[Bug 92909] Offset/alignment issue with layout std140 and vec3
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Wed Nov 11 14:42:42 PST 2015
https://bugs.freedesktop.org/show_bug.cgi?id=92909
Bug ID: 92909
Summary: Offset/alignment issue with layout std140 and vec3
Product: Mesa
Version: 11.0
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
Severity: normal
Priority: medium
Component: Drivers/DRI/i965
Assignee: idr at freedesktop.org
Reporter: dimitri.sabadie at gmail.com
QA Contact: intel-3d-bugs at lists.freedesktop.org
Created attachment 119574
--> https://bugs.freedesktop.org/attachment.cgi?id=119574&action=edit
source code with compilation line (first line)
When trying to compile an OpenGL 3.2 program to demonstrate the use of UBO
(Uniform Buffer Objects), I got astonished my program worked on nvidia but not
on i915. I spent days trying to fix my code, but I was eventually advised to
submit a driver bug here.
The problem is there when trying to send three colors to fulfill a triangle
(red, green and blue). I attached the code so that you can run it and test it;
it’s rather small.
So, the shader defines a uniform block as:
struct Color {
vec3 rgb;
float k;
};
The rule 3 and rule 9 of the gl32 specs state that the scalar (float) should be
aligned on a 4 bytes and that the vec3 should be aligned on 16 bytes. The vec3
rgb field is already aligned on 16 bytes (because its offset is 0) and the
float k is already aligned as well (because its offset is 12, which is a
multiple of 4). So no padding is needed and the structure’s size is 16 bytes.
Though, I guess the driver tries to do different things on the GLSL side and I
get wrong values for k (though the vec3 works, like, if I don’t use k in the
fragment shader output, I get a correct behavior).
--
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/intel-3d-bugs/attachments/20151111/32861f2c/attachment.html>
More information about the intel-3d-bugs
mailing list