Francisco Casas (@fcasas) commented about libs/vkd3d-shader/hlsl_codegen.c:
- unsigned int dim_count;
- if (instr->type != HLSL_IR_RESOURCE_LOAD)
return false;
- load = hlsl_ir_resource_load(instr);
- if (load->load_type != HLSL_RESOURCE_SAMPLE_PROJ)
return false;
- dim_count = hlsl_sampler_dim_count(load->sampling_dim);
- if (!(swizzle = hlsl_new_swizzle(ctx, HLSL_SWIZZLE(W, W, W, W), dim_count, load->coords.node, &instr->loc)))
return false;
- list_add_before(&instr->entry, &swizzle->entry);
- operands[0] = load->coords.node;
- operands[1] = swizzle;
- if (!(coords = hlsl_new_expr(ctx, HLSL_OP2_DIV, operands, hlsl_get_vector_type(ctx, HLSL_TYPE_FLOAT, dim_count),
Since the result has the same type as the operands, you can use hlsl_new_binary_expr() here.