@@ -286,11 +286,15 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) {
286286
287287 // TODO - Need to add TileShadingRateQCOM support
288288 if (spvIsVulkanEnv (_.context ()->target_env )) {
289+ bool ok = false ;
290+ bool foundLocalSizeId = false ;
289291 switch (execution_model) {
290292 case spv::ExecutionModel::GLCompute:
291- if (!execution_modes ||
292- !execution_modes->count (spv::ExecutionMode::LocalSize)) {
293- bool ok = false ;
293+ if (_.HasCapability (spv::Capability::TileShadingQCOM)) {
294+ ok = (execution_modes && execution_modes->count (spv::ExecutionMode::TileShadingRateQCOM));
295+ }
296+ if (!ok && (!execution_modes ||
297+ !execution_modes->count (spv::ExecutionMode::LocalSize))) {
294298 for (auto & i : _.ordered_instructions ()) {
295299 if (i.opcode () == spv::Op::OpDecorate) {
296300 if (i.operands ().size () > 2 ) {
@@ -307,6 +311,7 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) {
307311 const auto mode = i.GetOperandAs <spv::ExecutionMode>(1 );
308312 if (mode == spv::ExecutionMode::LocalSizeId) {
309313 ok = true ;
314+ foundLocalSizeId = true ;
310315 break ;
311316 }
312317 }
@@ -315,9 +320,21 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) {
315320 return _.diag (SPV_ERROR_INVALID_DATA, inst)
316321 << _.VkErrorID (10685 )
317322 << " In the Vulkan environment, GLCompute execution model "
318- " entry points require either the LocalSize or "
319- " LocalSizeId execution mode or an object decorated with "
320- " WorkgroupSize must be specified." ;
323+ " entry points require either the "
324+ << (_.HasCapability (spv::Capability::TileShadingQCOM) ? " TileShadingRateQCOM, " : " " )
325+ << " LocalSize or LocalSizeId execution mode or an object "
326+ " decorated with WorkgroupSize must be specified." ;
327+ }
328+ }
329+
330+ if (_.HasCapability (spv::Capability::TileShadingQCOM)) {
331+ if (execution_modes) {
332+ if (execution_modes->count (spv::ExecutionMode::TileShadingRateQCOM) &&
333+ (execution_modes->count (spv::ExecutionMode::LocalSize) || foundLocalSizeId)) {
334+ return _.diag (SPV_ERROR_INVALID_DATA, inst)
335+ << " If the TileShadingRateQCOM Execution Mode is used, "
336+ << " LocalSize and LocalSizeId must not be specified." ;
337+ }
321338 }
322339 }
323340 break ;
0 commit comments