vkd3d-shader/d3dbc: Compile HLSL to d3dbc through vsir, part 3.
Merge request reports
Activity
added 16 commits
-
0d651fc2...bfd1fc9c - 11 commits from branch
wine:master
- 74904a99 - vkd3d-shader/hlsl: Save simple hlsl_ir_exprs in the vsir_program for SM1.
- 178686d9 - vkd3d-shader/hlsl: Save per-component hlsl_ir_exprs in the vsir_program for SM1.
- 886accbc - vkd3d-shader/hlsl: Save DOT hlsl_ir_exprs in the vsir_program for SM1.
- 60729616 - vkd3d-shader/hlsl: Save COS_REDUCED and SIN_REDUCED in the vsir_program for SM1.
- e61bd3f5 - vkd3d-shader/hlsl: Save DP2ADD hlsl_ir_exprs in the vsir_program for SM1.
Toggle commit list-
0d651fc2...bfd1fc9c - 11 commits from branch
⬆ Needed a rebase after b9693393 .+static void d3dbc_write_vsir_per_component_instr(struct d3dbc_compiler *d3dbc, + const struct vkd3d_shader_instruction *ins) +{ + const struct vkd3d_sm1_opcode_info *info; + struct sm1_instruction instr = {0}; + unsigned int i; + + if (!(info = shader_sm1_get_opcode_info_from_vsir_instruction(d3dbc, ins))) + return; + + instr.opcode = info->sm1_opcode; + instr.has_dst = info->dst_count; + instr.src_count = info->src_count; + + VKD3D_ASSERT(instr.has_dst); + VKD3D_ASSERT(instr.src_count == 1); + + sm1_dst_reg_from_vsir(d3dbc, &ins->dst[0], &instr.dst, &ins->location); + sm1_src_reg_from_vsir(d3dbc, &ins->src[0], &instr.srcs[0], &ins->location); + + for (i = 0; i < 4; ++i) + { + if (instr.dst.writemask & (1u << i)) + { + struct sm1_instruction instr_copy = instr; + unsigned int c; + + instr_copy.dst.writemask = (1u << i); + c = shader_sm1_get_swizzle_component(instr.srcs[0].swizzle, i); + instr_copy.srcs[0].swizzle = hlsl_swizzle_from_writemask(1u << c); + + d3dbc_write_instruction(d3dbc, &instr_copy); + } + } +}
That doesn't seem quite right. We'll ultimately want the d3dbc backend to consume the "d3dbc" variant of vsir, so that hlsl->vsir->d3d-asm produces the same output as hlsl->vsir->d3dbc->d3d-asm. The implication is that we don't want to do this kind of fixup in the d3dbc backend, but instead want to either produce "d3dbc" vsir on the HLSL side, or produce generic vsir and then run a ir.c lowering pass. The former seems like the easier option at this point, since I think it would effectively be a matter of moving d3dbc_write_per_component_unary_op() to hlsl_codegen.c.
#include "hlsl.h" +#include "vkd3d_shader_private.h"
Why is that?
That doesn't seem quite right. We'll ultimately want the d3dbc backend to consume the "d3dbc" variant of vsir, so that hlsl->vsir->d3d-asm produces the same output as hlsl->vsir->d3dbc->d3d-asm. The implication is that we don't want to do this kind of fixup in the d3dbc backend, but instead want to either produce "d3dbc" vsir on the HLSL side, or produce generic vsir and then run a ir.c lowering pass. The former seems like the easier option at this point, since I think it would effectively be a matter of moving d3dbc_write_per_component_unary_op() to hlsl_codegen.c.
I see. I introduced sm1_generate_vsir_instr_expr_per_component_instr_op() to split these operations in hlsl_codegen.c. I had to add a no-op MOV to properly replace the original expression, but that only lasts until hlsl_ir_vsir_instruction_ref is removed later in the patches when the translation is complete.
I added a check to emit an error in d3dbc_write_vsir_instruction() in case these instruction get a multi-component dst writemask from other source.
#include "hlsl.h" +#include "vkd3d_shader_private.h"
Why is that?
Sorry, the auto-complete symbol feature of my text editor sometimes auto-includes files, I missed removing this one.
Sorry, the auto-complete symbol feature of my text editor sometimes auto-includes files, I missed removing this one.
If that's VS Code/Codium, I have this in my
settings.json
file:"clangd.arguments": [ "--header-insertion=never" ]
Clangd's header insertion algorithms are way too heavy-handed.
added 4 commits
- 05e86378 - vkd3d-shader/hlsl: Save per-component hlsl_ir_exprs in the vsir_program for SM1.
- e6c3f9c9 - vkd3d-shader/hlsl: Save DOT hlsl_ir_exprs in the vsir_program for SM1.
- 869aed7f - vkd3d-shader/hlsl: Save COS_REDUCED and SIN_REDUCED in the vsir_program for SM1.
- 8b302213 - vkd3d-shader/hlsl: Save DP2ADD hlsl_ir_exprs in the vsir_program for SM1.
Toggle commit listadded 29 commits
-
8b302213...f6a8cdf2 - 24 commits from branch
wine:master
- 82dec5db - vkd3d-shader/hlsl: Save simple hlsl_ir_exprs in the vsir_program for SM1.
- d70342d6 - vkd3d-shader/hlsl: Save per-component hlsl_ir_exprs in the vsir_program for SM1.
- 5db2c2a9 - vkd3d-shader/hlsl: Save DOT hlsl_ir_exprs in the vsir_program for SM1.
- 4ed16108 - vkd3d-shader/hlsl: Save COS_REDUCED and SIN_REDUCED in the vsir_program for SM1.
- 6e6e2910 - vkd3d-shader/hlsl: Save DP2ADD hlsl_ir_exprs in the vsir_program for SM1.
Toggle commit list-
8b302213...f6a8cdf2 - 24 commits from branch