Skip to content

Commit 0d2b621

Browse files
authored
layers: Add VK_QCOM_tile_shading cmd VUIDs and tests
* layers: Add VK_QCOM_tile_shading cmd VUIDs and tests
1 parent e7e36b2 commit 0d2b621

11 files changed

Lines changed: 1429 additions & 13 deletions

layers/core_checks/cc_cmd_buffer.cpp

Lines changed: 188 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,10 @@ bool CoreChecks::ValidateBeginCommandBufferInheritanceInfo(const vvl::CommandBuf
365365
}
366366
}
367367

368+
if (enabled_features.tileShading) {
369+
skip |= ValidateBeginCommandBufferRenderPassTileShadingCreateInfo(cb_state, info, begin_flags, inheritance_loc);
370+
}
371+
368372
return skip;
369373
}
370374

@@ -469,6 +473,76 @@ bool CoreChecks::ValidateBeginCommandBufferRenderingInheritanceInfo(const vvl::C
469473
return skip;
470474
}
471475

476+
bool CoreChecks::ValidateBeginCommandBufferRenderPassTileShadingCreateInfo(const vvl::CommandBuffer& cb_state,
477+
const VkCommandBufferInheritanceInfo& info,
478+
const VkCommandBufferUsageFlags begin_flags,
479+
const Location& inheritance_loc) const {
480+
bool skip = false;
481+
const bool has_rp_continue_bit = (begin_flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) != 0;
482+
const auto* rp_tile_shading_ci = vku::FindStructInPNextChain<VkRenderPassTileShadingCreateInfoQCOM>(info.pNext);
483+
const bool has_rp_enable_bit = rp_tile_shading_ci ?
484+
(rp_tile_shading_ci->flags & VK_TILE_SHADING_RENDER_PASS_ENABLE_BIT_QCOM) != 0 : false;
485+
const auto rp_state = Get<vvl::RenderPass>(info.renderPass);
486+
const bool rp_enabled_tile_shading = rp_state ? rp_state->has_tile_shading_enabled : false;
487+
488+
if (has_rp_continue_bit && rp_enabled_tile_shading && !has_rp_enable_bit) {
489+
std::stringstream conditional_ss{};
490+
if (rp_tile_shading_ci) {
491+
conditional_ss << "(" << string_VkTileShadingRenderPassFlagsQCOM(rp_tile_shading_ci->flags)
492+
<< ")" << " doesn't contain VK_TILE_SHADING_RENDER_PASS_ENABLE_BIT_QCOM bit, ";
493+
}
494+
else {
495+
conditional_ss << "doesn't include VkRenderPassTileShadingCreateInfoQCOM instance, ";
496+
}
497+
conditional_ss << "but VkCommandBufferBeginInfo::flags (" << string_VkCommandBufferUsageFlags(begin_flags)
498+
<< ") contains VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT bit and "
499+
<< "VkCommandBufferInheritanceInfo::renderPass has been created with tile shading enabled.";
500+
501+
const LogObjectList objlist(cb_state.Handle(), rp_state->Handle());
502+
const Location error_loc = rp_tile_shading_ci ?
503+
inheritance_loc.pNext(Struct::VkRenderPassTileShadingCreateInfoQCOM, Field::flags) : inheritance_loc.dot(Field::pNext);
504+
skip |= LogError("VUID-VkCommandBufferBeginInfo-flags-10617", objlist, error_loc,
505+
"%s", conditional_ss.str().c_str());
506+
}
507+
508+
if (!has_rp_continue_bit && !rp_enabled_tile_shading && has_rp_enable_bit) {
509+
std::stringstream conditional_ss{};
510+
conditional_ss << "but VkCommandBufferBeginInfo::flags is ( " << string_VkCommandBufferUsageFlags(begin_flags) << ")";
511+
if (!info.renderPass) {
512+
conditional_ss << " and VkCommandBufferInheritanceInfo::renderPass is VK_NULL_HANDLE.";
513+
}
514+
else {
515+
conditional_ss << " and VkCommandBufferInheritanceInfo::renderPass hasn't been created with tile shading enabled. "
516+
"(Can be enabled by using VkRenderPassTileShadingCreateInfoQCOM)";
517+
}
518+
519+
skip |= LogError("VUID-VkCommandBufferBeginInfo-flags-10618", cb_state.Handle(),
520+
inheritance_loc.pNext(Struct::VkRenderPassTileShadingCreateInfoQCOM, Field::flags),
521+
"(%s) contains VK_TILE_SHADING_RENDER_PASS_ENABLE_BIT_QCOM bit, %s",
522+
string_VkTileShadingRenderPassFlagsQCOM(rp_tile_shading_ci->flags).c_str(),
523+
conditional_ss.str().c_str());
524+
}
525+
526+
if (has_rp_enable_bit && rp_enabled_tile_shading) {
527+
const auto* rp_tile_shading_ci_of_rp =
528+
vku::FindStructInPNextChain<VkRenderPassTileShadingCreateInfoQCOM>(rp_state->create_info.pNext);
529+
if (rp_tile_shading_ci->tileApronSize.width != rp_tile_shading_ci_of_rp->tileApronSize.width ||
530+
rp_tile_shading_ci->tileApronSize.height != rp_tile_shading_ci_of_rp->tileApronSize.height) {
531+
const LogObjectList objlist(cb_state.Handle(), rp_state->Handle());
532+
skip |= LogError("VUID-VkCommandBufferBeginInfo-flags-10619", objlist,
533+
inheritance_loc.pNext(Struct::VkRenderPassTileShadingCreateInfoQCOM, Field::flags),
534+
"(%s) contains VK_TILE_SHADING_RENDER_PASS_ENABLE_BIT_QCOM bit, but "
535+
"tileApronSize (%s) aren't equal to that "
536+
"tileApronSize (%s) used to create VkCommandBufferInheritanceInfo::renderPass.",
537+
string_VkTileShadingRenderPassFlagsQCOM(rp_tile_shading_ci->flags).c_str(),
538+
string_VkExtent2D(rp_tile_shading_ci->tileApronSize).c_str(),
539+
string_VkExtent2D(rp_tile_shading_ci_of_rp->tileApronSize).c_str());
540+
}
541+
}
542+
543+
return skip;
544+
}
545+
472546
bool CoreChecks::PreCallValidateEndCommandBuffer(VkCommandBuffer commandBuffer, const ErrorObject& error_obj) const {
473547
bool skip = false;
474548
auto cb_state_ptr = GetRead<vvl::CommandBuffer>(commandBuffer);
@@ -1318,6 +1392,18 @@ bool CoreChecks::PreCallValidateCmdExecuteCommands(VkCommandBuffer commandBuffer
13181392
"the vkBeginCommandBuffer() was called.",
13191393
FormatHandle(secondary_cb).c_str());
13201394
}
1395+
if (secondary_cb_state.has_inheritance) {
1396+
const auto* rp_tile_shading_ci =
1397+
vku::FindStructInPNextChain<VkRenderPassTileShadingCreateInfoQCOM>(secondary_cb_state.inheritance_info.pNext);
1398+
if (rp_tile_shading_ci &&
1399+
(rp_tile_shading_ci->tileApronSize.width != 0 || rp_tile_shading_ci->tileApronSize.height != 0)) {
1400+
const LogObjectList objlist(commandBuffer, secondary_cb);
1401+
skip |= LogError("VUID-vkCmdExecuteCommands-tileApronSize-10625", objlist, secondary_cb_loc,
1402+
"has been recorded with VkRenderPassTileShadingCreateInfoQCOM::tileApronSize "
1403+
"(%s) for non-render-pass scenario.",
1404+
string_VkExtent2D(rp_tile_shading_ci->tileApronSize).c_str());
1405+
}
1406+
}
13211407
} else if (rp_state) {
13221408
const vvl::RenderPass* secondary_rp_state = secondary_cb_state.active_render_pass.get();
13231409
if (secondary_rp_state) {
@@ -1762,6 +1848,78 @@ bool CoreChecks::ValidateCmdExecuteCommandsRenderPassInheritance(const vvl::Comm
17621848
}
17631849
}
17641850

1851+
const auto* rp_tile_shading_ci = vku::FindStructInPNextChain<VkRenderPassTileShadingCreateInfoQCOM>(inheritance_info.pNext);
1852+
const bool has_rp_enable_bit = (rp_tile_shading_ci) ?
1853+
(rp_tile_shading_ci->flags & VK_TILE_SHADING_RENDER_PASS_ENABLE_BIT_QCOM) != 0 : false;
1854+
const bool has_rp_per_tile_exec_bit = (rp_tile_shading_ci) ?
1855+
(rp_tile_shading_ci->flags & VK_TILE_SHADING_RENDER_PASS_PER_TILE_EXECUTION_BIT_QCOM) != 0 : false;
1856+
if (rp_state.has_tile_shading_enabled) {
1857+
if (!has_rp_enable_bit) {
1858+
std::stringstream conditional_ss{};
1859+
if (rp_tile_shading_ci) {
1860+
conditional_ss << "has been recorded with VkRenderPassTileShadingCreateInfoQCOM::flags ("
1861+
<< string_VkTileShadingRenderPassFlagsQCOM(rp_tile_shading_ci->flags)
1862+
<< ") doesn't include VK_TILE_SHADING_RENDER_PASS_ENABLE_BIT_QCOM bit, ";
1863+
} else {
1864+
conditional_ss << "hasn't been recorded with VK_TILE_SHADING_RENDER_PASS_ENABLE_BIT_QCOM bit since "
1865+
<< "VkCommandBufferInheritanceInfo::pNext doesn't include "
1866+
<< "VkRenderPassTileShadingCreateInfoQCOM instance, ";
1867+
}
1868+
conditional_ss << "but the render pass has tile shading enabled.";
1869+
const LogObjectList objlist(cb_state.Handle(), secondary_cb_state.Handle(), rp_state.Handle());
1870+
skip |= LogError("VUID-vkCmdExecuteCommands-pCommandBuffers-10620", objlist, secondary_cb_loc,
1871+
"%s", conditional_ss.str().c_str());
1872+
}
1873+
1874+
const auto *rp_tile_shading_ci_of_rp =
1875+
vku::FindStructInPNextChain<VkRenderPassTileShadingCreateInfoQCOM>(rp_state.create_info.pNext);
1876+
if (rp_tile_shading_ci &&
1877+
(rp_tile_shading_ci_of_rp->tileApronSize.width != rp_tile_shading_ci->tileApronSize.width ||
1878+
rp_tile_shading_ci_of_rp->tileApronSize.height != rp_tile_shading_ci->tileApronSize.height)) {
1879+
const LogObjectList objlist(cb_state.Handle(), secondary_cb_state.Handle(), rp_state.Handle());
1880+
skip |= LogError("VUID-vkCmdExecuteCommands-tileApronSize-10622", objlist, secondary_cb_loc,
1881+
"has been recorded with VkRenderPassTileShadingCreateInfoQCOM::tileApronSize "
1882+
"(%s) that isn't equal to that tileApronSize (%s) used to create the render pass.",
1883+
string_VkExtent2D(rp_tile_shading_ci->tileApronSize).c_str(),
1884+
string_VkExtent2D(rp_tile_shading_ci_of_rp->tileApronSize).c_str());
1885+
}
1886+
}
1887+
1888+
if (has_rp_enable_bit && !rp_state.has_tile_shading_enabled) {
1889+
const LogObjectList objlist(cb_state.Handle(), secondary_cb_state.Handle(), rp_state.Handle());
1890+
skip |= LogError("VUID-vkCmdExecuteCommands-pCommandBuffers-10623", objlist, secondary_cb_loc,
1891+
"has been recorded with VkRenderPassTileShadingCreateInfoQCOM::flags (%s) "
1892+
"that includes VK_TILE_SHADING_RENDER_PASS_ENABLE_BIT_QCOM bit, but "
1893+
"the render pass doesn't have tile shading enabled. "
1894+
"(Can be enabled by using VkRenderPassTileShadingCreateInfoQCOM)",
1895+
string_VkTileShadingRenderPassFlagsQCOM(rp_tile_shading_ci->flags).c_str());
1896+
}
1897+
1898+
if (cb_state.per_tile_execution_model_enabled && !has_rp_per_tile_exec_bit) {
1899+
std::stringstream conditional_ss{};
1900+
if (rp_tile_shading_ci) {
1901+
conditional_ss << "has been recorded with VkRenderPassTileShadingCreateInfoQCOM::flags ("
1902+
<< string_VkTileShadingRenderPassFlagsQCOM(rp_tile_shading_ci->flags)
1903+
<< ") doesn't include VK_TILE_SHADING_RENDER_PASS_PER_TILE_EXECUTION_BIT_QCOM bit, ";
1904+
} else {
1905+
conditional_ss << "hasn't been recorded with VK_TILE_SHADING_RENDER_PASS_PER_TILE_EXECUTION_BIT_QCOM "
1906+
<< "bit since VkCommandBufferInheritanceInfo::pNext doesn't include "
1907+
<< "VkRenderPassTileShadingCreateInfoQCOM instance, ";
1908+
}
1909+
conditional_ss << "but the per-tile execution model is enabled in the command buffer.";
1910+
const LogObjectList objlist(cb_state.Handle(), secondary_cb_state.Handle(), rp_state.Handle());
1911+
skip |= LogError("VUID-vkCmdExecuteCommands-pCommandBuffers-10621", objlist, secondary_cb_loc,
1912+
"%s", conditional_ss.str().c_str());
1913+
} else if (!cb_state.per_tile_execution_model_enabled && has_rp_per_tile_exec_bit) {
1914+
const LogObjectList objlist(cb_state.Handle(), secondary_cb_state.Handle(), rp_state.Handle());
1915+
skip |= LogError("VUID-vkCmdExecuteCommands-pCommandBuffers-10624", objlist, secondary_cb_loc,
1916+
"has been recorded with VkRenderPassTileShadingCreateInfoQCOM::flags (%s) "
1917+
"includes VK_TILE_SHADING_RENDER_PASS_PER_TILE_EXECUTION_BIT_QCOM bit, but "
1918+
"the per-tile execution model isn't enabled in the command buffer. "
1919+
"(Can be enabled by calling vkCmdBeginPerTileExecutionQCOM)",
1920+
string_VkTileShadingRenderPassFlagsQCOM(rp_tile_shading_ci->flags).c_str());
1921+
}
1922+
17651923
return skip;
17661924
}
17671925

