[Mesa-dev] [RFC PATCH 14/26] glsl: do not make bindless image read-only variables

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Apr 12 10:21:25 UTC 2017



On 04/12/2017 02:18 AM, Timothy Arceri wrote:
> On 12/04/17 02:48, Samuel Pitoiset wrote:
>> Bindless images can be explicitely converted to and from uvec2
>> using scalar constructors.
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>  src/compiler/glsl/ast_to_hir.cpp | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/compiler/glsl/ast_to_hir.cpp 
>> b/src/compiler/glsl/ast_to_hir.cpp
>> index f52ba8181a..bcdf212497 100644
>> --- a/src/compiler/glsl/ast_to_hir.cpp
>> +++ b/src/compiler/glsl/ast_to_hir.cpp
>> @@ -3411,7 +3411,7 @@ 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;
>> +      var->data.read_only = base_type->is_image();
>>
>>        if (qual->flags.q.explicit_image_format) {
>>           if (var->data.mode == ir_var_function_in) {
>>
> 
> Just curious. If we remove this what stops values being directly 
> assigned to images when not using the constructors?

do_assignment() doesn't allow image types to be assigned. For example, 
this valid VS code doesn't pass without that patch.

layout (bindless_sampler) writeonly uniform image2D img;
flat out writeonly image2D image_vs;

void main()
{
   image_vs = img;
}

because the spec allows to declare image types as shader inputs/outputs, 
I guess they can be assigned.


More information about the mesa-dev mailing list