v98: replace vkUpdateDescriptors() by vkUpdateDescriptorSets()
Only slightly tested.
Conflicts:
include/vulkan.h
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 05fb363..4393d1d 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -1237,20 +1237,26 @@
err = vkCreateSampler(m_device->device(), &sampler_ci, &sampler);
ASSERT_VK_SUCCESS(err);
- VkUpdateSamplers *pSamplerUpdate = (VkUpdateSamplers*)malloc(sizeof(VkUpdateSamplers));
+ VkDescriptorInfo descriptor_info;
+ memset(&descriptor_info, 0, sizeof(descriptor_info));
+ descriptor_info.sampler = sampler;
+
+ VkWriteDescriptorSet descriptor_write;
+ memset(&descriptor_write, 0, sizeof(descriptor_write));
+ descriptor_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
+ descriptor_write.destSet = descriptorSet;
+ descriptor_write.count = 1;
// This is a mismatched type for the layout which expects BUFFER
- pSamplerUpdate->sType = VK_STRUCTURE_TYPE_UPDATE_SAMPLERS;
- pSamplerUpdate->pNext = NULL;
- pSamplerUpdate->binding = 0;
- pSamplerUpdate->arrayIndex = 0;
- pSamplerUpdate->count = 1;
- pSamplerUpdate->pSamplers = &sampler;
- const void** ppUpdate = (const void**)&pSamplerUpdate;
- vkUpdateDescriptors(m_device->device(), descriptorSet, 1, ppUpdate);
+ descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER;
+ descriptor_write.pDescriptors = &descriptor_info;
+
+ vkUpdateDescriptorSets(m_device->device(), 1, &descriptor_write, 0, NULL);
+
msgType = m_errorMonitor->GetState(&msgString);
+ std::cout << msgString << "\n";
ASSERT_EQ(msgType, VK_DBG_MSG_ERROR) << "Did not receive error after updating BUFFER Descriptor w/ incorrect type of SAMPLER.";
- if (!strstr(msgString.c_str(),"Descriptor update type of VK_STRUCTURE_TYPE_UPDATE_SAMPLERS does not match ")) {
- FAIL() << "Error received was not 'Descriptor update type of VK_STRUCTURE_TYPE_UPDATE_SAMPLERS does not match overlapping binding type!'";
+ if (!strstr(msgString.c_str(),"Descriptor update type of VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET does not match ")) {
+ FAIL() << "Error received was not 'Descriptor update type of VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET does not match overlapping binding type!'";
}
}
@@ -1318,20 +1324,27 @@
VkSampler sampler;
err = vkCreateSampler(m_device->device(), &sampler_ci, &sampler);
ASSERT_VK_SUCCESS(err);
+
+ VkDescriptorInfo descriptor_info;
+ memset(&descriptor_info, 0, sizeof(descriptor_info));
+ descriptor_info.sampler = sampler;
+
+ VkWriteDescriptorSet descriptor_write;
+ memset(&descriptor_write, 0, sizeof(descriptor_write));
+ descriptor_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
+ descriptor_write.destSet = descriptorSet;
+ descriptor_write.destArrayElement = 1; /* This index out of bounds for the update */
+ descriptor_write.count = 1;
// This is the wrong type, but out of bounds will be flagged first
- VkUpdateSamplers *pSamplerUpdate = (VkUpdateSamplers*)malloc(sizeof(VkUpdateSamplers));
- pSamplerUpdate->sType = VK_STRUCTURE_TYPE_UPDATE_SAMPLERS;
- pSamplerUpdate->pNext = NULL;
- pSamplerUpdate->binding = 0;
- pSamplerUpdate->arrayIndex = 1; /* This index out of bounds for the update */
- pSamplerUpdate->count = 1;
- pSamplerUpdate->pSamplers = &sampler;
- const void** ppUpdate = (const void**)&pSamplerUpdate;
- vkUpdateDescriptors(m_device->device(), descriptorSet, 1, ppUpdate);
+ descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER;
+ descriptor_write.pDescriptors = &descriptor_info;
+
+ vkUpdateDescriptorSets(m_device->device(), 1, &descriptor_write, 0, NULL);
+
msgType = m_errorMonitor->GetState(&msgString);
ASSERT_EQ(msgType, VK_DBG_MSG_ERROR) << "Did not receive error after updating Descriptor w/ index out of bounds.";
- if (!strstr(msgString.c_str(),"Descriptor update type of VK_STRUCTURE_TYPE_UPDATE_SAMPLERS is out of bounds for matching binding")) {
- FAIL() << "Error received was not 'Descriptor update type of VK_STRUCTURE_TYPE_UPDATE_SAMPLERS is out of bounds for matching binding...'";
+ if (!strstr(msgString.c_str(),"Descriptor update type of VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET is out of bounds for matching binding")) {
+ FAIL() << "Error received was not 'Descriptor update type of VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET is out of bounds for matching binding...'";
}
}
@@ -1399,16 +1412,23 @@
VkSampler sampler;
err = vkCreateSampler(m_device->device(), &sampler_ci, &sampler);
ASSERT_VK_SUCCESS(err);
+
+ VkDescriptorInfo descriptor_info;
+ memset(&descriptor_info, 0, sizeof(descriptor_info));
+ descriptor_info.sampler = sampler;
+
+ VkWriteDescriptorSet descriptor_write;
+ memset(&descriptor_write, 0, sizeof(descriptor_write));
+ descriptor_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
+ descriptor_write.destSet = descriptorSet;
+ descriptor_write.destBinding = 2;
+ descriptor_write.count = 1;
// This is the wrong type, but out of bounds will be flagged first
- VkUpdateSamplers *pSamplerUpdate = (VkUpdateSamplers*)malloc(sizeof(VkUpdateSamplers));
- pSamplerUpdate->sType = VK_STRUCTURE_TYPE_UPDATE_SAMPLERS;
- pSamplerUpdate->pNext = NULL;
- pSamplerUpdate->binding = 2; /* This binding too big for the update */
- pSamplerUpdate->arrayIndex = 0;
- pSamplerUpdate->count = 1;
- pSamplerUpdate->pSamplers = &sampler;
- const void** ppUpdate = (const void**)&pSamplerUpdate;
- vkUpdateDescriptors(m_device->device(), descriptorSet, 1, ppUpdate);
+ descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER;
+ descriptor_write.pDescriptors = &descriptor_info;
+
+ vkUpdateDescriptorSets(m_device->device(), 1, &descriptor_write, 0, NULL);
+
msgType = m_errorMonitor->GetState(&msgString);
ASSERT_EQ(msgType, VK_DBG_MSG_ERROR) << "Did not receive error after updating Descriptor w/ count too large for layout.";
if (!strstr(msgString.c_str()," does not have binding to match update binding ")) {
@@ -1480,16 +1500,23 @@
VkSampler sampler;
err = vkCreateSampler(m_device->device(), &sampler_ci, &sampler);
ASSERT_VK_SUCCESS(err);
+
+
+ VkDescriptorInfo descriptor_info;
+ memset(&descriptor_info, 0, sizeof(descriptor_info));
+ descriptor_info.sampler = sampler;
+
+ VkWriteDescriptorSet descriptor_write;
+ memset(&descriptor_write, 0, sizeof(descriptor_write));
+ descriptor_write.sType = (VkStructureType)0x99999999; /* Intentionally broken struct type */
+ descriptor_write.destSet = descriptorSet;
+ descriptor_write.count = 1;
// This is the wrong type, but out of bounds will be flagged first
- VkUpdateSamplers *pSamplerUpdate = (VkUpdateSamplers*)malloc(sizeof(VkUpdateSamplers));
- pSamplerUpdate->sType = (VkStructureType)0x99999999; /* Intentionally broken struct type */
- pSamplerUpdate->pNext = NULL;
- pSamplerUpdate->binding = 0;
- pSamplerUpdate->arrayIndex = 0;
- pSamplerUpdate->count = 1;
- pSamplerUpdate->pSamplers = &sampler;
- const void** ppUpdate = (const void**)&pSamplerUpdate;
- vkUpdateDescriptors(m_device->device(), descriptorSet, 1, ppUpdate);
+ descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER;
+ descriptor_write.pDescriptors = &descriptor_info;
+
+ vkUpdateDescriptorSets(m_device->device(), 1, &descriptor_write, 0, NULL);
+
msgType = m_errorMonitor->GetState(&msgString);
ASSERT_EQ(msgType, VK_DBG_MSG_ERROR) << "Did not receive error after updating Descriptor w/ invalid struct type.";
if (!strstr(msgString.c_str(),"Unexpected UPDATE struct of type ")) {
diff --git a/tests/render_tests.cpp b/tests/render_tests.cpp
index 3e6ad95..b7472e9 100644
--- a/tests/render_tests.cpp
+++ b/tests/render_tests.cpp
@@ -277,7 +277,7 @@
protected:
VkImage m_texture;
VkImageView m_textureView;
- VkImageViewAttachInfo m_textureViewInfo;
+ VkDescriptorInfo m_descriptorInfo;
VkDeviceMemory m_textureMem;
VkSampler m_sampler;
@@ -293,8 +293,7 @@
this->app_info.engineVersion = 1;
this->app_info.apiVersion = VK_API_VERSION;
- memset(&m_textureViewInfo, 0, sizeof(m_textureViewInfo));
- m_textureViewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_ATTACH_INFO;
+ memset(&m_descriptorInfo, 0, sizeof(m_descriptorInfo));
InitFramework();
}
diff --git a/tests/vkrenderframework.cpp b/tests/vkrenderframework.cpp
index 4dd04c6..5a1da2b 100644
--- a/tests/vkrenderframework.cpp
+++ b/tests/vkrenderframework.cpp
@@ -308,8 +308,8 @@
tc.count = 1;
m_type_counts.push_back(tc);
- m_updateBuffers.push_back(vk_testing::DescriptorSet::update(type,
- m_nextSlot, 0, 1, &constantBuffer.m_bufferViewInfo));
+ m_writes.push_back(vk_testing::Device::write_descriptor_set(vk_testing::DescriptorSet(),
+ m_nextSlot, 0, type, 1, &constantBuffer.m_descriptorInfo));
return m_nextSlot++;
}
@@ -321,13 +321,12 @@
tc.count = 1;
m_type_counts.push_back(tc);
- VkSamplerImageViewInfo tmp = {};
+ VkDescriptorInfo tmp = texture->m_descriptorInfo;
tmp.sampler = sampler->obj();
- tmp.pImageView = &texture->m_textureViewInfo;
- m_samplerTextureInfo.push_back(tmp);
+ m_imageSamplerDescriptors.push_back(tmp);
- m_updateSamplerTextures.push_back(vk_testing::DescriptorSet::update(m_nextSlot, 0, 1,
- (const VkSamplerImageViewInfo *) NULL));
+ m_writes.push_back(vk_testing::Device::write_descriptor_set(vk_testing::DescriptorSet(),
+ m_nextSlot, 0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, NULL));
return m_nextSlot++;
}
@@ -383,26 +382,24 @@
m_set = alloc_sets(*m_device, VK_DESCRIPTOR_SET_USAGE_STATIC, m_layout);
// build the update array
- vector<const void *> update_array;
-
- for (int i = 0; i < m_updateBuffers.size(); i++) {
- update_array.push_back(&m_updateBuffers[i]);
- }
- for (int i = 0; i < m_updateSamplerTextures.size(); i++) {
- m_updateSamplerTextures[i].pSamplerImageViews = &m_samplerTextureInfo[i];
- update_array.push_back(&m_updateSamplerTextures[i]);
+ size_t imageSamplerCount = 0;
+ for (std::vector<VkWriteDescriptorSet>::iterator it = m_writes.begin();
+ it != m_writes.end(); it++) {
+ it->destSet = m_set->obj();
+ if (it->descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)
+ it->pDescriptors = &m_imageSamplerDescriptors[imageSamplerCount++];
}
// do the updates
clear_sets(*m_set);
- m_set->update(update_array);
+ m_device->update_descriptor_sets(m_writes);
}
VkImageObj::VkImageObj(VkDeviceObj *dev)
{
m_device = dev;
- m_imageInfo.view = VK_NULL_HANDLE;
- m_imageInfo.layout = VK_IMAGE_LAYOUT_GENERAL;
+ m_descriptorInfo.imageView = VK_NULL_HANDLE;
+ m_descriptorInfo.imageLayout = VK_IMAGE_LAYOUT_GENERAL;
}
void VkImageObj::ImageMemoryBarrier(
@@ -461,7 +458,7 @@
VK_MEMORY_INPUT_DEPTH_STENCIL_ATTACHMENT_BIT |
VK_MEMORY_INPUT_TRANSFER_BIT;
- if (image_layout == m_imageInfo.layout) {
+ if (image_layout == m_descriptorInfo.imageLayout) {
return;
}
@@ -489,7 +486,7 @@
}
ImageMemoryBarrier(cmd_buf, aspect, output_mask, input_mask, image_layout);
- m_imageInfo.layout = image_layout;
+ m_descriptorInfo.imageLayout = image_layout;
}
void VkImageObj::SetLayout(VkImageAspect aspect,
@@ -660,9 +657,7 @@
if (colors == NULL)
colors = tex_colors;
- memset(&m_textureViewInfo,0,sizeof(m_textureViewInfo));
-
- m_textureViewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_ATTACH_INFO;
+ memset(&m_descriptorInfo,0,sizeof(m_descriptorInfo));
VkImageViewCreateInfo view = {};
view.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
@@ -687,7 +682,7 @@
/* create image view */
view.image = obj();
m_textureView.init(*m_device, view);
- m_textureViewInfo.view = m_textureView.obj();
+ m_descriptorInfo.imageView = m_textureView.obj();
data = stagingImage.map();
@@ -731,7 +726,7 @@
m_device = device;
m_commandBuffer = 0;
- memset(&m_bufferViewInfo,0,sizeof(m_bufferViewInfo));
+ memset(&m_descriptorInfo,0,sizeof(m_descriptorInfo));
}
VkConstantBufferObj::~VkConstantBufferObj()
@@ -747,7 +742,7 @@
m_device = device;
m_commandBuffer = 0;
- memset(&m_bufferViewInfo,0,sizeof(m_bufferViewInfo));
+ memset(&m_descriptorInfo,0,sizeof(m_descriptorInfo));
m_numVertices = constantCount;
m_stride = constantSize;
@@ -768,8 +763,7 @@
view_info.range = allocationSize;
m_bufferView.init(*m_device, view_info);
- this->m_bufferViewInfo.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_ATTACH_INFO;
- this->m_bufferViewInfo.view = m_bufferView.obj();
+ this->m_descriptorInfo.bufferView = m_bufferView.obj();
}
void VkConstantBufferObj::Bind(VkCmdBuffer cmdBuffer, VkDeviceSize offset, uint32_t binding)
@@ -888,8 +882,7 @@
view_info.range = allocationSize;
m_bufferView.init(*m_device, view_info);
- this->m_bufferViewInfo.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_ATTACH_INFO;
- this->m_bufferViewInfo.view = m_bufferView.obj();
+ this->m_descriptorInfo.bufferView = m_bufferView.obj();
}
void VkIndexBufferObj::Bind(VkCmdBuffer cmdBuffer, VkDeviceSize offset)
diff --git a/tests/vkrenderframework.h b/tests/vkrenderframework.h
index 587dba7..a265bc7 100644
--- a/tests/vkrenderframework.h
+++ b/tests/vkrenderframework.h
@@ -212,7 +212,7 @@
void Bind(VkCmdBuffer cmdBuffer, VkDeviceSize offset, uint32_t binding);
- VkBufferViewAttachInfo m_bufferViewInfo;
+ VkDescriptorInfo m_descriptorInfo;
protected:
VkDeviceObj *m_device;
@@ -251,7 +251,7 @@
void layout( VkImageLayout layout )
{
- m_imageInfo.layout = layout;
+ m_descriptorInfo.imageLayout = layout;
}
VkDeviceMemory memory() const
@@ -296,7 +296,7 @@
VkImageLayout layout() const
{
- return ( VkImageLayout )m_imageInfo.layout;
+ return m_descriptorInfo.imageLayout;
}
uint32_t width() const
{
@@ -318,15 +318,15 @@
VkDeviceObj *m_device;
vk_testing::ColorAttachmentView m_targetView;
- VkImageViewAttachInfo m_imageInfo;
+ VkDescriptorInfo m_descriptorInfo;
};
class VkTextureObj : public VkImageObj
{
public:
VkTextureObj(VkDeviceObj *device, uint32_t *colors = NULL);
- VkImageViewAttachInfo m_textureViewInfo;
+ VkDescriptorInfo m_descriptorInfo;
protected:
VkDeviceObj *m_device;
@@ -365,10 +365,8 @@
vector<VkDescriptorTypeCount> m_type_counts;
int m_nextSlot;
- vector<VkUpdateBuffers> m_updateBuffers;
-
- vector<VkSamplerImageViewInfo> m_samplerTextureInfo;
- vector<VkUpdateSamplerTextures> m_updateSamplerTextures;
+ vector<VkDescriptorInfo> m_imageSamplerDescriptors;
+ vector<VkWriteDescriptorSet> m_writes;
vk_testing::DescriptorSetLayout m_layout;
vk_testing::PipelineLayout m_pipeline_layout;
diff --git a/tests/vktestbinding.cpp b/tests/vktestbinding.cpp
index b0d83ca..8579b7e 100644
--- a/tests/vktestbinding.cpp
+++ b/tests/vktestbinding.cpp
@@ -488,6 +488,11 @@
return err;
}
+VkResult Device::update_descriptor_sets(const std::vector<VkWriteDescriptorSet> &writes, const std::vector<VkCopyDescriptorSet> &copies)
+{
+ return vkUpdateDescriptorSets(obj(), writes.size(), &writes[0], copies.size(), &copies[0]);
+}
+
void Queue::submit(const std::vector<const CmdBuffer *> &cmds, Fence &fence)
{
const std::vector<VkCmdBuffer> cmd_objs = make_objects<VkCmdBuffer>(cmds);
@@ -888,11 +893,6 @@
vkClearDescriptorSets(dev_->obj(), obj(), set_objs.size(), &set_objs[0]);
}
-void DescriptorSet::update(const std::vector<const void *> &update_array)
-{
- vkUpdateDescriptors(dev_->obj(), obj(), update_array.size(), const_cast<const void **>(&update_array[0]));
-}
-
void DynamicVpStateObject::init(const Device &dev, const VkDynamicVpStateCreateInfo &info)
{
DERIVED_OBJECT_TYPE_INIT(vkCreateDynamicViewportState, dev, VK_OBJECT_TYPE_DYNAMIC_VP_STATE, &info);
diff --git a/tests/vktestbinding.h b/tests/vktestbinding.h
index 93b2722..89aee53 100644
--- a/tests/vktestbinding.h
+++ b/tests/vktestbinding.h
@@ -235,6 +235,19 @@
VkResult wait(const std::vector<const Fence *> &fences, bool wait_all, uint64_t timeout);
VkResult wait(const Fence &fence) { return wait(std::vector<const Fence *>(1, &fence), true, (uint64_t) -1); }
+ // vkUpdateDescriptorSets()
+ VkResult update_descriptor_sets(const std::vector<VkWriteDescriptorSet> &writes, const std::vector<VkCopyDescriptorSet> &copies);
+ VkResult update_descriptor_sets(const std::vector<VkWriteDescriptorSet> &writes) { return update_descriptor_sets(writes, std::vector<VkCopyDescriptorSet>()); }
+
+ static VkWriteDescriptorSet write_descriptor_set(const DescriptorSet &set, uint32_t binding, uint32_t array_element,
+ VkDescriptorType type, uint32_t count, const VkDescriptorInfo *descriptors);
+ static VkWriteDescriptorSet write_descriptor_set(const DescriptorSet &set, uint32_t binding, uint32_t array_element,
+ VkDescriptorType type, const std::vector<VkDescriptorInfo> &descriptors);
+
+ static VkCopyDescriptorSet copy_descriptor_set(const DescriptorSet &src_set, uint32_t src_binding, uint32_t src_array_element,
+ const DescriptorSet &dst_set, uint32_t dst_binding, uint32_t dst_array_element,
+ uint32_t count);
+
private:
enum QueueIndex {
GRAPHICS,
@@ -548,27 +561,8 @@
class DescriptorSet : public DerivedObject<VkDescriptorSet, Object, VK_OBJECT_TYPE_DESCRIPTOR_SET> {
public:
+ explicit DescriptorSet() : DerivedObject() {}
explicit DescriptorSet(const Device &dev, VkDescriptorSet set) : DerivedObject(dev, set) {}
-
- // vkUpdateDescriptors()
- void update(const std::vector<const void *> &update_array);
-
- static VkUpdateSamplers update(uint32_t binding, uint32_t index, uint32_t count, const VkSampler *samplers);
- static VkUpdateSamplers update(uint32_t binding, uint32_t index, const std::vector<VkSampler> &samplers);
-
- static VkUpdateSamplerTextures update(uint32_t binding, uint32_t index, uint32_t count, const VkSamplerImageViewInfo *textures);
- static VkUpdateSamplerTextures update(uint32_t binding, uint32_t index, const std::vector<VkSamplerImageViewInfo> &textures);
-
- static VkUpdateImages update(VkDescriptorType type, uint32_t binding, uint32_t index, uint32_t count, const VkImageViewAttachInfo *views);
- static VkUpdateImages update(VkDescriptorType type, uint32_t binding, uint32_t index, const std::vector<VkImageViewAttachInfo> &views);
-
- static VkUpdateBuffers update(VkDescriptorType type, uint32_t binding, uint32_t index, uint32_t count, const VkBufferViewAttachInfo *views);
- static VkUpdateBuffers update(VkDescriptorType type, uint32_t binding, uint32_t index, const std::vector<VkBufferViewAttachInfo> &views);
-
- static VkUpdateAsCopy update(VkDescriptorType type, uint32_t binding, uint32_t index, uint32_t count, const DescriptorSet &set);
-
- static VkBufferViewAttachInfo attach_info(const BufferView &view);
- static VkImageViewAttachInfo attach_info(const ImageView &view, VkImageLayout layout);
};
class DynamicVpStateObject : public DerivedObject<VkDynamicVpState, DynamicStateObject, VK_OBJECT_TYPE_DYNAMIC_VP_STATE> {
@@ -792,103 +786,41 @@
return info;
}
-inline VkBufferViewAttachInfo DescriptorSet::attach_info(const BufferView &view)
+inline VkWriteDescriptorSet Device::write_descriptor_set(const DescriptorSet &set, uint32_t binding, uint32_t array_element,
+ VkDescriptorType type, uint32_t count, const VkDescriptorInfo *descriptors)
{
- VkBufferViewAttachInfo info = {};
- info.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_ATTACH_INFO;
- info.view = view.obj();
- return info;
+ VkWriteDescriptorSet write = {};
+ write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
+ write.destSet = set.obj();
+ write.destBinding = binding;
+ write.destArrayElement = array_element;
+ write.count = count;
+ write.descriptorType = type;
+ write.pDescriptors = descriptors;
+ return write;
}
-inline VkImageViewAttachInfo DescriptorSet::attach_info(const ImageView &view, VkImageLayout layout)
+inline VkWriteDescriptorSet Device::write_descriptor_set(const DescriptorSet &set, uint32_t binding, uint32_t array_element,
+ VkDescriptorType type, const std::vector<VkDescriptorInfo> &descriptors)
{
- VkImageViewAttachInfo info = {};
- info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_ATTACH_INFO;
- info.view = view.obj();
- info.layout = layout;
- return info;
+ return write_descriptor_set(set, binding, array_element, type, descriptors.size(), &descriptors[0]);
}
-inline VkUpdateSamplers DescriptorSet::update(uint32_t binding, uint32_t index, uint32_t count, const VkSampler *samplers)
+inline VkCopyDescriptorSet Device::copy_descriptor_set(const DescriptorSet &src_set, uint32_t src_binding, uint32_t src_array_element,
+ const DescriptorSet &dst_set, uint32_t dst_binding, uint32_t dst_array_element,
+ uint32_t count)
{
- VkUpdateSamplers info = {};
- info.sType = VK_STRUCTURE_TYPE_UPDATE_SAMPLERS;
- info.binding = binding;
- info.arrayIndex = index;
- info.count = count;
- info.pSamplers = samplers;
- return info;
-}
+ VkCopyDescriptorSet copy = {};
+ copy.sType = VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET;
+ copy.srcSet = src_set.obj();
+ copy.srcBinding = src_binding;
+ copy.srcArrayElement = src_array_element;
+ copy.destSet = dst_set.obj();
+ copy.destBinding = dst_binding;
+ copy.destArrayElement = dst_array_element;
+ copy.count = count;
-inline VkUpdateSamplers DescriptorSet::update(uint32_t binding, uint32_t index, const std::vector<VkSampler> &samplers)
-{
- return update(binding, index, samplers.size(), &samplers[0]);
-}
-
-inline VkUpdateSamplerTextures DescriptorSet::update(uint32_t binding, uint32_t index, uint32_t count, const VkSamplerImageViewInfo *textures)
-{
- VkUpdateSamplerTextures info = {};
- info.sType = VK_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES;
- info.binding = binding;
- info.arrayIndex = index;
- info.count = count;
- info.pSamplerImageViews = textures;
- return info;
-}
-
-inline VkUpdateSamplerTextures DescriptorSet::update(uint32_t binding, uint32_t index, const std::vector<VkSamplerImageViewInfo> &textures)
-{
- return update(binding, index, textures.size(), &textures[0]);
-}
-
-inline VkUpdateImages DescriptorSet::update(VkDescriptorType type, uint32_t binding, uint32_t index, uint32_t count,
- const VkImageViewAttachInfo *views)
-{
- VkUpdateImages info = {};
- info.sType = VK_STRUCTURE_TYPE_UPDATE_IMAGES;
- info.descriptorType = type;
- info.binding = binding;
- info.arrayIndex = index;
- info.count = count;
- info.pImageViews = views;
- return info;
-}
-
-inline VkUpdateImages DescriptorSet::update(VkDescriptorType type, uint32_t binding, uint32_t index,
- const std::vector<VkImageViewAttachInfo> &views)
-{
- return update(type, binding, index, views.size(), &views[0]);
-}
-
-inline VkUpdateBuffers DescriptorSet::update(VkDescriptorType type, uint32_t binding, uint32_t index, uint32_t count,
- const VkBufferViewAttachInfo *views)
-{
- VkUpdateBuffers info = {};
- info.sType = VK_STRUCTURE_TYPE_UPDATE_BUFFERS;
- info.descriptorType = type;
- info.binding = binding;
- info.arrayIndex = index;
- info.count = count;
- info.pBufferViews = views;
- return info;
-}
-
-inline VkUpdateBuffers DescriptorSet::update(VkDescriptorType type, uint32_t binding, uint32_t index,
- const std::vector<VkBufferViewAttachInfo> &views)
-{
- return update(type, binding, index, views.size(), &views[0]);
-}
-
-inline VkUpdateAsCopy DescriptorSet::update(VkDescriptorType type, uint32_t binding, uint32_t index, uint32_t count, const DescriptorSet &set)
-{
- VkUpdateAsCopy info = {};
- info.sType = VK_STRUCTURE_TYPE_UPDATE_AS_COPY;
- info.descriptorType = type;
- info.binding = binding;
- info.arrayElement = index;
- info.count = count;
- info.descriptorSet = set.obj();
- return info;
+ return copy;
}
inline VkCmdBufferCreateInfo CmdBuffer::create_info(uint32_t queueNodeIndex)