[PATCH vkd3d 3/4] libs/vkd3d-shader: Factor out shader_dump_instruction().
Józef Kucia
joseph.kucia at gmail.com
Tue Jun 5 06:52:58 CDT 2018
From: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
libs/vkd3d-shader/trace.c | 484 ++++++++++++++++++++++++----------------------
1 file changed, 249 insertions(+), 235 deletions(-)
diff --git a/libs/vkd3d-shader/trace.c b/libs/vkd3d-shader/trace.c
index f987e3caa877..420ccea37f94 100644
--- a/libs/vkd3d-shader/trace.c
+++ b/libs/vkd3d-shader/trace.c
@@ -1340,13 +1340,260 @@ static void shader_dump_instruction_flags(struct vkd3d_string_buffer *buffer,
}
}
+static void shader_dump_instruction(struct vkd3d_string_buffer *buffer,
+ const struct vkd3d_shader_instruction *ins, const struct vkd3d_shader_version *shader_version)
+{
+ unsigned int i;
+
+ switch (ins->handler_idx)
+ {
+ case VKD3DSIH_DCL:
+ case VKD3DSIH_DCL_UAV_TYPED:
+ shader_dump_decl_usage(buffer, &ins->declaration.semantic, ins->flags, shader_version);
+ shader_dump_ins_modifiers(buffer, &ins->declaration.semantic.reg);
+ shader_addline(buffer, " ");
+ shader_dump_dst_param(buffer, &ins->declaration.semantic.reg, shader_version);
+ break;
+
+ case VKD3DSIH_DCL_CONSTANT_BUFFER:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_src_param(buffer, &ins->declaration.src, shader_version);
+ shader_addline(buffer, ", %s",
+ ins->flags & VKD3DSI_INDEXED_DYNAMIC ? "dynamicIndexed" : "immediateIndexed");
+ break;
+
+ case VKD3DSIH_DCL_FUNCTION_BODY:
+ shader_addline(buffer, "%s fb%u",
+ shader_opcode_names[ins->handler_idx], ins->declaration.index);
+ break;
+
+ case VKD3DSIH_DCL_FUNCTION_TABLE:
+ shader_addline(buffer, "%s ft%u = {...}",
+ shader_opcode_names[ins->handler_idx], ins->declaration.index);
+ break;
+
+ case VKD3DSIH_DCL_GLOBAL_FLAGS:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_global_flags(buffer, ins->flags);
+ break;
+
+ case VKD3DSIH_DCL_HS_MAX_TESSFACTOR:
+ shader_addline(buffer, "%s %.8e", shader_opcode_names[ins->handler_idx],
+ ins->declaration.max_tessellation_factor);
+ break;
+
+ case VKD3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER:
+ shader_addline(buffer, "%s {\n", shader_opcode_names[ins->handler_idx]);
+ for (i = 0; i < ins->declaration.icb->vec4_count; ++i)
+ {
+ shader_addline(buffer, " {0x%08x, 0x%08x, 0x%08x, 0x%08x},\n",
+ ins->declaration.icb->data[4 * i + 0],
+ ins->declaration.icb->data[4 * i + 1],
+ ins->declaration.icb->data[4 * i + 2],
+ ins->declaration.icb->data[4 * i + 3]);
+ }
+ shader_addline(buffer, "}");
+ break;
+
+ case VKD3DSIH_DCL_INDEX_RANGE:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_dst_param(buffer, &ins->declaration.index_range.first_register, shader_version);
+ shader_addline(buffer, " %u", ins->declaration.index_range.last_register);
+ break;
+
+ case VKD3DSIH_DCL_INDEXABLE_TEMP:
+ shader_addline(buffer, "%s x[%u][%u], %u", shader_opcode_names[ins->handler_idx],
+ ins->declaration.indexable_temp.register_idx,
+ ins->declaration.indexable_temp.register_size,
+ ins->declaration.indexable_temp.component_count);
+ break;
+
+ case VKD3DSIH_DCL_INPUT_PS:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_interpolation_mode(buffer, ins->flags);
+ shader_addline(buffer, " ");
+ shader_dump_dst_param(buffer, &ins->declaration.dst, shader_version);
+ break;
+
+ case VKD3DSIH_DCL_INPUT_PS_SGV:
+ case VKD3DSIH_DCL_INPUT_SGV:
+ case VKD3DSIH_DCL_INPUT_SIV:
+ case VKD3DSIH_DCL_OUTPUT_SIV:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_dst_param(buffer, &ins->declaration.register_semantic.reg, shader_version);
+ shader_addline(buffer, ", ");
+ shader_dump_shader_input_sysval_semantic(buffer, ins->declaration.register_semantic.sysval_semantic);
+ break;
+
+ case VKD3DSIH_DCL_INPUT_PS_SIV:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_interpolation_mode(buffer, ins->flags);
+ shader_addline(buffer, " ");
+ shader_dump_dst_param(buffer, &ins->declaration.register_semantic.reg, shader_version);
+ shader_addline(buffer, ", ");
+ shader_dump_shader_input_sysval_semantic(buffer, ins->declaration.register_semantic.sysval_semantic);
+ break;
+
+ case VKD3DSIH_DCL_INPUT:
+ case VKD3DSIH_DCL_OUTPUT:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_dst_param(buffer, &ins->declaration.dst, shader_version);
+ break;
+
+ case VKD3DSIH_DCL_INPUT_PRIMITIVE:
+ case VKD3DSIH_DCL_OUTPUT_TOPOLOGY:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_primitive_type(buffer, &ins->declaration.primitive_type);
+ break;
+
+ case VKD3DSIH_DCL_INTERFACE:
+ shader_addline(buffer, "%s fp[%u][%u][%u] = {...}",
+ shader_opcode_names[ins->handler_idx], ins->declaration.fp.index,
+ ins->declaration.fp.array_size, ins->declaration.fp.body_count);
+ break;
+
+ case VKD3DSIH_DCL_RESOURCE_RAW:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_dst_param(buffer, &ins->declaration.dst, shader_version);
+ break;
+
+ case VKD3DSIH_DCL_RESOURCE_STRUCTURED:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_dst_param(buffer, &ins->declaration.structured_resource.reg, shader_version);
+ shader_addline(buffer, ", %u", ins->declaration.structured_resource.byte_stride);
+ break;
+
+ case VKD3DSIH_DCL_SAMPLER:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_dst_param(buffer, &ins->declaration.dst, shader_version);
+ if (ins->flags == VKD3DSI_SAMPLER_COMPARISON_MODE)
+ shader_addline(buffer, ", comparisonMode");
+ break;
+
+ case VKD3DSIH_DCL_TEMPS:
+ case VKD3DSIH_DCL_GS_INSTANCES:
+ case VKD3DSIH_DCL_HS_FORK_PHASE_INSTANCE_COUNT:
+ case VKD3DSIH_DCL_HS_JOIN_PHASE_INSTANCE_COUNT:
+ case VKD3DSIH_DCL_INPUT_CONTROL_POINT_COUNT:
+ case VKD3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT:
+ case VKD3DSIH_DCL_VERTICES_OUT:
+ shader_addline(buffer, "%s %u", shader_opcode_names[ins->handler_idx], ins->declaration.count);
+ break;
+
+ case VKD3DSIH_DCL_TESSELLATOR_DOMAIN:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_tessellator_domain(buffer, ins->declaration.tessellator_domain);
+ break;
+
+ case VKD3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_tessellator_output_primitive(buffer, ins->declaration.tessellator_output_primitive);
+ break;
+
+ case VKD3DSIH_DCL_TESSELLATOR_PARTITIONING:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_tessellator_partitioning(buffer, ins->declaration.tessellator_partitioning);
+ break;
+
+ case VKD3DSIH_DCL_TGSM_RAW:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_dst_param(buffer, &ins->declaration.tgsm_raw.reg, shader_version);
+ shader_addline(buffer, ", %u", ins->declaration.tgsm_raw.byte_count);
+ break;
+
+ case VKD3DSIH_DCL_TGSM_STRUCTURED:
+ shader_addline(buffer, "%s ", shader_opcode_names[ins->handler_idx]);
+ shader_dump_dst_param(buffer, &ins->declaration.tgsm_structured.reg, shader_version);
+ shader_addline(buffer, ", %u, %u", ins->declaration.tgsm_structured.byte_stride,
+ ins->declaration.tgsm_structured.structure_count);
+ break;
+
+ case VKD3DSIH_DCL_THREAD_GROUP:
+ shader_addline(buffer, "%s %u, %u, %u", shader_opcode_names[ins->handler_idx],
+ ins->declaration.thread_group_size.x,
+ ins->declaration.thread_group_size.y,
+ ins->declaration.thread_group_size.z);
+ break;
+
+ case VKD3DSIH_DCL_UAV_RAW:
+ shader_addline(buffer, "%s", shader_opcode_names[ins->handler_idx]);
+ shader_dump_uav_flags(buffer, ins->flags);
+ shader_addline(buffer, " ");
+ shader_dump_dst_param(buffer, &ins->declaration.dst, shader_version);
+ break;
+
+ case VKD3DSIH_DCL_UAV_STRUCTURED:
+ shader_addline(buffer, "%s", shader_opcode_names[ins->handler_idx]);
+ shader_dump_uav_flags(buffer, ins->flags);
+ shader_addline(buffer, " ");
+ shader_dump_dst_param(buffer, &ins->declaration.structured_resource.reg, shader_version);
+ shader_addline(buffer, ", %u", ins->declaration.structured_resource.byte_stride);
+ break;
+
+ case VKD3DSIH_DEF:
+ shader_addline(buffer, "def c%u = %.8e, %.8e, %.8e, %.8e",
+ shader_get_float_offset(ins->dst[0].reg.type, ins->dst[0].reg.idx[0].offset),
+ ins->src[0].reg.u.immconst_float[0], ins->src[0].reg.u.immconst_float[1],
+ ins->src[0].reg.u.immconst_float[2], ins->src[0].reg.u.immconst_float[3]);
+ break;
+
+ case VKD3DSIH_DEFI:
+ shader_addline(buffer, "defi i%u = %d, %d, %d, %d", ins->dst[0].reg.idx[0].offset,
+ ins->src[0].reg.u.immconst_uint[0], ins->src[0].reg.u.immconst_uint[1],
+ ins->src[0].reg.u.immconst_uint[2], ins->src[0].reg.u.immconst_uint[3]);
+ break;
+
+ case VKD3DSIH_DEFB:
+ shader_addline(buffer, "defb b%u = %s",
+ ins->dst[0].reg.idx[0].offset, ins->src[0].reg.u.immconst_uint[0] ? "true" : "false");
+ break;
+
+ default:
+ if (ins->predicate)
+ {
+ shader_addline(buffer, "(");
+ shader_dump_src_param(buffer, ins->predicate, shader_version);
+ shader_addline(buffer, ") ");
+ }
+
+ /* PixWin marks instructions with the coissue flag with a '+' */
+ if (ins->coissue)
+ shader_addline(buffer, "+");
+
+ shader_addline(buffer, "%s", shader_opcode_names[ins->handler_idx]);
+
+ shader_dump_instruction_flags(buffer, ins, shader_version);
+ if (vkd3d_shader_instruction_has_texel_offset(ins))
+ {
+ shader_addline(buffer, "(%d,%d,%d)",
+ ins->texel_offset.u, ins->texel_offset.v, ins->texel_offset.w);
+ }
+
+ for (i = 0; i < ins->dst_count; ++i)
+ {
+ shader_dump_ins_modifiers(buffer, &ins->dst[i]);
+ shader_addline(buffer, !i ? " " : ", ");
+ shader_dump_dst_param(buffer, &ins->dst[i], shader_version);
+ }
+
+ /* Other source tokens */
+ for (i = ins->dst_count; i < (ins->dst_count + ins->src_count); ++i)
+ {
+ shader_addline(buffer, !i ? " " : ", ");
+ shader_dump_src_param(buffer, &ins->src[i - ins->dst_count], shader_version);
+ }
+ break;
+ }
+
+ shader_addline(buffer, "\n");
+}
+
void vkd3d_shader_trace(void *data)
{
struct vkd3d_shader_version shader_version;
struct vkd3d_string_buffer buffer;
const char *p, *q;
const DWORD *ptr;
- DWORD i;
if (!string_buffer_init(&buffer))
{
@@ -1369,240 +1616,7 @@ void vkd3d_shader_trace(void *data)
continue;
}
- if (ins.handler_idx == VKD3DSIH_DCL || ins.handler_idx == VKD3DSIH_DCL_UAV_TYPED)
- {
- shader_dump_decl_usage(&buffer, &ins.declaration.semantic, ins.flags, &shader_version);
- shader_dump_ins_modifiers(&buffer, &ins.declaration.semantic.reg);
- shader_addline(&buffer, " ");
- shader_dump_dst_param(&buffer, &ins.declaration.semantic.reg, &shader_version);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_CONSTANT_BUFFER)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_src_param(&buffer, &ins.declaration.src, &shader_version);
- shader_addline(&buffer, ", %s",
- ins.flags & VKD3DSI_INDEXED_DYNAMIC ? "dynamicIndexed" : "immediateIndexed");
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_FUNCTION_BODY)
- {
- shader_addline(&buffer, "%s fb%u",
- shader_opcode_names[ins.handler_idx], ins.declaration.index);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_FUNCTION_TABLE)
- {
- shader_addline(&buffer, "%s ft%u = {...}",
- shader_opcode_names[ins.handler_idx], ins.declaration.index);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_GLOBAL_FLAGS)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_global_flags(&buffer, ins.flags);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_HS_MAX_TESSFACTOR)
- {
- shader_addline(&buffer, "%s %.8e", shader_opcode_names[ins.handler_idx],
- ins.declaration.max_tessellation_factor);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER)
- {
- shader_addline(&buffer, "%s {\n", shader_opcode_names[ins.handler_idx]);
- for (i = 0; i < ins.declaration.icb->vec4_count; ++i)
- {
- shader_addline(&buffer, " {0x%08x, 0x%08x, 0x%08x, 0x%08x},\n",
- ins.declaration.icb->data[4 * i + 0],
- ins.declaration.icb->data[4 * i + 1],
- ins.declaration.icb->data[4 * i + 2],
- ins.declaration.icb->data[4 * i + 3]);
- }
- shader_addline(&buffer, "}");
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_INDEX_RANGE)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_dst_param(&buffer, &ins.declaration.index_range.first_register, &shader_version);
- shader_addline(&buffer, " %u", ins.declaration.index_range.last_register);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_INDEXABLE_TEMP)
- {
- shader_addline(&buffer, "%s x[%u][%u], %u", shader_opcode_names[ins.handler_idx],
- ins.declaration.indexable_temp.register_idx,
- ins.declaration.indexable_temp.register_size,
- ins.declaration.indexable_temp.component_count);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_INPUT_PS)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_interpolation_mode(&buffer, ins.flags);
- shader_addline(&buffer, " ");
- shader_dump_dst_param(&buffer, &ins.declaration.dst, &shader_version);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_INPUT_PS_SGV
- || ins.handler_idx == VKD3DSIH_DCL_INPUT_SGV
- || ins.handler_idx == VKD3DSIH_DCL_INPUT_SIV
- || ins.handler_idx == VKD3DSIH_DCL_OUTPUT_SIV)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_dst_param(&buffer, &ins.declaration.register_semantic.reg, &shader_version);
- shader_addline(&buffer, ", ");
- shader_dump_shader_input_sysval_semantic(&buffer, ins.declaration.register_semantic.sysval_semantic);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_INPUT_PS_SIV)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_interpolation_mode(&buffer, ins.flags);
- shader_addline(&buffer, " ");
- shader_dump_dst_param(&buffer, &ins.declaration.register_semantic.reg, &shader_version);
- shader_addline(&buffer, ", ");
- shader_dump_shader_input_sysval_semantic(&buffer, ins.declaration.register_semantic.sysval_semantic);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_INPUT
- || ins.handler_idx == VKD3DSIH_DCL_OUTPUT)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_dst_param(&buffer, &ins.declaration.dst, &shader_version);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_INPUT_PRIMITIVE
- || ins.handler_idx == VKD3DSIH_DCL_OUTPUT_TOPOLOGY)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_primitive_type(&buffer, &ins.declaration.primitive_type);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_INTERFACE)
- {
- shader_addline(&buffer, "%s fp[%u][%u][%u] = {...}",
- shader_opcode_names[ins.handler_idx], ins.declaration.fp.index,
- ins.declaration.fp.array_size, ins.declaration.fp.body_count);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_RESOURCE_RAW)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_dst_param(&buffer, &ins.declaration.dst, &shader_version);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_RESOURCE_STRUCTURED)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_dst_param(&buffer, &ins.declaration.structured_resource.reg, &shader_version);
- shader_addline(&buffer, ", %u", ins.declaration.structured_resource.byte_stride);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_SAMPLER)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_dst_param(&buffer, &ins.declaration.dst, &shader_version);
- if (ins.flags == VKD3DSI_SAMPLER_COMPARISON_MODE)
- shader_addline(&buffer, ", comparisonMode");
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_TEMPS
- || ins.handler_idx == VKD3DSIH_DCL_GS_INSTANCES
- || ins.handler_idx == VKD3DSIH_DCL_HS_FORK_PHASE_INSTANCE_COUNT
- || ins.handler_idx == VKD3DSIH_DCL_HS_JOIN_PHASE_INSTANCE_COUNT
- || ins.handler_idx == VKD3DSIH_DCL_INPUT_CONTROL_POINT_COUNT
- || ins.handler_idx == VKD3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT
- || ins.handler_idx == VKD3DSIH_DCL_VERTICES_OUT)
- {
- shader_addline(&buffer, "%s %u", shader_opcode_names[ins.handler_idx], ins.declaration.count);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_TESSELLATOR_DOMAIN)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_tessellator_domain(&buffer, ins.declaration.tessellator_domain);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_tessellator_output_primitive(&buffer, ins.declaration.tessellator_output_primitive);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_TESSELLATOR_PARTITIONING)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_tessellator_partitioning(&buffer, ins.declaration.tessellator_partitioning);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_TGSM_RAW)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_dst_param(&buffer, &ins.declaration.tgsm_raw.reg, &shader_version);
- shader_addline(&buffer, ", %u", ins.declaration.tgsm_raw.byte_count);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_TGSM_STRUCTURED)
- {
- shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]);
- shader_dump_dst_param(&buffer, &ins.declaration.tgsm_structured.reg, &shader_version);
- shader_addline(&buffer, ", %u, %u", ins.declaration.tgsm_structured.byte_stride,
- ins.declaration.tgsm_structured.structure_count);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_THREAD_GROUP)
- {
- shader_addline(&buffer, "%s %u, %u, %u", shader_opcode_names[ins.handler_idx],
- ins.declaration.thread_group_size.x,
- ins.declaration.thread_group_size.y,
- ins.declaration.thread_group_size.z);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_UAV_RAW)
- {
- shader_addline(&buffer, "%s", shader_opcode_names[ins.handler_idx]);
- shader_dump_uav_flags(&buffer, ins.flags);
- shader_addline(&buffer, " ");
- shader_dump_dst_param(&buffer, &ins.declaration.dst, &shader_version);
- }
- else if (ins.handler_idx == VKD3DSIH_DCL_UAV_STRUCTURED)
- {
- shader_addline(&buffer, "%s", shader_opcode_names[ins.handler_idx]);
- shader_dump_uav_flags(&buffer, ins.flags);
- shader_addline(&buffer, " ");
- shader_dump_dst_param(&buffer, &ins.declaration.structured_resource.reg, &shader_version);
- shader_addline(&buffer, ", %u", ins.declaration.structured_resource.byte_stride);
- }
- else if (ins.handler_idx == VKD3DSIH_DEF)
- {
- shader_addline(&buffer, "def c%u = %.8e, %.8e, %.8e, %.8e",
- shader_get_float_offset(ins.dst[0].reg.type, ins.dst[0].reg.idx[0].offset),
- ins.src[0].reg.u.immconst_float[0], ins.src[0].reg.u.immconst_float[1],
- ins.src[0].reg.u.immconst_float[2], ins.src[0].reg.u.immconst_float[3]);
- }
- else if (ins.handler_idx == VKD3DSIH_DEFI)
- {
- shader_addline(&buffer, "defi i%u = %d, %d, %d, %d", ins.dst[0].reg.idx[0].offset,
- ins.src[0].reg.u.immconst_uint[0], ins.src[0].reg.u.immconst_uint[1],
- ins.src[0].reg.u.immconst_uint[2], ins.src[0].reg.u.immconst_uint[3]);
- }
- else if (ins.handler_idx == VKD3DSIH_DEFB)
- {
- shader_addline(&buffer, "defb b%u = %s",
- ins.dst[0].reg.idx[0].offset, ins.src[0].reg.u.immconst_uint[0] ? "true" : "false");
- }
- else
- {
- if (ins.predicate)
- {
- shader_addline(&buffer, "(");
- shader_dump_src_param(&buffer, ins.predicate, &shader_version);
- shader_addline(&buffer, ") ");
- }
-
- /* PixWin marks instructions with the coissue flag with a '+' */
- if (ins.coissue)
- shader_addline(&buffer, "+");
-
- shader_addline(&buffer, "%s", shader_opcode_names[ins.handler_idx]);
-
- shader_dump_instruction_flags(&buffer, &ins, &shader_version);
- if (vkd3d_shader_instruction_has_texel_offset(&ins))
- shader_addline(&buffer, "(%d,%d,%d)", ins.texel_offset.u, ins.texel_offset.v, ins.texel_offset.w);
-
- for (i = 0; i < ins.dst_count; ++i)
- {
- shader_dump_ins_modifiers(&buffer, &ins.dst[i]);
- shader_addline(&buffer, !i ? " " : ", ");
- shader_dump_dst_param(&buffer, &ins.dst[i], &shader_version);
- }
-
- /* Other source tokens */
- for (i = ins.dst_count; i < (ins.dst_count + ins.src_count); ++i)
- {
- shader_addline(&buffer, !i ? " " : ", ");
- shader_dump_src_param(&buffer, &ins.src[i - ins.dst_count], &shader_version);
- }
- }
- shader_addline(&buffer, "\n");
+ shader_dump_instruction(&buffer, &ins, &shader_version);
}
for (p = buffer.buffer; *p; p = q)
--
2.16.4
More information about the wine-devel
mailing list