Renderer: Implement TextureUsage
This commit is contained in:
parent
311cfeaf3c
commit
b291f8a21c
|
|
@ -154,6 +154,26 @@ namespace Nz
|
||||||
TransferDestination,
|
TransferDestination,
|
||||||
Undefined
|
Undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class TextureUsage
|
||||||
|
{
|
||||||
|
ColorOutput,
|
||||||
|
DepthStencilOutput,
|
||||||
|
InputAttachment,
|
||||||
|
ShaderSampling,
|
||||||
|
TransferSource,
|
||||||
|
TransferDestination,
|
||||||
|
|
||||||
|
Max = TransferDestination
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct EnumAsFlags<TextureUsage>
|
||||||
|
{
|
||||||
|
static constexpr TextureUsage max = TextureUsage::Max;
|
||||||
|
};
|
||||||
|
|
||||||
|
using TextureUsageFlags = Flags<TextureUsage>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // NAZARA_ENUMS_RENDERER_HPP
|
#endif // NAZARA_ENUMS_RENDERER_HPP
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include <Nazara/Core/Resource.hpp>
|
#include <Nazara/Core/Resource.hpp>
|
||||||
#include <Nazara/Math/Vector3.hpp>
|
#include <Nazara/Math/Vector3.hpp>
|
||||||
#include <Nazara/Renderer/Config.hpp>
|
#include <Nazara/Renderer/Config.hpp>
|
||||||
|
#include <Nazara/Renderer/Enums.hpp>
|
||||||
#include <Nazara/Utility/Enums.hpp>
|
#include <Nazara/Utility/Enums.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
|
|
@ -19,6 +20,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
PixelFormat pixelFormat;
|
PixelFormat pixelFormat;
|
||||||
ImageType type;
|
ImageType type;
|
||||||
|
TextureUsageFlags usageFlags = TextureUsage::ShaderSampling | TextureUsage::TransferDestination;
|
||||||
UInt8 mipmapLevel = 1;
|
UInt8 mipmapLevel = 1;
|
||||||
unsigned int depth = 1;
|
unsigned int depth = 1;
|
||||||
unsigned int height;
|
unsigned int height;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace Nz
|
||||||
createInfo.mipLevels = params.mipmapLevel;
|
createInfo.mipLevels = params.mipmapLevel;
|
||||||
createInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
createInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
createInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
createInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
||||||
createInfo.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;
|
createInfo.usage = ToVulkan(params.usageFlags);
|
||||||
|
|
||||||
VkImageViewCreateInfo createInfoView = { VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO };
|
VkImageViewCreateInfo createInfoView = { VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO };
|
||||||
createInfoView.subresourceRange = {
|
createInfoView.subresourceRange = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue