From 3cdcc5f02f39bd4dc78b88eb80bca4ac208f7f2f Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 21 Apr 2017 15:27:15 +0200 Subject: glsl: implement ARB_bindless_texture conversions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From section 5.4.1 of the ARB_bindless_texture spec: "In the following four constructors, the low 32 bits of the sampler type correspond to the .x component of the uvec2 and the high 32 bits correspond to the .y component." uvec2(any sampler type) // Converts a sampler type to a // pair of 32-bit unsigned integers any sampler type(uvec2) // Converts a pair of 32-bit unsigned integers to // a sampler type uvec2(any image type) // Converts an image type to a // pair of 32-bit unsigned integers any image type(uvec2) // Converts a pair of 32-bit unsigned integers to // an image type v4: - fix up comment style v3: - rebase (and remove (sampler) ? 1 : vector_elements) Signed-off-by: Samuel Pitoiset Reviewed-by: Nicolai Hähnle Reviewed-by: Timothy Arceri --- src/compiler/glsl/ir.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/compiler/glsl/ir.cpp') diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp index 4ae23e92f1e..123de99005c 100644 --- a/src/compiler/glsl/ir.cpp +++ b/src/compiler/glsl/ir.cpp @@ -370,6 +370,16 @@ ir_expression::ir_expression(int op, ir_rvalue *op0) this->type = glsl_type::vec4_type; break; + case ir_unop_unpack_sampler_2x32: + case ir_unop_unpack_image_2x32: + this->type = glsl_type::uvec2_type; + break; + + case ir_unop_pack_sampler_2x32: + case ir_unop_pack_image_2x32: + this->type = op0->type; + break; + case ir_unop_frexp_sig: this->type = op0->type; break; @@ -606,7 +616,7 @@ ir_constant::ir_constant(const struct glsl_type *type, this->array_elements = NULL; assert((type->base_type >= GLSL_TYPE_UINT) - && (type->base_type <= GLSL_TYPE_BOOL)); + && (type->base_type <= GLSL_TYPE_IMAGE)); this->type = type; memcpy(& this->value, data, sizeof(this->value)); -- cgit v1.2.3