Signed-off-by: Zebediah Figura z.figura12@gmail.com --- I have as yet been unable to determine a use for this information.
dlls/wined3d/shader.c | 77 ++++++++++++++-------------------- dlls/wined3d/shader_sm4.c | 74 ++++++++++++++++++++++---------- dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 83 insertions(+), 69 deletions(-)
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index f4c4eb07d88..cfcb636346d 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -2042,6 +2042,29 @@ static void shader_dump_shader_input_sysval_semantic(struct wined3d_string_buffe shader_addline(buffer, "unknown_shader_input_sysval_semantic(%#x)", semantic); }
+static void shader_dump_resource_type(struct wined3d_string_buffer *buffer, enum wined3d_shader_resource_type type) +{ + static const char *const resource_type_names[] = + { + /* WINED3D_SHADER_RESOURCE_NONE */ "none", + /* WINED3D_SHADER_RESOURCE_BUFFER */ "buffer", + /* WINED3D_SHADER_RESOURCE_TEXTURE_1D */ "texture1d", + /* WINED3D_SHADER_RESOURCE_TEXTURE_2D */ "texture2d", + /* WINED3D_SHADER_RESOURCE_TEXTURE_2DMS */ "texture2dms", + /* WINED3D_SHADER_RESOURCE_TEXTURE_3D */ "texture3d", + /* WINED3D_SHADER_RESOURCE_TEXTURE_CUBE */ "texturecube", + /* WINED3D_SHADER_RESOURCE_TEXTURE_1DARRAY */ "texture1darray", + /* WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY */ "texture2darray", + /* WINED3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY */ "texture2dmsarray", + /* WINED3D_SHADER_RESOURCE_TEXTURE_CUBEARRAY */ "texturecubearray", + }; + + if (type <= ARRAY_SIZE(resource_type_names)) + shader_addline(buffer, resource_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) @@ -2075,52 +2098,7 @@ static void shader_dump_decl_usage(struct wined3d_string_buffer *buffer, shader_addline(buffer, "_resource_"); else shader_addline(buffer, "_uav_"); - switch (semantic->resource_type) - { - case WINED3D_SHADER_RESOURCE_BUFFER: - shader_addline(buffer, "buffer"); - break; - - case WINED3D_SHADER_RESOURCE_TEXTURE_1D: - shader_addline(buffer, "texture1d"); - break; - - case WINED3D_SHADER_RESOURCE_TEXTURE_2D: - shader_addline(buffer, "texture2d"); - break; - - case WINED3D_SHADER_RESOURCE_TEXTURE_2DMS: - shader_addline(buffer, "texture2dms"); - break; - - case WINED3D_SHADER_RESOURCE_TEXTURE_3D: - shader_addline(buffer, "texture3d"); - break; - - case WINED3D_SHADER_RESOURCE_TEXTURE_CUBE: - shader_addline(buffer, "texturecube"); - break; - - case WINED3D_SHADER_RESOURCE_TEXTURE_1DARRAY: - shader_addline(buffer, "texture1darray"); - break; - - case WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY: - shader_addline(buffer, "texture2darray"); - break; - - case WINED3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY: - shader_addline(buffer, "texture2dmsarray"); - break; - - case WINED3D_SHADER_RESOURCE_TEXTURE_CUBEARRAY: - shader_addline(buffer, "texturecubearray"); - break; - - default: - shader_addline(buffer, "unknown"); - break; - } + 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) @@ -3116,6 +3094,13 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe if (wined3d_shader_instruction_has_texel_offset(&ins)) shader_addline(&buffer, "(%d,%d,%d)", ins.texel_offset.u, ins.texel_offset.v, ins.texel_offset.w);
+ if (ins.resource_type != WINED3D_SHADER_RESOURCE_NONE) + { + shader_addline(&buffer, "("); + shader_dump_resource_type(&buffer, ins.resource_type); + shader_addline(&buffer, ")"); + } + for (i = 0; i < ins.dst_count; ++i) { shader_dump_ins_modifiers(&buffer, &ins.dst[i]); diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index 443cfe7e4bd..54646174a29 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -26,7 +26,11 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode);
#define WINED3D_SM4_INSTRUCTION_MODIFIER (0x1u << 31)
-#define WINED3D_SM4_MODIFIER_AOFFIMMI 0x1 +#define WINED3D_SM4_MODIFIER_MASK 0x3fu + +#define WINED3D_SM5_MODIFIER_RESOURCE_TYPE_SHIFT 6 +#define WINED3D_SM5_MODIFIER_RESOURCE_TYPE_MASK (0xfu << WINED3D_SM5_MODIFIER_RESOURCE_TYPE_SHIFT) + #define WINED3D_SM4_AOFFIMMI_U_SHIFT 9 #define WINED3D_SM4_AOFFIMMI_U_MASK (0xfu << WINED3D_SM4_AOFFIMMI_U_SHIFT) #define WINED3D_SM4_AOFFIMMI_V_SHIFT 13 @@ -304,6 +308,12 @@ enum wined3d_sm4_opcode WINED3D_SM5_OP_DCL_GS_INSTANCES = 0xce, };
+enum wined3d_sm4_instruction_modifier +{ + WINED3D_SM4_MODIFIER_AOFFIMMI = 0x1, + WINED3D_SM5_MODIFIER_RESOURCE_TYPE = 0x2, +}; + enum wined3d_sm4_register_type { WINED3D_SM4_RT_TEMP = 0x00, @@ -1609,32 +1619,49 @@ static BOOL shader_sm4_read_dst_param(struct wined3d_sm4_data *priv, const DWORD
static void shader_sm4_read_instruction_modifier(DWORD modifier, struct wined3d_shader_instruction *ins) { - static const DWORD recognized_bits = WINED3D_SM4_INSTRUCTION_MODIFIER - | WINED3D_SM4_MODIFIER_AOFFIMMI - | WINED3D_SM4_AOFFIMMI_U_MASK - | WINED3D_SM4_AOFFIMMI_V_MASK - | WINED3D_SM4_AOFFIMMI_W_MASK; + enum wined3d_sm4_instruction_modifier modifier_type = modifier & WINED3D_SM4_MODIFIER_MASK;
- if (modifier & ~recognized_bits) + switch (modifier_type) { - FIXME("Unhandled modifier 0x%08x.\n", modifier); - } - else - { - /* Bit fields are used for sign extension */ - struct + case WINED3D_SM4_MODIFIER_AOFFIMMI: { - int u : 4; - int v : 4; - int w : 4; + static const DWORD recognized_bits = WINED3D_SM4_INSTRUCTION_MODIFIER + | WINED3D_SM4_MODIFIER_MASK + | WINED3D_SM4_AOFFIMMI_U_MASK + | WINED3D_SM4_AOFFIMMI_V_MASK + | WINED3D_SM4_AOFFIMMI_W_MASK; + + /* Bit fields are used for sign extension. */ + struct + { + int u : 4; + int v : 4; + int w : 4; + } aoffimmi; + + if (modifier & ~recognized_bits) + FIXME("Unhandled instruction modifier %#x.\n", modifier); + + aoffimmi.u = (modifier & WINED3D_SM4_AOFFIMMI_U_MASK) >> WINED3D_SM4_AOFFIMMI_U_SHIFT; + aoffimmi.v = (modifier & WINED3D_SM4_AOFFIMMI_V_MASK) >> WINED3D_SM4_AOFFIMMI_V_SHIFT; + aoffimmi.w = (modifier & WINED3D_SM4_AOFFIMMI_W_MASK) >> WINED3D_SM4_AOFFIMMI_W_SHIFT; + ins->texel_offset.u = aoffimmi.u; + ins->texel_offset.v = aoffimmi.v; + ins->texel_offset.w = aoffimmi.w; + break; + } + + case WINED3D_SM5_MODIFIER_RESOURCE_TYPE: + { + enum wined3d_sm4_resource_type resource_type + = (modifier & WINED3D_SM5_MODIFIER_RESOURCE_TYPE_MASK) >> WINED3D_SM5_MODIFIER_RESOURCE_TYPE_SHIFT; + + ins->resource_type = resource_type_table[resource_type]; + break; } - aoffimmi; - aoffimmi.u = (modifier & WINED3D_SM4_AOFFIMMI_U_MASK) >> WINED3D_SM4_AOFFIMMI_U_SHIFT; - aoffimmi.v = (modifier & WINED3D_SM4_AOFFIMMI_V_MASK) >> WINED3D_SM4_AOFFIMMI_V_SHIFT; - aoffimmi.w = (modifier & WINED3D_SM4_AOFFIMMI_W_MASK) >> WINED3D_SM4_AOFFIMMI_W_SHIFT; - ins->texel_offset.u = aoffimmi.u; - ins->texel_offset.v = aoffimmi.v; - ins->texel_offset.w = aoffimmi.w; + + default: + FIXME("Unhandled instruction modifier %#x.\n", modifier); } }
@@ -1703,6 +1730,7 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi ins->dst = priv->dst_param; ins->src_count = strlen(opcode_info->src_info); ins->src = priv->src_param; + ins->resource_type = WINED3D_SHADER_RESOURCE_NONE; memset(&ins->texel_offset, 0, sizeof(ins->texel_offset));
p = *ptr; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 16b3d0325c5..6e905ca6a49 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1246,6 +1246,7 @@ struct wined3d_shader_instruction const struct wined3d_shader_dst_param *dst; const struct wined3d_shader_src_param *src; struct wined3d_shader_texel_offset texel_offset; + enum wined3d_shader_resource_type resource_type; BOOL coissue; const struct wined3d_shader_src_param *predicate; union
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- I have as yet been unable to determine a use for this information.
dlls/wined3d/shader.c | 51 +++++++++++++++++----------------- dlls/wined3d/shader_sm4.c | 16 +++++++++++ dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 42 insertions(+), 26 deletions(-)
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index cfcb636346d..eb240a41f50 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -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, 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]); diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index 54646174a29..90135553d8f 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -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; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 6e905ca6a49..b2605b837a8 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com