OSDN Git Service

glsl: xfb_stride applies to buffers, not block members
authorJuan A. Suarez Romero <jasuarez@igalia.com>
Fri, 7 Jul 2017 09:35:52 +0000 (09:35 +0000)
committerJuan A. Suarez Romero <jasuarez@igalia.com>
Tue, 1 Aug 2017 15:58:24 +0000 (15:58 +0000)
commit54826331b31d4cdcb3a7e444caf97b75c3364b54
tree3cc429f9842b46918427493c0212584ab8f473ad
parentd4b44783906d3dd37903525dd187c53f4bd26918
glsl: xfb_stride applies to buffers, not block members

When we have an interface block like:

layout (xfb_buffer = 0, xfb_offset = 0) out Block {
                             vec4 var1;
    layout (xfb_stride = 48) vec4 var2;
                             vec4 var3;
};

According to ARB_enhanced_layouts spec:

   "The *xfb_stride* qualifier specifies how many bytes are consumed by
    each captured vertex.  It applies to the transform feedback buffer
    for that declaration, whether it is inherited or explicitly
    declared. It can be applied to variables, blocks, block members, or
    just the qualifier out. [ ...] While *xfb_stride* can be declared
    multiple times for the same buffer, it is a compile-time or
    link-time error to have different values specified for the stride
    for the same buffer."

This means xfb_stride actually applies to the buffer, and not to the
individual components.

In the above example, it means that var2 consumes 16 bytes, and var3 is
at offset 32.

This has been confirmed also by John Kessenich, the main contact for the
ARB_enhanced_layouts specs, and also because this commit fixes:

GL45.enhanced_layouts.xfb_block_member_stride

This commit is in practice a revert of 598790e8564 (glsl: apply
xfb_stride to implicit offsets for ifc block members).

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/compiler/glsl/ast_to_hir.cpp