mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Updated spirv-tools.
This commit is contained in:
@@ -859,6 +859,7 @@ uint32_t ValidationState_t::GetComponentType(uint32_t id) const {
|
||||
return GetComponentType(inst->word(2));
|
||||
|
||||
case spv::Op::OpTypeCooperativeMatrixNV:
|
||||
case spv::Op::OpTypeCooperativeMatrixKHR:
|
||||
return inst->word(2);
|
||||
|
||||
default:
|
||||
@@ -886,6 +887,7 @@ uint32_t ValidationState_t::GetDimension(uint32_t id) const {
|
||||
return inst->word(3);
|
||||
|
||||
case spv::Op::OpTypeCooperativeMatrixNV:
|
||||
case spv::Op::OpTypeCooperativeMatrixKHR:
|
||||
// Actual dimension isn't known, return 0
|
||||
return 0;
|
||||
|
||||
@@ -1142,22 +1144,68 @@ bool ValidationState_t::IsAccelerationStructureType(uint32_t id) const {
|
||||
}
|
||||
|
||||
bool ValidationState_t::IsCooperativeMatrixType(uint32_t id) const {
|
||||
const Instruction* inst = FindDef(id);
|
||||
return inst && (inst->opcode() == spv::Op::OpTypeCooperativeMatrixNV ||
|
||||
inst->opcode() == spv::Op::OpTypeCooperativeMatrixKHR);
|
||||
}
|
||||
|
||||
bool ValidationState_t::IsCooperativeMatrixNVType(uint32_t id) const {
|
||||
const Instruction* inst = FindDef(id);
|
||||
return inst && inst->opcode() == spv::Op::OpTypeCooperativeMatrixNV;
|
||||
}
|
||||
|
||||
bool ValidationState_t::IsCooperativeMatrixKHRType(uint32_t id) const {
|
||||
const Instruction* inst = FindDef(id);
|
||||
return inst && inst->opcode() == spv::Op::OpTypeCooperativeMatrixKHR;
|
||||
}
|
||||
|
||||
bool ValidationState_t::IsCooperativeMatrixAType(uint32_t id) const {
|
||||
if (!IsCooperativeMatrixKHRType(id)) return false;
|
||||
const Instruction* inst = FindDef(id);
|
||||
uint64_t matrixUse = 0;
|
||||
if (GetConstantValUint64(inst->word(6), &matrixUse)) {
|
||||
return matrixUse ==
|
||||
static_cast<uint64_t>(spv::CooperativeMatrixUse::MatrixAKHR);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ValidationState_t::IsCooperativeMatrixBType(uint32_t id) const {
|
||||
if (!IsCooperativeMatrixKHRType(id)) return false;
|
||||
const Instruction* inst = FindDef(id);
|
||||
uint64_t matrixUse = 0;
|
||||
if (GetConstantValUint64(inst->word(6), &matrixUse)) {
|
||||
return matrixUse ==
|
||||
static_cast<uint64_t>(spv::CooperativeMatrixUse::MatrixBKHR);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool ValidationState_t::IsCooperativeMatrixAccType(uint32_t id) const {
|
||||
if (!IsCooperativeMatrixKHRType(id)) return false;
|
||||
const Instruction* inst = FindDef(id);
|
||||
uint64_t matrixUse = 0;
|
||||
if (GetConstantValUint64(inst->word(6), &matrixUse)) {
|
||||
return matrixUse == static_cast<uint64_t>(
|
||||
spv::CooperativeMatrixUse::MatrixAccumulatorKHR);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ValidationState_t::IsFloatCooperativeMatrixType(uint32_t id) const {
|
||||
if (!IsCooperativeMatrixType(id)) return false;
|
||||
if (!IsCooperativeMatrixNVType(id) && !IsCooperativeMatrixKHRType(id))
|
||||
return false;
|
||||
return IsFloatScalarType(FindDef(id)->word(2));
|
||||
}
|
||||
|
||||
bool ValidationState_t::IsIntCooperativeMatrixType(uint32_t id) const {
|
||||
if (!IsCooperativeMatrixType(id)) return false;
|
||||
if (!IsCooperativeMatrixNVType(id) && !IsCooperativeMatrixKHRType(id))
|
||||
return false;
|
||||
return IsIntScalarType(FindDef(id)->word(2));
|
||||
}
|
||||
|
||||
bool ValidationState_t::IsUnsignedIntCooperativeMatrixType(uint32_t id) const {
|
||||
if (!IsCooperativeMatrixType(id)) return false;
|
||||
if (!IsCooperativeMatrixNVType(id) && !IsCooperativeMatrixKHRType(id))
|
||||
return false;
|
||||
return IsUnsignedIntScalarType(FindDef(id)->word(2));
|
||||
}
|
||||
|
||||
@@ -1173,8 +1221,7 @@ spv_result_t ValidationState_t::CooperativeMatrixShapesMatch(
|
||||
const auto m1_type = FindDef(m1);
|
||||
const auto m2_type = FindDef(m2);
|
||||
|
||||
if (m1_type->opcode() != spv::Op::OpTypeCooperativeMatrixNV ||
|
||||
m2_type->opcode() != spv::Op::OpTypeCooperativeMatrixNV) {
|
||||
if (m1_type->opcode() != m2_type->opcode()) {
|
||||
return diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< "Expected cooperative matrix types";
|
||||
}
|
||||
@@ -1224,6 +1271,21 @@ spv_result_t ValidationState_t::CooperativeMatrixShapesMatch(
|
||||
<< "identical";
|
||||
}
|
||||
|
||||
if (m1_type->opcode() == spv::Op::OpTypeCooperativeMatrixKHR) {
|
||||
uint32_t m1_use_id = m1_type->GetOperandAs<uint32_t>(5);
|
||||
uint32_t m2_use_id = m2_type->GetOperandAs<uint32_t>(5);
|
||||
std::tie(m1_is_int32, m1_is_const_int32, m1_value) =
|
||||
EvalInt32IfConst(m1_use_id);
|
||||
std::tie(m2_is_int32, m2_is_const_int32, m2_value) =
|
||||
EvalInt32IfConst(m2_use_id);
|
||||
|
||||
if (m1_is_const_int32 && m2_is_const_int32 && m1_value != m2_value) {
|
||||
return diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< "Expected Use of Matrix type and Result Type to be "
|
||||
<< "identical";
|
||||
}
|
||||
}
|
||||
|
||||
return SPV_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1489,6 +1551,7 @@ bool ValidationState_t::ContainsType(
|
||||
case spv::Op::OpTypeImage:
|
||||
case spv::Op::OpTypeSampledImage:
|
||||
case spv::Op::OpTypeCooperativeMatrixNV:
|
||||
case spv::Op::OpTypeCooperativeMatrixKHR:
|
||||
return ContainsType(inst->GetOperandAs<uint32_t>(1u), f,
|
||||
traverse_all_types);
|
||||
case spv::Op::OpTypePointer:
|
||||
@@ -2048,8 +2111,6 @@ std::string ValidationState_t::VkErrorID(uint32_t id,
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-OpImageTexelPointer-04658);
|
||||
case 4659:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-OpImageQuerySizeLod-04659);
|
||||
case 4662:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-Offset-04662);
|
||||
case 4663:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-Offset-04663);
|
||||
case 4664:
|
||||
|
||||
Reference in New Issue
Block a user