[Mesa-dev] [Bug 57121] corrupted GLSL built-in function results when using Uniform Buffer contents as arguments

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Nov 21 06:49:41 PST 2012


https://bugs.freedesktop.org/show_bug.cgi?id=57121

--- Comment #7 from Tomasz Kaźmierczak <tomek-k at wp.eu> ---
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:
http://www.opengl.org/wiki/Tutorial:_OpenGL_3.0_Context_Creation_%28GLX%29

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121121/4ee97ca8/attachment.html>


More information about the mesa-dev mailing list