gles: fix crashing on mali gpus (#6956)

* gles: reorder framebuffer fetch extension directives

* Address review comments
This commit is contained in:
Vitor K 2023-09-10 18:30:30 -03:00 committed by GitHub
parent 0b0d3a4ac3
commit bbb47cd753
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1351,21 +1351,22 @@ ShaderDecompiler::ProgramResult GenerateFragmentShader(const PicaFSConfig& confi
out += "#extension GL_ARB_separate_shader_objects : enable\n"; out += "#extension GL_ARB_separate_shader_objects : enable\n";
} }
if (GLES) { // The extension directives need to come before non-preprocessor tokens
out += fragment_shader_precision_OES;
}
out += R"( out += R"(
#if defined(GL_EXT_shader_framebuffer_fetch) #if defined(GL_EXT_shader_framebuffer_fetch)
#extension GL_EXT_shader_framebuffer_fetch : enable #extension GL_EXT_shader_framebuffer_fetch : enable
#elif defined(GL_ARM_shader_framebuffer_fetch) #elif defined(GL_ARM_shader_framebuffer_fetch)
#extension GL_ARM_shader_framebuffer_fetch : enable #extension GL_ARM_shader_framebuffer_fetch : enable
#else #else
layout(location = 10) uniform sampler2D colorBuffer; #define CITRA_NO_FRAMEBUFFER_FETCH 1
#endif #endif
)"; )";
if (GLES) {
out += fragment_shader_precision_OES;
}
out += GetVertexInterfaceDeclaration(false, separable_shader); out += GetVertexInterfaceDeclaration(false, separable_shader);
out += R"( out += R"(
@ -1391,6 +1392,10 @@ layout(binding = 3, r32ui) uniform readonly uimage2D shadow_texture_ny;
layout(binding = 4, r32ui) uniform readonly uimage2D shadow_texture_pz; layout(binding = 4, r32ui) uniform readonly uimage2D shadow_texture_pz;
layout(binding = 5, r32ui) uniform readonly uimage2D shadow_texture_nz; layout(binding = 5, r32ui) uniform readonly uimage2D shadow_texture_nz;
layout(binding = 6, r32ui) uniform uimage2D shadow_buffer; layout(binding = 6, r32ui) uniform uimage2D shadow_buffer;
#if defined(CITRA_NO_FRAMEBUFFER_FETCH)
layout(location = 10) uniform sampler2D colorBuffer;
#endif
)"; )";
out += UniformBlockDef; out += UniformBlockDef;