Skip to content

Commit

Permalink
DRIVERS: shader source components, len=0 => ""
Browse files Browse the repository at this point in the history
Another bug found in AMD .13399 drivers... (QW-Group#416)
  • Loading branch information
meag committed Jul 20, 2021
1 parent 2808f33 commit 32f263e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gl_program.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ static int GL_InsertDefinitions(
static unsigned char *glsl_constants_glsl = (unsigned char *)"", *glsl_common_glsl = (unsigned char *)"";
unsigned int glsl_constants_glsl_len = 0, glsl_common_glsl_len = 0;
const char* break_point;
int i;

if (!strings[0] || !strings[0][0]) {
return 0;
Expand Down Expand Up @@ -569,6 +570,14 @@ static int GL_InsertDefinitions(
strings[1] = (const char*)glsl_constants_glsl;

return 6;
// Some drivers interpret length 0 as nul terminated
// spec is < 0 (https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glShaderSource.xhtml)
for (i = 0; i < MAX_SHADER_COMPONENTS; ++i) {
if (lengths[i] == 0) {
strings[i] = "";
}
}

}

return 1;
Expand Down

0 comments on commit 32f263e

Please sign in to comment.