spirv: update arguments for vtn_nir_alu_op_for_spirv_opcode()

We don't need anymore the source and destination's data type, just
their bitsize.

v2:
- Use glsl_get_bit_size () instead (Jason).

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Samuel Iglesias Gonsálvez
2018-03-14 08:49:43 +01:00
parent ce2fd87056
commit adf58e59d3
3 changed files with 15 additions and 15 deletions

View File

@@ -1725,8 +1725,8 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
}; };
nir_op op = vtn_nir_alu_op_for_spirv_opcode(b, opcode, &swap, nir_op op = vtn_nir_alu_op_for_spirv_opcode(b, opcode, &swap,
src_alu_type, nir_alu_type_get_type_size(src_alu_type),
dst_alu_type); nir_alu_type_get_type_size(dst_alu_type));
nir_const_value src[4]; nir_const_value src[4];
for (unsigned i = 0; i < count - 4; i++) { for (unsigned i = 0; i < count - 4; i++) {

View File

@@ -275,7 +275,7 @@ vtn_handle_bitcast(struct vtn_builder *b, struct vtn_ssa_value *dest,
nir_op nir_op
vtn_nir_alu_op_for_spirv_opcode(struct vtn_builder *b, vtn_nir_alu_op_for_spirv_opcode(struct vtn_builder *b,
SpvOp opcode, bool *swap, SpvOp opcode, bool *swap,
nir_alu_type src, nir_alu_type dst) unsigned src_bit_size, unsigned dst_bit_size)
{ {
/* Indicates that the first two arguments should be swapped. This is /* Indicates that the first two arguments should be swapped. This is
* used for implementing greater-than and less-than-or-equal. * used for implementing greater-than and less-than-or-equal.
@@ -388,8 +388,8 @@ vtn_nir_alu_op_for_spirv_opcode(struct vtn_builder *b,
default: default:
unreachable("Invalid opcode"); unreachable("Invalid opcode");
} }
src_type |= nir_alu_type_get_type_size(src); src_type |= src_bit_size;
dst_type |= nir_alu_type_get_type_size(dst); dst_type |= dst_bit_size;
return nir_type_conversion_op(src_type, dst_type, nir_rounding_mode_undef); return nir_type_conversion_op(src_type, dst_type, nir_rounding_mode_undef);
} }
/* Derivatives: */ /* Derivatives: */
@@ -575,10 +575,10 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
case SpvOpFUnordLessThanEqual: case SpvOpFUnordLessThanEqual:
case SpvOpFUnordGreaterThanEqual: { case SpvOpFUnordGreaterThanEqual: {
bool swap; bool swap;
nir_alu_type src_alu_type = nir_get_nir_type_for_glsl_type(vtn_src[0]->type); unsigned src_bit_size = glsl_get_bit_size(vtn_src[0]->type);
nir_alu_type dst_alu_type = nir_get_nir_type_for_glsl_type(type); unsigned dst_bit_size = glsl_get_bit_size(type);
nir_op op = vtn_nir_alu_op_for_spirv_opcode(b, opcode, &swap, nir_op op = vtn_nir_alu_op_for_spirv_opcode(b, opcode, &swap,
src_alu_type, dst_alu_type); src_bit_size, dst_bit_size);
if (swap) { if (swap) {
nir_ssa_def *tmp = src[0]; nir_ssa_def *tmp = src[0];
@@ -602,10 +602,10 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
case SpvOpFOrdLessThanEqual: case SpvOpFOrdLessThanEqual:
case SpvOpFOrdGreaterThanEqual: { case SpvOpFOrdGreaterThanEqual: {
bool swap; bool swap;
nir_alu_type src_alu_type = nir_get_nir_type_for_glsl_type(vtn_src[0]->type); unsigned src_bit_size = glsl_get_bit_size(vtn_src[0]->type);
nir_alu_type dst_alu_type = nir_get_nir_type_for_glsl_type(type); unsigned dst_bit_size = glsl_get_bit_size(type);
nir_op op = vtn_nir_alu_op_for_spirv_opcode(b, opcode, &swap, nir_op op = vtn_nir_alu_op_for_spirv_opcode(b, opcode, &swap,
src_alu_type, dst_alu_type); src_bit_size, dst_bit_size);
if (swap) { if (swap) {
nir_ssa_def *tmp = src[0]; nir_ssa_def *tmp = src[0];
@@ -640,10 +640,10 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
default: { default: {
bool swap; bool swap;
nir_alu_type src_alu_type = nir_get_nir_type_for_glsl_type(vtn_src[0]->type); unsigned src_bit_size = glsl_get_bit_size(vtn_src[0]->type);
nir_alu_type dst_alu_type = nir_get_nir_type_for_glsl_type(type); unsigned dst_bit_size = glsl_get_bit_size(type);
nir_op op = vtn_nir_alu_op_for_spirv_opcode(b, opcode, &swap, nir_op op = vtn_nir_alu_op_for_spirv_opcode(b, opcode, &swap,
src_alu_type, dst_alu_type); src_bit_size, dst_bit_size);
if (swap) { if (swap) {
nir_ssa_def *tmp = src[0]; nir_ssa_def *tmp = src[0];

View File

@@ -708,7 +708,7 @@ void vtn_foreach_execution_mode(struct vtn_builder *b, struct vtn_value *value,
nir_op vtn_nir_alu_op_for_spirv_opcode(struct vtn_builder *b, nir_op vtn_nir_alu_op_for_spirv_opcode(struct vtn_builder *b,
SpvOp opcode, bool *swap, SpvOp opcode, bool *swap,
nir_alu_type src, nir_alu_type dst); unsigned src_bit_size, unsigned dst_bit_size);
void vtn_handle_alu(struct vtn_builder *b, SpvOp opcode, void vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
const uint32_t *w, unsigned count); const uint32_t *w, unsigned count);