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
36
#include "
Utility/Headers/ImageToolsFwd.h
"
37
#include "
Core/Resources/Headers/Resource.h
"
38
39
namespace
Divide
{
40
41
struct
SamplerDescriptor;
42
class
Texture;
43
44
struct
PixelAlignment
45
{
46
size_t
_alignment
{ 4u };
47
size_t
_rowLength
{ 0u };
48
size_t
_skipPixels
{ 0u };
49
size_t
_skipRows
{ 0u };
50
};
51
52
enum class
MipMappingState
:
U8
53
{
54
AUTO
= 0,
55
MANUAL
,
56
OFF
,
57
COUNT
58
};
59
62
template
<>
63
struct
PropertyDescriptor
<
Texture
>
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 };
71
TextureType
_texType{
TextureType::TEXTURE_2D
};
72
GFXDataFormat
_dataType{
GFXDataFormat::UNSIGNED_BYTE
};
73
GFXImagePacking
_packing{
GFXImagePacking::NORMALIZED
};
74
GFXImageFormat
_baseFormat{
GFXImageFormat::RGBA
};
75
MipMappingState
_mipMappingState{
MipMappingState::AUTO
};
76
U8
_msaaSamples{ 0u };
77
bool
_allowRegionUpdates{
false
};
78
};
79
80
using
TextureDescriptor
=
PropertyDescriptor<Texture>
;
81
82
template
<>
83
inline
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
"
ImageToolsFwd.h
Resource.h
TextureDescriptor.inl
Divide::Texture
An API-independent representation of a texture.
Definition:
Texture.h:83
Divide
Handle console commands that start with a forward slash.
Definition:
AIProcessor.cpp:7
Divide::ImageUsage
ImageUsage
Definition:
RenderAPIEnums.h:117
Divide::ImageUsage::SHADER_READ
@ SHADER_READ
Divide::Is1DTexture
bool Is1DTexture(TextureType texType) noexcept
Definition:
TextureDescriptor.inl:38
Divide::AppStepResult::COUNT
@ COUNT
Divide::IsNormalizedTexture
bool IsNormalizedTexture(GFXImagePacking packing) noexcept
Definition:
TextureDescriptor.inl:75
Divide::U8
uint8_t U8
Definition:
PlatformDataTypes.h:44
Divide::IsCubeTexture
bool IsCubeTexture(TextureType texType) noexcept
Definition:
TextureDescriptor.inl:56
Divide::IsArrayTexture
bool IsArrayTexture(TextureType texType) noexcept
Definition:
TextureDescriptor.inl:62
Divide::Is3DTexture
bool Is3DTexture(TextureType texType) noexcept
Definition:
TextureDescriptor.inl:50
Divide::GetHash
size_t GetHash(const PropertyDescriptor< T > &descriptor) noexcept
Definition:
Resource.inl:40
Divide::AddImageUsageFlag
void AddImageUsageFlag(PropertyDescriptor< Texture > &descriptor, const ImageUsage usage) noexcept
Definition:
TextureDescriptor.inl:123
Divide::Is2DTexture
bool Is2DTexture(TextureType texType) noexcept
Definition:
TextureDescriptor.inl:44
Divide::IsDepthTexture
bool IsDepthTexture(GFXImagePacking packing) noexcept
Definition:
TextureDescriptor.inl:69
Divide::GFXImagePacking
GFXImagePacking
Definition:
RenderAPIEnums.h:674
Divide::GFXImagePacking::NORMALIZED
@ NORMALIZED
Divide::U16
uint16_t U16
Definition:
PlatformDataTypes.h:45
Divide::TextureType
TextureType
Definition:
RenderAPIEnums.h:517
Divide::TextureType::TEXTURE_2D
@ TEXTURE_2D
Divide::GFXImageFormat
GFXImageFormat
Definition:
RenderAPIEnums.h:610
Divide::GFXImageFormat::RGBA
@ RGBA
Divide::RemoveImageUsageFlag
void RemoveImageUsageFlag(PropertyDescriptor< Texture > &descriptor, const ImageUsage usage) noexcept
Definition:
TextureDescriptor.inl:128
Divide::NumChannels
U8 NumChannels(GFXImageFormat format) noexcept
Definition:
TextureDescriptor.inl:85
Divide::IsCompressed
bool IsCompressed(GFXImageFormat format) noexcept
Definition:
TextureDescriptor.cpp:7
Divide::GFXDataFormat
GFXDataFormat
Definition:
RenderAPIEnums.h:652
Divide::GFXDataFormat::UNSIGNED_BYTE
@ UNSIGNED_BYTE
Divide::HasUsageFlagSet
bool HasUsageFlagSet(const PropertyDescriptor< Texture > &descriptor, const ImageUsage usage) noexcept
Definition:
TextureDescriptor.inl:133
Divide::HasAlphaChannel
bool HasAlphaChannel(GFXImageFormat format) noexcept
Definition:
TextureDescriptor.cpp:22
Divide::U32
uint32_t U32
Definition:
PlatformDataTypes.h:46
Divide::MipMappingState
MipMappingState
Definition:
TextureDescriptor.h:53
Divide::MipMappingState::OFF
@ OFF
Divide::MipMappingState::MANUAL
@ MANUAL
Divide::MipMappingState::AUTO
@ AUTO
Divide::SupportsZOffsetTexture
bool SupportsZOffsetTexture(TextureType texType) noexcept
Definition:
TextureDescriptor.inl:80
Divide::IsBGRTexture
bool IsBGRTexture(GFXImageFormat format) noexcept
Definition:
TextureDescriptor.inl:117
Divide::to_base
constexpr auto to_base(const Type value) -> Type
Definition:
PlatformDataTypes.h:228
Divide::ImageTools::ImportOptions
Definition:
ImageToolsFwd.h:65
Divide::PixelAlignment
Definition:
TextureDescriptor.h:45
Divide::PixelAlignment::_rowLength
size_t _rowLength
Definition:
TextureDescriptor.h:47
Divide::PixelAlignment::_skipPixels
size_t _skipPixels
Definition:
TextureDescriptor.h:48
Divide::PixelAlignment::_alignment
size_t _alignment
Definition:
TextureDescriptor.h:46
Divide::PixelAlignment::_skipRows
size_t _skipRows
Definition:
TextureDescriptor.h:49
Divide::PropertyDescriptor< Texture >
Definition:
TextureDescriptor.h:64
Divide::PropertyDescriptor
Definition:
Resource.h:116
Source
Platform
Video
Textures
Headers
TextureDescriptor.h
Generated on Fri May 17 2024 16:59:55 for Divide Framework by
1.9.6