spirv: handle OpCopyObject correctly with any types
This implements OpCopyObject as a blind copy and propagates the access mask properly even if the source object type isn't a SSA value. This fixes some recent dEQP-VK.descriptor_indexing.* failures since CTS changed and now apply nonUniformEXT after constructing a combined image/sampler. Original patch is from Jason Ekstrand. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4909>
This commit is contained in:

committed by
Marge Bot

parent
9d1821adf0
commit
844d561c58
@@ -3469,9 +3469,11 @@ vtn_handle_composite(struct vtn_builder *b, SpvOp opcode,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SpvOpCopyLogical:
|
case SpvOpCopyLogical:
|
||||||
case SpvOpCopyObject:
|
|
||||||
ssa = vtn_composite_copy(b, vtn_ssa_value(b, w[3]));
|
ssa = vtn_composite_copy(b, vtn_ssa_value(b, w[3]));
|
||||||
break;
|
break;
|
||||||
|
case SpvOpCopyObject:
|
||||||
|
vtn_copy_value(b, w[3], w[2]);
|
||||||
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
vtn_fail_with_opcode("unknown composite operation", opcode);
|
vtn_fail_with_opcode("unknown composite operation", opcode);
|
||||||
|
@@ -807,6 +807,10 @@ struct vtn_value *vtn_push_value_pointer(struct vtn_builder *b,
|
|||||||
struct vtn_value *vtn_push_ssa(struct vtn_builder *b, uint32_t value_id,
|
struct vtn_value *vtn_push_ssa(struct vtn_builder *b, uint32_t value_id,
|
||||||
struct vtn_type *type, struct vtn_ssa_value *ssa);
|
struct vtn_type *type, struct vtn_ssa_value *ssa);
|
||||||
|
|
||||||
|
void
|
||||||
|
vtn_copy_value(struct vtn_builder *b, uint32_t src_value_id,
|
||||||
|
uint32_t dst_value_id);
|
||||||
|
|
||||||
struct vtn_ssa_value *vtn_create_ssa_value(struct vtn_builder *b,
|
struct vtn_ssa_value *vtn_create_ssa_value(struct vtn_builder *b,
|
||||||
const struct glsl_type *type);
|
const struct glsl_type *type);
|
||||||
|
|
||||||
|
@@ -78,13 +78,19 @@ vtn_push_value_pointer(struct vtn_builder *b, uint32_t value_id,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
ssa_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
|
ssa_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
|
||||||
const struct vtn_decoration *dec, void *void_ssa)
|
const struct vtn_decoration *dec, void *void_ctx)
|
||||||
{
|
{
|
||||||
struct vtn_ssa_value *ssa = void_ssa;
|
|
||||||
|
|
||||||
switch (dec->decoration) {
|
switch (dec->decoration) {
|
||||||
case SpvDecorationNonUniformEXT:
|
case SpvDecorationNonUniformEXT:
|
||||||
ssa->access |= ACCESS_NON_UNIFORM;
|
if (val->value_type == vtn_value_type_ssa) {
|
||||||
|
val->ssa->access |= ACCESS_NON_UNIFORM;
|
||||||
|
} else if (val->value_type == vtn_value_type_pointer) {
|
||||||
|
val->pointer->access |= ACCESS_NON_UNIFORM;
|
||||||
|
} else if (val->value_type == vtn_value_type_sampled_image) {
|
||||||
|
val->sampled_image->image->access |= ACCESS_NON_UNIFORM;
|
||||||
|
} else if (val->value_type == vtn_value_type_image_pointer) {
|
||||||
|
val->image->image->access |= ACCESS_NON_UNIFORM;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -102,11 +108,30 @@ vtn_push_ssa(struct vtn_builder *b, uint32_t value_id,
|
|||||||
} else {
|
} else {
|
||||||
val = vtn_push_value(b, value_id, vtn_value_type_ssa);
|
val = vtn_push_value(b, value_id, vtn_value_type_ssa);
|
||||||
val->ssa = ssa;
|
val->ssa = ssa;
|
||||||
vtn_foreach_decoration(b, val, ssa_decoration_cb, val->ssa);
|
vtn_foreach_decoration(b, val, ssa_decoration_cb, NULL);
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
vtn_copy_value(struct vtn_builder *b, uint32_t src_value_id,
|
||||||
|
uint32_t dst_value_id)
|
||||||
|
{
|
||||||
|
struct vtn_value *src = vtn_untyped_value(b, src_value_id);
|
||||||
|
struct vtn_value *dst = vtn_push_value(b, dst_value_id, src->value_type);
|
||||||
|
struct vtn_value src_copy = *src;
|
||||||
|
|
||||||
|
vtn_fail_if(dst->type->id != src->type->id,
|
||||||
|
"Result Type must equal Operand type");
|
||||||
|
|
||||||
|
src_copy.name = dst->name;
|
||||||
|
src_copy.decoration = dst->decoration;
|
||||||
|
src_copy.type = dst->type;
|
||||||
|
*dst = src_copy;
|
||||||
|
|
||||||
|
vtn_foreach_decoration(b, dst, ssa_decoration_cb, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static struct vtn_access_chain *
|
static struct vtn_access_chain *
|
||||||
vtn_access_chain_create(struct vtn_builder *b, unsigned length)
|
vtn_access_chain_create(struct vtn_builder *b, unsigned length)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user