mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-03 12:12:06 +00:00
Use lightning GE state accessors where appropriate.
This commit is contained in:
parent
c0da6b97c5
commit
988614f6d0
@ -110,7 +110,7 @@ void ComputeFragmentShaderID(FragmentShaderID *id) {
|
||||
// We only need one clear shader, so let's ignore the rest of the bits.
|
||||
id->d[0] = 1;
|
||||
} else {
|
||||
int lmode = (gstate.lmode & 1) && gstate.isLightingEnabled();
|
||||
bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled();
|
||||
bool enableFog = gstate.isFogEnabled() && !gstate.isModeThrough();
|
||||
bool enableAlphaTest = gstate.isAlphaTestEnabled() && !IsAlphaTestTriviallyTrue();
|
||||
bool enableColorTest = gstate.isColorTestEnabled() && !IsColorTestTriviallyTrue();
|
||||
@ -156,8 +156,8 @@ void GenerateFragmentShader(char *buffer) {
|
||||
WRITE(p, "#version 110\n");
|
||||
#endif
|
||||
|
||||
int lmode = (gstate.lmode & 1) && gstate.isLightingEnabled();
|
||||
int doTexture = gstate.isTextureMapEnabled() && !gstate.isModeClear();
|
||||
bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled();
|
||||
bool doTexture = gstate.isTextureMapEnabled() && !gstate.isModeClear();
|
||||
bool enableFog = gstate.isFogEnabled() && !gstate.isModeThrough() && !gstate.isModeClear();
|
||||
bool enableAlphaTest = gstate.isAlphaTestEnabled() && !IsAlphaTestTriviallyTrue() && !gstate.isModeClear();
|
||||
bool enableColorTest = gstate.isColorTestEnabled() && !IsColorTestTriviallyTrue() && !gstate.isModeClear();
|
||||
|
@ -398,10 +398,10 @@ void LinkedShader::updateUniforms() {
|
||||
|
||||
// Lighting
|
||||
if (u_ambient != -1 && (dirtyUniforms & DIRTY_AMBIENT)) {
|
||||
SetColorUniform3Alpha(u_ambient, gstate.ambientcolor, gstate.ambientalpha & 0xFF);
|
||||
SetColorUniform3Alpha(u_ambient, gstate.ambientcolor, gstate.getAmbientA());
|
||||
}
|
||||
if (u_matambientalpha != -1 && (dirtyUniforms & DIRTY_MATAMBIENTALPHA)) {
|
||||
SetColorUniform3Alpha(u_matambientalpha, gstate.materialambient, gstate.materialalpha & 0xFF);
|
||||
SetColorUniform3Alpha(u_matambientalpha, gstate.materialambient, gstate.getMaterialAmbientA());
|
||||
}
|
||||
if (u_matdiffuse != -1 && (dirtyUniforms & DIRTY_MATDIFFUSE)) {
|
||||
SetColorUniform3(u_matdiffuse, gstate.materialdiffuse);
|
||||
|
@ -505,7 +505,7 @@ void TransformDrawEngine::SoftwareTransformAndDraw(
|
||||
int prim, u8 *decoded, LinkedShader *program, int vertexCount, u32 vertType, void *inds, int indexType, const DecVtxFormat &decVtxFormat, int maxIndex) {
|
||||
|
||||
bool throughmode = (vertType & GE_VTYPE_THROUGH_MASK) != 0;
|
||||
bool lmode = (gstate.lmode & 1) && gstate.isLightingEnabled();
|
||||
bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled();
|
||||
|
||||
// TODO: Split up into multiple draw calls for GLES 2.0 where you can't guarantee support for more than 0x10000 verts.
|
||||
|
||||
@ -549,10 +549,10 @@ void TransformDrawEngine::SoftwareTransformAndDraw(
|
||||
c1[j] = 0.0f;
|
||||
}
|
||||
} else {
|
||||
c0[0] = (gstate.materialambient & 0xFF) / 255.f;
|
||||
c0[1] = ((gstate.materialambient >> 8) & 0xFF) / 255.f;
|
||||
c0[2] = ((gstate.materialambient >> 16) & 0xFF) / 255.f;
|
||||
c0[3] = (gstate.materialalpha & 0xFF) / 255.f;
|
||||
c0[0] = gstate.getMaterialAmbientR() / 255.f;
|
||||
c0[1] = gstate.getMaterialAmbientG() / 255.f;
|
||||
c0[2] = gstate.getMaterialAmbientB() / 255.f;
|
||||
c0[3] = gstate.getMaterialAmbientA() / 255.f;
|
||||
}
|
||||
|
||||
if (reader.hasUV()) {
|
||||
@ -612,10 +612,10 @@ void TransformDrawEngine::SoftwareTransformAndDraw(
|
||||
if (reader.hasColor0()) {
|
||||
reader.ReadColor0(unlitColor);
|
||||
} else {
|
||||
unlitColor[0] = (gstate.materialambient & 0xFF) / 255.f;
|
||||
unlitColor[1] = ((gstate.materialambient >> 8) & 0xFF) / 255.f;
|
||||
unlitColor[2] = ((gstate.materialambient >> 16) & 0xFF) / 255.f;
|
||||
unlitColor[3] = (gstate.materialalpha & 0xFF) / 255.f;
|
||||
unlitColor[0] = gstate.getMaterialAmbientR() / 255.f;
|
||||
unlitColor[1] = gstate.getMaterialAmbientG() / 255.f;
|
||||
unlitColor[2] = gstate.getMaterialAmbientB() / 255.f;
|
||||
unlitColor[3] = gstate.getMaterialAmbientA() / 255.f;
|
||||
}
|
||||
float litColor0[4];
|
||||
float litColor1[4];
|
||||
@ -643,10 +643,10 @@ void TransformDrawEngine::SoftwareTransformAndDraw(
|
||||
c0[j] = unlitColor[j];
|
||||
}
|
||||
} else {
|
||||
c0[0] = (gstate.materialambient & 0xFF) / 255.f;
|
||||
c0[1] = ((gstate.materialambient >> 8) & 0xFF) / 255.f;
|
||||
c0[2] = ((gstate.materialambient >> 16)& 0xFF) / 255.f;
|
||||
c0[3] = (gstate.materialalpha & 0xFF) / 255.f;
|
||||
c0[0] = gstate.getMaterialAmbientR() / 255.f;
|
||||
c0[1] = gstate.getMaterialAmbientG() / 255.f;
|
||||
c0[2] = gstate.getMaterialAmbientB() / 255.f;
|
||||
c0[3] = gstate.getMaterialAmbientA() / 255.f;
|
||||
}
|
||||
if (lmode) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
|
@ -54,7 +54,7 @@ void ComputeVertexShaderID(VertexShaderID *id, int prim, bool useHWTransform) {
|
||||
bool hasNormal = (vertType & GE_VTYPE_NRM_MASK) != 0;
|
||||
bool hasBones = (vertType & GE_VTYPE_WEIGHT_MASK) != 0;
|
||||
bool enableFog = gstate.isFogEnabled() && !gstate.isModeThrough() && !gstate.isModeClear();
|
||||
bool lmode = (gstate.lmode & 1) && gstate.isLightingEnabled();
|
||||
bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled();
|
||||
|
||||
memset(id->d, 0, sizeof(id->d));
|
||||
id->d[0] = lmode & 1;
|
||||
@ -142,7 +142,7 @@ void GenerateVertexShader(int prim, char *buffer, bool useHWTransform) {
|
||||
#endif
|
||||
const u32 vertType = gstate.vertType;
|
||||
|
||||
int lmode = (gstate.lmode & 1) && gstate.isLightingEnabled();
|
||||
int lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled();
|
||||
int doTexture = gstate.isTextureMapEnabled() && !gstate.isModeClear();
|
||||
|
||||
bool hasColor = (vertType & GE_VTYPE_COL_MASK) != 0 || !useHWTransform;
|
||||
|
Loading…
x
Reference in New Issue
Block a user