From 3e011238c5002e303da2da881405fd5d36ebf73a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 30 Nov 2017 22:44:39 +0100 Subject: [PATCH] Fix minor discrepancy in shader ID calculation, I don't think this will fix anything though. Bumping shader cache version and doing minor cleanup too. --- GPU/Common/ShaderId.cpp | 6 +++--- GPU/Common/SoftwareTransformCommon.cpp | 1 - GPU/GLES/ShaderManagerGLES.cpp | 2 +- GPU/GLES/VertexShaderGeneratorGLES.cpp | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/GPU/Common/ShaderId.cpp b/GPU/Common/ShaderId.cpp index d7975f1443..6329103da4 100644 --- a/GPU/Common/ShaderId.cpp +++ b/GPU/Common/ShaderId.cpp @@ -57,6 +57,7 @@ std::string VertexShaderDesc(const ShaderID &id) { } void ComputeVertexShaderID(ShaderID *id_out, u32 vertType, bool useHWTransform) { + bool isModeThrough = gstate.isModeThrough(); bool doTexture = gstate.isTextureMapEnabled() && !gstate.isModeClear(); bool doTextureTransform = gstate.getUVGenMode() == GE_TEXMAP_TEXTURE_MATRIX; bool doShadeMapping = doTexture && (gstate.getUVGenMode() == GE_TEXMAP_ENVIRONMENT_MAP); @@ -71,9 +72,8 @@ void ComputeVertexShaderID(ShaderID *id_out, u32 vertType, bool useHWTransform) bool hasColorTess = (gstate.vertType & GE_VTYPE_COL_MASK) != 0 && (doBezier || doSpline); bool hasTexcoordTess = (gstate.vertType & GE_VTYPE_TC_MASK) != 0 && (doBezier || doSpline); - bool enableFog = gstate.isFogEnabled() && !gstate.isModeThrough() && !gstate.isModeClear(); - bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled(); - // lmode: && !isModeThrough!? + bool enableFog = gstate.isFogEnabled() && !isModeThrough && !gstate.isModeClear(); + bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled() && !isModeThrough; ShaderID id; id.SetBit(VS_BIT_LMODE, lmode); diff --git a/GPU/Common/SoftwareTransformCommon.cpp b/GPU/Common/SoftwareTransformCommon.cpp index 4ec1aa4e70..a7f0410038 100644 --- a/GPU/Common/SoftwareTransformCommon.cpp +++ b/GPU/Common/SoftwareTransformCommon.cpp @@ -207,7 +207,6 @@ void SoftwareTransform( float uv[3] = {0, 0, 1}; float fogCoef = 1.0f; - // We do software T&L for now float out[3]; float pos[3]; Vec3f normal(0, 0, 1); diff --git a/GPU/GLES/ShaderManagerGLES.cpp b/GPU/GLES/ShaderManagerGLES.cpp index 461384eb70..a4b43c14cc 100644 --- a/GPU/GLES/ShaderManagerGLES.cpp +++ b/GPU/GLES/ShaderManagerGLES.cpp @@ -930,7 +930,7 @@ std::string ShaderManagerGLES::DebugGetShaderString(std::string id, DebugShaderT // as sometimes these features might have an effect on the ID bits. #define CACHE_HEADER_MAGIC 0x83277592 -#define CACHE_VERSION 4 +#define CACHE_VERSION 5 struct CacheHeader { uint32_t magic; uint32_t version; diff --git a/GPU/GLES/VertexShaderGeneratorGLES.cpp b/GPU/GLES/VertexShaderGeneratorGLES.cpp index a6087f33e1..c974af4a1f 100644 --- a/GPU/GLES/VertexShaderGeneratorGLES.cpp +++ b/GPU/GLES/VertexShaderGeneratorGLES.cpp @@ -112,7 +112,7 @@ void GenerateVertexShader(const ShaderID &id, char *buffer, uint32_t *attrMask, bool highpTexcoord = false; if (gl_extensions.IsGLES) { - if (gstate_c.featureFlags & GPU_SUPPORTS_GLSL_ES_300) { + if (gstate_c.Supports(GPU_SUPPORTS_GLSL_ES_300)) { WRITE(p, "#version 300 es\n"); glslES30 = true; texelFetch = "texelFetch";