libs/vkd3d-shader: Fix write mask for vThreadIDInGroupFlattened.

This commit is contained in:
Józef Kucia 2017-07-24 19:43:50 +02:00
parent 6bbd6c948a
commit c71d609fb6

View File

@ -1890,6 +1890,7 @@ static void vkd3d_dxbc_compiler_emit_store_reg(struct vkd3d_dxbc_compiler *compi
uint32_t reg_id;
assert(reg->type != VKD3DSPR_IMMCONST);
assert(write_mask);
component_count = vkd3d_write_mask_component_count(write_mask);
@ -2045,21 +2046,18 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
SpvStorageClass storage_class;
struct rb_entry *entry = NULL;
bool use_private_var = false;
DWORD write_mask;
builtin = vkd3d_get_spirv_builtin(dst->reg.type, sysval);
/* vThreadIDInGroupFlattened is declared with no write mask in shader
* bytecode generated by fxc. */
if (!dst->write_mask && dst->reg.type == VKD3DSPR_LOCALTHREADINDEX)
{
component_idx = 0;
component_count = 1;
}
else
{
component_idx = vkd3d_write_mask_get_component_idx(dst->write_mask);
component_count = vkd3d_write_mask_component_count(dst->write_mask);
}
write_mask = dst->write_mask;
if (!write_mask && dst->reg.type == VKD3DSPR_LOCALTHREADINDEX)
write_mask = VKD3DSP_WRITEMASK_0;
component_idx = vkd3d_write_mask_get_component_idx(write_mask);
component_count = vkd3d_write_mask_component_count(write_mask);
if (builtin)
{
component_type = builtin->component_type;
@ -2105,7 +2103,7 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
}
if (val_id && input_component_count != component_count)
val_id = vkd3d_dxbc_compiler_emit_swizzle(compiler, val_id, VKD3DSP_NOSWIZZLE, dst->write_mask);
val_id = vkd3d_dxbc_compiler_emit_swizzle(compiler, val_id, VKD3DSP_NOSWIZZLE, write_mask);
vkd3d_symbol_make_register(&reg_symbol, &dst->reg);
@ -2131,7 +2129,7 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
if (use_private_var)
{
assert(val_id);
vkd3d_dxbc_compiler_emit_store_reg(compiler, &dst->reg, dst->write_mask, val_id);
vkd3d_dxbc_compiler_emit_store_reg(compiler, &dst->reg, write_mask, val_id);
}
return input_id;