aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2018-05-11 11:11:34 -0600
committerMark Lobodzinski <mark@lunarg.com>2018-05-11 18:47:55 -0600
commit2490b80edb6ab10df256e544540bf8ee446adba5 (patch)
tree023a02cd36532aba7f3396491c6500f94bfa2057
parent863f214c0dda21e09343ee929244394943dfaffc (diff)
downloadvulkan-validation-layers-2490b80edb6ab10df256e544540bf8ee446adba5.tar.gz
layers:Moving to GPDF2
Update layer_data struct to track safe_VkPhysicalDeviceFeatures2 struct instead of VkPhysicalDeviceFeatures. Currently just doing previous checks using the VkPhysicalDeviceFeatures member of GPDF2 struct. Will follow-on with checking against extension structs.
-rw-r--r--layers/core_validation.cpp49
1 files changed, 27 insertions, 22 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 5de8fe9cb..8f6ee29d7 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -199,7 +199,7 @@ struct layer_data {
instance_layer_data *instance_data = nullptr; // from device to enclosing instance
- VkPhysicalDeviceFeatures enabled_features = {};
+ safe_VkPhysicalDeviceFeatures2 enabled_features2 = {};
// Device specific data
PHYS_DEV_PROPERTIES_NODE phys_dev_properties = {};
VkPhysicalDeviceMemoryProperties phys_dev_mem_props = {};
@@ -1281,7 +1281,7 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq
HandleToUint64(pPipeline->rp_state->renderPass), pPipeline->graphicsPipelineCI.subpass,
subpass_desc->colorAttachmentCount, color_blend_state->attachmentCount);
}
- if (!dev_data->enabled_features.independentBlend) {
+ if (!dev_data->enabled_features2.features.independentBlend) {
if (pPipeline->attachments.size() > 1) {
VkPipelineColorBlendAttachmentState *pAttachments = &pPipeline->attachments[0];
for (size_t i = 1; i < pPipeline->attachments.size(); i++) {
@@ -1300,7 +1300,8 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq
}
}
}
- if (!dev_data->enabled_features.logicOp && (pPipeline->graphicsPipelineCI.pColorBlendState->logicOpEnable != VK_FALSE)) {
+ if (!dev_data->enabled_features2.features.logicOp &&
+ (pPipeline->graphicsPipelineCI.pColorBlendState->logicOpEnable != VK_FALSE)) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
HandleToUint64(pPipeline->pipeline), VALIDATION_ERROR_0f4004bc,
@@ -1311,7 +1312,7 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq
(pPipeline->attachments[i].srcColorBlendFactor == VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR) ||
(pPipeline->attachments[i].srcColorBlendFactor == VK_BLEND_FACTOR_SRC1_ALPHA) ||
(pPipeline->attachments[i].srcColorBlendFactor == VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA)) {
- if (!dev_data->enabled_features.dualSrcBlend) {
+ if (!dev_data->enabled_features2.features.dualSrcBlend) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
HandleToUint64(pPipeline->pipeline), VALIDATION_ERROR_0f2004c0,
@@ -1325,7 +1326,7 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq
(pPipeline->attachments[i].dstColorBlendFactor == VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR) ||
(pPipeline->attachments[i].dstColorBlendFactor == VK_BLEND_FACTOR_SRC1_ALPHA) ||
(pPipeline->attachments[i].dstColorBlendFactor == VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA)) {
- if (!dev_data->enabled_features.dualSrcBlend) {
+ if (!dev_data->enabled_features2.features.dualSrcBlend) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
HandleToUint64(pPipeline->pipeline), VALIDATION_ERROR_0f2004c2,
@@ -1339,7 +1340,7 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq
(pPipeline->attachments[i].srcAlphaBlendFactor == VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR) ||
(pPipeline->attachments[i].srcAlphaBlendFactor == VK_BLEND_FACTOR_SRC1_ALPHA) ||
(pPipeline->attachments[i].srcAlphaBlendFactor == VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA)) {
- if (!dev_data->enabled_features.dualSrcBlend) {
+ if (!dev_data->enabled_features2.features.dualSrcBlend) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
HandleToUint64(pPipeline->pipeline), VALIDATION_ERROR_0f2004c4,
@@ -1353,7 +1354,7 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq
(pPipeline->attachments[i].dstAlphaBlendFactor == VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR) ||
(pPipeline->attachments[i].dstAlphaBlendFactor == VK_BLEND_FACTOR_SRC1_ALPHA) ||
(pPipeline->attachments[i].dstAlphaBlendFactor == VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA)) {
- if (!dev_data->enabled_features.dualSrcBlend) {
+ if (!dev_data->enabled_features2.features.dualSrcBlend) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
HandleToUint64(pPipeline->pipeline), VALIDATION_ERROR_0f2004c6,
@@ -1428,7 +1429,7 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq
// If a rasterization state is provided...
if (pPipeline->graphicsPipelineCI.pRasterizationState) {
if ((pPipeline->graphicsPipelineCI.pRasterizationState->depthClampEnable == VK_TRUE) &&
- (!dev_data->enabled_features.depthClamp)) {
+ (!dev_data->enabled_features2.features.depthClamp)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
HandleToUint64(pPipeline->pipeline), VALIDATION_ERROR_1020061c,
"vkCreateGraphicsPipelines(): the depthClamp device feature is disabled: the depthClampEnable member "
@@ -1437,7 +1438,7 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq
if (!isDynamic(pPipeline, VK_DYNAMIC_STATE_DEPTH_BIAS) &&
(pPipeline->graphicsPipelineCI.pRasterizationState->depthBiasClamp != 0.0) &&
- (!dev_data->enabled_features.depthBiasClamp)) {
+ (!dev_data->enabled_features2.features.depthBiasClamp)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
HandleToUint64(pPipeline->pipeline), DRAWSTATE_INVALID_FEATURE,
"vkCreateGraphicsPipelines(): the depthBiasClamp device feature is disabled: the depthBiasClamp member "
@@ -1448,7 +1449,7 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq
// If rasterization is enabled...
if (pPipeline->graphicsPipelineCI.pRasterizationState->rasterizerDiscardEnable == VK_FALSE) {
if ((pPipeline->graphicsPipelineCI.pMultisampleState->alphaToOneEnable == VK_TRUE) &&
- (!dev_data->enabled_features.alphaToOne)) {
+ (!dev_data->enabled_features2.features.alphaToOne)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
HandleToUint64(pPipeline->pipeline), VALIDATION_ERROR_10000622,
"vkCreateGraphicsPipelines(): the alphaToOne device feature is disabled: the alphaToOneEnable "
@@ -1465,7 +1466,7 @@ static bool ValidatePipelineUnlocked(layer_data *dev_data, std::vector<std::uniq
"and subpass uses a depth/stencil attachment.");
} else if ((pPipeline->graphicsPipelineCI.pDepthStencilState->depthBoundsTestEnable == VK_TRUE) &&
- (!dev_data->enabled_features.depthBounds)) {
+ (!dev_data->enabled_features2.features.depthBounds)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
HandleToUint64(pPipeline->pipeline), VALIDATION_ERROR_0f6004ac,
"vkCreateGraphicsPipelines(): the depthBounds device feature is disabled: the "
@@ -2221,6 +2222,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice gpu, const VkDevice
// Check that any requested features are available
// The enabled features can come from either pEnabledFeatures, or from the pNext chain
+ // TODO: Validate VALIDATION_ERROR_056002ea here, can't have non-null pEnabledFeatures & GPDF2 in pNext chain
const VkPhysicalDeviceFeatures *enabled_features_found = pCreateInfo->pEnabledFeatures;
if (nullptr == enabled_features_found) {
const auto *features2 = lvl_find_in_chain<VkPhysicalDeviceFeatures2KHR>(pCreateInfo->pNext);
@@ -2283,9 +2285,9 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice gpu, const VkDevice
gpu, &count, &device_data->phys_dev_properties.queue_family_properties[0]);
// TODO: device limits should make sure these are compatible
if (enabled_features_found) {
- device_data->enabled_features = *enabled_features_found;
+ device_data->enabled_features2.features = *enabled_features_found;
} else {
- memset(&device_data->enabled_features, 0, sizeof(VkPhysicalDeviceFeatures));
+ memset(&device_data->enabled_features2.features, 0, sizeof(VkPhysicalDeviceFeatures));
}
// Store physical device properties and physical device mem limits into device layer_data structs
instance_data->dispatch_table.GetPhysicalDeviceMemoryProperties(gpu, &device_data->phys_dev_mem_props);
@@ -2363,14 +2365,14 @@ static const VkExtensionProperties instance_extensions[] = {{VK_EXT_DEBUG_REPORT
static bool ValidateStageMaskGsTsEnables(layer_data *dev_data, VkPipelineStageFlags stageMask, const char *caller,
UNIQUE_VALIDATION_ERROR_CODE geo_error_id, UNIQUE_VALIDATION_ERROR_CODE tess_error_id) {
bool skip = false;
- if (!dev_data->enabled_features.geometryShader && (stageMask & VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT)) {
+ if (!dev_data->enabled_features2.features.geometryShader && (stageMask & VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT)) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, geo_error_id,
"%s call includes a stageMask with VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT bit set when device does not have "
"geometryShader feature enabled.",
caller);
}
- if (!dev_data->enabled_features.tessellationShader &&
+ if (!dev_data->enabled_features2.features.tessellationShader &&
(stageMask & (VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT | VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT))) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, tess_error_id,
@@ -4449,7 +4451,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateQueryPool(VkDevice device, const VkQueryPoo
layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map);
bool skip = false;
if (pCreateInfo && pCreateInfo->queryType == VK_QUERY_TYPE_PIPELINE_STATISTICS) {
- if (!dev_data->enabled_features.pipelineStatisticsQuery) {
+ if (!dev_data->enabled_features2.features.pipelineStatisticsQuery) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, 0,
VALIDATION_ERROR_11c0062e,
"Query pool with type VK_QUERY_TYPE_PIPELINE_STATISTICS created on a device with "
@@ -4745,7 +4747,9 @@ std::unordered_map<VkImageView, std::unique_ptr<IMAGE_VIEW_STATE>> *GetImageView
const PHYS_DEV_PROPERTIES_NODE *GetPhysDevProperties(const layer_data *device_data) { return &device_data->phys_dev_properties; }
-const VkPhysicalDeviceFeatures *GetEnabledFeatures(const layer_data *device_data) { return &device_data->enabled_features; }
+const VkPhysicalDeviceFeatures *GetEnabledFeatures(const layer_data *device_data) {
+ return &device_data->enabled_features2.features;
+}
const VkPhysicalDeviceDescriptorIndexingFeaturesEXT *GetEnabledDescriptorIndexingFeatures(const layer_data *device_data) {
return &device_data->phys_dev_ext_props.descriptor_indexing_features;
@@ -5146,10 +5150,10 @@ std::valarray<uint32_t> GetDescriptorCountMaxPerStage(
// Identify active pipeline stages
std::vector<VkShaderStageFlags> stage_flags = {VK_SHADER_STAGE_VERTEX_BIT, VK_SHADER_STAGE_FRAGMENT_BIT,
VK_SHADER_STAGE_COMPUTE_BIT};
- if (dev_data->enabled_features.geometryShader) {
+ if (dev_data->enabled_features2.features.geometryShader) {
stage_flags.push_back(VK_SHADER_STAGE_GEOMETRY_BIT);
}
- if (dev_data->enabled_features.tessellationShader) {
+ if (dev_data->enabled_features2.features.tessellationShader) {
stage_flags.push_back(VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT);
stage_flags.push_back(VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT);
}
@@ -5961,7 +5965,8 @@ VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer,
AddFramebufferBinding(dev_data, cb_node, framebuffer);
}
}
- if ((pInfo->occlusionQueryEnable == VK_FALSE || dev_data->enabled_features.occlusionQueryPrecise == VK_FALSE) &&
+ if ((pInfo->occlusionQueryEnable == VK_FALSE ||
+ dev_data->enabled_features2.features.occlusionQueryPrecise == VK_FALSE) &&
(pInfo->queryFlags & VK_QUERY_CONTROL_PRECISE_BIT)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer),
@@ -6206,7 +6211,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetDepthBias(VkCommandBuffer commandBuffer, float
HandleToUint64(commandBuffer), VALIDATION_ERROR_1cc0062a,
"vkCmdSetDepthBias(): pipeline was created without VK_DYNAMIC_STATE_DEPTH_BIAS flag..");
}
- if ((depthBiasClamp != 0.0) && (!dev_data->enabled_features.depthBiasClamp)) {
+ if ((depthBiasClamp != 0.0) && (!dev_data->enabled_features2.features.depthBiasClamp)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
HandleToUint64(commandBuffer), VALIDATION_ERROR_1cc0062c,
"vkCmdSetDepthBias(): the depthBiasClamp device feature is disabled: the depthBiasClamp parameter must "
@@ -9603,7 +9608,7 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uin
pCB->beginInfo.flags &= ~VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT;
}
}
- if (!pCB->activeQueries.empty() && !dev_data->enabled_features.inheritedQueries) {
+ if (!pCB->activeQueries.empty() && !dev_data->enabled_features2.features.inheritedQueries) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
HandleToUint64(pCommandBuffers[i]), VALIDATION_ERROR_1b2000ca,