Commit 246cc50b by Chris Forbes

BufferView has id in shared space with ImageViews

Avoids collisions in the dynamic sampling function cache. Change-Id: I41b5e5723c3f23f67722e006bdbc603ba1ba18f5 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31029Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Presubmit-Ready: Chris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent f469b67b
......@@ -17,6 +17,7 @@
#include "VkObject.hpp"
#include "VkFormat.h"
#include "VkImageView.hpp"
namespace vk
{
......@@ -37,6 +38,7 @@ public:
uint32_t getRangeInBytes() const { return range; }
VkFormat getFormat() const { return format; }
const uint32_t id = ImageView::nextID++; // ID space for sampling function cache, shared with imageviews
private:
VkBuffer buffer;
VkFormat format;
......
......@@ -307,7 +307,7 @@ void DescriptorSetLayout::WriteDescriptorSet(DescriptorSet *dstSet, VkDescriptor
auto bufferView = Cast(*update);
imageSampler[i].type = VK_IMAGE_VIEW_TYPE_1D;
imageSampler[i].imageViewId = 1; // FIXME: BufferViews need IDs in the same space as ImageViews
imageSampler[i].imageViewId = bufferView->id;
imageSampler[i].swizzle = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A };
imageSampler[i].format = bufferView->getFormat();
......
......@@ -75,6 +75,7 @@ public:
const uint32_t id = nextID++;
private:
static std::atomic<uint32_t> nextID;
friend class BufferView; // ImageView/BufferView share the ID space above.
bool imageTypesMatch(VkImageType imageType) const;
const Image* getImage(Usage usage) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment