mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 17:20:10 +01:00
zink: fix spirv image operand ordering
image operands are ordered by their operand's spirv value, meaning that
the availability operands need to go last here
Fixes: 882ab6afb7 ("zink: add spirv builder functions for image ops")
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9724>
This commit is contained in:
parent
e696596f86
commit
3adc4c41e1
1 changed files with 28 additions and 39 deletions
|
|
@ -744,33 +744,30 @@ spirv_builder_emit_image_sample(struct spirv_builder *b,
|
|||
|
||||
SpvImageOperandsMask operand_mask = SpvImageOperandsMaskNone;
|
||||
SpvId extra_operands[5];
|
||||
int num_extra_operands = 0;
|
||||
int num_extra_operands = 1;
|
||||
if (bias) {
|
||||
extra_operands[++num_extra_operands] = bias;
|
||||
extra_operands[num_extra_operands++] = bias;
|
||||
operand_mask |= SpvImageOperandsBiasMask;
|
||||
}
|
||||
if (lod) {
|
||||
extra_operands[++num_extra_operands] = lod;
|
||||
extra_operands[num_extra_operands++] = lod;
|
||||
operand_mask |= SpvImageOperandsLodMask;
|
||||
} else if (dx && dy) {
|
||||
extra_operands[++num_extra_operands] = dx;
|
||||
extra_operands[++num_extra_operands] = dy;
|
||||
extra_operands[num_extra_operands++] = dx;
|
||||
extra_operands[num_extra_operands++] = dy;
|
||||
operand_mask |= SpvImageOperandsGradMask;
|
||||
}
|
||||
assert(!(const_offset && offset));
|
||||
if (const_offset) {
|
||||
extra_operands[++num_extra_operands] = const_offset;
|
||||
extra_operands[num_extra_operands++] = const_offset;
|
||||
operand_mask |= SpvImageOperandsConstOffsetMask;
|
||||
} else if (offset) {
|
||||
extra_operands[++num_extra_operands] = offset;
|
||||
extra_operands[num_extra_operands++] = offset;
|
||||
operand_mask |= SpvImageOperandsOffsetMask;
|
||||
}
|
||||
|
||||
/* finalize num_extra_operands / extra_operands */
|
||||
if (num_extra_operands > 0) {
|
||||
extra_operands[0] = operand_mask;
|
||||
num_extra_operands++;
|
||||
}
|
||||
extra_operands[0] = operand_mask;
|
||||
|
||||
spirv_buffer_prepare(&b->instructions, b->mem_ctx, operands + num_extra_operands);
|
||||
spirv_buffer_emit_word(&b->instructions, opcode | ((operands + num_extra_operands) << 16));
|
||||
|
|
@ -825,22 +822,21 @@ spirv_builder_emit_image_read(struct spirv_builder *b,
|
|||
SpvImageOperandsMask operand_mask = SpvImageOperandsMakeTexelVisibleMask | SpvImageOperandsNonPrivateTexelMask;
|
||||
SpvId extra_operands[5];
|
||||
int num_extra_operands = 1;
|
||||
extra_operands[1] = spirv_builder_const_uint(b, 32, SpvScopeWorkgroup);
|
||||
if (lod) {
|
||||
extra_operands[++num_extra_operands] = lod;
|
||||
extra_operands[num_extra_operands++] = lod;
|
||||
operand_mask |= SpvImageOperandsLodMask;
|
||||
}
|
||||
if (sample) {
|
||||
extra_operands[++num_extra_operands] = sample;
|
||||
extra_operands[num_extra_operands++] = sample;
|
||||
operand_mask |= SpvImageOperandsSampleMask;
|
||||
}
|
||||
if (offset) {
|
||||
extra_operands[++num_extra_operands] = offset;
|
||||
extra_operands[num_extra_operands++] = offset;
|
||||
operand_mask |= SpvImageOperandsOffsetMask;
|
||||
}
|
||||
/* finalize num_extra_operands / extra_operands */
|
||||
extra_operands[0] = operand_mask;
|
||||
num_extra_operands++;
|
||||
extra_operands[num_extra_operands++] = spirv_builder_const_uint(b, 32, SpvScopeWorkgroup);
|
||||
|
||||
spirv_buffer_prepare(&b->instructions, b->mem_ctx, 5 + num_extra_operands);
|
||||
spirv_buffer_emit_word(&b->instructions, SpvOpImageRead |
|
||||
|
|
@ -866,22 +862,21 @@ spirv_builder_emit_image_write(struct spirv_builder *b,
|
|||
SpvImageOperandsMask operand_mask = SpvImageOperandsMakeTexelAvailableMask | SpvImageOperandsNonPrivateTexelMask;
|
||||
SpvId extra_operands[5];
|
||||
int num_extra_operands = 1;
|
||||
extra_operands[1] = spirv_builder_const_uint(b, 32, SpvScopeWorkgroup);
|
||||
if (lod) {
|
||||
extra_operands[++num_extra_operands] = lod;
|
||||
extra_operands[num_extra_operands++] = lod;
|
||||
operand_mask |= SpvImageOperandsLodMask;
|
||||
}
|
||||
if (sample) {
|
||||
extra_operands[++num_extra_operands] = sample;
|
||||
extra_operands[num_extra_operands++] = sample;
|
||||
operand_mask |= SpvImageOperandsSampleMask;
|
||||
}
|
||||
if (offset) {
|
||||
extra_operands[++num_extra_operands] = offset;
|
||||
extra_operands[num_extra_operands++] = offset;
|
||||
operand_mask |= SpvImageOperandsOffsetMask;
|
||||
}
|
||||
/* finalize num_extra_operands / extra_operands */
|
||||
extra_operands[0] = operand_mask;
|
||||
num_extra_operands++;
|
||||
extra_operands[num_extra_operands++] = spirv_builder_const_uint(b, 32, SpvScopeWorkgroup);
|
||||
|
||||
spirv_buffer_prepare(&b->instructions, b->mem_ctx, 4 + num_extra_operands);
|
||||
spirv_buffer_emit_word(&b->instructions, SpvOpImageWrite |
|
||||
|
|
@ -910,30 +905,27 @@ spirv_builder_emit_image_gather(struct spirv_builder *b,
|
|||
|
||||
SpvImageOperandsMask operand_mask = SpvImageOperandsMaskNone;
|
||||
SpvId extra_operands[4];
|
||||
int num_extra_operands = 0;
|
||||
int num_extra_operands = 1;
|
||||
if (lod) {
|
||||
extra_operands[++num_extra_operands] = lod;
|
||||
extra_operands[num_extra_operands++] = lod;
|
||||
operand_mask |= SpvImageOperandsLodMask;
|
||||
}
|
||||
if (sample) {
|
||||
extra_operands[++num_extra_operands] = sample;
|
||||
extra_operands[num_extra_operands++] = sample;
|
||||
operand_mask |= SpvImageOperandsSampleMask;
|
||||
}
|
||||
assert(!(const_offset && offset));
|
||||
if (const_offset) {
|
||||
extra_operands[++num_extra_operands] = const_offset;
|
||||
extra_operands[num_extra_operands++] = const_offset;
|
||||
operand_mask |= SpvImageOperandsConstOffsetMask;
|
||||
} else if (offset) {
|
||||
extra_operands[++num_extra_operands] = offset;
|
||||
extra_operands[num_extra_operands++] = offset;
|
||||
operand_mask |= SpvImageOperandsOffsetMask;
|
||||
}
|
||||
if (dref)
|
||||
op = SpvOpImageDrefGather;
|
||||
/* finalize num_extra_operands / extra_operands */
|
||||
if (num_extra_operands > 0) {
|
||||
extra_operands[0] = operand_mask;
|
||||
num_extra_operands++;
|
||||
}
|
||||
extra_operands[0] = operand_mask;
|
||||
|
||||
spirv_buffer_prepare(&b->instructions, b->mem_ctx, 6 + num_extra_operands);
|
||||
spirv_buffer_emit_word(&b->instructions, op |
|
||||
|
|
@ -965,29 +957,26 @@ spirv_builder_emit_image_fetch(struct spirv_builder *b,
|
|||
|
||||
SpvImageOperandsMask operand_mask = SpvImageOperandsMaskNone;
|
||||
SpvId extra_operands[4];
|
||||
int num_extra_operands = 0;
|
||||
int num_extra_operands = 1;
|
||||
if (lod) {
|
||||
extra_operands[++num_extra_operands] = lod;
|
||||
extra_operands[num_extra_operands++] = lod;
|
||||
operand_mask |= SpvImageOperandsLodMask;
|
||||
}
|
||||
if (sample) {
|
||||
extra_operands[++num_extra_operands] = sample;
|
||||
extra_operands[num_extra_operands++] = sample;
|
||||
operand_mask |= SpvImageOperandsSampleMask;
|
||||
}
|
||||
assert(!(const_offset && offset));
|
||||
if (const_offset) {
|
||||
extra_operands[++num_extra_operands] = const_offset;
|
||||
extra_operands[num_extra_operands++] = const_offset;
|
||||
operand_mask |= SpvImageOperandsConstOffsetMask;
|
||||
} else if (offset) {
|
||||
extra_operands[++num_extra_operands] = offset;
|
||||
extra_operands[num_extra_operands++] = offset;
|
||||
operand_mask |= SpvImageOperandsOffsetMask;
|
||||
}
|
||||
|
||||
/* finalize num_extra_operands / extra_operands */
|
||||
if (num_extra_operands > 0) {
|
||||
extra_operands[0] = operand_mask;
|
||||
num_extra_operands++;
|
||||
}
|
||||
extra_operands[0] = operand_mask;
|
||||
|
||||
spirv_buffer_prepare(&b->instructions, b->mem_ctx, 5 + num_extra_operands);
|
||||
spirv_buffer_emit_word(&b->instructions, SpvOpImageFetch |
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue