Skip to content

Commit d49e8f4

Browse files
layers: Apply Ziga Feedback
1 parent b414337 commit d49e8f4

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

layers/core_checks/cc_drawdispatch.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,7 +2141,6 @@ bool CoreChecks::ValidateDrawDepthStencilAttachments(const LastBound &last_bound
21412141

21422142
bool CoreChecks::ValidateDrawTessellation(const LastBound &last_bound_state, const vvl::DrawDispatchVuid &vuid) const {
21432143
bool skip = false;
2144-
// Already validation to ensure there is both a Control and Eval
21452144
if ((last_bound_state.GetAllActiveBoundStages() & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) == 0) {
21462145
return skip;
21472146
}
@@ -2150,7 +2149,7 @@ bool CoreChecks::ValidateDrawTessellation(const LastBound &last_bound_state, con
21502149
const spirv::ExecutionModeSet *tese_execution_mode = nullptr;
21512150

21522151
if (last_bound_state.pipeline_state) {
2153-
for (auto &stage_state : last_bound_state.pipeline_state->stage_states) {
2152+
for (const auto &stage_state : last_bound_state.pipeline_state->stage_states) {
21542153
const VkShaderStageFlagBits stage = stage_state.GetStage();
21552154
if (stage & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) {
21562155
if (stage_state.entrypoint) {
@@ -2173,12 +2172,15 @@ bool CoreChecks::ValidateDrawTessellation(const LastBound &last_bound_state, con
21732172
}
21742173
}
21752174

2176-
ASSERT_AND_RETURN_SKIP(tesc_execution_mode && tese_execution_mode);
2175+
if (!tesc_execution_mode || !tese_execution_mode) {
2176+
return skip; // Occurs if using binary shader object
2177+
}
21772178

21782179
// VUID being added in https://gitlab.khronos.org/vulkan/vulkan/-/merge_requests/7694
21792180
const uint32_t tesc_subdivision = tesc_execution_mode->GetTessellationSubdivision();
21802181
const uint32_t tese_subdivision = tese_execution_mode->GetTessellationSubdivision();
2181-
if (tesc_subdivision != 0 && tese_subdivision != 0 && tesc_subdivision != tese_subdivision) {
2182+
if (tesc_subdivision != spirv::kInvalidValue && tese_subdivision != spirv::kInvalidValue &&
2183+
tesc_subdivision != tese_subdivision) {
21822184
skip |= LogError("UNASSIGNED-vkCmdDraw-tessellation-subdivision",
21832185
last_bound_state.cb_state.GetObjectList(VK_PIPELINE_BIND_POINT_GRAPHICS), vuid.loc(),
21842186
"The subdivision specified in tessellation control shader (%s) does not match the subdivision in "
@@ -2188,7 +2190,8 @@ bool CoreChecks::ValidateDrawTessellation(const LastBound &last_bound_state, con
21882190

21892191
const uint32_t tesc_orientation = tesc_execution_mode->GetTessellationOrientation();
21902192
const uint32_t tese_orientation = tese_execution_mode->GetTessellationOrientation();
2191-
if (tesc_orientation != 0 && tese_orientation != 0 && tesc_orientation != tese_orientation) {
2193+
if (tesc_orientation != spirv::kInvalidValue && tese_orientation != spirv::kInvalidValue &&
2194+
tesc_orientation != tese_orientation) {
21922195
skip |= LogError("UNASSIGNED-vkCmdDraw-tessellation-orientation",
21932196
last_bound_state.cb_state.GetObjectList(VK_PIPELINE_BIND_POINT_GRAPHICS), vuid.loc(),
21942197
"The orientation specified in tessellation control shader (%s) does not match the orientation in "
@@ -2198,7 +2201,7 @@ bool CoreChecks::ValidateDrawTessellation(const LastBound &last_bound_state, con
21982201

21992202
const uint32_t tesc_spacing = tesc_execution_mode->GetTessellationSpacing();
22002203
const uint32_t tese_spacing = tese_execution_mode->GetTessellationSpacing();
2201-
if (tesc_spacing != 0 && tese_spacing != 0 && tesc_spacing != tese_spacing) {
2204+
if (tesc_spacing != spirv::kInvalidValue && tese_spacing != spirv::kInvalidValue && tesc_spacing != tese_spacing) {
22022205
skip |= LogError("UNASSIGNED-vkCmdDraw-tessellation-spacing",
22032206
last_bound_state.cb_state.GetObjectList(VK_PIPELINE_BIND_POINT_GRAPHICS), vuid.loc(),
22042207
"The spacing specified in tessellation control shader (%s) does not match the spacing in "

layers/core_checks/cc_shader_interface.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -705,11 +705,12 @@ bool CoreChecks::ValidatePipelineTessellationStages(const spirv::Module &tesc_mo
705705
const uint32_t tese_subdivision = tese_entrypoint.execution_mode.GetTessellationSubdivision();
706706
const uint32_t tesc_patch_size = tesc_entrypoint.execution_mode.output_vertices;
707707
const uint32_t tese_patch_size = tese_entrypoint.execution_mode.output_vertices;
708-
if (tesc_subdivision == 0 && tese_subdivision == 0) {
708+
if (tesc_subdivision == spirv::kInvalidValue && tese_subdivision == spirv::kInvalidValue) {
709709
const LogObjectList objlist(tesc_module_state.handle(), tese_module_state.handle());
710710
skip |= LogError("VUID-VkGraphicsPipelineCreateInfo-pStages-00732", objlist, create_info_loc,
711711
"Subdivision (Triangles/Quads/IsoLines) is not specified in either of tessellation stages");
712-
} else if (tesc_subdivision != 0 && tese_subdivision != 0 && tesc_subdivision != tese_subdivision) {
712+
} else if (tesc_subdivision != spirv::kInvalidValue && tese_subdivision != spirv::kInvalidValue &&
713+
tesc_subdivision != tese_subdivision) {
713714
const LogObjectList objlist(tesc_module_state.handle(), tese_module_state.handle());
714715
skip |= LogError("VUID-VkGraphicsPipelineCreateInfo-pStages-00733", objlist, create_info_loc,
715716
"Subdivision specified in tessellation control shader is %s, but subdivison type specified in "
@@ -725,7 +726,7 @@ bool CoreChecks::ValidatePipelineTessellationStages(const spirv::Module &tesc_mo
725726
const LogObjectList objlist(tesc_module_state.handle(), tese_module_state.handle());
726727
skip |= LogError("VUID-VkGraphicsPipelineCreateInfo-pStages-00735", objlist, create_info_loc,
727728
"OutputVertices (patch size) specified in tessellation control shader is %" PRIu32
728-
", but subdivison type specified in tessellation evaluation shader is %" PRIu32,
729+
", but OutputVertices specified in tessellation evaluation shader is %" PRIu32,
729730
tesc_patch_size, tese_patch_size);
730731
}
731732
return skip;

layers/core_checks/cc_shader_object.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ bool CoreChecks::ValidateCreateShadersSpirv(uint32_t createInfoCount, const VkSh
348348
const uint32_t tessellation_subdivision = execution_mode.GetTessellationSubdivision();
349349

350350
if (create_info.stage == VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) {
351-
if (tessellation_subdivision == 0) {
351+
if (tessellation_subdivision == spirv::kInvalidValue) {
352352
skip |= LogError("VUID-VkShaderCreateInfoEXT-codeType-08872", device, create_info_loc.dot(Field::stage),
353353
"is VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, but subdivision is not specified "
354354
"(Triangles/Quads/IsoLines).");
@@ -388,19 +388,21 @@ bool CoreChecks::ValidateCreateShadersSpirv(uint32_t createInfoCount, const VkSh
388388
}
389389

390390
if (tesc.is_linked && tese.is_linked) {
391-
if (tesc.subdivision != 0 && tese.subdivision != 0 && tesc.subdivision != tese.subdivision) {
391+
if (tesc.subdivision != spirv::kInvalidValue && tese.subdivision != spirv::kInvalidValue &&
392+
tesc.subdivision != tese.subdivision) {
392393
skip |= LogError("VUID-vkCreateShadersEXT-pCreateInfos-08867", device, loc,
393394
"The subdivision specified in tessellation control shader (%s) does not match the subdivision in "
394395
"tessellation evaluation shader (%s).",
395396
string_SpvExecutionMode(tesc.subdivision), string_SpvExecutionMode(tese.subdivision));
396397
}
397-
if (tesc.orientation != 0 && tese.orientation != 0 && tesc.orientation != tese.orientation) {
398+
if (tesc.orientation != spirv::kInvalidValue && tese.orientation != spirv::kInvalidValue &&
399+
tesc.orientation != tese.orientation) {
398400
skip |= LogError("VUID-vkCreateShadersEXT-pCreateInfos-08868", device, loc,
399401
"The orientation specified in tessellation control shader (%s) does not match the orientation in "
400402
"tessellation evaluation shader (%s).",
401403
string_SpvExecutionMode(tesc.orientation), string_SpvExecutionMode(tese.orientation));
402404
}
403-
if (tesc.spacing != 0 && tese.spacing != 0 && tesc.spacing != tese.spacing) {
405+
if (tesc.spacing != spirv::kInvalidValue && tese.spacing != spirv::kInvalidValue && tesc.spacing != tese.spacing) {
404406
skip |= LogError("VUID-vkCreateShadersEXT-pCreateInfos-08870", device, loc,
405407
"The spacing specified in tessellation control shader (%s) does not match the spacing in "
406408
"tessellation evaluation shader (%s).",

layers/state_tracker/shader_module.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void ExecutionModeSet::Add(const Instruction& insn) {
294294
}
295295

296296
uint32_t ExecutionModeSet::GetTessellationSubdivision() const {
297-
uint32_t tessellation_subdivision = 0;
297+
uint32_t tessellation_subdivision = kInvalidValue;
298298
if (Has(subdivision_iso_lines_bit)) {
299299
tessellation_subdivision = spv::ExecutionModeIsolines;
300300
} else if (Has(subdivision_triangle_bit)) {
@@ -306,7 +306,7 @@ uint32_t ExecutionModeSet::GetTessellationSubdivision() const {
306306
}
307307

308308
uint32_t ExecutionModeSet::GetTessellationOrientation() const {
309-
uint32_t tessellation_orientation = 0;
309+
uint32_t tessellation_orientation = kInvalidValue;
310310
if (Has(vertex_order_cw_bit)) {
311311
tessellation_orientation = spv::ExecutionModeVertexOrderCw;
312312
} else if (Has(vertex_order_ccw_bit)) {
@@ -316,7 +316,7 @@ uint32_t ExecutionModeSet::GetTessellationOrientation() const {
316316
}
317317

318318
uint32_t ExecutionModeSet::GetTessellationSpacing() const {
319-
uint32_t tessellation_spacing = 0;
319+
uint32_t tessellation_spacing = kInvalidValue;
320320
if (Has(spacing_equal_bit)) {
321321
tessellation_spacing = spv::ExecutionModeSpacingEqual;
322322
} else if (Has(spacing_fractional_even_bit)) {

0 commit comments

Comments
 (0)