summaryrefslogtreecommitdiffstats
path: root/src/vulkan
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-05-21 16:33:04 -0700
committerJason Ekstrand <[email protected]>2015-05-21 16:33:04 -0700
commit0a54751910f1e8f7e65fcc6dbb0b32eee7a7120e (patch)
tree79e3ed1851588931622523dddb0f9ee788868ca2 /src/vulkan
parent519fe765e21e43b650ebf2acc9e28725e528a0de (diff)
vk/device: Memset descriptor sets to 0 and handle descriptor set holes
Diffstat (limited to 'src/vulkan')
-rw-r--r--src/vulkan/device.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vulkan/device.c b/src/vulkan/device.c
index 3381729680a..d464d66982e 100644
--- a/src/vulkan/device.c
+++ b/src/vulkan/device.c
@@ -1832,6 +1832,11 @@ VkResult anv_AllocDescriptorSets(
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
+ /* Descriptor sets may not be 100% filled out so we need to memset to
+ * ensure that we can properly detect and handle holes.
+ */
+ memset(set, 0, size);
+
pDescriptorSets[i] = (VkDescriptorSet) set;
}
@@ -2461,6 +2466,8 @@ void anv_CmdBindDescriptorSets(
start = bias + layout->set[firstSet + i].surface_start[s];
for (uint32_t b = 0; b < set_layout->stage[s].surface_count; b++) {
struct anv_surface_view *view = set->descriptors[surface_to_desc[b]].view;
+ if (!view)
+ continue;
struct anv_state state =
anv_cmd_buffer_alloc_surface_state(cmd_buffer, 64, 64);
@@ -2478,6 +2485,8 @@ void anv_CmdBindDescriptorSets(
start = layout->set[firstSet + i].sampler_start[s];
for (uint32_t b = 0; b < set_layout->stage[s].sampler_count; b++) {
struct anv_sampler *sampler = set->descriptors[sampler_to_desc[b]].sampler;
+ if (!sampler)
+ continue;
memcpy(&bindings->descriptors[s].samplers[start + b],
sampler->state, sizeof(sampler->state));