[Mesa-dev] [PATCH 1/6] main: fix TOP_LEVEL_ARRAY_SIZE and TOP_LEVEL_ARRAY_STRIDE
Samuel Iglesias Gonsalvez
siglesias at igalia.com
Fri Oct 2 00:13:51 PDT 2015
When the active variable is an array which is already a top-level
shader storage block member, don't return its array size and stride
when querying TOP_LEVEL_ARRAY_SIZE and TOP_LEVEL_ARRAY_STRIDE
respectively.
Fixes the following 12 dEQP-GLES31 tests:
dEQP-GLES31.functional.ssbo.layout.single_basic_array.shared.mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.shared.row_major_mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.shared.column_major_mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.packed.mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.packed.row_major_mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.packed.column_major_mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std140.mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std140.row_major_mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std140.column_major_mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std430.mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std430.row_major_mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std430.column_major_mat3x4
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
---
I am not very sure about this change, ARB_program_interface query
doesn't clarify this case:
"For the property TOP_LEVEL_ARRAY_SIZE, a single integer identifying
the number of active array elements of the top-level shader storage
block member containing to the active variable is written to <params>"
"For the property TOP_LEVEL_ARRAY_STRIDE, a single integer identifying
the stride between array elements of the top-level shader storage
block member containing the active variable is written to <params>."
Ian, What do you think?
src/mesa/main/shader_query.cpp | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 7189676..e6d93c3 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -921,12 +921,18 @@ program_resource_top_level_array_size(struct gl_shader_program *shProg,
* the top-level block member is an array with no declared size,
* the value zero is written to <params>.
*/
- if (field->type->is_unsized_array())
+ /* If the given variable is already a top-level shader storage
+ * block member, then return array_size = 1.
+ */
+ if (strcmp(name, var_name) == 0)
+ array_size = 1;
+ else if (field->type->is_unsized_array())
array_size = 0;
else if (field->type->is_array())
array_size = field->type->length;
else
array_size = 1;
+
goto found_top_level_array_size;
}
}
@@ -995,6 +1001,14 @@ program_resource_top_level_array_stride(struct gl_shader_program *shProg,
bool row_major = matrix_layout == GLSL_MATRIX_LAYOUT_ROW_MAJOR;
const glsl_type *array_type = field->type->fields.array;
+ /* If the given variable is already a top-level shader storage
+ * block member, then return array_stride = 0.
+ */
+ if (strcmp(name, var_name) == 0) {
+ array_stride = 0;
+ goto found_top_level_array_size;
+ }
+
if (interface->interface_packing != GLSL_INTERFACE_PACKING_STD430) {
if (array_type->is_record()) {
array_stride = array_type->std140_size(row_major);
--
2.1.4
More information about the mesa-dev
mailing list