2 Replies Latest reply: Jun 15, 2012 1:41 PM by allan_intel RSS

[Bug Report] GLSL compiler crashes when glsl code ends with #endif

Gunjambi Community Member
Currently Being Moderated

Renderer info:

GL_VENDOR:Intel
GL_RENDERER:Intel(R) HD Graphics 3000
GL_VERSION:3.1.0 - Build 8.15.10.2696

 

Description:

 

Code crashes somewhere in glCompileShader. Any whitespace characters after #endif prevents crash.

 

Code:


std::string shader_src =
"#ifdef DEFINED\r\n"
"out vec4 position;\r\n"
"void main() {position = vec4(1.0,1.0,1.0,1.0);} \r\n"
"#else\r\n"
"out vec4 position;\r\n"
"void main() {position = vec4(1.0,1.0,1.0,1.0);} \r\n"
"#endif";
std::string head = "#version 130\r\n#define DEFINED 1\r\n";

gl::GLint shader = gl::glCreateShader(gl::GL_VERTEX_SHADER);

const char* sources[] = {head.c_str(), shader_src.c_str()};
gl::GLint lens[] = {head.size(),shader_src.size()};

gl::glShaderSource(shader,2,sources,lens);
gl::glCompileShader(shader);

More Like This

  • Retrieving data ...

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points