mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 23:40:39 +00:00
d3d9: Remove the old shader id gen.
This commit is contained in:
parent
06f2c7f1fe
commit
6b905e8e18
@ -36,81 +36,6 @@
|
||||
|
||||
namespace DX9 {
|
||||
|
||||
bool CanUseHardwareTransformDX9(int prim) {
|
||||
if (!g_Config.bHardwareTransform)
|
||||
return false;
|
||||
return !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES;
|
||||
}
|
||||
|
||||
// prim so we can special case for RECTANGLES :(
|
||||
void ComputeVertexShaderIDDX9(ShaderID *id, u32 vertType, bool useHWTransform) {
|
||||
bool doTexture = gstate.isTextureMapEnabled() && !gstate.isModeClear();
|
||||
bool doTextureProjection = gstate.getUVGenMode() == GE_TEXMAP_TEXTURE_MATRIX;
|
||||
bool doShadeMapping = gstate.getUVGenMode() == GE_TEXMAP_ENVIRONMENT_MAP;
|
||||
|
||||
bool hasColor = (vertType & GE_VTYPE_COL_MASK) != 0;
|
||||
bool hasNormal = (vertType & GE_VTYPE_NRM_MASK) != 0;
|
||||
bool hasTexcoord = (vertType & GE_VTYPE_TC_MASK) != 0;
|
||||
bool enableFog = gstate.isFogEnabled() && !gstate.isModeThrough() && !gstate.isModeClear();
|
||||
bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled();
|
||||
|
||||
int id0 = 0;
|
||||
int id1 = 0;
|
||||
|
||||
id0 = lmode & 1;
|
||||
id0 |= (gstate.isModeThrough() & 1) << 1;
|
||||
id0 |= (enableFog & 1) << 2;
|
||||
id0 |= (hasColor & 1) << 3;
|
||||
if (doTexture) {
|
||||
id0 |= 1 << 4;
|
||||
id0 |= (gstate_c.flipTexture & 1) << 5;
|
||||
id0 |= (doTextureProjection & 1) << 6;
|
||||
}
|
||||
|
||||
if (useHWTransform) {
|
||||
id0 |= 1 << 8;
|
||||
id0 |= (hasNormal & 1) << 9;
|
||||
|
||||
// UV generation mode
|
||||
id0 |= gstate.getUVGenMode() << 16;
|
||||
|
||||
// The next bits are used differently depending on UVgen mode
|
||||
if (doTextureProjection) {
|
||||
id0 |= gstate.getUVProjMode() << 18;
|
||||
} else if (doShadeMapping) {
|
||||
id0 |= gstate.getUVLS0() << 18;
|
||||
id0 |= gstate.getUVLS1() << 20;
|
||||
}
|
||||
|
||||
// Bones
|
||||
if (vertTypeIsSkinningEnabled(vertType))
|
||||
id0 |= (TranslateNumBones(vertTypeGetNumBoneWeights(vertType)) - 1) << 22;
|
||||
|
||||
// Okay, d[1] coming up. ==============
|
||||
|
||||
if (gstate.isLightingEnabled() || doShadeMapping) {
|
||||
// Light bits
|
||||
for (int i = 0; i < 4; i++) {
|
||||
id1 |= gstate.getLightComputation(i) << (i * 4);
|
||||
id1 |= gstate.getLightType(i) << (i * 4 + 2);
|
||||
}
|
||||
id1 |= (gstate.materialupdate & 7) << 16;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
id1 |= (gstate.isLightChanEnabled(i) & 1) << (20 + i);
|
||||
}
|
||||
// doShadeMapping is stored as UVGenMode, so this is enough for isLightingEnabled.
|
||||
id1 |= 1 << 24;
|
||||
}
|
||||
// 2 bits.
|
||||
id1 |= (vertTypeGetWeightMask(vertType) >> GE_VTYPE_WEIGHT_SHIFT) << 25;
|
||||
id1 |= (gstate.areNormalsReversed() & 1) << 27;
|
||||
id1 |= (hasTexcoord & 1) << 28;
|
||||
}
|
||||
|
||||
id->d[0] = id0;
|
||||
id->d[1] = id1;
|
||||
}
|
||||
|
||||
static const char * const boneWeightAttrDecl[9] = {
|
||||
"#ERROR#",
|
||||
"float a_w1:TEXCOORD1;\n",
|
||||
|
Loading…
Reference in New Issue
Block a user