glsl: do not make sampler/image types readonly variables
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 27 Apr 2017 11:45:16 +0000 (13:45 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sat, 6 May 2017 14:40:19 +0000 (16:40 +0200)
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@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/glsl/ast_to_hir.cpp
src/compiler/glsl/ir.cpp

index 0f79cd6084cb843fbbd5d15b4b18abf5bc7111a7..f301b39f89627a91f496a7a4e7106549d25089fc 100644 (file)
@@ -3365,7 +3365,6 @@ apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual,
    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) {
       if (var->data.mode == ir_var_function_in) {
index 6a8b790493496293ef5847e015ceeb0edb9634ed..5b38a71149433a8c71b72205e56cd972cea3df36 100644 (file)
@@ -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())