aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorMike Weiblen <mikew@lunarg.com>2017-02-09 12:26:58 -0700
committerMike Weiblen <mikew@lunarg.com>2017-02-13 12:02:19 -0700
commit44dd16bb27045ef45fa64d694c0864426c66405e (patch)
tree08410ebe76919ab09856dc024534bd3753fa1a11 /layers/core_validation.cpp
parentddb864f4fe8e4c4cc525146a43c4d86af11f8594 (diff)
downloadusermoji-44dd16bb27045ef45fa64d694c0864426c66405e.tar.xz
layers: Refactor checking code
Combine code blocks to avoid repetitive checking of the same state. Change-Id: I788538b82ce9420035d9ab2ba9fefb9befb67722
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 22ca66e5..d225af42 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -3198,32 +3198,34 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
validation_error_map[VALIDATION_ERROR_01426]);
}
- // If a rasterization state is provided, make sure that the line width conforms to the HW.
+ // If a rasterization state is provided...
if (pPipeline->graphicsPipelineCI.pRasterizationState) {
+
+ // Make sure that the line width conforms to the HW.
if (!isDynamic(pPipeline, VK_DYNAMIC_STATE_LINE_WIDTH)) {
skip_call |= verifyLineWidth(dev_data, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE,
reinterpret_cast<uint64_t const &>(pPipeline->pipeline),
pPipeline->graphicsPipelineCI.pRasterizationState->lineWidth);
}
- }
- // If rasterization is not disabled and subpass uses a depth/stencil attachment, pDepthStencilState must be a pointer to a
- // valid structure
- if (pPipeline->graphicsPipelineCI.pRasterizationState &&
- (pPipeline->graphicsPipelineCI.pRasterizationState->rasterizerDiscardEnable == VK_FALSE)) {
- auto subpass_desc = renderPass ? &renderPass->createInfo.pSubpasses[pPipeline->graphicsPipelineCI.subpass] : nullptr;
- if (subpass_desc && subpass_desc->pDepthStencilAttachment &&
- subpass_desc->pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) {
- if (!pPipeline->graphicsPipelineCI.pDepthStencilState) {
- skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,
- 0, __LINE__, VALIDATION_ERROR_02115, "DS",
- "Invalid Pipeline CreateInfo State: "
- "pDepthStencilState is NULL when rasterization is enabled and subpass uses a "
- "depth/stencil attachment. %s",
- validation_error_map[VALIDATION_ERROR_02115]);
+ // If rasterization is enabled...
+ if (pPipeline->graphicsPipelineCI.pRasterizationState->rasterizerDiscardEnable == VK_FALSE) {
+ auto subpass_desc = renderPass ? &renderPass->createInfo.pSubpasses[pPipeline->graphicsPipelineCI.subpass] : nullptr;
+
+ // If subpass uses a depth/stencil attachment, pDepthStencilState must be a pointer to a valid structure
+ if (subpass_desc && subpass_desc->pDepthStencilAttachment &&
+ subpass_desc->pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) {
+ if (!pPipeline->graphicsPipelineCI.pDepthStencilState) {
+ skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_02115, "DS",
+ "Invalid Pipeline CreateInfo State: pDepthStencilState is NULL when rasterization is "
+ "enabled and subpass uses a depth/stencil attachment. %s",
+ validation_error_map[VALIDATION_ERROR_02115]);
+ }
}
}
}
+
return skip_call;
}