Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl_sm4.c:
static void write_sm4_ld(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer, const struct hlsl_type *resource_type, const struct hlsl_ir_node *dst, const struct hlsl_deref *resource, const struct hlsl_ir_node *coords,
const struct hlsl_ir_node *texel_offset)
const struct hlsl_ir_node *sample_index, const struct hlsl_ir_node *texel_offset)
{ bool uav = (resource_type->base_type == HLSL_TYPE_UAV);
bool multisampled = resource_type->base_type == HLSL_TYPE_TEXTURE
&& (resource_type->sampler_dim == HLSL_SAMPLER_DIM_2DMS || resource_type->sampler_dim == HLSL_SAMPLER_DIM_2DMSARRAY);
struct sm4_instruction instr; unsigned int dim_count;
memset(&instr, 0, sizeof(instr));
- instr.opcode = uav ? VKD3D_SM5_OP_LD_UAV_TYPED : VKD3D_SM4_OP_LD;
- instr.opcode = uav ? VKD3D_SM5_OP_LD_UAV_TYPED : (multisampled ? VKD3D_SM4_OP_LD2DMS : VKD3D_SM4_OP_LD);
Let's not nest ternary operators, please, that's a little hard to read.