[Mesa-dev] [PATCH v3 07/32] glsl: do not make sampler/image types readonly variables

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue May 2 20:53:28 UTC 2017


In plain GLSL, sampler and image types can only be declared
uniform-qualified global variables or 'in' function parameters.

Setting the read_only flag seems quite useless because other
checks will prevent sampler/image variables to be assigned and
also because the flag is not set for atomic_uint types which are
opaque types.

This will also help for ARB_bindless_texture because samplers
and images can be assigned when they are considered bindless.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/compiler/glsl/ast_to_hir.cpp | 1 -
 src/compiler/glsl/ir.cpp         | 3 ---
 2 files changed, 4 deletions(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 20a0f11755..c849e5badf 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -3364,7 +3364,6 @@ apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual,
    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.read_only = true;
 
    if (qual->flags.q.explicit_image_format) {
       if (var->data.mode == ir_var_function_in) {
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index 356eb0fbcf..0c23ba816c 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -1731,9 +1731,6 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
    this->data.fb_fetch_output = false;
 
    if (type != NULL) {
-      if (type->is_sampler())
-         this->data.read_only = true;
-
       if (type->is_interface())
          this->init_interface_type(type);
       else if (type->without_array()->is_interface())
-- 
2.12.2



More information about the mesa-dev mailing list