diff options
author | Timothy Arceri <[email protected]> | 2016-02-13 14:53:45 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-03-31 12:50:44 +1100 |
commit | 04a72e6e57ea97db2023bec50a10f2106f5d5b24 (patch) | |
tree | e7a407c970573c3273170d9f8c7b0cf8c36d0b13 | |
parent | edddad0eee15c1f97443fc262d731e06d9604d4e (diff) |
glsl: add xfb_stride compile time rules
From the 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. If the buffer is capturing any
double-typed outputs, the stride must be a multiple of 8, otherwise
it must be a multiple of 4, or a compile-time or link-time error
results.
...
The resulting stride (implicit or explicit) must be less than or
equal to the implementation-dependent constant
gl_MaxTransformFeedbackInterleavedComponents."
Reviewed-by: Dave Airlie <[email protected]>
-rw-r--r-- | src/compiler/glsl/ast_to_hir.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 9ff23757533..4fd2fd8ff05 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -3246,6 +3246,15 @@ apply_layout_qualifier_to_variable(const struct ast_type_qualifier *qual, } } + if (qual->flags.q.explicit_xfb_stride) { + unsigned qual_xfb_stride; + if (process_qualifier_constant(state, loc, "xfb_stride", + qual->xfb_stride, &qual_xfb_stride)) { + var->data.xfb_stride = qual_xfb_stride; + var->data.explicit_xfb_stride = true; + } + } + if (var->type->contains_atomic()) { if (var->data.mode == ir_var_uniform) { if (var->data.explicit_binding) { @@ -6535,6 +6544,15 @@ ast_process_struct_or_iface_block_members(exec_list *instructions, xfb_buffer = (int) block_xfb_buffer; } + int xfb_stride = -1; + if (qual->flags.q.explicit_xfb_stride) { + unsigned qual_xfb_stride; + if (process_qualifier_constant(state, &loc, "xfb_stride", + qual->xfb_stride, &qual_xfb_stride)) { + xfb_stride = (int) qual_xfb_stride; + } + } + if (qual->flags.q.uniform && qual->has_interpolation()) { _mesa_glsl_error(&loc, state, "interpolation qualifiers cannot be used " @@ -6583,6 +6601,7 @@ ast_process_struct_or_iface_block_members(exec_list *instructions, fields[i].offset = -1; fields[i].explicit_xfb_buffer = explicit_xfb_buffer; fields[i].xfb_buffer = xfb_buffer; + fields[i].xfb_stride = xfb_stride; if (qual->flags.q.explicit_location) { unsigned qual_location; @@ -6972,6 +6991,14 @@ ast_interface_block::hir(exec_list *instructions, } } + unsigned qual_xfb_stride; + if (layout.flags.q.explicit_xfb_stride) { + if (!process_qualifier_constant(state, &loc, "xfb_stride", + layout.xfb_stride, &qual_xfb_stride)) { + return NULL; + } + } + unsigned expl_location = 0; if (layout.flags.q.explicit_location) { if (!process_qualifier_constant(state, &loc, "location", |