@@ -311,17 +311,84 @@ spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) {
311311 }
312312 }
313313 }
314+ if (!ok && _.HasCapability (spv::Capability::TileShadingQCOM)) {
315+ ok =
316+ execution_modes &&
317+ execution_modes->count (spv::ExecutionMode::TileShadingRateQCOM);
318+ }
314319 if (!ok) {
315320 return _.diag (SPV_ERROR_INVALID_DATA, inst)
316- << _.VkErrorID (6426 )
321+ << (_.HasCapability (spv::Capability::TileShadingQCOM)
322+ ? _.VkErrorID (10685 )
323+ : _.VkErrorID (6426 ))
317324 << " 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." ;
325+ " entry points require either the "
326+ << (_.HasCapability (spv::Capability::TileShadingQCOM)
327+ ? " TileShadingRateQCOM, "
328+ : " " )
329+ << " LocalSize or LocalSizeId execution mode or an object "
330+ " decorated with WorkgroupSize must be specified." ;
331+ }
332+ }
333+
334+ if (_.HasCapability (spv::Capability::TileShadingQCOM)) {
335+ if (execution_modes) {
336+ if (execution_modes->count (
337+ spv::ExecutionMode::TileShadingRateQCOM) &&
338+ (execution_modes->count (spv::ExecutionMode::LocalSize) ||
339+ execution_modes->count (spv::ExecutionMode::LocalSizeId))) {
340+ return _.diag (SPV_ERROR_INVALID_DATA, inst)
341+ << " If the TileShadingRateQCOM execution mode is used, "
342+ << " LocalSize and LocalSizeId must not be specified." ;
343+ }
344+ if (execution_modes->count (
345+ spv::ExecutionMode::NonCoherentTileAttachmentReadQCOM)) {
346+ return _.diag (SPV_ERROR_INVALID_DATA, inst)
347+ << " The NonCoherentTileAttachmentQCOM execution mode must "
348+ " not be used in any stage other than fragment." ;
349+ }
350+ }
351+ } else {
352+ if (execution_modes &&
353+ execution_modes->count (spv::ExecutionMode::TileShadingRateQCOM)) {
354+ return _.diag (SPV_ERROR_INVALID_DATA, inst)
355+ << " If the TileShadingRateQCOM execution mode is used, the "
356+ " TileShadingQCOM capability must be enabled." ;
321357 }
322358 }
323359 break ;
324360 default :
361+ if (execution_modes &&
362+ execution_modes->count (spv::ExecutionMode::TileShadingRateQCOM)) {
363+ return _.diag (SPV_ERROR_INVALID_DATA, inst)
364+ << " The TileShadingRateQCOM execution mode must not be used "
365+ " in any stage other than compute." ;
366+ }
367+ if (execution_model != spv::ExecutionModel::Fragment) {
368+ if (execution_modes &&
369+ execution_modes->count (
370+ spv::ExecutionMode::NonCoherentTileAttachmentReadQCOM)) {
371+ return _.diag (SPV_ERROR_INVALID_DATA, inst)
372+ << " The NonCoherentTileAttachmentQCOM execution mode must "
373+ " not be used in any stage other than fragment." ;
374+ }
375+ if (_.HasCapability (spv::Capability::TileShadingQCOM)) {
376+ return _.diag (SPV_ERROR_INVALID_CAPABILITY, inst)
377+ << " The TileShadingQCOM capability must not be enabled in "
378+ " any stage other than compute or fragment." ;
379+ }
380+ } else {
381+ if (execution_modes &&
382+ execution_modes->count (
383+ spv::ExecutionMode::NonCoherentTileAttachmentReadQCOM)) {
384+ if (!_.HasCapability (spv::Capability::TileShadingQCOM)) {
385+ return _.diag (SPV_ERROR_INVALID_DATA, inst)
386+ << " If the NonCoherentTileAttachmentReadQCOM execution "
387+ " mode is used, the TileShadingQCOM capability must be "
388+ " enabled." ;
389+ }
390+ }
391+ }
325392 break ;
326393 }
327394 }
@@ -758,6 +825,14 @@ spv_result_t ValidateExecutionMode(ValidationState_t& _,
758825 << " In the Vulkan environment, the PixelCenterInteger execution "
759826 " mode must not be used." ;
760827 }
828+ if (mode == spv::ExecutionMode::TileShadingRateQCOM) {
829+ const auto rateX = inst->GetOperandAs <int >(2 );
830+ const auto rateY = inst->GetOperandAs <int >(3 );
831+ if ((rateX & (rateX - 1 )) != 0 || (rateY & (rateY - 1 )) != 0 )
832+ return _.diag (SPV_ERROR_INVALID_DATA, inst)
833+ << " The TileShadingRateQCOM execution mode's x and y values "
834+ " must be powers of 2." ;
835+ }
761836 }
762837
763838 return SPV_SUCCESS;
0 commit comments