vkd3d-shader/ir: Introduce vsir_register_is_descriptor().

This commit is contained in:
Henri Verbeet 2023-11-11 18:48:12 +01:00 committed by Alexandre Julliard
parent 22960753e9
commit 215a2c4ede
Notes: Alexandre Julliard 2023-11-13 23:30:13 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/467
3 changed files with 17 additions and 32 deletions

View File

@ -3396,21 +3396,6 @@ static bool spirv_compiler_get_register_info(const struct spirv_compiler *compil
return true;
}
static bool register_is_descriptor(const struct vkd3d_shader_register *reg)
{
switch (reg->type)
{
case VKD3DSPR_SAMPLER:
case VKD3DSPR_RESOURCE:
case VKD3DSPR_CONSTBUFFER:
case VKD3DSPR_UAV:
return true;
default:
return false;
}
}
static bool spirv_compiler_enable_descriptor_indexing(struct spirv_compiler *compiler,
enum vkd3d_shader_register_type reg_type, enum vkd3d_shader_resource_type resource_type)
{
@ -3536,7 +3521,7 @@ static void spirv_compiler_emit_dereference_register(struct spirv_compiler *comp
FIXME("Relative addressing not implemented.\n");
/* Handle arrayed registers, e.g. v[3][0]. */
if (reg->idx_count > 1 && !register_is_descriptor(reg))
if (reg->idx_count > 1 && !vsir_register_is_descriptor(reg))
indexes[index_count++] = spirv_compiler_emit_register_addressing(compiler, &reg->idx[0]);
}

View File

@ -1751,21 +1751,6 @@ static bool shader_sm4_read_reg_idx(struct vkd3d_shader_sm4_parser *priv, const
return true;
}
static bool sm4_register_is_descriptor(enum vkd3d_sm4_register_type register_type)
{
switch (register_type)
{
case VKD3D_SM4_RT_SAMPLER:
case VKD3D_SM4_RT_RESOURCE:
case VKD3D_SM4_RT_CONSTBUFFER:
case VKD3D_SM5_RT_UAV:
return true;
default:
return false;
}
}
static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const uint32_t **ptr, const uint32_t *end,
enum vkd3d_data_type data_type, struct vkd3d_shader_register *param, enum vkd3d_shader_src_modifier *modifier)
{
@ -1943,7 +1928,7 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui
break;
}
}
else if (!shader_is_sm_5_1(priv) && sm4_register_is_descriptor(register_type))
else if (!shader_is_sm_5_1(priv) && vsir_register_is_descriptor(param))
{
/* SM5.1 places a symbol identifier in idx[0] and moves
* other values up one slot. Normalize to SM5.1. */

View File

@ -833,6 +833,21 @@ struct vkd3d_shader_register
void vsir_register_init(struct vkd3d_shader_register *reg, enum vkd3d_shader_register_type reg_type,
enum vkd3d_data_type data_type, unsigned int idx_count);
static inline bool vsir_register_is_descriptor(const struct vkd3d_shader_register *reg)
{
switch (reg->type)
{
case VKD3DSPR_SAMPLER:
case VKD3DSPR_RESOURCE:
case VKD3DSPR_CONSTBUFFER:
case VKD3DSPR_UAV:
return true;
default:
return false;
}
}
struct vkd3d_shader_dst_param
{
struct vkd3d_shader_register reg;