diff --git a/kraken/KRSampler.cpp b/kraken/KRSampler.cpp index ae1fa57..60b51bc 100644 --- a/kraken/KRSampler.cpp +++ b/kraken/KRSampler.cpp @@ -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 sampler : m_samplers) { + if (sampler.first == handle) { + return sampler.second; + } + } + // TODO - Handle device context loss + assert(false); + return VK_NULL_HANDLE; } diff --git a/kraken/KRSampler.h b/kraken/KRSampler.h index 22c8e5c..a91975b 100644 --- a/kraken/KRSampler.h +++ b/kraken/KRSampler.h @@ -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> SamplerSet; + SamplerSet m_samplers; };