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) KRSampler::KRSampler(KRContext& context, const SamplerInfo& info)
: KRContextObject(context) : KRContextObject(context)
, m_sampler(VK_NULL_HANDLE)
{ {
// TODO - Implement stub function // TODO - Implement stub function
} }
@@ -44,7 +43,14 @@ KRSampler::~KRSampler()
// TODO - Implement stub function // 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); KRSampler(KRContext& context, const SamplerInfo& info);
virtual ~KRSampler(); virtual ~KRSampler();
VkSampler& getSampler(); VkSampler getSampler(KrDeviceHandle &handle);
private: private:
typedef std::vector<std::pair<KrDeviceHandle, VkSampler>> SamplerSet;
VkSampler m_sampler; SamplerSet m_samplers;
}; };