MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / ValidateImageDref

Function ValidateImageDref

source/val/validate_image.cpp:1653–1671  ·  view source on GitHub ↗

Validates anything OpImage*Dref* instruction

Source from the content-addressed store, hash-verified

1651
1652// Validates anything OpImage*Dref* instruction
1653spv_result_t ValidateImageDref(ValidationState_t& _, const Instruction* inst,
1654 const ImageTypeInfo& info) {
1655 const uint32_t dref_type = _.GetOperandTypeId(inst, 4);
1656 if (!_.IsFloatScalarType(dref_type, 32)) {
1657 return _.diag(SPV_ERROR_INVALID_DATA, inst)
1658 << "Expected Dref to be of 32-bit float type";
1659 }
1660
1661 if (spvIsVulkanEnv(_.context()->target_env)) {
1662 if (info.dim == spv::Dim::Dim3D) {
1663 return _.diag(SPV_ERROR_INVALID_DATA, inst)
1664 << _.VkErrorID(4777)
1665 << "In Vulkan, OpImage*Dref* instructions must not use images "
1666 "with a 3D Dim";
1667 }
1668 }
1669
1670 return SPV_SUCCESS;
1671}
1672
1673spv_result_t ValidateImageDrefLod(ValidationState_t& _,
1674 const Instruction* inst) {

Callers 2

ValidateImageDrefLodFunction · 0.85
ValidateImageGatherFunction · 0.85

Calls 6

spvIsVulkanEnvFunction · 0.85
GetOperandTypeIdMethod · 0.80
IsFloatScalarTypeMethod · 0.80
diagMethod · 0.80
VkErrorIDMethod · 0.80
contextMethod · 0.45

Tested by

no test coverage detected