@@ -2113,12 +2271,28 @@ bool CoreChecks::PreCallValidateCmdEndPerTileExecutionQCOM(VkCommandBuffer comma
21132271
bool CoreChecks::PreCallValidateCmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo,
21142272
const ErrorObject& error_obj) const {
21152273
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
2116-
return ValidateCmd(*cb_state, error_obj.location);
2274+
bool skip = ValidateCmd(*cb_state, error_obj.location);
2275+
2276+
if (cb_state->per_tile_execution_model_enabled) {
2277+
skip |= LogError("VUID-vkCmdDebugMarkerBeginEXT-None-10614", commandBuffer, error_obj.location,
2278+
"the per-tile execution model has been enabled in this command buffer. "
2279+
"(Don't call vkCmdBeginPerTileExecutionQCOM before vkCmdDebugMarkerBeginEXT)");
2280+
}
2281+
2282+
return skip;
21172283
}
21182284

21192285
bool CoreChecks::PreCallValidateCmdDebugMarkerEndEXT(VkCommandBuffer commandBuffer, const ErrorObject& error_obj) const {
21202286
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
2121-
return ValidateCmd(*cb_state, error_obj.location);
2287+
bool skip = ValidateCmd(*cb_state, error_obj.location);
2288+
2289+
if (cb_state->per_tile_execution_model_enabled) {
2290+
skip |= LogError("VUID-vkCmdDebugMarkerEndEXT-None-10615", commandBuffer, error_obj.location,
2291+
"the per-tile execution model has been enabled in this command buffer. "
2292+
"(Don't call vkCmdBeginPerTileExecutionQCOM before vkCmdDebugMarkerEndEXT)");
2293+
}
2294+
2295+
return skip;
21222296
}
21232297

