git.s-ol.nu forks/DiligentCore / d31dc00
Reworked main headers to be compatible with c assiduous 3 years ago
152 changed file(s) with 4303 addition(s) and 3161 deletion(s). Raw diff Collapse all Expand all
3232 #include "../../Primitives/interface/FileStream.h"
3333 #include "../../Primitives/interface/DataBlob.h"
3434 #include "ObjectBase.h"
35 #include "RefCountedObjectImpl.h"
3635 #include "FileWrapper.h"
3736
3837 namespace Diligent
7272 bool IsES30 = false;
7373 bool IsES31OrAbove = false;
7474 bool IsES32OrAbove = false;
75 if (deviceCaps.DevType == DeviceType::Vulkan)
75 if (deviceCaps.DevType == RENDER_DEVICE_TYPE_VULKAN)
7676 {
7777 IsES30 = false;
7878 IsES31OrAbove = true;
7979 IsES32OrAbove = false;
8080 GLSLSource.append("#version 310 es\n");
8181 }
82 else if (deviceCaps.DevType == DeviceType::OpenGLES)
82 else if (deviceCaps.DevType == RENDER_DEVICE_TYPE_GLES)
8383 {
8484 IsES30 = deviceCaps.MajorVersion == 3 && deviceCaps.MinorVersion == 0;
8585 IsES31OrAbove = deviceCaps.MajorVersion > 3 || (deviceCaps.MajorVersion == 3 && deviceCaps.MinorVersion >= 1);
2626
2727 #pragma once
2828
29 #include "../../../Common/interface/BasicFileStream.h"
3029 #include "../../GraphicsEngine/interface/Shader.h"
3130
32 namespace Diligent
33 {
31 DILIGENT_BEGIN_NAMESPACE(Diligent)
32
3433
3534 /// Creates default shader source stream factory
3635 /// \param [in] SearchDirectories - Semicolon-seprated list of search directories.
3736 /// \param [out] ppShaderSourceStreamFactory - Memory address where pointer to the shader source stream factory will be written.
38 void CreateDefaultShaderSourceStreamFactory(const Char* SearchDirectories,
39 IShaderSourceInputStreamFactory** ppShaderSourceStreamFactory);
37 void CreateDefaultShaderSourceStreamFactory(const Char* SearchDirectories,
38 class IShaderSourceInputStreamFactory** ppShaderSourceStreamFactory);
4039
41 } // namespace Diligent
40 DILIGENT_END_NAMESPACE // namespace Diligent
249249 RefCntAutoPtr<DeviceImplType> m_pDevice;
250250
251251 /// Vertex streams. Every stream holds strong reference to the buffer
252 VertexStreamInfo<BufferImplType> m_VertexStreams[MaxBufferSlots];
252 VertexStreamInfo<BufferImplType> m_VertexStreams[MAX_BUFFER_SLOTS];
253253
254254 /// Number of bound vertex streams
255255 Uint32 m_NumVertexStreams = 0;
274274 Float32 m_BlendFactors[4] = {-1, -1, -1, -1};
275275
276276 /// Current viewports
277 Viewport m_Viewports[MaxViewports];
277 Viewport m_Viewports[MAX_VIEWPORTS];
278278 /// Number of current viewports
279279 Uint32 m_NumViewports = 0;
280280
281281 /// Current scissor rects
282 Rect m_ScissorRects[MaxViewports];
282 Rect m_ScissorRects[MAX_VIEWPORTS];
283283 /// Number of current scissor rects
284284 Uint32 m_NumScissorRects = 0;
285285
286286 /// Vector of strong references to the bound render targets.
287287 /// Use final texture view implementation type to avoid virtual calls to AddRef()/Release()
288 RefCntAutoPtr<TextureViewImplType> m_pBoundRenderTargets[MaxRenderTargets];
288 RefCntAutoPtr<TextureViewImplType> m_pBoundRenderTargets[MAX_RENDER_TARGETS];
289289 /// Number of bound render targets
290290 Uint32 m_NumBoundRenderTargets = 0;
291291 /// Width of the currently bound framebuffer
323323 SET_VERTEX_BUFFERS_FLAGS Flags)
324324 {
325325 #ifdef DEVELOPMENT
326 if (StartSlot >= MaxBufferSlots)
327 {
328 LOG_ERROR_MESSAGE("Start vertex buffer slot ", StartSlot, " is out of allowed range [0, ", MaxBufferSlots - 1, "].");
326 if (StartSlot >= MAX_BUFFER_SLOTS)
327 {
328 LOG_ERROR_MESSAGE("Start vertex buffer slot ", StartSlot, " is out of allowed range [0, ", MAX_BUFFER_SLOTS - 1, "].");
329329 return;
330330 }
331331
332 if (StartSlot + NumBuffersSet > MaxBufferSlots)
333 {
334 LOG_ERROR_MESSAGE("The range of vertex buffer slots being set [", StartSlot, ", ", StartSlot + NumBuffersSet - 1, "] is out of allowed range [0, ", MaxBufferSlots - 1, "].");
335 NumBuffersSet = MaxBufferSlots - StartSlot;
332 if (StartSlot + NumBuffersSet > MAX_BUFFER_SLOTS)
333 {
334 LOG_ERROR_MESSAGE("The range of vertex buffer slots being set [", StartSlot, ", ", StartSlot + NumBuffersSet - 1, "] is out of allowed range [0, ", MAX_BUFFER_SLOTS - 1, "].");
335 NumBuffersSet = MAX_BUFFER_SLOTS - StartSlot;
336336 }
337337 #endif
338338
478478 RTHeight = m_FramebufferHeight;
479479 }
480480
481 VERIFY(NumViewports < MaxViewports, "Number of viewports (", NumViewports, ") exceeds the limit (", MaxViewports, ")");
482 m_NumViewports = std::min(MaxViewports, NumViewports);
481 VERIFY(NumViewports < MAX_VIEWPORTS, "Number of viewports (", NumViewports, ") exceeds the limit (", MAX_VIEWPORTS, ")");
482 m_NumViewports = std::min(MAX_VIEWPORTS, NumViewports);
483483
484484 Viewport DefaultVP(0, 0, static_cast<float>(RTWidth), static_cast<float>(RTHeight));
485485 // If no viewports are specified, use default viewport
518518 RTHeight = m_FramebufferHeight;
519519 }
520520
521 VERIFY(NumRects < MaxViewports, "Number of scissor rects (", NumRects, ") exceeds the limit (", MaxViewports, ")");
522 m_NumScissorRects = std::min(MaxViewports, NumRects);
521 VERIFY(NumRects < MAX_VIEWPORTS, "Number of scissor rects (", NumRects, ") exceeds the limit (", MAX_VIEWPORTS, ")");
522 m_NumScissorRects = std::min(MAX_VIEWPORTS, NumRects);
523523
524524 for (Uint32 sr = 0; sr < m_NumScissorRects; ++sr)
525525 {
656656 else
657657 ppRTVs[rt] = nullptr;
658658 }
659 for (Uint32 rt = NumRenderTargets; rt < MaxRenderTargets; ++rt)
659 for (Uint32 rt = NumRenderTargets; rt < MAX_RENDER_TARGETS; ++rt)
660660 {
661661 VERIFY(ppRTVs[rt] == nullptr, "Non-null pointer found in RTV array element #", rt);
662662 ppRTVs[rt] = nullptr;
14401440 DEV_CHECK_ERR(Barrier.FirstMipLevel < TexDesc.MipLevels, "First mip level (", Barrier.FirstMipLevel,
14411441 ") specified by the barrier is out of range. Texture '",
14421442 TexDesc.Name, "' has only ", TexDesc.MipLevels, " mip level(s)");
1443 DEV_CHECK_ERR(Barrier.MipLevelsCount == StateTransitionDesc::RemainingMipLevels || Barrier.FirstMipLevel + Barrier.MipLevelsCount <= TexDesc.MipLevels,
1443 DEV_CHECK_ERR(Barrier.MipLevelsCount == REMAINING_MIP_LEVELS || Barrier.FirstMipLevel + Barrier.MipLevelsCount <= TexDesc.MipLevels,
14441444 "Mip level range ", Barrier.FirstMipLevel, "..", Barrier.FirstMipLevel + Barrier.MipLevelsCount - 1,
14451445 " specified by the barrier is out of range. Texture '",
14461446 TexDesc.Name, "' has only ", TexDesc.MipLevels, " mip level(s)");
14481448 DEV_CHECK_ERR(Barrier.FirstArraySlice < TexDesc.ArraySize, "First array slice (", Barrier.FirstArraySlice,
14491449 ") specified by the barrier is out of range. Array size of texture '",
14501450 TexDesc.Name, "' is ", TexDesc.ArraySize);
1451 DEV_CHECK_ERR(Barrier.ArraySliceCount == StateTransitionDesc::RemainingArraySlices || Barrier.FirstArraySlice + Barrier.ArraySliceCount <= TexDesc.ArraySize,
1451 DEV_CHECK_ERR(Barrier.ArraySliceCount == REMAINING_ARRAY_SLICES || Barrier.FirstArraySlice + Barrier.ArraySliceCount <= TexDesc.ArraySize,
14521452 "Array slice range ", Barrier.FirstArraySlice, "..", Barrier.FirstArraySlice + Barrier.ArraySliceCount - 1,
14531453 " specified by the barrier is out of range. Array size of texture '",
14541454 TexDesc.Name, "' is ", TexDesc.ArraySize);
14551455
14561456 auto DevType = m_pDevice->GetDeviceCaps().DevType;
1457 if (DevType != DeviceType::D3D12 && DevType != DeviceType::Vulkan)
1458 {
1459 DEV_CHECK_ERR(Barrier.FirstMipLevel == 0 && (Barrier.MipLevelsCount == StateTransitionDesc::RemainingMipLevels || Barrier.MipLevelsCount == TexDesc.MipLevels),
1457 if (DevType != RENDER_DEVICE_TYPE_D3D12 && DevType != RENDER_DEVICE_TYPE_VULKAN)
1458 {
1459 DEV_CHECK_ERR(Barrier.FirstMipLevel == 0 && (Barrier.MipLevelsCount == REMAINING_MIP_LEVELS || Barrier.MipLevelsCount == TexDesc.MipLevels),
14601460 "Failed to transition texture '", TexDesc.Name, "': only whole resources can be transitioned on this device");
1461 DEV_CHECK_ERR(Barrier.FirstArraySlice == 0 && (Barrier.ArraySliceCount == StateTransitionDesc::RemainingArraySlices || Barrier.ArraySliceCount == TexDesc.ArraySize),
1461 DEV_CHECK_ERR(Barrier.FirstArraySlice == 0 && (Barrier.ArraySliceCount == REMAINING_ARRAY_SLICES || Barrier.ArraySliceCount == TexDesc.ArraySize),
14621462 "Failed to transition texture '", TexDesc.Name, "': only whole resources can be transitioned on this device");
14631463 }
14641464 }
205205
206206
207207 // Correct description and compute offsets and tight strides
208 std::array<Uint32, MaxBufferSlots> Strides, TightStrides = {};
208 std::array<Uint32, MAX_BUFFER_SLOTS> Strides, TightStrides = {};
209209 // Set all strides to an invalid value because an application may want to use 0 stride
210210 for (auto& Stride : Strides)
211 Stride = LayoutElement::AutoStride;
211 Stride = LAYOUT_ELEMENT_AUTO_STRIDE;
212212
213213 for (Uint32 i = 0; i < InputLayout.NumElements; ++i)
214214 {
227227
228228 auto& CurrAutoStride = TightStrides[BuffSlot];
229229 // If offset is not explicitly specified, use current auto stride value
230 if (LayoutElem.RelativeOffset == LayoutElement::AutoOffset)
230 if (LayoutElem.RelativeOffset == LAYOUT_ELEMENT_AUTO_OFFSET)
231231 {
232232 LayoutElem.RelativeOffset = CurrAutoStride;
233233 }
234234
235235 // If stride is explicitly specified, use it for the current buffer slot
236 if (LayoutElem.Stride != LayoutElement::AutoStride)
236 if (LayoutElem.Stride != LAYOUT_ELEMENT_AUTO_STRIDE)
237237 {
238238 // Verify that the value is consistent with the previously specified stride, if any
239 if (Strides[BuffSlot] != LayoutElement::AutoStride && Strides[BuffSlot] != LayoutElem.Stride)
239 if (Strides[BuffSlot] != LAYOUT_ELEMENT_AUTO_STRIDE && Strides[BuffSlot] != LayoutElem.Stride)
240240 {
241241 LOG_ERROR_MESSAGE("Inconsistent strides are specified for buffer slot ", BuffSlot,
242242 ". Input element at index ", LayoutElem.InputIndex, " explicitly specifies stride ",
243243 LayoutElem.Stride, ", while current value is ", Strides[BuffSlot],
244 ". Specify consistent strides or use LayoutElement::AutoStride to allow "
244 ". Specify consistent strides or use LAYOUT_ELEMENT_AUTO_STRIDE to allow "
245245 "the engine compute strides automatically.");
246246 }
247247 Strides[BuffSlot] = LayoutElem.Stride;
256256
257257 auto BuffSlot = LayoutElem.BufferSlot;
258258 // If no input elements explicitly specified stride for this buffer slot, use automatic stride
259 if (Strides[BuffSlot] == LayoutElement::AutoStride)
259 if (Strides[BuffSlot] == LAYOUT_ELEMENT_AUTO_STRIDE)
260260 {
261261 Strides[BuffSlot] = TightStrides[BuffSlot];
262262 }
269269 " required to accomodate all input elements.");
270270 }
271271 }
272 if (LayoutElem.Stride == LayoutElement::AutoStride)
272 if (LayoutElem.Stride == LAYOUT_ELEMENT_AUTO_STRIDE)
273273 LayoutElem.Stride = Strides[BuffSlot];
274274 }
275275
281281 for (Uint32 i = 0; i < m_BufferSlotsUsed; ++i)
282282 {
283283 auto Stride = Strides[i];
284 m_pStrides[i] = Stride != LayoutElement::AutoStride ? Stride : 0;
284 m_pStrides[i] = Stride != LAYOUT_ELEMENT_AUTO_STRIDE ? Stride : 0;
285285 }
286286 }
287287 }
126126 size_t operator()(const Diligent::BlendStateDesc& BSDesc) const
127127 {
128128 std::size_t Seed = 0;
129 for (int i = 0; i < Diligent::BlendStateDesc::MaxRenderTargets; ++i)
129 for (int i = 0; i < Diligent::MAX_RENDER_TARGETS; ++i)
130130 {
131131 const auto& rt = BSDesc.RenderTargets[i];
132132 Diligent::HashCombine(Seed,
229229 if (ViewDesc.MostDetailedMip >= this->m_Desc.MipLevels)
230230 TEX_VIEW_VALIDATION_ERROR("Most detailed mip (", ViewDesc.MostDetailedMip, ") is out of range. The texture has only ", this->m_Desc.MipLevels, " mip ", (this->m_Desc.MipLevels > 1 ? "levels." : "level."));
231231
232 if (ViewDesc.NumMipLevels != TextureViewDesc::RemainingMipLevels && ViewDesc.MostDetailedMip + ViewDesc.NumMipLevels > this->m_Desc.MipLevels)
232 if (ViewDesc.NumMipLevels != REMAINING_MIP_LEVELS && ViewDesc.MostDetailedMip + ViewDesc.NumMipLevels > this->m_Desc.MipLevels)
233233 TEX_VIEW_VALIDATION_ERROR("Most detailed mip (", ViewDesc.MostDetailedMip, ") and number of mip levels in the view (", ViewDesc.NumMipLevels, ") is out of range. The texture has only ", this->m_Desc.MipLevels, " mip ", (this->m_Desc.MipLevels > 1 ? "levels." : "level."));
234234
235235 if (ViewDesc.Format == TEX_FORMAT_UNKNOWN)
350350 {
351351 if (ViewDesc.ViewType != TEXTURE_VIEW_SHADER_RESOURCE)
352352 TEX_VIEW_VALIDATION_ERROR("Unexpected view type: SRV is expected");
353 if (ViewDesc.NumArraySlices != 6 && ViewDesc.NumArraySlices != 0 && ViewDesc.NumArraySlices != TextureViewDesc::RemainingArraySlices)
353 if (ViewDesc.NumArraySlices != 6 && ViewDesc.NumArraySlices != 0 && ViewDesc.NumArraySlices != REMAINING_ARRAY_SLICES)
354354 TEX_VIEW_VALIDATION_ERROR("Texture cube SRV is expected to have 6 array slices, while ", ViewDesc.NumArraySlices, " is provided");
355355 if (ViewDesc.FirstArraySlice != 0)
356356 TEX_VIEW_VALIDATION_ERROR("First slice (", ViewDesc.FirstArraySlice, ") must be 0 for non-array texture cube SRV");
359359 {
360360 if (ViewDesc.ViewType != TEXTURE_VIEW_SHADER_RESOURCE)
361361 TEX_VIEW_VALIDATION_ERROR("Unexpected view type: SRV is expected");
362 if (ViewDesc.NumArraySlices != TextureViewDesc::RemainingArraySlices && (ViewDesc.NumArraySlices % 6) != 0)
362 if (ViewDesc.NumArraySlices != REMAINING_ARRAY_SLICES && (ViewDesc.NumArraySlices % 6) != 0)
363363 TEX_VIEW_VALIDATION_ERROR("Number of slices in texture cube array SRV is expected to be multiple of 6. ", ViewDesc.NumArraySlices, " slices is provided.");
364364 }
365365
369369 if (ViewDesc.FirstArraySlice != 0)
370370 TEX_VIEW_VALIDATION_ERROR("First slice (", ViewDesc.FirstArraySlice, ") must be 0 for non-array texture 1D/2D views");
371371
372 if (ViewDesc.NumArraySlices != TextureViewDesc::RemainingArraySlices && ViewDesc.NumArraySlices > 1)
372 if (ViewDesc.NumArraySlices != REMAINING_ARRAY_SLICES && ViewDesc.NumArraySlices > 1)
373373 TEX_VIEW_VALIDATION_ERROR("Number of slices in the view (", ViewDesc.NumArraySlices, ") must be 1 (or 0) for non-array texture 1D/2D views");
374374 }
375375 else if (ViewDesc.TextureDim == RESOURCE_DIM_TEX_1D_ARRAY ||
380380 if (ViewDesc.FirstArraySlice >= this->m_Desc.ArraySize)
381381 TEX_VIEW_VALIDATION_ERROR("First array slice (", ViewDesc.FirstArraySlice, ") exceeds the number of slices in the texture array (", this->m_Desc.ArraySize, ")");
382382
383 if (ViewDesc.NumArraySlices != TextureViewDesc::RemainingArraySlices && ViewDesc.FirstArraySlice + ViewDesc.NumArraySlices > this->m_Desc.ArraySize)
383 if (ViewDesc.NumArraySlices != REMAINING_ARRAY_SLICES && ViewDesc.FirstArraySlice + ViewDesc.NumArraySlices > this->m_Desc.ArraySize)
384384 TEX_VIEW_VALIDATION_ERROR("First slice (", ViewDesc.FirstArraySlice, ") and number of slices in the view (", ViewDesc.NumArraySlices, ") specify more slices than target texture has (", this->m_Desc.ArraySize, ")");
385385 }
386386 else if (ViewDesc.TextureDim == RESOURCE_DIM_TEX_3D)
410410
411411 #undef TEX_VIEW_VALIDATION_ERROR
412412
413 if (ViewDesc.NumMipLevels == 0 || ViewDesc.NumMipLevels == TextureViewDesc::RemainingMipLevels)
413 if (ViewDesc.NumMipLevels == 0 || ViewDesc.NumMipLevels == REMAINING_MIP_LEVELS)
414414 {
415415 if (ViewDesc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE)
416416 ViewDesc.NumMipLevels = this->m_Desc.MipLevels - ViewDesc.MostDetailedMip;
418418 ViewDesc.NumMipLevels = 1;
419419 }
420420
421 if (ViewDesc.NumArraySlices == 0 || ViewDesc.NumArraySlices == TextureViewDesc::RemainingArraySlices)
421 if (ViewDesc.NumArraySlices == 0 || ViewDesc.NumArraySlices == REMAINING_ARRAY_SLICES)
422422 {
423423 if (ViewDesc.TextureDim == RESOURCE_DIM_TEX_1D_ARRAY ||
424424 ViewDesc.TextureDim == RESOURCE_DIM_TEX_2D_ARRAY ||
2929 /// \file
3030 /// Diligent API information
3131
32 #define DILIGENT_API_VERSION 240051
32 #define DILIGENT_API_VERSION 240052
3333
3434 #include "../../../Primitives/interface/BasicTypes.h"
3535
36 namespace Diligent
37 {
36 DILIGENT_BEGIN_NAMESPACE(Diligent)
3837
3938 /// Diligent API Info. This tructure can be used to verify API compatibility.
4039 struct APIInfo
4140 {
42 size_t StructSize = 0;
43 int APIVersion = 0;
44 size_t RenderTargetBlendDescSize = 0;
45 size_t BlendStateDescSize = 0;
46 size_t BufferDescSize = 0;
47 size_t BufferDataSize = 0;
48 size_t BufferFormatSize = 0;
49 size_t BufferViewDescSize = 0;
50 size_t StencilOpDescSize = 0;
51 size_t DepthStencilStateDescSize = 0;
52 size_t SamplerCapsSize = 0;
53 size_t TextureCapsSize = 0;
54 size_t DeviceCapsSize = 0;
55 size_t DrawAttribsSize = 0;
56 size_t DispatchComputeAttribsSize = 0;
57 size_t ViewportSize = 0;
58 size_t RectSize = 0;
59 size_t CopyTextureAttribsSize = 0;
60 size_t DeviceObjectAttribsSize = 0;
61 size_t AdapterAttribsSize = 0;
62 size_t DisplayModeAttribsSize = 0;
63 size_t SwapChainDescSize = 0;
64 size_t FullScreenModeDescSize = 0;
65 size_t EngineCreateInfoSize = 0;
66 size_t EngineGLCreateInfoSize = 0;
67 size_t EngineD3D11CreateInfoSize = 0;
68 size_t EngineD3D12CreateInfoSize = 0;
69 size_t EngineVkCreateInfoSize = 0;
70 size_t EngineMtlCreateInfoSize = 0;
71 size_t BoxSize = 0;
72 size_t TextureFormatAttribsSize = 0;
73 size_t TextureFormatInfoSize = 0;
74 size_t TextureFormatInfoExtSize = 0;
75 size_t StateTransitionDescSize = 0;
76 size_t LayoutElementSize = 0;
77 size_t InputLayoutDescSize = 0;
78 size_t SampleDescSize = 0;
79 size_t ShaderResourceVariableDescSize = 0;
80 size_t StaticSamplerDescSize = 0;
81 size_t PipelineResourceLayoutDescSize = 0;
82 size_t GraphicsPipelineDescSize = 0;
83 size_t ComputePipelineDescSize = 0;
84 size_t PipelineStateDescSize = 0;
85 size_t RasterizerStateDescSize = 0;
86 size_t ResourceMappingEntrySize = 0;
87 size_t ResourceMappingDescSize = 0;
88 size_t SamplerDescSize = 0;
89 size_t ShaderDescSize = 0;
90 size_t ShaderMacroSize = 0;
91 size_t ShaderCreateInfoSize = 0;
92 size_t ShaderResourceDescSize = 0;
93 size_t DepthStencilClearValueSize = 0;
94 size_t OptimizedClearValueSize = 0;
95 size_t TextureDescSize = 0;
96 size_t TextureSubResDataSize = 0;
97 size_t TextureDataSize = 0;
98 size_t MappedTextureSubresourceSize = 0;
99 size_t TextureViewDescSize = 0;
41 size_t StructSize DEFAULT_INITIALIZER(0);
42 int APIVersion DEFAULT_INITIALIZER(0);
43 size_t RenderTargetBlendDescSize DEFAULT_INITIALIZER(0);
44 size_t BlendStateDescSize DEFAULT_INITIALIZER(0);
45 size_t BufferDescSize DEFAULT_INITIALIZER(0);
46 size_t BufferDataSize DEFAULT_INITIALIZER(0);
47 size_t BufferFormatSize DEFAULT_INITIALIZER(0);
48 size_t BufferViewDescSize DEFAULT_INITIALIZER(0);
49 size_t StencilOpDescSize DEFAULT_INITIALIZER(0);
50 size_t DepthStencilStateDescSize DEFAULT_INITIALIZER(0);
51 size_t SamplerCapsSize DEFAULT_INITIALIZER(0);
52 size_t TextureCapsSize DEFAULT_INITIALIZER(0);
53 size_t DeviceCapsSize DEFAULT_INITIALIZER(0);
54 size_t DrawAttribsSize DEFAULT_INITIALIZER(0);
55 size_t DispatchComputeAttribsSize DEFAULT_INITIALIZER(0);
56 size_t ViewportSize DEFAULT_INITIALIZER(0);
57 size_t RectSize DEFAULT_INITIALIZER(0);
58 size_t CopyTextureAttribsSize DEFAULT_INITIALIZER(0);
59 size_t DeviceObjectAttribsSize DEFAULT_INITIALIZER(0);
60 size_t AdapterAttribsSize DEFAULT_INITIALIZER(0);
61 size_t DisplayModeAttribsSize DEFAULT_INITIALIZER(0);
62 size_t SwapChainDescSize DEFAULT_INITIALIZER(0);
63 size_t FullScreenModeDescSize DEFAULT_INITIALIZER(0);
64 size_t EngineCreateInfoSize DEFAULT_INITIALIZER(0);
65 size_t EngineGLCreateInfoSize DEFAULT_INITIALIZER(0);
66 size_t EngineD3D11CreateInfoSize DEFAULT_INITIALIZER(0);
67 size_t EngineD3D12CreateInfoSize DEFAULT_INITIALIZER(0);
68 size_t EngineVkCreateInfoSize DEFAULT_INITIALIZER(0);
69 size_t EngineMtlCreateInfoSize DEFAULT_INITIALIZER(0);
70 size_t BoxSize DEFAULT_INITIALIZER(0);
71 size_t TextureFormatAttribsSize DEFAULT_INITIALIZER(0);
72 size_t TextureFormatInfoSize DEFAULT_INITIALIZER(0);
73 size_t TextureFormatInfoExtSize DEFAULT_INITIALIZER(0);
74 size_t StateTransitionDescSize DEFAULT_INITIALIZER(0);
75 size_t LayoutElementSize DEFAULT_INITIALIZER(0);
76 size_t InputLayoutDescSize DEFAULT_INITIALIZER(0);
77 size_t SampleDescSize DEFAULT_INITIALIZER(0);
78 size_t ShaderResourceVariableDescSize DEFAULT_INITIALIZER(0);
79 size_t StaticSamplerDescSize DEFAULT_INITIALIZER(0);
80 size_t PipelineResourceLayoutDescSize DEFAULT_INITIALIZER(0);
81 size_t GraphicsPipelineDescSize DEFAULT_INITIALIZER(0);
82 size_t ComputePipelineDescSize DEFAULT_INITIALIZER(0);
83 size_t PipelineStateDescSize DEFAULT_INITIALIZER(0);
84 size_t RasterizerStateDescSize DEFAULT_INITIALIZER(0);
85 size_t ResourceMappingEntrySize DEFAULT_INITIALIZER(0);
86 size_t ResourceMappingDescSize DEFAULT_INITIALIZER(0);
87 size_t SamplerDescSize DEFAULT_INITIALIZER(0);
88 size_t ShaderDescSize DEFAULT_INITIALIZER(0);
89 size_t ShaderMacroSize DEFAULT_INITIALIZER(0);
90 size_t ShaderCreateInfoSize DEFAULT_INITIALIZER(0);
91 size_t ShaderResourceDescSize DEFAULT_INITIALIZER(0);
92 size_t DepthStencilClearValueSize DEFAULT_INITIALIZER(0);
93 size_t OptimizedClearValueSize DEFAULT_INITIALIZER(0);
94 size_t TextureDescSize DEFAULT_INITIALIZER(0);
95 size_t TextureSubResDataSize DEFAULT_INITIALIZER(0);
96 size_t TextureDataSize DEFAULT_INITIALIZER(0);
97 size_t MappedTextureSubresourceSize DEFAULT_INITIALIZER(0);
98 size_t TextureViewDescSize DEFAULT_INITIALIZER(0);
10099 };
101100
102 } // namespace Diligent
101 DILIGENT_END_NAMESPACE // namespace Diligent
3232 /// Blend state description
3333
3434 #include "../../../Primitives/interface/BasicTypes.h"
35
36 namespace Diligent
37 {
35 #include "Constants.h"
36
37 DILIGENT_BEGIN_NAMESPACE(Diligent)
38
3839
3940 /// Blend factors
4041
4546 /// It generatlly mirrors [D3D11_BLEND][] and [D3D12_BLEND][] enumerations and is used by RenderTargetBlendDesc structure
4647 /// to define source and destination blend factors for color and alpha channels.
4748 /// \sa [D3D11_BLEND on MSDN][D3D11_BLEND], [D3D12_BLEND on MSDN][D3D12_BLEND], [glBlendFuncSeparate on OpenGL.org][glBlendFuncSeparate]
48 enum BLEND_FACTOR : Int8
49 DILIGENT_TYPED_ENUM(BLEND_FACTOR, Int8)
4950 {
5051 /// Undefined blend factor
5152 BLEND_FACTOR_UNDEFINED = 0,
133134 /// [D3D11_BLEND_OP][] and [D3D12_BLEND_OP][] enums. It is used by RenderTargetBlendDesc structure to define RGB and Alpha
134135 /// blending operations
135136 /// \sa [D3D11_BLEND_OP on MSDN][D3D11_BLEND_OP], [D3D12_BLEND_OP on MSDN][D3D12_BLEND_OP], [glBlendEquationSeparate on OpenGL.org][glBlendEquationSeparate]
136 enum BLEND_OPERATION : Int8
137 DILIGENT_TYPED_ENUM(BLEND_OPERATION, Int8)
137138 {
138139 /// Undefined blend operation
139140 BLEND_OPERATION_UNDEFINED = 0,
167168
168169 /// These flags are used by RenderTargetBlendDesc structure to define
169170 /// writable components of the render target
170 enum COLOR_MASK : Int8
171 DILIGENT_TYPED_ENUM(COLOR_MASK, Int8)
171172 {
172173 /// Allow data to be stored in the red component.
173174 COLOR_MASK_RED = 1,
193194 /// It is used by RenderTargetBlendDesc structure to define logic operation.
194195 /// Only available on D3D12 engine
195196 /// \sa [D3D12_LOGIC_OP on MSDN][D3D12_LOGIC_OP]
196 enum LOGIC_OPERATION : Int8
197 DILIGENT_TYPED_ENUM(LOGIC_OPERATION, Int8)
197198 {
198199 /// Clear the render target.\n
199200 /// Direct3D12 counterpart: D3D12_LOGIC_OP_CLEAR.
271272 struct RenderTargetBlendDesc
272273 {
273274 /// Enable or disable blending for this render target. Default value: False.
274 Bool BlendEnable = False;
275 Bool BlendEnable DEFAULT_INITIALIZER(False);
275276
276277 /// Enable or disable a logical operation for this render target. Default value: False.
277 Bool LogicOperationEnable = False;
278 Bool LogicOperationEnable DEFAULT_INITIALIZER(False);
278279
279280 /// Specifies the blend factor to apply to the RGB value output from the pixel shader
280281 /// Default value: Diligent::BLEND_FACTOR_ONE.
281 BLEND_FACTOR SrcBlend = BLEND_FACTOR_ONE;
282 BLEND_FACTOR SrcBlend DEFAULT_INITIALIZER(BLEND_FACTOR_ONE);
282283
283284 /// Specifies the blend factor to apply to the RGB value in the render target
284285 /// Default value: Diligent::BLEND_FACTOR_ZERO.
285 BLEND_FACTOR DestBlend = BLEND_FACTOR_ZERO;
286 BLEND_FACTOR DestBlend DEFAULT_INITIALIZER(BLEND_FACTOR_ZERO);
286287
287288 /// Defines how to combine the source and destination RGB values
288289 /// after applying the SrcBlend and DestBlend factors.
289290 /// Default value: Diligent::BLEND_OPERATION_ADD.
290 BLEND_OPERATION BlendOp = BLEND_OPERATION_ADD;
291 BLEND_OPERATION BlendOp DEFAULT_INITIALIZER(BLEND_OPERATION_ADD);
291292
292293 /// Specifies the blend factor to apply to the alpha value output from the pixel shader.
293294 /// Blend factors that end in _COLOR are not allowed.
294295 /// Default value: Diligent::BLEND_FACTOR_ONE.
295 BLEND_FACTOR SrcBlendAlpha = BLEND_FACTOR_ONE;
296 BLEND_FACTOR SrcBlendAlpha DEFAULT_INITIALIZER(BLEND_FACTOR_ONE);
296297
297298 /// Specifies the blend factor to apply to the alpha value in the render target.
298299 /// Blend factors that end in _COLOR are not allowed.
299300 /// Default value: Diligent::BLEND_FACTOR_ZERO.
300 BLEND_FACTOR DestBlendAlpha = BLEND_FACTOR_ZERO;
301 BLEND_FACTOR DestBlendAlpha DEFAULT_INITIALIZER(BLEND_FACTOR_ZERO);
301302
302303 /// Defines how to combine the source and destination alpha values
303304 /// after applying the SrcBlendAlpha and DestBlendAlpha factors.
304305 /// Default value: Diligent::BLEND_OPERATION_ADD.
305 BLEND_OPERATION BlendOpAlpha = BLEND_OPERATION_ADD;
306 BLEND_OPERATION BlendOpAlpha DEFAULT_INITIALIZER(BLEND_OPERATION_ADD);
306307
307308 /// Defines logical operation for the render target.
308309 /// Default value: Diligent::LOGIC_OP_NOOP.
309 LOGIC_OPERATION LogicOp = LOGIC_OP_NOOP;
310 LOGIC_OPERATION LogicOp DEFAULT_INITIALIZER(LOGIC_OP_NOOP);
310311
311312 /// Render target write mask.
312313 /// Default value: Diligent::COLOR_MASK_ALL.
313 Uint8 RenderTargetWriteMask = COLOR_MASK_ALL;
314
315 // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
316 // RenderTargetBlendDesc{False, False}
314 Uint8 RenderTargetWriteMask DEFAULT_INITIALIZER(COLOR_MASK_ALL);
315
316 #if DILIGENT_CPP_INTERFACE
317317
318318 RenderTargetBlendDesc()noexcept{}
319319
359359 LogicOp == rhs.LogicOp &&
360360 RenderTargetWriteMask == rhs.RenderTargetWriteMask;
361361 }
362 #endif
362363 };
363364
364365
369370 {
370371 /// Specifies whether to use alpha-to-coverage as a multisampling technique
371372 /// when setting a pixel to a render target. Default value: False.
372 Bool AlphaToCoverageEnable = False;
373 Bool AlphaToCoverageEnable DEFAULT_INITIALIZER(False);
373374
374375 /// Specifies whether to enable independent blending in simultaneous render targets.
375376 /// If set to False, only RenderTargets[0] is used. Default value: False.
376 Bool IndependentBlendEnable = False;
377
378 /// Constant member defining the maximum number of render targets
379 static constexpr int MaxRenderTargets = 8;
377 Bool IndependentBlendEnable DEFAULT_INITIALIZER(False);
380378
381379 /// An array of RenderTargetBlendDesc structures that describe the blend
382380 /// states for render targets
383 RenderTargetBlendDesc RenderTargets[MaxRenderTargets];
384
381 struct RenderTargetBlendDesc RenderTargets[DILIGENT_MAX_RENDER_TARGETS];
382
383 #if DILIGENT_CPP_INTERFACE
385384 // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
386385 // BlendStateDesc{False, False}
387386
409408 bool operator==(const BlendStateDesc& RHS) const
410409 {
411410 bool bRTsEqual = true;
412 for (int i = 0; i < MaxRenderTargets; ++i)
411 for (int i = 0; i < MAX_RENDER_TARGETS; ++i)
413412 {
414413 if (!(RenderTargets[i] == RHS.RenderTargets[i]))
415414 {
422421 AlphaToCoverageEnable == RHS.AlphaToCoverageEnable &&
423422 IndependentBlendEnable == RHS.IndependentBlendEnable;
424423 }
425 };
426
427 } // namespace Diligent
424 #endif
425 };
426
427 DILIGENT_END_NAMESPACE // namespace Diligent
3333
3434 #include "DeviceObject.h"
3535
36 namespace Diligent
37 {
36 DILIGENT_BEGIN_NAMESPACE(Diligent)
37
3838
3939 // {EC47EAD3-A2C4-44F2-81C5-5248D14F10E4}
40 static constexpr INTERFACE_ID IID_Buffer =
40 static const struct INTERFACE_ID IID_Buffer =
4141 {0xec47ead3, 0xa2c4, 0x44f2, {0x81, 0xc5, 0x52, 0x48, 0xd1, 0x4f, 0x10, 0xe4}};
4242
4343 /// Describes the buffer access mode.
4444
4545 /// This enumeration is used by BufferDesc structure.
46 enum BUFFER_MODE : Uint8
46 DILIGENT_TYPED_ENUM(BUFFER_MODE, Uint8)
4747 {
4848 /// Undefined mode.
4949 BUFFER_MODE_UNDEFINED = 0,
6969 };
7070
7171 /// Buffer description
72 struct BufferDesc : DeviceObjectAttribs
73 {
72 struct BufferDesc DILIGENT_DERIVE(DeviceObjectAttribs)
73
7474 /// Size of the buffer, in bytes. For a uniform buffer, this must be multiple of 16.
75 Uint32 uiSizeInBytes = 0;
75 Uint32 uiSizeInBytes DEFAULT_INITIALIZER(0);
7676
7777 /// Buffer bind flags, see Diligent::BIND_FLAGS for details
7878
8080 /// Diligent::BIND_VERTEX_BUFFER, Diligent::BIND_INDEX_BUFFER, Diligent::BIND_UNIFORM_BUFFER,
8181 /// Diligent::BIND_SHADER_RESOURCE, Diligent::BIND_STREAM_OUTPUT, Diligent::BIND_UNORDERED_ACCESS,
8282 /// Diligent::BIND_INDIRECT_DRAW_ARGS
83 BIND_FLAGS BindFlags = BIND_NONE;
83 BIND_FLAGS BindFlags DEFAULT_INITIALIZER(BIND_NONE);
8484
8585 /// Buffer usage, see Diligent::USAGE for details
86 USAGE Usage = USAGE_DEFAULT;
86 USAGE Usage DEFAULT_INITIALIZER(USAGE_DEFAULT);
8787
8888 /// CPU access flags or 0 if no CPU access is allowed,
8989 /// see Diligent::CPU_ACCESS_FLAGS for details.
90 CPU_ACCESS_FLAGS CPUAccessFlags = CPU_ACCESS_NONE;
90 CPU_ACCESS_FLAGS CPUAccessFlags DEFAULT_INITIALIZER(CPU_ACCESS_NONE);
9191
9292 /// Buffer mode, see Diligent::BUFFER_MODE
93 BUFFER_MODE Mode = BUFFER_MODE_UNDEFINED;
93 BUFFER_MODE Mode DEFAULT_INITIALIZER(BUFFER_MODE_UNDEFINED);
9494
9595 /// Buffer element stride, in bytes.
9696
9999 /// (BufferDesc::Mode equals Diligent::BUFFER_MODE_FORMATTED) and optionally for a raw buffer
100100 /// (Diligent::BUFFER_MODE_RAW), this member defines the size of the format that will be used for views
101101 /// created for this buffer.
102 Uint32 ElementByteStride = 0;
102 Uint32 ElementByteStride DEFAULT_INITIALIZER(0);
103103
104104 /// Defines which command queues this buffer can be used with
105 Uint64 CommandQueueMask = 1;
106
107
105 Uint64 CommandQueueMask DEFAULT_INITIALIZER(1);
106
107 #if DILIGENT_CPP_INTERFACE
108108 // We have to explicitly define constructors because otherwise the following initialization fails on Apple's clang:
109109 // BufferDesc{1024, BIND_UNIFORM_BUFFER, USAGE_DEFAULT}
110110
144144 ElementByteStride == RHS.ElementByteStride &&
145145 CommandQueueMask == RHS.CommandQueueMask;
146146 }
147 #endif
147148 };
148149
149150 /// Describes the buffer initial data
150151 struct BufferData
151152 {
152153 /// Pointer to the data
153 const void* pData = nullptr;
154 const void* pData DEFAULT_INITIALIZER(nullptr);
154155
155156 /// Data size, in bytes
156 Uint32 DataSize = 0;
157
158
159 // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
160 // BufferData{nullptr, 0}
157 Uint32 DataSize DEFAULT_INITIALIZER(0);
158
159
160 #if DILIGENT_CPP_INTERFACE
161161
162162 BufferData() noexcept {}
163163
166166 pData {_pData },
167167 DataSize{_DataSize}
168168 {}
169 };
169 #endif
170 };
171
172
173 #if DILIGENT_CPP_INTERFACE
170174
171175 /// Buffer interface
172176
225229 virtual RESOURCE_STATE GetState() const = 0;
226230 };
227231
228 } // namespace Diligent
232 #else
233
234 #endif
235
236 DILIGENT_END_NAMESPACE // namespace Diligent
3333
3434 #include "Buffer.h"
3535
36 namespace Diligent
37 {
36 DILIGENT_BEGIN_NAMESPACE(Diligent)
3837
3938 // {E2E83490-E9D2-495B-9A83-ABB413A38B07}
40 static constexpr INTERFACE_ID IID_BufferView =
39 static const struct INTERFACE_ID IID_BufferView =
4140 {0xe2e83490, 0xe9d2, 0x495b, {0x9a, 0x83, 0xab, 0xb4, 0x13, 0xa3, 0x8b, 0x7}};
4241
4342 /// Buffer format description
4443 struct BufferFormat
4544 {
4645 /// Type of components. For a formatted buffer views, this value cannot be VT_UNDEFINED
47 VALUE_TYPE ValueType = VT_UNDEFINED;
46 VALUE_TYPE ValueType DEFAULT_INITIALIZER(VT_UNDEFINED);
4847
4948 /// Number of components. Allowed values: 1, 2, 3, 4.
5049 /// For a formatted buffer, this value cannot be 0
51 Uint8 NumComponents = 0;
50 Uint8 NumComponents DEFAULT_INITIALIZER(0);
5251
5352 /// For signed and unsigned integer value types
5453 /// (VT_INT8, VT_INT16, VT_INT32, VT_UINT8, VT_UINT16, VT_UINT32)
5554 /// indicates if the value should be normalized to [-1,+1] or
5655 /// [0, 1] range respectively. For floating point types
5756 /// (VT_FLOAT16 and VT_FLOAT32), this member is ignored.
58 Bool IsNormalized = False;
57 Bool IsNormalized DEFAULT_INITIALIZER(False);
5958
6059
60 #if DILIGENT_CPP_INTERFACE
6161 // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
6262 // BufferFormat{VT_FLOAT32, 4}
6363
7979 NumComponents == RHS.NumComponents &&
8080 IsNormalized == RHS.IsNormalized;
8181 }
82 #endif
8283 };
8384
8485 /// Buffer view description
85 struct BufferViewDesc : DeviceObjectAttribs
86 {
86 struct BufferViewDesc DILIGENT_DERIVE(DeviceObjectAttribs)
87
8788 /// View type. See Diligent::BUFFER_VIEW_TYPE for details.
88 BUFFER_VIEW_TYPE ViewType = BUFFER_VIEW_UNDEFINED;
89 BUFFER_VIEW_TYPE ViewType DEFAULT_INITIALIZER(BUFFER_VIEW_UNDEFINED);
8990
9091 /// Format of the view. This member is only used for formatted and raw buffers.
9192 /// To create raw view of a raw buffer, set Format.ValueType member to VT_UNDEFINED
9293 /// (default value).
93 BufferFormat Format;
94 struct BufferFormat Format;
9495
9596 /// Offset in bytes from the beginnig of the buffer to the start of the
9697 /// buffer region referenced by the view
97 Uint32 ByteOffset = 0;
98 Uint32 ByteOffset DEFAULT_INITIALIZER(0);
9899
99100 /// Size in bytes of the referenced buffer region
100 Uint32 ByteWidth = 0;
101 Uint32 ByteWidth DEFAULT_INITIALIZER(0);
101102
102103
104 #if DILIGENT_CPP_INTERFACE
103105 BufferViewDesc()noexcept{}
104106
105107 explicit
131133 ByteWidth == RHS.ByteWidth &&
132134 Format == RHS.Format;
133135 }
136 #endif
134137 };
138
139
140 #if DILIGENT_CPP_INTERFACE
135141
136142 /// Buffer view interface
137143
155161 virtual IBuffer* GetBuffer() = 0;
156162 };
157163
158 } // namespace Diligent
164 #else
165
166 #endif
167
168 DILIGENT_END_NAMESPACE // namespace Diligent
3131
3232 #include "DeviceObject.h"
3333
34 namespace Diligent
35 {
34 DILIGENT_BEGIN_NAMESPACE(Diligent)
3635
3736 // {C38C68F2-8A8C-4ED5-B7EE-69126E75DCD8}
38 static constexpr INTERFACE_ID IID_CommandList =
37 static const struct INTERFACE_ID IID_CommandList =
3938 {0xc38c68f2, 0x8a8c, 0x4ed5, {0xb7, 0xee, 0x69, 0x12, 0x6e, 0x75, 0xdc, 0xd8}};
39
40
41 #if DILIGENT_CPP_INTERFACE
4042
4143 /// Command list interface
4244
4648 {
4749 };
4850
49 } // namespace Diligent
51 #else
52
53 #endif
54
55 DILIGENT_END_NAMESPACE // namespace Diligent
3131
3232 #include "../../../Primitives/interface/BasicTypes.h"
3333
34 namespace Diligent
35 {
34 DILIGENT_BEGIN_NAMESPACE(Diligent)
35
3636 // clang-format off
3737
3838 /// Maximum number of input buffer slots.
3939 /// D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT == 32
40 static constexpr Uint32 MaxBufferSlots = 32;
40 #define DILIGENT_MAX_BUFFER_SOLTS 32
4141
4242 /// Maximum number of simultaneous render targets.
43 static constexpr Uint32 MaxRenderTargets = 8;
43 #define DILIGENT_MAX_RENDER_TARGETS 8
4444
4545 /// Maximum number of viewports.
46 static constexpr Uint32 MaxViewports = 16;
46 #define DILIGENT_MAX_VIEWPORTS 16
47
48 static const Uint32 MAX_BUFFER_SLOTS = DILIGENT_MAX_BUFFER_SOLTS;
49 static const Uint32 MAX_RENDER_TARGETS = DILIGENT_MAX_RENDER_TARGETS;
50 static const Uint32 MAX_VIEWPORTS = DILIGENT_MAX_VIEWPORTS;
4751
4852 /// Maximum number of shader stages in a pipeline.
49 static constexpr Uint32 MaxShadersInPipeline = 5;
53 static const Uint32 MAX_SHADERS_IN_PIPELINE = 5;
5054
5155 // clang-format on
5256
53 } // namespace Diligent
57 DILIGENT_END_NAMESPACE // namespace Diligent
3333
3434 #include "GraphicsTypes.h"
3535
36 namespace Diligent
37 {
36 DILIGENT_BEGIN_NAMESPACE(Diligent)
37
3838
3939 /// Stencil operation
4040
4444 /// [D3D11_STENCIL_OP][]/[D3D12_STENCIL_OP][] enumeration.
4545 /// It is used by Diligent::StencilOpDesc structure to describe the stencil fail, depth fail
4646 /// and stencil pass operations
47 enum STENCIL_OP : Int8
47 DILIGENT_TYPED_ENUM(STENCIL_OP, Int8)
4848 {
4949 /// Undefined operation.
5050 STENCIL_OP_UNDEFINED = 0,
9898 {
9999 /// The stencil operation to perform when stencil testing fails.
100100 /// Default value: Diligent::STENCIL_OP_KEEP.
101 STENCIL_OP StencilFailOp = STENCIL_OP_KEEP;
101 STENCIL_OP StencilFailOp DEFAULT_INITIALIZER(STENCIL_OP_KEEP);
102102
103103 /// The stencil operation to perform when stencil testing passes and depth testing fails.
104104 /// Default value: Diligent::STENCIL_OP_KEEP.
105 STENCIL_OP StencilDepthFailOp = STENCIL_OP_KEEP;
105 STENCIL_OP StencilDepthFailOp DEFAULT_INITIALIZER(STENCIL_OP_KEEP);
106106
107107 /// The stencil operation to perform when stencil testing and depth testing both pass.
108108 /// Default value: Diligent::STENCIL_OP_KEEP.
109 STENCIL_OP StencilPassOp = STENCIL_OP_KEEP;
109 STENCIL_OP StencilPassOp DEFAULT_INITIALIZER(STENCIL_OP_KEEP);
110110
111111 /// A function that compares stencil data against existing stencil data.
112112 /// Default value: Diligent::COMPARISON_FUNC_ALWAYS. See Diligent::COMPARISON_FUNCTION.
113 COMPARISON_FUNCTION StencilFunc = COMPARISON_FUNC_ALWAYS;
114
115
113 COMPARISON_FUNCTION StencilFunc DEFAULT_INITIALIZER(COMPARISON_FUNC_ALWAYS);
114
115
116 #if DILIGENT_CPP_INTERFACE
116117 // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
117118 // StencilOpDesc{STENCIL_OP_KEEP, STENCIL_OP_KEEP, STENCIL_OP_KEEP, COMPARISON_FUNC_ALWAYS}
118119
141142 StencilPassOp == rhs.StencilPassOp &&
142143 StencilFunc == rhs.StencilFunc;
143144 }
145 #endif
144146 };
145147
146148 /// Depth stencil state description
155157 /// Enable depth-stencil operations. When it is set to False,
156158 /// depth test always passes, depth writes are disabled,
157159 /// and no stencil operations are performed. Default value: True.
158 Bool DepthEnable = True;
160 Bool DepthEnable DEFAULT_INITIALIZER(True);
159161
160162 /// Enable or disable writes to a depth buffer. Default value: True.
161 Bool DepthWriteEnable = True;
163 Bool DepthWriteEnable DEFAULT_INITIALIZER(True);
162164
163165 /// A function that compares depth data against existing depth data.
164166 /// See Diligent::COMPARISON_FUNCTION for details.
165167 /// Default value: Diligent::COMPARISON_FUNC_LESS.
166 COMPARISON_FUNCTION DepthFunc = COMPARISON_FUNC_LESS;
168 COMPARISON_FUNCTION DepthFunc DEFAULT_INITIALIZER(COMPARISON_FUNC_LESS);
167169
168170 /// Enable stencil opertaions. Default value: False.
169 Bool StencilEnable = False;
171 Bool StencilEnable DEFAULT_INITIALIZER(False);
170172
171173 /// Identify which bits of the depth-stencil buffer are accessed when reading stencil data.
172174 /// Default value: 0xFF.
173 Uint8 StencilReadMask = 0xFF;
175 Uint8 StencilReadMask DEFAULT_INITIALIZER(0xFF);
174176
175177 /// Identify which bits of the depth-stencil buffer are accessed when writing stencil data.
176178 /// Default value: 0xFF.
177 Uint8 StencilWriteMask = 0xFF;
179 Uint8 StencilWriteMask DEFAULT_INITIALIZER(0xFF);
178180
179181 /// Identify stencil operations for the front-facing triangles, see Diligent::StencilOpDesc.
180 StencilOpDesc FrontFace;
182 struct StencilOpDesc FrontFace;
181183
182184 /// Identify stencil operations for the back-facing triangles, see Diligent::StencilOpDesc.
183 StencilOpDesc BackFace;
184
185
185 struct StencilOpDesc BackFace;
186
187
188 #if DILIGENT_CPP_INTERFACE
186189 // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
187190 // DepthStencilStateDesc{False, False}
188191
223226 FrontFace == rhs.FrontFace &&
224227 BackFace == rhs.BackFace;
225228 }
229 #endif
226230 };
227231
228 }
232 DILIGENT_END_NAMESPACE
3333
3434 #include "GraphicsTypes.h"
3535
36 namespace Diligent
37 {
38 /// Device type
39 enum class DeviceType : Int32
40 {
41 Undefined = 0, ///< Undefined device
42 D3D11, ///< D3D11 device
43 D3D12, ///< D3D12 device
44 OpenGL, ///< OpenGL device
45 OpenGLES, ///< OpenGLES device
46 Vulkan, ///< Vulkan device
47 Metal ///< Metal device (not yet implemented)
36 DILIGENT_BEGIN_NAMESPACE(Diligent)
37
38 /// Device type
39 enum RENDER_DEVICE_TYPE
40 {
41 RENDER_DEVICE_TYPE_UNDEFINED = 0, ///< Undefined device
42 RENDER_DEVICE_TYPE_D3D11, ///< D3D11 device
43 RENDER_DEVICE_TYPE_D3D12, ///< D3D12 device
44 RENDER_DEVICE_TYPE_GL, ///< OpenGL device
45 RENDER_DEVICE_TYPE_GLES, ///< OpenGLES device
46 RENDER_DEVICE_TYPE_VULKAN, ///< Vulkan device
47 RENDER_DEVICE_TYPE_METAL ///< Metal device (not yet implemented)
48 };
49
50 /// Texture sampler capabilities
51 struct SamplerCaps
52 {
53 /// Indicates if device supports border texture addressing mode
54 Bool BorderSamplingModeSupported DEFAULT_INITIALIZER(False);
55
56 /// Indicates if device supports anisotrpoic filtering
57 Bool AnisotropicFilteringSupported DEFAULT_INITIALIZER(False);
58
59 /// Indicates if device supports MIP load bias
60 Bool LODBiasSupported DEFAULT_INITIALIZER(False);
61 };
62
63 /// Texture capabilities
64 struct TextureCaps
65 {
66 /// Maximum dimension (width) of a 1D texture, or 0 if 1D textures are not supported.
67 Uint32 MaxTexture1DDimension DEFAULT_INITIALIZER(0);
68
69 /// Maximum number of slices in a 1D texture array, or 0 if 1D texture arrays are not supported.
70 Uint32 MaxTexture1DArraySlices DEFAULT_INITIALIZER(0);
71
72 /// Maximum dimension (width or height) of a 2D texture.
73 Uint32 MaxTexture2DDimension DEFAULT_INITIALIZER(0);
74
75 /// Maximum number of slices in a 2D texture array, or 0 if 2D texture arrays are not supported.
76 Uint32 MaxTexture2DArraySlices DEFAULT_INITIALIZER(0);
77
78 /// Maximum dimension (width, height, or depth) of a 3D texture, or 0 if 3D textures are not supported.
79 Uint32 MaxTexture3DDimension DEFAULT_INITIALIZER(0);
80
81 /// Maximum dimension (width or height) of a cubemap face, or 0 if cubemap textures are not supported.
82 Uint32 MaxTextureCubeDimension DEFAULT_INITIALIZER(0);
83
84 /// Indicates if device supports 2D multisampled textures
85 Bool Texture2DMSSupported DEFAULT_INITIALIZER(False);
86
87 /// Indicates if device supports 2D multisampled texture arrays
88 Bool Texture2DMSArraySupported DEFAULT_INITIALIZER(False);
89
90 /// Indicates if device supports texture views
91 Bool TextureViewSupported DEFAULT_INITIALIZER(False);
92
93 /// Indicates if device supports cubemap arrays
94 Bool CubemapArraysSupported DEFAULT_INITIALIZER(False);
95 };
96
97 /// Describes supported device features
98 struct DeviceFeatures
99 {
100 /// Indicates if device supports separable programs
101 Bool SeparablePrograms DEFAULT_INITIALIZER(False);
102
103 /// Indicates if device supports indirect draw commands
104 Bool IndirectRendering DEFAULT_INITIALIZER(False);
105
106 /// Indicates if device supports wireframe fill mode
107 Bool WireframeFill DEFAULT_INITIALIZER(False);
108
109 /// Indicates if device supports multithreaded resource creation
110 Bool MultithreadedResourceCreation DEFAULT_INITIALIZER(False);
111
112 /// Indicates if device supports compute shaders
113 Bool ComputeShaders DEFAULT_INITIALIZER(False);
114
115 /// Indicates if device supports geometry shaders
116 Bool GeometryShaders DEFAULT_INITIALIZER(False);
117
118 /// Indicates if device supports tessellation
119 Bool Tessellation DEFAULT_INITIALIZER(False);
120
121 /// Indicates if device supports bindless resources
122 Bool BindlessResources DEFAULT_INITIALIZER(False);
123
124 /// Indicates if device supports occlusion queries (see Diligent::QUERY_TYPE_OCCLUSION).
125 Bool OcclusionQueries DEFAULT_INITIALIZER(False);
126
127 /// Indicates if device supports binary occlusion queries (see Diligent::QUERY_TYPE_BINARY_OCCLUSION).
128 Bool BinaryOcclusionQueries DEFAULT_INITIALIZER(False);
129
130 /// Indicates if device supports timestamp queries (see Diligent::QUERY_TYPE_TIMESTAMP).
131 Bool TimestampQueries DEFAULT_INITIALIZER(False);
132
133 /// Indicates if device supports pipeline statistics queries (see Diligent::QUERY_TYPE_PIPELINE_STATISTICS).
134 Bool PipelineStatisticsQueries DEFAULT_INITIALIZER(False);
135
136 /// Indicates if device supports depth bias clamping
137 Bool DepthBiasClamp DEFAULT_INITIALIZER(False);
138
139 /// Indicates if device supports depth clamping
140 Bool DepthClamp DEFAULT_INITIALIZER(False);
141
142 /// Indicates if device supports depth clamping
143 Bool IndependentBlend DEFAULT_INITIALIZER(False);
144
145 /// Indicates if device supports dual-source blend
146 Bool DualSourceBlend DEFAULT_INITIALIZER(False);
147
148 /// Indicates if device supports multiviewport
149 Bool MultiViewport DEFAULT_INITIALIZER(False);
150
151 /// Indicates if device supports all BC-compressed formats
152 Bool TextureCompressionBC DEFAULT_INITIALIZER(False);
153
154 /// Indicates if device supports writes to UAVs as well as atomic operations in vertex,
155 /// tessellation, and geometry shader stages.
156 Bool VertexPipelineUAVWritesAndAtomics DEFAULT_INITIALIZER(False);
157
158 /// Indicates if device supports writes to UAVs as well as atomic operations in pixel
159 /// shader stage.
160 Bool PixelUAVWritesAndAtomics DEFAULT_INITIALIZER(False);
161
162 /// Specifies whether all the extended UAV texture formats are available in shader code.
163 Bool TextureUAVExtendedFormats DEFAULT_INITIALIZER(False);
164 };
165
166 /// Device capabilities
167 struct DeviceCaps
168 {
169 /// Device type. See Diligent::DeviceType.
170 enum RENDER_DEVICE_TYPE DevType DEFAULT_INITIALIZER(RENDER_DEVICE_TYPE_UNDEFINED);
171
172 /// Major revision of the graphics API supported by the graphics adapter.
173 /// Note that this value indicates the maximum supported feature level, so,
174 /// for example, if the device type is D3D11, this value will be 10 when
175 /// the maximum supported Direct3D feature level of the graphics adapter is 10.0.
176 Int32 MajorVersion DEFAULT_INITIALIZER(0);
177
178 /// Minor revision of the graphics API supported by the graphics adapter.
179 /// Similar to MajorVersion, this value indicates the maximum supported feature level.
180 Int32 MinorVersion DEFAULT_INITIALIZER(0);
181
182 /// Adapter type. See Diligent::ADAPTER_TYPE.
183 ADAPTER_TYPE AdaterType DEFAULT_INITIALIZER(ADAPTER_TYPE_UNKNOWN);
184
185 /// Texture sampling capabilities. See Diligent::SamplerCaps.
186 struct SamplerCaps SamCaps;
187
188 /// Texture capabilities. See Diligent::TextureCaps.
189 struct TextureCaps TexCaps;
190
191 /// Device features. See Diligent::DeviceFeatures.
192 struct DeviceFeatures Features;
193
194 #if DILIGENT_CPP_INTERFACE
195 bool IsGLDevice()const
196 {
197 return DevType == RENDER_DEVICE_TYPE_GL || DevType == RENDER_DEVICE_TYPE_GLES;
198 }
199 bool IsD3DDevice()const
200 {
201 return DevType == RENDER_DEVICE_TYPE_D3D11 || DevType == RENDER_DEVICE_TYPE_D3D12;
202 }
203 bool IsVulkanDevice()const
204 {
205 return DevType == RENDER_DEVICE_TYPE_VULKAN;
206 }
207
208 struct NDCAttribs
209 {
210 const float MinZ; // Minimum z value of normalized device coordinate space
211 const float ZtoDepthScale; // NDC z to depth scale
212 const float YtoVScale; // Scale to transform NDC y coordinate to texture V coordinate
213
214 float GetZtoDepthBias() const
215 {
216 // Returns ZtoDepthBias such that given NDC z coordinate, depth value can be
217 // computed as follows:
218 // d = z * ZtoDepthScale + ZtoDepthBias
219 return -MinZ * ZtoDepthScale;
220 }
48221 };
49222
50 /// Texture sampler capabilities
51 struct SamplerCaps
52 {
53 /// Indicates if device supports border texture addressing mode
54 Bool BorderSamplingModeSupported = False;
55
56 /// Indicates if device supports anisotrpoic filtering
57 Bool AnisotropicFilteringSupported = False;
58
59 /// Indicates if device supports MIP load bias
60 Bool LODBiasSupported = False;
61 };
62
63 /// Texture capabilities
64 struct TextureCaps
65 {
66 /// Maximum dimension (width) of a 1D texture, or 0 if 1D textures are not supported.
67 Uint32 MaxTexture1DDimension = 0;
68
69 /// Maximum number of slices in a 1D texture array, or 0 if 1D texture arrays are not supported.
70 Uint32 MaxTexture1DArraySlices = 0;
71
72 /// Maximum dimension (width or height) of a 2D texture.
73 Uint32 MaxTexture2DDimension = 0;
74
75 /// Maximum number of slices in a 2D texture array, or 0 if 2D texture arrays are not supported.
76 Uint32 MaxTexture2DArraySlices = 0;
77
78 /// Maximum dimension (width, height, or depth) of a 3D texture, or 0 if 3D textures are not supported.
79 Uint32 MaxTexture3DDimension = 0;
80
81 /// Maximum dimension (width or height) of a cubemap face, or 0 if cubemap textures are not supported.
82 Uint32 MaxTextureCubeDimension = 0;
83
84 /// Indicates if device supports 2D multisampled textures
85 Bool Texture2DMSSupported = False;
86
87 /// Indicates if device supports 2D multisampled texture arrays
88 Bool Texture2DMSArraySupported = False;
89
90 /// Indicates if device supports texture views
91 Bool TextureViewSupported = False;
92
93 /// Indicates if device supports cubemap arrays
94 Bool CubemapArraysSupported = False;
95 };
96
97 /// Describes supported device features
98 struct DeviceFeatures
99 {
100 /// Indicates if device supports separable programs
101 Bool SeparablePrograms = False;
102
103 /// Indicates if device supports indirect draw commands
104 Bool IndirectRendering = False;
105
106 /// Indicates if device supports wireframe fill mode
107 Bool WireframeFill = False;
108
109 /// Indicates if device supports multithreaded resource creation
110 Bool MultithreadedResourceCreation = False;
111
112 /// Indicates if device supports compute shaders
113 Bool ComputeShaders = False;
114
115 /// Indicates if device supports geometry shaders
116 Bool GeometryShaders = False;
117
118 /// Indicates if device supports tessellation
119 Bool Tessellation = False;
120
121 /// Indicates if device supports bindless resources
122 Bool BindlessResources = False;
123
124 /// Indicates if device supports occlusion queries (see Diligent::QUERY_TYPE_OCCLUSION).
125 Bool OcclusionQueries = False;
126
127 /// Indicates if device supports binary occlusion queries (see Diligent::QUERY_TYPE_BINARY_OCCLUSION).
128 Bool BinaryOcclusionQueries = False;
129
130 /// Indicates if device supports timestamp queries (see Diligent::QUERY_TYPE_TIMESTAMP).
131 Bool TimestampQueries = False;
132
133 /// Indicates if device supports pipeline statistics queries (see Diligent::QUERY_TYPE_PIPELINE_STATISTICS).
134 Bool PipelineStatisticsQueries = False;
135
136 /// Indicates if device supports depth bias clamping
137 Bool DepthBiasClamp = False;
138
139 /// Indicates if device supports depth clamping
140 Bool DepthClamp = False;
141
142 /// Indicates if device supports depth clamping
143 Bool IndependentBlend = False;
144
145 /// Indicates if device supports dual-source blend
146 Bool DualSourceBlend = False;
147
148 /// Indicates if device supports multiviewport
149 Bool MultiViewport = False;
150
151 /// Indicates if device supports all BC-compressed formats
152 Bool TextureCompressionBC = False;
153
154 /// Indicates if device supports writes to UAVs as well as atomic operations in vertex,
155 /// tessellation, and geometry shader stages.
156 Bool VertexPipelineUAVWritesAndAtomics = False;
157
158 /// Indicates if device supports writes to UAVs as well as atomic operations in pixel
159 /// shader stage.
160 Bool PixelUAVWritesAndAtomics = False;
161
162 /// Specifies whether all the extended UAV texture formats are available in shader code.
163 Bool TextureUAVExtendedFormats = False;
164 };
165
166 /// Device capabilities
167 struct DeviceCaps
168 {
169 /// Device type. See Diligent::DeviceType.
170 DeviceType DevType = DeviceType::Undefined;
171
172 /// Major revision of the graphics API supported by the graphics adapter.
173 /// Note that this value indicates the maximum supported feature level, so,
174 /// for example, if the device type is D3D11, this value will be 10 when
175 /// the maximum supported Direct3D feature level of the graphics adapter is 10.0.
176 Int32 MajorVersion = 0;
177
178 /// Minor revision of the graphics API supported by the graphics adapter.
179 /// Similar to MajorVersion, this value indicates the maximum supported feature level.
180 Int32 MinorVersion = 0;
181
182 /// Adapter type. See Diligent::ADAPTER_TYPE.
183 ADAPTER_TYPE AdaterType = ADAPTER_TYPE_UNKNOWN;
184
185 /// Texture sampling capabilities. See Diligent::SamplerCaps.
186 SamplerCaps SamCaps;
187
188 /// Texture capabilities. See Diligent::TextureCaps.
189 TextureCaps TexCaps;
190
191 /// Device features. See Diligent::DeviceFeatures.
192 DeviceFeatures Features;
193
194 bool IsGLDevice()const
195 {
196 return DevType == DeviceType::OpenGL || DevType == DeviceType::OpenGLES;
197 }
198 bool IsD3DDevice()const
199 {
200 return DevType == DeviceType::D3D11 || DevType == DeviceType::D3D12;
201 }
202 bool IsVulkanDevice()const
203 {
204 return DevType == DeviceType::Vulkan;
205 }
206
207 struct NDCAttribs
208 {
209 const float MinZ; // Minimum z value of normalized device coordinate space
210 const float ZtoDepthScale; // NDC z to depth scale
211 const float YtoVScale; // Scale to transform NDC y coordinate to texture V coordinate
212
213 float GetZtoDepthBias() const
214 {
215 // Returns ZtoDepthBias such that given NDC z coordinate, depth value can be
216 // computed as follows:
217 // d = z * ZtoDepthScale + ZtoDepthBias
218 return -MinZ * ZtoDepthScale;
219 }
220 };
221
222 const NDCAttribs& GetNDCAttribs()const
223 {
224 if (IsVulkanDevice())
225 {
226 // Note that Vulkan itself does not invert Y coordinate when transforming
227 // normalized device Y to window space. However, we use negative viewport
228 // height which achieves the same effect as in D3D, thererfore we need to
229 // invert y (see comments in DeviceContextVkImpl::CommitViewports() for details)
230 static constexpr const NDCAttribs NDCAttribsVk {0.0f, 1.0f, -0.5f};
231 return NDCAttribsVk;
232 }
233 else if (IsD3DDevice())
234 {
235 static constexpr const NDCAttribs NDCAttribsD3D {0.0f, 1.0f, -0.5f};
236 return NDCAttribsD3D;
237 }
238 else if (IsGLDevice())
239 {
240 static constexpr const NDCAttribs NDCAttribsGL {-1.0f, 0.5f, 0.5f};
241 return NDCAttribsGL;
242 }
243 else
244 {
245 static constexpr const NDCAttribs NDCAttribsDefault {0.0f, 1.0f, 0.5f};
246 return NDCAttribsDefault;
247 }
248 }
249 };
250 }
223 const NDCAttribs& GetNDCAttribs()const
224 {
225 if (IsVulkanDevice())
226 {
227 // Note that Vulkan itself does not invert Y coordinate when transforming
228 // normalized device Y to window space. However, we use negative viewport
229 // height which achieves the same effect as in D3D, thererfore we need to
230 // invert y (see comments in DeviceContextVkImpl::CommitViewports() for details)
231 static constexpr const NDCAttribs NDCAttribsVk {0.0f, 1.0f, -0.5f};
232 return NDCAttribsVk;
233 }
234 else if (IsD3DDevice())
235 {
236 static constexpr const NDCAttribs NDCAttribsD3D {0.0f, 1.0f, -0.5f};
237 return NDCAttribsD3D;
238 }
239 else if (IsGLDevice())
240 {
241 static constexpr const NDCAttribs NDCAttribsGL {-1.0f, 0.5f, 0.5f};
242 return NDCAttribsGL;
243 }
244 else
245 {
246 static constexpr const NDCAttribs NDCAttribsDefault {0.0f, 1.0f, 0.5f};
247 return NDCAttribsDefault;
248 }
249 }
250 #endif
251 };
252
253 DILIGENT_END_NAMESPACE // namespace Diligent
5151 #include "CommandList.h"
5252 #include "SwapChain.h"
5353
54 namespace Diligent
55 {
54 DILIGENT_BEGIN_NAMESPACE(Diligent)
55
5656
5757 // {DC92711B-A1BE-4319-B2BD-C662D1CC19E4}
58 static constexpr INTERFACE_ID IID_DeviceContext =
58 static const struct INTERFACE_ID IID_DeviceContext =
5959 {0xdc92711b, 0xa1be, 0x4319, {0xb2, 0xbd, 0xc6, 0x62, 0xd1, 0xcc, 0x19, 0xe4}};
6060
6161 /// Draw command flags
62 enum DRAW_FLAGS : Uint8
62 DILIGENT_TYPED_ENUM(DRAW_FLAGS, Uint8)
6363 {
6464 /// No flags.
6565 DRAW_FLAG_NONE = 0x00,
127127
128128 /// Refer to http://diligentgraphics.com/2018/12/09/resource-state-management/ for detailed explanation
129129 /// of resource state management in Diligent Engine.
130 enum RESOURCE_STATE_TRANSITION_MODE : Uint8
130 DILIGENT_TYPED_ENUM(RESOURCE_STATE_TRANSITION_MODE, Uint8)
131131 {
132132 /// Perform no state transitions and no state validation.
133133 /// Resource states are not accessed (either read or written) by the command.
163163 struct DrawAttribs
164164 {
165165 /// The number of vertices to draw.
166 Uint32 NumVertices = 0;
166 Uint32 NumVertices DEFAULT_INITIALIZER(0);
167167
168168 /// Additional flags, see Diligent::DRAW_FLAGS.
169 DRAW_FLAGS Flags = DRAW_FLAG_NONE;
169 DRAW_FLAGS Flags DEFAULT_INITIALIZER(DRAW_FLAG_NONE);
170170
171171 /// The number of instances to draw. If more than one instance is specified,
172172 /// instanced draw call will be performed.
173 Uint32 NumInstances = 1;
173 Uint32 NumInstances DEFAULT_INITIALIZER(1);
174174
175175 /// LOCATION (or INDEX, but NOT the byte offset) of the first vertex in the
176176 /// vertex buffer to start reading vertices from.
177 Uint32 StartVertexLocation = 0;
177 Uint32 StartVertexLocation DEFAULT_INITIALIZER(0);
178178
179179 /// LOCATION (or INDEX, but NOT the byte offset) in the vertex buffer to start
180180 /// reading instance data from.
181 Uint32 FirstInstanceLocation = 0;
182
183
181 Uint32 FirstInstanceLocation DEFAULT_INITIALIZER(0);
182
183
184 #if DILIGENT_CPP_INTERFACE
184185 /// Initializes the structure members with default values.
185186
186187 /// Default values:
206207 StartVertexLocation {_StartVertexLocation },
207208 FirstInstanceLocation{_FirstInstanceLocation}
208209 {}
210 #endif
209211 };
210212
211213
215217 struct DrawIndexedAttribs
216218 {
217219 /// The number of indices to draw.
218 Uint32 NumIndices = 0;
220 Uint32 NumIndices DEFAULT_INITIALIZER(0);
219221
220222 /// The type of elements in the index buffer.
221223 /// Allowed values: VT_UINT16 and VT_UINT32.
222 VALUE_TYPE IndexType = VT_UNDEFINED;
224 enum VALUE_TYPE IndexType DEFAULT_INITIALIZER(VT_UNDEFINED);
223225
224226 /// Additional flags, see Diligent::DRAW_FLAGS.
225 DRAW_FLAGS Flags = DRAW_FLAG_NONE;
227 enum DRAW_FLAGS Flags DEFAULT_INITIALIZER(DRAW_FLAG_NONE);
226228
227229 /// Number of instances to draw. If more than one instance is specified,
228230 /// instanced draw call will be performed.
229 Uint32 NumInstances = 1;
231 Uint32 NumInstances DEFAULT_INITIALIZER(1);
230232
231233 /// LOCATION (NOT the byte offset) of the first index in
232234 /// the index buffer to start reading indices from.
233 Uint32 FirstIndexLocation = 0;
235 Uint32 FirstIndexLocation DEFAULT_INITIALIZER(0);
234236
235237 /// A constant which is added to each index before accessing the vertex buffer.
236 Uint32 BaseVertex = 0;
238 Uint32 BaseVertex DEFAULT_INITIALIZER(0);
237239
238240 /// LOCATION (or INDEX, but NOT the byte offset) in the vertex
239241 /// buffer to start reading instance data from.
240 Uint32 FirstInstanceLocation = 0;
241
242
242 Uint32 FirstInstanceLocation DEFAULT_INITIALIZER(0);
243
244
245 #if DILIGENT_CPP_INTERFACE
243246 /// Initializes the structure members with default values.
244247
245248 /// Default values:
270273 BaseVertex {_BaseVertex },
271274 FirstInstanceLocation{_FirstInstanceLocation}
272275 {}
276 #endif
273277 };
274278
275279
279283 struct DrawIndirectAttribs
280284 {
281285 /// Additional flags, see Diligent::DRAW_FLAGS.
282 DRAW_FLAGS Flags = DRAW_FLAG_NONE;
286 enum DRAW_FLAGS Flags DEFAULT_INITIALIZER(DRAW_FLAG_NONE);
283287
284288 /// State transition mode for indirect draw arguments buffer.
285 RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
289 enum RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE);
286290
287291 /// Offset from the beginning of the buffer to the location of draw command attributes.
288 Uint32 IndirectDrawArgsOffset = 0;
292 Uint32 IndirectDrawArgsOffset DEFAULT_INITIALIZER(0);
289293
294
295 #if DILIGENT_CPP_INTERFACE
290296 /// Initializes the structure members with default values
291297
292298 /// Default values:
305311 IndirectAttribsBufferStateTransitionMode{_IndirectAttribsBufferStateTransitionMode},
306312 IndirectDrawArgsOffset {_IndirectDrawArgsOffset }
307313 {}
314 #endif
308315 };
309316
310317
315322 {
316323 /// The type of the elements in the index buffer.
317324 /// Allowed values: VT_UINT16 and VT_UINT32. Ignored if DrawAttribs::IsIndexed is False.
318 VALUE_TYPE IndexType = VT_UNDEFINED;
325 enum VALUE_TYPE IndexType DEFAULT_INITIALIZER(VT_UNDEFINED);
319326
320327 /// Additional flags, see Diligent::DRAW_FLAGS.
321 DRAW_FLAGS Flags = DRAW_FLAG_NONE;
328 enum DRAW_FLAGS Flags DEFAULT_INITIALIZER(DRAW_FLAG_NONE);
322329
323330 /// State transition mode for indirect draw arguments buffer.
324 RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
331 enum RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE);
325332
326333 /// Offset from the beginning of the buffer to the location of draw command attributes.
327 Uint32 IndirectDrawArgsOffset = 0;
328
329
334 Uint32 IndirectDrawArgsOffset DEFAULT_INITIALIZER(0);
335
336
337 #if DILIGENT_CPP_INTERFACE
330338 /// Initializes the structure members with default values
331339
332340 /// Default values:
348356 IndirectAttribsBufferStateTransitionMode{_IndirectAttribsBufferStateTransitionMode},
349357 IndirectDrawArgsOffset {_IndirectDrawArgsOffset }
350358 {}
359 #endif
351360 };
352361
353362
354363 /// Defines which parts of the depth-stencil buffer to clear.
355364
356365 /// These flags are used by IDeviceContext::ClearDepthStencil().
357 enum CLEAR_DEPTH_STENCIL_FLAGS : Uint32
366 DILIGENT_TYPED_ENUM(CLEAR_DEPTH_STENCIL_FLAGS, Uint32)
358367 {
359368 /// Perform no clear.
360369 CLEAR_DEPTH_FLAG_NONE = 0x00,
373382 /// This structure is used by IDeviceContext::DispatchCompute().
374383 struct DispatchComputeAttribs
375384 {
376 Uint32 ThreadGroupCountX = 1; ///< Number of groups dispatched in X direction.
377 Uint32 ThreadGroupCountY = 1; ///< Number of groups dispatched in Y direction.
378 Uint32 ThreadGroupCountZ = 1; ///< Number of groups dispatched in Z direction.
379
385 Uint32 ThreadGroupCountX DEFAULT_INITIALIZER(1); ///< Number of groups dispatched in X direction.
386 Uint32 ThreadGroupCountY DEFAULT_INITIALIZER(1); ///< Number of groups dispatched in Y direction.
387 Uint32 ThreadGroupCountZ DEFAULT_INITIALIZER(1); ///< Number of groups dispatched in Z direction.
388
389 #if DILIGENT_CPP_INTERFACE
380390 DispatchComputeAttribs()noexcept{}
381391
382392 /// Initializes the structure with user-specified values.
385395 ThreadGroupCountY {GroupsY},
386396 ThreadGroupCountZ {GroupsZ}
387397 {}
398 #endif
388399 };
389400
390401 /// Describes dispatch command arguments.
393404 struct DispatchComputeIndirectAttribs
394405 {
395406 /// State transition mode for indirect dispatch attributes buffer.
396 RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
407 enum RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE);
397408
398409 /// The offset from the beginning of the buffer to the dispatch command arguments.
399 Uint32 DispatchArgsByteOffset = 0;
400
410 Uint32 DispatchArgsByteOffset DEFAULT_INITIALIZER(0);
411
412 #if DILIGENT_CPP_INTERFACE
401413 DispatchComputeIndirectAttribs()noexcept{}
402414
403415 /// Initializes the structure with user-specified values.
407419 IndirectAttribsBufferStateTransitionMode{StateTransitionMode},
408420 DispatchArgsByteOffset {Offset }
409421 {}
422 #endif
410423 };
411424
412425
416429 struct ResolveTextureSubresourceAttribs
417430 {
418431 /// Mip level of the source multi-sampled texture to resolve.
419 Uint32 SrcMipLevel = 0;
432 Uint32 SrcMipLevel DEFAULT_INITIALIZER(0);
420433
421434 /// Array slice of the source multi-sampled texture to resolve.
422 Uint32 SrcSlice = 0;
435 Uint32 SrcSlice DEFAULT_INITIALIZER(0);
423436
424437 /// Source texture state transition mode, see Diligent::RESOURCE_STATE_TRANSITION_MODE.
425 RESOURCE_STATE_TRANSITION_MODE SrcTextureTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
438 enum RESOURCE_STATE_TRANSITION_MODE SrcTextureTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE);
426439
427440 /// Mip level of the destination non-multi-sampled texture.
428 Uint32 DstMipLevel = 0;
441 Uint32 DstMipLevel DEFAULT_INITIALIZER(0);
429442
430443 /// Array slice of the destination non-multi-sampled texture.
431 Uint32 DstSlice = 0;
444 Uint32 DstSlice DEFAULT_INITIALIZER(0);
432445
433446 /// Destination texture state transition mode, see Diligent::RESOURCE_STATE_TRANSITION_MODE.
434 RESOURCE_STATE_TRANSITION_MODE DstTextureTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
447 enum RESOURCE_STATE_TRANSITION_MODE DstTextureTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE);
435448
436449 /// If one or both textures are typeless, specifies the type of the typeless texture.
437450 /// If both texture formats are not typeless, in which case they must be identical, this member must be
438451 /// either TEX_FORMAT_UNKNOWN, or match this format.
439 TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
452 enum TEXTURE_FORMAT Format DEFAULT_INITIALIZER(TEX_FORMAT_UNKNOWN);
440453 };
441454
442455 /// Defines allowed flags for IDeviceContext::SetVertexBuffers() function.
443 enum SET_VERTEX_BUFFERS_FLAGS : Uint8
456 DILIGENT_TYPED_ENUM(SET_VERTEX_BUFFERS_FLAGS, Uint8)
444457 {
445458 /// No extra operations.
446459 SET_VERTEX_BUFFERS_FLAG_NONE = 0x00,
458471 struct Viewport
459472 {
460473 /// X coordinate of the left boundary of the viewport.
461 Float32 TopLeftX = 0.f;
474 Float32 TopLeftX DEFAULT_INITIALIZER(0.f);
462475
463476 /// Y coordinate of the top boundary of the viewport.
464477 /// When defining a viewport, DirectX convention is used:
465478 /// window coordinate systems originates in the LEFT TOP corner
466479 /// of the screen with Y axis pointing down.
467 Float32 TopLeftY = 0.f;
480 Float32 TopLeftY DEFAULT_INITIALIZER(0.f);
468481
469482 /// Viewport width.
470 Float32 Width = 0.f;
483 Float32 Width DEFAULT_INITIALIZER(0.f);
471484
472485 /// Viewport Height.
473 Float32 Height = 0.f;
486 Float32 Height DEFAULT_INITIALIZER(0.f);
474487
475488 /// Minimum depth of the viewport. Ranges between 0 and 1.
476 Float32 MinDepth = 0.f;
489 Float32 MinDepth DEFAULT_INITIALIZER(0.f);
477490
478491 /// Maximum depth of the viewport. Ranges between 0 and 1.
479 Float32 MaxDepth = 1.f;
480
492 Float32 MaxDepth DEFAULT_INITIALIZER(1.f);
493
494 #if DILIGENT_CPP_INTERFACE
481495 /// Initializes the structure.
482496 Viewport(Float32 _TopLeftX, Float32 _TopLeftY,
483497 Float32 _Width, Float32 _Height,
491505 {}
492506
493507 Viewport()noexcept{}
508 #endif
494509 };
495510
496511 /// Describes the rectangle.
502517 /// of the screen with Y axis pointing down.
503518 struct Rect
504519 {
505 Int32 left = 0; ///< X coordinate of the left boundary of the viewport.
506 Int32 top = 0; ///< Y coordinate of the top boundary of the viewport.
507 Int32 right = 0; ///< X coordinate of the right boundary of the viewport.
508 Int32 bottom = 0; ///< Y coordinate of the bottom boundary of the viewport.
509
520 Int32 left DEFAULT_INITIALIZER(0); ///< X coordinate of the left boundary of the viewport.
521 Int32 top DEFAULT_INITIALIZER(0); ///< Y coordinate of the top boundary of the viewport.
522 Int32 right DEFAULT_INITIALIZER(0); ///< X coordinate of the right boundary of the viewport.
523 Int32 bottom DEFAULT_INITIALIZER(0); ///< Y coordinate of the bottom boundary of the viewport.
524
525 #if DILIGENT_CPP_INTERFACE
510526 /// Initializes the structure
511527 Rect(Int32 _left, Int32 _top, Int32 _right, Int32 _bottom)noexcept :
512528 left {_left },
521537 {
522538 return right > left && bottom > top;
523539 }
540 #endif
524541 };
525542
526543
530547 struct CopyTextureAttribs
531548 {
532549 /// Source texture to copy data from.
533 ITexture* pSrcTexture = nullptr;
550 class ITexture* pSrcTexture DEFAULT_INITIALIZER(nullptr);
534551
535552 /// Mip level of the source texture to copy data from.
536 Uint32 SrcMipLevel = 0;
553 Uint32 SrcMipLevel DEFAULT_INITIALIZER(0);
537554
538555 /// Array slice of the source texture to copy data from. Must be 0 for non-array textures.
539 Uint32 SrcSlice = 0;
556 Uint32 SrcSlice DEFAULT_INITIALIZER(0);
540557
541558 /// Source region to copy. Use nullptr to copy the entire subresource.
542 const Box* pSrcBox = nullptr;
559 const struct Box* pSrcBox DEFAULT_INITIALIZER(nullptr);
543560
544561 /// Source texture state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE).
545 RESOURCE_STATE_TRANSITION_MODE SrcTextureTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
562 enum RESOURCE_STATE_TRANSITION_MODE SrcTextureTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE);
546563
547564 /// Destination texture.
548 ITexture* pDstTexture = nullptr;
565 class ITexture* pDstTexture DEFAULT_INITIALIZER(nullptr);
549566
550567 /// Destination mip level.
551 Uint32 DstMipLevel = 0;
568 Uint32 DstMipLevel DEFAULT_INITIALIZER(0);
552569
553570 /// Destination array slice. Must be 0 for non-array textures.
554 Uint32 DstSlice = 0;
571 Uint32 DstSlice DEFAULT_INITIALIZER(0);
555572
556573 /// X offset on the destination subresource.
557 Uint32 DstX = 0;
574 Uint32 DstX DEFAULT_INITIALIZER(0);
558575
559576 /// Y offset on the destination subresource.
560 Uint32 DstY = 0;
577 Uint32 DstY DEFAULT_INITIALIZER(0);
561578
562579 /// Z offset on the destination subresource
563 Uint32 DstZ = 0;
580 Uint32 DstZ DEFAULT_INITIALIZER(0);
564581
565582 /// Destination texture state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE).
566 RESOURCE_STATE_TRANSITION_MODE DstTextureTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
567
583 enum RESOURCE_STATE_TRANSITION_MODE DstTextureTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE);
584
585
586 #if DILIGENT_CPP_INTERFACE
568587 CopyTextureAttribs()noexcept{}
569588
570589 CopyTextureAttribs(ITexture* _pSrcTexture,
576595 pDstTexture {_pDstTexture },
577596 DstTextureTransitionMode{_DstTextureTransitionMode}
578597 {}
579 };
598 #endif
599 };
600
601
602
603 #if DILIGENT_CPP_INTERFACE
580604
581605 /// Device context interface.
582606
12241248 const ResolveTextureSubresourceAttribs& ResolveAttribs) = 0;
12251249 };
12261250
1227 }
1251 #else
1252
1253
1254
1255 #endif
1256
1257 DILIGENT_END_NAMESPACE // namespace Diligent
3232 #include "../../../Primitives/interface/Object.h"
3333 #include "GraphicsTypes.h"
3434
35 namespace Diligent
36 {
35 DILIGENT_BEGIN_NAMESPACE(Diligent)
36
3737
3838 // {5B4CCA0B-5075-4230-9759-F48769EE5502}
39 static constexpr INTERFACE_ID IID_DeviceObject =
39 static const struct INTERFACE_ID IID_DeviceObject =
4040 {0x5b4cca0b, 0x5075, 0x4230, {0x97, 0x59, 0xf4, 0x87, 0x69, 0xee, 0x55, 0x2}};
41
42 #if DILIGENT_CPP_INTERFACE
4143
4244 /// Base interface for all objects created by the render device Diligent::IRenderDevice
4345 class IDeviceObject : public IObject
7072 virtual Int32 GetUniqueID() const = 0;
7173 };
7274
73 } // namespace Diligent
75 #else
76
77 #endif
78
79 DILIGENT_END_NAMESPACE // namespace Diligent
3232 #include "../../../Primitives/interface/Object.h"
3333 #include "APIInfo.h"
3434
35 namespace Diligent
36 {
35 DILIGENT_BEGIN_NAMESPACE(Diligent)
3736
3837 class IShaderSourceInputStreamFactory;
3938
4039 // {D932B052-4ED6-4729-A532-F31DEEC100F3}
41 static constexpr INTERFACE_ID IID_EngineFactory =
40 static const struct INTERFACE_ID IID_EngineFactory =
4241 {0xd932b052, 0x4ed6, 0x4729, {0xa5, 0x32, 0xf3, 0x1d, 0xee, 0xc1, 0x0, 0xf3}};
4342
43 #if DILIGENT_CPP_INTERFACE
4444
4545 /// Engine factory base interface
4646 class IEngineFactory : public IObject
5555 virtual void CreateDefaultShaderSourceStreamFactory(const Char* SearchDirectories,
5656 IShaderSourceInputStreamFactory** ppShaderSourceFactory) const = 0;
5757
58 #if PLATFORM_ANDROID
58 # if PLATFORM_ANDROID
5959 /// On Android platform, it is necessary to initialize the file system before
6060 /// CreateDefaultShaderSourceStreamFactory() method can be called.
6161 /// \param [in] Activity - Pointer to the activity.
6262 /// \param [in] ActivityClassName - Activity class name.
6363 virtual void InitAndroidFileSystem(void* Activity, const char* ActivityClassName) const = 0;
64 #endif
64 # endif
6565 };
6666
67 } // namespace Diligent
67 #else
68
69 #endif
70
71 DILIGENT_END_NAMESPACE // namespace Diligent
3131
3232 #include "DeviceObject.h"
3333
34 namespace Diligent
35 {
34 DILIGENT_BEGIN_NAMESPACE(Diligent)
3635
3736 // {3B19184D-32AB-4701-84F4-9A0C03AE1672}
38 static constexpr INTERFACE_ID IID_Fence =
37 static const struct INTERFACE_ID IID_Fence =
3938 {0x3b19184d, 0x32ab, 0x4701, {0x84, 0xf4, 0x9a, 0xc, 0x3, 0xae, 0x16, 0x72}};
4039
40 // clang-format off
4141 /// Fence description
42 struct FenceDesc : DeviceObjectAttribs
43 {
42 struct FenceDesc DILIGENT_DERIVE(DeviceObjectAttribs)
4443 };
44 // clang-format on
45
46
47 #if DILIGENT_CPP_INTERFACE
4548
4649 /// Fence interface
4750
6972 virtual void Reset(Uint64 Value) = 0;
7073 };
7174
72 } // namespace Diligent
75 #else
76
77 #endif
78
79 DILIGENT_END_NAMESPACE // namespace Diligent
3737 #include "APIInfo.h"
3838
3939 /// Graphics engine namespace
40 namespace Diligent
41 {
42 class ITexture;
43 class IBuffer;
44
45 /// Value type
46
47 /// This enumeration describes value type. It is used by
48 /// - BufferDesc structure to describe value type of a formatted buffer
49 /// - DrawAttribs structure to describe index type for an indexed draw call
50 enum VALUE_TYPE : Uint8
51 {
52 VT_UNDEFINED = 0, ///< Undefined type
53 VT_INT8, ///< Signed 8-bit integer
54 VT_INT16, ///< Signed 16-bit integer
55 VT_INT32, ///< Signed 32-bit integer
56 VT_UINT8, ///< Unsigned 8-bit integer
57 VT_UINT16, ///< Unsigned 16-bit integer
58 VT_UINT32, ///< Unsigned 32-bit integer
59 VT_FLOAT16, ///< Half-precision 16-bit floating point
60 VT_FLOAT32, ///< Full-precision 32-bit floating point
61 VT_NUM_TYPES ///< Helper value storing total number of types in the enumeration
62 };
63
64 /// Resource binding flags
65
66 /// [D3D11_BIND_FLAG]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476085(v=vs.85).aspx
67 ///
68 /// This enumeration describes which parts of the pipeline a resource can be bound to.
69 /// It generally mirrors [D3D11_BIND_FLAG][] enumeration. It is used by
70 /// - BufferDesc to describe bind flags for a buffer
71 /// - TextureDesc to describe bind flags for a texture
72 enum BIND_FLAGS : Uint32
73 {
74 BIND_NONE = 0x0L, ///< Undefined binding
75 BIND_VERTEX_BUFFER = 0x1L, ///< A buffer can be bound as a vertex buffer
76 BIND_INDEX_BUFFER = 0x2L, ///< A buffer can be bound as an index buffer
77 BIND_UNIFORM_BUFFER = 0x4L, ///< A buffer can be bound as a uniform buffer
78 /// \warning This flag may not be combined with any other bind flag
79 BIND_SHADER_RESOURCE = 0x8L, ///< A buffer or a texture can be bound as a shader resource
80 /// \warning This flag cannot be used with MAP_WRITE_NO_OVERWRITE flag
81 BIND_STREAM_OUTPUT = 0x10L,///< A buffer can be bound as a target for stream output stage
82 BIND_RENDER_TARGET = 0x20L,///< A texture can be bound as a render target
83 BIND_DEPTH_STENCIL = 0x40L,///< A texture can be bound as a depth-stencil target
84 BIND_UNORDERED_ACCESS = 0x80L,///< A buffer or a texture can be bound as an unordered access view
85 BIND_INDIRECT_DRAW_ARGS = 0x100L///< A buffer can be bound as the source buffer for indirect draw commands
86 };
87 DEFINE_FLAG_ENUM_OPERATORS(BIND_FLAGS)
88
89 /// Resource usage
90
91 /// [D3D11_USAGE]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476259(v=vs.85).aspx
92 /// This enumeration describes expected resource usage. It generally mirrors [D3D11_USAGE] enumeration.
93 /// The enumeration is used by
94 /// - BufferDesc to describe usage for a buffer
95 /// - TextureDesc to describe usage for a texture
96 enum USAGE : Uint8
97 {
98 /// A resource that can only be read by the GPU. It cannot be written by the GPU,
99 /// and cannot be accessed at all by the CPU. This type of resource must be initialized
100 /// when it is created, since it cannot be changed after creation. \n
101 /// D3D11 Counterpart: D3D11_USAGE_IMMUTABLE. OpenGL counterpart: GL_STATIC_DRAW
102 USAGE_STATIC = 0,
103
104 /// A resource that requires read and write access by the GPU and can also be occasionally
105 /// written by the CPU. \n
106 /// D3D11 Counterpart: D3D11_USAGE_DEFAULT. OpenGL counterpart: GL_DYNAMIC_DRAW
107 USAGE_DEFAULT,
108
109 /// A resource that can be read by the GPU and written at least once per frame by the CPU. \n
110 /// D3D11 Counterpart: D3D11_USAGE_DYNAMIC. OpenGL counterpart: GL_STREAM_DRAW
111 USAGE_DYNAMIC,
112
113 /// A resource that facilitates transferring data from GPU to CPU. \n
114 /// D3D11 Counterpart: D3D11_USAGE_STAGING. OpenGL counterpart: GL_DYNAMIC_READ
115 USAGE_STAGING
116 };
117
118 /// Allowed CPU access mode flags when mapping a resource
40 DILIGENT_BEGIN_NAMESPACE(Diligent)
41
42 class ITexture;
43 class IBuffer;
44
45 /// Value type
46
47 /// This enumeration describes value type. It is used by
48 /// - BufferDesc structure to describe value type of a formatted buffer
49 /// - DrawAttribs structure to describe index type for an indexed draw call
50 DILIGENT_TYPED_ENUM(VALUE_TYPE, Uint8)
51 {
52 VT_UNDEFINED = 0, ///< Undefined type
53 VT_INT8, ///< Signed 8-bit integer
54 VT_INT16, ///< Signed 16-bit integer
55 VT_INT32, ///< Signed 32-bit integer
56 VT_UINT8, ///< Unsigned 8-bit integer
57 VT_UINT16, ///< Unsigned 16-bit integer
58 VT_UINT32, ///< Unsigned 32-bit integer
59 VT_FLOAT16, ///< Half-precision 16-bit floating point
60 VT_FLOAT32, ///< Full-precision 32-bit floating point
61 VT_NUM_TYPES ///< Helper value storing total number of types in the enumeration
62 };
63
64 /// Resource binding flags
65
66 /// [D3D11_BIND_FLAG]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476085(v=vs.85).aspx
67 ///
68 /// This enumeration describes which parts of the pipeline a resource can be bound to.
69 /// It generally mirrors [D3D11_BIND_FLAG][] enumeration. It is used by
70 /// - BufferDesc to describe bind flags for a buffer
71 /// - TextureDesc to describe bind flags for a texture
72 DILIGENT_TYPED_ENUM(BIND_FLAGS, Uint32)
73 {
74 BIND_NONE = 0x0L, ///< Undefined binding
75 BIND_VERTEX_BUFFER = 0x1L, ///< A buffer can be bound as a vertex buffer
76 BIND_INDEX_BUFFER = 0x2L, ///< A buffer can be bound as an index buffer
77 BIND_UNIFORM_BUFFER = 0x4L, ///< A buffer can be bound as a uniform buffer
78 /// \warning This flag may not be combined with any other bind flag
79 BIND_SHADER_RESOURCE = 0x8L, ///< A buffer or a texture can be bound as a shader resource
80 /// \warning This flag cannot be used with MAP_WRITE_NO_OVERWRITE flag
81 BIND_STREAM_OUTPUT = 0x10L,///< A buffer can be bound as a target for stream output stage
82 BIND_RENDER_TARGET = 0x20L,///< A texture can be bound as a render target
83 BIND_DEPTH_STENCIL = 0x40L,///< A texture can be bound as a depth-stencil target
84 BIND_UNORDERED_ACCESS = 0x80L,///< A buffer or a texture can be bound as an unordered access view
85 BIND_INDIRECT_DRAW_ARGS = 0x100L///< A buffer can be bound as the source buffer for indirect draw commands
86 };
87 DEFINE_FLAG_ENUM_OPERATORS(BIND_FLAGS)
88
89 /// Resource usage
90
91 /// [D3D11_USAGE]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476259(v=vs.85).aspx
92 /// This enumeration describes expected resource usage. It generally mirrors [D3D11_USAGE] enumeration.
93 /// The enumeration is used by
94 /// - BufferDesc to describe usage for a buffer
95 /// - TextureDesc to describe usage for a texture
96 DILIGENT_TYPED_ENUM(USAGE, Uint8)
97 {
98 /// A resource that can only be read by the GPU. It cannot be written by the GPU,
99 /// and cannot be accessed at all by the CPU. This type of resource must be initialized
100 /// when it is created, since it cannot be changed after creation. \n
101 /// D3D11 Counterpart: D3D11_USAGE_IMMUTABLE. OpenGL counterpart: GL_STATIC_DRAW
102 USAGE_STATIC = 0,
103
104 /// A resource that requires read and write access by the GPU and can also be occasionally
105 /// written by the CPU. \n
106 /// D3D11 Counterpart: D3D11_USAGE_DEFAULT. OpenGL counterpart: GL_DYNAMIC_DRAW
107 USAGE_DEFAULT,
108
109 /// A resource that can be read by the GPU and written at least once per frame by the CPU. \n
110 /// D3D11 Counterpart: D3D11_USAGE_DYNAMIC. OpenGL counterpart: GL_STREAM_DRAW
111 USAGE_DYNAMIC,
112
113 /// A resource that facilitates transferring data from GPU to CPU. \n
114 /// D3D11 Counterpart: D3D11_USAGE_STAGING. OpenGL counterpart: GL_DYNAMIC_READ
115 USAGE_STAGING
116 };
117
118 /// Allowed CPU access mode flags when mapping a resource
119119
120 /// The enumeration is used by
121 /// - BufferDesc to describe CPU access mode for a buffer
122 /// - TextureDesc to describe CPU access mode for a texture
123 /// \note Only USAGE_DYNAMIC resources can be mapped
124 enum CPU_ACCESS_FLAGS : Uint8
125 {
126 CPU_ACCESS_NONE = 0x00, ///< No CPU access
127 CPU_ACCESS_READ = 0x01, ///< A resource can be mapped for reading
128 CPU_ACCESS_WRITE = 0x02 ///< A resource can be mapped for writing
129 };
130 DEFINE_FLAG_ENUM_OPERATORS(CPU_ACCESS_FLAGS)
131
132 /// Resource mapping type
133
134 /// [D3D11_MAP]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476181(v=vs.85).aspx
135 /// Describes how a mapped resource will be accessed. This enumeration generally
136 /// mirrors [D3D11_MAP][] enumeration. It is used by
137 /// - IBuffer::Map to describe buffer mapping type
138 /// - ITexture::Map to describe texture mapping type
139 enum MAP_TYPE : Uint8
140 {
141 /// The resource is mapped for reading. \n
142 /// D3D11 counterpart: D3D11_MAP_READ. OpenGL counterpart: GL_MAP_READ_BIT
143 MAP_READ = 0x01,
144
145 /// The resource is mapped for writing. \n
146 /// D3D11 counterpart: D3D11_MAP_WRITE. OpenGL counterpart: GL_MAP_WRITE_BIT
147 MAP_WRITE = 0x02,
148
149 /// The resource is mapped for reading and writing. \n
150 /// D3D11 counterpart: D3D11_MAP_READ_WRITE. OpenGL counterpart: GL_MAP_WRITE_BIT | GL_MAP_READ_BIT
151 MAP_READ_WRITE = 0x03
152 };
153
154 /// Special map flags
155
156 /// Describes special arguments for a map operation.
157 /// This enumeration is used by
158 /// - IBuffer::Map to describe buffer mapping flags
159 /// - ITexture::Map to describe texture mapping flags
160 enum MAP_FLAGS : Uint8
161 {
162 MAP_FLAG_NONE = 0x000,
163
164 /// Specifies that map operation should not wait until previous command that
165 /// using the same resource completes. Map returns null pointer if the resource
166 /// is still in use.\n
167 /// D3D11 counterpart: D3D11_MAP_FLAG_DO_NOT_WAIT
168 /// \note: OpenGL does not have corresponding flag, so a buffer will always be mapped
169 MAP_FLAG_DO_NOT_WAIT = 0x001,
170
171 /// Previous contents of the resource will be undefined. This flag is only compatible with MAP_WRITE\n
172 /// D3D11 counterpart: D3D11_MAP_WRITE_DISCARD. OpenGL counterpart: GL_MAP_INVALIDATE_BUFFER_BIT
173 /// \note OpenGL implementation may orphan a buffer instead
174 MAP_FLAG_DISCARD = 0x002,
175
176 /// The system will not synchronize pending operations before mapping the buffer. It is responsibility
177 /// of the application to make sure that the buffer contents is not overwritten while it is in use by
178 /// the GPU.\n
179 /// D3D11 counterpart: D3D11_MAP_WRITE_NO_OVERWRITE. OpenGL counterpart: GL_MAP_UNSYNCHRONIZED_BIT
180 MAP_FLAG_NO_OVERWRITE = 0x004
181 };
182 DEFINE_FLAG_ENUM_OPERATORS(MAP_FLAGS)
183
184 /// Describes resource dimension
185
186 /// This enumeration is used by
187 /// - TextureDesc to describe texture type
188 /// - TextureViewDesc to describe texture view type
189 enum RESOURCE_DIMENSION : Uint8
190 {
191 RESOURCE_DIM_UNDEFINED = 0, ///< Texture type undefined
192 RESOURCE_DIM_BUFFER, ///< Buffer
193 RESOURCE_DIM_TEX_1D, ///< One-dimensional texture
194 RESOURCE_DIM_TEX_1D_ARRAY, ///< One-dimensional texture array
195 RESOURCE_DIM_TEX_2D, ///< Two-dimensional texture
196 RESOURCE_DIM_TEX_2D_ARRAY, ///< Two-dimensional texture array
197 RESOURCE_DIM_TEX_3D, ///< Three-dimensional texture
198 RESOURCE_DIM_TEX_CUBE, ///< Cube-map texture
199 RESOURCE_DIM_TEX_CUBE_ARRAY, ///< Cube-map array texture
200 RESOURCE_DIM_NUM_DIMENSIONS ///< Helper value that stores the total number of texture types in the enumeration
201 };
202
203 /// Texture view type
204
205 /// This enumeration describes allowed view types for a texture view. It is used by TextureViewDesc
206 /// structure.
207 enum TEXTURE_VIEW_TYPE : Uint8
208 {
209 /// Undefined view type
210 TEXTURE_VIEW_UNDEFINED = 0,
211
212 /// A texture view will define a shader resource view that will be used
213 /// as the source for the shader read operations
214 TEXTURE_VIEW_SHADER_RESOURCE,
215
216 /// A texture view will define a render target view that will be used
217 /// as the target for rendering operations
218 TEXTURE_VIEW_RENDER_TARGET,
219
220 /// A texture view will define a depth stencil view that will be used
221 /// as the target for rendering operations
222 TEXTURE_VIEW_DEPTH_STENCIL,
223
224 /// A texture view will define an unordered access view that will be used
225 /// for unordered read/write operations from the shaders
226 TEXTURE_VIEW_UNORDERED_ACCESS,
227
228 /// Helper value that stores that total number of texture views
229 TEXTURE_VIEW_NUM_VIEWS
230 };
231
232 /// Buffer view type
233
234 /// This enumeration describes allowed view types for a buffer view. It is used by BufferViewDesc
235 /// structure.
236 enum BUFFER_VIEW_TYPE : Uint8
237 {
238 /// Undefined view type
239 BUFFER_VIEW_UNDEFINED = 0,
240
241 /// A buffer view will define a shader resource view that will be used
242 /// as the source for the shader read operations
243 BUFFER_VIEW_SHADER_RESOURCE,
244
245 /// A buffer view will define an unordered access view that will be used
246 /// for unordered read/write operations from the shaders
247 BUFFER_VIEW_UNORDERED_ACCESS,
248
249 /// Helper value that stores that total number of buffer views
250 BUFFER_VIEW_NUM_VIEWS
251 };
252
253 /// Texture formats
254
255 /// This enumeration describes available texture formats and generally mirrors DXGI_FORMAT enumeration.
256 /// The table below provides detailed information on each format. Most of the formats are widely supported
257 /// by all modern APIs (DX10+, OpenGL3.3+ and OpenGLES3.0+). Specific requirements are additionally indicated.
258 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb173059(v=vs.85).aspx">DXGI_FORMAT enumeration on MSDN</a>,
259 /// <a href = "https://www.opengl.org/wiki/Image_Format">OpenGL Texture Formats</a>
260 ///
261 enum TEXTURE_FORMAT : Uint16
262 {
263 /// Unknown format
264 TEX_FORMAT_UNKNOWN = 0,
265
266 /// Four-component 128-bit typeless format with 32-bit channels. \n
267 /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_TYPELESS. OpenGL does not have direct counterpart, GL_RGBA32F is used.
268 TEX_FORMAT_RGBA32_TYPELESS,
269
270 /// Four-component 128-bit floating-point format with 32-bit channels. \n
271 /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_FLOAT. OpenGL counterpart: GL_RGBA32F.
272 TEX_FORMAT_RGBA32_FLOAT,
273
274 /// Four-component 128-bit unsigned-integer format with 32-bit channels. \n
275 /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_UINT. OpenGL counterpart: GL_RGBA32UI.
276 TEX_FORMAT_RGBA32_UINT,
277
278 /// Four-component 128-bit signed-integer format with 32-bit channels. \n
279 /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_SINT. OpenGL counterpart: GL_RGBA32I.
280 TEX_FORMAT_RGBA32_SINT,
281
282 /// Three-component 96-bit typeless format with 32-bit channels. \n
283 /// D3D counterpart: DXGI_FORMAT_R32G32B32_TYPELESS. OpenGL does not have direct counterpart, GL_RGB32F is used.
284 /// \warning This format has weak hardware support and is not recommended
285 TEX_FORMAT_RGB32_TYPELESS,
120 /// The enumeration is used by
121 /// - BufferDesc to describe CPU access mode for a buffer
122 /// - TextureDesc to describe CPU access mode for a texture
123 /// \note Only USAGE_DYNAMIC resources can be mapped
124 DILIGENT_TYPED_ENUM(CPU_ACCESS_FLAGS, Uint8)
125 {
126 CPU_ACCESS_NONE = 0x00, ///< No CPU access
127 CPU_ACCESS_READ = 0x01, ///< A resource can be mapped for reading
128 CPU_ACCESS_WRITE = 0x02 ///< A resource can be mapped for writing
129 };
130 DEFINE_FLAG_ENUM_OPERATORS(CPU_ACCESS_FLAGS)
131
132 /// Resource mapping type
133
134 /// [D3D11_MAP]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476181(v=vs.85).aspx
135 /// Describes how a mapped resource will be accessed. This enumeration generally
136 /// mirrors [D3D11_MAP][] enumeration. It is used by
137 /// - IBuffer::Map to describe buffer mapping type
138 /// - ITexture::Map to describe texture mapping type
139 DILIGENT_TYPED_ENUM(MAP_TYPE, Uint8)
140 {
141 /// The resource is mapped for reading. \n
142 /// D3D11 counterpart: D3D11_MAP_READ. OpenGL counterpart: GL_MAP_READ_BIT
143 MAP_READ = 0x01,
144
145 /// The resource is mapped for writing. \n
146 /// D3D11 counterpart: D3D11_MAP_WRITE. OpenGL counterpart: GL_MAP_WRITE_BIT
147 MAP_WRITE = 0x02,
148
149 /// The resource is mapped for reading and writing. \n
150 /// D3D11 counterpart: D3D11_MAP_READ_WRITE. OpenGL counterpart: GL_MAP_WRITE_BIT | GL_MAP_READ_BIT
151 MAP_READ_WRITE = 0x03
152 };
153
154 /// Special map flags
155
156 /// Describes special arguments for a map operation.
157 /// This enumeration is used by
158 /// - IBuffer::Map to describe buffer mapping flags
159 /// - ITexture::Map to describe texture mapping flags
160 DILIGENT_TYPED_ENUM(MAP_FLAGS, Uint8)
161 {
162 MAP_FLAG_NONE = 0x000,
163
164 /// Specifies that map operation should not wait until previous command that
165 /// using the same resource completes. Map returns null pointer if the resource
166 /// is still in use.\n
167 /// D3D11 counterpart: D3D11_MAP_FLAG_DO_NOT_WAIT
168 /// \note: OpenGL does not have corresponding flag, so a buffer will always be mapped
169 MAP_FLAG_DO_NOT_WAIT = 0x001,
170
171 /// Previous contents of the resource will be undefined. This flag is only compatible with MAP_WRITE\n
172 /// D3D11 counterpart: D3D11_MAP_WRITE_DISCARD. OpenGL counterpart: GL_MAP_INVALIDATE_BUFFER_BIT
173 /// \note OpenGL implementation may orphan a buffer instead
174 MAP_FLAG_DISCARD = 0x002,
175
176 /// The system will not synchronize pending operations before mapping the buffer. It is responsibility
177 /// of the application to make sure that the buffer contents is not overwritten while it is in use by
178 /// the GPU.\n
179 /// D3D11 counterpart: D3D11_MAP_WRITE_NO_OVERWRITE. OpenGL counterpart: GL_MAP_UNSYNCHRONIZED_BIT
180 MAP_FLAG_NO_OVERWRITE = 0x004
181 };
182 DEFINE_FLAG_ENUM_OPERATORS(MAP_FLAGS)
183
184 /// Describes resource dimension
185
186 /// This enumeration is used by
187 /// - TextureDesc to describe texture type
188 /// - TextureViewDesc to describe texture view type
189 DILIGENT_TYPED_ENUM(RESOURCE_DIMENSION, Uint8)
190 {
191 RESOURCE_DIM_UNDEFINED = 0, ///< Texture type undefined
192 RESOURCE_DIM_BUFFER, ///< Buffer
193 RESOURCE_DIM_TEX_1D, ///< One-dimensional texture
194 RESOURCE_DIM_TEX_1D_ARRAY, ///< One-dimensional texture array
195 RESOURCE_DIM_TEX_2D, ///< Two-dimensional texture
196 RESOURCE_DIM_TEX_2D_ARRAY, ///< Two-dimensional texture array
197 RESOURCE_DIM_TEX_3D, ///< Three-dimensional texture
198 RESOURCE_DIM_TEX_CUBE, ///< Cube-map texture
199 RESOURCE_DIM_TEX_CUBE_ARRAY, ///< Cube-map array texture
200 RESOURCE_DIM_NUM_DIMENSIONS ///< Helper value that stores the total number of texture types in the enumeration
201 };
202
203 /// Texture view type
204
205 /// This enumeration describes allowed view types for a texture view. It is used by TextureViewDesc
206 /// structure.
207 DILIGENT_TYPED_ENUM(TEXTURE_VIEW_TYPE, Uint8)
208 {
209 /// Undefined view type
210 TEXTURE_VIEW_UNDEFINED = 0,
211
212 /// A texture view will define a shader resource view that will be used
213 /// as the source for the shader read operations
214 TEXTURE_VIEW_SHADER_RESOURCE,
215
216 /// A texture view will define a render target view that will be used
217 /// as the target for rendering operations
218 TEXTURE_VIEW_RENDER_TARGET,
219
220 /// A texture view will define a depth stencil view that will be used
221 /// as the target for rendering operations
222 TEXTURE_VIEW_DEPTH_STENCIL,
223
224 /// A texture view will define an unordered access view that will be used
225 /// for unordered read/write operations from the shaders
226 TEXTURE_VIEW_UNORDERED_ACCESS,
227
228 /// Helper value that stores that total number of texture views
229 TEXTURE_VIEW_NUM_VIEWS
230 };
231
232 /// Buffer view type
233
234 /// This enumeration describes allowed view types for a buffer view. It is used by BufferViewDesc
235 /// structure.
236 DILIGENT_TYPED_ENUM(BUFFER_VIEW_TYPE, Uint8)
237 {
238 /// Undefined view type
239 BUFFER_VIEW_UNDEFINED = 0,
240
241 /// A buffer view will define a shader resource view that will be used
242 /// as the source for the shader read operations
243 BUFFER_VIEW_SHADER_RESOURCE,
244
245 /// A buffer view will define an unordered access view that will be used
246 /// for unordered read/write operations from the shaders
247 BUFFER_VIEW_UNORDERED_ACCESS,
248
249 /// Helper value that stores that total number of buffer views
250 BUFFER_VIEW_NUM_VIEWS
251 };
252
253 /// Texture formats
254
255 /// This enumeration describes available texture formats and generally mirrors DXGI_FORMAT enumeration.
256 /// The table below provides detailed information on each format. Most of the formats are widely supported
257 /// by all modern APIs (DX10+, OpenGL3.3+ and OpenGLES3.0+). Specific requirements are additionally indicated.
258 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb173059(v=vs.85).aspx">DXGI_FORMAT enumeration on MSDN</a>,
259 /// <a href = "https://www.opengl.org/wiki/Image_Format">OpenGL Texture Formats</a>
260 ///
261 DILIGENT_TYPED_ENUM(TEXTURE_FORMAT, Uint16)
262 {
263 /// Unknown format
264 TEX_FORMAT_UNKNOWN = 0,
265
266 /// Four-component 128-bit typeless format with 32-bit channels. \n
267 /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_TYPELESS. OpenGL does not have direct counterpart, GL_RGBA32F is used.
268 TEX_FORMAT_RGBA32_TYPELESS,
269
270 /// Four-component 128-bit floating-point format with 32-bit channels. \n
271 /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_FLOAT. OpenGL counterpart: GL_RGBA32F.
272 TEX_FORMAT_RGBA32_FLOAT,
273
274 /// Four-component 128-bit unsigned-integer format with 32-bit channels. \n
275 /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_UINT. OpenGL counterpart: GL_RGBA32UI.
276 TEX_FORMAT_RGBA32_UINT,
277
278 /// Four-component 128-bit signed-integer format with 32-bit channels. \n
279 /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_SINT. OpenGL counterpart: GL_RGBA32I.
280 TEX_FORMAT_RGBA32_SINT,
281
282 /// Three-component 96-bit typeless format with 32-bit channels. \n
283 /// D3D counterpart: DXGI_FORMAT_R32G32B32_TYPELESS. OpenGL does not have direct counterpart, GL_RGB32F is used.
284 /// \warning This format has weak hardware support and is not recommended
285 TEX_FORMAT_RGB32_TYPELESS,
286286
287 /// Three-component 96-bit floating-point format with 32-bit channels. \n
288 /// D3D counterpart: DXGI_FORMAT_R32G32B32_FLOAT. OpenGL counterpart: GL_RGB32F.
289 /// \warning This format has weak hardware support and is not recommended
290 TEX_FORMAT_RGB32_FLOAT,
291
292 /// Three-component 96-bit unsigned-integer format with 32-bit channels. \n
293 /// D3D counterpart: DXGI_FORMAT_R32G32B32_UINT. OpenGL counterpart: GL_RGB32UI.
294 /// \warning This format has weak hardware support and is not recommended
295 TEX_FORMAT_RGB32_UINT,
296
297 /// Three-component 96-bit signed-integer format with 32-bit channels. \n
298 /// D3D counterpart: DXGI_FORMAT_R32G32B32_SINT. OpenGL counterpart: GL_RGB32I.
299 /// \warning This format has weak hardware support and is not recommended
300 TEX_FORMAT_RGB32_SINT,
301
302 /// Four-component 64-bit typeless format with 16-bit channels. \n
303 /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_TYPELESS. OpenGL does not have direct counterpart, GL_RGBA16F is used.
304 TEX_FORMAT_RGBA16_TYPELESS,
305
306 /// Four-component 64-bit half-precision floating-point format with 16-bit channels. \n
307 /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_FLOAT. OpenGL counterpart: GL_RGBA16F.
308 TEX_FORMAT_RGBA16_FLOAT,
309
310 /// Four-component 64-bit unsigned-normalized-integer format with 16-bit channels. \n
311 /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_UNORM. OpenGL counterpart: GL_RGBA16. \n
312 /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
313 /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
314 TEX_FORMAT_RGBA16_UNORM,
315
316 /// Four-component 64-bit unsigned-integer format with 16-bit channels. \n
317 /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_UINT. OpenGL counterpart: GL_RGBA16UI.
318 TEX_FORMAT_RGBA16_UINT,
319
320 /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
321 /// Four-component 64-bit signed-normalized-integer format with 16-bit channels. \n
322 /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_SNORM. OpenGL counterpart: GL_RGBA16_SNORM. \n
323 /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
324 /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
325 TEX_FORMAT_RGBA16_SNORM,
326
327 /// Four-component 64-bit signed-integer format with 16-bit channels. \n
328 /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_SINT. OpenGL counterpart: GL_RGBA16I.
329 TEX_FORMAT_RGBA16_SINT,
330
331 /// Two-component 64-bit typeless format with 32-bit channels. \n
332 /// D3D counterpart: DXGI_FORMAT_R32G32_TYPELESS. OpenGL does not have direct counterpart, GL_RG32F is used.
333 TEX_FORMAT_RG32_TYPELESS,
334
335 /// Two-component 64-bit floating-point format with 32-bit channels. \n
336 /// D3D counterpart: DXGI_FORMAT_R32G32_FLOAT. OpenGL counterpart: GL_RG32F.
337 TEX_FORMAT_RG32_FLOAT,
338
339 /// Two-component 64-bit unsigned-integer format with 32-bit channels. \n
340 /// D3D counterpart: DXGI_FORMAT_R32G32_UINT. OpenGL counterpart: GL_RG32UI.
341 TEX_FORMAT_RG32_UINT,
342
343 /// Two-component 64-bit signed-integer format with 32-bit channels. \n
344 /// D3D counterpart: DXGI_FORMAT_R32G32_SINT. OpenGL counterpart: GL_RG32I.
345 TEX_FORMAT_RG32_SINT,
346
347 /// Two-component 64-bit typeless format with 32-bits for R channel and 8 bits for G channel. \n
348 /// D3D counterpart: DXGI_FORMAT_R32G8X24_TYPELESS. OpenGL does not have direct counterpart, GL_DEPTH32F_STENCIL8 is used.
349 TEX_FORMAT_R32G8X24_TYPELESS,
350
351 /// Two-component 64-bit format with 32-bit floating-point depth channel and 8-bit stencil channel. \n
352 /// D3D counterpart: DXGI_FORMAT_D32_FLOAT_S8X24_UINT. OpenGL counterpart: GL_DEPTH32F_STENCIL8.
353 TEX_FORMAT_D32_FLOAT_S8X24_UINT,
354
355 /// Two-component 64-bit format with 32-bit floating-point R channel and 8+24-bits of typeless data. \n
356 /// D3D counterpart: DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS. OpenGL does not have direct counterpart, GL_DEPTH32F_STENCIL8 is used.
357 TEX_FORMAT_R32_FLOAT_X8X24_TYPELESS,
358
359 /// Two-component 64-bit format with 32-bit typeless data and 8-bit G channel. \n
360 /// D3D counterpart: DXGI_FORMAT_X32_TYPELESS_G8X24_UINT
361 /// \warning This format is currently not implemented in OpenGL version
362 TEX_FORMAT_X32_TYPELESS_G8X24_UINT,
363
364 /// Four-component 32-bit typeless format with 10 bits for RGB and 2 bits for alpha channel. \n
365 /// D3D counterpart: DXGI_FORMAT_R10G10B10A2_TYPELESS. OpenGL does not have direct counterpart, GL_RGB10_A2 is used.
366 TEX_FORMAT_RGB10A2_TYPELESS,
367
368 /// Four-component 32-bit unsigned-normalized-integer format with 10 bits for each color and 2 bits for alpha channel. \n
369 /// D3D counterpart: DXGI_FORMAT_R10G10B10A2_UNORM. OpenGL counterpart: GL_RGB10_A2.
370 TEX_FORMAT_RGB10A2_UNORM,
371
372 /// Four-component 32-bit unsigned-integer format with 10 bits for each color and 2 bits for alpha channel. \n
373 /// D3D counterpart: DXGI_FORMAT_R10G10B10A2_UINT. OpenGL counterpart: GL_RGB10_A2UI.
374 TEX_FORMAT_RGB10A2_UINT,
375
376 /// Three-component 32-bit format encoding three partial precision channels using 11 bits for red and green and 10 bits for blue channel. \n
377 /// D3D counterpart: DXGI_FORMAT_R11G11B10_FLOAT. OpenGL counterpart: GL_R11F_G11F_B10F.
378 TEX_FORMAT_R11G11B10_FLOAT,
379
380 /// Four-component 32-bit typeless format with 8-bit channels. \n
381 /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_TYPELESS. OpenGL does not have direct counterpart, GL_RGBA8 is used.
382 TEX_FORMAT_RGBA8_TYPELESS,
383
384 /// Four-component 32-bit unsigned-normalized-integer format with 8-bit channels. \n
385 /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_UNORM. OpenGL counterpart: GL_RGBA8.
386 TEX_FORMAT_RGBA8_UNORM,
387
388 /// Four-component 32-bit unsigned-normalized-integer sRGB format with 8-bit channels. \n
389 /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_UNORM_SRGB. OpenGL counterpart: GL_SRGB8_ALPHA8.
390 TEX_FORMAT_RGBA8_UNORM_SRGB,
391
392 /// Four-component 32-bit unsigned-integer format with 8-bit channels. \n
393 /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_UINT. OpenGL counterpart: GL_RGBA8UI.
394 TEX_FORMAT_RGBA8_UINT,
395
396 /// Four-component 32-bit signed-normalized-integer format with 8-bit channels. \n
397 /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_SNORM. OpenGL counterpart: GL_RGBA8_SNORM.
398 TEX_FORMAT_RGBA8_SNORM,
399
400 /// Four-component 32-bit signed-integer format with 8-bit channels. \n
401 /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_SINT. OpenGL counterpart: GL_RGBA8I.
402 TEX_FORMAT_RGBA8_SINT,
403
404 /// Two-component 32-bit typeless format with 16-bit channels. \n
405 /// D3D counterpart: DXGI_FORMAT_R16G16_TYPELESS. OpenGL does not have direct counterpart, GL_RG16F is used.
406 TEX_FORMAT_RG16_TYPELESS,
407
408 /// Two-component 32-bit half-precision floating-point format with 16-bit channels. \n
409 /// D3D counterpart: DXGI_FORMAT_R16G16_FLOAT. OpenGL counterpart: GL_RG16F.
410 TEX_FORMAT_RG16_FLOAT,
411
412 /// Two-component 32-bit unsigned-normalized-integer format with 16-bit channels. \n
413 /// D3D counterpart: DXGI_FORMAT_R16G16_UNORM. OpenGL counterpart: GL_RG16. \n
414 /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
415 /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
416 TEX_FORMAT_RG16_UNORM,
417
418 /// Two-component 32-bit unsigned-integer format with 16-bit channels. \n
419 /// D3D counterpart: DXGI_FORMAT_R16G16_UINT. OpenGL counterpart: GL_RG16UI.
420 TEX_FORMAT_RG16_UINT,
421
422 /// Two-component 32-bit signed-normalized-integer format with 16-bit channels. \n
423 /// D3D counterpart: DXGI_FORMAT_R16G16_SNORM. OpenGL counterpart: GL_RG16_SNORM. \n
424 /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
425 /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
426 TEX_FORMAT_RG16_SNORM,
427
428 /// Two-component 32-bit signed-integer format with 16-bit channels. \n
429 /// D3D counterpart: DXGI_FORMAT_R16G16_SINT. OpenGL counterpart: GL_RG16I.
430 TEX_FORMAT_RG16_SINT,
431
432 /// Single-component 32-bit typeless format. \n
433 /// D3D counterpart: DXGI_FORMAT_R32_TYPELESS. OpenGL does not have direct counterpart, GL_R32F is used.
434 TEX_FORMAT_R32_TYPELESS,
435
436 /// Single-component 32-bit floating-point depth format. \n
437 /// D3D counterpart: DXGI_FORMAT_D32_FLOAT. OpenGL counterpart: GL_DEPTH_COMPONENT32F.
438 TEX_FORMAT_D32_FLOAT,
439
440 /// Single-component 32-bit floating-point format. \n
441 /// D3D counterpart: DXGI_FORMAT_R32_FLOAT. OpenGL counterpart: GL_R32F.
442 TEX_FORMAT_R32_FLOAT,
443
444 /// Single-component 32-bit unsigned-integer format. \n
445 /// D3D counterpart: DXGI_FORMAT_R32_UINT. OpenGL counterpart: GL_R32UI.
446 TEX_FORMAT_R32_UINT,
447
448 /// Single-component 32-bit signed-integer format. \n
449 /// D3D counterpart: DXGI_FORMAT_R32_SINT. OpenGL counterpart: GL_R32I.
450 TEX_FORMAT_R32_SINT,
451
452 /// Two-component 32-bit typeless format with 24 bits for R and 8 bits for G channel. \n
453 /// D3D counterpart: DXGI_FORMAT_R24G8_TYPELESS. OpenGL does not have direct counterpart, GL_DEPTH24_STENCIL8 is used.
454 TEX_FORMAT_R24G8_TYPELESS,
455
456 /// Two-component 32-bit format with 24 bits for unsigned-normalized-integer depth and 8 bits for stencil. \n
457 /// D3D counterpart: DXGI_FORMAT_D24_UNORM_S8_UINT. OpenGL counterpart: GL_DEPTH24_STENCIL8.
458 TEX_FORMAT_D24_UNORM_S8_UINT,
459
460 /// Two-component 32-bit format with 24 bits for unsigned-normalized-integer data and 8 bits of unreferenced data. \n
461 /// D3D counterpart: DXGI_FORMAT_R24_UNORM_X8_TYPELESS. OpenGL does not have direct counterpart, GL_DEPTH24_STENCIL8 is used.
462 TEX_FORMAT_R24_UNORM_X8_TYPELESS,
463
464 /// Two-component 32-bit format with 24 bits of unreferenced data and 8 bits of unsigned-integer data. \n
465 /// D3D counterpart: DXGI_FORMAT_X24_TYPELESS_G8_UINT
466 /// \warning This format is currently not implemented in OpenGL version
467 TEX_FORMAT_X24_TYPELESS_G8_UINT,
468
469 /// Two-component 16-bit typeless format with 8-bit channels. \n
470 /// D3D counterpart: DXGI_FORMAT_R8G8_TYPELESS. OpenGL does not have direct counterpart, GL_RG8 is used.
471 TEX_FORMAT_RG8_TYPELESS,
472
473 /// Two-component 16-bit unsigned-normalized-integer format with 8-bit channels. \n
474 /// D3D counterpart: DXGI_FORMAT_R8G8_UNORM. OpenGL counterpart: GL_RG8.
475 TEX_FORMAT_RG8_UNORM,
476
477 /// Two-component 16-bit unsigned-integer format with 8-bit channels. \n
478 /// D3D counterpart: DXGI_FORMAT_R8G8_UINT. OpenGL counterpart: GL_RG8UI.
479 TEX_FORMAT_RG8_UINT,
480
481 /// Two-component 16-bit signed-normalized-integer format with 8-bit channels. \n
482 /// D3D counterpart: DXGI_FORMAT_R8G8_SNORM. OpenGL counterpart: GL_RG8_SNORM.
483 TEX_FORMAT_RG8_SNORM,
484
485 /// Two-component 16-bit signed-integer format with 8-bit channels. \n
486 /// D3D counterpart: DXGI_FORMAT_R8G8_SINT. OpenGL counterpart: GL_RG8I.
487 TEX_FORMAT_RG8_SINT,
488
489 /// Single-component 16-bit typeless format. \n
490 /// D3D counterpart: DXGI_FORMAT_R16_TYPELESS. OpenGL does not have direct counterpart, GL_R16F is used.
491 TEX_FORMAT_R16_TYPELESS,
492
493 /// Single-component 16-bit half-precisoin floating-point format. \n
494 /// D3D counterpart: DXGI_FORMAT_R16_FLOAT. OpenGL counterpart: GL_R16F.
495 TEX_FORMAT_R16_FLOAT,
496
497 /// Single-component 16-bit unsigned-normalized-integer depth format. \n
498 /// D3D counterpart: DXGI_FORMAT_D16_UNORM. OpenGL counterpart: GL_DEPTH_COMPONENT16.
499 TEX_FORMAT_D16_UNORM,
500
501 /// Single-component 16-bit unsigned-normalized-integer format. \n
502 /// D3D counterpart: DXGI_FORMAT_R16_UNORM. OpenGL counterpart: GL_R16.
503 /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
504 /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
505 TEX_FORMAT_R16_UNORM,
506
507 /// Single-component 16-bit unsigned-integer format. \n
508 /// D3D counterpart: DXGI_FORMAT_R16_UINT. OpenGL counterpart: GL_R16UI.
509 TEX_FORMAT_R16_UINT,
510
511 /// Single-component 16-bit signed-normalized-integer format. \n
512 /// D3D counterpart: DXGI_FORMAT_R16_SNORM. OpenGL counterpart: GL_R16_SNORM. \n
513 /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
514 /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
515 TEX_FORMAT_R16_SNORM,
516
517 /// Single-component 16-bit signed-integer format. \n
518 /// D3D counterpart: DXGI_FORMAT_R16_SINT. OpenGL counterpart: GL_R16I.
519 TEX_FORMAT_R16_SINT,
520
521 /// Single-component 8-bit typeless format. \n
522 /// D3D counterpart: DXGI_FORMAT_R8_TYPELESS. OpenGL does not have direct counterpart, GL_R8 is used.
523 TEX_FORMAT_R8_TYPELESS,
524
525 /// Single-component 8-bit unsigned-normalized-integer format. \n
526 /// D3D counterpart: DXGI_FORMAT_R8_UNORM. OpenGL counterpart: GL_R8.
527 TEX_FORMAT_R8_UNORM,
528
529 /// Single-component 8-bit unsigned-integer format. \n
530 /// D3D counterpart: DXGI_FORMAT_R8_UINT. OpenGL counterpart: GL_R8UI.
531 TEX_FORMAT_R8_UINT,
532
533 /// Single-component 8-bit signed-normalized-integer format. \n
534 /// D3D counterpart: DXGI_FORMAT_R8_SNORM. OpenGL counterpart: GL_R8_SNORM.
535 TEX_FORMAT_R8_SNORM,
536
537 /// Single-component 8-bit signed-integer format. \n
538 /// D3D counterpart: DXGI_FORMAT_R8_SINT. OpenGL counterpart: GL_R8I.
539 TEX_FORMAT_R8_SINT,
540
541 /// Single-component 8-bit unsigned-normalized-integer format for alpha only. \n
542 /// D3D counterpart: DXGI_FORMAT_A8_UNORM
543 /// \warning This format is not availanle in OpenGL
544 TEX_FORMAT_A8_UNORM,
545
546 /// Single-component 1-bit format. \n
547 /// D3D counterpart: DXGI_FORMAT_R1_UNORM
548 /// \warning This format is not availanle in OpenGL
549 TEX_FORMAT_R1_UNORM,
550
551 /// Three partial-precision floating pointer numbers sharing single exponent encoded into a 32-bit value. \n
552 /// D3D counterpart: DXGI_FORMAT_R9G9B9E5_SHAREDEXP. OpenGL counterpart: GL_RGB9_E5.
553 TEX_FORMAT_RGB9E5_SHAREDEXP,
554
555 /// Four-component unsigned-normalized integer format analogous to UYVY encoding. \n
556 /// D3D counterpart: DXGI_FORMAT_R8G8_B8G8_UNORM
557 /// \warning This format is not availanle in OpenGL
558 TEX_FORMAT_RG8_B8G8_UNORM,
559
560 /// Four-component unsigned-normalized integer format analogous to YUY2 encoding. \n
561 /// D3D counterpart: DXGI_FORMAT_G8R8_G8B8_UNORM
562 /// \warning This format is not availanle in OpenGL
563 TEX_FORMAT_G8R8_G8B8_UNORM,
564
565 /// Four-component typeless block-compression format with 1:8 compression ratio.\n
566 /// D3D counterpart: DXGI_FORMAT_BC1_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGB_S3TC_DXT1_EXT is used. \n
567 /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
568 /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
569 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC1">BC1 on MSDN </a>,
570 /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT1_Format">DXT1 on OpenGL.org </a>
571 TEX_FORMAT_BC1_TYPELESS,
572
573 /// Four-component unsigned-normalized-integer block-compression format with 5 bits for R, 6 bits for G, 5 bits for B, and 0 or 1 bit for A channel.
574 /// The pixel data is encoded using 8 bytes per 4x4 block (4 bits per pixel) providing 1:8 compression ratio against RGBA8 format. \n
575 /// D3D counterpart: DXGI_FORMAT_BC1_UNORM. OpenGL counterpart: GL_COMPRESSED_RGB_S3TC_DXT1_EXT.\n
576 /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
577 /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
578 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC1">BC1 on MSDN </a>,
579 /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT1_Format">DXT1 on OpenGL.org </a>
580 TEX_FORMAT_BC1_UNORM,
581
582 /// Four-component unsigned-normalized-integer block-compression sRGB format with 5 bits for R, 6 bits for G, 5 bits for B, and 0 or 1 bit for A channel. \n
583 /// The pixel data is encoded using 8 bytes per 4x4 block (4 bits per pixel) providing 1:8 compression ratio against RGBA8 format. \n
584 /// D3D counterpart: DXGI_FORMAT_BC1_UNORM_SRGB. OpenGL counterpart: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT.\n
585 /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
586 /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
587 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC1">BC1 on MSDN </a>,
588 /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT1_Format">DXT1 on OpenGL.org </a>
589 TEX_FORMAT_BC1_UNORM_SRGB,
590
591 /// Four component typeless block-compression format with 1:4 compression ratio.\n
592 /// D3D counterpart: DXGI_FORMAT_BC2_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT is used. \n
593 /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
594 /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
595 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC2">BC2 on MSDN </a>,
596 /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT3_Format">DXT3 on OpenGL.org </a>
597 TEX_FORMAT_BC2_TYPELESS,
598
599 /// Four-component unsigned-normalized-integer block-compression format with 5 bits for R, 6 bits for G, 5 bits for B, and 4 bits for low-coherent separate A channel.
600 /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:4 compression ratio against RGBA8 format. \n
601 /// D3D counterpart: DXGI_FORMAT_BC2_UNORM. OpenGL counterpart: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT. \n
602 /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
603 /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
604 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC2">BC2 on MSDN </a>,
605 /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT3_Format">DXT3 on OpenGL.org </a>
606 TEX_FORMAT_BC2_UNORM,
607
608 /// Four-component signed-normalized-integer block-compression sRGB format with 5 bits for R, 6 bits for G, 5 bits for B, and 4 bits for low-coherent separate A channel.
609 /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:4 compression ratio against RGBA8 format. \n
610 /// D3D counterpart: DXGI_FORMAT_BC2_UNORM_SRGB. OpenGL counterpart: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT. \n
611 /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
612 /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
613 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC2">BC2 on MSDN </a>,
614 /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT3_Format">DXT3 on OpenGL.org </a>
615 TEX_FORMAT_BC2_UNORM_SRGB,
616
617 /// Four-component typeless block-compression format with 1:4 compression ratio.\n
618 /// D3D counterpart: DXGI_FORMAT_BC3_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT is used. \n
619 /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
620 /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
621 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC3">BC3 on MSDN </a>,
622 /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT5_Format">DXT5 on OpenGL.org </a>
623 TEX_FORMAT_BC3_TYPELESS,
624
625 /// Four-component unsigned-normalized-integer block-compression format with 5 bits for R, 6 bits for G, 5 bits for B, and 8 bits for highly-coherent A channel.
626 /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:4 compression ratio against RGBA8 format. \n
627 /// D3D counterpart: DXGI_FORMAT_BC3_UNORM. OpenGL counterpart: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT. \n
628 /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
629 /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
630 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC3">BC3 on MSDN </a>,
631 /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT5_Format">DXT5 on OpenGL.org </a>
632 TEX_FORMAT_BC3_UNORM,
633
634 /// Four-component unsigned-normalized-integer block-compression sRGB format with 5 bits for R, 6 bits for G, 5 bits for B, and 8 bits for highly-coherent A channel.
635 /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:4 compression ratio against RGBA8 format. \n
636 /// D3D counterpart: DXGI_FORMAT_BC3_UNORM_SRGB. OpenGL counterpart: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT. \n
637 /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
638 /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
639 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC3">BC3 on MSDN </a>,
640 /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT5_Format">DXT5 on OpenGL.org </a>
641 TEX_FORMAT_BC3_UNORM_SRGB,
642
643 /// One-component typeless block-compression format with 1:2 compression ratio. \n
644 /// D3D counterpart: DXGI_FORMAT_BC4_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RED_RGTC1 is used. \n
645 /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
646 /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
647 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC4">BC4 on MSDN </a>,
648 /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
649 TEX_FORMAT_BC4_TYPELESS,
650
651 /// One-component unsigned-normalized-integer block-compression format with 8 bits for R channel.
652 /// The pixel data is encoded using 8 bytes per 4x4 block (4 bits per pixel) providing 1:2 compression ratio against R8 format. \n
653 /// D3D counterpart: DXGI_FORMAT_BC4_UNORM. OpenGL counterpart: GL_COMPRESSED_RED_RGTC1. \n
654 /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
655 /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
656 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC4">BC4 on MSDN </a>,
657 /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
658 TEX_FORMAT_BC4_UNORM,
659
660 /// One-component signed-normalized-integer block-compression format with 8 bits for R channel.
661 /// The pixel data is encoded using 8 bytes per 4x4 block (4 bits per pixel) providing 1:2 compression ratio against R8 format. \n
662 /// D3D counterpart: DXGI_FORMAT_BC4_SNORM. OpenGL counterpart: GL_COMPRESSED_SIGNED_RED_RGTC1. \n
663 /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
664 /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
665 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC4">BC4 on MSDN </a>,
666 /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
667 TEX_FORMAT_BC4_SNORM,
668
669 /// Two-component typeless block-compression format with 1:2 compression ratio. \n
670 /// D3D counterpart: DXGI_FORMAT_BC5_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RG_RGTC2 is used. \n
671 /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
672 /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
673 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC5">BC5 on MSDN </a>,
674 /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
675 TEX_FORMAT_BC5_TYPELESS,
676
677 /// Two-component unsigned-normalized-integer block-compression format with 8 bits for R and 8 bits for G channel.
678 /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:2 compression ratio against RG8 format. \n
679 /// D3D counterpart: DXGI_FORMAT_BC5_UNORM. OpenGL counterpart: GL_COMPRESSED_RG_RGTC2. \n
680 /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
681 /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
682 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC5">BC5 on MSDN </a>,
683 /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
684 TEX_FORMAT_BC5_UNORM,
685
686 /// Two-component signed-normalized-integer block-compression format with 8 bits for R and 8 bits for G channel.
687 /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:2 compression ratio against RG8 format. \n
688 /// D3D counterpart: DXGI_FORMAT_BC5_SNORM. OpenGL counterpart: GL_COMPRESSED_SIGNED_RG_RGTC2. \n
689 /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
690 /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
691 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC5">BC5 on MSDN </a>,
692 /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
693 TEX_FORMAT_BC5_SNORM,
694
695 /// Three-component 16-bit unsigned-normalized-integer format with 5 bits for blue, 6 bits for green, and 5 bits for red channel. \n
696 /// D3D counterpart: DXGI_FORMAT_B5G6R5_UNORM
697 /// \warning This format is not available until D3D11.1 and Windows 8. It is also not available in OpenGL
698 TEX_FORMAT_B5G6R5_UNORM,
699
700 /// Four-component 16-bit unsigned-normalized-integer format with 5 bits for each color channel and 1-bit alpha. \n
701 /// D3D counterpart: DXGI_FORMAT_B5G5R5A1_UNORM
702 /// \warning This format is not available until D3D11.1 and Windows 8. It is also not available in OpenGL
703 TEX_FORMAT_B5G5R5A1_UNORM,
704
705 /// Four-component 32-bit unsigned-normalized-integer format with 8 bits for each channel. \n
706 /// D3D counterpart: DXGI_FORMAT_B8G8R8A8_UNORM.
707 /// \warning This format is not available in OpenGL
708 TEX_FORMAT_BGRA8_UNORM,
709
710 /// Four-component 32-bit unsigned-normalized-integer format with 8 bits for each color channel and 8 bits unused. \n
711 /// D3D counterpart: DXGI_FORMAT_B8G8R8X8_UNORM.
712 /// \warning This format is not available in OpenGL
713 TEX_FORMAT_BGRX8_UNORM,
714
715 /// Four-component 32-bit 2.8-biased fixed-point format with 10 bits for each color channel and 2-bit alpha. \n
716 /// D3D counterpart: DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM.
717 /// \warning This format is not available in OpenGL
718 TEX_FORMAT_R10G10B10_XR_BIAS_A2_UNORM,
719
720 /// Four-component 32-bit typeless format with 8 bits for each channel. \n
721 /// D3D counterpart: DXGI_FORMAT_B8G8R8A8_TYPELESS.
722 /// \warning This format is not available in OpenGL
723 TEX_FORMAT_BGRA8_TYPELESS,
724
725 /// Four-component 32-bit unsigned-normalized sRGB format with 8 bits for each channel. \n
726 /// D3D counterpart: DXGI_FORMAT_B8G8R8A8_UNORM_SRGB.
727 /// \warning This format is not available in OpenGL.
728 TEX_FORMAT_BGRA8_UNORM_SRGB,
729
730 /// Four-component 32-bit typeless format that with 8 bits for each color channel, and 8 bits are unused. \n
731 /// D3D counterpart: DXGI_FORMAT_B8G8R8X8_TYPELESS.
732 /// \warning This format is not available in OpenGL.
733 TEX_FORMAT_BGRX8_TYPELESS,
734
735 /// Four-component 32-bit unsigned-normalized sRGB format with 8 bits for each color channel, and 8 bits are unused. \n
736 /// D3D counterpart: DXGI_FORMAT_B8G8R8X8_UNORM_SRGB.
737 /// \warning This format is not available in OpenGL.
738 TEX_FORMAT_BGRX8_UNORM_SRGB,
739
740 /// Three-component typeless block-compression format. \n
741 /// D3D counterpart: DXGI_FORMAT_BC6H_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT is used. \n
742 /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
743 /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
744 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308952(v=vs.85).aspx">BC6H on MSDN </a>,
745 /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
746 TEX_FORMAT_BC6H_TYPELESS,
747
748 /// Three-component unsigned half-precision floating-point format with 16 bits for each channel. \n
749 /// D3D counterpart: DXGI_FORMAT_BC6H_UF16. OpenGL counterpart: GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT. \n
750 /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
751 /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
752 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308952(v=vs.85).aspx">BC6H on MSDN </a>,
753 /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
754 TEX_FORMAT_BC6H_UF16,
755
756 /// Three-channel signed half-precision floating-point format with 16 bits per each channel. \n
757 /// D3D counterpart: DXGI_FORMAT_BC6H_SF16. OpenGL counterpart: GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT. \n
758 /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
759 /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
760 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308952(v=vs.85).aspx">BC6H on MSDN </a>,
761 /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
762 TEX_FORMAT_BC6H_SF16,
763
764 /// Three-component typeless block-compression format. \n
765 /// D3D counterpart: DXGI_FORMAT_BC7_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGBA_BPTC_UNORM is used. \n
766 /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
767 /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
768 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308953(v=vs.85).aspx">BC7 on MSDN </a>,
769 /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
770 TEX_FORMAT_BC7_TYPELESS,
771
772 /// Three-component block-compression unsigned-normalized-integer format with 4 to 7 bits per color channel and 0 to 8 bits of alpha. \n
773 /// D3D counterpart: DXGI_FORMAT_BC7_UNORM. OpenGL counterpart: GL_COMPRESSED_RGBA_BPTC_UNORM. \n
774 /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
775 /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
776 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308953(v=vs.85).aspx">BC7 on MSDN </a>,
777 /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
778 TEX_FORMAT_BC7_UNORM,
779
780 /// Three-component block-compression unsigned-normalized-integer sRGB format with 4 to 7 bits per color channel and 0 to 8 bits of alpha. \n
781 /// D3D counterpart: DXGI_FORMAT_BC7_UNORM_SRGB. OpenGL counterpart: GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM. \n
782 /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
783 /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
784 /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308953(v=vs.85).aspx">BC7 on MSDN </a>,
785 /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
786 TEX_FORMAT_BC7_UNORM_SRGB,
787
788 /// Helper member containing the total number of texture formats in the enumeration
789 TEX_FORMAT_NUM_FORMATS
790 };
791
792 /// Filter type
793
794 /// This enumeration defines filter type. It is used by SamplerDesc structure to define min, mag and mip filters.
795 /// \note On D3D11, comparison filters only work with textures that have the following formats:
796 /// R32_FLOAT_X8X24_TYPELESS, R32_FLOAT, R24_UNORM_X8_TYPELESS, R16_UNORM.
797 enum FILTER_TYPE : Uint8
798 {
799 FILTER_TYPE_UNKNOWN = 0, ///< Unknown filter type
800 FILTER_TYPE_POINT, ///< Point filtering
801 FILTER_TYPE_LINEAR, ///< Linear filtering
802 FILTER_TYPE_ANISOTROPIC, ///< Anisotropic filtering
803 FILTER_TYPE_COMPARISON_POINT, ///< Comparison-point filtering
804 FILTER_TYPE_COMPARISON_LINEAR, ///< Comparison-linear filtering
805 FILTER_TYPE_COMPARISON_ANISOTROPIC, ///< Comparison-anisotropic filtering
806 FILTER_TYPE_MINIMUM_POINT, ///< Minimum-point filtering (DX12 only)
807 FILTER_TYPE_MINIMUM_LINEAR, ///< Minimum-linear filtering (DX12 only)
808 FILTER_TYPE_MINIMUM_ANISOTROPIC, ///< Minimum-anisotropic filtering (DX12 only)
809 FILTER_TYPE_MAXIMUM_POINT, ///< Maximum-point filtering (DX12 only)
810 FILTER_TYPE_MAXIMUM_LINEAR, ///< Maximum-linear filtering (DX12 only)
811 FILTER_TYPE_MAXIMUM_ANISOTROPIC, ///< Maximum-anisotropic filtering (DX12 only)
812 FILTER_TYPE_NUM_FILTERS ///< Helper value that stores the total number of filter types in the enumeration
813 };
814
815 /// Texture address mode
816
817 /// [D3D11_TEXTURE_ADDRESS_MODE]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476256(v=vs.85).aspx
818 /// [D3D12_TEXTURE_ADDRESS_MODE]: https://msdn.microsoft.com/en-us/library/windows/desktop/dn770441(v=vs.85).aspx
819 /// Defines a technique for resolving texture coordinates that are outside of
820 /// the boundaries of a texture. The enumeration generally mirrors [D3D11_TEXTURE_ADDRESS_MODE][]/[D3D12_TEXTURE_ADDRESS_MODE][] enumeration.
821 /// It is used by SamplerDesc structure to define the address mode for U,V and W texture coordinates.
822 enum TEXTURE_ADDRESS_MODE : Uint8
823 {
824 /// Unknown mode
825 TEXTURE_ADDRESS_UNKNOWN = 0,
826
827 /// Tile the texture at every integer junction. \n
828 /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_WRAP/D3D12_TEXTURE_ADDRESS_MODE_WRAP. OpenGL counterpart: GL_REPEAT
829 TEXTURE_ADDRESS_WRAP = 1,
830
831 /// Flip the texture at every integer junction. \n
832 /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_MIRROR/D3D12_TEXTURE_ADDRESS_MODE_MIRROR. OpenGL counterpart: GL_MIRRORED_REPEAT
833 TEXTURE_ADDRESS_MIRROR = 2,
834
835 /// Texture coordinates outside the range [0.0, 1.0] are set to the
836 /// texture color at 0.0 or 1.0, respectively. \n
837 /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_CLAMP/D3D12_TEXTURE_ADDRESS_MODE_CLAMP. OpenGL counterpart: GL_CLAMP_TO_EDGE
838 TEXTURE_ADDRESS_CLAMP = 3,
839
840 /// Texture coordinates outside the range [0.0, 1.0] are set to the border color specified
841 /// specified in SamplerDesc structure. \n
842 /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_BORDER/D3D12_TEXTURE_ADDRESS_MODE_BORDER. OpenGL counterpart: GL_CLAMP_TO_BORDER
843 TEXTURE_ADDRESS_BORDER = 4,
844
845 /// Similar to TEXTURE_ADDRESS_MIRROR and TEXTURE_ADDRESS_CLAMP. Takes the absolute
846 /// value of the texture coordinate (thus, mirroring around 0), and then clamps to
847 /// the maximum value. \n
848 /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_MIRROR_ONCE/D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE. OpenGL counterpart: GL_MIRROR_CLAMP_TO_EDGE
849 /// \note GL_MIRROR_CLAMP_TO_EDGE is only available in OpenGL4.4+, and is not available until at least OpenGLES3.1
850 TEXTURE_ADDRESS_MIRROR_ONCE = 5,
851
852 /// Helper value that stores the total number of texture address modes in the enumeration
853 TEXTURE_ADDRESS_NUM_MODES
854 };
855
856 /// Comparison function
857
858 /// [D3D11_COMPARISON_FUNC]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476101(v=vs.85).aspx
859 /// [D3D12_COMPARISON_FUNC]: https://msdn.microsoft.com/en-us/library/windows/desktop/dn770349(v=vs.85).aspx
860 /// This enumeartion defines a comparison function. It generally mirrors [D3D11_COMPARISON_FUNC]/[D3D12_COMPARISON_FUNC] enum and is used by
861 /// - SamplerDesc to define a comparison function if one of the comparison mode filters is used
862 /// - StencilOpDesc to define a stencil function
863 /// - DepthStencilStateDesc to define a depth function
864 enum COMPARISON_FUNCTION : Uint8
865 {
866 /// Unknown comparison function
867 COMPARISON_FUNC_UNKNOWN = 0,
868
869 /// Comparison never passes. \n
870 /// Direct3D counterpart: D3D11_COMPARISON_NEVER/D3D12_COMPARISON_FUNC_NEVER. OpenGL counterpart: GL_NEVER.
871 COMPARISON_FUNC_NEVER,
872
873 /// Comparison passes if the source data is less than the destination data.\n
874 /// Direct3D counterpart: D3D11_COMPARISON_LESS/D3D12_COMPARISON_FUNC_LESS. OpenGL counterpart: GL_LESS.
875 COMPARISON_FUNC_LESS,
876
877 /// Comparison passes if the source data is equal to the destination data.\n
878 /// Direct3D counterpart: D3D11_COMPARISON_EQUAL/D3D12_COMPARISON_FUNC_EQUAL. OpenGL counterpart: GL_EQUAL.
879 COMPARISON_FUNC_EQUAL,
880
881 /// Comparison passes if the source data is less than or equal to the destination data.\n
882 /// Direct3D counterpart: D3D11_COMPARISON_LESS_EQUAL/D3D12_COMPARISON_FUNC_LESS_EQUAL. OpenGL counterpart: GL_LEQUAL.
883 COMPARISON_FUNC_LESS_EQUAL,
884
885 /// Comparison passes if the source data is greater than the destination data.\n
886 /// Direct3D counterpart: 3D11_COMPARISON_GREATER/D3D12_COMPARISON_FUNC_GREATER. OpenGL counterpart: GL_GREATER.
887 COMPARISON_FUNC_GREATER,
888
889 /// Comparison passes if the source data is not equal to the destination data.\n
890 /// Direct3D counterpart: D3D11_COMPARISON_NOT_EQUAL/D3D12_COMPARISON_FUNC_NOT_EQUAL. OpenGL counterpart: GL_NOTEQUAL.
891 COMPARISON_FUNC_NOT_EQUAL,
892
893 /// Comparison passes if the source data is greater than or equal to the destination data.\n
894 /// Direct3D counterpart: D3D11_COMPARISON_GREATER_EQUAL/D3D12_COMPARISON_FUNC_GREATER_EQUAL. OpenGL counterpart: GL_GEQUAL.
895 COMPARISON_FUNC_GREATER_EQUAL,
896
897 /// Comparison always passes. \n
898 /// Direct3D counterpart: D3D11_COMPARISON_ALWAYS/D3D12_COMPARISON_FUNC_ALWAYS. OpenGL counterpart: GL_ALWAYS.
899 COMPARISON_FUNC_ALWAYS,
900
901 /// Helper value that stores the total number of comparison functions in the enumeration
902 COMPARISON_FUNC_NUM_FUNCTIONS
903 };
904
905 /// Miscellaneous texture flags
906
907 /// The enumeration is used by TextureDesc to describe misc texture flags
908 enum MISC_TEXTURE_FLAGS : Uint8
909 {
910 MISC_TEXTURE_FLAG_NONE = 0x00,
911
912 /// Allow automatic mipmap generation with ITextureView::GenerateMips()
913
914 /// \note A texture must be created with BIND_RENDER_TARGET bind flag
915 MISC_TEXTURE_FLAG_GENERATE_MIPS = 0x01
916 };
917 DEFINE_FLAG_ENUM_OPERATORS(MISC_TEXTURE_FLAGS)
918
919 /// Input primitive topology.
920
921 /// This enumeration is used by DrawAttribs structure to define input primitive topology.
922 enum PRIMITIVE_TOPOLOGY : Uint8
923 {
924 /// Undefined topology
925 PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
926
927 /// Interpret the vertex data as a list of triangles.\n
928 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST. OpenGL counterpart: GL_TRIANGLES.
929 PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
930
931 /// Interpret the vertex data as a triangle strip.\n
932 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP. OpenGL counterpart: GL_TRIANGLE_STRIP.
933 PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
934
935 /// Interpret the vertex data as a list of points.\n
936 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_POINTLIST. OpenGL counterpart: GL_POINTS.
937 PRIMITIVE_TOPOLOGY_POINT_LIST,
938
939 /// Interpret the vertex data as a list of lines.\n
940 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_LINELIST. OpenGL counterpart: GL_LINES.
941 PRIMITIVE_TOPOLOGY_LINE_LIST,
942
943 /// Interpret the vertex data as a list of one control point patches.\n
944 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
945 PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST,
946
947 /// Interpret the vertex data as a list of two control point patches.\n
948 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
949 PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST,
950
951 /// Interpret the vertex data as a list of three control point patches.\n
952 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
953 PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST,
954
955 /// Interpret the vertex data as a list of four control point patches.\n
956 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
957 PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST,
958
959 /// Interpret the vertex data as a list of five control point patches.\n
960 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
961 PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST,
962
963 /// Interpret the vertex data as a list of six control point patches.\n
964 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
965 PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST,
966
967 /// Interpret the vertex data as a list of seven control point patches.\n
968 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
969 PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST,
970
971 /// Interpret the vertex data as a list of eight control point patches.\n
972 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
973 PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST,
974
975 /// Interpret the vertex data as a list of nine control point patches.\n
976 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
977 PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST,
978
979 /// Interpret the vertex data as a list of ten control point patches.\n
980 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
981 PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST,
982
983 /// Interpret the vertex data as a list of 11 control point patches.\n
984 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
985 PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST,
986
987 /// Interpret the vertex data as a list of 12 control point patches.\n
988 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
989 PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST,
990
991 /// Interpret the vertex data as a list of 13 control point patches.\n
992 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
993 PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST,
994
995 /// Interpret the vertex data as a list of 14 control point patches.\n
996 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
997 PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST,
998
999 /// Interpret the vertex data as a list of 15 control point patches.\n
1000 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1001 PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST,
1002
1003 /// Interpret the vertex data as a list of 16 control point patches.\n
1004 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1005 PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST,
1006
1007 /// Interpret the vertex data as a list of 17 control point patches.\n
1008 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1009 PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST,
1010
1011 /// Interpret the vertex data as a list of 18 control point patches.\n
1012 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1013 PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST,
1014
1015 /// Interpret the vertex data as a list of 19 control point patches.\n
1016 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1017 PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST,
1018
1019 /// Interpret the vertex data as a list of 20 control point patches.\n
1020 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1021 PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST,
1022
1023 /// Interpret the vertex data as a list of 21 control point patches.\n
1024 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1025 PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST,
1026
1027 /// Interpret the vertex data as a list of 22 control point patches.\n
1028 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1029 PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST,
1030
1031 /// Interpret the vertex data as a list of 23 control point patches.\n
1032 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1033 PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST,
1034
1035 /// Interpret the vertex data as a list of 24 control point patches.\n
1036 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1037 PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST,
1038
1039 /// Interpret the vertex data as a list of 25 control point patches.\n
1040 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1041 PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST,
1042
1043 /// Interpret the vertex data as a list of 26 control point patches.\n
1044 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1045 PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST,
1046
1047 /// Interpret the vertex data as a list of 27 control point patches.\n
1048 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1049 PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST,
1050
1051 /// Interpret the vertex data as a list of 28 control point patches.\n
1052 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1053 PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST,
1054
1055 /// Interpret the vertex data as a list of 29 control point patches.\n
1056 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1057 PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST,
1058
1059 /// Interpret the vertex data as a list of 30 control point patches.\n
1060 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1061 PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST,
1062
1063 /// Interpret the vertex data as a list of 31 control point patches.\n
1064 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1065 PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST,
1066
1067 /// Interpret the vertex data as a list of 32 control point patches.\n
1068 /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
1069 PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST,
1070
1071 /// Helper value that stores the total number of topologies in the enumeration
1072 PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES
1073 };
1074
1075 /// Describes common device object attributes
1076 struct DeviceObjectAttribs
1077 {
1078 /// Object name
1079 const Char* Name = nullptr;
1080
1081 // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
1082 // DeviceObjectAttribs{"Name"}
1083
1084 DeviceObjectAttribs()noexcept{}
1085
1086 explicit DeviceObjectAttribs(const Char* _Name) :
1087 Name{_Name}
1088 {}
1089 };
287 /// Three-component 96-bit floating-point format with 32-bit channels. \n
288 /// D3D counterpart: DXGI_FORMAT_R32G32B32_FLOAT. OpenGL counterpart: GL_RGB32F.
289 /// \warning This format has weak hardware support and is not recommended
290 TEX_FORMAT_RGB32_FLOAT,
291
292 /// Three-component 96-bit unsigned-integer format with 32-bit channels. \n
293 /// D3D counterpart: DXGI_FORMAT_R32G32B32_UINT. OpenGL counterpart: GL_RGB32UI.
294 /// \warning This format has weak hardware support and is not recommended
295 TEX_FORMAT_RGB32_UINT,
296
297 /// Three-component 96-bit signed-integer format with 32-bit channels. \n
298 /// D3D counterpart: DXGI_FORMAT_R32G32B32_SINT. OpenGL counterpart: GL_RGB32I.
299 /// \warning This format has weak hardware support and is not recommended
300 TEX_FORMAT_RGB32_SINT,
301
302 /// Four-component 64-bit typeless format with 16-bit channels. \n
303 /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_TYPELESS. OpenGL does not have direct counterpart, GL_RGBA16F is used.
304 TEX_FORMAT_RGBA16_TYPELESS,
305
306 /// Four-component 64-bit half-precision floating-point format with 16-bit channels. \n
307 /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_FLOAT. OpenGL counterpart: GL_RGBA16F.
308 TEX_FORMAT_RGBA16_FLOAT,
309
310 /// Four-component 64-bit unsigned-normalized-integer format with 16-bit channels. \n
311 /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_UNORM. OpenGL counterpart: GL_RGBA16. \n
312 /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
313 /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
314 TEX_FORMAT_RGBA16_UNORM,
315
316 /// Four-component 64-bit unsigned-integer format with 16-bit channels. \n
317 /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_UIN