[Mesa-dev] [PATCH 05/16] glsl: Use the is_..._or_array_of predicates added in the previous commit
Ian Romanick
idr at freedesktop.org
Mon Jul 21 14:04:21 PDT 2014
From: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/glsl/ast_to_hir.cpp | 3 +--
src/glsl/glsl_types.cpp | 3 +--
src/glsl/link_uniforms.cpp | 22 +++++++---------------
src/glsl/link_varyings.cpp | 6 ++----
4 files changed, 11 insertions(+), 23 deletions(-)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index a15ee9c..b11b0e6 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -5203,8 +5203,7 @@ ast_process_structure_or_interface_block(exec_list *instructions,
"in uniform blocks or structures.");
}
- if (field_type->is_matrix() ||
- (field_type->is_array() && field_type->fields.array->is_matrix())) {
+ if (field_type->is_matrix_or_array_of()) {
fields[i].row_major = block_row_major;
if (qual->flags.q.row_major)
fields[i].row_major = true;
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index f9cd258..932c72b 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -872,8 +872,7 @@ glsl_type::std140_size(bool row_major) const
* and <R> rows, the matrix is stored identically to a row of <S>*<R>
* row vectors with <C> components each, according to rule (4).
*/
- if (this->is_matrix() || (this->is_array() &&
- this->fields.array->is_matrix())) {
+ if (this->is_matrix_or_array_of()) {
const struct glsl_type *element_type;
const struct glsl_type *vec_type;
unsigned int array_len;
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index 6c73197..bbfd326 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -59,10 +59,7 @@ values_for_type(const glsl_type *type)
void
program_resource_visitor::process(const glsl_type *type, const char *name)
{
- assert(type->is_record()
- || (type->is_array() && type->fields.array->is_record())
- || type->is_interface()
- || (type->is_array() && type->fields.array->is_interface()));
+ assert(type->is_record_or_array_of() || type->is_interface_or_array_of());
char *name_copy = ralloc_strdup(NULL, name);
recursion(type, &name_copy, strlen(name), false, NULL);
@@ -136,7 +133,7 @@ program_resource_visitor::process(ir_variable *var)
*/
recursion(var->type, &name, strlen(name), false, NULL);
ralloc_free(name);
- } else if (t->is_record() || (t->is_array() && t->fields.array->is_record())) {
+ } else if (t->is_record_or_array_of()) {
char *name = ralloc_strdup(NULL, var->name);
recursion(var->type, &name, strlen(name), false, NULL);
ralloc_free(name);
@@ -299,10 +296,8 @@ private:
virtual void visit_field(const glsl_type *type, const char *name,
bool row_major)
{
- assert(!type->is_record());
- assert(!(type->is_array() && type->fields.array->is_record()));
- assert(!type->is_interface());
- assert(!(type->is_array() && type->fields.array->is_interface()));
+ assert(!type->is_record_or_array_of());
+ assert(!type->is_interface_or_array_of());
(void) row_major;
@@ -514,10 +509,8 @@ private:
virtual void visit_field(const glsl_type *type, const char *name,
bool row_major, const glsl_type *record_type)
{
- assert(!type->is_record());
- assert(!(type->is_array() && type->fields.array->is_record()));
- assert(!type->is_interface());
- assert(!(type->is_array() && type->fields.array->is_interface()));
+ assert(!type->is_record_or_array_of());
+ assert(!type->is_interface_or_array_of());
(void) row_major;
@@ -590,8 +583,7 @@ private:
this->uniforms[id].array_stride = 0;
}
- if (type->is_matrix() ||
- (type->is_array() && type->fields.array->is_matrix())) {
+ if (type->is_matrix_or_array_of()) {
this->uniforms[id].matrix_stride = 16;
this->uniforms[id].row_major = ubo_row_major;
} else {
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index a3fc2ae..9d3f13f 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -1068,10 +1068,8 @@ private:
virtual void visit_field(const glsl_type *type, const char *name,
bool row_major)
{
- assert(!type->is_record());
- assert(!(type->is_array() && type->fields.array->is_record()));
- assert(!type->is_interface());
- assert(!(type->is_array() && type->fields.array->is_interface()));
+ assert(!type->is_record_or_array_of());
+ assert(!type->is_interface_or_array_of());
(void) row_major;
--
1.8.1.4
More information about the mesa-dev
mailing list