diff options
author | Samuel Iglesias Gonsalvez <[email protected]> | 2015-08-31 07:45:53 +0200 |
---|---|---|
committer | Samuel Iglesias Gonsalvez <[email protected]> | 2015-09-25 08:39:22 +0200 |
commit | 8f0167c65b2df73cf2ef094358ba162fe0028d14 (patch) | |
tree | a250a41e13676f62bc26ff59919b0cf50aa50014 /src/glsl/link_uniform_blocks.cpp | |
parent | 35476c2bae5d59adf5fcfce8c83958ed076264e5 (diff) |
glsl: Add parser/compiler support for std430 interface packing qualifier
v2:
- Fix a missing check in has_layout()
v3:
- Mention shader storage block in error message for layout qualifiers
(Kristian).
Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/glsl/link_uniform_blocks.cpp')
-rw-r--r-- | src/glsl/link_uniform_blocks.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/glsl/link_uniform_blocks.cpp b/src/glsl/link_uniform_blocks.cpp index 4df39e200d5..c891d030234 100644 --- a/src/glsl/link_uniform_blocks.cpp +++ b/src/glsl/link_uniform_blocks.cpp @@ -119,8 +119,16 @@ private: v->IndexName = v->Name; } - const unsigned alignment = type->std140_base_alignment(v->RowMajor); - unsigned size = type->std140_size(v->RowMajor); + unsigned alignment = 0; + unsigned size = 0; + + if (v->Type->interface_packing == GLSL_INTERFACE_PACKING_STD430) { + alignment = type->std430_base_alignment(v->RowMajor); + size = type->std430_size(v->RowMajor); + } else { + alignment = type->std140_base_alignment(v->RowMajor); + size = type->std140_size(v->RowMajor); + } this->offset = glsl_align(this->offset, alignment); v->Offset = this->offset; @@ -255,7 +263,8 @@ link_uniform_blocks(void *mem_ctx, == unsigned(ubo_packing_shared)); STATIC_ASSERT(unsigned(GLSL_INTERFACE_PACKING_PACKED) == unsigned(ubo_packing_packed)); - + STATIC_ASSERT(unsigned(GLSL_INTERFACE_PACKING_STD430) + == unsigned(ubo_packing_std430)); hash_table_foreach (block_hash, entry) { const struct link_uniform_block_active *const b = |