21242298
bool CoreChecks::PreCallValidateCmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer,
@@ -2358,6 +2532,12 @@ bool CoreChecks::PreCallValidateCmdBeginTransformFeedbackEXT(VkCommandBuffer com
23582532
}
23592533
}
23602534

2535+
if (cb_state->per_tile_execution_model_enabled) {
2536+
skip |= LogError("VUID-vkCmdBeginTransformFeedbackEXT-None-10656", commandBuffer, error_obj.location,
2537+
"the per-tile execution model has been enabled in this command buffer. "
2538+
"(Don't call vkCmdBeginPerTileExecutionQCOM before vkCmdBeginTransformFeedbackEXT)");
2539+
}
2540+
23612541
return skip;
23622542
}
23632543

@@ -2438,6 +2618,12 @@ bool CoreChecks::PreCallValidateCmdEndTransformFeedbackEXT(VkCommandBuffer comma
24382618
}
24392619
}
24402620

2621+
if (cb_state->per_tile_execution_model_enabled) {
2622+
skip |= LogError("VUID-vkCmdEndTransformFeedbackEXT-None-10657", commandBuffer, error_obj.location,
2623+
"the per-tile execution model has been enabled in this command buffer. "
2624+
"(Don't call vkCmdBeginPerTileExecutionQCOM before vkCmdEndTransformFeedbackEXT)");
2625+
}
2626+
24412627
return skip;
24422628
}
24432629

