aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCourtney Goeltzenleuchter <courtney@LunarG.com>2015-10-22 15:31:56 -0600
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-10-23 17:32:04 -0600
commitdd9a7ec64581fa72c80c4d6b2139fcc9bc20949d (patch)
tree06c1f933fd931fc80935a4e723927b872131c86a
parent62534c1eeb855c97e6ef2b46183972228120c199 (diff)
downloadusermoji-dd9a7ec64581fa72c80c4d6b2139fcc9bc20949d.tar.xz
bug-14827: Make DescriptorInfo a union of bufferInfo, imageInfo, and bufferView
-rw-r--r--demos/cube.c6
-rw-r--r--demos/tri.c6
-rw-r--r--include/vulkan.h16
-rwxr-xr-xlayers/draw_state.cpp14
-rw-r--r--layers/param_checker.cpp4
5 files changed, 29 insertions, 17 deletions
diff --git a/demos/cube.c b/demos/cube.c
index 67926279..a435c016 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -1657,9 +1657,9 @@ static void demo_prepare_descriptor_set(struct demo *demo)
memset(&tex_descs, 0, sizeof(tex_descs));
for (i = 0; i < DEMO_TEXTURE_COUNT; i++) {
- tex_descs[i].sampler = demo->textures[i].sampler;
- tex_descs[i].imageView = demo->textures[i].view;
- tex_descs[i].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
+ tex_descs[i].imageInfo.sampler = demo->textures[i].sampler;
+ tex_descs[i].imageInfo.imageView = demo->textures[i].view;
+ tex_descs[i].imageInfo.imageLayout = VK_IMAGE_LAYOUT_GENERAL;
}
memset(&writes, 0, sizeof(writes));
diff --git a/demos/tri.c b/demos/tri.c
index 3f48748a..d03bf16a 100644
--- a/demos/tri.c
+++ b/demos/tri.c
@@ -1413,9 +1413,9 @@ static void demo_prepare_descriptor_set(struct demo *demo)
memset(&tex_descs, 0, sizeof(tex_descs));
for (i = 0; i < DEMO_TEXTURE_COUNT; i++) {
- tex_descs[i].sampler = demo->textures[i].sampler;
- tex_descs[i].imageView = demo->textures[i].view;
- tex_descs[i].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
+ tex_descs[i].imageInfo.sampler = demo->textures[i].sampler;
+ tex_descs[i].imageInfo.imageView = demo->textures[i].view;
+ tex_descs[i].imageInfo.imageLayout = VK_IMAGE_LAYOUT_GENERAL;
}
memset(&write, 0, sizeof(write));
diff --git a/include/vulkan.h b/include/vulkan.h
index c85d5112..ebff03f3 100644
--- a/include/vulkan.h
+++ b/include/vulkan.h
@@ -1813,17 +1813,25 @@ typedef struct {
} VkDescriptorPoolCreateInfo;
typedef struct {
+ VkSampler sampler;
+ VkImageView imageView;
+ VkImageLayout imageLayout;
+} VkDescriptorImageInfo;
+
+typedef struct {
VkBuffer buffer;
VkDeviceSize offset;
VkDeviceSize range;
} VkDescriptorBufferInfo;
+/* TODO: this should be union, except that causes a compiler error:
+ * error: member 'VkDescriptorImageInfo <anonymous union>::imageInfo' with constructor not allowed in union
+ * This issue should go away when the change to remove the constructor lands.
+ */
typedef struct {
- VkBufferView bufferView;
- VkSampler sampler;
- VkImageView imageView;
- VkImageLayout imageLayout;
+ VkDescriptorImageInfo imageInfo;
VkDescriptorBufferInfo bufferInfo;
+ VkBufferView texelBufferView;
} VkDescriptorInfo;
typedef struct {
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index c1395b36..7f51083f 100755
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -830,7 +830,9 @@ static VkBool32 shadowUpdateNode(layer_data* my_data, const VkDevice device, GEN
pWDS = new VkWriteDescriptorSet;
*pNewNode = (GENERIC_HEADER*)pWDS;
memcpy(pWDS, pUpdate, sizeof(VkWriteDescriptorSet));
- pWDS->pDescriptors = new VkDescriptorInfo[pWDS->count];
+ /* TODO: restore new once constructors have been removed from vulkan.h */
+// pWDS->pDescriptors = new VkDescriptorInfo[pWDS->count];
+ pWDS->pDescriptors = (VkDescriptorInfo *) malloc(sizeof(VkDescriptorInfo) * pWDS->count);
array_size = sizeof(VkDescriptorInfo) * pWDS->count;
memcpy((void*)pWDS->pDescriptors, ((VkWriteDescriptorSet*)pUpdate)->pDescriptors, array_size);
break;
@@ -858,12 +860,12 @@ static VkBool32 validateDescriptorSetImageView(const layer_data* my_data, VkDevi
for (uint32_t i = 0; i < writeDsCount; i++) {
for (uint32_t j = 0; j < pWDS[i].count; j++) {
const VkDescriptorInfo *dInfo = &pWDS[i].pDescriptors[j];
- auto imageViewItem = dev_data->imageViewMap.find(dInfo->imageView.handle);
+ auto imageViewItem = dev_data->imageViewMap.find(dInfo->imageInfo.imageView.handle);
if (imageViewItem != dev_data->imageViewMap.end()) {
VkImageAspectFlags flags = ((*imageViewItem).second)->subresourceRange.aspectMask;
if ((flags & VK_IMAGE_ASPECT_DEPTH_BIT) &&
(flags & VK_IMAGE_ASPECT_STENCIL_BIT)) {
- skipCall |= log_msg(my_data->report_data, VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_IMAGE_VIEW, dInfo->imageView.handle, 0,
+ skipCall |= log_msg(my_data->report_data, VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_IMAGE_VIEW, dInfo->imageInfo.imageView.handle, 0,
DRAWSTATE_INVALID_IMAGE_ASPECT, "DS", "vkUpdateDescriptorSets: DesriptorSet[%d] in WriteDesriptorSet[%d] "
"has ImageView with both STENCIL and DEPTH aspects set", j, i);
}
@@ -1015,8 +1017,10 @@ static void freeShadowUpdateTree(SET_NODE* pSet)
{
case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET:
pWDS = (VkWriteDescriptorSet*)pFreeUpdate;
- if (pWDS->pDescriptors)
- delete[] pWDS->pDescriptors;
+ if (pWDS->pDescriptors) {
+// delete[] pWDS->pDescriptors;
+ free((void *) pWDS->pDescriptors);
+ }
break;
case VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET:
break;
diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp
index 989a6bda..618e0fc4 100644
--- a/layers/param_checker.cpp
+++ b/layers/param_checker.cpp
@@ -4806,8 +4806,8 @@ bool PreUpdateDescriptorSets(
}
if(pDescriptorWrites->pDescriptors != nullptr)
{
- if(pDescriptorWrites->pDescriptors->imageLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE ||
- pDescriptorWrites->pDescriptors->imageLayout > VK_IMAGE_LAYOUT_END_RANGE)
+ if(pDescriptorWrites->pDescriptors->imageInfo.imageLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE ||
+ pDescriptorWrites->pDescriptors->imageInfo.imageLayout > VK_IMAGE_LAYOUT_END_RANGE)
{
log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType)0, 0, 0, 1, "PARAMCHECK",
"vkUpdateDescriptorSets parameter, VkImageLayout pDescriptorWrites->pDescriptors->imageLayout, is an unrecognized enumerator");