From 68bdd959763ffd00a1fffd506585999356bf9786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 26 Oct 2022 23:48:45 +0200 Subject: [PATCH] Shadergen fix for OpenGL --- GPU/Common/FragmentShaderGenerator.cpp | 5 +++++ GPU/Common/ShaderId.cpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/GPU/Common/FragmentShaderGenerator.cpp b/GPU/Common/FragmentShaderGenerator.cpp index 879552e25373..7f09f7c390e6 100644 --- a/GPU/Common/FragmentShaderGenerator.cpp +++ b/GPU/Common/FragmentShaderGenerator.cpp @@ -113,6 +113,10 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu *errorString = "Invalid combination of 3D texture and array texture, shouldn't happen"; return false; } + if (compat.shaderLanguage != ShaderLanguage::GLSL_VULKAN && arrayTexture) { + *errorString = "We only do array textures for framebuffers in Vulkan."; + return false; + } bool flatBug = bugs.Has(Draw::Bugs::BROKEN_FLAT_IN_SHADER) && g_Config.bVendorBugChecksEnabled; @@ -660,6 +664,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu WRITE(p, " vec4 t = %s(tex, vec3(%s.xy, u_mipBias));\n", compat.texture3D, texcoord); } } else if (arrayTexture) { + _dbg_assert_(compat.shaderLanguage == GLSL_VULKAN); // Used for stereo rendering. const char *arrayIndex = useStereo ? "float(gl_ViewIndex)" : "0.0"; if (doTextureProjection) { diff --git a/GPU/Common/ShaderId.cpp b/GPU/Common/ShaderId.cpp index 9110ca744329..aee52476cf76 100644 --- a/GPU/Common/ShaderId.cpp +++ b/GPU/Common/ShaderId.cpp @@ -368,8 +368,8 @@ void ComputeFragmentShaderID(FShaderID *id_out, const ComputedPipelineState &pip id.SetBit(FS_BIT_FLATSHADE, doFlatShading); id.SetBit(FS_BIT_COLOR_WRITEMASK, colorWriteMask); - // All framebuffers are array textures now. - if (gstate_c.arrayTexture) { + // All framebuffers are array textures in Vulkan now. + if (gstate_c.arrayTexture && g_Config.iGPUBackend == (int)GPUBackend::VULKAN) { id.SetBit(FS_BIT_SAMPLE_ARRAY_TEXTURE); }