Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
TextureDescriptor.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef DVD_TEXTURE_DESCRIPTOR_H_
34#define DVD_TEXTURE_DESCRIPTOR_H_
35
38
39namespace Divide {
40
41struct SamplerDescriptor;
42class Texture;
43
45{
46 size_t _alignment{ 4u };
47 size_t _rowLength{ 0u };
48 size_t _skipPixels{ 0u };
49 size_t _skipRows{ 0u };
50};
51
52enum class MipMappingState : U8
53{
54 AUTO = 0,
55 MANUAL,
56 OFF,
57 COUNT
58};
59
62template<>
64{
65 public:
66
67 ImageTools::ImportOptions _textureOptions{};
68 U32 _usageMask{ 1u << to_base(ImageUsage::SHADER_READ) };
69 U16 _layerCount{ 0u };
70 U16 _mipBaseLevel{ 0u };
76 U8 _msaaSamples{ 0u };
77 bool _allowRegionUpdates{ false };
78};
79
81
82template<>
83inline size_t GetHash( const PropertyDescriptor<Texture>& descriptor ) noexcept;
84
85 void AddImageUsageFlag( PropertyDescriptor<Texture>& descriptor, const ImageUsage usage ) noexcept;
86 void RemoveImageUsageFlag( PropertyDescriptor<Texture>& descriptor, const ImageUsage usage ) noexcept;
87[[nodiscard]] bool HasUsageFlagSet( const PropertyDescriptor<Texture>& descriptor, const ImageUsage usage ) noexcept;
88
89[[nodiscard]] bool IsCompressed(GFXImageFormat format) noexcept;
90[[nodiscard]] bool HasAlphaChannel (GFXImageFormat format) noexcept;
91
92[[nodiscard]] bool Is1DTexture(TextureType texType) noexcept;
93[[nodiscard]] bool Is2DTexture(TextureType texType) noexcept;
94[[nodiscard]] bool Is3DTexture(TextureType texType) noexcept;
95[[nodiscard]] bool IsCubeTexture(TextureType texType) noexcept;
96[[nodiscard]] bool IsArrayTexture(TextureType texType) noexcept;
97[[nodiscard]] bool IsNormalizedTexture(GFXImagePacking packing) noexcept;
98[[nodiscard]] bool IsDepthTexture(GFXImagePacking packing) noexcept;
99[[nodiscard]] bool SupportsZOffsetTexture(TextureType texType) noexcept;
100[[nodiscard]] bool IsBGRTexture(GFXImageFormat format) noexcept;
101[[nodiscard]] U8 NumChannels(GFXImageFormat format) noexcept;
102
103} // namespace Divide
104
105#endif //DVD_TEXTURE_DESCRIPTOR_H_
106
107#include "TextureDescriptor.inl"
An API-independent representation of a texture.
Definition: Texture.h:83
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
bool Is1DTexture(TextureType texType) noexcept
bool IsNormalizedTexture(GFXImagePacking packing) noexcept
uint8_t U8
bool IsCubeTexture(TextureType texType) noexcept
bool IsArrayTexture(TextureType texType) noexcept
bool Is3DTexture(TextureType texType) noexcept
size_t GetHash(const PropertyDescriptor< T > &descriptor) noexcept
Definition: Resource.inl:40
void AddImageUsageFlag(PropertyDescriptor< Texture > &descriptor, const ImageUsage usage) noexcept
bool Is2DTexture(TextureType texType) noexcept
bool IsDepthTexture(GFXImagePacking packing) noexcept
uint16_t U16
void RemoveImageUsageFlag(PropertyDescriptor< Texture > &descriptor, const ImageUsage usage) noexcept
U8 NumChannels(GFXImageFormat format) noexcept
bool IsCompressed(GFXImageFormat format) noexcept
bool HasUsageFlagSet(const PropertyDescriptor< Texture > &descriptor, const ImageUsage usage) noexcept
bool HasAlphaChannel(GFXImageFormat format) noexcept
uint32_t U32
bool SupportsZOffsetTexture(TextureType texType) noexcept
bool IsBGRTexture(GFXImageFormat format) noexcept
constexpr auto to_base(const Type value) -> Type