cancel
Showing results for 
Search instead for 
Did you mean: 

OpenGL & Vulkan

lukcho
Journeyman III
Journeyman III

GLSL compiler bug

I dont know if this is the right forum for bug reports, but i could not find better one. Anyway here is the bug i found:

this fragment shader

#version 330
out vec4 color0;
void main() {
     const float a = 1;
     float b = clamp(a, 0, 1);
     color0 = vec4(b);
}

outputs vec4(0,0,0,0) instead of vec4(1,1,1,1).

if either the const qualifier for "a" or the clamp operation is removed, the shader will work correctly.

neither the shader version nor the shader type are important - happens with all versions and all shader types

 

Edit:

also tested it with the GPU Shader Analyser tool (very nice tool by the way) and it shows this assembly code:

; -------- Disassembly --------------------
00 ALU: ADDR(32) CNT(1)
0 x: MOV R0.x, 0.0f
01 EXP_DONE: PIX0, R0.xxxx
END_OF_PROGRAM

appears to be a bug with the compiler const-folding

 



Tags (1)
0 Kudos
Reply
4 Replies
gsellers
Staff
Staff

GLSL compiler bug

Thanks for the report. I'll forward it to our compiler guys and see if we can get to the bottom of it.

Cheers,

Graham

0 Kudos
Reply
farosis
Adept I
Adept I

GLSL compiler bug

It fixed, you can get it from a future driver release. thanks for reporting the issue.

0 Kudos
Reply
lukcho
Journeyman III
Journeyman III

Re: GLSL compiler bug

Thank you very much!

By the way, I wanted to ask, where is the preferred place to post AMD opengl driver bug reports, here or in the opengl forums?

I have posted several other bugs there too and there is one guy from AMD that replies, but I can post here if it is more appropriate.

0 Kudos
Reply
pillum
Adept II
Adept II

Re: GLSL compiler bug

OpenGL forum is better for bugs in the specification,

but this forum is more fitting for this kind of bug

since you are directly talking to AMD guys who are responsible for the AMD implementation.

0 Kudos
Reply