aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/lower_buffer_access.cpp
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2015-12-28 14:03:50 -0500
committerIlia Mirkin <[email protected]>2016-01-29 21:05:08 -0500
commit35f8488668fe055ffc8d0f9f897fa73e28e5e00d (patch)
tree7a87a460a916aadce6e9ce4df5f26211cbb1c893 /src/compiler/glsl/lower_buffer_access.cpp
parent2b089c7ffe2c46a5d5d01ec315fb3e5a07695d44 (diff)
glsl: keep track of ssbo variable being accessed, add access params
Currently any access params (coherent/volatile/restrict) are being lost when lowering to the ssbo load/store intrinsics. Keep track of the variable being used, and bake its access params in as the last arg of the load/store intrinsics. If the variable is accessed via an instance block, then 'variable' points to the instance block variable and not the field inside the instance block that we are accessing. In order to check access parameters for the field itself we need to detect this case and keep track of the corresponding field struct so we can extract the specific field access information from there instead. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> (v1) v1 -> v2: add tracking of struct field v2 -> v3: minor adjustments based on Iago's feedback Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/compiler/glsl/lower_buffer_access.cpp')
-rw-r--r--src/compiler/glsl/lower_buffer_access.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/glsl/lower_buffer_access.cpp b/src/compiler/glsl/lower_buffer_access.cpp
index f8c8d140ea8..9ad811de9f1 100644
--- a/src/compiler/glsl/lower_buffer_access.cpp
+++ b/src/compiler/glsl/lower_buffer_access.cpp
@@ -327,6 +327,7 @@ lower_buffer_access::setup_buffer_access(void *mem_ctx,
unsigned *const_offset,
bool *row_major,
int *matrix_columns,
+ const glsl_struct_field **struct_field,
unsigned packing)
{
*offset = new(mem_ctx) ir_constant(0u);
@@ -442,8 +443,11 @@ lower_buffer_access::setup_buffer_access(void *mem_ctx,
intra_struct_offset = glsl_align(intra_struct_offset, field_align);
if (strcmp(struct_type->fields.structure[i].name,
- deref_record->field) == 0)
+ deref_record->field) == 0) {
+ if (struct_field)
+ *struct_field = &struct_type->fields.structure[i];
break;
+ }
if (packing == GLSL_INTERFACE_PACKING_STD430)
intra_struct_offset += type->std430_size(field_row_major);