Shadergen fix for OpenGL

This commit is contained in:
Henrik Rydgård 2022-10-26 23:48:45 +02:00
parent 1da6d29a0f
commit e058f8aee6
2 changed files with 7 additions and 2 deletions

View file

@ -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) {

View file

@ -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);
}