}
default:
- vtn_fail("Unhandled opcode");
+ vtn_fail_with_opcode("Unhandled opcode", opcode);
}
}
break;
default:
- vtn_fail("Unhandled decoration");
+ vtn_fail_with_decoration("Unhandled decoration", dec->decoration);
}
}
break;
default:
- vtn_fail("Unhandled decoration");
+ vtn_fail_with_decoration("Unhandled decoration", dec->decoration);
}
}
case SpvImageFormatR16ui: return 0x8234; /* GL_R16UI */
case SpvImageFormatR8ui: return 0x8232; /* GL_R8UI */
default:
- vtn_fail("Invalid image format");
+ vtn_fail("Invalid image format: %s (%u)",
+ spirv_imageformat_to_string(format), format);
}
}
val->type->type = (signedness ? glsl_int8_t_type() : glsl_uint8_t_type());
break;
default:
- vtn_fail("Invalid int bit size");
+ vtn_fail("Invalid int bit size: %u", bit_size);
}
val->type->length = 1;
break;
val->type->type = glsl_double_type();
break;
default:
- vtn_fail("Invalid float bit size");
+ vtn_fail("Invalid float bit size: %u", bit_size);
}
val->type->length = 1;
break;
case SpvDimBuffer: dim = GLSL_SAMPLER_DIM_BUF; break;
case SpvDimSubpassData: dim = GLSL_SAMPLER_DIM_SUBPASS; break;
default:
- vtn_fail("Invalid SPIR-V image dimensionality");
+ vtn_fail("Invalid SPIR-V image dimensionality: %s (%u)",
+ spirv_dim_to_string((SpvDim)w[3]), w[3]);
}
/* w[4]: as per Vulkan spec "Validation Rules within a Module",
case SpvOpTypeQueue:
case SpvOpTypePipe:
default:
- vtn_fail("Unhandled opcode");
+ vtn_fail_with_opcode("Unhandled opcode", opcode);
}
vtn_foreach_decoration(b, val, type_decoration_cb, NULL);
val->constant->values[0][0].u8 = w[3];
break;
default:
- vtn_fail("Unsupported SpvOpConstant bit size");
+ vtn_fail("Unsupported SpvOpConstant bit size: %u", bit_size);
}
break;
}
switch (val->type->base_type) {
case vtn_base_type_vector: {
assert(glsl_type_is_vector(val->type->type));
- int bit_size = glsl_get_bit_size(val->type->type);
- for (unsigned i = 0; i < elem_count; i++) {
- switch (bit_size) {
- case 64:
- val->constant->values[0][i].u64 = elems[i]->values[0][0].u64;
- break;
- case 32:
- val->constant->values[0][i].u32 = elems[i]->values[0][0].u32;
- break;
- case 16:
- val->constant->values[0][i].u16 = elems[i]->values[0][0].u16;
- break;
- case 8:
- val->constant->values[0][i].u8 = elems[i]->values[0][0].u8;
- break;
- case 1:
- val->constant->values[0][i].b = elems[i]->values[0][0].b;
- break;
- default:
- vtn_fail("Invalid SpvOpConstantComposite bit size");
- }
- }
+ for (unsigned i = 0; i < elem_count; i++)
+ val->constant->values[0][i] = elems[i]->values[0][0];
break;
}
val->constant = *c;
} else {
unsigned num_components = type->length;
- unsigned bit_size = glsl_get_bit_size(type->type);
for (unsigned i = 0; i < num_components; i++)
- switch(bit_size) {
- case 64:
- val->constant->values[0][i].u64 = (*c)->values[col][elem + i].u64;
- break;
- case 32:
- val->constant->values[0][i].u32 = (*c)->values[col][elem + i].u32;
- break;
- case 16:
- val->constant->values[0][i].u16 = (*c)->values[col][elem + i].u16;
- break;
- case 8:
- val->constant->values[0][i].u8 = (*c)->values[col][elem + i].u8;
- break;
- case 1:
- val->constant->values[0][i].b = (*c)->values[col][elem + i].b;
- break;
- default:
- vtn_fail("Invalid SpvOpCompositeExtract bit size");
- }
+ val->constant->values[0][i] = (*c)->values[col][elem + i];
}
} else {
struct vtn_value *insert =
*c = insert->constant;
} else {
unsigned num_components = type->length;
- unsigned bit_size = glsl_get_bit_size(type->type);
for (unsigned i = 0; i < num_components; i++)
- switch (bit_size) {
- case 64:
- (*c)->values[col][elem + i].u64 = insert->constant->values[0][i].u64;
- break;
- case 32:
- (*c)->values[col][elem + i].u32 = insert->constant->values[0][i].u32;
- break;
- case 16:
- (*c)->values[col][elem + i].u16 = insert->constant->values[0][i].u16;
- break;
- case 8:
- (*c)->values[col][elem + i].u8 = insert->constant->values[0][i].u8;
- break;
- case 1:
- (*c)->values[col][elem + i].b = insert->constant->values[0][i].b;
- break;
- default:
- vtn_fail("Invalid SpvOpCompositeInsert bit size");
- }
+ (*c)->values[col][elem + i] = insert->constant->values[0][i];
}
}
break;
break;
default:
- vtn_fail("Unhandled opcode");
+ vtn_fail_with_opcode("Unhandled opcode", opcode);
}
/* Now that we have the value, update the workgroup size if needed */
break;
default:
- vtn_fail("Unhandled opcode");
+ vtn_fail_with_opcode("Unhandled opcode", opcode);
}
nir_tex_src srcs[10]; /* 10 should be enough */
case 32: instr->tg4_offsets[i][j] = cvec[j].i32; break;
case 64: instr->tg4_offsets[i][j] = cvec[j].i64; break;
default:
- vtn_fail("Unsupported bit size");
+ vtn_fail("Unsupported bit size: %u", bit_size);
}
}
}
break;
default:
- vtn_fail("Invalid SPIR-V atomic");
+ vtn_fail_with_opcode("Invalid SPIR-V atomic", opcode);
}
}
break;
default:
- vtn_fail("Invalid image opcode");
+ vtn_fail_with_opcode("Invalid image opcode", opcode);
}
nir_intrinsic_op op;
OP(AtomicXor, atomic_xor)
#undef OP
default:
- vtn_fail("Invalid image opcode");
+ vtn_fail_with_opcode("Invalid image opcode", opcode);
}
nir_intrinsic_instr *intrin = nir_intrinsic_instr_create(b->shader, op);
break;
default:
- vtn_fail("Invalid image opcode");
+ vtn_fail_with_opcode("Invalid image opcode", opcode);
}
if (opcode != SpvOpImageWrite && opcode != SpvOpAtomicStore) {
OP(AtomicXor, atomic_xor)
#undef OP
default:
- vtn_fail("Invalid SSBO atomic");
+ vtn_fail_with_opcode("Invalid SSBO atomic", opcode);
}
}
OP(AtomicXor, atomic_xor)
#undef OP
default:
- vtn_fail("Invalid shared atomic");
+ vtn_fail_with_opcode("Invalid shared atomic", opcode);
}
}
OP(AtomicXor, atomic_xor)
#undef OP
default:
- vtn_fail("Invalid shared atomic");
+ vtn_fail_with_opcode("Invalid shared atomic", opcode);
}
}
break;
default:
- vtn_fail("Invalid SPIR-V atomic");
+ vtn_fail_with_opcode("Invalid SPIR-V atomic", opcode);
}
/*
break;
default:
- vtn_fail("Invalid SPIR-V atomic");
+ vtn_fail_with_opcode("Invalid SPIR-V atomic", opcode);
}
} else {
nir_deref_instr *deref = vtn_pointer_to_deref(b, ptr);
break;
default:
- vtn_fail("Invalid SPIR-V atomic");
+ vtn_fail_with_opcode("Invalid SPIR-V atomic", opcode);
}
}
case 2: op = nir_op_vec2; break;
case 3: op = nir_op_vec3; break;
case 4: op = nir_op_vec4; break;
- default: vtn_fail("bad vector size");
+ default: vtn_fail("bad vector size: %u", num_components);
}
nir_alu_instr *vec = nir_alu_instr_create(b->shader, op);
break;
default:
- vtn_fail("unknown composite operation");
+ vtn_fail_with_opcode("unknown composite operation", opcode);
}
}
case SpvExecutionModeOutputTriangleStrip:
return 5; /* GL_TRIANGLE_STRIP */
default:
- vtn_fail("Invalid primitive type");
+ vtn_fail("Invalid primitive type: %s (%u)",
+ spirv_executionmode_to_string(mode), mode);
}
}
case SpvExecutionModeInputTrianglesAdjacency:
return 6;
default:
- vtn_fail("Invalid GS input mode");
+ vtn_fail("Invalid GS input mode: %s (%u)",
+ spirv_executionmode_to_string(mode), mode);
}
}
case SpvExecutionModelKernel:
return MESA_SHADER_KERNEL;
default:
- vtn_fail("Unsupported execution model");
+ vtn_fail("Unsupported execution model: %s (%u)",
+ spirv_executionmodel_to_string(model), model);
}
}
-#define spv_check_supported(name, cap) do { \
- if (!(b->options && b->options->caps.name)) \
- vtn_warn("Unsupported SPIR-V capability: %s", \
- spirv_capability_to_string(cap)); \
+#define spv_check_supported(name, cap) do { \
+ if (!(b->options && b->options->caps.name)) \
+ vtn_warn("Unsupported SPIR-V capability: %s (%u)", \
+ spirv_capability_to_string(cap), cap); \
} while(0)
case SpvCapabilityLinkage:
case SpvCapabilityVector16:
case SpvCapabilityFloat16Buffer:
- case SpvCapabilityFloat16:
case SpvCapabilitySparseResidency:
vtn_warn("Unsupported SPIR-V capability: %s",
spirv_capability_to_string(cap));
spv_check_supported(derivative_group, cap);
break;
+ case SpvCapabilityFloat16:
+ spv_check_supported(float16, cap);
+ break;
+
default:
- vtn_fail("Unhandled capability");
+ vtn_fail("Unhandled capability: %s (%u)",
+ spirv_capability_to_string(cap), cap);
}
break;
}
"AddressingModelPhysicalStorageBuffer64EXT not supported");
break;
default:
- vtn_fail("Unknown addressing model");
+ vtn_fail("Unknown addressing model: %s (%u)",
+ spirv_addressingmodel_to_string(w[1]), w[1]);
break;
}
break;
default:
- vtn_fail("Unhandled execution mode");
+ vtn_fail("Unhandled execution mode: %s (%u)",
+ spirv_executionmode_to_string(mode->exec_mode),
+ mode->exec_mode);
}
}
break;
default:
- vtn_fail("Unhandled opcode");
+ vtn_fail_with_opcode("Unhandled opcode", opcode);
}
return true;