Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl.y:
- return value->u; - case HLSL_TYPE_INT: - return value->i; - case HLSL_TYPE_FLOAT: - case HLSL_TYPE_HALF: - return value->f; - case HLSL_TYPE_DOUBLE: - return value->d; - case HLSL_TYPE_BOOL: - return !!value->u; - default: - vkd3d_unreachable(); - } - } + hlsl_block_init(&block); + hlsl_block_add_instr(&block, node); This instruction already belongs to a block; this'll corrupt that list.
Separately, this will only fold the one expression. I believe both problems will be fixed if you just transform the whole block, and I don't see any reason not to? -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/180#note_31335