1#pragma once
2
3#include <nn/gfx/detail/gfx_DataContainer.h>
4#include <nn/gfx/gfx_Common.h>
5#include <nn/gfx/gfx_Enum.h>
6#include <nn/gfx/gfx_TextureInfoData.h>
7
8namespace nn::gfx {
9
10class TextureSubresourceRange;
11class TextureArrayRange;
12
13class TextureInfo : public detail::DataContainer<TextureInfoData> {
14public:
15 TextureInfo() {}
16
17 void SetDefault();
18
19 void SetImageStorageDimension(ImageStorageDimension value) { imageStorageDimension = value; }
20 void SetImageFormat(ImageFormat value) { imageFormat = value; }
21 void SetGpuAccessFlags(int value) { gpuAccessFlags = value; }
22 void SetTileMode(TileMode value) { tileMode = value; }
23 void SetWidth(int value) { width = value; }
24 void SetHeight(int value) { height = value; }
25 void SetDepth(int value) { depth = value; }
26 void SetArrayLength(int value) { arrayLength = value; }
27 void SetSwizzle(int value) { swizzle = value; }
28 void SetMultiSampleCount(int value) { multisampleCount = value; }
29 void SetMipCount(int value) { mipCount = value; }
30
31 ImageStorageDimension GetImageStorageDimension() const {
32 return static_cast<ImageStorageDimension>(imageStorageDimension);
33 }
34
35 ImageFormat GetImageFormat() const { return static_cast<ImageFormat>(imageFormat); }
36 int GetGpuAccessFlags() const { return gpuAccessFlags; }
37 TileMode GetTileMode() const { return static_cast<TileMode>(tileMode); }
38 int GetWidth() const { return width; }
39 int GetHeight() const { return height; }
40 int GetDepth() const { return depth; }
41 int GetMipCount() const { return mipCount; }
42 int GetArrayLength() const { return arrayLength; }
43 int GetSwizzle() const { return swizzle; }
44 int GetMultisampleCount() const { return multisampleCount; }
45};
46
47class TextureViewInfo : public detail::DataContainer<TextureViewInfoData> {
48public:
49 TextureViewInfo() {}
50
51 void SetDefault();
52
53 void SetImageDimension(ImageDimension value) { imageDimension = value; }
54
55 void SetDepthStencilTextureMode(DepthStencilFetchMode value) {
56 depthStencilTextureMode = value;
57 }
58
59 void SetImageFormat(ImageFormat value) { imageFormat = value; }
60 void SetTexturePtr(const void* value) { pTexture = value; }
61
62 void SetChannelMapping(ChannelMapping red, ChannelMapping green, ChannelMapping blue,
63 ChannelMapping alpha) {
64 channelMapping[ColorChannel_Red] = red;
65 channelMapping[ColorChannel_Green] = green;
66 channelMapping[ColorChannel_Blue] = blue;
67 channelMapping[ColorChannel_Alpha] = alpha;
68 }
69
70 TextureSubresourceRange& EditSubresourceRange() {
71 return gfx::DataToAccessor(data&: subresourceRange);
72 }
73
74 ImageDimension GetImageDimension() const { return static_cast<ImageDimension>(imageDimension); }
75
76 DepthStencilFetchMode GetDepthStencilTextureMode() const {
77 return static_cast<DepthStencilFetchMode>(depthStencilTextureMode);
78 }
79
80 ImageFormat GetImageFormat() const { return static_cast<ImageFormat>(imageFormat); }
81
82 detail::Caster<const void> GetTexturePtr() const {
83 return detail::Caster<const void>(pTexture.ptr);
84 }
85
86 ChannelMapping GetChannelMapping(ColorChannel channel) const {
87 return static_cast<ChannelMapping>(channelMapping[channel]);
88 }
89
90 const TextureSubresourceRange& GetSubresourceRange() const {
91 return gfx::DataToAccessor(data: subresourceRange);
92 }
93};
94
95class ColorTargetViewInfo : public detail::DataContainer<ColorTargetViewInfoData> {
96public:
97 ColorTargetViewInfo() {}
98 void SetDefault();
99 void SetImageDimension(ImageDimension value) { imageDimension = value; }
100 void SetImageFormat(ImageFormat value) { imageFormat = value; }
101 void SetMipLevel(int value) { mipLevel = value; }
102 void SetTexturePtr(const void* value) { pTexture = value; }
103
104 TextureArrayRange& EditArrayRange() { return gfx::DataToAccessor(data&: arrayRange); }
105 ImageDimension GetImageDimension() const { return static_cast<ImageDimension>(imageDimension); }
106 ImageFormat GetImageFormat() const { return static_cast<ImageFormat>(imageFormat); }
107 int GetMipLevel() const { return mipLevel; }
108
109 detail::Caster<const void> GetTexturePtr() const {
110 return detail::Caster<const void>(pTexture.ptr);
111 }
112
113 const TextureArrayRange& GetArrayRange() const { return gfx::DataToAccessor(data: arrayRange); }
114};
115
116class DepthStencilViewInfo : public detail::DataContainer<DepthStencilViewInfoData> {
117public:
118 DepthStencilViewInfo() {}
119
120 void SetDefault();
121
122 void SetImageDimension(ImageDimension value) { imageDimension = value; }
123 void SetMipLevel(int value) { mipLevel = value; }
124 void SetTexturePtr(const void* value) { pTexture = value; }
125
126 TextureArrayRange& EditArrayRange() { return gfx::DataToAccessor(data&: arrayRange); }
127 ImageDimension GetImageDimension() const { return static_cast<ImageDimension>(imageDimension); }
128 int GetMipLevel() const { return mipLevel; }
129
130 detail::Caster<const void> GetTexturePtr() const {
131 return detail::Caster<const void>(pTexture.ptr);
132 }
133
134 const TextureArrayRange& GetArrayRange() const { return gfx::DataToAccessor(data: arrayRange); }
135
136 template <typename TTarget>
137 void SetTexturePtr(const TTexture<TTarget>*);
138};
139
140class TextureMipRange : public detail::DataContainer<TextureMipRangeData> {
141public:
142 TextureMipRange() {}
143
144 void SetDefault();
145
146 void SetMinMipLevel(int value) { minMipLevel = value; }
147 void SetMipCount(int value) { mipCount = value; }
148
149 int GetMinMipLevel() const { return minMipLevel; }
150 int GetMipCount() const { return mipCount; }
151};
152
153class TextureArrayRange : public detail::DataContainer<TextureArrayRangeData> {
154public:
155 TextureArrayRange() {}
156
157 void SetDefault();
158
159 void SetBaseArrayIndex(int value) { baseArrayIndex = value; }
160 void SetArrayLength(int value) { arrayLength = value; }
161
162 int GetBaseArrayIndex() const { return baseArrayIndex; }
163 int GetArrayLength() const { return arrayLength; }
164};
165
166class TextureSubresourceRange : public detail::DataContainer<TextureSubresourceRangeData> {
167public:
168 TextureSubresourceRange() {}
169
170 void SetDefault();
171
172 TextureMipRange& EditMipRange() { return gfx::DataToAccessor(data&: mipRange); }
173 TextureArrayRange& EditArrayRange() { return gfx::DataToAccessor(data&: arrayRange); }
174
175 const TextureMipRange& GetMipRange() const { return gfx::DataToAccessor(data: mipRange); }
176 const TextureArrayRange& GetArrayRange() const { return gfx::DataToAccessor(data: arrayRange); }
177};
178
179class TextureSubresource : public detail::DataContainer<TextureSubresourceData> {
180public:
181 TextureSubresource() {}
182
183 void SetDefault();
184
185 void SetMipLevel(int value) { mipLevel = value; }
186 void SetArrayIndex(int value) { arrayIndex = value; }
187
188 int GetMipLevel() const { return mipLevel; }
189 int GetArrayIndex() const { return arrayIndex; }
190};
191
192class TextureCopyRegion : public detail::DataContainer<TextureCopyRegionData> {
193public:
194 TextureCopyRegion() {}
195
196 void SetDefault();
197
198 void SetOffsetU(int value) { offsetU = value; }
199 void SetOffsetV(int value) { offsetV = value; }
200 void SetOffsetW(int value) { offsetW = value; }
201 void SetWidth(int value) { width = value; }
202 void SetHeight(int value) { height = value; }
203 void SetDepth(int value) { depth = value; }
204 TextureSubresource& EditSubresource() { return gfx::DataToAccessor(data&: subresource); }
205 void SetArrayLength(int value) { arrayLength = value; }
206
207 int GetOffsetU() const { return offsetU; }
208 int GetOffsetV() const { return offsetV; }
209 int GetOffsetW() const { return offsetW; }
210 int GetWidth() const { return width; }
211 int GetHeight() const { return height; }
212 int GetDepth() const { return depth; }
213
214 const TextureSubresource& GetSubresource() const { return gfx::DataToAccessor(data: subresource); }
215
216 int GetArrayLength() const { return arrayLength; }
217};
218
219class BufferTextureCopyRegion : public detail::DataContainer<BufferTextureCopyRegionData> {
220public:
221 BufferTextureCopyRegion() {}
222
223 void SetDefault();
224
225 void SetBufferOffset(int value) { bufferOffset = value; }
226 void SetBufferImageWidth(int value) { bufferImageWidth = value; }
227 void SetBufferImageHeight(int value) { bufferImageHeight = value; }
228
229 TextureCopyRegion& EditTextureCopyRegion() { return gfx::DataToAccessor(data&: textureCopyRegion); }
230
231 int GetBufferOffset() const { return bufferOffset; }
232 int GetBufferImageWidth() const { return bufferImageWidth; }
233 int GetBufferImageHeight() const { return bufferImageHeight; }
234
235 const TextureCopyRegion& GetTextureCopyRegion() const {
236 return gfx::DataToAccessor(data: textureCopyRegion);
237 }
238};
239
240} // namespace nn::gfx