diff options
author | Neil Roberts <[email protected]> | 2018-03-13 13:26:19 +0100 |
---|---|---|
committer | Neil Roberts <[email protected]> | 2018-03-14 08:43:33 +0100 |
commit | 25a966a23d397cdfd853bc3ee54a11cf3bd3f84d (patch) | |
tree | 839c1ac32830b8266ad85f5945476b649511c3f1 /src/compiler | |
parent | 1a0aba7216e54e117df744c252f152ff3eab6441 (diff) |
spirv: Handle doubles when multiplying a mat by a scalar
The code to handle mat multiplication by a scalar tries to pick either
imul or fmul depending on whether the matrix is float or integer.
However it was doing this by checking whether the base type is float.
This was making it choose the int path for doubles (and presumably
float16s).
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/spirv/vtn_alu.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/spirv/vtn_alu.c b/src/compiler/spirv/vtn_alu.c index d0c9e316935..110fcec2a60 100644 --- a/src/compiler/spirv/vtn_alu.c +++ b/src/compiler/spirv/vtn_alu.c @@ -142,10 +142,10 @@ mat_times_scalar(struct vtn_builder *b, { struct vtn_ssa_value *dest = vtn_create_ssa_value(b, mat->type); for (unsigned i = 0; i < glsl_get_matrix_columns(mat->type); i++) { - if (glsl_get_base_type(mat->type) == GLSL_TYPE_FLOAT) - dest->elems[i]->def = nir_fmul(&b->nb, mat->elems[i]->def, scalar); - else + if (glsl_base_type_is_integer(glsl_get_base_type(mat->type))) dest->elems[i]->def = nir_imul(&b->nb, mat->elems[i]->def, scalar); + else + dest->elems[i]->def = nir_fmul(&b->nb, mat->elems[i]->def, scalar); } return dest; |