vkd3d-shader: Rename the VKD3D_SWIZZLE macro to VKD3D_SHADER_SWIZZLE.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2020-07-10 16:44:02 +04:30 committed by Alexandre Julliard
parent 3a9eb1839e
commit edd585ea44
6 changed files with 37 additions and 34 deletions

View File

@ -701,22 +701,23 @@ struct vkd3d_shader_signature
}; };
/* swizzle bits fields: wwzzyyxx */ /* swizzle bits fields: wwzzyyxx */
#define VKD3D_SWIZZLE_X (0u) #define VKD3D_SHADER_SWIZZLE_X (0u)
#define VKD3D_SWIZZLE_Y (1u) #define VKD3D_SHADER_SWIZZLE_Y (1u)
#define VKD3D_SWIZZLE_Z (2u) #define VKD3D_SHADER_SWIZZLE_Z (2u)
#define VKD3D_SWIZZLE_W (3u) #define VKD3D_SHADER_SWIZZLE_W (3u)
#define VKD3D_SWIZZLE_MASK (0x3u) #define VKD3D_SHADER_SWIZZLE_MASK (0x3u)
#define VKD3D_SWIZZLE_SHIFT(idx) (2u * (idx)) #define VKD3D_SHADER_SWIZZLE_SHIFT(idx) (2u * (idx))
#define VKD3D_SWIZZLE(x, y, z, w) \ #define VKD3D_SHADER_SWIZZLE(x, y, z, w) \
(((x & VKD3D_SWIZZLE_MASK) << VKD3D_SWIZZLE_SHIFT(0)) \ (((x & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(0)) \
| ((y & VKD3D_SWIZZLE_MASK) << VKD3D_SWIZZLE_SHIFT(1)) \ | ((y & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(1)) \
| ((z & VKD3D_SWIZZLE_MASK) << VKD3D_SWIZZLE_SHIFT(2)) \ | ((z & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(2)) \
| ((w & VKD3D_SWIZZLE_MASK) << VKD3D_SWIZZLE_SHIFT(3))) | ((w & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(3)))
#define VKD3D_NO_SWIZZLE \ #define VKD3D_SHADER_NO_SWIZZLE \
VKD3D_SWIZZLE(VKD3D_SWIZZLE_X, VKD3D_SWIZZLE_Y, VKD3D_SWIZZLE_Z, VKD3D_SWIZZLE_W) VKD3D_SHADER_SWIZZLE(VKD3D_SHADER_SWIZZLE_X, VKD3D_SHADER_SWIZZLE_Y, \
VKD3D_SHADER_SWIZZLE_Z, VKD3D_SHADER_SWIZZLE_W)
#ifndef VKD3D_SHADER_NO_PROTOTYPES #ifndef VKD3D_SHADER_NO_PROTOTYPES

View File

@ -1658,7 +1658,7 @@ static bool shader_sm4_read_src_param(struct vkd3d_sm4_data *priv, const DWORD *
if (src_param->reg.type == VKD3DSPR_IMMCONST) if (src_param->reg.type == VKD3DSPR_IMMCONST)
{ {
src_param->swizzle = VKD3D_NO_SWIZZLE; src_param->swizzle = VKD3D_SHADER_NO_SWIZZLE;
} }
else else
{ {
@ -1669,9 +1669,10 @@ static bool shader_sm4_read_src_param(struct vkd3d_sm4_data *priv, const DWORD *
{ {
case VKD3D_SM4_SWIZZLE_NONE: case VKD3D_SM4_SWIZZLE_NONE:
if (shader_sm4_is_scalar_register(&src_param->reg)) if (shader_sm4_is_scalar_register(&src_param->reg))
src_param->swizzle = VKD3D_SWIZZLE(VKD3D_SWIZZLE_X, VKD3D_SWIZZLE_X, VKD3D_SWIZZLE_X, VKD3D_SWIZZLE_X); src_param->swizzle = VKD3D_SHADER_SWIZZLE(VKD3D_SHADER_SWIZZLE_X,
VKD3D_SHADER_SWIZZLE_X, VKD3D_SHADER_SWIZZLE_X, VKD3D_SHADER_SWIZZLE_X);
else else
src_param->swizzle = VKD3D_NO_SWIZZLE; src_param->swizzle = VKD3D_SHADER_NO_SWIZZLE;
break; break;
case VKD3D_SM4_SWIZZLE_SCALAR: case VKD3D_SM4_SWIZZLE_SCALAR:

View File

@ -2963,7 +2963,7 @@ static uint32_t vkd3d_dxbc_compiler_get_register_id(struct vkd3d_dxbc_compiler *
static bool vkd3d_swizzle_is_equal(unsigned int dst_write_mask, static bool vkd3d_swizzle_is_equal(unsigned int dst_write_mask,
unsigned int swizzle, unsigned int write_mask) unsigned int swizzle, unsigned int write_mask)
{ {
return vkd3d_compact_swizzle(VKD3D_NO_SWIZZLE, dst_write_mask) == vkd3d_compact_swizzle(swizzle, write_mask); return vkd3d_compact_swizzle(VKD3D_SHADER_NO_SWIZZLE, dst_write_mask) == vkd3d_compact_swizzle(swizzle, write_mask);
} }
static uint32_t vkd3d_dxbc_compiler_emit_swizzle(struct vkd3d_dxbc_compiler *compiler, static uint32_t vkd3d_dxbc_compiler_emit_swizzle(struct vkd3d_dxbc_compiler *compiler,
@ -4162,7 +4162,7 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
val_id = vkd3d_dxbc_compiler_emit_swizzle(compiler, val_id, val_id = vkd3d_dxbc_compiler_emit_swizzle(compiler, val_id,
vkd3d_write_mask_from_component_count(input_component_count) << component_idx, vkd3d_write_mask_from_component_count(input_component_count) << component_idx,
VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_NO_SWIZZLE, dst->write_mask); VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_SHADER_NO_SWIZZLE, dst->write_mask);
vkd3d_dxbc_compiler_emit_store_reg(compiler, &dst_reg, dst->write_mask, val_id); vkd3d_dxbc_compiler_emit_store_reg(compiler, &dst_reg, dst->write_mask, val_id);
} }
@ -4257,9 +4257,9 @@ static unsigned int get_shader_output_swizzle(const struct vkd3d_dxbc_compiler *
const struct vkd3d_shader_spirv_target_info *info; const struct vkd3d_shader_spirv_target_info *info;
if (!(info = compiler->spirv_target_info)) if (!(info = compiler->spirv_target_info))
return VKD3D_NO_SWIZZLE; return VKD3D_SHADER_NO_SWIZZLE;
if (register_idx >= info->output_swizzle_count) if (register_idx >= info->output_swizzle_count)
return VKD3D_NO_SWIZZLE; return VKD3D_SHADER_NO_SWIZZLE;
return info->output_swizzles[register_idx]; return info->output_swizzles[register_idx];
} }
@ -4488,7 +4488,7 @@ static void vkd3d_dxbc_compiler_emit_output(struct vkd3d_dxbc_compiler *compiler
if ((use_private_variable = builtin && builtin->spirv_array_size)) if ((use_private_variable = builtin && builtin->spirv_array_size))
write_mask = VKD3DSP_WRITEMASK_ALL; write_mask = VKD3DSP_WRITEMASK_ALL;
else if (get_shader_output_swizzle(compiler, signature_element->register_index) != VKD3D_NO_SWIZZLE else if (get_shader_output_swizzle(compiler, signature_element->register_index) != VKD3D_SHADER_NO_SWIZZLE
|| needs_private_io_variable(shader_signature, signature_element->register_index, || needs_private_io_variable(shader_signature, signature_element->register_index,
builtin, &output_component_count, &write_mask) builtin, &output_component_count, &write_mask)
|| is_patch_constant) || is_patch_constant)
@ -4704,8 +4704,8 @@ static void vkd3d_dxbc_compiler_emit_store_shader_output(struct vkd3d_dxbc_compi
chain_id = vkd3d_spirv_build_op_access_chain1(builder, chain_id = vkd3d_spirv_build_op_access_chain1(builder,
ptr_type_id, output_id, vkd3d_dxbc_compiler_get_constant_uint(compiler, index)); ptr_type_id, output_id, vkd3d_dxbc_compiler_get_constant_uint(compiler, index));
object_id = vkd3d_dxbc_compiler_emit_swizzle(compiler, val_id, object_id = vkd3d_dxbc_compiler_emit_swizzle(compiler, val_id, write_mask,
write_mask, output_info->component_type, VKD3D_NO_SWIZZLE, VKD3DSP_WRITEMASK_0 << i); output_info->component_type, VKD3D_SHADER_NO_SWIZZLE, VKD3DSP_WRITEMASK_0 << i);
vkd3d_dxbc_compiler_emit_store(compiler, chain_id, VKD3DSP_WRITEMASK_0, vkd3d_dxbc_compiler_emit_store(compiler, chain_id, VKD3DSP_WRITEMASK_0,
output_info->component_type, SpvStorageClassOutput, VKD3DSP_WRITEMASK_0 << i, object_id); output_info->component_type, SpvStorageClassOutput, VKD3DSP_WRITEMASK_0 << i, object_id);
++index; ++index;
@ -6978,7 +6978,7 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
assert(compiler->control_flow_depth); assert(compiler->control_flow_depth);
assert(cf_info->current_block == VKD3D_BLOCK_SWITCH); assert(cf_info->current_block == VKD3D_BLOCK_SWITCH);
assert(src->swizzle == VKD3D_NO_SWIZZLE && src->reg.type == VKD3DSPR_IMMCONST); assert(src->swizzle == VKD3D_SHADER_NO_SWIZZLE && src->reg.type == VKD3DSPR_IMMCONST);
value = *src->reg.u.immconst_uint; value = *src->reg.u.immconst_uint;
if (!vkd3d_array_reserve((void **)&cf_info->u.switch_.case_blocks, &cf_info->u.switch_.case_blocks_size, if (!vkd3d_array_reserve((void **)&cf_info->u.switch_.case_blocks, &cf_info->u.switch_.case_blocks_size,

View File

@ -1124,13 +1124,13 @@ static void shader_dump_src_param(struct vkd3d_string_buffer *buffer,
default: shader_addline(buffer, "_unknown_modifier(%#x)", src_modifier); default: shader_addline(buffer, "_unknown_modifier(%#x)", src_modifier);
} }
if (swizzle != VKD3D_NO_SWIZZLE) if (swizzle != VKD3D_SHADER_NO_SWIZZLE)
{ {
static const char swizzle_chars[] = "xyzw"; static const char swizzle_chars[] = "xyzw";
DWORD swizzle_x = (swizzle >> VKD3D_SWIZZLE_SHIFT(0)) & VKD3D_SWIZZLE_MASK; DWORD swizzle_x = (swizzle >> VKD3D_SHADER_SWIZZLE_SHIFT(0)) & VKD3D_SHADER_SWIZZLE_MASK;
DWORD swizzle_y = (swizzle >> VKD3D_SWIZZLE_SHIFT(1)) & VKD3D_SWIZZLE_MASK; DWORD swizzle_y = (swizzle >> VKD3D_SHADER_SWIZZLE_SHIFT(1)) & VKD3D_SHADER_SWIZZLE_MASK;
DWORD swizzle_z = (swizzle >> VKD3D_SWIZZLE_SHIFT(2)) & VKD3D_SWIZZLE_MASK; DWORD swizzle_z = (swizzle >> VKD3D_SHADER_SWIZZLE_SHIFT(2)) & VKD3D_SHADER_SWIZZLE_MASK;
DWORD swizzle_w = (swizzle >> VKD3D_SWIZZLE_SHIFT(3)) & VKD3D_SWIZZLE_MASK; DWORD swizzle_w = (swizzle >> VKD3D_SHADER_SWIZZLE_SHIFT(3)) & VKD3D_SHADER_SWIZZLE_MASK;
if (swizzle_x == swizzle_y if (swizzle_x == swizzle_y
&& swizzle_x == swizzle_z && swizzle_x == swizzle_z

View File

@ -886,7 +886,7 @@ static inline unsigned int vkd3d_write_mask_from_component_count(unsigned int co
static inline unsigned int vkd3d_swizzle_get_component(DWORD swizzle, static inline unsigned int vkd3d_swizzle_get_component(DWORD swizzle,
unsigned int idx) unsigned int idx)
{ {
return (swizzle >> VKD3D_SWIZZLE_SHIFT(idx)) & VKD3D_SWIZZLE_MASK; return (swizzle >> VKD3D_SHADER_SWIZZLE_SHIFT(idx)) & VKD3D_SHADER_SWIZZLE_MASK;
} }
static inline unsigned int vkd3d_compact_swizzle(unsigned int swizzle, unsigned int write_mask) static inline unsigned int vkd3d_compact_swizzle(unsigned int swizzle, unsigned int write_mask)
@ -897,7 +897,7 @@ static inline unsigned int vkd3d_compact_swizzle(unsigned int swizzle, unsigned
{ {
if (write_mask & (VKD3DSP_WRITEMASK_0 << i)) if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
{ {
compacted_swizzle <<= VKD3D_SWIZZLE_SHIFT(1); compacted_swizzle <<= VKD3D_SHADER_SWIZZLE_SHIFT(1);
compacted_swizzle |= vkd3d_swizzle_get_component(swizzle, i); compacted_swizzle |= vkd3d_swizzle_get_component(swizzle, i);
} }
} }

View File

@ -1953,9 +1953,10 @@ static HRESULT compute_input_layout_offsets(const struct d3d12_device *device,
static unsigned int vkd3d_get_rt_format_swizzle(const struct vkd3d_format *format) static unsigned int vkd3d_get_rt_format_swizzle(const struct vkd3d_format *format)
{ {
if (format->dxgi_format == DXGI_FORMAT_A8_UNORM) if (format->dxgi_format == DXGI_FORMAT_A8_UNORM)
return VKD3D_SWIZZLE(VKD3D_SWIZZLE_W, VKD3D_SWIZZLE_X, VKD3D_SWIZZLE_Y, VKD3D_SWIZZLE_Z); return VKD3D_SHADER_SWIZZLE(VKD3D_SHADER_SWIZZLE_W, VKD3D_SHADER_SWIZZLE_X,
VKD3D_SHADER_SWIZZLE_Y, VKD3D_SHADER_SWIZZLE_Z);
return VKD3D_NO_SWIZZLE; return VKD3D_SHADER_NO_SWIZZLE;
} }
STATIC_ASSERT(sizeof(struct vkd3d_shader_transform_feedback_element) == sizeof(D3D12_SO_DECLARATION_ENTRY)); STATIC_ASSERT(sizeof(struct vkd3d_shader_transform_feedback_element) == sizeof(D3D12_SO_DECLARATION_ENTRY));
@ -2102,7 +2103,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
if (desc->RTVFormats[i] == DXGI_FORMAT_UNKNOWN) if (desc->RTVFormats[i] == DXGI_FORMAT_UNKNOWN)
{ {
graphics->null_attachment_mask |= 1u << i; graphics->null_attachment_mask |= 1u << i;
ps_output_swizzle[i] = VKD3D_NO_SWIZZLE; ps_output_swizzle[i] = VKD3D_SHADER_NO_SWIZZLE;
graphics->rtv_formats[i] = VK_FORMAT_UNDEFINED; graphics->rtv_formats[i] = VK_FORMAT_UNDEFINED;
} }
else if ((format = vkd3d_get_format(device, desc->RTVFormats[i], false))) else if ((format = vkd3d_get_format(device, desc->RTVFormats[i], false)))