wined3d: 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:
Zebediah Figura 2020-09-02 18:40:36 -05:00 committed by Alexandre Julliard
parent 9610e71f34
commit 2f94e72b80
3 changed files with 42 additions and 26 deletions

View File

@ -2065,6 +2065,27 @@ static void shader_dump_resource_type(struct wined3d_string_buffer *buffer, enum
shader_addline(buffer, "unknown");
}
static void shader_dump_data_type(struct wined3d_string_buffer *buffer, enum wined3d_data_type type)
{
static const char *const data_type_names[] =
{
/* WINED3D_DATA_FLOAT */ "(float)",
/* WINED3D_DATA_INT */ "(int)",
/* WINED3D_DATA_RESOURCE */ "(resource)",
/* WINED3D_DATA_SAMPLER */ "(sampler)",
/* WINED3D_DATA_UAV */ "(uav)",
/* WINED3D_DATA_UINT */ "(uint)",
/* WINED3D_DATA_UNORM */ "(unorm)",
/* WINED3D_DATA_SNORM */ "(snorm)",
/* WINED3D_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 wined3d_string_buffer *buffer,
const struct wined3d_shader_semantic *semantic, unsigned int flags,
const struct wined3d_shader_version *shader_version)
@ -2101,32 +2122,7 @@ static void shader_dump_decl_usage(struct wined3d_string_buffer *buffer,
shader_dump_resource_type(buffer, semantic->resource_type);
if (semantic->reg.reg.type == WINED3DSPR_UAV)
shader_dump_uav_flags(buffer, flags);
switch (semantic->resource_data_type)
{
case WINED3D_DATA_FLOAT:
shader_addline(buffer, " (float)");
break;
case WINED3D_DATA_INT:
shader_addline(buffer, " (int)");
break;
case WINED3D_DATA_UINT:
shader_addline(buffer, " (uint)");
break;
case WINED3D_DATA_UNORM:
shader_addline(buffer, " (unorm)");
break;
case WINED3D_DATA_SNORM:
shader_addline(buffer, " (snorm)");
break;
default:
shader_addline(buffer, " (unknown)");
break;
}
shader_dump_data_type(buffer, semantic->resource_data_type);
}
else
{
@ -3101,6 +3097,9 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
shader_addline(&buffer, ")");
}
if (ins.resource_data_type != WINED3D_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]);

View File

@ -28,6 +28,9 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode);
#define WINED3D_SM4_MODIFIER_MASK 0x3fu
#define WINED3D_SM5_MODIFIER_DATA_TYPE_SHIFT 6
#define WINED3D_SM5_MODIFIER_DATA_TYPE_MASK (0xffffu << WINED3D_SM5_MODIFIER_DATA_TYPE_SHIFT)
#define WINED3D_SM5_MODIFIER_RESOURCE_TYPE_SHIFT 6
#define WINED3D_SM5_MODIFIER_RESOURCE_TYPE_MASK (0xfu << WINED3D_SM5_MODIFIER_RESOURCE_TYPE_SHIFT)
@ -312,6 +315,7 @@ enum wined3d_sm4_instruction_modifier
{
WINED3D_SM4_MODIFIER_AOFFIMMI = 0x1,
WINED3D_SM5_MODIFIER_RESOURCE_TYPE = 0x2,
WINED3D_SM5_MODIFIER_DATA_TYPE = 0x3,
};
enum wined3d_sm4_register_type
@ -1651,6 +1655,17 @@ static void shader_sm4_read_instruction_modifier(DWORD modifier, struct wined3d_
break;
}
case WINED3D_SM5_MODIFIER_DATA_TYPE:
{
DWORD components = (modifier & WINED3D_SM5_MODIFIER_DATA_TYPE_MASK) >> WINED3D_SM5_MODIFIER_DATA_TYPE_SHIFT;
enum wined3d_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 WINED3D_SM5_MODIFIER_RESOURCE_TYPE:
{
enum wined3d_sm4_resource_type resource_type
@ -1731,6 +1746,7 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi
ins->src_count = strlen(opcode_info->src_info);
ins->src = priv->src_param;
ins->resource_type = WINED3D_SHADER_RESOURCE_NONE;
ins->resource_data_type = WINED3D_DATA_FLOAT;
memset(&ins->texel_offset, 0, sizeof(ins->texel_offset));
p = *ptr;

View File

@ -1247,6 +1247,7 @@ struct wined3d_shader_instruction
const struct wined3d_shader_src_param *src;
struct wined3d_shader_texel_offset texel_offset;
enum wined3d_shader_resource_type resource_type;
enum wined3d_data_type resource_data_type;
BOOL coissue;
const struct wined3d_shader_src_param *predicate;
union