layers/core_checks/cc_image.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,13 @@ bool CoreChecks::PreCallValidateCmdClearAttachments(VkCommandBuffer commandBuffe
13431343
}
13441344
}
13451345
}
1346+
1347+
if (cb_state.per_tile_execution_model_enabled) {
1348+
skip |= LogError("VUID-vkCmdClearAttachments-None-10616", commandBuffer, error_obj.location,
1349+
"the per-tile execution model has been enabled in this command buffer. "
1350+
"(Don't call vkCmdBeginPerTileExecutionQCOM before vkCmdClearAttachments)");
1351+
}
1352+
13461353
return skip;
13471354
}
13481355

layers/core_checks/cc_query.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,14 @@ bool CoreChecks::PreCallValidateCmdBeginQuery(VkCommandBuffer commandBuffer, VkQ
766766
QueryObject query_obj = {queryPool, slot};
767767
skip |= ValidateBeginQuery(*cb_state, query_obj, flags, 0, error_obj.location);
768768
skip |= ValidateCmd(*cb_state, error_obj.location);
769+
770+
if (cb_state->per_tile_execution_model_enabled) {
771+
const LogObjectList objlist(commandBuffer, queryPool);
772+
skip |= LogError("VUID-vkCmdBeginQuery-None-10681", objlist, error_obj.location,
773+
"the per-tile execution model has been enabled in this command buffer. "
774+
"(Don't call vkCmdBeginPerTileExecutionQCOM before vkCmdBeginQuery)");
775+
}
776+
769777
return skip;
770778
}
771779

