Validates anything OpImage*Dref* instruction
| 1651 | |
| 1652 | // Validates anything OpImage*Dref* instruction |
| 1653 | spv_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 | |
| 1673 | spv_result_t ValidateImageDrefLod(ValidationState_t& _, |
| 1674 | const Instruction* inst) { |
no test coverage detected