From: Jason Ekstrand Date: Tue, 19 Jan 2016 00:01:00 +0000 (-0800) Subject: nir/spirv: Patch through image qualifiers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c2a6f4302e39bc868765e91e0618c0fd334f1407;p=mesa.git nir/spirv: Patch through image qualifiers --- diff --git a/src/glsl/nir/spirv/spirv_to_nir.c b/src/glsl/nir/spirv/spirv_to_nir.c index 4110c3571c6..1fcdb1aa14a 100644 --- a/src/glsl/nir/spirv/spirv_to_nir.c +++ b/src/glsl/nir/spirv/spirv_to_nir.c @@ -717,6 +717,11 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, unsigned sampled = w[7]; SpvImageFormat format = w[8]; + if (count > 9) + val->type->access_qualifier = w[9]; + else + val->type->access_qualifier = SpvAccessQualifierReadWrite; + assert(!multisampled && "FIXME: Handl multi-sampled textures"); val->type->image_format = translate_image_format(format); @@ -1915,6 +1920,17 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode, if (glsl_type_is_image(interface_type->type)) { b->shader->info.num_images++; var->data.image.format = interface_type->image_format; + + switch (interface_type->access_qualifier) { + case SpvAccessQualifierReadOnly: + var->data.image.read_only = true; + break; + case SpvAccessQualifierWriteOnly: + var->data.image.write_only = true; + break; + default: + break; + } } else if (glsl_type_is_sampler(interface_type->type)) { b->shader->info.num_textures++; } else { diff --git a/src/glsl/nir/spirv/vtn_private.h b/src/glsl/nir/spirv/vtn_private.h index f91330ad486..cf75bc92a7a 100644 --- a/src/glsl/nir/spirv/vtn_private.h +++ b/src/glsl/nir/spirv/vtn_private.h @@ -216,6 +216,9 @@ struct vtn_type { /* Image format for image_load_store type images */ unsigned image_format; + /* Access qualifier for storage images */ + SpvAccessQualifier access_qualifier; + /* for arrays and matrices, the array stride */ unsigned stride;