spirv: handle undefined components for OpVectorShuffle
Fixes: dEQP-VK.spirv_assembly.instruction.compute.opspecconstantop.vector_related dEQP-VK.spirv_assembly.instruction.graphics.opspecconstantop.vector_related* Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Cc: "17.0 13.0" <mesa-stable@lists.freedesktop.org>
This commit is contained in:
@@ -1113,23 +1113,43 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
|
|||||||
SpvOp opcode = get_specialization(b, val, w[3]);
|
SpvOp opcode = get_specialization(b, val, w[3]);
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case SpvOpVectorShuffle: {
|
case SpvOpVectorShuffle: {
|
||||||
struct vtn_value *v0 = vtn_value(b, w[4], vtn_value_type_constant);
|
struct vtn_value *v0 = &b->values[w[4]];
|
||||||
struct vtn_value *v1 = vtn_value(b, w[5], vtn_value_type_constant);
|
struct vtn_value *v1 = &b->values[w[5]];
|
||||||
unsigned len0 = glsl_get_vector_elements(v0->const_type);
|
|
||||||
unsigned len1 = glsl_get_vector_elements(v1->const_type);
|
assert(v0->value_type == vtn_value_type_constant ||
|
||||||
|
v0->value_type == vtn_value_type_undef);
|
||||||
|
assert(v1->value_type == vtn_value_type_constant ||
|
||||||
|
v1->value_type == vtn_value_type_undef);
|
||||||
|
|
||||||
|
unsigned len0 = v0->value_type == vtn_value_type_constant ?
|
||||||
|
glsl_get_vector_elements(v0->const_type) :
|
||||||
|
glsl_get_vector_elements(v0->type->type);
|
||||||
|
unsigned len1 = v1->value_type == vtn_value_type_constant ?
|
||||||
|
glsl_get_vector_elements(v1->const_type) :
|
||||||
|
glsl_get_vector_elements(v1->type->type);
|
||||||
|
|
||||||
assert(len0 + len1 < 16);
|
assert(len0 + len1 < 16);
|
||||||
|
|
||||||
unsigned bit_size = glsl_get_bit_size(val->const_type);
|
unsigned bit_size = glsl_get_bit_size(val->const_type);
|
||||||
assert(bit_size == glsl_get_bit_size(v0->const_type) &&
|
unsigned bit_size0 = v0->value_type == vtn_value_type_constant ?
|
||||||
bit_size == glsl_get_bit_size(v1->const_type));
|
glsl_get_bit_size(v0->const_type) :
|
||||||
|
glsl_get_bit_size(v0->type->type);
|
||||||
|
unsigned bit_size1 = v1->value_type == vtn_value_type_constant ?
|
||||||
|
glsl_get_bit_size(v1->const_type) :
|
||||||
|
glsl_get_bit_size(v1->type->type);
|
||||||
|
|
||||||
|
assert(bit_size == bit_size0 && bit_size == bit_size1);
|
||||||
|
|
||||||
if (bit_size == 64) {
|
if (bit_size == 64) {
|
||||||
uint64_t u64[8];
|
uint64_t u64[8];
|
||||||
for (unsigned i = 0; i < len0; i++)
|
if (v0->value_type == vtn_value_type_constant) {
|
||||||
u64[i] = v0->constant->values[0].u64[i];
|
for (unsigned i = 0; i < len0; i++)
|
||||||
for (unsigned i = 0; i < len1; i++)
|
u64[i] = v0->constant->values[0].u64[i];
|
||||||
u64[len0 + i] = v1->constant->values[0].u64[i];
|
}
|
||||||
|
if (v1->value_type == vtn_value_type_constant) {
|
||||||
|
for (unsigned i = 0; i < len1; i++)
|
||||||
|
u64[len0 + i] = v1->constant->values[0].u64[i];
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned i = 0, j = 0; i < count - 6; i++, j++) {
|
for (unsigned i = 0, j = 0; i < count - 6; i++, j++) {
|
||||||
uint32_t comp = w[i + 6];
|
uint32_t comp = w[i + 6];
|
||||||
@@ -1143,11 +1163,14 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uint32_t u32[8];
|
uint32_t u32[8];
|
||||||
for (unsigned i = 0; i < len0; i++)
|
if (v0->value_type == vtn_value_type_constant) {
|
||||||
u32[i] = v0->constant->values[0].u32[i];
|
for (unsigned i = 0; i < len0; i++)
|
||||||
|
u32[i] = v0->constant->values[0].u32[i];
|
||||||
for (unsigned i = 0; i < len1; i++)
|
}
|
||||||
u32[len0 + i] = v1->constant->values[0].u32[i];
|
if (v1->value_type == vtn_value_type_constant) {
|
||||||
|
for (unsigned i = 0; i < len1; i++)
|
||||||
|
u32[len0 + i] = v1->constant->values[0].u32[i];
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned i = 0, j = 0; i < count - 6; i++, j++) {
|
for (unsigned i = 0, j = 0; i < count - 6; i++, j++) {
|
||||||
uint32_t comp = w[i + 6];
|
uint32_t comp = w[i + 6];
|
||||||
|
Reference in New Issue
Block a user