Implemented KRSampler::getSampler

This commit is contained in:
2022-08-29 23:59:02 -07:00
parent e318a5b4aa
commit 0e5fee2d80
2 changed files with 12 additions and 6 deletions

View File

@@ -34,7 +34,6 @@
KRSampler::KRSampler(KRContext& context, const SamplerInfo& info)
: KRContextObject(context)
, m_sampler(VK_NULL_HANDLE)
{
// TODO - Implement stub function
}
@@ -44,7 +43,14 @@ KRSampler::~KRSampler()
// TODO - Implement stub function
}
VkSampler& KRSampler::getSampler()
VkSampler KRSampler::getSampler(KrDeviceHandle& handle)
{
return m_sampler;
for (std::pair<KrDeviceHandle, VkSampler> sampler : m_samplers) {
if (sampler.first == handle) {
return sampler.second;
}
}
// TODO - Handle device context loss
assert(false);
return VK_NULL_HANDLE;
}

View File

@@ -44,9 +44,9 @@ public:
KRSampler(KRContext& context, const SamplerInfo& info);
virtual ~KRSampler();
VkSampler& getSampler();
VkSampler getSampler(KrDeviceHandle &handle);
private:
VkSampler m_sampler;
typedef std::vector<std::pair<KrDeviceHandle, VkSampler>> SamplerSet;
SamplerSet m_samplers;
};