summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2017-11-01 17:34:12 -0700
committerIan Romanick <[email protected]>2017-11-08 18:37:29 -0800
commit9c53b80ff94c60bef18af6fbeee30bae43b42485 (patch)
tree4dd01a822d57c51fa34b0dcffce983fae1484531
parentc18d8c61d6ecc108c1ef2012b37e9cf56da98664 (diff)
glsl: Minor cleanups after previous commit
I think it's more clear to only call emit_access once. The only difference between the two calls is the value of size_mul used for the offset parameter... but you really have to look at it to be sure. The s/is_64bit/is_double/ change is because there are no int64_t or uint64_t matrix types. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
-rw-r--r--src/compiler/glsl/lower_buffer_access.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/compiler/glsl/lower_buffer_access.cpp b/src/compiler/glsl/lower_buffer_access.cpp
index 056fd26e0db..fa6e5f5c066 100644
--- a/src/compiler/glsl/lower_buffer_access.cpp
+++ b/src/compiler/glsl/lower_buffer_access.cpp
@@ -111,24 +111,17 @@ lower_buffer_access::emit_access(void *mem_ctx,
ir_dereference *col_deref =
new(mem_ctx) ir_dereference_array(deref->clone(mem_ctx, NULL), col);
- if (row_major) {
- /* For a row-major matrix, the next column starts at the next
- * element.
- */
- int size_mul = deref->type->is_64bit() ? 8 : 4;
- emit_access(mem_ctx, is_write, col_deref, base_offset,
- deref_offset + i * size_mul,
- row_major, deref->type, packing,
- writemask_for_size(col_deref->type->vector_elements));
- } else {
- const int size_mul =
- link_calculate_matrix_stride(deref->type, row_major, packing);
-
- emit_access(mem_ctx, is_write, col_deref, base_offset,
- deref_offset + i * size_mul,
- row_major, deref->type, packing,
- writemask_for_size(col_deref->type->vector_elements));
- }
+ /* For a row-major matrix, the next column starts at the next
+ * element. Otherwise it is offset by the matrix stride.
+ */
+ const unsigned size_mul = row_major
+ ? (deref->type->is_double() ? 8 : 4)
+ : link_calculate_matrix_stride(deref->type, row_major, packing);
+
+ emit_access(mem_ctx, is_write, col_deref, base_offset,
+ deref_offset + i * size_mul,
+ row_major, deref->type, packing,
+ writemask_for_size(col_deref->type->vector_elements));
}
return;
}