diff --git a/GPU/Common/ShaderId.cpp b/GPU/Common/ShaderId.cpp index f48ac546e8..e05e976a9f 100644 --- a/GPU/Common/ShaderId.cpp +++ b/GPU/Common/ShaderId.cpp @@ -166,12 +166,13 @@ void ComputeVertexShaderID(VShaderID *id_out, u32 vertType, bool useHWTransform, *id_out = id; } - static const char * const alphaTestFuncs[] = { "NEVER", "ALWAYS", "==", "!=", "<", "<=", ">", ">=" }; +static_assert(ARRAY_SIZE(alphaTestFuncs) == 8); static const char * const logicFuncs[] = { "CLEAR", "AND", "AND_REV", "COPY", "AND_INV", "NOOP", "XOR", "OR", "NOR", "EQUIV", "INVERTED", "OR_REV", "COPY_INV", "OR_INV", "NAND", "SET", }; +static_assert(ARRAY_SIZE(logicFuncs) == 16); static bool MatrixNeedsProjection(const float m[12], GETexProjMapMode mode) { // For GE_PROJMAP_UV, we can ignore m[8] since it multiplies to zero. diff --git a/GPU/Common/ShaderUniforms.cpp b/GPU/Common/ShaderUniforms.cpp index 7f07262c4d..5895ba9b28 100644 --- a/GPU/Common/ShaderUniforms.cpp +++ b/GPU/Common/ShaderUniforms.cpp @@ -90,7 +90,6 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool useBuffe ub->rasterOffset[1] = gstate.getOffsetY(); ub->minZmaxZ[0] = (float)gstate.getDepthRangeMin(); ub->minZmaxZ[1] = (float)gstate.getDepthRangeMax(); - // test sine wave // ub->minZmaxZ[0] = (sin(time_now_d()) * 0.5f + 0.5f) * 65536.0; } diff --git a/GPU/Common/ShaderUniforms.h b/GPU/Common/ShaderUniforms.h index fae84d99e3..68162f9969 100644 --- a/GPU/Common/ShaderUniforms.h +++ b/GPU/Common/ShaderUniforms.h @@ -127,17 +127,13 @@ void UpdateFogCoef(const GEState &state, float fogCoef[2]); // This happens so much that I want it inline. inline void UpdateUVScaleOff(const GEState &state, float uvScaleOff[4]) { - float widthFactor; - float heightFactor; if (gstate_c.textureIsFramebuffer) { - widthFactor = (float)gstate.getTextureWidth(0) / (float)gstate_c.curTextureWidth; - heightFactor = (float)gstate.getTextureHeight(0) / (float)gstate_c.curTextureHeight; + uvScaleOff[0] = (float)gstate.getTextureWidth(0) / (float)gstate_c.curTextureWidth; + uvScaleOff[1] = (float)gstate.getTextureHeight(0) / (float)gstate_c.curTextureHeight; } else { - widthFactor = 1.0f; - heightFactor = 1.0f; + uvScaleOff[0] = 1.0f; + uvScaleOff[1] = 1.0f; } - uvScaleOff[0] = widthFactor; - uvScaleOff[1] = heightFactor; uvScaleOff[2] = 0.0f; uvScaleOff[3] = 0.0f; } diff --git a/GPU/GPUCommonHW.cpp b/GPU/GPUCommonHW.cpp index 8cf35e046d..fa0f8c2545 100644 --- a/GPU/GPUCommonHW.cpp +++ b/GPU/GPUCommonHW.cpp @@ -621,6 +621,13 @@ u32 GPUCommonHW::CheckGPUFeatures() const { features |= GPU_USE_VS_RANGE_CULLING; } + // Set this to true to easily test our fallback shaders for depth clamp and min/max clipping. + // DO NOT check that in! This should be false normally. + constexpr bool simulateOldMali = false; + if (simulateOldMali) { + features &= ~(GPU_USE_CLIP_DISTANCE | GPU_USE_CULL_DISTANCE | GPU_USE_DEPTH_CLAMP); + } + return features; }