layers: Move patchControlPoints validation
Move pTessellationState->patchControlPoints checks to parameter
validation where they will only be executed if the pipeline contains
tessellation stages.
Change-Id: I271f915625995f4a54045d0abe63ce27b9e023f9
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index d1afb90..383de01 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -2905,21 +2905,6 @@
}
}
- if (pPipeline->graphicsPipelineCI.pTessellationState &&
- ((pPipeline->graphicsPipelineCI.pTessellationState->patchControlPoints == 0) ||
- (pPipeline->graphicsPipelineCI.pTessellationState->patchControlPoints >
- dev_data->phys_dev_properties.properties.limits.maxTessellationPatchSize))) {
- skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_01426, "DS",
- "Invalid Pipeline CreateInfo State: "
- "VK_PRIMITIVE_TOPOLOGY_PATCH_LIST primitive "
- "topology used with patchControlPoints value %u."
- " patchControlPoints should be >0 and <=%u. %s",
- pPipeline->graphicsPipelineCI.pTessellationState->patchControlPoints,
- dev_data->phys_dev_properties.properties.limits.maxTessellationPatchSize,
- validation_error_map[VALIDATION_ERROR_01426]);
- }
-
// If a rasterization state is provided...
if (pPipeline->graphicsPipelineCI.pRasterizationState) {
// Make sure that the line width conforms to the HW.
diff --git a/layers/parameter_validation.cpp b/layers/parameter_validation.cpp
index d9cd7f7..301fb40 100644
--- a/layers/parameter_validation.cpp
+++ b/layers/parameter_validation.cpp
@@ -2961,6 +2961,19 @@
"be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO. %s",
i, validation_error_map[VALIDATION_ERROR_00538]);
}
+
+ if (pCreateInfos[i].pTessellationState->patchControlPoints == 0 ||
+ pCreateInfos[i].pTessellationState->patchControlPoints >
+ device_data->device_limits.maxTessellationPatchSize) {
+ skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
+ __LINE__, VALIDATION_ERROR_01426, LayerName,
+ "vkCreateGraphicsPipelines: invalid parameter "
+ "pCreateInfos[%d].pTessellationState->patchControlPoints value %u. patchControlPoints "
+ "should be >0 and <=%u. %s",
+ i, pCreateInfos[i].pTessellationState->patchControlPoints,
+ device_data->device_limits.maxTessellationPatchSize,
+ validation_error_map[VALIDATION_ERROR_01426]);
+ }
}
}
}