wined3d: Split shader_dump_param() in shader_dump_src_param() and shader_dump_dst_param().
This commit is contained in:
parent
54a3054e5a
commit
bf4f7bf34a
|
@ -94,8 +94,8 @@ typedef enum _WINED3DSHADER_ADDRESSMODE_TYPE
|
||||||
WINED3DSHADER_ADDRMODE_FORCE_DWORD = 0x7fffffff,
|
WINED3DSHADER_ADDRMODE_FORCE_DWORD = 0x7fffffff,
|
||||||
} WINED3DSHADER_ADDRESSMODE_TYPE;
|
} WINED3DSHADER_ADDRESSMODE_TYPE;
|
||||||
|
|
||||||
static void shader_dump_param(WINED3DSHADER_PARAM_REGISTER_TYPE register_type, UINT register_idx, BOOL is_src,
|
static void shader_dump_src_param(const struct wined3d_shader_src_param *param, DWORD shader_version);
|
||||||
DWORD src_modifier, DWORD mask_swizzle, const struct wined3d_shader_src_param *rel_addr, DWORD shader_version);
|
static void shader_dump_dst_param(const struct wined3d_shader_dst_param *param, DWORD shader_version);
|
||||||
|
|
||||||
/* Read a parameter opcode from the input stream,
|
/* Read a parameter opcode from the input stream,
|
||||||
* and possibly a relative addressing token.
|
* and possibly a relative addressing token.
|
||||||
|
@ -211,16 +211,14 @@ static int shader_skip_unrecognized(const DWORD *ptr, DWORD shader_version)
|
||||||
struct wined3d_shader_dst_param dst;
|
struct wined3d_shader_dst_param dst;
|
||||||
|
|
||||||
shader_parse_dst_param(token, token & WINED3DSHADER_ADDRMODE_RELATIVE ? &rel_addr : NULL, &dst);
|
shader_parse_dst_param(token, token & WINED3DSHADER_ADDRMODE_RELATIVE ? &rel_addr : NULL, &dst);
|
||||||
shader_dump_param(dst.register_type, dst.register_idx, FALSE, 0,
|
shader_dump_dst_param(&dst, shader_version);
|
||||||
dst.write_mask, dst.rel_addr, shader_version);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct wined3d_shader_src_param src;
|
struct wined3d_shader_src_param src;
|
||||||
|
|
||||||
shader_parse_src_param(token, token & WINED3DSHADER_ADDRMODE_RELATIVE ? &rel_addr : NULL, &src);
|
shader_parse_src_param(token, token & WINED3DSHADER_ADDRMODE_RELATIVE ? &rel_addr : NULL, &src);
|
||||||
shader_dump_param(src.register_type, src.register_idx, TRUE, src.modifiers,
|
shader_dump_src_param(&src, shader_version);
|
||||||
src.swizzle, src.rel_addr, shader_version);
|
|
||||||
}
|
}
|
||||||
FIXME("\n");
|
FIXME("\n");
|
||||||
++i;
|
++i;
|
||||||
|
@ -919,26 +917,132 @@ static void shader_dump_arr_entry(const struct wined3d_shader_src_param *rel_add
|
||||||
if (rel_addr)
|
if (rel_addr)
|
||||||
{
|
{
|
||||||
TRACE("[");
|
TRACE("[");
|
||||||
shader_dump_param(rel_addr->register_type, rel_addr->register_idx, TRUE,
|
shader_dump_src_param(rel_addr, shader_version);
|
||||||
rel_addr->modifiers, rel_addr->swizzle, NULL, shader_version);
|
|
||||||
TRACE(" + ");
|
TRACE(" + ");
|
||||||
}
|
}
|
||||||
TRACE("%u", register_idx);
|
TRACE("%u", register_idx);
|
||||||
if (rel_addr) TRACE("]");
|
if (rel_addr) TRACE("]");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shader_dump_param(WINED3DSHADER_PARAM_REGISTER_TYPE register_type, UINT register_idx, BOOL is_src,
|
static void shader_dump_register(WINED3DSHADER_PARAM_REGISTER_TYPE register_type, UINT register_idx,
|
||||||
DWORD src_modifier, DWORD mask_swizzle, const struct wined3d_shader_src_param *rel_addr, DWORD shader_version)
|
const struct wined3d_shader_src_param *rel_addr, DWORD shader_version)
|
||||||
{
|
{
|
||||||
static const char * const rastout_reg_names[] = {"oPos", "oFog", "oPts"};
|
static const char * const rastout_reg_names[] = {"oPos", "oFog", "oPts"};
|
||||||
static const char * const misctype_reg_names[] = {"vPos", "vFace"};
|
static const char * const misctype_reg_names[] = {"vPos", "vFace"};
|
||||||
const char *swizzle_reg_chars = "xyzw";
|
|
||||||
|
|
||||||
/* There are some minor differences between pixel and vertex shaders */
|
switch (register_type)
|
||||||
char pshader = shader_is_pshader_version(shader_version);
|
|
||||||
|
|
||||||
if (is_src)
|
|
||||||
{
|
{
|
||||||
|
case WINED3DSPR_TEMP:
|
||||||
|
TRACE("r%u", register_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_INPUT:
|
||||||
|
TRACE("v");
|
||||||
|
shader_dump_arr_entry(rel_addr, register_idx, shader_version);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_CONST:
|
||||||
|
case WINED3DSPR_CONST2:
|
||||||
|
case WINED3DSPR_CONST3:
|
||||||
|
case WINED3DSPR_CONST4:
|
||||||
|
TRACE("c");
|
||||||
|
shader_dump_arr_entry(rel_addr, shader_get_float_offset(register_type, register_idx), shader_version);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_TEXTURE: /* vs: case WINED3DSPR_ADDR */
|
||||||
|
TRACE("%c%u", (shader_is_pshader_version(shader_version) ? 't' : 'a'), register_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_RASTOUT:
|
||||||
|
TRACE("%s", rastout_reg_names[register_idx]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_COLOROUT:
|
||||||
|
TRACE("oC%u", register_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_DEPTHOUT:
|
||||||
|
TRACE("oDepth");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_ATTROUT:
|
||||||
|
TRACE("oD%u", register_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_TEXCRDOUT:
|
||||||
|
/* Vertex shaders >= 3.0 use general purpose output registers
|
||||||
|
* (WINED3DSPR_OUTPUT), which can include an address token */
|
||||||
|
if (WINED3DSHADER_VERSION_MAJOR(shader_version) >= 3)
|
||||||
|
{
|
||||||
|
TRACE("o");
|
||||||
|
shader_dump_arr_entry(rel_addr, register_idx, shader_version);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TRACE("oT%u", register_idx);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_CONSTINT:
|
||||||
|
TRACE("i");
|
||||||
|
shader_dump_arr_entry(rel_addr, register_idx, shader_version);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_CONSTBOOL:
|
||||||
|
TRACE("b");
|
||||||
|
shader_dump_arr_entry(rel_addr, register_idx, shader_version);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_LABEL:
|
||||||
|
TRACE("l%u", register_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_LOOP:
|
||||||
|
TRACE("aL");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_SAMPLER:
|
||||||
|
TRACE("s%u", register_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_MISCTYPE:
|
||||||
|
if (register_idx > 1) FIXME("Unhandled misctype register %d\n", register_idx);
|
||||||
|
else TRACE("%s", misctype_reg_names[register_idx]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DSPR_PREDICATE:
|
||||||
|
TRACE("p%u", register_idx);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
TRACE("unhandled_rtype(%#x)", register_type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void shader_dump_dst_param(const struct wined3d_shader_dst_param *param, DWORD shader_version)
|
||||||
|
{
|
||||||
|
DWORD write_mask = param->write_mask;
|
||||||
|
|
||||||
|
shader_dump_register(param->register_type, param->register_idx, param->rel_addr, shader_version);
|
||||||
|
|
||||||
|
if (write_mask != WINED3DSP_WRITEMASK_ALL)
|
||||||
|
{
|
||||||
|
static const char *write_mask_chars = "xyzw";
|
||||||
|
|
||||||
|
TRACE(".");
|
||||||
|
if (write_mask & WINED3DSP_WRITEMASK_0) TRACE("%c", write_mask_chars[0]);
|
||||||
|
if (write_mask & WINED3DSP_WRITEMASK_1) TRACE("%c", write_mask_chars[1]);
|
||||||
|
if (write_mask & WINED3DSP_WRITEMASK_2) TRACE("%c", write_mask_chars[2]);
|
||||||
|
if (write_mask & WINED3DSP_WRITEMASK_3) TRACE("%c", write_mask_chars[3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void shader_dump_src_param(const struct wined3d_shader_src_param *param, DWORD shader_version)
|
||||||
|
{
|
||||||
|
DWORD src_modifier = param->modifiers;
|
||||||
|
DWORD swizzle = param->swizzle;
|
||||||
|
|
||||||
if (src_modifier == WINED3DSPSM_NEG
|
if (src_modifier == WINED3DSPSM_NEG
|
||||||
|| src_modifier == WINED3DSPSM_BIASNEG
|
|| src_modifier == WINED3DSPSM_BIASNEG
|
||||||
|| src_modifier == WINED3DSPSM_SIGNNEG
|
|| src_modifier == WINED3DSPSM_SIGNNEG
|
||||||
|
@ -952,95 +1056,9 @@ static void shader_dump_param(WINED3DSHADER_PARAM_REGISTER_TYPE register_type, U
|
||||||
|
|
||||||
if (src_modifier == WINED3DSPSM_ABS || src_modifier == WINED3DSPSM_ABSNEG)
|
if (src_modifier == WINED3DSPSM_ABS || src_modifier == WINED3DSPSM_ABSNEG)
|
||||||
TRACE("abs(");
|
TRACE("abs(");
|
||||||
}
|
|
||||||
|
|
||||||
switch (register_type)
|
shader_dump_register(param->register_type, param->register_idx, param->rel_addr, shader_version);
|
||||||
{
|
|
||||||
case WINED3DSPR_TEMP:
|
|
||||||
TRACE("r%u", register_idx);
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_INPUT:
|
|
||||||
TRACE("v");
|
|
||||||
shader_dump_arr_entry(rel_addr, register_idx, shader_version);
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_CONST:
|
|
||||||
case WINED3DSPR_CONST2:
|
|
||||||
case WINED3DSPR_CONST3:
|
|
||||||
case WINED3DSPR_CONST4:
|
|
||||||
TRACE("c");
|
|
||||||
shader_dump_arr_entry(rel_addr, shader_get_float_offset(register_type, register_idx), shader_version);
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_TEXTURE: /* vs: case WINED3DSPR_ADDR */
|
|
||||||
TRACE("%c%u", (pshader ? 't' : 'a'), register_idx);
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_RASTOUT:
|
|
||||||
TRACE("%s", rastout_reg_names[register_idx]);
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_COLOROUT:
|
|
||||||
TRACE("oC%u", register_idx);
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_DEPTHOUT:
|
|
||||||
TRACE("oDepth");
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_ATTROUT:
|
|
||||||
TRACE("oD%u", register_idx);
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_TEXCRDOUT:
|
|
||||||
|
|
||||||
/* Vertex shaders >= 3.0 use general purpose output registers
|
|
||||||
* (WINED3DSPR_OUTPUT), which can include an address token */
|
|
||||||
|
|
||||||
if (WINED3DSHADER_VERSION_MAJOR(shader_version) >= 3) {
|
|
||||||
TRACE("o");
|
|
||||||
shader_dump_arr_entry(rel_addr, register_idx, shader_version);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
TRACE("oT%u", register_idx);
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_CONSTINT:
|
|
||||||
TRACE("i");
|
|
||||||
shader_dump_arr_entry(rel_addr, register_idx, shader_version);
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_CONSTBOOL:
|
|
||||||
TRACE("b");
|
|
||||||
shader_dump_arr_entry(rel_addr, register_idx, shader_version);
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_LABEL:
|
|
||||||
TRACE("l%u", register_idx);
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_LOOP:
|
|
||||||
TRACE("aL");
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_SAMPLER:
|
|
||||||
TRACE("s%u", register_idx);
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_MISCTYPE:
|
|
||||||
if (register_idx > 1) FIXME("Unhandled misctype register %d\n", register_idx);
|
|
||||||
else TRACE("%s", misctype_reg_names[register_idx]);
|
|
||||||
break;
|
|
||||||
case WINED3DSPR_PREDICATE:
|
|
||||||
TRACE("p%u", register_idx);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
TRACE("unhandled_rtype(%#x)", register_type);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_src)
|
|
||||||
{
|
|
||||||
/* operand output (for modifiers and shift, see dump_ins_modifiers) */
|
|
||||||
if (mask_swizzle != WINED3DSP_WRITEMASK_ALL)
|
|
||||||
{
|
|
||||||
TRACE(".");
|
|
||||||
if (mask_swizzle & WINED3DSP_WRITEMASK_0) TRACE("%c", swizzle_reg_chars[0]);
|
|
||||||
if (mask_swizzle & WINED3DSP_WRITEMASK_1) TRACE("%c", swizzle_reg_chars[1]);
|
|
||||||
if (mask_swizzle & WINED3DSP_WRITEMASK_2) TRACE("%c", swizzle_reg_chars[2]);
|
|
||||||
if (mask_swizzle & WINED3DSP_WRITEMASK_3) TRACE("%c", swizzle_reg_chars[3]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* operand input */
|
|
||||||
if (src_modifier)
|
if (src_modifier)
|
||||||
{
|
{
|
||||||
switch (src_modifier)
|
switch (src_modifier)
|
||||||
|
@ -1064,28 +1082,24 @@ static void shader_dump_param(WINED3DSHADER_PARAM_REGISTER_TYPE register_type, U
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
if (swizzle != WINED3DSP_NOSWIZZLE)
|
||||||
* swizzle bits fields:
|
|
||||||
* RRGGBBAA
|
|
||||||
*/
|
|
||||||
if (mask_swizzle != WINED3DSP_NOSWIZZLE)
|
|
||||||
{
|
{
|
||||||
DWORD swizzle_x = mask_swizzle & 0x03;
|
static const char *swizzle_chars = "xyzw";
|
||||||
DWORD swizzle_y = (mask_swizzle >> 2) & 0x03;
|
DWORD swizzle_x = swizzle & 0x03;
|
||||||
DWORD swizzle_z = (mask_swizzle >> 4) & 0x03;
|
DWORD swizzle_y = (swizzle >> 2) & 0x03;
|
||||||
DWORD swizzle_w = (mask_swizzle >> 6) & 0x03;
|
DWORD swizzle_z = (swizzle >> 4) & 0x03;
|
||||||
|
DWORD swizzle_w = (swizzle >> 6) & 0x03;
|
||||||
|
|
||||||
if (swizzle_x == swizzle_y &&
|
if (swizzle_x == swizzle_y
|
||||||
swizzle_x == swizzle_z &&
|
&& swizzle_x == swizzle_z
|
||||||
swizzle_x == swizzle_w) {
|
&& swizzle_x == swizzle_w)
|
||||||
TRACE(".%c", swizzle_reg_chars[swizzle_x]);
|
{
|
||||||
} else {
|
TRACE(".%c", swizzle_chars[swizzle_x]);
|
||||||
TRACE(".%c%c%c%c",
|
|
||||||
swizzle_reg_chars[swizzle_x],
|
|
||||||
swizzle_reg_chars[swizzle_y],
|
|
||||||
swizzle_reg_chars[swizzle_z],
|
|
||||||
swizzle_reg_chars[swizzle_w]);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TRACE(".%c%c%c%c", swizzle_chars[swizzle_x], swizzle_chars[swizzle_y],
|
||||||
|
swizzle_chars[swizzle_z], swizzle_chars[swizzle_w]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1269,8 +1283,7 @@ void shader_trace_init(const DWORD *pFunction, const SHADER_OPCODE *opcode_table
|
||||||
shader_dump_decl_usage(&semantic, shader_version);
|
shader_dump_decl_usage(&semantic, shader_version);
|
||||||
shader_dump_ins_modifiers(&semantic.reg);
|
shader_dump_ins_modifiers(&semantic.reg);
|
||||||
TRACE(" ");
|
TRACE(" ");
|
||||||
shader_dump_param(semantic.reg.register_type, semantic.reg.register_idx, FALSE,
|
shader_dump_dst_param(&semantic.reg, shader_version);
|
||||||
0, semantic.reg.write_mask, semantic.reg.rel_addr, shader_version);
|
|
||||||
}
|
}
|
||||||
else if (ins.handler_idx == WINED3DSIH_DEF)
|
else if (ins.handler_idx == WINED3DSIH_DEF)
|
||||||
{
|
{
|
||||||
|
@ -1313,8 +1326,7 @@ void shader_trace_init(const DWORD *pFunction, const SHADER_OPCODE *opcode_table
|
||||||
shader_parse_src_param(*(pToken + 2), NULL, &pred);
|
shader_parse_src_param(*(pToken + 2), NULL, &pred);
|
||||||
|
|
||||||
TRACE("(");
|
TRACE("(");
|
||||||
shader_dump_param(pred.register_type, pred.register_idx, TRUE,
|
shader_dump_src_param(&pred, shader_version);
|
||||||
pred.modifiers, pred.swizzle, pred.rel_addr, shader_version);
|
|
||||||
TRACE(") ");
|
TRACE(") ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1354,8 +1366,7 @@ void shader_trace_init(const DWORD *pFunction, const SHADER_OPCODE *opcode_table
|
||||||
|
|
||||||
shader_dump_ins_modifiers(&dst);
|
shader_dump_ins_modifiers(&dst);
|
||||||
TRACE(" ");
|
TRACE(" ");
|
||||||
shader_dump_param(dst.register_type, dst.register_idx, FALSE,
|
shader_dump_dst_param(&dst, shader_version);
|
||||||
0, dst.write_mask, dst.rel_addr, shader_version);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Predication token - already printed out, just skip it */
|
/* Predication token - already printed out, just skip it */
|
||||||
|
@ -1380,8 +1391,7 @@ void shader_trace_init(const DWORD *pFunction, const SHADER_OPCODE *opcode_table
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE(!i ? " " : ", ");
|
TRACE(!i ? " " : ", ");
|
||||||
shader_dump_param(src.register_type, src.register_idx, TRUE,
|
shader_dump_src_param(&src, shader_version);
|
||||||
src.modifiers, src.swizzle, src.rel_addr, shader_version);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
Loading…
Reference in New Issue