mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Read the SM5 resource data type instruction modifier.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c3a5df7375
commit
7dd8c15d49
@ -23,6 +23,9 @@
|
||||
|
||||
#define VKD3D_SM4_MODIFIER_MASK 0x3fu
|
||||
|
||||
#define VKD3D_SM5_MODIFIER_DATA_TYPE_SHIFT 6
|
||||
#define VKD3D_SM5_MODIFIER_DATA_TYPE_MASK (0xffffu << VKD3D_SM5_MODIFIER_DATA_TYPE_SHIFT)
|
||||
|
||||
#define VKD3D_SM5_MODIFIER_RESOURCE_TYPE_SHIFT 6
|
||||
#define VKD3D_SM5_MODIFIER_RESOURCE_TYPE_MASK (0xfu << VKD3D_SM5_MODIFIER_RESOURCE_TYPE_SHIFT)
|
||||
|
||||
@ -311,6 +314,7 @@ enum vkd3d_sm4_instruction_modifier
|
||||
{
|
||||
VKD3D_SM4_MODIFIER_AOFFIMMI = 0x1,
|
||||
VKD3D_SM5_MODIFIER_RESOURCE_TYPE = 0x2,
|
||||
VKD3D_SM5_MODIFIER_DATA_TYPE = 0x3,
|
||||
};
|
||||
|
||||
enum vkd3d_sm4_register_type
|
||||
@ -1776,6 +1780,17 @@ static void shader_sm4_read_instruction_modifier(DWORD modifier, struct vkd3d_sh
|
||||
break;
|
||||
}
|
||||
|
||||
case VKD3D_SM5_MODIFIER_DATA_TYPE:
|
||||
{
|
||||
DWORD components = (modifier & VKD3D_SM5_MODIFIER_DATA_TYPE_MASK) >> VKD3D_SM5_MODIFIER_DATA_TYPE_SHIFT;
|
||||
enum vkd3d_sm4_data_type data_type = components & 0xf;
|
||||
|
||||
if ((components & 0xfff0) != (components & 0xf) * 0x1110)
|
||||
FIXME("Components (%#x) have different data types.\n", components);
|
||||
ins->resource_data_type = data_type_table[data_type];
|
||||
break;
|
||||
}
|
||||
|
||||
case VKD3D_SM5_MODIFIER_RESOURCE_TYPE:
|
||||
{
|
||||
enum vkd3d_sm4_resource_type resource_type
|
||||
@ -1846,6 +1861,7 @@ void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct vkd3d_sha
|
||||
ins->src_count = strlen(opcode_info->src_info);
|
||||
ins->src = priv->src_param;
|
||||
ins->resource_type = VKD3D_SHADER_RESOURCE_NONE;
|
||||
ins->resource_data_type = VKD3D_DATA_FLOAT;
|
||||
memset(&ins->texel_offset, 0, sizeof(ins->texel_offset));
|
||||
|
||||
p = *ptr;
|
||||
|
@ -517,6 +517,27 @@ static void shader_dump_resource_type(struct vkd3d_string_buffer *buffer, enum v
|
||||
shader_addline(buffer, "unknown");
|
||||
}
|
||||
|
||||
static void shader_dump_data_type(struct vkd3d_string_buffer *buffer, enum vkd3d_data_type type)
|
||||
{
|
||||
static const char *const data_type_names[] =
|
||||
{
|
||||
/* VKD3D_DATA_FLOAT */ "(float)",
|
||||
/* VKD3D_DATA_INT */ "(int)",
|
||||
/* VKD3D_DATA_RESOURCE */ "(resource)",
|
||||
/* VKD3D_DATA_SAMPLER */ "(sampler)",
|
||||
/* VKD3D_DATA_UAV */ "(uav)",
|
||||
/* VKD3D_DATA_UINT */ "(uint)",
|
||||
/* VKD3D_DATA_UNORM */ "(unorm)",
|
||||
/* VKD3D_DATA_SNORM */ "(snorm)",
|
||||
/* VKD3D_DATA_OPAQUE */ "(opaque)",
|
||||
};
|
||||
|
||||
if (type <= ARRAY_SIZE(data_type_names))
|
||||
shader_addline(buffer, "%s", data_type_names[type]);
|
||||
else
|
||||
shader_addline(buffer, "(unknown)");
|
||||
}
|
||||
|
||||
static void shader_dump_decl_usage(struct vkd3d_string_buffer *buffer,
|
||||
const struct vkd3d_shader_semantic *semantic, unsigned int flags,
|
||||
const struct vkd3d_shader_version *shader_version)
|
||||
@ -553,32 +574,7 @@ static void shader_dump_decl_usage(struct vkd3d_string_buffer *buffer,
|
||||
shader_dump_resource_type(buffer, semantic->resource_type);
|
||||
if (semantic->resource.reg.reg.type == VKD3DSPR_UAV)
|
||||
shader_dump_uav_flags(buffer, flags);
|
||||
switch (semantic->resource_data_type)
|
||||
{
|
||||
case VKD3D_DATA_FLOAT:
|
||||
shader_addline(buffer, " (float)");
|
||||
break;
|
||||
|
||||
case VKD3D_DATA_INT:
|
||||
shader_addline(buffer, " (int)");
|
||||
break;
|
||||
|
||||
case VKD3D_DATA_UINT:
|
||||
shader_addline(buffer, " (uint)");
|
||||
break;
|
||||
|
||||
case VKD3D_DATA_UNORM:
|
||||
shader_addline(buffer, " (unorm)");
|
||||
break;
|
||||
|
||||
case VKD3D_DATA_SNORM:
|
||||
shader_addline(buffer, " (snorm)");
|
||||
break;
|
||||
|
||||
default:
|
||||
shader_addline(buffer, " (unknown)");
|
||||
break;
|
||||
}
|
||||
shader_dump_data_type(buffer, semantic->resource_data_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1507,6 +1503,9 @@ static void shader_dump_instruction(struct vkd3d_string_buffer *buffer,
|
||||
shader_addline(buffer, ")");
|
||||
}
|
||||
|
||||
if (ins->resource_data_type != VKD3D_DATA_FLOAT)
|
||||
shader_dump_data_type(buffer, ins->resource_data_type);
|
||||
|
||||
for (i = 0; i < ins->dst_count; ++i)
|
||||
{
|
||||
shader_dump_ins_modifiers(buffer, &ins->dst[i]);
|
||||
|
@ -765,6 +765,7 @@ struct vkd3d_shader_instruction
|
||||
const struct vkd3d_shader_src_param *src;
|
||||
struct vkd3d_shader_texel_offset texel_offset;
|
||||
enum vkd3d_shader_resource_type resource_type;
|
||||
enum vkd3d_data_type resource_data_type;
|
||||
bool coissue;
|
||||
const struct vkd3d_shader_src_param *predicate;
|
||||
union
|
||||
|
Loading…
Reference in New Issue
Block a user