Graphics: Improve TextureSampler handling
This commit is contained in:
19
src/Nazara/Graphics/TextureSamplerCache.cpp
Normal file
19
src/Nazara/Graphics/TextureSamplerCache.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Graphics module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/TextureSamplerCache.hpp>
|
||||
#include <Nazara/Renderer/RenderDevice.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
const std::shared_ptr<TextureSampler>& TextureSamplerCache::Get(const TextureSamplerInfo& info)
|
||||
{
|
||||
auto it = m_samplers.find(info);
|
||||
if (it == m_samplers.end())
|
||||
it = m_samplers.emplace(info, m_device->InstantiateTextureSampler(info)).first;
|
||||
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user