From 3e7f6b57aaaffc2eef534aae3b786e8942475593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 11 Sep 2022 16:17:38 +0200 Subject: [PATCH] Shadergen issues found by the test --- Common/GPU/ShaderWriter.cpp | 2 +- GPU/Common/FragmentShaderGenerator.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Common/GPU/ShaderWriter.cpp b/Common/GPU/ShaderWriter.cpp index 62d5760408..b260d05fc9 100644 --- a/Common/GPU/ShaderWriter.cpp +++ b/Common/GPU/ShaderWriter.cpp @@ -453,7 +453,7 @@ ShaderWriter &ShaderWriter::LoadTexture2D(const char *sampName, const char *uv, break; default: // Note: we ignore the sampler. make sure you bound samplers to the textures correctly. - F("texelFetch(%s, %s, %d)", lang_.texture, sampName, uv, level); + F("texelFetch(%s, %s, %d)", sampName, uv, level); break; } return *this; diff --git a/GPU/Common/FragmentShaderGenerator.cpp b/GPU/Common/FragmentShaderGenerator.cpp index d1aabac698..fe3d685f28 100644 --- a/GPU/Common/FragmentShaderGenerator.cpp +++ b/GPU/Common/FragmentShaderGenerator.cpp @@ -96,7 +96,10 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu if (texture3D) { shaderDepalMode = ShaderDepalMode::OFF; } - + if (!compat.bitwiseOps && shaderDepalMode != ShaderDepalMode::OFF) { + *errorString = "depal requires bitwise ops"; + return false; + } bool bgraTexture = id.Bit(FS_BIT_BGRA_TEXTURE); bool colorWriteMask = id.Bit(FS_BIT_COLOR_WRITEMASK) && compat.bitwiseOps; @@ -732,7 +735,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu break; case ShaderDepalMode::CLUT8_8888: // Not yet implemented. - WRITE(p, " t = vec4(0.0, 0.0, 0.0, 0.0);\n"); + WRITE(p, " vec4 t = vec4(0.0, 0.0, 0.0, 0.0);\n"); break; }