diff options
author | Dave Airlie <[email protected]> | 2016-06-09 10:11:16 +1000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2017-01-20 15:41:23 -0800 |
commit | 050f38ef0bb3f5ddb11e1c4fac08039e74d16f34 (patch) | |
tree | d0bf95700e25715047772f51580ad18c1ba3769f | |
parent | 923aebdd464e0463db28c1824b0bc12a538937a5 (diff) |
glsl/varying_packing: Add 64-bit integer support
As for the double code, but using the 64-bit integer conversions.
v2 (idr): Remove some spurious u2i() and i2u() operations when packing
and unpacking, respectively, int64_t varyings.
Signed-off-by: Dave Airlie <[email protected]>
Reviewed-by: Ian Romanick <[email protected]> [v1]
Reviewed-by: Matt Turner <[email protected]>
-rw-r--r-- | src/compiler/glsl/lower_packed_varyings.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/compiler/glsl/lower_packed_varyings.cpp b/src/compiler/glsl/lower_packed_varyings.cpp index 7a2f187229b..1e9bdda12b1 100644 --- a/src/compiler/glsl/lower_packed_varyings.cpp +++ b/src/compiler/glsl/lower_packed_varyings.cpp @@ -351,6 +351,38 @@ lower_packed_varyings_visitor::bitwise_assign_pack(ir_rvalue *lhs, rhs = u2i(expr(ir_unop_unpack_double_2x32, rhs)); } break; + case GLSL_TYPE_INT64: + assert(rhs->type->vector_elements <= 2); + if (rhs->type->vector_elements == 2) { + ir_variable *t = new(mem_ctx) ir_variable(lhs->type, "pack", ir_var_temporary); + + assert(lhs->type->vector_elements == 4); + this->out_variables->push_tail(t); + this->out_instructions->push_tail( + assign(t, expr(ir_unop_unpack_int_2x32, swizzle_x(rhs->clone(mem_ctx, NULL))), 0x3)); + this->out_instructions->push_tail( + assign(t, expr(ir_unop_unpack_int_2x32, swizzle_y(rhs)), 0xc)); + rhs = deref(t).val; + } else { + rhs = expr(ir_unop_unpack_int_2x32, rhs); + } + break; + case GLSL_TYPE_UINT64: + assert(rhs->type->vector_elements <= 2); + if (rhs->type->vector_elements == 2) { + ir_variable *t = new(mem_ctx) ir_variable(lhs->type, "pack", ir_var_temporary); + + assert(lhs->type->vector_elements == 4); + this->out_variables->push_tail(t); + this->out_instructions->push_tail( + assign(t, u2i(expr(ir_unop_unpack_uint_2x32, swizzle_x(rhs->clone(mem_ctx, NULL)))), 0x3)); + this->out_instructions->push_tail( + assign(t, u2i(expr(ir_unop_unpack_uint_2x32, swizzle_y(rhs))), 0xc)); + rhs = deref(t).val; + } else { + rhs = u2i(expr(ir_unop_unpack_uint_2x32, rhs)); + } + break; default: assert(!"Unexpected type conversion while lowering varyings"); break; @@ -400,6 +432,36 @@ lower_packed_varyings_visitor::bitwise_assign_unpack(ir_rvalue *lhs, rhs = expr(ir_unop_pack_double_2x32, i2u(rhs)); } break; + case GLSL_TYPE_INT64: + assert(lhs->type->vector_elements <= 2); + if (lhs->type->vector_elements == 2) { + ir_variable *t = new(mem_ctx) ir_variable(lhs->type, "unpack", ir_var_temporary); + assert(rhs->type->vector_elements == 4); + this->out_variables->push_tail(t); + this->out_instructions->push_tail( + assign(t, expr(ir_unop_pack_int_2x32, swizzle_xy(rhs->clone(mem_ctx, NULL))), 0x1)); + this->out_instructions->push_tail( + assign(t, expr(ir_unop_pack_int_2x32, swizzle(rhs->clone(mem_ctx, NULL), SWIZZLE_ZWZW, 2)), 0x2)); + rhs = deref(t).val; + } else { + rhs = expr(ir_unop_pack_int_2x32, rhs); + } + break; + case GLSL_TYPE_UINT64: + assert(lhs->type->vector_elements <= 2); + if (lhs->type->vector_elements == 2) { + ir_variable *t = new(mem_ctx) ir_variable(lhs->type, "unpack", ir_var_temporary); + assert(rhs->type->vector_elements == 4); + this->out_variables->push_tail(t); + this->out_instructions->push_tail( + assign(t, expr(ir_unop_pack_uint_2x32, i2u(swizzle_xy(rhs->clone(mem_ctx, NULL)))), 0x1)); + this->out_instructions->push_tail( + assign(t, expr(ir_unop_pack_uint_2x32, i2u(swizzle(rhs->clone(mem_ctx, NULL), SWIZZLE_ZWZW, 2))), 0x2)); + rhs = deref(t).val; + } else { + rhs = expr(ir_unop_pack_uint_2x32, i2u(rhs)); + } + break; default: assert(!"Unexpected type conversion while lowering varyings"); break; |