Try to fix flat/smooth shade mode issue (caused shader mismatches)

This commit is contained in:
Henrik Rydgard 2014-12-02 01:13:26 +01:00
parent 1abadef87f
commit ff68e32f88
2 changed files with 6 additions and 3 deletions

View file

@ -573,13 +573,15 @@ void GenerateFragmentShader(char *buffer) {
bool enableColorDoubling = gstate.isColorDoublingEnabled() && gstate.isTextureMapEnabled();
bool doTextureProjection = gstate.getUVGenMode() == GE_TEXMAP_TEXTURE_MATRIX;
bool doTextureAlpha = gstate.isTextureAlphaUsed();
bool doFlatShading = gstate.getShadeMode() == GE_SHADE_FLAT && !gstate.isModeClear();
bool textureAtOffset = gstate_c.curTextureXOffset != 0 || gstate_c.curTextureYOffset != 0;
ReplaceBlendType replaceBlend = ReplaceBlendWithShader();
ReplaceAlphaType stencilToAlpha = ReplaceAlphaWithStencil(replaceBlend);
const char *shading = "";
if (glslES30)
shading = gstate.getShadeMode() == GE_SHADE_FLAT ? "flat" : "";
shading = doFlatShading ? "flat" : "";
if (gstate_c.textureFullAlpha && gstate.getTextureFunction() != GE_TEXFUNC_REPLACE)
doTextureAlpha = false;

View file

@ -52,7 +52,7 @@ void ComputeVertexShaderID(VertexShaderID *id, u32 vertType, int prim, bool useH
bool doTexture = gstate.isTextureMapEnabled() && !gstate.isModeClear();
bool doTextureProjection = gstate.getUVGenMode() == GE_TEXMAP_TEXTURE_MATRIX;
bool doShadeMapping = gstate.getUVGenMode() == GE_TEXMAP_ENVIRONMENT_MAP;
bool doFlatShading = gstate.getShadeMode() == GE_SHADE_FLAT;
bool doFlatShading = gstate.getShadeMode() == GE_SHADE_FLAT && !gstate.isModeClear();
bool hasColor = (vertType & GE_VTYPE_COL_MASK) != 0;
bool hasNormal = (vertType & GE_VTYPE_NRM_MASK) != 0;
@ -215,6 +215,7 @@ void GenerateVertexShader(int prim, u32 vertType, char *buffer, bool useHWTransf
bool doTexture = gstate.isTextureMapEnabled() && !gstate.isModeClear();
bool doTextureProjection = gstate.getUVGenMode() == GE_TEXMAP_TEXTURE_MATRIX;
bool doShadeMapping = gstate.getUVGenMode() == GE_TEXMAP_ENVIRONMENT_MAP;
bool doFlatShading = gstate.getShadeMode() == GE_SHADE_FLAT && !gstate.isModeClear();
bool hasColor = (vertType & GE_VTYPE_COL_MASK) != 0 || !useHWTransform;
bool hasNormal = (vertType & GE_VTYPE_NRM_MASK) != 0 && useHWTransform;
@ -226,7 +227,7 @@ void GenerateVertexShader(int prim, u32 vertType, char *buffer, bool useHWTransf
const char *shading = "";
if (glslES30)
shading = gstate.getShadeMode() == GE_SHADE_FLAT ? "flat" : "";
shading = doFlatShading ? "flat" : "";
DoLightComputation doLight[4] = {LIGHT_OFF, LIGHT_OFF, LIGHT_OFF, LIGHT_OFF};
if (useHWTransform) {