@@ -962,6 +970,14 @@ bool CoreChecks::PreCallValidateCmdEndQuery(VkCommandBuffer commandBuffer, VkQue
962970
skip |= ValidateCmdEndQuery(*cb_state, queryPool, slot, 0, error_obj.location);
963971
skip |= ValidateCmd(*cb_state, error_obj.location);
964972
}
973+
974+
if (cb_state->per_tile_execution_model_enabled) {
975+
const LogObjectList objlist(commandBuffer, queryPool);
976+
skip |= LogError("VUID-vkCmdEndQuery-None-10682", objlist, error_obj.location,
977+
"the per-tile execution model has been enabled in this command buffer. "
978+
"(Don't call vkCmdBeginPerTileExecutionQCOM before vkCmdEndQuery)");
979+
}
980+
965981
return skip;
966982
}
967983

@@ -1293,6 +1309,14 @@ bool CoreChecks::PreCallValidateCmdWriteTimestamp(VkCommandBuffer commandBuffer,
12931309

12941310
const Location stage_loc = error_obj.location.dot(Field::pipelineStage);
12951311
skip |= ValidatePipelineStage(LogObjectList(commandBuffer), stage_loc, cb_state->GetQueueFlags(), pipelineStage);
1312+
1313+
if (cb_state->per_tile_execution_model_enabled) {
1314+
const LogObjectList objlist(commandBuffer, queryPool);
1315+
skip |= LogError("VUID-vkCmdWriteTimestamp-None-10640", objlist, error_obj.location,
1316+
"the per-tile execution model has been enabled in this command buffer. "
1317+
"(Don't call vkCmdBeginPerTileExecutionQCOM before vkCmdWriteTimestamp)");
1318+
}
1319+
12961320
return skip;
12971321
}
12981322

