Implement Texture and TextureSampler
This commit is contained in:
@@ -51,5 +51,6 @@
|
||||
#include <Nazara/Renderer/ShaderStageImpl.hpp>
|
||||
#include <Nazara/Renderer/ShaderWriter.hpp>
|
||||
#include <Nazara/Renderer/Texture.hpp>
|
||||
#include <Nazara/Renderer/TextureSampler.hpp>
|
||||
|
||||
#endif // NAZARA_GLOBAL_RENDERER_HPP
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <Nazara/Renderer/Enums.hpp>
|
||||
#include <Nazara/Renderer/RenderPipeline.hpp>
|
||||
#include <Nazara/Renderer/RenderPipelineLayout.hpp>
|
||||
#include <Nazara/Renderer/Texture.hpp>
|
||||
#include <Nazara/Renderer/TextureSampler.hpp>
|
||||
#include <Nazara/Utility/AbstractBuffer.hpp>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -31,6 +33,8 @@ namespace Nz
|
||||
virtual std::shared_ptr<RenderPipelineLayout> InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo) = 0;
|
||||
virtual std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize) = 0;
|
||||
std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const std::filesystem::path& sourcePath);
|
||||
virtual std::unique_ptr<Texture> InstantiateTexture(const TextureInfo& params) = 0;
|
||||
virtual std::unique_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -8,128 +8,40 @@
|
||||
#define NAZARA_TEXTURE_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/ObjectLibrary.hpp>
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceManager.hpp>
|
||||
#include <Nazara/Core/Signal.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
#include <Nazara/Utility/AbstractImage.hpp>
|
||||
#include <Nazara/Utility/CubemapParams.hpp>
|
||||
#include <Nazara/Utility/Image.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class Texture;
|
||||
|
||||
using TextureConstRef = ObjectRef<const Texture>;
|
||||
using TextureLibrary = ObjectLibrary<Texture>;
|
||||
using TextureManager = ResourceManager<Texture, ImageParams>;
|
||||
using TextureRef = ObjectRef<Texture>;
|
||||
|
||||
struct TextureImpl;
|
||||
|
||||
class NAZARA_RENDERER_API Texture : public AbstractImage, public Resource
|
||||
struct TextureInfo
|
||||
{
|
||||
friend TextureLibrary;
|
||||
friend TextureManager;
|
||||
friend class Renderer;
|
||||
PixelFormatType pixelFormat;
|
||||
ImageType type;
|
||||
unsigned int depth = 1;
|
||||
unsigned int height;
|
||||
unsigned int mipmapLevel = 1;
|
||||
unsigned int width;
|
||||
};
|
||||
|
||||
class NAZARA_RENDERER_API Texture : public Resource
|
||||
{
|
||||
public:
|
||||
Texture() = default;
|
||||
Texture(ImageType type, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth = 1, UInt8 levelCount = 1);
|
||||
Texture(const Texture&) = delete;
|
||||
Texture(Texture&&) = delete;
|
||||
~Texture();
|
||||
virtual ~Texture();
|
||||
|
||||
bool Create(ImageType type, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth = 1, UInt8 levelCount = 1);
|
||||
void Destroy();
|
||||
virtual PixelFormatType GetFormat() const = 0;
|
||||
virtual UInt8 GetLevelCount() const = 0;
|
||||
virtual Vector3ui GetSize(UInt8 level = 0) const = 0;
|
||||
virtual ImageType GetType() const = 0;
|
||||
|
||||
bool Download(Image* image) const;
|
||||
|
||||
bool EnableMipmapping(bool enable);
|
||||
|
||||
void EnsureMipmapsUpdate() const;
|
||||
|
||||
unsigned int GetDepth(UInt8 level = 0) const override;
|
||||
PixelFormatType GetFormat() const override;
|
||||
unsigned int GetHeight(UInt8 level = 0) const override;
|
||||
UInt8 GetLevelCount() const override;
|
||||
UInt8 GetMaxLevel() const override;
|
||||
std::size_t GetMemoryUsage() const override;
|
||||
std::size_t GetMemoryUsage(UInt8 level) const override;
|
||||
Vector3ui GetSize(UInt8 level = 0) const override;
|
||||
ImageType GetType() const override;
|
||||
unsigned int GetWidth(UInt8 level = 0) const override;
|
||||
|
||||
bool HasMipmaps() const;
|
||||
|
||||
void InvalidateMipmaps();
|
||||
bool IsValid() const;
|
||||
|
||||
// LoadFace
|
||||
bool LoadFaceFromFile(CubemapFace face, const std::filesystem::path& filePath, const ImageParams& params = ImageParams());
|
||||
bool LoadFaceFromMemory(CubemapFace face, const void* data, std::size_t size, const ImageParams& params = ImageParams());
|
||||
bool LoadFaceFromStream(CubemapFace face, Stream& stream, const ImageParams& params = ImageParams());
|
||||
|
||||
// Save
|
||||
bool SaveToFile(const std::filesystem::path& filePath, const ImageParams& params = ImageParams());
|
||||
bool SaveToStream(Stream& stream, const std::string& format, const ImageParams& params = ImageParams());
|
||||
|
||||
bool SetMipmapRange(UInt8 minLevel, UInt8 maxLevel);
|
||||
|
||||
bool Update(const Image* image, UInt8 level = 0);
|
||||
bool Update(const Image* image, const Boxui& box, UInt8 level = 0);
|
||||
bool Update(const Image* image, const Rectui& rect, unsigned int z = 0, UInt8 level = 0);
|
||||
bool Update(const UInt8* pixels, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) override;
|
||||
bool Update(const UInt8* pixels, const Boxui& box, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) override;
|
||||
bool Update(const UInt8* pixels, const Rectui& rect, unsigned int z = 0, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) override;
|
||||
|
||||
// Fonctions OpenGL
|
||||
unsigned int GetOpenGLID() const;
|
||||
virtual bool Update(const void* ptr) = 0;
|
||||
|
||||
Texture& operator=(const Texture&) = delete;
|
||||
Texture& operator=(Texture&&) = delete;
|
||||
|
||||
static bool IsFormatSupported(PixelFormatType format);
|
||||
static bool IsMipmappingSupported();
|
||||
static bool IsTypeSupported(ImageType type);
|
||||
|
||||
// Load
|
||||
static TextureRef LoadFromFile(const std::filesystem::path& filePath, const ImageParams& params = ImageParams(), bool generateMipmaps = true);
|
||||
static TextureRef LoadFromImage(const Image* image, bool generateMipmaps = true);
|
||||
static TextureRef LoadFromMemory(const void* data, std::size_t size, const ImageParams& params = ImageParams(), bool generateMipmaps = true);
|
||||
static TextureRef LoadFromStream(Stream& stream, const ImageParams& params = ImageParams(), bool generateMipmaps = true);
|
||||
|
||||
// LoadArray
|
||||
static TextureRef LoadArrayFromFile(const std::filesystem::path& filePath, const ImageParams& imageParams = ImageParams(), bool generateMipmaps = true, const Vector2ui& atlasSize = Vector2ui(2, 2));
|
||||
static TextureRef LoadArrayFromImage(const Image* image, bool generateMipmaps = true, const Vector2ui& atlasSize = Vector2ui(2, 2));
|
||||
static TextureRef LoadArrayFromMemory(const void* data, std::size_t size, const ImageParams& imageParams = ImageParams(), bool generateMipmaps = true, const Vector2ui& atlasSize = Vector2ui(2, 2));
|
||||
static TextureRef LoadArrayFromStream(Stream& stream, const ImageParams& imageParams = ImageParams(), bool generateMipmaps = true, const Vector2ui& atlasSize = Vector2ui(2, 2));
|
||||
|
||||
// LoadCubemap
|
||||
static TextureRef LoadCubemapFromFile(const std::filesystem::path& filePath, const ImageParams& imageParams = ImageParams(), bool generateMipmaps = true, const CubemapParams& cubemapParams = CubemapParams());
|
||||
static TextureRef LoadCubemapFromImage(const Image* image, bool generateMipmaps = true, const CubemapParams& params = CubemapParams());
|
||||
static TextureRef LoadCubemapFromMemory(const void* data, std::size_t size, const ImageParams& imageParams = ImageParams(), bool generateMipmaps = true, const CubemapParams& cubemapParams = CubemapParams());
|
||||
static TextureRef LoadCubemapFromStream(Stream& stream, const ImageParams& imageParams = ImageParams(), bool generateMipmaps = true, const CubemapParams& cubemapParams = CubemapParams());
|
||||
|
||||
template<typename... Args> static TextureRef New(Args&&... args);
|
||||
|
||||
// Signals:
|
||||
NazaraSignal(OnTextureDestroy, const Texture* /*texture*/);
|
||||
NazaraSignal(OnTextureRelease, const Texture* /*texture*/);
|
||||
|
||||
private:
|
||||
bool CreateTexture(bool proxy);
|
||||
|
||||
static bool Initialize();
|
||||
static void Uninitialize();
|
||||
|
||||
TextureImpl* m_impl = nullptr;
|
||||
|
||||
static TextureLibrary::LibraryMap s_library;
|
||||
static TextureManager::ManagerMap s_managerMap;
|
||||
static TextureManager::ManagerParams s_managerParameters;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
12
include/Nazara/Renderer/Texture.inl
Normal file
12
include/Nazara/Renderer/Texture.inl
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Renderer/Texture.hpp>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/DebugOff.hpp>
|
||||
42
include/Nazara/Renderer/TextureSampler.hpp
Normal file
42
include/Nazara/Renderer/TextureSampler.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_TEXTURE_SAMPLER_HPP
|
||||
#define NAZARA_TEXTURE_SAMPLER_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
struct TextureSamplerInfo
|
||||
{
|
||||
float anisotropyLevel = 0.f;
|
||||
SamplerFilter magFilter = SamplerFilter_Linear;
|
||||
SamplerFilter minFilter = SamplerFilter_Linear;
|
||||
SamplerMipmapMode mipmapMode = SamplerMipmapMode_Linear;
|
||||
SamplerWrap wrapModeU = SamplerWrap_Clamp;
|
||||
SamplerWrap wrapModeV = SamplerWrap_Clamp;
|
||||
SamplerWrap wrapModeW = SamplerWrap_Clamp;
|
||||
};
|
||||
|
||||
class NAZARA_RENDERER_API TextureSampler
|
||||
{
|
||||
public:
|
||||
TextureSampler() = default;
|
||||
TextureSampler(const TextureSampler&) = delete;
|
||||
TextureSampler(TextureSampler&&) = delete;
|
||||
virtual ~TextureSampler();
|
||||
|
||||
TextureSampler& operator=(const TextureSampler&) = delete;
|
||||
TextureSampler& operator=(TextureSampler&&) = delete;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/TextureSampler.inl>
|
||||
|
||||
#endif // NAZARA_TEXTURE_HPP
|
||||
12
include/Nazara/Renderer/TextureSampler.inl
Normal file
12
include/Nazara/Renderer/TextureSampler.inl
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Renderer/TextureSampler.hpp>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/DebugOff.hpp>
|
||||
@@ -286,27 +286,26 @@ namespace Nz
|
||||
|
||||
enum SamplerFilter
|
||||
{
|
||||
SamplerFilter_Unknown = -1,
|
||||
|
||||
SamplerFilter_Bilinear,
|
||||
SamplerFilter_Linear,
|
||||
SamplerFilter_Nearest,
|
||||
SamplerFilter_Trilinear,
|
||||
|
||||
SamplerFilter_Default,
|
||||
SamplerFilter_Max = SamplerFilter_Nearest
|
||||
};
|
||||
|
||||
SamplerFilter_Max = SamplerFilter_Default
|
||||
enum SamplerMipmapMode
|
||||
{
|
||||
SamplerMipmapMode_Linear,
|
||||
SamplerMipmapMode_Nearest,
|
||||
|
||||
SamplerMipmapMode_Max = SamplerMipmapMode_Nearest
|
||||
};
|
||||
|
||||
enum SamplerWrap
|
||||
{
|
||||
SamplerWrap_Unknown = -1,
|
||||
|
||||
SamplerWrap_Clamp,
|
||||
SamplerWrap_MirroredRepeat,
|
||||
SamplerWrap_Repeat,
|
||||
|
||||
SamplerWrap_Default,
|
||||
|
||||
SamplerWrap_Max = SamplerWrap_Repeat
|
||||
};
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include <Nazara/VulkanRenderer/VulkanRenderPipelineLayout.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanShaderStage.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanSurface.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanTexture.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanTextureSampler.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanUploadPool.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper.hpp>
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ namespace Nz
|
||||
inline VkPolygonMode ToVulkan(FaceFilling faceFilling);
|
||||
inline VkPrimitiveTopology ToVulkan(PrimitiveMode primitiveMode);
|
||||
inline VkCompareOp ToVulkan(RendererComparison comparison);
|
||||
inline VkFilter ToVulkan(SamplerFilter samplerFilter);
|
||||
inline VkSamplerMipmapMode ToVulkan(SamplerMipmapMode samplerMipmap);
|
||||
inline VkSamplerAddressMode ToVulkan(SamplerWrap samplerWrap);
|
||||
inline VkDescriptorType ToVulkan(ShaderBindingType bindingType);
|
||||
inline VkShaderStageFlagBits ToVulkan(ShaderStageType stageType);
|
||||
inline VkShaderStageFlags ToVulkan(ShaderStageTypeFlags stageType);
|
||||
|
||||
@@ -108,6 +108,43 @@ namespace Nz
|
||||
return VK_COMPARE_OP_NEVER;
|
||||
}
|
||||
|
||||
VkFilter ToVulkan(SamplerFilter samplerFilter)
|
||||
{
|
||||
switch (samplerFilter)
|
||||
{
|
||||
case SamplerFilter_Linear: return VK_FILTER_LINEAR;
|
||||
case SamplerFilter_Nearest: return VK_FILTER_NEAREST;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled SamplerFilter 0x" + String::Number(UnderlyingCast(samplerFilter), 16));
|
||||
return VK_FILTER_NEAREST;
|
||||
}
|
||||
|
||||
VkSamplerMipmapMode ToVulkan(SamplerMipmapMode samplerMipmap)
|
||||
{
|
||||
switch (samplerMipmap)
|
||||
{
|
||||
case SamplerMipmapMode_Linear: return VK_SAMPLER_MIPMAP_MODE_LINEAR;
|
||||
case SamplerMipmapMode_Nearest: return VK_SAMPLER_MIPMAP_MODE_NEAREST;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled SamplerMipmapMode 0x" + String::Number(UnderlyingCast(samplerMipmap), 16));
|
||||
return VK_SAMPLER_MIPMAP_MODE_NEAREST;
|
||||
}
|
||||
|
||||
VkSamplerAddressMode ToVulkan(SamplerWrap samplerWrap)
|
||||
{
|
||||
switch (samplerWrap)
|
||||
{
|
||||
case SamplerWrap_Clamp: return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
|
||||
case SamplerWrap_MirroredRepeat: return VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT;
|
||||
case SamplerWrap_Repeat: return VK_SAMPLER_ADDRESS_MODE_REPEAT;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled SamplerWrap 0x" + String::Number(UnderlyingCast(samplerWrap), 16));
|
||||
return VK_SAMPLER_ADDRESS_MODE_REPEAT;
|
||||
}
|
||||
|
||||
VkDescriptorType ToVulkan(ShaderBindingType bindingType)
|
||||
{
|
||||
switch (bindingType)
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace Nz
|
||||
std::unique_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) override;
|
||||
std::shared_ptr<RenderPipelineLayout> InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo) override;
|
||||
std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize) override;
|
||||
std::unique_ptr<Texture> InstantiateTexture(const TextureInfo& params) override;
|
||||
std::unique_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) override;
|
||||
|
||||
VulkanDevice& operator=(const VulkanDevice&) = delete;
|
||||
VulkanDevice& operator=(VulkanDevice&&) = delete; ///TODO?
|
||||
|
||||
51
include/Nazara/VulkanRenderer/VulkanTexture.hpp
Normal file
51
include/Nazara/VulkanRenderer/VulkanTexture.hpp
Normal file
@@ -0,0 +1,51 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_VULKANRENDERER_VULKANTEXTURE_HPP
|
||||
#define NAZARA_VULKANRENDERER_VULKANTEXTURE_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/Texture.hpp>
|
||||
#include <Nazara/VulkanRenderer/Config.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Image.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/ImageView.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_VULKANRENDERER_API VulkanTexture : public Texture
|
||||
{
|
||||
public:
|
||||
VulkanTexture(Vk::Device& device, const TextureInfo& params);
|
||||
VulkanTexture(const VulkanTexture&) = default;
|
||||
VulkanTexture(VulkanTexture&&) noexcept = default;
|
||||
~VulkanTexture();
|
||||
|
||||
PixelFormatType GetFormat() const override;
|
||||
inline VkImage GetImage() const;
|
||||
inline VkImageView GetImageView() const;
|
||||
UInt8 GetLevelCount() const override;
|
||||
Vector3ui GetSize(UInt8 level = 0) const override;
|
||||
ImageType GetType() const override;
|
||||
|
||||
bool Update(const void* ptr) override;
|
||||
|
||||
VulkanTexture& operator=(const VulkanTexture&) = delete;
|
||||
VulkanTexture& operator=(VulkanTexture&&) = delete;
|
||||
|
||||
private:
|
||||
static void InitForFormat(PixelFormatType pixelFormat, VkImageCreateInfo& createImage, VkImageViewCreateInfo& createImageView);
|
||||
|
||||
VkImage m_image;
|
||||
VmaAllocation m_allocation;
|
||||
Vk::Device& m_device;
|
||||
Vk::ImageView m_imageView;
|
||||
TextureInfo m_params;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/VulkanRenderer/VulkanTexture.inl>
|
||||
|
||||
#endif // NAZARA_VULKANRENDERER_VULKANTEXTURE_HPP
|
||||
21
include/Nazara/VulkanRenderer/VulkanTexture.inl
Normal file
21
include/Nazara/VulkanRenderer/VulkanTexture.inl
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Vulkan Renderer"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/VulkanRenderer/VulkanTexture.hpp>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline VkImage VulkanTexture::GetImage() const
|
||||
{
|
||||
return m_image;
|
||||
}
|
||||
|
||||
inline VkImageView VulkanTexture::GetImageView() const
|
||||
{
|
||||
return m_imageView;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/VulkanRenderer/DebugOff.hpp>
|
||||
36
include/Nazara/VulkanRenderer/VulkanTextureSampler.hpp
Normal file
36
include/Nazara/VulkanRenderer/VulkanTextureSampler.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_VULKANRENDERER_VULKANTEXTURESAMPLER_HPP
|
||||
#define NAZARA_VULKANRENDERER_VULKANTEXTURESAMPLER_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/TextureSampler.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Sampler.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_VULKANRENDERER_API VulkanTextureSampler : public TextureSampler
|
||||
{
|
||||
public:
|
||||
VulkanTextureSampler(Vk::Device& device, TextureSamplerInfo samplerInfo);
|
||||
VulkanTextureSampler(const VulkanTextureSampler&) = default;
|
||||
VulkanTextureSampler(VulkanTextureSampler&&) noexcept = default;
|
||||
~VulkanTextureSampler() = default;
|
||||
|
||||
inline VkSampler GetSampler() const;
|
||||
|
||||
VulkanTextureSampler& operator=(const VulkanTextureSampler&) = delete;
|
||||
VulkanTextureSampler& operator=(VulkanTextureSampler&&) = delete;
|
||||
|
||||
private:
|
||||
Vk::Sampler m_sampler;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/VulkanRenderer/VulkanTextureSampler.inl>
|
||||
|
||||
#endif // NAZARA_VULKANRENDERER_VULKANTEXTURESAMPLER_HPP
|
||||
16
include/Nazara/VulkanRenderer/VulkanTextureSampler.inl
Normal file
16
include/Nazara/VulkanRenderer/VulkanTextureSampler.inl
Normal file
@@ -0,0 +1,16 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Vulkan Renderer"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/VulkanRenderer/VulkanShaderBinding.hpp>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline VkSampler VulkanTextureSampler::GetSampler() const
|
||||
{
|
||||
return m_sampler;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/VulkanRenderer/DebugOff.hpp>
|
||||
Reference in New Issue
Block a user