From a5f82db3805ff8e96b04e5b35fc566eac2f0a0a8 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Wed, 3 May 2017 11:16:57 +0200 Subject: [PATCH] glsl: rename image_* qualifiers to memory_* It doesn't make sense to prefix them with 'image' because they are called "Memory Qualifiers" and they can be applied to members of storage buffer blocks. Signed-off-by: Samuel Pitoiset Reviewed-by: Andres Gomez --- src/compiler/glsl/ast_function.cpp | 10 ++-- src/compiler/glsl/ast_to_hir.cpp | 54 +++++++++++----------- src/compiler/glsl/builtin_functions.cpp | 30 ++++++------ src/compiler/glsl/builtin_variables.cpp | 10 ++-- src/compiler/glsl/glsl_to_nir.cpp | 10 ++-- src/compiler/glsl/ir.cpp | 20 ++++---- src/compiler/glsl/ir.h | 12 ++--- src/compiler/glsl/link_uniforms.cpp | 4 +- src/compiler/glsl/lower_ubo_reference.cpp | 12 ++--- src/compiler/glsl_types.cpp | 20 ++++---- src/compiler/glsl_types.h | 18 ++++---- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 +-- 12 files changed, 103 insertions(+), 103 deletions(-) diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp index 1b90937ec8c..bee5f0588b2 100644 --- a/src/compiler/glsl/ast_function.cpp +++ b/src/compiler/glsl/ast_function.cpp @@ -107,35 +107,35 @@ verify_image_parameter(YYLTYPE *loc, _mesa_glsl_parse_state *state, * qualifiers. [...] It is legal to have additional qualifiers * on a formal parameter, but not to have fewer." */ - if (actual->data.image_coherent && !formal->data.image_coherent) { + if (actual->data.memory_coherent && !formal->data.memory_coherent) { _mesa_glsl_error(loc, state, "function call parameter `%s' drops " "`coherent' qualifier", formal->name); return false; } - if (actual->data.image_volatile && !formal->data.image_volatile) { + if (actual->data.memory_volatile && !formal->data.memory_volatile) { _mesa_glsl_error(loc, state, "function call parameter `%s' drops " "`volatile' qualifier", formal->name); return false; } - if (actual->data.image_restrict && !formal->data.image_restrict) { + if (actual->data.memory_restrict && !formal->data.memory_restrict) { _mesa_glsl_error(loc, state, "function call parameter `%s' drops " "`restrict' qualifier", formal->name); return false; } - if (actual->data.image_read_only && !formal->data.image_read_only) { + if (actual->data.memory_read_only && !formal->data.memory_read_only) { _mesa_glsl_error(loc, state, "function call parameter `%s' drops " "`readonly' qualifier", formal->name); return false; } - if (actual->data.image_write_only && !formal->data.image_write_only) { + if (actual->data.memory_write_only && !formal->data.memory_write_only) { _mesa_glsl_error(loc, state, "function call parameter `%s' drops " "`writeonly' qualifier", formal->name); diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 0703ed664c8..b57d1cf53b5 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -86,17 +86,17 @@ public: return visit_continue; ir_variable *var = ir->variable_referenced(); - /* We can have image_write_only set on both images and buffer variables, + /* We can have memory_write_only set on both images and buffer variables, * but in the former there is a distinction between reads from * the variable itself (write_only) and from the memory they point to - * (image_write_only), while in the case of buffer variables there is + * (memory_write_only), while in the case of buffer variables there is * no such distinction, that is why this check here is limited to * buffer variables alone. */ if (!var || var->data.mode != ir_var_shader_storage) return visit_continue; - if (var->data.image_write_only) { + if (var->data.memory_write_only) { found = var; return visit_stop; } @@ -947,11 +947,11 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, error_emitted = true; } else if (lhs_var != NULL && (lhs_var->data.read_only || (lhs_var->data.mode == ir_var_shader_storage && - lhs_var->data.image_read_only))) { - /* We can have image_read_only set on both images and buffer variables, + lhs_var->data.memory_read_only))) { + /* We can have memory_read_only set on both images and buffer variables, * but in the former there is a distinction between assignments to * the variable itself (read_only) and to the memory they point to - * (image_read_only), while in the case of buffer variables there is + * (memory_read_only), while in the case of buffer variables there is * no such distinction, that is why this check here is limited to * buffer variables alone. */ @@ -3335,11 +3335,11 @@ apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual, "global variables"); } - var->data.image_read_only |= qual->flags.q.read_only; - var->data.image_write_only |= qual->flags.q.write_only; - var->data.image_coherent |= qual->flags.q.coherent; - var->data.image_volatile |= qual->flags.q._volatile; - var->data.image_restrict |= qual->flags.q.restrict_flag; + var->data.memory_read_only |= qual->flags.q.read_only; + var->data.memory_write_only |= qual->flags.q.write_only; + var->data.memory_coherent |= qual->flags.q.coherent; + var->data.memory_volatile |= qual->flags.q._volatile; + var->data.memory_restrict |= qual->flags.q.restrict_flag; var->data.read_only = true; if (qual->flags.q.explicit_image_format) { @@ -3377,8 +3377,8 @@ apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual, var->data.image_format != GL_R32F && var->data.image_format != GL_R32I && var->data.image_format != GL_R32UI && - !var->data.image_read_only && - !var->data.image_write_only) { + !var->data.memory_read_only && + !var->data.memory_write_only) { _mesa_glsl_error(loc, state, "image variables of format other than r32f, " "r32i or r32ui must be qualified `readonly' or " "`writeonly'"); @@ -7126,24 +7126,24 @@ ast_process_struct_or_iface_block_members(exec_list *instructions, * if set, overwrites the layout qualifier. */ if (qual->flags.q.read_only) { - fields[i].image_read_only = true; - fields[i].image_write_only = false; + fields[i].memory_read_only = true; + fields[i].memory_write_only = false; } else if (qual->flags.q.write_only) { - fields[i].image_read_only = false; - fields[i].image_write_only = true; + fields[i].memory_read_only = false; + fields[i].memory_write_only = true; } else { - fields[i].image_read_only = layout->flags.q.read_only; - fields[i].image_write_only = layout->flags.q.write_only; + fields[i].memory_read_only = layout->flags.q.read_only; + fields[i].memory_write_only = layout->flags.q.write_only; } /* For other qualifiers, we set the flag if either the layout * qualifier or the field qualifier are set */ - fields[i].image_coherent = qual->flags.q.coherent || + fields[i].memory_coherent = qual->flags.q.coherent || layout->flags.q.coherent; - fields[i].image_volatile = qual->flags.q._volatile || + fields[i].memory_volatile = qual->flags.q._volatile || layout->flags.q._volatile; - fields[i].image_restrict = qual->flags.q.restrict_flag || + fields[i].memory_restrict = qual->flags.q.restrict_flag || layout->flags.q.restrict_flag; } @@ -7268,11 +7268,11 @@ is_unsized_array_last_element(ir_variable *v) static void apply_memory_qualifiers(ir_variable *var, glsl_struct_field field) { - var->data.image_read_only = field.image_read_only; - var->data.image_write_only = field.image_write_only; - var->data.image_coherent = field.image_coherent; - var->data.image_volatile = field.image_volatile; - var->data.image_restrict = field.image_restrict; + var->data.memory_read_only = field.memory_read_only; + var->data.memory_write_only = field.memory_write_only; + var->data.memory_coherent = field.memory_coherent; + var->data.memory_volatile = field.memory_volatile; + var->data.memory_restrict = field.memory_restrict; } ir_rvalue * diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp index 3abbb0c9f2a..cc1432197b9 100644 --- a/src/compiler/glsl/builtin_functions.cpp +++ b/src/compiler/glsl/builtin_functions.cpp @@ -5929,11 +5929,11 @@ builtin_builder::_image_prototype(const glsl_type *image_type, * accept everything that needs to be accepted, and reject cases * like loads from write-only or stores to read-only images. */ - image->data.image_read_only = (flags & IMAGE_FUNCTION_READ_ONLY) != 0; - image->data.image_write_only = (flags & IMAGE_FUNCTION_WRITE_ONLY) != 0; - image->data.image_coherent = true; - image->data.image_volatile = true; - image->data.image_restrict = true; + image->data.memory_read_only = (flags & IMAGE_FUNCTION_READ_ONLY) != 0; + image->data.memory_write_only = (flags & IMAGE_FUNCTION_WRITE_ONLY) != 0; + image->data.memory_coherent = true; + image->data.memory_volatile = true; + image->data.memory_restrict = true; return sig; } @@ -5969,11 +5969,11 @@ builtin_builder::_image_size_prototype(const glsl_type *image_type, * accept everything that needs to be accepted, and reject cases * like loads from write-only or stores to read-only images. */ - image->data.image_read_only = true; - image->data.image_write_only = true; - image->data.image_coherent = true; - image->data.image_volatile = true; - image->data.image_restrict = true; + image->data.memory_read_only = true; + image->data.memory_write_only = true; + image->data.memory_coherent = true; + image->data.memory_volatile = true; + image->data.memory_restrict = true; return sig; } @@ -5994,11 +5994,11 @@ builtin_builder::_image_samples_prototype(const glsl_type *image_type, * accept everything that needs to be accepted, and reject cases * like loads from write-only or stores to read-only images. */ - image->data.image_read_only = true; - image->data.image_write_only = true; - image->data.image_coherent = true; - image->data.image_volatile = true; - image->data.image_restrict = true; + image->data.memory_read_only = true; + image->data.memory_write_only = true; + image->data.memory_coherent = true; + image->data.memory_volatile = true; + image->data.memory_restrict = true; return sig; } diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp index c232571f26e..a45c9d62c71 100644 --- a/src/compiler/glsl/builtin_variables.cpp +++ b/src/compiler/glsl/builtin_variables.cpp @@ -336,11 +336,11 @@ per_vertex_accumulator::add_field(int slot, const glsl_type *type, this->fields[this->num_fields].sample = 0; this->fields[this->num_fields].patch = 0; this->fields[this->num_fields].precision = GLSL_PRECISION_NONE; - this->fields[this->num_fields].image_read_only = 0; - this->fields[this->num_fields].image_write_only = 0; - this->fields[this->num_fields].image_coherent = 0; - this->fields[this->num_fields].image_volatile = 0; - this->fields[this->num_fields].image_restrict = 0; + this->fields[this->num_fields].memory_read_only = 0; + this->fields[this->num_fields].memory_write_only = 0; + this->fields[this->num_fields].memory_coherent = 0; + this->fields[this->num_fields].memory_volatile = 0; + this->fields[this->num_fields].memory_restrict = 0; this->fields[this->num_fields].explicit_xfb_buffer = 0; this->fields[this->num_fields].xfb_buffer = -1; this->fields[this->num_fields].xfb_stride = -1; diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 189eb24ac61..307276555ee 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -426,11 +426,11 @@ nir_visitor::visit(ir_variable *ir) var->data.index = ir->data.index; var->data.binding = ir->data.binding; var->data.offset = ir->data.offset; - var->data.image.read_only = ir->data.image_read_only; - var->data.image.write_only = ir->data.image_write_only; - var->data.image.coherent = ir->data.image_coherent; - var->data.image._volatile = ir->data.image_volatile; - var->data.image.restrict_flag = ir->data.image_restrict; + var->data.image.read_only = ir->data.memory_read_only; + var->data.image.write_only = ir->data.memory_write_only; + var->data.image.coherent = ir->data.memory_coherent; + var->data.image._volatile = ir->data.memory_volatile; + var->data.image.restrict_flag = ir->data.memory_restrict; var->data.image.format = ir->data.image_format; var->data.fb_fetch_output = ir->data.fb_fetch_output; diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp index 356eb0fbcfd..6a8b7904934 100644 --- a/src/compiler/glsl/ir.cpp +++ b/src/compiler/glsl/ir.cpp @@ -1722,11 +1722,11 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name, this->data.max_array_access = -1; this->data.offset = 0; this->data.precision = GLSL_PRECISION_NONE; - this->data.image_read_only = false; - this->data.image_write_only = false; - this->data.image_coherent = false; - this->data.image_volatile = false; - this->data.image_restrict = false; + this->data.memory_read_only = false; + this->data.memory_write_only = false; + this->data.memory_coherent = false; + this->data.memory_volatile = false; + this->data.memory_restrict = false; this->data.from_ssbo_unsized_array = false; this->data.fb_fetch_output = false; @@ -1846,11 +1846,11 @@ ir_function_signature::qualifiers_match(exec_list *params) a->data.centroid != b->data.centroid || a->data.sample != b->data.sample || a->data.patch != b->data.patch || - a->data.image_read_only != b->data.image_read_only || - a->data.image_write_only != b->data.image_write_only || - a->data.image_coherent != b->data.image_coherent || - a->data.image_volatile != b->data.image_volatile || - a->data.image_restrict != b->data.image_restrict) { + a->data.memory_read_only != b->data.memory_read_only || + a->data.memory_write_only != b->data.memory_write_only || + a->data.memory_coherent != b->data.memory_coherent || + a->data.memory_volatile != b->data.memory_volatile || + a->data.memory_restrict != b->data.memory_restrict) { /* parameter a's qualifiers don't match */ return a->name; diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h index 9ab4df7219e..5a5729cdbe3 100644 --- a/src/compiler/glsl/ir.h +++ b/src/compiler/glsl/ir.h @@ -827,13 +827,13 @@ public: ir_depth_layout depth_layout:3; /** - * ARB_shader_image_load_store qualifiers. + * Memory qualifiers. */ - unsigned image_read_only:1; /**< "readonly" qualifier. */ - unsigned image_write_only:1; /**< "writeonly" qualifier. */ - unsigned image_coherent:1; - unsigned image_volatile:1; - unsigned image_restrict:1; + unsigned memory_read_only:1; /**< "readonly" qualifier. */ + unsigned memory_write_only:1; /**< "writeonly" qualifier. */ + unsigned memory_coherent:1; + unsigned memory_volatile:1; + unsigned memory_restrict:1; /** * ARB_shader_storage_buffer_object diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp index f1e0885fbd3..c195e767e25 100644 --- a/src/compiler/glsl/link_uniforms.cpp +++ b/src/compiler/glsl/link_uniforms.cpp @@ -586,8 +586,8 @@ private: /* Set image access qualifiers */ const GLenum access = - (current_var->data.image_read_only ? GL_READ_ONLY : - current_var->data.image_write_only ? GL_WRITE_ONLY : + (current_var->data.memory_read_only ? GL_READ_ONLY : + current_var->data.memory_write_only ? GL_WRITE_ONLY : GL_READ_WRITE); const unsigned first = this->next_image; diff --git a/src/compiler/glsl/lower_ubo_reference.cpp b/src/compiler/glsl/lower_ubo_reference.cpp index bfaddac3add..365b8ebc653 100644 --- a/src/compiler/glsl/lower_ubo_reference.cpp +++ b/src/compiler/glsl/lower_ubo_reference.cpp @@ -411,13 +411,13 @@ lower_ubo_reference_visitor::ssbo_access_params() if (variable->is_interface_instance()) { assert(struct_field); - return ((struct_field->image_coherent ? ACCESS_COHERENT : 0) | - (struct_field->image_restrict ? ACCESS_RESTRICT : 0) | - (struct_field->image_volatile ? ACCESS_VOLATILE : 0)); + return ((struct_field->memory_coherent ? ACCESS_COHERENT : 0) | + (struct_field->memory_restrict ? ACCESS_RESTRICT : 0) | + (struct_field->memory_volatile ? ACCESS_VOLATILE : 0)); } else { - return ((variable->data.image_coherent ? ACCESS_COHERENT : 0) | - (variable->data.image_restrict ? ACCESS_RESTRICT : 0) | - (variable->data.image_volatile ? ACCESS_VOLATILE : 0)); + return ((variable->data.memory_coherent ? ACCESS_COHERENT : 0) | + (variable->data.memory_restrict ? ACCESS_RESTRICT : 0) | + (variable->data.memory_volatile ? ACCESS_VOLATILE : 0)); } } diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp index bf078ad6141..22a54d06eff 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -940,20 +940,20 @@ glsl_type::record_compare(const glsl_type *b, bool match_locations) const if (this->fields.structure[i].patch != b->fields.structure[i].patch) return false; - if (this->fields.structure[i].image_read_only - != b->fields.structure[i].image_read_only) + if (this->fields.structure[i].memory_read_only + != b->fields.structure[i].memory_read_only) return false; - if (this->fields.structure[i].image_write_only - != b->fields.structure[i].image_write_only) + if (this->fields.structure[i].memory_write_only + != b->fields.structure[i].memory_write_only) return false; - if (this->fields.structure[i].image_coherent - != b->fields.structure[i].image_coherent) + if (this->fields.structure[i].memory_coherent + != b->fields.structure[i].memory_coherent) return false; - if (this->fields.structure[i].image_volatile - != b->fields.structure[i].image_volatile) + if (this->fields.structure[i].memory_volatile + != b->fields.structure[i].memory_volatile) return false; - if (this->fields.structure[i].image_restrict - != b->fields.structure[i].image_restrict) + if (this->fields.structure[i].memory_restrict + != b->fields.structure[i].memory_restrict) return false; if (this->fields.structure[i].precision != b->fields.structure[i].precision) diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h index 403663f7b87..9885866866a 100644 --- a/src/compiler/glsl_types.h +++ b/src/compiler/glsl_types.h @@ -966,14 +966,14 @@ struct glsl_struct_field { unsigned precision:2; /** - * Image qualifiers, applicable to buffer variables defined in shader + * Memory qualifiers, applicable to buffer variables defined in shader * storage buffer objects (SSBOs) */ - unsigned image_read_only:1; - unsigned image_write_only:1; - unsigned image_coherent:1; - unsigned image_volatile:1; - unsigned image_restrict:1; + unsigned memory_read_only:1; + unsigned memory_write_only:1; + unsigned memory_coherent:1; + unsigned memory_volatile:1; + unsigned memory_restrict:1; /** * Any of the xfb_* qualifiers trigger the shader to be in transform @@ -988,9 +988,9 @@ struct glsl_struct_field { : type(_type), name(_name), location(-1), offset(0), xfb_buffer(0), xfb_stride(0), interpolation(0), centroid(0), sample(0), matrix_layout(GLSL_MATRIX_LAYOUT_INHERITED), patch(0), - precision(GLSL_PRECISION_NONE), image_read_only(0), image_write_only(0), - image_coherent(0), image_volatile(0), image_restrict(0), - explicit_xfb_buffer(0), implicit_sized_array(0) + precision(GLSL_PRECISION_NONE), memory_read_only(0), + memory_write_only(0), memory_coherent(0), memory_volatile(0), + memory_restrict(0), explicit_xfb_buffer(0), implicit_sized_array(0) { /* empty */ } diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index c0a85772a61..249584d75e4 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3888,11 +3888,11 @@ glsl_to_tgsi_visitor::visit_image_intrinsic(ir_call *ir) inst->image_format = st_mesa_format_to_pipe_format(st_context(ctx), _mesa_get_shader_image_format(imgvar->data.image_format)); - if (imgvar->data.image_coherent) + if (imgvar->data.memory_coherent) inst->buffer_access |= TGSI_MEMORY_COHERENT; - if (imgvar->data.image_restrict) + if (imgvar->data.memory_restrict) inst->buffer_access |= TGSI_MEMORY_RESTRICT; - if (imgvar->data.image_volatile) + if (imgvar->data.memory_volatile) inst->buffer_access |= TGSI_MEMORY_VOLATILE; } -- 2.30.2