@@ -1314,6 +1338,14 @@ bool CoreChecks::PreCallValidateCmdWriteTimestamp2(VkCommandBuffer commandBuffer
13141338
"(%s) must only set a single pipeline stage.", string_VkPipelineStageFlags2(stage).c_str());
13151339
}
13161340
skip |= ValidatePipelineStage(LogObjectList(commandBuffer), stage_loc, cb_state->GetQueueFlags(), stage);
1341+
1342+
if (cb_state->per_tile_execution_model_enabled) {
1343+
const LogObjectList objlist(commandBuffer, queryPool);
1344+
skip |= LogError("VUID-vkCmdWriteTimestamp2-None-10639", objlist, error_obj.location,
1345+
"the per-tile execution model has been enabled in this command buffer. "
1346+
"(Don't call vkCmdBeginPerTileExecutionQCOM before vkCmdWriteTimestamp2)");
1347+
}
1348+
13171349
return skip;
13181350
}
13191351

layers/core_checks/cc_synchronization.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,13 @@ bool CoreChecks::PreCallValidateCmdWaitEvents(VkCommandBuffer commandBuffer, uin
14491449
skip |= LogError("VUID-vkCmdWaitEvents-srcStageMask-07308", objlist, error_obj.location.dot(Field::srcStageMask), "is %s.",
14501450
sync_utils::StringPipelineStageFlags(srcStageMask).c_str());
14511451
}
1452+
1453+
if (cb_state->per_tile_execution_model_enabled) {
1454+
skip |= LogError("VUID-vkCmdWaitEvents-None-10655", objlist, error_obj.location,
1455+
"the per-tile execution model has been enabled in this command buffer. "
1456+
"(Don't call vkCmdBeginPerTileExecutionQCOM before vkCmdWaitEvents)");
1457+
}
1458+
14521459
return skip;
14531460
}
14541461

@@ -1491,6 +1498,13 @@ bool CoreChecks::PreCallValidateCmdWaitEvents2(VkCommandBuffer commandBuffer, ui
14911498
skip |= ValidateDependencyInfo(objlist, dep_info_loc, *cb_state, pDependencyInfos[i]);
14921499
}
14931500
skip |= ValidateCmd(*cb_state, error_obj.location);
1501+
1502+
if (cb_state->per_tile_execution_model_enabled) {
1503+
skip |= LogError("VUID-vkCmdWaitEvents2-None-10654", commandBuffer, error_obj.location,
1504+
"the per-tile execution model has been enabled in this command buffer. "
1505+
"(Don't call vkCmdBeginPerTileExecutionQCOM before vkCmdWaitEvents2)");
1506+
}
1507+
14941508
return skip;
14951509
}
14961510

0 commit comments

Comments
 (0)