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

Function ValidateReportIntersection

source/val/validate_ray_tracing.cpp:121–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119 return SPV_SUCCESS;
120}
121spv_result_t ValidateReportIntersection(ValidationState_t& _,
122 const Instruction* inst) {
123 _.function(inst->function()->id())
124 ->RegisterExecutionModelLimitation(
125 [](spv::ExecutionModel model, std::string* message) {
126 if (model != spv::ExecutionModel::IntersectionKHR) {
127 if (message) {
128 *message =
129 "OpReportIntersectionKHR requires IntersectionKHR "
130 "execution model";
131 }
132 return false;
133 }
134 return true;
135 });
136
137 const uint32_t result_type = inst->type_id();
138 if (!_.IsBoolScalarType(result_type)) {
139 return _.diag(SPV_ERROR_INVALID_DATA, inst)
140 << "expected Result Type to be bool scalar type";
141 }
142
143 const uint32_t hit = _.GetOperandTypeId(inst, 2);
144 if (!_.IsFloatScalarType(hit, 32)) {
145 return _.diag(SPV_ERROR_INVALID_DATA, inst)
146 << "Hit must be a 32-bit int scalar";
147 }
148
149 const uint32_t hit_kind = _.GetOperandTypeId(inst, 3);
150 if (!_.IsUnsignedIntScalarType(hit_kind) || _.GetBitWidth(hit_kind) != 32) {
151 return _.diag(SPV_ERROR_INVALID_DATA, inst)
152 << "Hit Kind must be a 32-bit unsigned int scalar";
153 }
154 return SPV_SUCCESS;
155}
156
157spv_result_t ValidateExecuteCallable(ValidationState_t& _,
158 const Instruction* inst) {

Callers 1

RayTracingPassFunction · 0.85

Calls 10

IsBoolScalarTypeMethod · 0.80
diagMethod · 0.80
GetOperandTypeIdMethod · 0.80
IsFloatScalarTypeMethod · 0.80
GetBitWidthMethod · 0.80
functionMethod · 0.45
idMethod · 0.45
type_idMethod · 0.45

Tested by

no test coverage detected