mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-22 13:25:51 +12:00
Add vulkan sampler cache
This commit is contained in:
parent
14b1d7d8a8
commit
7a86595a1b
3 changed files with 61 additions and 0 deletions
28
include/renderer_vk/vk_sampler_cache.hpp
Normal file
28
include/renderer_vk/vk_sampler_cache.hpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "helpers.hpp"
|
||||
#include "vk_api.hpp"
|
||||
|
||||
namespace Vulkan {
|
||||
// Implements a simple pool of reusable sampler objects
|
||||
class SamplerCache {
|
||||
private:
|
||||
const vk::Device device;
|
||||
|
||||
std::unordered_map<std::size_t, vk::UniqueSampler> samplerMap;
|
||||
|
||||
explicit SamplerCache(vk::Device device);
|
||||
|
||||
public:
|
||||
~SamplerCache() = default;
|
||||
|
||||
SamplerCache(SamplerCache&&) = default;
|
||||
|
||||
const vk::Sampler& getSampler(const vk::SamplerCreateInfo& samplerInfo);
|
||||
|
||||
static std::optional<SamplerCache> create(vk::Device device);
|
||||
};
|
||||
} // namespace Vulkan
|
Loading…
Add table
Add a link
Reference in a new issue