aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2016-04-19 08:15:03 -0600
committerTobin Ehlis <tobine@google.com>2016-04-20 07:31:53 -0600
commitf4c61aafdd4c22f308e37eaaec7156d8c70b4fce (patch)
treed5836841bddd43a6d6e180f8a64d8f9551fc8f20
parentb34e816d8512ae285a49feabb34980895cfc38ea (diff)
downloadusermoji-f4c61aafdd4c22f308e37eaaec7156d8c70b4fce.tar.xz
layers: GH384 Fix descriptor update check for immutable samplers
If a descriptor is an immutable sampler of type VK_DESCRIPTOR_TYPE_SAMPLER then it doesn't need to be explicitly updated so don't flag errors in this case.
-rw-r--r--layers/core_validation.cpp14
-rw-r--r--layers/core_validation.h7
2 files changed, 15 insertions, 6 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index a53b5b64..a2a04da3 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -2718,7 +2718,12 @@ static bool validate_and_update_drawtime_descriptor_state(
for (uint32_t i = startIdx; i <= endIdx; ++i) {
// We did check earlier to verify that set was updated, but now make sure given slot was updated
// TODO : Would be better to store set# that set is bound to so we can report set.binding[index] not updated
- if (!set_node->pDescriptorUpdates[i]) {
+ // For immutable sampler w/o combined image, don't need to update
+ if ((set_node->pLayout->createInfo.pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) &&
+ (set_node->pLayout->createInfo.pBindings[i].descriptorCount != 0) &&
+ (set_node->pLayout->createInfo.pBindings[i].pImmutableSamplers)) {
+ // Nothing to do here
+ } else if (!set_node->pDescriptorUpdates[i]) {
result |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, reinterpret_cast<const uint64_t &>(set_node->set), __LINE__,
DRAWSTATE_DESCRIPTOR_SET_NOT_UPDATED, "DS",
@@ -2907,10 +2912,10 @@ static bool validate_and_update_draw_state(layer_data *my_data, GLOBAL_CB_NODE *
// Pull the set node
SET_NODE *pSet = my_data->setMap[state.boundDescriptorSets[setIndex]];
// Save vector of all active sets to verify dynamicOffsets below
- // activeSetNodes.push_back(pSet);
activeSetBindingsPairs.push_back(std::make_pair(pSet, setBindingPair.second));
- // Make sure set has been updated
- if (!pSet->pUpdateStructs) {
+ // Make sure set has been updated if it has no immutable samplers
+ // If it has immutable samplers, we'll flag error later as needed depending on binding
+ if (!pSet->pUpdateStructs && !pSet->pLayout->immutableSamplerCount) {
result |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, (uint64_t)pSet->set, __LINE__,
DRAWSTATE_DESCRIPTOR_SET_NOT_UPDATED, "DS",
@@ -6479,6 +6484,7 @@ vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateIn
*ppIS = new VkSampler[pCreateInfo->pBindings[i].descriptorCount];
memcpy(*ppIS, pCreateInfo->pBindings[i].pImmutableSamplers,
pCreateInfo->pBindings[i].descriptorCount * sizeof(VkSampler));
+ pNewNode->immutableSamplerCount += pCreateInfo->pBindings[i].descriptorCount;
}
}
pNewNode->layout = *pSetLayout;
diff --git a/layers/core_validation.h b/layers/core_validation.h
index 853c87fd..0831c775 100644
--- a/layers/core_validation.h
+++ b/layers/core_validation.h
@@ -638,6 +638,7 @@ typedef struct _LAYOUT_NODE {
uint32_t endIndex; // last index of this layout
uint32_t dynamicDescriptorCount; // Total count of dynamic descriptors used
// by this layout
+ uint32_t immutableSamplerCount; // # of immutable samplers in this layout
vector<VkDescriptorType> descriptorTypes; // Type per descriptor in this
// layout to verify correct
// updates
@@ -646,7 +647,7 @@ typedef struct _LAYOUT_NODE {
unordered_map<uint32_t, uint32_t> bindingToIndexMap; // map set binding # to
// createInfo.pBindings index
// Default constructor
- _LAYOUT_NODE() : layout{}, createInfo{}, startIndex(0), endIndex(0), dynamicDescriptorCount(0){};
+ _LAYOUT_NODE() : layout{}, createInfo{}, startIndex(0), endIndex(0), dynamicDescriptorCount(0), immutableSamplerCount(0){};
} LAYOUT_NODE;
// Store layouts and pushconstants for PipelineLayout
@@ -668,7 +669,9 @@ class SET_NODE : public BASE_NODE {
LAYOUT_NODE *pLayout; // Layout for this set
SET_NODE *pNext;
unordered_set<VkCommandBuffer> boundCmdBuffers; // Cmd buffers that this set has been bound to
- SET_NODE() : set(VK_NULL_HANDLE), pool(VK_NULL_HANDLE), pUpdateStructs(nullptr), pLayout(nullptr), pNext(nullptr){};
+ SET_NODE()
+ : set(VK_NULL_HANDLE), pool(VK_NULL_HANDLE), pUpdateStructs(nullptr), descriptorCount(0), pLayout(nullptr),
+ pNext(nullptr){};
};
typedef struct _DESCRIPTOR_POOL_NODE {