diff options
Diffstat (limited to 'source/val/validate.cpp')
-rw-r--r-- | source/val/validate.cpp | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/source/val/validate.cpp b/source/val/validate.cpp index 52cb0d8b..efb9225e 100644 --- a/source/val/validate.cpp +++ b/source/val/validate.cpp @@ -66,15 +66,15 @@ void RegisterExtension(ValidationState_t& _, // Parses the beginning of the module searching for OpExtension instructions. // Registers extensions if recognized. Returns SPV_REQUESTED_TERMINATION -// once an instruction which is not spv::Op::OpCapability and -// spv::Op::OpExtension is encountered. According to the SPIR-V spec extensions -// are declared after capabilities and before everything else. +// once an instruction which is not SpvOpCapability and SpvOpExtension is +// encountered. According to the SPIR-V spec extensions are declared after +// capabilities and before everything else. spv_result_t ProcessExtensions(void* user_data, const spv_parsed_instruction_t* inst) { - const spv::Op opcode = static_cast<spv::Op>(inst->opcode); - if (opcode == spv::Op::OpCapability) return SPV_SUCCESS; + const SpvOp opcode = static_cast<SpvOp>(inst->opcode); + if (opcode == SpvOpCapability) return SPV_SUCCESS; - if (opcode == spv::Op::OpExtension) { + if (opcode == SpvOpExtension) { ValidationState_t& _ = *(reinterpret_cast<ValidationState_t*>(user_data)); RegisterExtension(_, inst); return SPV_SUCCESS; @@ -123,7 +123,7 @@ spv_result_t ValidateEntryPoints(ValidationState_t& _) { _.ComputeFunctionToEntryPointMapping(); _.ComputeRecursiveEntryPoints(); - if (_.entry_points().empty() && !_.HasCapability(spv::Capability::Linkage)) { + if (_.entry_points().empty() && !_.HasCapability(SpvCapabilityLinkage)) { return _.diag(SPV_ERROR_INVALID_BINARY, nullptr) << "No OpEntryPoint instruction was found. This is only allowed if " "the Linkage capability is being used."; @@ -218,9 +218,9 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( // able to, briefly, de-const the instruction. Instruction* inst = const_cast<Instruction*>(&instruction); - if (inst->opcode() == spv::Op::OpEntryPoint) { + if (inst->opcode() == SpvOpEntryPoint) { const auto entry_point = inst->GetOperandAs<uint32_t>(1); - const auto execution_model = inst->GetOperandAs<spv::ExecutionModel>(0); + const auto execution_model = inst->GetOperandAs<SpvExecutionModel>(0); const std::string desc_name = inst->GetOperandAs<std::string>(2); ValidationState_t::EntryPointDescription desc; @@ -236,7 +236,7 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( if (visited_entry_points.size() > 0) { for (const Instruction* check_inst : visited_entry_points) { const auto check_execution_model = - check_inst->GetOperandAs<spv::ExecutionModel>(0); + check_inst->GetOperandAs<SpvExecutionModel>(0); const std::string check_name = check_inst->GetOperandAs<std::string>(2); @@ -250,12 +250,12 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( } visited_entry_points.push_back(inst); - has_mask_task_nv |= (execution_model == spv::ExecutionModel::TaskNV || - execution_model == spv::ExecutionModel::MeshNV); - has_mask_task_ext |= (execution_model == spv::ExecutionModel::TaskEXT || - execution_model == spv::ExecutionModel::MeshEXT); + has_mask_task_nv |= (execution_model == SpvExecutionModelTaskNV || + execution_model == SpvExecutionModelMeshNV); + has_mask_task_ext |= (execution_model == SpvExecutionModelTaskEXT || + execution_model == SpvExecutionModelMeshEXT); } - if (inst->opcode() == spv::Op::OpFunctionCall) { + if (inst->opcode() == SpvOpFunctionCall) { if (!vstate->in_function_body()) { return vstate->diag(SPV_ERROR_INVALID_LAYOUT, &instruction) << "A FunctionCall must happen within a function body."; @@ -286,7 +286,7 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( { Instruction* inst = const_cast<Instruction*>(&instruction); vstate->RegisterInstruction(inst); - if (inst->opcode() == spv::Op::OpTypeForwardPointer) { + if (inst->opcode() == SpvOpTypeForwardPointer) { vstate->RegisterForwardPointer(inst->GetOperandAs<uint32_t>(0)); } } @@ -300,7 +300,7 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( return vstate->diag(SPV_ERROR_INVALID_LAYOUT, nullptr) << "Missing OpFunctionEnd at end of module."; - if (vstate->HasCapability(spv::Capability::BindlessTextureNV) && + if (vstate->HasCapability(SpvCapabilityBindlessTextureNV) && !vstate->has_samplerimage_variable_address_mode_specified()) return vstate->diag(SPV_ERROR_INVALID_LAYOUT, nullptr) << "Missing required OpSamplerImageAddressingModeNV instruction."; @@ -365,13 +365,11 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( if (auto error = LiteralsPass(*vstate, &instruction)) return error; if (auto error = RayQueryPass(*vstate, &instruction)) return error; if (auto error = RayTracingPass(*vstate, &instruction)) return error; - if (auto error = RayReorderNVPass(*vstate, &instruction)) return error; if (auto error = MeshShadingPass(*vstate, &instruction)) return error; } - // Validate the preconditions involving adjacent instructions. e.g. - // spv::Op::OpPhi must only be preceded by spv::Op::OpLabel, spv::Op::OpPhi, - // or spv::Op::OpLine. + // Validate the preconditions involving adjacent instructions. e.g. SpvOpPhi + // must only be preceded by SpvOpLabel, SpvOpPhi, or SpvOpLine. if (auto error = ValidateAdjacency(*vstate)) return error; if (auto error = ValidateEntryPoints(*vstate)) return error; |