From 8d4bb10d443060dc56d6c6ddd9b84bbea00874d3 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sat, 10 Nov 2018 02:41:33 -0300 Subject: gl_shader_decompiler: Guard out of bound geometry shader input reads Geometry shaders follow a pattern that results in out of bound reads. This pattern is: - VSETP to predicate - Use that predicate to conditionally set a register a big number - Use the register to access geometry shaders At the time of writing this commit I don't know what's the intent of this number. Some drivers argue about these out of bound reads. To avoid this issue, input reads are guarded limiting reads to the highest posible vertex input of the current topology (e.g. points to 1 and triangles to 3). --- src/video_core/renderer_opengl/gl_shader_gen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/video_core/renderer_opengl/gl_shader_gen.cpp') diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index 9d17edd63..eea090e52 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -82,8 +82,8 @@ void main() { } ProgramResult GenerateGeometryShader(const ShaderSetup& setup) { - std::string out = "#version 430 core\n"; - out += "#extension GL_ARB_separate_shader_objects : enable\n\n"; + // Version is intentionally skipped in shader generation, it's added by the lazy compilation. + std::string out = "#extension GL_ARB_separate_shader_objects : enable\n\n"; out += Decompiler::GetCommonDeclarations(); out += "bool exec_geometry();\n"; -- cgit v1.2.3