<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - corrupted GLSL built-in function results when using Uniform Buffer contents as arguments"
href="https://bugs.freedesktop.org/show_bug.cgi?id=57121#c7">Comment # 7</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - corrupted GLSL built-in function results when using Uniform Buffer contents as arguments"
href="https://bugs.freedesktop.org/show_bug.cgi?id=57121">bug 57121</a>
from <span class="vcard"><a class="email" href="mailto:tomek-k@wp.eu" title="Tomasz Kaźmierczak <tomek-k@wp.eu>"> <span class="fn">Tomasz Kaźmierczak</span></a>
</span></b>
<pre>Hi again.
Adding a small test program (one c++ source and two shader sources). In order
to compile, just call:
$ g++ main.cpp -o gl3test -lX11 -lGL
It draws a triangle whose color is set directly in a fragment shader, and then
the gamma correction is applied to the color. The gamma factor comes from a UBO
and is an argument to the pow() function used to calculate the gamma
correction. I've tried to keep it as simple as possible, so even the vertex
transform matrix is hardcoded into the vertex shader.
Also attaching new images with the error and the expected result (the expected
result has been produced by hardcoding the gamma value into the fragment
shader).
If you look into the fragment shader source (simple.frag) you can see one line
commented out (line 18). If you use line 18 instead of line 16, then the
problem is gone, so this demonstrates that the uniform itself contains propper
value - it's just the pow() function that reads from somewhere else rather than
from the uniform (as mentioned earlier, other built-in functions have the same
problem, and it happens only for uniforms that come from UBOs).
The source code is based on code copied from here:
<a href="http://www.opengl.org/wiki/Tutorial:_OpenGL_3.0_Context_Creation_%28GLX%29">http://www.opengl.org/wiki/Tutorial:_OpenGL_3.0_Context_Creation_%28GLX%29</a>
I've added three functions: readShader(), linkProgram() and doTests().
Besides that, I've added the #define GL_GLEXT_PROTOTYPES directive at the
begining of the file, so that I didn't have to load the function pointers
manually.
The program draws 5 frames (one frame per second) and exits.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>