If we can predict that the texcoord.z will always be 1.0 after the matrix, skip texture projection. Should help #9189

This commit is contained in:
Henrik Rydgard 2017-01-30 16:01:00 +01:00
parent 24cc3dbc70
commit 0e4fb11a2d
2 changed files with 6 additions and 2 deletions

View file

@ -149,6 +149,10 @@ void ComputeVertexShaderID(ShaderID *id_out, u32 vertType, bool useHWTransform)
static const char *alphaTestFuncs[] = { "NEVER", "ALWAYS", "==", "!=", "<", "<=", ">", ">=" };
static bool MatrixNeedsProjection(const float m[12]) {
return m[2] != 0.0f || m[5] != 0.0f || m[8] != 0.0f || m[11] != 1.0f;
}
std::string FragmentShaderDesc(const ShaderID &id) {
std::stringstream desc;
desc << StringFromFormat("%08x:%08x ", id.d[1], id.d[0]);
@ -224,7 +228,7 @@ void ComputeFragmentShaderID(ShaderID *id_out) {
bool enableAlphaTest = gstate.isAlphaTestEnabled() && !IsAlphaTestTriviallyTrue() && !g_Config.bDisableAlphaTest;
bool enableColorTest = gstate.isColorTestEnabled() && !IsColorTestTriviallyTrue();
bool enableColorDoubling = gstate.isColorDoublingEnabled() && gstate.isTextureMapEnabled();
bool doTextureProjection = gstate.getUVGenMode() == GE_TEXMAP_TEXTURE_MATRIX;
bool doTextureProjection = (gstate.getUVGenMode() == GE_TEXMAP_TEXTURE_MATRIX && MatrixNeedsProjection(gstate.tgenMatrix));
bool doTextureAlpha = gstate.isTextureAlphaUsed();
bool doFlatShading = gstate.getShadeMode() == GE_SHADE_FLAT;

View file

@ -993,7 +993,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 2
#define CACHE_VERSION 3
struct CacheHeader {
uint32_t magic;
uint32_t version;