[PATCH vkd3d 6/9] vkd3d-shader: Correctly handle bit shifts greater than 31 bits.
Henri Verbeet
hverbeet at gmail.com
Mon Oct 11 10:59:14 CDT 2021
On Tue, 28 Sept 2021 at 07:39, Conor McCarthy <cmccarthy at codeweavers.com> wrote:
> + /* The SPIR-V specification states, "The resulting value is undefined if Shift is greater than or
> + * equal to the bit width of the components of Base." D3D applies only the lowest 5 bits of the shift. */
> + if (src[1].reg.type != VKD3DSPR_IMMCONST && (instruction->handler_idx == VKD3DSIH_ISHL
> + || instruction->handler_idx == VKD3DSIH_ISHR || instruction->handler_idx == VKD3DSIH_USHR))
> + {
> + uint32_t mask_id = vkd3d_dxbc_compiler_get_constant_vector(compiler, VKD3D_SHADER_COMPONENT_UINT,
> + vkd3d_write_mask_component_count(dst->write_mask), 0x1f);
> + src_ids[1] = vkd3d_spirv_build_op_and(builder, type_id, src_ids[1], mask_id);
> + }
Is there any particular reason to avoid handling VKD3DSPR_IMMCONST
shifts? I suppose immediate shifts are unlikely to be larger than 31,
but it should also be easy to verify that.
More information about the wine-devel
mailing list