nir/serialize: cast swizzle before shifting

fixes undefined behaviour with enabled vec16

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Karol Herbst 2019-12-11 16:01:15 +01:00 committed by Karol Herbst
parent e6b2af56cb
commit c83b1a4560

View file

@ -879,7 +879,7 @@ write_alu(write_ctx *ctx, const nir_alu_instr *alu)
unsigned value = 0;
for (unsigned j = 0; j < 8 && o + j < src_channels; j++) {
value |= alu->src[i].swizzle[o + j] <<
value |= (uint32_t)alu->src[i].swizzle[o + j] <<
(4 * j); /* 4 bits per swizzle */
}