From: Ian Romanick Date: Fri, 18 Jul 2014 19:18:21 +0000 (-0700) Subject: linker: Use the matrix layout information in ir_variable and glsl_type for UBO layout X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b71f149a446cd009f2851a1847e20d29a056389e;p=mesa.git linker: Use the matrix layout information in ir_variable and glsl_type for UBO layout Use the data that is stored in the ir_variable and the glsl_type to determine whether or not a UBO member is row-major. Fixes gles3conform failures in: ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat2x3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat2x4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat3x2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat3x4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat4x2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat4x3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat2x3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat2x4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat3x2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat3x4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat4x2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat4x3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat2x3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat2x4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat3x2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat3x4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat4x2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat4x3 ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.2 ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.5 ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.9 Causes gles3conform failures in: ES3-CTS.shaders.uniform_block.random.basic_types.8 ES3-CTS.shaders.uniform_block.random.basic_arrays.3 ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.0 ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.2 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.13 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.18 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.4 These failures will be fixed shortly. Signed-off-by: Ian Romanick Reviewed-by: Matt Turner --- diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp index ecd414b8ceb..3251097bc30 100644 --- a/src/glsl/link_uniforms.cpp +++ b/src/glsl/link_uniforms.cpp @@ -445,7 +445,6 @@ public: */ if (var->is_interface_instance()) { ubo_byte_offset = 0; - ubo_row_major = false; } else { const struct gl_uniform_block *const block = &prog->UniformBlocks[ubo_block_index]; @@ -455,7 +454,6 @@ public: const struct gl_uniform_buffer_variable *const ubo_var = &block->Uniforms[var->data.location]; - ubo_row_major = ubo_var->RowMajor; ubo_byte_offset = ubo_var->Offset; } @@ -470,7 +468,6 @@ public: int ubo_block_index; int ubo_byte_offset; - bool ubo_row_major; gl_shader_stage shader_type; private: @@ -536,8 +533,6 @@ private: assert(!type->without_array()->is_record()); assert(!type->without_array()->is_interface()); - (void) row_major; - unsigned id; bool found = this->map->get(id, name); assert(found); @@ -594,25 +589,25 @@ private: this->uniforms[id].block_index = this->ubo_block_index; const unsigned alignment = record_type - ? record_type->std140_base_alignment(ubo_row_major) - : type->std140_base_alignment(ubo_row_major); + ? record_type->std140_base_alignment(row_major) + : type->std140_base_alignment(row_major); this->ubo_byte_offset = glsl_align(this->ubo_byte_offset, alignment); this->uniforms[id].offset = this->ubo_byte_offset; - this->ubo_byte_offset += type->std140_size(ubo_row_major); + this->ubo_byte_offset += type->std140_size(row_major); if (last_field) this->ubo_byte_offset = glsl_align(this->ubo_byte_offset, 16); if (type->is_array()) { this->uniforms[id].array_stride = - glsl_align(type->fields.array->std140_size(ubo_row_major), 16); + glsl_align(type->fields.array->std140_size(row_major), 16); } else { this->uniforms[id].array_stride = 0; } if (type->without_array()->is_matrix()) { this->uniforms[id].matrix_stride = 16; - this->uniforms[id].row_major = ubo_row_major; + this->uniforms[id].row_major = row_major; } else { this->uniforms[id].matrix_stride = 0; this->uniforms[id].row_major = false;