mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
GPU: Ignore color write mask if unusable.
We unconditionally attempt to use a shader with color write mask, so we can't just refuse to generate a shader - it'll mean non-supporting devices get no shader at all. It's better to continue ignoring the mask in that case.
This commit is contained in:
parent
fa466d2363
commit
4006a4b143
1 changed files with 3 additions and 9 deletions
|
@ -81,12 +81,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
|
|||
bool doFlatShading = id.Bit(FS_BIT_FLATSHADE) && !bugs.Has(Draw::Bugs::BROKEN_FLAT_IN_SHADER);
|
||||
bool shaderDepal = id.Bit(FS_BIT_SHADER_DEPAL);
|
||||
bool bgraTexture = id.Bit(FS_BIT_BGRA_TEXTURE);
|
||||
bool colorWriteMask = id.Bit(FS_BIT_COLOR_WRITEMASK);
|
||||
|
||||
if (colorWriteMask && !compat.bitwiseOps) {
|
||||
*errorString = "Color Write Mask requires bitwise ops";
|
||||
return false;
|
||||
}
|
||||
bool colorWriteMask = id.Bit(FS_BIT_COLOR_WRITEMASK) && compat.bitwiseOps;
|
||||
|
||||
GEComparison alphaTestFunc = (GEComparison)id.Bits(FS_BIT_ALPHA_TEST_FUNC, 3);
|
||||
GEComparison colorTestFunc = (GEComparison)id.Bits(FS_BIT_COLOR_TEST_FUNC, 2);
|
||||
|
@ -299,7 +294,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
|
|||
WRITE(p, "float3 u_fogcolor : register(c%i);\n", CONST_PS_FOGCOLOR);
|
||||
}
|
||||
} else if (ShaderLanguageIsOpenGL(compat.shaderLanguage)) {
|
||||
if (shaderDepal && gl_extensions.IsGLES) {
|
||||
if ((shaderDepal || colorWriteMask) && gl_extensions.IsGLES) {
|
||||
WRITE(p, "precision highp int;\n");
|
||||
}
|
||||
|
||||
|
@ -819,10 +814,9 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
|
|||
WRITE(p, " vec3 colortest = roundAndScaleTo255v(v.rgb);\n");
|
||||
WRITE(p, " if ((colortest.r %s u_alphacolorref.r) && (colortest.g %s u_alphacolorref.g) && (colortest.b %s u_alphacolorref.b)) %s\n", test, test, test, discardStatement);
|
||||
} else if (compat.bitwiseOps) {
|
||||
// Apparently GLES3 does not support vector bitwise ops.
|
||||
WRITE(p, " ivec3 v_scaled = roundAndScaleTo255iv(v.rgb);\n");
|
||||
if (compat.shaderLanguage == GLSL_VULKAN) {
|
||||
// TODO: Use this for GL as well?
|
||||
// Apparently GLES3 does not support vector bitwise ops, but Vulkan does?
|
||||
WRITE(p, " if ((v_scaled & u_alphacolormask.rgb) %s (u_alphacolorref.rgb & u_alphacolormask.rgb)) %s\n", colorTestFuncs[colorTestFunc], discardStatement);
|
||||
} else {
|
||||
const char *maskedFragColor = "ivec3(v_scaled.r & u_alphacolormask.r, v_scaled.g & u_alphacolormask.g, v_scaled.b & u_alphacolormask.b)";
|
||||
|
|
Loading…
Add table
Reference in a new issue