Commit 2f94e72b authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Read the SM5 resource data type instruction modifier.

parent 9610e71f
...@@ -2065,6 +2065,27 @@ static void shader_dump_resource_type(struct wined3d_string_buffer *buffer, enum ...@@ -2065,6 +2065,27 @@ static void shader_dump_resource_type(struct wined3d_string_buffer *buffer, enum
shader_addline(buffer, "unknown"); 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, static void shader_dump_decl_usage(struct wined3d_string_buffer *buffer,
const struct wined3d_shader_semantic *semantic, unsigned int flags, const struct wined3d_shader_semantic *semantic, unsigned int flags,
const struct wined3d_shader_version *shader_version) const struct wined3d_shader_version *shader_version)
...@@ -2101,32 +2122,7 @@ static void shader_dump_decl_usage(struct wined3d_string_buffer *buffer, ...@@ -2101,32 +2122,7 @@ static void shader_dump_decl_usage(struct wined3d_string_buffer *buffer,
shader_dump_resource_type(buffer, semantic->resource_type); shader_dump_resource_type(buffer, semantic->resource_type);
if (semantic->reg.reg.type == WINED3DSPR_UAV) if (semantic->reg.reg.type == WINED3DSPR_UAV)
shader_dump_uav_flags(buffer, flags); shader_dump_uav_flags(buffer, flags);
switch (semantic->resource_data_type) shader_dump_data_type(buffer, 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;
}
} }
else else
{ {
...@@ -3101,6 +3097,9 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe ...@@ -3101,6 +3097,9 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
shader_addline(&buffer, ")"); 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) for (i = 0; i < ins.dst_count; ++i)
{ {
shader_dump_ins_modifiers(&buffer, &ins.dst[i]); shader_dump_ins_modifiers(&buffer, &ins.dst[i]);
......
...@@ -28,6 +28,9 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode); ...@@ -28,6 +28,9 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode);
#define WINED3D_SM4_MODIFIER_MASK 0x3fu #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_SHIFT 6
#define WINED3D_SM5_MODIFIER_RESOURCE_TYPE_MASK (0xfu << WINED3D_SM5_MODIFIER_RESOURCE_TYPE_SHIFT) #define WINED3D_SM5_MODIFIER_RESOURCE_TYPE_MASK (0xfu << WINED3D_SM5_MODIFIER_RESOURCE_TYPE_SHIFT)
...@@ -312,6 +315,7 @@ enum wined3d_sm4_instruction_modifier ...@@ -312,6 +315,7 @@ enum wined3d_sm4_instruction_modifier
{ {
WINED3D_SM4_MODIFIER_AOFFIMMI = 0x1, WINED3D_SM4_MODIFIER_AOFFIMMI = 0x1,
WINED3D_SM5_MODIFIER_RESOURCE_TYPE = 0x2, WINED3D_SM5_MODIFIER_RESOURCE_TYPE = 0x2,
WINED3D_SM5_MODIFIER_DATA_TYPE = 0x3,
}; };
enum wined3d_sm4_register_type enum wined3d_sm4_register_type
...@@ -1651,6 +1655,17 @@ static void shader_sm4_read_instruction_modifier(DWORD modifier, struct wined3d_ ...@@ -1651,6 +1655,17 @@ static void shader_sm4_read_instruction_modifier(DWORD modifier, struct wined3d_
break; 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: case WINED3D_SM5_MODIFIER_RESOURCE_TYPE:
{ {
enum wined3d_sm4_resource_type 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 ...@@ -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_count = strlen(opcode_info->src_info);
ins->src = priv->src_param; ins->src = priv->src_param;
ins->resource_type = WINED3D_SHADER_RESOURCE_NONE; ins->resource_type = WINED3D_SHADER_RESOURCE_NONE;
ins->resource_data_type = WINED3D_DATA_FLOAT;
memset(&ins->texel_offset, 0, sizeof(ins->texel_offset)); memset(&ins->texel_offset, 0, sizeof(ins->texel_offset));
p = *ptr; p = *ptr;
......
...@@ -1247,6 +1247,7 @@ struct wined3d_shader_instruction ...@@ -1247,6 +1247,7 @@ struct wined3d_shader_instruction
const struct wined3d_shader_src_param *src; const struct wined3d_shader_src_param *src;
struct wined3d_shader_texel_offset texel_offset; struct wined3d_shader_texel_offset texel_offset;
enum wined3d_shader_resource_type resource_type; enum wined3d_shader_resource_type resource_type;
enum wined3d_data_type resource_data_type;
BOOL coissue; BOOL coissue;
const struct wined3d_shader_src_param *predicate; const struct wined3d_shader_src_param *predicate;
union union
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment