mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
libs/vkd3d-shader: Rework swizzle macros.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3198cab3ed
commit
926f844ead
@ -1521,7 +1521,7 @@ static BOOL shader_sm4_read_src_param(struct vkd3d_sm4_data *priv, const DWORD *
|
||||
|
||||
if (src_param->reg.type == VKD3DSPR_IMMCONST)
|
||||
{
|
||||
src_param->swizzle = VKD3DSP_NOSWIZZLE;
|
||||
src_param->swizzle = VKD3D_NO_SWIZZLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1531,7 +1531,7 @@ static BOOL shader_sm4_read_src_param(struct vkd3d_sm4_data *priv, const DWORD *
|
||||
switch (swizzle_type)
|
||||
{
|
||||
case VKD3D_SM4_SWIZZLE_NONE:
|
||||
src_param->swizzle = VKD3DSP_NOSWIZZLE;
|
||||
src_param->swizzle = VKD3D_NO_SWIZZLE;
|
||||
break;
|
||||
|
||||
case VKD3D_SM4_SWIZZLE_SCALAR:
|
||||
|
@ -2349,7 +2349,7 @@ static uint32_t vkd3d_dxbc_compiler_emit_swizzle(struct vkd3d_dxbc_compiler *com
|
||||
unsigned int i, component_idx, component_count;
|
||||
uint32_t type_id, components[VKD3D_VEC4_SIZE];
|
||||
|
||||
if (swizzle == VKD3DSP_NOSWIZZLE && write_mask == VKD3DSP_WRITEMASK_ALL)
|
||||
if (swizzle == VKD3D_NO_SWIZZLE && write_mask == VKD3DSP_WRITEMASK_ALL)
|
||||
return val_id;
|
||||
|
||||
component_count = vkd3d_write_mask_component_count(write_mask);
|
||||
@ -2972,7 +2972,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, VKD3D_TYPE_FLOAT, VKD3DSP_NOSWIZZLE, dst->write_mask);
|
||||
val_id, VKD3D_TYPE_FLOAT, VKD3D_NO_SWIZZLE, dst->write_mask);
|
||||
|
||||
vkd3d_symbol_make_register(®_symbol, reg);
|
||||
|
||||
@ -4601,7 +4601,7 @@ static void vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_
|
||||
assert(compiler->control_flow_depth);
|
||||
assert(cf_info->current_block == VKD3D_BLOCK_SWITCH);
|
||||
|
||||
assert(src->swizzle == VKD3DSP_NOSWIZZLE && src->reg.type == VKD3DSPR_IMMCONST);
|
||||
assert(src->swizzle == VKD3D_NO_SWIZZLE && src->reg.type == VKD3DSPR_IMMCONST);
|
||||
value = *src->reg.u.immconst_data;
|
||||
|
||||
if (!vkd3d_array_reserve((void **)&cf_info->u.switch_.case_blocks, &cf_info->u.switch_.case_blocks_size,
|
||||
@ -5946,7 +5946,7 @@ static void vkd3d_dxbc_compiler_emit_output_setup_function(struct vkd3d_dxbc_com
|
||||
|
||||
write_mask = signature->elements[i].mask & 0xff;
|
||||
val_id = vkd3d_dxbc_compiler_emit_swizzle(compiler,
|
||||
param_id[variable_idx], VKD3D_TYPE_FLOAT, VKD3DSP_NOSWIZZLE, write_mask);
|
||||
param_id[variable_idx], VKD3D_TYPE_FLOAT, VKD3D_NO_SWIZZLE, write_mask);
|
||||
|
||||
if (compiler->output_info[i].component_type != VKD3D_TYPE_FLOAT)
|
||||
{
|
||||
|
@ -390,8 +390,6 @@ enum vkd3d_immconst_type
|
||||
VKD3D_IMMCONST_VEC4,
|
||||
};
|
||||
|
||||
#define VKD3DSP_NOSWIZZLE (0u | (1u << 2) | (2u << 4) | (3u << 6))
|
||||
|
||||
enum vkd3d_shader_src_modifier
|
||||
{
|
||||
VKD3DSPSM_NONE = 0,
|
||||
@ -852,11 +850,22 @@ static inline unsigned int vkd3d_write_mask_component_count(DWORD write_mask)
|
||||
return count;
|
||||
}
|
||||
|
||||
/* swizzle bits fields: wwzzyyxx */
|
||||
#define VKD3D_SWIZZLE_X (0u)
|
||||
#define VKD3D_SWIZZLE_Y (1u)
|
||||
#define VKD3D_SWIZZLE_Z (2u)
|
||||
#define VKD3D_SWIZZLE_W (3u)
|
||||
#define VKD3D_SWIZZLE_MASK (0x3u)
|
||||
#define VKD3D_SWIZZLE_SHIFT(idx) (2u * (idx))
|
||||
#define VKD3D_NO_SWIZZLE ((VKD3D_SWIZZLE_X << VKD3D_SWIZZLE_SHIFT(0)) \
|
||||
| (VKD3D_SWIZZLE_Y << VKD3D_SWIZZLE_SHIFT(1)) \
|
||||
| (VKD3D_SWIZZLE_Z << VKD3D_SWIZZLE_SHIFT(2)) \
|
||||
| (VKD3D_SWIZZLE_W << VKD3D_SWIZZLE_SHIFT(3)))
|
||||
|
||||
static inline unsigned int vkd3d_swizzle_get_component(DWORD swizzle,
|
||||
unsigned int idx)
|
||||
{
|
||||
/* swizzle bits fields: wwzzyyxx */
|
||||
return (swizzle >> (2 * idx)) & 0x3;
|
||||
return (swizzle >> VKD3D_SWIZZLE_SHIFT(idx)) & VKD3D_SWIZZLE_MASK;
|
||||
}
|
||||
|
||||
#define VKD3D_DXBC_MAX_SOURCE_COUNT 6
|
||||
|
Loading…
Reference in New Issue
Block a user