Add sample TexelBuffer; adjust vk::su::updateDescriptorSets (#352)

This commit is contained in:
Andreas Süßenbach
2019-07-03 09:23:56 +02:00
committed by Markus Tavenrath
parent d811c3a7e2
commit 5414a2e232
12 changed files with 248 additions and 19 deletions

View File

@@ -527,8 +527,8 @@ namespace vk
;
}
void updateDescriptorSets(vk::UniqueDevice const& device, vk::UniqueDescriptorSet const& descriptorSet, std::map<vk::DescriptorType, vk::UniqueBuffer const&> const& bufferData,
vk::su::TextureData const& textureData)
void updateDescriptorSets(vk::UniqueDevice const& device, vk::UniqueDescriptorSet const& descriptorSet,
std::vector<std::tuple<vk::DescriptorType, vk::UniqueBuffer const&, vk::UniqueBufferView const&>> const& bufferData, vk::su::TextureData const& textureData)
{
std::vector<vk::DescriptorBufferInfo> bufferInfos;
bufferInfos.reserve(bufferData.size());
@@ -538,8 +538,8 @@ namespace vk
uint32_t dstBinding = 0;
for (auto const& bd : bufferData)
{
bufferInfos.push_back(vk::DescriptorBufferInfo(*bd.second, 0, VK_WHOLE_SIZE));
writeDescriptorSets.push_back(vk::WriteDescriptorSet(*descriptorSet, dstBinding++, 0, 1, bd.first, nullptr, &bufferInfos.back()));
bufferInfos.push_back(vk::DescriptorBufferInfo(*std::get<1>(bd), 0, VK_WHOLE_SIZE));
writeDescriptorSets.push_back(vk::WriteDescriptorSet(*descriptorSet, dstBinding++, 0, 1, std::get<0>(bd), nullptr, &bufferInfos.back(), std::get<2>(bd) ? &*std::get<2>(bd) : nullptr));
}
vk::DescriptorImageInfo imageInfo(*textureData.textureSampler, *textureData.imageData->imageView, vk::ImageLayout::eShaderReadOnlyOptimal);
@@ -548,7 +548,8 @@ namespace vk
device->updateDescriptorSets(writeDescriptorSets, nullptr);
}
void updateDescriptorSets(vk::UniqueDevice const& device, vk::UniqueDescriptorSet const& descriptorSet, std::map<vk::DescriptorType, vk::UniqueBuffer const&> const& bufferData,
void updateDescriptorSets(vk::UniqueDevice const& device, vk::UniqueDescriptorSet const& descriptorSet,
std::vector<std::tuple<vk::DescriptorType, vk::UniqueBuffer const&, vk::UniqueBufferView const&>> const& bufferData,
std::vector<vk::su::TextureData> const& textureData)
{
std::vector<vk::DescriptorBufferInfo> bufferInfos;
@@ -559,8 +560,8 @@ namespace vk
uint32_t dstBinding = 0;
for (auto const& bd : bufferData)
{
bufferInfos.push_back(vk::DescriptorBufferInfo(*bd.second, 0, VK_WHOLE_SIZE));
writeDescriptorSets.push_back(vk::WriteDescriptorSet(*descriptorSet, dstBinding++, 0, 1, bd.first, nullptr, &bufferInfos.back()));
bufferInfos.push_back(vk::DescriptorBufferInfo(*std::get<1>(bd), 0, VK_WHOLE_SIZE));
writeDescriptorSets.push_back(vk::WriteDescriptorSet(*descriptorSet, dstBinding++, 0, 1, std::get<0>(bd), nullptr, &bufferInfos.back(), std::get<2>(bd) ? &*std::get<2>(bd) : nullptr));
}
std::vector<vk::DescriptorImageInfo> imageInfos;

View File

@@ -275,9 +275,10 @@ namespace vk
vk::SurfaceFormatKHR pickSurfaceFormat(std::vector<vk::SurfaceFormatKHR> const& formats);
void setImageLayout(vk::UniqueCommandBuffer const& commandBuffer, vk::Image image, vk::Format format, vk::ImageLayout oldImageLayout, vk::ImageLayout newImageLayout);
void submitAndWait(vk::UniqueDevice &device, vk::Queue queue, vk::UniqueCommandBuffer &commandBuffer);
void updateDescriptorSets(vk::UniqueDevice const& device, vk::UniqueDescriptorSet const& descriptorSet, std::map<vk::DescriptorType, vk::UniqueBuffer const&> const& bufferData,
vk::su::TextureData const& textureData);
void updateDescriptorSets(vk::UniqueDevice const& device, vk::UniqueDescriptorSet const& descriptorSet, std::map<vk::DescriptorType, vk::UniqueBuffer const&> const& bufferData,
void updateDescriptorSets(vk::UniqueDevice const& device, vk::UniqueDescriptorSet const& descriptorSet,
std::vector<std::tuple<vk::DescriptorType, vk::UniqueBuffer const&, vk::UniqueBufferView const&>> const& bufferData, vk::su::TextureData const& textureData);
void updateDescriptorSets(vk::UniqueDevice const& device, vk::UniqueDescriptorSet const& descriptorSet,
std::vector<std::tuple<vk::DescriptorType, vk::UniqueBuffer const&, vk::UniqueBufferView const&>> const& bufferData,
std::vector<vk::su::TextureData> const& textureData);
#if defined(VK_USE_PLATFORM_WIN32_KHR)