On Fri Mar 22 22:09:42 2024 +0000, Francisco Casas wrote:
Another case that does not fit into "args" array is examples like
"compile ps_2_0, main(var)", or asm {} blocks, or asm{} blocks with leading decl{} part. Those will have to be handled separately. The approach I am writing for the `compile ps_2_0 main(var)` compile expressions is creating a HLSL_IR_COMPILE_SHADER node type. I think this is necessary because these can also appear outside state blocks (which means they are part of regular HLSL syntax):
PixelShader ps1 = compile ps_2_0 main(); technique { pass { SetPixelShader(ps1); } }
so it would be a matter of checking if rhs's arg[0] is of this type of node. I haven't hear of asm{} blocks before, but I assume something similar would happen.
...which means we would have to somewhat propagate the loads to pixel|vertex shader variables into these HLSL_IR_COMPILE_SHADER. Maybe something worth adding to the copy-propagation pass if we end up using it for rhs.