summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-01-25 19:19:23 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-01-25 19:19:23 +0000
commitd31dc00f82d2121dc0378db77264d9263540a192 (patch)
treed384eb65560a6bef42e339d4393e03b6c9baaa16 /Graphics/GraphicsEngine
parentUpdated handling of fatal errors (diff)
downloadDiligentCore-d31dc00f82d2121dc0378db77264d9263540a192.tar.gz
DiligentCore-d31dc00f82d2121dc0378db77264d9263540a192.zip
Reworked main headers to be compatible with c
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/DefaultShaderSourceStreamFactory.h11
-rw-r--r--Graphics/GraphicsEngine/include/DeviceContextBase.h38
-rw-r--r--Graphics/GraphicsEngine/include/PipelineStateBase.h18
-rw-r--r--Graphics/GraphicsEngine/include/RenderDeviceBase.h2
-rw-r--r--Graphics/GraphicsEngine/include/TextureBase.h14
-rw-r--r--Graphics/GraphicsEngine/interface/APIInfo.h123
-rw-r--r--Graphics/GraphicsEngine/interface/BlendState.h52
-rw-r--r--Graphics/GraphicsEngine/interface/Buffer.h46
-rw-r--r--Graphics/GraphicsEngine/interface/BufferView.h36
-rw-r--r--Graphics/GraphicsEngine/interface/CommandList.h14
-rw-r--r--Graphics/GraphicsEngine/interface/Constants.h18
-rw-r--r--Graphics/GraphicsEngine/interface/DepthStencilState.h36
-rw-r--r--Graphics/GraphicsEngine/interface/DeviceCaps.h331
-rw-r--r--Graphics/GraphicsEngine/interface/DeviceContext.h152
-rw-r--r--Graphics/GraphicsEngine/interface/DeviceObject.h14
-rw-r--r--Graphics/GraphicsEngine/interface/EngineFactory.h16
-rw-r--r--Graphics/GraphicsEngine/interface/Fence.h19
-rw-r--r--Graphics/GraphicsEngine/interface/GraphicsTypes.h3413
-rw-r--r--Graphics/GraphicsEngine/interface/InputLayout.h129
-rw-r--r--Graphics/GraphicsEngine/interface/PipelineState.h98
-rw-r--r--Graphics/GraphicsEngine/interface/Query.h64
-rw-r--r--Graphics/GraphicsEngine/interface/RasterizerState.h35
-rw-r--r--Graphics/GraphicsEngine/interface/RenderDevice.h15
-rw-r--r--Graphics/GraphicsEngine/interface/ResourceMapping.h37
-rw-r--r--Graphics/GraphicsEngine/interface/Sampler.h49
-rw-r--r--Graphics/GraphicsEngine/interface/Shader.h131
-rw-r--r--Graphics/GraphicsEngine/interface/ShaderResourceBinding.h13
-rw-r--r--Graphics/GraphicsEngine/interface/ShaderResourceVariable.h23
-rw-r--r--Graphics/GraphicsEngine/interface/SwapChain.h15
-rw-r--r--Graphics/GraphicsEngine/interface/Texture.h92
-rw-r--r--Graphics/GraphicsEngine/interface/TextureView.h126
-rw-r--r--Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp1
32 files changed, 2719 insertions, 2462 deletions
diff --git a/Graphics/GraphicsEngine/include/DefaultShaderSourceStreamFactory.h b/Graphics/GraphicsEngine/include/DefaultShaderSourceStreamFactory.h
index f1c0d997..7b3b1e47 100644
--- a/Graphics/GraphicsEngine/include/DefaultShaderSourceStreamFactory.h
+++ b/Graphics/GraphicsEngine/include/DefaultShaderSourceStreamFactory.h
@@ -27,16 +27,15 @@
#pragma once
-#include "../../../Common/interface/BasicFileStream.h"
#include "../../GraphicsEngine/interface/Shader.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
/// Creates default shader source stream factory
/// \param [in] SearchDirectories - Semicolon-seprated list of search directories.
/// \param [out] ppShaderSourceStreamFactory - Memory address where pointer to the shader source stream factory will be written.
-void CreateDefaultShaderSourceStreamFactory(const Char* SearchDirectories,
- IShaderSourceInputStreamFactory** ppShaderSourceStreamFactory);
+void CreateDefaultShaderSourceStreamFactory(const Char* SearchDirectories,
+ class IShaderSourceInputStreamFactory** ppShaderSourceStreamFactory);
-} // namespace Diligent
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.h b/Graphics/GraphicsEngine/include/DeviceContextBase.h
index 02e564af..dc7cce82 100644
--- a/Graphics/GraphicsEngine/include/DeviceContextBase.h
+++ b/Graphics/GraphicsEngine/include/DeviceContextBase.h
@@ -250,7 +250,7 @@ protected:
RefCntAutoPtr<DeviceImplType> m_pDevice;
/// Vertex streams. Every stream holds strong reference to the buffer
- VertexStreamInfo<BufferImplType> m_VertexStreams[MaxBufferSlots];
+ VertexStreamInfo<BufferImplType> m_VertexStreams[MAX_BUFFER_SLOTS];
/// Number of bound vertex streams
Uint32 m_NumVertexStreams = 0;
@@ -275,18 +275,18 @@ protected:
Float32 m_BlendFactors[4] = {-1, -1, -1, -1};
/// Current viewports
- Viewport m_Viewports[MaxViewports];
+ Viewport m_Viewports[MAX_VIEWPORTS];
/// Number of current viewports
Uint32 m_NumViewports = 0;
/// Current scissor rects
- Rect m_ScissorRects[MaxViewports];
+ Rect m_ScissorRects[MAX_VIEWPORTS];
/// Number of current scissor rects
Uint32 m_NumScissorRects = 0;
/// Vector of strong references to the bound render targets.
/// Use final texture view implementation type to avoid virtual calls to AddRef()/Release()
- RefCntAutoPtr<TextureViewImplType> m_pBoundRenderTargets[MaxRenderTargets];
+ RefCntAutoPtr<TextureViewImplType> m_pBoundRenderTargets[MAX_RENDER_TARGETS];
/// Number of bound render targets
Uint32 m_NumBoundRenderTargets = 0;
/// Width of the currently bound framebuffer
@@ -324,16 +324,16 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::
SET_VERTEX_BUFFERS_FLAGS Flags)
{
#ifdef DEVELOPMENT
- if (StartSlot >= MaxBufferSlots)
+ if (StartSlot >= MAX_BUFFER_SLOTS)
{
- LOG_ERROR_MESSAGE("Start vertex buffer slot ", StartSlot, " is out of allowed range [0, ", MaxBufferSlots - 1, "].");
+ LOG_ERROR_MESSAGE("Start vertex buffer slot ", StartSlot, " is out of allowed range [0, ", MAX_BUFFER_SLOTS - 1, "].");
return;
}
- if (StartSlot + NumBuffersSet > MaxBufferSlots)
+ if (StartSlot + NumBuffersSet > MAX_BUFFER_SLOTS)
{
- LOG_ERROR_MESSAGE("The range of vertex buffer slots being set [", StartSlot, ", ", StartSlot + NumBuffersSet - 1, "] is out of allowed range [0, ", MaxBufferSlots - 1, "].");
- NumBuffersSet = MaxBufferSlots - StartSlot;
+ 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, "].");
+ NumBuffersSet = MAX_BUFFER_SLOTS - StartSlot;
}
#endif
@@ -479,8 +479,8 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::
RTHeight = m_FramebufferHeight;
}
- VERIFY(NumViewports < MaxViewports, "Number of viewports (", NumViewports, ") exceeds the limit (", MaxViewports, ")");
- m_NumViewports = std::min(MaxViewports, NumViewports);
+ VERIFY(NumViewports < MAX_VIEWPORTS, "Number of viewports (", NumViewports, ") exceeds the limit (", MAX_VIEWPORTS, ")");
+ m_NumViewports = std::min(MAX_VIEWPORTS, NumViewports);
Viewport DefaultVP(0, 0, static_cast<float>(RTWidth), static_cast<float>(RTHeight));
// If no viewports are specified, use default viewport
@@ -519,8 +519,8 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::
RTHeight = m_FramebufferHeight;
}
- VERIFY(NumRects < MaxViewports, "Number of scissor rects (", NumRects, ") exceeds the limit (", MaxViewports, ")");
- m_NumScissorRects = std::min(MaxViewports, NumRects);
+ VERIFY(NumRects < MAX_VIEWPORTS, "Number of scissor rects (", NumRects, ") exceeds the limit (", MAX_VIEWPORTS, ")");
+ m_NumScissorRects = std::min(MAX_VIEWPORTS, NumRects);
for (Uint32 sr = 0; sr < m_NumScissorRects; ++sr)
{
@@ -657,7 +657,7 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::
else
ppRTVs[rt] = nullptr;
}
- for (Uint32 rt = NumRenderTargets; rt < MaxRenderTargets; ++rt)
+ for (Uint32 rt = NumRenderTargets; rt < MAX_RENDER_TARGETS; ++rt)
{
VERIFY(ppRTVs[rt] == nullptr, "Non-null pointer found in RTV array element #", rt);
ppRTVs[rt] = nullptr;
@@ -1441,7 +1441,7 @@ void DeviceContextBase<BaseInterface, ImplementationTraits>::
DEV_CHECK_ERR(Barrier.FirstMipLevel < TexDesc.MipLevels, "First mip level (", Barrier.FirstMipLevel,
") specified by the barrier is out of range. Texture '",
TexDesc.Name, "' has only ", TexDesc.MipLevels, " mip level(s)");
- DEV_CHECK_ERR(Barrier.MipLevelsCount == StateTransitionDesc::RemainingMipLevels || Barrier.FirstMipLevel + Barrier.MipLevelsCount <= TexDesc.MipLevels,
+ DEV_CHECK_ERR(Barrier.MipLevelsCount == REMAINING_MIP_LEVELS || Barrier.FirstMipLevel + Barrier.MipLevelsCount <= TexDesc.MipLevels,
"Mip level range ", Barrier.FirstMipLevel, "..", Barrier.FirstMipLevel + Barrier.MipLevelsCount - 1,
" specified by the barrier is out of range. Texture '",
TexDesc.Name, "' has only ", TexDesc.MipLevels, " mip level(s)");
@@ -1449,17 +1449,17 @@ void DeviceContextBase<BaseInterface, ImplementationTraits>::
DEV_CHECK_ERR(Barrier.FirstArraySlice < TexDesc.ArraySize, "First array slice (", Barrier.FirstArraySlice,
") specified by the barrier is out of range. Array size of texture '",
TexDesc.Name, "' is ", TexDesc.ArraySize);
- DEV_CHECK_ERR(Barrier.ArraySliceCount == StateTransitionDesc::RemainingArraySlices || Barrier.FirstArraySlice + Barrier.ArraySliceCount <= TexDesc.ArraySize,
+ DEV_CHECK_ERR(Barrier.ArraySliceCount == REMAINING_ARRAY_SLICES || Barrier.FirstArraySlice + Barrier.ArraySliceCount <= TexDesc.ArraySize,
"Array slice range ", Barrier.FirstArraySlice, "..", Barrier.FirstArraySlice + Barrier.ArraySliceCount - 1,
" specified by the barrier is out of range. Array size of texture '",
TexDesc.Name, "' is ", TexDesc.ArraySize);
auto DevType = m_pDevice->GetDeviceCaps().DevType;
- if (DevType != DeviceType::D3D12 && DevType != DeviceType::Vulkan)
+ if (DevType != RENDER_DEVICE_TYPE_D3D12 && DevType != RENDER_DEVICE_TYPE_VULKAN)
{
- DEV_CHECK_ERR(Barrier.FirstMipLevel == 0 && (Barrier.MipLevelsCount == StateTransitionDesc::RemainingMipLevels || Barrier.MipLevelsCount == TexDesc.MipLevels),
+ DEV_CHECK_ERR(Barrier.FirstMipLevel == 0 && (Barrier.MipLevelsCount == REMAINING_MIP_LEVELS || Barrier.MipLevelsCount == TexDesc.MipLevels),
"Failed to transition texture '", TexDesc.Name, "': only whole resources can be transitioned on this device");
- DEV_CHECK_ERR(Barrier.FirstArraySlice == 0 && (Barrier.ArraySliceCount == StateTransitionDesc::RemainingArraySlices || Barrier.ArraySliceCount == TexDesc.ArraySize),
+ DEV_CHECK_ERR(Barrier.FirstArraySlice == 0 && (Barrier.ArraySliceCount == REMAINING_ARRAY_SLICES || Barrier.ArraySliceCount == TexDesc.ArraySize),
"Failed to transition texture '", TexDesc.Name, "': only whole resources can be transitioned on this device");
}
}
diff --git a/Graphics/GraphicsEngine/include/PipelineStateBase.h b/Graphics/GraphicsEngine/include/PipelineStateBase.h
index e1d2669e..efc75725 100644
--- a/Graphics/GraphicsEngine/include/PipelineStateBase.h
+++ b/Graphics/GraphicsEngine/include/PipelineStateBase.h
@@ -206,10 +206,10 @@ public:
// Correct description and compute offsets and tight strides
- std::array<Uint32, MaxBufferSlots> Strides, TightStrides = {};
+ std::array<Uint32, MAX_BUFFER_SLOTS> Strides, TightStrides = {};
// Set all strides to an invalid value because an application may want to use 0 stride
for (auto& Stride : Strides)
- Stride = LayoutElement::AutoStride;
+ Stride = LAYOUT_ELEMENT_AUTO_STRIDE;
for (Uint32 i = 0; i < InputLayout.NumElements; ++i)
{
@@ -228,21 +228,21 @@ public:
auto& CurrAutoStride = TightStrides[BuffSlot];
// If offset is not explicitly specified, use current auto stride value
- if (LayoutElem.RelativeOffset == LayoutElement::AutoOffset)
+ if (LayoutElem.RelativeOffset == LAYOUT_ELEMENT_AUTO_OFFSET)
{
LayoutElem.RelativeOffset = CurrAutoStride;
}
// If stride is explicitly specified, use it for the current buffer slot
- if (LayoutElem.Stride != LayoutElement::AutoStride)
+ if (LayoutElem.Stride != LAYOUT_ELEMENT_AUTO_STRIDE)
{
// Verify that the value is consistent with the previously specified stride, if any
- if (Strides[BuffSlot] != LayoutElement::AutoStride && Strides[BuffSlot] != LayoutElem.Stride)
+ if (Strides[BuffSlot] != LAYOUT_ELEMENT_AUTO_STRIDE && Strides[BuffSlot] != LayoutElem.Stride)
{
LOG_ERROR_MESSAGE("Inconsistent strides are specified for buffer slot ", BuffSlot,
". Input element at index ", LayoutElem.InputIndex, " explicitly specifies stride ",
LayoutElem.Stride, ", while current value is ", Strides[BuffSlot],
- ". Specify consistent strides or use LayoutElement::AutoStride to allow "
+ ". Specify consistent strides or use LAYOUT_ELEMENT_AUTO_STRIDE to allow "
"the engine compute strides automatically.");
}
Strides[BuffSlot] = LayoutElem.Stride;
@@ -257,7 +257,7 @@ public:
auto BuffSlot = LayoutElem.BufferSlot;
// If no input elements explicitly specified stride for this buffer slot, use automatic stride
- if (Strides[BuffSlot] == LayoutElement::AutoStride)
+ if (Strides[BuffSlot] == LAYOUT_ELEMENT_AUTO_STRIDE)
{
Strides[BuffSlot] = TightStrides[BuffSlot];
}
@@ -270,7 +270,7 @@ public:
" required to accomodate all input elements.");
}
}
- if (LayoutElem.Stride == LayoutElement::AutoStride)
+ if (LayoutElem.Stride == LAYOUT_ELEMENT_AUTO_STRIDE)
LayoutElem.Stride = Strides[BuffSlot];
}
@@ -282,7 +282,7 @@ public:
for (Uint32 i = 0; i < m_BufferSlotsUsed; ++i)
{
auto Stride = Strides[i];
- m_pStrides[i] = Stride != LayoutElement::AutoStride ? Stride : 0;
+ m_pStrides[i] = Stride != LAYOUT_ELEMENT_AUTO_STRIDE ? Stride : 0;
}
}
}
diff --git a/Graphics/GraphicsEngine/include/RenderDeviceBase.h b/Graphics/GraphicsEngine/include/RenderDeviceBase.h
index 2712b9d8..33a021db 100644
--- a/Graphics/GraphicsEngine/include/RenderDeviceBase.h
+++ b/Graphics/GraphicsEngine/include/RenderDeviceBase.h
@@ -127,7 +127,7 @@ struct hash<Diligent::BlendStateDesc>
size_t operator()(const Diligent::BlendStateDesc& BSDesc) const
{
std::size_t Seed = 0;
- for (int i = 0; i < Diligent::BlendStateDesc::MaxRenderTargets; ++i)
+ for (int i = 0; i < Diligent::MAX_RENDER_TARGETS; ++i)
{
const auto& rt = BSDesc.RenderTargets[i];
Diligent::HashCombine(Seed,
diff --git a/Graphics/GraphicsEngine/include/TextureBase.h b/Graphics/GraphicsEngine/include/TextureBase.h
index 2ef02d8d..0a1cfc68 100644
--- a/Graphics/GraphicsEngine/include/TextureBase.h
+++ b/Graphics/GraphicsEngine/include/TextureBase.h
@@ -230,7 +230,7 @@ void TextureBase<BaseInterface, TRenderDeviceImpl, TTextureViewImpl, TTexViewObj
if (ViewDesc.MostDetailedMip >= this->m_Desc.MipLevels)
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."));
- if (ViewDesc.NumMipLevels != TextureViewDesc::RemainingMipLevels && ViewDesc.MostDetailedMip + ViewDesc.NumMipLevels > this->m_Desc.MipLevels)
+ if (ViewDesc.NumMipLevels != REMAINING_MIP_LEVELS && ViewDesc.MostDetailedMip + ViewDesc.NumMipLevels > this->m_Desc.MipLevels)
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."));
if (ViewDesc.Format == TEX_FORMAT_UNKNOWN)
@@ -351,7 +351,7 @@ void TextureBase<BaseInterface, TRenderDeviceImpl, TTextureViewImpl, TTexViewObj
{
if (ViewDesc.ViewType != TEXTURE_VIEW_SHADER_RESOURCE)
TEX_VIEW_VALIDATION_ERROR("Unexpected view type: SRV is expected");
- if (ViewDesc.NumArraySlices != 6 && ViewDesc.NumArraySlices != 0 && ViewDesc.NumArraySlices != TextureViewDesc::RemainingArraySlices)
+ if (ViewDesc.NumArraySlices != 6 && ViewDesc.NumArraySlices != 0 && ViewDesc.NumArraySlices != REMAINING_ARRAY_SLICES)
TEX_VIEW_VALIDATION_ERROR("Texture cube SRV is expected to have 6 array slices, while ", ViewDesc.NumArraySlices, " is provided");
if (ViewDesc.FirstArraySlice != 0)
TEX_VIEW_VALIDATION_ERROR("First slice (", ViewDesc.FirstArraySlice, ") must be 0 for non-array texture cube SRV");
@@ -360,7 +360,7 @@ void TextureBase<BaseInterface, TRenderDeviceImpl, TTextureViewImpl, TTexViewObj
{
if (ViewDesc.ViewType != TEXTURE_VIEW_SHADER_RESOURCE)
TEX_VIEW_VALIDATION_ERROR("Unexpected view type: SRV is expected");
- if (ViewDesc.NumArraySlices != TextureViewDesc::RemainingArraySlices && (ViewDesc.NumArraySlices % 6) != 0)
+ if (ViewDesc.NumArraySlices != REMAINING_ARRAY_SLICES && (ViewDesc.NumArraySlices % 6) != 0)
TEX_VIEW_VALIDATION_ERROR("Number of slices in texture cube array SRV is expected to be multiple of 6. ", ViewDesc.NumArraySlices, " slices is provided.");
}
@@ -370,7 +370,7 @@ void TextureBase<BaseInterface, TRenderDeviceImpl, TTextureViewImpl, TTexViewObj
if (ViewDesc.FirstArraySlice != 0)
TEX_VIEW_VALIDATION_ERROR("First slice (", ViewDesc.FirstArraySlice, ") must be 0 for non-array texture 1D/2D views");
- if (ViewDesc.NumArraySlices != TextureViewDesc::RemainingArraySlices && ViewDesc.NumArraySlices > 1)
+ if (ViewDesc.NumArraySlices != REMAINING_ARRAY_SLICES && ViewDesc.NumArraySlices > 1)
TEX_VIEW_VALIDATION_ERROR("Number of slices in the view (", ViewDesc.NumArraySlices, ") must be 1 (or 0) for non-array texture 1D/2D views");
}
else if (ViewDesc.TextureDim == RESOURCE_DIM_TEX_1D_ARRAY ||
@@ -381,7 +381,7 @@ void TextureBase<BaseInterface, TRenderDeviceImpl, TTextureViewImpl, TTexViewObj
if (ViewDesc.FirstArraySlice >= this->m_Desc.ArraySize)
TEX_VIEW_VALIDATION_ERROR("First array slice (", ViewDesc.FirstArraySlice, ") exceeds the number of slices in the texture array (", this->m_Desc.ArraySize, ")");
- if (ViewDesc.NumArraySlices != TextureViewDesc::RemainingArraySlices && ViewDesc.FirstArraySlice + ViewDesc.NumArraySlices > this->m_Desc.ArraySize)
+ if (ViewDesc.NumArraySlices != REMAINING_ARRAY_SLICES && ViewDesc.FirstArraySlice + ViewDesc.NumArraySlices > this->m_Desc.ArraySize)
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, ")");
}
else if (ViewDesc.TextureDim == RESOURCE_DIM_TEX_3D)
@@ -411,7 +411,7 @@ void TextureBase<BaseInterface, TRenderDeviceImpl, TTextureViewImpl, TTexViewObj
#undef TEX_VIEW_VALIDATION_ERROR
- if (ViewDesc.NumMipLevels == 0 || ViewDesc.NumMipLevels == TextureViewDesc::RemainingMipLevels)
+ if (ViewDesc.NumMipLevels == 0 || ViewDesc.NumMipLevels == REMAINING_MIP_LEVELS)
{
if (ViewDesc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE)
ViewDesc.NumMipLevels = this->m_Desc.MipLevels - ViewDesc.MostDetailedMip;
@@ -419,7 +419,7 @@ void TextureBase<BaseInterface, TRenderDeviceImpl, TTextureViewImpl, TTexViewObj
ViewDesc.NumMipLevels = 1;
}
- if (ViewDesc.NumArraySlices == 0 || ViewDesc.NumArraySlices == TextureViewDesc::RemainingArraySlices)
+ if (ViewDesc.NumArraySlices == 0 || ViewDesc.NumArraySlices == REMAINING_ARRAY_SLICES)
{
if (ViewDesc.TextureDim == RESOURCE_DIM_TEX_1D_ARRAY ||
ViewDesc.TextureDim == RESOURCE_DIM_TEX_2D_ARRAY ||
diff --git a/Graphics/GraphicsEngine/interface/APIInfo.h b/Graphics/GraphicsEngine/interface/APIInfo.h
index 919894e4..0b6cebd8 100644
--- a/Graphics/GraphicsEngine/interface/APIInfo.h
+++ b/Graphics/GraphicsEngine/interface/APIInfo.h
@@ -30,74 +30,73 @@
/// \file
/// Diligent API information
-#define DILIGENT_API_VERSION 240051
+#define DILIGENT_API_VERSION 240052
#include "../../../Primitives/interface/BasicTypes.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
/// Diligent API Info. This tructure can be used to verify API compatibility.
struct APIInfo
{
- size_t StructSize = 0;
- int APIVersion = 0;
- size_t RenderTargetBlendDescSize = 0;
- size_t BlendStateDescSize = 0;
- size_t BufferDescSize = 0;
- size_t BufferDataSize = 0;
- size_t BufferFormatSize = 0;
- size_t BufferViewDescSize = 0;
- size_t StencilOpDescSize = 0;
- size_t DepthStencilStateDescSize = 0;
- size_t SamplerCapsSize = 0;
- size_t TextureCapsSize = 0;
- size_t DeviceCapsSize = 0;
- size_t DrawAttribsSize = 0;
- size_t DispatchComputeAttribsSize = 0;
- size_t ViewportSize = 0;
- size_t RectSize = 0;
- size_t CopyTextureAttribsSize = 0;
- size_t DeviceObjectAttribsSize = 0;
- size_t AdapterAttribsSize = 0;
- size_t DisplayModeAttribsSize = 0;
- size_t SwapChainDescSize = 0;
- size_t FullScreenModeDescSize = 0;
- size_t EngineCreateInfoSize = 0;
- size_t EngineGLCreateInfoSize = 0;
- size_t EngineD3D11CreateInfoSize = 0;
- size_t EngineD3D12CreateInfoSize = 0;
- size_t EngineVkCreateInfoSize = 0;
- size_t EngineMtlCreateInfoSize = 0;
- size_t BoxSize = 0;
- size_t TextureFormatAttribsSize = 0;
- size_t TextureFormatInfoSize = 0;
- size_t TextureFormatInfoExtSize = 0;
- size_t StateTransitionDescSize = 0;
- size_t LayoutElementSize = 0;
- size_t InputLayoutDescSize = 0;
- size_t SampleDescSize = 0;
- size_t ShaderResourceVariableDescSize = 0;
- size_t StaticSamplerDescSize = 0;
- size_t PipelineResourceLayoutDescSize = 0;
- size_t GraphicsPipelineDescSize = 0;
- size_t ComputePipelineDescSize = 0;
- size_t PipelineStateDescSize = 0;
- size_t RasterizerStateDescSize = 0;
- size_t ResourceMappingEntrySize = 0;
- size_t ResourceMappingDescSize = 0;
- size_t SamplerDescSize = 0;
- size_t ShaderDescSize = 0;
- size_t ShaderMacroSize = 0;
- size_t ShaderCreateInfoSize = 0;
- size_t ShaderResourceDescSize = 0;
- size_t DepthStencilClearValueSize = 0;
- size_t OptimizedClearValueSize = 0;
- size_t TextureDescSize = 0;
- size_t TextureSubResDataSize = 0;
- size_t TextureDataSize = 0;
- size_t MappedTextureSubresourceSize = 0;
- size_t TextureViewDescSize = 0;
+ size_t StructSize DEFAULT_INITIALIZER(0);
+ int APIVersion DEFAULT_INITIALIZER(0);
+ size_t RenderTargetBlendDescSize DEFAULT_INITIALIZER(0);
+ size_t BlendStateDescSize DEFAULT_INITIALIZER(0);
+ size_t BufferDescSize DEFAULT_INITIALIZER(0);
+ size_t BufferDataSize DEFAULT_INITIALIZER(0);
+ size_t BufferFormatSize DEFAULT_INITIALIZER(0);
+ size_t BufferViewDescSize DEFAULT_INITIALIZER(0);
+ size_t StencilOpDescSize DEFAULT_INITIALIZER(0);
+ size_t DepthStencilStateDescSize DEFAULT_INITIALIZER(0);
+ size_t SamplerCapsSize DEFAULT_INITIALIZER(0);
+ size_t TextureCapsSize DEFAULT_INITIALIZER(0);
+ size_t DeviceCapsSize DEFAULT_INITIALIZER(0);
+ size_t DrawAttribsSize DEFAULT_INITIALIZER(0);
+ size_t DispatchComputeAttribsSize DEFAULT_INITIALIZER(0);
+ size_t ViewportSize DEFAULT_INITIALIZER(0);
+ size_t RectSize DEFAULT_INITIALIZER(0);
+ size_t CopyTextureAttribsSize DEFAULT_INITIALIZER(0);
+ size_t DeviceObjectAttribsSize DEFAULT_INITIALIZER(0);
+ size_t AdapterAttribsSize DEFAULT_INITIALIZER(0);
+ size_t DisplayModeAttribsSize DEFAULT_INITIALIZER(0);
+ size_t SwapChainDescSize DEFAULT_INITIALIZER(0);
+ size_t FullScreenModeDescSize DEFAULT_INITIALIZER(0);
+ size_t EngineCreateInfoSize DEFAULT_INITIALIZER(0);
+ size_t EngineGLCreateInfoSize DEFAULT_INITIALIZER(0);
+ size_t EngineD3D11CreateInfoSize DEFAULT_INITIALIZER(0);
+ size_t EngineD3D12CreateInfoSize DEFAULT_INITIALIZER(0);
+ size_t EngineVkCreateInfoSize DEFAULT_INITIALIZER(0);
+ size_t EngineMtlCreateInfoSize DEFAULT_INITIALIZER(0);
+ size_t BoxSize DEFAULT_INITIALIZER(0);
+ size_t TextureFormatAttribsSize DEFAULT_INITIALIZER(0);
+ size_t TextureFormatInfoSize DEFAULT_INITIALIZER(0);
+ size_t TextureFormatInfoExtSize DEFAULT_INITIALIZER(0);
+ size_t StateTransitionDescSize DEFAULT_INITIALIZER(0);
+ size_t LayoutElementSize DEFAULT_INITIALIZER(0);
+ size_t InputLayoutDescSize DEFAULT_INITIALIZER(0);
+ size_t SampleDescSize DEFAULT_INITIALIZER(0);
+ size_t ShaderResourceVariableDescSize DEFAULT_INITIALIZER(0);
+ size_t StaticSamplerDescSize DEFAULT_INITIALIZER(0);
+ size_t PipelineResourceLayoutDescSize DEFAULT_INITIALIZER(0);
+ size_t GraphicsPipelineDescSize DEFAULT_INITIALIZER(0);
+ size_t ComputePipelineDescSize DEFAULT_INITIALIZER(0);
+ size_t PipelineStateDescSize DEFAULT_INITIALIZER(0);
+ size_t RasterizerStateDescSize DEFAULT_INITIALIZER(0);
+ size_t ResourceMappingEntrySize DEFAULT_INITIALIZER(0);
+ size_t ResourceMappingDescSize DEFAULT_INITIALIZER(0);
+ size_t SamplerDescSize DEFAULT_INITIALIZER(0);
+ size_t ShaderDescSize DEFAULT_INITIALIZER(0);
+ size_t ShaderMacroSize DEFAULT_INITIALIZER(0);
+ size_t ShaderCreateInfoSize DEFAULT_INITIALIZER(0);
+ size_t ShaderResourceDescSize DEFAULT_INITIALIZER(0);
+ size_t DepthStencilClearValueSize DEFAULT_INITIALIZER(0);
+ size_t OptimizedClearValueSize DEFAULT_INITIALIZER(0);
+ size_t TextureDescSize DEFAULT_INITIALIZER(0);
+ size_t TextureSubResDataSize DEFAULT_INITIALIZER(0);
+ size_t TextureDataSize DEFAULT_INITIALIZER(0);
+ size_t MappedTextureSubresourceSize DEFAULT_INITIALIZER(0);
+ size_t TextureViewDescSize DEFAULT_INITIALIZER(0);
};
-} // namespace Diligent
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/BlendState.h b/Graphics/GraphicsEngine/interface/BlendState.h
index aaaa29fe..4499c2cc 100644
--- a/Graphics/GraphicsEngine/interface/BlendState.h
+++ b/Graphics/GraphicsEngine/interface/BlendState.h
@@ -33,9 +33,10 @@
/// Blend state description
#include "../../../Primitives/interface/BasicTypes.h"
+#include "Constants.h"
+
+DILIGENT_BEGIN_NAMESPACE(Diligent)
-namespace Diligent
-{
/// Blend factors
@@ -46,7 +47,7 @@ namespace Diligent
/// It generatlly mirrors [D3D11_BLEND][] and [D3D12_BLEND][] enumerations and is used by RenderTargetBlendDesc structure
/// to define source and destination blend factors for color and alpha channels.
/// \sa [D3D11_BLEND on MSDN][D3D11_BLEND], [D3D12_BLEND on MSDN][D3D12_BLEND], [glBlendFuncSeparate on OpenGL.org][glBlendFuncSeparate]
-enum BLEND_FACTOR : Int8
+DILIGENT_TYPED_ENUM(BLEND_FACTOR, Int8)
{
/// Undefined blend factor
BLEND_FACTOR_UNDEFINED = 0,
@@ -134,7 +135,7 @@ enum BLEND_FACTOR : Int8
/// [D3D11_BLEND_OP][] and [D3D12_BLEND_OP][] enums. It is used by RenderTargetBlendDesc structure to define RGB and Alpha
/// blending operations
/// \sa [D3D11_BLEND_OP on MSDN][D3D11_BLEND_OP], [D3D12_BLEND_OP on MSDN][D3D12_BLEND_OP], [glBlendEquationSeparate on OpenGL.org][glBlendEquationSeparate]
-enum BLEND_OPERATION : Int8
+DILIGENT_TYPED_ENUM(BLEND_OPERATION, Int8)
{
/// Undefined blend operation
BLEND_OPERATION_UNDEFINED = 0,
@@ -168,7 +169,7 @@ enum BLEND_OPERATION : Int8
/// These flags are used by RenderTargetBlendDesc structure to define
/// writable components of the render target
-enum COLOR_MASK : Int8
+DILIGENT_TYPED_ENUM(COLOR_MASK, Int8)
{
/// Allow data to be stored in the red component.
COLOR_MASK_RED = 1,
@@ -194,7 +195,7 @@ enum COLOR_MASK : Int8
/// It is used by RenderTargetBlendDesc structure to define logic operation.
/// Only available on D3D12 engine
/// \sa [D3D12_LOGIC_OP on MSDN][D3D12_LOGIC_OP]
-enum LOGIC_OPERATION : Int8
+DILIGENT_TYPED_ENUM(LOGIC_OPERATION, Int8)
{
/// Clear the render target.\n
/// Direct3D12 counterpart: D3D12_LOGIC_OP_CLEAR.
@@ -272,49 +273,48 @@ enum LOGIC_OPERATION : Int8
struct RenderTargetBlendDesc
{
/// Enable or disable blending for this render target. Default value: False.
- Bool BlendEnable = False;
+ Bool BlendEnable DEFAULT_INITIALIZER(False);
/// Enable or disable a logical operation for this render target. Default value: False.
- Bool LogicOperationEnable = False;
+ Bool LogicOperationEnable DEFAULT_INITIALIZER(False);
/// Specifies the blend factor to apply to the RGB value output from the pixel shader
/// Default value: Diligent::BLEND_FACTOR_ONE.
- BLEND_FACTOR SrcBlend = BLEND_FACTOR_ONE;
+ BLEND_FACTOR SrcBlend DEFAULT_INITIALIZER(BLEND_FACTOR_ONE);
/// Specifies the blend factor to apply to the RGB value in the render target
/// Default value: Diligent::BLEND_FACTOR_ZERO.
- BLEND_FACTOR DestBlend = BLEND_FACTOR_ZERO;
+ BLEND_FACTOR DestBlend DEFAULT_INITIALIZER(BLEND_FACTOR_ZERO);
/// Defines how to combine the source and destination RGB values
/// after applying the SrcBlend and DestBlend factors.
/// Default value: Diligent::BLEND_OPERATION_ADD.
- BLEND_OPERATION BlendOp = BLEND_OPERATION_ADD;
+ BLEND_OPERATION BlendOp DEFAULT_INITIALIZER(BLEND_OPERATION_ADD);
/// Specifies the blend factor to apply to the alpha value output from the pixel shader.
/// Blend factors that end in _COLOR are not allowed.
/// Default value: Diligent::BLEND_FACTOR_ONE.
- BLEND_FACTOR SrcBlendAlpha = BLEND_FACTOR_ONE;
+ BLEND_FACTOR SrcBlendAlpha DEFAULT_INITIALIZER(BLEND_FACTOR_ONE);
/// Specifies the blend factor to apply to the alpha value in the render target.
/// Blend factors that end in _COLOR are not allowed.
/// Default value: Diligent::BLEND_FACTOR_ZERO.
- BLEND_FACTOR DestBlendAlpha = BLEND_FACTOR_ZERO;
+ BLEND_FACTOR DestBlendAlpha DEFAULT_INITIALIZER(BLEND_FACTOR_ZERO);
/// Defines how to combine the source and destination alpha values
/// after applying the SrcBlendAlpha and DestBlendAlpha factors.
/// Default value: Diligent::BLEND_OPERATION_ADD.
- BLEND_OPERATION BlendOpAlpha = BLEND_OPERATION_ADD;
+ BLEND_OPERATION BlendOpAlpha DEFAULT_INITIALIZER(BLEND_OPERATION_ADD);
/// Defines logical operation for the render target.
/// Default value: Diligent::LOGIC_OP_NOOP.
- LOGIC_OPERATION LogicOp = LOGIC_OP_NOOP;
+ LOGIC_OPERATION LogicOp DEFAULT_INITIALIZER(LOGIC_OP_NOOP);
/// Render target write mask.
/// Default value: Diligent::COLOR_MASK_ALL.
- Uint8 RenderTargetWriteMask = COLOR_MASK_ALL;
+ Uint8 RenderTargetWriteMask DEFAULT_INITIALIZER(COLOR_MASK_ALL);
- // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
- // RenderTargetBlendDesc{False, False}
+#if DILIGENT_CPP_INTERFACE
RenderTargetBlendDesc()noexcept{}
@@ -360,6 +360,7 @@ struct RenderTargetBlendDesc
LogicOp == rhs.LogicOp &&
RenderTargetWriteMask == rhs.RenderTargetWriteMask;
}
+#endif
};
@@ -370,19 +371,17 @@ struct BlendStateDesc
{
/// Specifies whether to use alpha-to-coverage as a multisampling technique
/// when setting a pixel to a render target. Default value: False.
- Bool AlphaToCoverageEnable = False;
+ Bool AlphaToCoverageEnable DEFAULT_INITIALIZER(False);
/// Specifies whether to enable independent blending in simultaneous render targets.
/// If set to False, only RenderTargets[0] is used. Default value: False.
- Bool IndependentBlendEnable = False;
-
- /// Constant member defining the maximum number of render targets
- static constexpr int MaxRenderTargets = 8;
+ Bool IndependentBlendEnable DEFAULT_INITIALIZER(False);
/// An array of RenderTargetBlendDesc structures that describe the blend
/// states for render targets
- RenderTargetBlendDesc RenderTargets[MaxRenderTargets];
+ struct RenderTargetBlendDesc RenderTargets[DILIGENT_MAX_RENDER_TARGETS];
+#if DILIGENT_CPP_INTERFACE
// We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
// BlendStateDesc{False, False}
@@ -410,7 +409,7 @@ struct BlendStateDesc
bool operator==(const BlendStateDesc& RHS) const
{
bool bRTsEqual = true;
- for (int i = 0; i < MaxRenderTargets; ++i)
+ for (int i = 0; i < MAX_RENDER_TARGETS; ++i)
{
if (!(RenderTargets[i] == RHS.RenderTargets[i]))
{
@@ -423,6 +422,7 @@ struct BlendStateDesc
AlphaToCoverageEnable == RHS.AlphaToCoverageEnable &&
IndependentBlendEnable == RHS.IndependentBlendEnable;
}
+#endif
};
-} // namespace Diligent
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/Buffer.h b/Graphics/GraphicsEngine/interface/Buffer.h
index 92c1da89..7ccb543a 100644
--- a/Graphics/GraphicsEngine/interface/Buffer.h
+++ b/Graphics/GraphicsEngine/interface/Buffer.h
@@ -34,17 +34,17 @@
#include "DeviceObject.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
// {EC47EAD3-A2C4-44F2-81C5-5248D14F10E4}
-static constexpr INTERFACE_ID IID_Buffer =
+static const struct INTERFACE_ID IID_Buffer =
{0xec47ead3, 0xa2c4, 0x44f2, {0x81, 0xc5, 0x52, 0x48, 0xd1, 0x4f, 0x10, 0xe4}};
/// Describes the buffer access mode.
/// This enumeration is used by BufferDesc structure.
-enum BUFFER_MODE : Uint8
+DILIGENT_TYPED_ENUM(BUFFER_MODE, Uint8)
{
/// Undefined mode.
BUFFER_MODE_UNDEFINED = 0,
@@ -70,10 +70,10 @@ enum BUFFER_MODE : Uint8
};
/// Buffer description
-struct BufferDesc : DeviceObjectAttribs
-{
+struct BufferDesc DILIGENT_DERIVE(DeviceObjectAttribs)
+
/// Size of the buffer, in bytes. For a uniform buffer, this must be multiple of 16.
- Uint32 uiSizeInBytes = 0;
+ Uint32 uiSizeInBytes DEFAULT_INITIALIZER(0);
/// Buffer bind flags, see Diligent::BIND_FLAGS for details
@@ -81,17 +81,17 @@ struct BufferDesc : DeviceObjectAttribs
/// Diligent::BIND_VERTEX_BUFFER, Diligent::BIND_INDEX_BUFFER, Diligent::BIND_UNIFORM_BUFFER,
/// Diligent::BIND_SHADER_RESOURCE, Diligent::BIND_STREAM_OUTPUT, Diligent::BIND_UNORDERED_ACCESS,
/// Diligent::BIND_INDIRECT_DRAW_ARGS
- BIND_FLAGS BindFlags = BIND_NONE;
+ BIND_FLAGS BindFlags DEFAULT_INITIALIZER(BIND_NONE);
/// Buffer usage, see Diligent::USAGE for details
- USAGE Usage = USAGE_DEFAULT;
+ USAGE Usage DEFAULT_INITIALIZER(USAGE_DEFAULT);
/// CPU access flags or 0 if no CPU access is allowed,
/// see Diligent::CPU_ACCESS_FLAGS for details.
- CPU_ACCESS_FLAGS CPUAccessFlags = CPU_ACCESS_NONE;
+ CPU_ACCESS_FLAGS CPUAccessFlags DEFAULT_INITIALIZER(CPU_ACCESS_NONE);
/// Buffer mode, see Diligent::BUFFER_MODE
- BUFFER_MODE Mode = BUFFER_MODE_UNDEFINED;
+ BUFFER_MODE Mode DEFAULT_INITIALIZER(BUFFER_MODE_UNDEFINED);
/// Buffer element stride, in bytes.
@@ -100,12 +100,12 @@ struct BufferDesc : DeviceObjectAttribs
/// (BufferDesc::Mode equals Diligent::BUFFER_MODE_FORMATTED) and optionally for a raw buffer
/// (Diligent::BUFFER_MODE_RAW), this member defines the size of the format that will be used for views
/// created for this buffer.
- Uint32 ElementByteStride = 0;
+ Uint32 ElementByteStride DEFAULT_INITIALIZER(0);
/// Defines which command queues this buffer can be used with
- Uint64 CommandQueueMask = 1;
-
+ Uint64 CommandQueueMask DEFAULT_INITIALIZER(1);
+#if DILIGENT_CPP_INTERFACE
// We have to explicitly define constructors because otherwise the following initialization fails on Apple's clang:
// BufferDesc{1024, BIND_UNIFORM_BUFFER, USAGE_DEFAULT}
@@ -145,20 +145,20 @@ struct BufferDesc : DeviceObjectAttribs
ElementByteStride == RHS.ElementByteStride &&
CommandQueueMask == RHS.CommandQueueMask;
}
+#endif
};
/// Describes the buffer initial data
struct BufferData
{
/// Pointer to the data
- const void* pData = nullptr;
+ const void* pData DEFAULT_INITIALIZER(nullptr);
/// Data size, in bytes
- Uint32 DataSize = 0;
+ Uint32 DataSize DEFAULT_INITIALIZER(0);
- // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
- // BufferData{nullptr, 0}
+#if DILIGENT_CPP_INTERFACE
BufferData() noexcept {}
@@ -167,8 +167,12 @@ struct BufferData
pData {_pData },
DataSize{_DataSize}
{}
+#endif
};
+
+#if DILIGENT_CPP_INTERFACE
+
/// Buffer interface
/// Defines the methods to manipulate a buffer object
@@ -226,4 +230,8 @@ public:
virtual RESOURCE_STATE GetState() const = 0;
};
-} // namespace Diligent
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/BufferView.h b/Graphics/GraphicsEngine/interface/BufferView.h
index 50aed1d3..992ef5f0 100644
--- a/Graphics/GraphicsEngine/interface/BufferView.h
+++ b/Graphics/GraphicsEngine/interface/BufferView.h
@@ -34,31 +34,31 @@
#include "Buffer.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {E2E83490-E9D2-495B-9A83-ABB413A38B07}
-static constexpr INTERFACE_ID IID_BufferView =
+static const struct INTERFACE_ID IID_BufferView =
{0xe2e83490, 0xe9d2, 0x495b, {0x9a, 0x83, 0xab, 0xb4, 0x13, 0xa3, 0x8b, 0x7}};
/// Buffer format description
struct BufferFormat
{
/// Type of components. For a formatted buffer views, this value cannot be VT_UNDEFINED
- VALUE_TYPE ValueType = VT_UNDEFINED;
+ VALUE_TYPE ValueType DEFAULT_INITIALIZER(VT_UNDEFINED);
/// Number of components. Allowed values: 1, 2, 3, 4.
/// For a formatted buffer, this value cannot be 0
- Uint8 NumComponents = 0;
+ Uint8 NumComponents DEFAULT_INITIALIZER(0);
/// For signed and unsigned integer value types
/// (VT_INT8, VT_INT16, VT_INT32, VT_UINT8, VT_UINT16, VT_UINT32)
/// indicates if the value should be normalized to [-1,+1] or
/// [0, 1] range respectively. For floating point types
/// (VT_FLOAT16 and VT_FLOAT32), this member is ignored.
- Bool IsNormalized = False;
+ Bool IsNormalized DEFAULT_INITIALIZER(False);
+#if DILIGENT_CPP_INTERFACE
// We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
// BufferFormat{VT_FLOAT32, 4}
@@ -80,27 +80,29 @@ struct BufferFormat
NumComponents == RHS.NumComponents &&
IsNormalized == RHS.IsNormalized;
}
+#endif
};
/// Buffer view description
-struct BufferViewDesc : DeviceObjectAttribs
-{
+struct BufferViewDesc DILIGENT_DERIVE(DeviceObjectAttribs)
+
/// View type. See Diligent::BUFFER_VIEW_TYPE for details.
- BUFFER_VIEW_TYPE ViewType = BUFFER_VIEW_UNDEFINED;
+ BUFFER_VIEW_TYPE ViewType DEFAULT_INITIALIZER(BUFFER_VIEW_UNDEFINED);
/// Format of the view. This member is only used for formatted and raw buffers.
/// To create raw view of a raw buffer, set Format.ValueType member to VT_UNDEFINED
/// (default value).
- BufferFormat Format;
+ struct BufferFormat Format;
/// Offset in bytes from the beginnig of the buffer to the start of the
/// buffer region referenced by the view
- Uint32 ByteOffset = 0;
+ Uint32 ByteOffset DEFAULT_INITIALIZER(0);
/// Size in bytes of the referenced buffer region
- Uint32 ByteWidth = 0;
+ Uint32 ByteWidth DEFAULT_INITIALIZER(0);
+#if DILIGENT_CPP_INTERFACE
BufferViewDesc()noexcept{}
explicit
@@ -132,8 +134,12 @@ struct BufferViewDesc : DeviceObjectAttribs
ByteWidth == RHS.ByteWidth &&
Format == RHS.Format;
}
+#endif
};
+
+#if DILIGENT_CPP_INTERFACE
+
/// Buffer view interface
/// To create a buffer view, call IBuffer::CreateView().
@@ -156,4 +162,8 @@ public:
virtual IBuffer* GetBuffer() = 0;
};
-} // namespace Diligent
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/CommandList.h b/Graphics/GraphicsEngine/interface/CommandList.h
index 4333638c..49586d8c 100644
--- a/Graphics/GraphicsEngine/interface/CommandList.h
+++ b/Graphics/GraphicsEngine/interface/CommandList.h
@@ -32,13 +32,15 @@
#include "DeviceObject.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {C38C68F2-8A8C-4ED5-B7EE-69126E75DCD8}
-static constexpr INTERFACE_ID IID_CommandList =
+static const struct INTERFACE_ID IID_CommandList =
{0xc38c68f2, 0x8a8c, 0x4ed5, {0xb7, 0xee, 0x69, 0x12, 0x6e, 0x75, 0xdc, 0xd8}};
+
+#if DILIGENT_CPP_INTERFACE
+
/// Command list interface
/// Command list has no methods. When command list recording is finished, it is executed by
@@ -47,4 +49,8 @@ class ICommandList : public IDeviceObject
{
};
-} // namespace Diligent
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/Constants.h b/Graphics/GraphicsEngine/interface/Constants.h
index 2d14abed..9fa70088 100644
--- a/Graphics/GraphicsEngine/interface/Constants.h
+++ b/Graphics/GraphicsEngine/interface/Constants.h
@@ -32,23 +32,27 @@
#include "../../../Primitives/interface/BasicTypes.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
// clang-format off
/// Maximum number of input buffer slots.
/// D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT == 32
-static constexpr Uint32 MaxBufferSlots = 32;
+#define DILIGENT_MAX_BUFFER_SOLTS 32
/// Maximum number of simultaneous render targets.
-static constexpr Uint32 MaxRenderTargets = 8;
+#define DILIGENT_MAX_RENDER_TARGETS 8
/// Maximum number of viewports.
-static constexpr Uint32 MaxViewports = 16;
+#define DILIGENT_MAX_VIEWPORTS 16
+
+static const Uint32 MAX_BUFFER_SLOTS = DILIGENT_MAX_BUFFER_SOLTS;
+static const Uint32 MAX_RENDER_TARGETS = DILIGENT_MAX_RENDER_TARGETS;
+static const Uint32 MAX_VIEWPORTS = DILIGENT_MAX_VIEWPORTS;
/// Maximum number of shader stages in a pipeline.
-static constexpr Uint32 MaxShadersInPipeline = 5;
+static const Uint32 MAX_SHADERS_IN_PIPELINE = 5;
// clang-format on
-} // namespace Diligent
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/DepthStencilState.h b/Graphics/GraphicsEngine/interface/DepthStencilState.h
index 3edfcd62..39c4111d 100644
--- a/Graphics/GraphicsEngine/interface/DepthStencilState.h
+++ b/Graphics/GraphicsEngine/interface/DepthStencilState.h
@@ -34,8 +34,8 @@
#include "GraphicsTypes.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
/// Stencil operation
@@ -45,7 +45,7 @@ namespace Diligent
/// [D3D11_STENCIL_OP][]/[D3D12_STENCIL_OP][] enumeration.
/// It is used by Diligent::StencilOpDesc structure to describe the stencil fail, depth fail
/// and stencil pass operations
-enum STENCIL_OP : Int8
+DILIGENT_TYPED_ENUM(STENCIL_OP, Int8)
{
/// Undefined operation.
STENCIL_OP_UNDEFINED = 0,
@@ -99,21 +99,22 @@ struct StencilOpDesc
{
/// The stencil operation to perform when stencil testing fails.
/// Default value: Diligent::STENCIL_OP_KEEP.
- STENCIL_OP StencilFailOp = STENCIL_OP_KEEP;
+ STENCIL_OP StencilFailOp DEFAULT_INITIALIZER(STENCIL_OP_KEEP);
/// The stencil operation to perform when stencil testing passes and depth testing fails.
/// Default value: Diligent::STENCIL_OP_KEEP.
- STENCIL_OP StencilDepthFailOp = STENCIL_OP_KEEP;
+ STENCIL_OP StencilDepthFailOp DEFAULT_INITIALIZER(STENCIL_OP_KEEP);
/// The stencil operation to perform when stencil testing and depth testing both pass.
/// Default value: Diligent::STENCIL_OP_KEEP.
- STENCIL_OP StencilPassOp = STENCIL_OP_KEEP;
+ STENCIL_OP StencilPassOp DEFAULT_INITIALIZER(STENCIL_OP_KEEP);
/// A function that compares stencil data against existing stencil data.
/// Default value: Diligent::COMPARISON_FUNC_ALWAYS. See Diligent::COMPARISON_FUNCTION.
- COMPARISON_FUNCTION StencilFunc = COMPARISON_FUNC_ALWAYS;
+ COMPARISON_FUNCTION StencilFunc DEFAULT_INITIALIZER(COMPARISON_FUNC_ALWAYS);
+#if DILIGENT_CPP_INTERFACE
// We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
// StencilOpDesc{STENCIL_OP_KEEP, STENCIL_OP_KEEP, STENCIL_OP_KEEP, COMPARISON_FUNC_ALWAYS}
@@ -142,6 +143,7 @@ struct StencilOpDesc
StencilPassOp == rhs.StencilPassOp &&
StencilFunc == rhs.StencilFunc;
}
+#endif
};
/// Depth stencil state description
@@ -156,34 +158,35 @@ struct DepthStencilStateDesc
/// Enable depth-stencil operations. When it is set to False,
/// depth test always passes, depth writes are disabled,
/// and no stencil operations are performed. Default value: True.
- Bool DepthEnable = True;
+ Bool DepthEnable DEFAULT_INITIALIZER(True);
/// Enable or disable writes to a depth buffer. Default value: True.
- Bool DepthWriteEnable = True;
+ Bool DepthWriteEnable DEFAULT_INITIALIZER(True);
/// A function that compares depth data against existing depth data.
/// See Diligent::COMPARISON_FUNCTION for details.
/// Default value: Diligent::COMPARISON_FUNC_LESS.
- COMPARISON_FUNCTION DepthFunc = COMPARISON_FUNC_LESS;
+ COMPARISON_FUNCTION DepthFunc DEFAULT_INITIALIZER(COMPARISON_FUNC_LESS);
/// Enable stencil opertaions. Default value: False.
- Bool StencilEnable = False;
+ Bool StencilEnable DEFAULT_INITIALIZER(False);
/// Identify which bits of the depth-stencil buffer are accessed when reading stencil data.
/// Default value: 0xFF.
- Uint8 StencilReadMask = 0xFF;
+ Uint8 StencilReadMask DEFAULT_INITIALIZER(0xFF);
/// Identify which bits of the depth-stencil buffer are accessed when writing stencil data.
/// Default value: 0xFF.
- Uint8 StencilWriteMask = 0xFF;
+ Uint8 StencilWriteMask DEFAULT_INITIALIZER(0xFF);
/// Identify stencil operations for the front-facing triangles, see Diligent::StencilOpDesc.
- StencilOpDesc FrontFace;
+ struct StencilOpDesc FrontFace;
/// Identify stencil operations for the back-facing triangles, see Diligent::StencilOpDesc.
- StencilOpDesc BackFace;
+ struct StencilOpDesc BackFace;
+#if DILIGENT_CPP_INTERFACE
// We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
// DepthStencilStateDesc{False, False}
@@ -224,6 +227,7 @@ struct DepthStencilStateDesc
FrontFace == rhs.FrontFace &&
BackFace == rhs.BackFace;
}
+#endif
};
-}
+DILIGENT_END_NAMESPACE
diff --git a/Graphics/GraphicsEngine/interface/DeviceCaps.h b/Graphics/GraphicsEngine/interface/DeviceCaps.h
index b604c811..e43a343c 100644
--- a/Graphics/GraphicsEngine/interface/DeviceCaps.h
+++ b/Graphics/GraphicsEngine/interface/DeviceCaps.h
@@ -34,218 +34,221 @@
#include "GraphicsTypes.h"
-namespace Diligent
-{
- /// Device type
- enum class DeviceType : Int32
- {
- Undefined = 0, ///< Undefined device
- D3D11, ///< D3D11 device
- D3D12, ///< D3D12 device
- OpenGL, ///< OpenGL device
- OpenGLES, ///< OpenGLES device
- Vulkan, ///< Vulkan device
- Metal ///< Metal device (not yet implemented)
- };
+DILIGENT_BEGIN_NAMESPACE(Diligent)
- /// Texture sampler capabilities
- struct SamplerCaps
- {
- /// Indicates if device supports border texture addressing mode
- Bool BorderSamplingModeSupported = False;
+/// Device type
+enum RENDER_DEVICE_TYPE
+{
+ RENDER_DEVICE_TYPE_UNDEFINED = 0, ///< Undefined device
+ RENDER_DEVICE_TYPE_D3D11, ///< D3D11 device
+ RENDER_DEVICE_TYPE_D3D12, ///< D3D12 device
+ RENDER_DEVICE_TYPE_GL, ///< OpenGL device
+ RENDER_DEVICE_TYPE_GLES, ///< OpenGLES device
+ RENDER_DEVICE_TYPE_VULKAN, ///< Vulkan device
+ RENDER_DEVICE_TYPE_METAL ///< Metal device (not yet implemented)
+};
+
+/// Texture sampler capabilities
+struct SamplerCaps
+{
+ /// Indicates if device supports border texture addressing mode
+ Bool BorderSamplingModeSupported DEFAULT_INITIALIZER(False);
- /// Indicates if device supports anisotrpoic filtering
- Bool AnisotropicFilteringSupported = False;
+ /// Indicates if device supports anisotrpoic filtering
+ Bool AnisotropicFilteringSupported DEFAULT_INITIALIZER(False);
- /// Indicates if device supports MIP load bias
- Bool LODBiasSupported = False;
- };
+ /// Indicates if device supports MIP load bias
+ Bool LODBiasSupported DEFAULT_INITIALIZER(False);
+};
- /// Texture capabilities
- struct TextureCaps
- {
- /// Maximum dimension (width) of a 1D texture, or 0 if 1D textures are not supported.
- Uint32 MaxTexture1DDimension = 0;
+/// Texture capabilities
+struct TextureCaps
+{
+ /// Maximum dimension (width) of a 1D texture, or 0 if 1D textures are not supported.
+ Uint32 MaxTexture1DDimension DEFAULT_INITIALIZER(0);
- /// Maximum number of slices in a 1D texture array, or 0 if 1D texture arrays are not supported.
- Uint32 MaxTexture1DArraySlices = 0;
+ /// Maximum number of slices in a 1D texture array, or 0 if 1D texture arrays are not supported.
+ Uint32 MaxTexture1DArraySlices DEFAULT_INITIALIZER(0);
- /// Maximum dimension (width or height) of a 2D texture.
- Uint32 MaxTexture2DDimension = 0;
+ /// Maximum dimension (width or height) of a 2D texture.
+ Uint32 MaxTexture2DDimension DEFAULT_INITIALIZER(0);
- /// Maximum number of slices in a 2D texture array, or 0 if 2D texture arrays are not supported.
- Uint32 MaxTexture2DArraySlices = 0;
+ /// Maximum number of slices in a 2D texture array, or 0 if 2D texture arrays are not supported.
+ Uint32 MaxTexture2DArraySlices DEFAULT_INITIALIZER(0);
- /// Maximum dimension (width, height, or depth) of a 3D texture, or 0 if 3D textures are not supported.
- Uint32 MaxTexture3DDimension = 0;
+ /// Maximum dimension (width, height, or depth) of a 3D texture, or 0 if 3D textures are not supported.
+ Uint32 MaxTexture3DDimension DEFAULT_INITIALIZER(0);
- /// Maximum dimension (width or height) of a cubemap face, or 0 if cubemap textures are not supported.
- Uint32 MaxTextureCubeDimension = 0;
+ /// Maximum dimension (width or height) of a cubemap face, or 0 if cubemap textures are not supported.
+ Uint32 MaxTextureCubeDimension DEFAULT_INITIALIZER(0);
- /// Indicates if device supports 2D multisampled textures
- Bool Texture2DMSSupported = False;
+ /// Indicates if device supports 2D multisampled textures
+ Bool Texture2DMSSupported DEFAULT_INITIALIZER(False);
- /// Indicates if device supports 2D multisampled texture arrays
- Bool Texture2DMSArraySupported = False;
+ /// Indicates if device supports 2D multisampled texture arrays
+ Bool Texture2DMSArraySupported DEFAULT_INITIALIZER(False);
- /// Indicates if device supports texture views
- Bool TextureViewSupported = False;
+ /// Indicates if device supports texture views
+ Bool TextureViewSupported DEFAULT_INITIALIZER(False);
- /// Indicates if device supports cubemap arrays
- Bool CubemapArraysSupported = False;
- };
+ /// Indicates if device supports cubemap arrays
+ Bool CubemapArraysSupported DEFAULT_INITIALIZER(False);
+};
- /// Describes supported device features
- struct DeviceFeatures
- {
- /// Indicates if device supports separable programs
- Bool SeparablePrograms = False;
+/// Describes supported device features
+struct DeviceFeatures
+{
+ /// Indicates if device supports separable programs
+ Bool SeparablePrograms DEFAULT_INITIALIZER(False);
- /// Indicates if device supports indirect draw commands
- Bool IndirectRendering = False;
+ /// Indicates if device supports indirect draw commands
+ Bool IndirectRendering DEFAULT_INITIALIZER(False);
- /// Indicates if device supports wireframe fill mode
- Bool WireframeFill = False;
+ /// Indicates if device supports wireframe fill mode
+ Bool WireframeFill DEFAULT_INITIALIZER(False);
- /// Indicates if device supports multithreaded resource creation
- Bool MultithreadedResourceCreation = False;
+ /// Indicates if device supports multithreaded resource creation
+ Bool MultithreadedResourceCreation DEFAULT_INITIALIZER(False);
- /// Indicates if device supports compute shaders
- Bool ComputeShaders = False;
+ /// Indicates if device supports compute shaders
+ Bool ComputeShaders DEFAULT_INITIALIZER(False);
- /// Indicates if device supports geometry shaders
- Bool GeometryShaders = False;
+ /// Indicates if device supports geometry shaders
+ Bool GeometryShaders DEFAULT_INITIALIZER(False);
- /// Indicates if device supports tessellation
- Bool Tessellation = False;
+ /// Indicates if device supports tessellation
+ Bool Tessellation DEFAULT_INITIALIZER(False);
- /// Indicates if device supports bindless resources
- Bool BindlessResources = False;
+ /// Indicates if device supports bindless resources
+ Bool BindlessResources DEFAULT_INITIALIZER(False);
- /// Indicates if device supports occlusion queries (see Diligent::QUERY_TYPE_OCCLUSION).
- Bool OcclusionQueries = False;
+ /// Indicates if device supports occlusion queries (see Diligent::QUERY_TYPE_OCCLUSION).
+ Bool OcclusionQueries DEFAULT_INITIALIZER(False);
- /// Indicates if device supports binary occlusion queries (see Diligent::QUERY_TYPE_BINARY_OCCLUSION).
- Bool BinaryOcclusionQueries = False;
+ /// Indicates if device supports binary occlusion queries (see Diligent::QUERY_TYPE_BINARY_OCCLUSION).
+ Bool BinaryOcclusionQueries DEFAULT_INITIALIZER(False);
- /// Indicates if device supports timestamp queries (see Diligent::QUERY_TYPE_TIMESTAMP).
- Bool TimestampQueries = False;
+ /// Indicates if device supports timestamp queries (see Diligent::QUERY_TYPE_TIMESTAMP).
+ Bool TimestampQueries DEFAULT_INITIALIZER(False);
- /// Indicates if device supports pipeline statistics queries (see Diligent::QUERY_TYPE_PIPELINE_STATISTICS).
- Bool PipelineStatisticsQueries = False;
+ /// Indicates if device supports pipeline statistics queries (see Diligent::QUERY_TYPE_PIPELINE_STATISTICS).
+ Bool PipelineStatisticsQueries DEFAULT_INITIALIZER(False);
- /// Indicates if device supports depth bias clamping
- Bool DepthBiasClamp = False;
+ /// Indicates if device supports depth bias clamping
+ Bool DepthBiasClamp DEFAULT_INITIALIZER(False);
- /// Indicates if device supports depth clamping
- Bool DepthClamp = False;
+ /// Indicates if device supports depth clamping
+ Bool DepthClamp DEFAULT_INITIALIZER(False);
- /// Indicates if device supports depth clamping
- Bool IndependentBlend = False;
+ /// Indicates if device supports depth clamping
+ Bool IndependentBlend DEFAULT_INITIALIZER(False);
- /// Indicates if device supports dual-source blend
- Bool DualSourceBlend = False;
+ /// Indicates if device supports dual-source blend
+ Bool DualSourceBlend DEFAULT_INITIALIZER(False);
- /// Indicates if device supports multiviewport
- Bool MultiViewport = False;
+ /// Indicates if device supports multiviewport
+ Bool MultiViewport DEFAULT_INITIALIZER(False);
- /// Indicates if device supports all BC-compressed formats
- Bool TextureCompressionBC = False;
+ /// Indicates if device supports all BC-compressed formats
+ Bool TextureCompressionBC DEFAULT_INITIALIZER(False);
- /// Indicates if device supports writes to UAVs as well as atomic operations in vertex,
- /// tessellation, and geometry shader stages.
- Bool VertexPipelineUAVWritesAndAtomics = False;
+ /// Indicates if device supports writes to UAVs as well as atomic operations in vertex,
+ /// tessellation, and geometry shader stages.
+ Bool VertexPipelineUAVWritesAndAtomics DEFAULT_INITIALIZER(False);
- /// Indicates if device supports writes to UAVs as well as atomic operations in pixel
- /// shader stage.
- Bool PixelUAVWritesAndAtomics = False;
+ /// Indicates if device supports writes to UAVs as well as atomic operations in pixel
+ /// shader stage.
+ Bool PixelUAVWritesAndAtomics DEFAULT_INITIALIZER(False);
- /// Specifies whether all the extended UAV texture formats are available in shader code.
- Bool TextureUAVExtendedFormats = False;
- };
+ /// Specifies whether all the extended UAV texture formats are available in shader code.
+ Bool TextureUAVExtendedFormats DEFAULT_INITIALIZER(False);
+};
- /// Device capabilities
- struct DeviceCaps
- {
- /// Device type. See Diligent::DeviceType.
- DeviceType DevType = DeviceType::Undefined;
+/// Device capabilities
+struct DeviceCaps
+{
+ /// Device type. See Diligent::DeviceType.
+ enum RENDER_DEVICE_TYPE DevType DEFAULT_INITIALIZER(RENDER_DEVICE_TYPE_UNDEFINED);
+
+ /// Major revision of the graphics API supported by the graphics adapter.
+ /// Note that this value indicates the maximum supported feature level, so,
+ /// for example, if the device type is D3D11, this value will be 10 when
+ /// the maximum supported Direct3D feature level of the graphics adapter is 10.0.
+ Int32 MajorVersion DEFAULT_INITIALIZER(0);
- /// Major revision of the graphics API supported by the graphics adapter.
- /// Note that this value indicates the maximum supported feature level, so,
- /// for example, if the device type is D3D11, this value will be 10 when
- /// the maximum supported Direct3D feature level of the graphics adapter is 10.0.
- Int32 MajorVersion = 0;
+ /// Minor revision of the graphics API supported by the graphics adapter.
+ /// Similar to MajorVersion, this value indicates the maximum supported feature level.
+ Int32 MinorVersion DEFAULT_INITIALIZER(0);
- /// Minor revision of the graphics API supported by the graphics adapter.
- /// Similar to MajorVersion, this value indicates the maximum supported feature level.
- Int32 MinorVersion = 0;
+ /// Adapter type. See Diligent::ADAPTER_TYPE.
+ ADAPTER_TYPE AdaterType DEFAULT_INITIALIZER(ADAPTER_TYPE_UNKNOWN);
- /// Adapter type. See Diligent::ADAPTER_TYPE.
- ADAPTER_TYPE AdaterType = ADAPTER_TYPE_UNKNOWN;
+ /// Texture sampling capabilities. See Diligent::SamplerCaps.
+ struct SamplerCaps SamCaps;
- /// Texture sampling capabilities. See Diligent::SamplerCaps.
- SamplerCaps SamCaps;
+ /// Texture capabilities. See Diligent::TextureCaps.
+ struct TextureCaps TexCaps;
- /// Texture capabilities. See Diligent::TextureCaps.
- TextureCaps TexCaps;
+ /// Device features. See Diligent::DeviceFeatures.
+ struct DeviceFeatures Features;
- /// Device features. See Diligent::DeviceFeatures.
- DeviceFeatures Features;
+#if DILIGENT_CPP_INTERFACE
+ bool IsGLDevice()const
+ {
+ return DevType == RENDER_DEVICE_TYPE_GL || DevType == RENDER_DEVICE_TYPE_GLES;
+ }
+ bool IsD3DDevice()const
+ {
+ return DevType == RENDER_DEVICE_TYPE_D3D11 || DevType == RENDER_DEVICE_TYPE_D3D12;
+ }
+ bool IsVulkanDevice()const
+ {
+ return DevType == RENDER_DEVICE_TYPE_VULKAN;
+ }
+
+ struct NDCAttribs
+ {
+ const float MinZ; // Minimum z value of normalized device coordinate space
+ const float ZtoDepthScale; // NDC z to depth scale
+ const float YtoVScale; // Scale to transform NDC y coordinate to texture V coordinate
- bool IsGLDevice()const
+ float GetZtoDepthBias() const
{
- return DevType == DeviceType::OpenGL || DevType == DeviceType::OpenGLES;
+ // Returns ZtoDepthBias such that given NDC z coordinate, depth value can be
+ // computed as follows:
+ // d = z * ZtoDepthScale + ZtoDepthBias
+ return -MinZ * ZtoDepthScale;
}
- bool IsD3DDevice()const
+ };
+
+ const NDCAttribs& GetNDCAttribs()const
+ {
+ if (IsVulkanDevice())
{
- return DevType == DeviceType::D3D11 || DevType == DeviceType::D3D12;
+ // Note that Vulkan itself does not invert Y coordinate when transforming
+ // normalized device Y to window space. However, we use negative viewport
+ // height which achieves the same effect as in D3D, thererfore we need to
+ // invert y (see comments in DeviceContextVkImpl::CommitViewports() for details)
+ static constexpr const NDCAttribs NDCAttribsVk {0.0f, 1.0f, -0.5f};
+ return NDCAttribsVk;
}
- bool IsVulkanDevice()const
+ else if (IsD3DDevice())
{
- return DevType == DeviceType::Vulkan;
+ static constexpr const NDCAttribs NDCAttribsD3D {0.0f, 1.0f, -0.5f};
+ return NDCAttribsD3D;
}
-
- struct NDCAttribs
+ else if (IsGLDevice())
{
- const float MinZ; // Minimum z value of normalized device coordinate space
- const float ZtoDepthScale; // NDC z to depth scale
- const float YtoVScale; // Scale to transform NDC y coordinate to texture V coordinate
-
- float GetZtoDepthBias() const
- {
- // Returns ZtoDepthBias such that given NDC z coordinate, depth value can be
- // computed as follows:
- // d = z * ZtoDepthScale + ZtoDepthBias
- return -MinZ * ZtoDepthScale;
- }
- };
-
- const NDCAttribs& GetNDCAttribs()const
+ static constexpr const NDCAttribs NDCAttribsGL {-1.0f, 0.5f, 0.5f};
+ return NDCAttribsGL;
+ }
+ else
{
- if (IsVulkanDevice())
- {
- // Note that Vulkan itself does not invert Y coordinate when transforming
- // normalized device Y to window space. However, we use negative viewport
- // height which achieves the same effect as in D3D, thererfore we need to
- // invert y (see comments in DeviceContextVkImpl::CommitViewports() for details)
- static constexpr const NDCAttribs NDCAttribsVk {0.0f, 1.0f, -0.5f};
- return NDCAttribsVk;
- }
- else if (IsD3DDevice())
- {
- static constexpr const NDCAttribs NDCAttribsD3D {0.0f, 1.0f, -0.5f};
- return NDCAttribsD3D;
- }
- else if (IsGLDevice())
- {
- static constexpr const NDCAttribs NDCAttribsGL {-1.0f, 0.5f, 0.5f};
- return NDCAttribsGL;
- }
- else
- {
- static constexpr const NDCAttribs NDCAttribsDefault {0.0f, 1.0f, 0.5f};
- return NDCAttribsDefault;
- }
+ static constexpr const NDCAttribs NDCAttribsDefault {0.0f, 1.0f, 0.5f};
+ return NDCAttribsDefault;
}
- };
-}
+ }
+#endif
+};
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h
index c3f7e407..b5387fd4 100644
--- a/Graphics/GraphicsEngine/interface/DeviceContext.h
+++ b/Graphics/GraphicsEngine/interface/DeviceContext.h
@@ -52,15 +52,15 @@
#include "CommandList.h"
#include "SwapChain.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
// {DC92711B-A1BE-4319-B2BD-C662D1CC19E4}
-static constexpr INTERFACE_ID IID_DeviceContext =
+static const struct INTERFACE_ID IID_DeviceContext =
{0xdc92711b, 0xa1be, 0x4319, {0xb2, 0xbd, 0xc6, 0x62, 0xd1, 0xcc, 0x19, 0xe4}};
/// Draw command flags
-enum DRAW_FLAGS : Uint8
+DILIGENT_TYPED_ENUM(DRAW_FLAGS, Uint8)
{
/// No flags.
DRAW_FLAG_NONE = 0x00,
@@ -128,7 +128,7 @@ DEFINE_FLAG_ENUM_OPERATORS(DRAW_FLAGS)
/// Refer to http://diligentgraphics.com/2018/12/09/resource-state-management/ for detailed explanation
/// of resource state management in Diligent Engine.
-enum RESOURCE_STATE_TRANSITION_MODE : Uint8
+DILIGENT_TYPED_ENUM(RESOURCE_STATE_TRANSITION_MODE, Uint8)
{
/// Perform no state transitions and no state validation.
/// Resource states are not accessed (either read or written) by the command.
@@ -164,24 +164,25 @@ enum RESOURCE_STATE_TRANSITION_MODE : Uint8
struct DrawAttribs
{
/// The number of vertices to draw.
- Uint32 NumVertices = 0;
+ Uint32 NumVertices DEFAULT_INITIALIZER(0);
/// Additional flags, see Diligent::DRAW_FLAGS.
- DRAW_FLAGS Flags = DRAW_FLAG_NONE;
+ DRAW_FLAGS Flags DEFAULT_INITIALIZER(DRAW_FLAG_NONE);
/// The number of instances to draw. If more than one instance is specified,
/// instanced draw call will be performed.
- Uint32 NumInstances = 1;
+ Uint32 NumInstances DEFAULT_INITIALIZER(1);
/// LOCATION (or INDEX, but NOT the byte offset) of the first vertex in the
/// vertex buffer to start reading vertices from.
- Uint32 StartVertexLocation = 0;
+ Uint32 StartVertexLocation DEFAULT_INITIALIZER(0);
/// LOCATION (or INDEX, but NOT the byte offset) in the vertex buffer to start
/// reading instance data from.
- Uint32 FirstInstanceLocation = 0;
+ Uint32 FirstInstanceLocation DEFAULT_INITIALIZER(0);
+#if DILIGENT_CPP_INTERFACE
/// Initializes the structure members with default values.
/// Default values:
@@ -207,6 +208,7 @@ struct DrawAttribs
StartVertexLocation {_StartVertexLocation },
FirstInstanceLocation{_FirstInstanceLocation}
{}
+#endif
};
@@ -216,31 +218,32 @@ struct DrawAttribs
struct DrawIndexedAttribs
{
/// The number of indices to draw.
- Uint32 NumIndices = 0;
+ Uint32 NumIndices DEFAULT_INITIALIZER(0);
/// The type of elements in the index buffer.
/// Allowed values: VT_UINT16 and VT_UINT32.
- VALUE_TYPE IndexType = VT_UNDEFINED;
+ enum VALUE_TYPE IndexType DEFAULT_INITIALIZER(VT_UNDEFINED);
/// Additional flags, see Diligent::DRAW_FLAGS.
- DRAW_FLAGS Flags = DRAW_FLAG_NONE;
+ enum DRAW_FLAGS Flags DEFAULT_INITIALIZER(DRAW_FLAG_NONE);
/// Number of instances to draw. If more than one instance is specified,
/// instanced draw call will be performed.
- Uint32 NumInstances = 1;
+ Uint32 NumInstances DEFAULT_INITIALIZER(1);
/// LOCATION (NOT the byte offset) of the first index in
/// the index buffer to start reading indices from.
- Uint32 FirstIndexLocation = 0;
+ Uint32 FirstIndexLocation DEFAULT_INITIALIZER(0);
/// A constant which is added to each index before accessing the vertex buffer.
- Uint32 BaseVertex = 0;
+ Uint32 BaseVertex DEFAULT_INITIALIZER(0);
/// LOCATION (or INDEX, but NOT the byte offset) in the vertex
/// buffer to start reading instance data from.
- Uint32 FirstInstanceLocation = 0;
+ Uint32 FirstInstanceLocation DEFAULT_INITIALIZER(0);
+#if DILIGENT_CPP_INTERFACE
/// Initializes the structure members with default values.
/// Default values:
@@ -271,6 +274,7 @@ struct DrawIndexedAttribs
BaseVertex {_BaseVertex },
FirstInstanceLocation{_FirstInstanceLocation}
{}
+#endif
};
@@ -280,14 +284,16 @@ struct DrawIndexedAttribs
struct DrawIndirectAttribs
{
/// Additional flags, see Diligent::DRAW_FLAGS.
- DRAW_FLAGS Flags = DRAW_FLAG_NONE;
+ enum DRAW_FLAGS Flags DEFAULT_INITIALIZER(DRAW_FLAG_NONE);
/// State transition mode for indirect draw arguments buffer.
- RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
+ enum RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE);
/// Offset from the beginning of the buffer to the location of draw command attributes.
- Uint32 IndirectDrawArgsOffset = 0;
+ Uint32 IndirectDrawArgsOffset DEFAULT_INITIALIZER(0);
+
+#if DILIGENT_CPP_INTERFACE
/// Initializes the structure members with default values
/// Default values:
@@ -306,6 +312,7 @@ struct DrawIndirectAttribs
IndirectAttribsBufferStateTransitionMode{_IndirectAttribsBufferStateTransitionMode},
IndirectDrawArgsOffset {_IndirectDrawArgsOffset }
{}
+#endif
};
@@ -316,18 +323,19 @@ struct DrawIndexedIndirectAttribs
{
/// The type of the elements in the index buffer.
/// Allowed values: VT_UINT16 and VT_UINT32. Ignored if DrawAttribs::IsIndexed is False.
- VALUE_TYPE IndexType = VT_UNDEFINED;
+ enum VALUE_TYPE IndexType DEFAULT_INITIALIZER(VT_UNDEFINED);
/// Additional flags, see Diligent::DRAW_FLAGS.
- DRAW_FLAGS Flags = DRAW_FLAG_NONE;
+ enum DRAW_FLAGS Flags DEFAULT_INITIALIZER(DRAW_FLAG_NONE);
/// State transition mode for indirect draw arguments buffer.
- RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
+ enum RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE);
/// Offset from the beginning of the buffer to the location of draw command attributes.
- Uint32 IndirectDrawArgsOffset = 0;
+ Uint32 IndirectDrawArgsOffset DEFAULT_INITIALIZER(0);
+#if DILIGENT_CPP_INTERFACE
/// Initializes the structure members with default values
/// Default values:
@@ -349,13 +357,14 @@ struct DrawIndexedIndirectAttribs
IndirectAttribsBufferStateTransitionMode{_IndirectAttribsBufferStateTransitionMode},
IndirectDrawArgsOffset {_IndirectDrawArgsOffset }
{}
+#endif
};
/// Defines which parts of the depth-stencil buffer to clear.
/// These flags are used by IDeviceContext::ClearDepthStencil().
-enum CLEAR_DEPTH_STENCIL_FLAGS : Uint32
+DILIGENT_TYPED_ENUM(CLEAR_DEPTH_STENCIL_FLAGS, Uint32)
{
/// Perform no clear.
CLEAR_DEPTH_FLAG_NONE = 0x00,
@@ -374,10 +383,11 @@ DEFINE_FLAG_ENUM_OPERATORS(CLEAR_DEPTH_STENCIL_FLAGS)
/// This structure is used by IDeviceContext::DispatchCompute().
struct DispatchComputeAttribs
{
- Uint32 ThreadGroupCountX = 1; ///< Number of groups dispatched in X direction.
- Uint32 ThreadGroupCountY = 1; ///< Number of groups dispatched in Y direction.
- Uint32 ThreadGroupCountZ = 1; ///< Number of groups dispatched in Z direction.
+ Uint32 ThreadGroupCountX DEFAULT_INITIALIZER(1); ///< Number of groups dispatched in X direction.
+ Uint32 ThreadGroupCountY DEFAULT_INITIALIZER(1); ///< Number of groups dispatched in Y direction.
+ Uint32 ThreadGroupCountZ DEFAULT_INITIALIZER(1); ///< Number of groups dispatched in Z direction.
+#if DILIGENT_CPP_INTERFACE
DispatchComputeAttribs()noexcept{}
/// Initializes the structure with user-specified values.
@@ -386,6 +396,7 @@ struct DispatchComputeAttribs
ThreadGroupCountY {GroupsY},
ThreadGroupCountZ {GroupsZ}
{}
+#endif
};
/// Describes dispatch command arguments.
@@ -394,11 +405,12 @@ struct DispatchComputeAttribs
struct DispatchComputeIndirectAttribs
{
/// State transition mode for indirect dispatch attributes buffer.
- RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
+ enum RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE);
/// The offset from the beginning of the buffer to the dispatch command arguments.
- Uint32 DispatchArgsByteOffset = 0;
+ Uint32 DispatchArgsByteOffset DEFAULT_INITIALIZER(0);
+#if DILIGENT_CPP_INTERFACE
DispatchComputeIndirectAttribs()noexcept{}
/// Initializes the structure with user-specified values.
@@ -408,6 +420,7 @@ struct DispatchComputeIndirectAttribs
IndirectAttribsBufferStateTransitionMode{StateTransitionMode},
DispatchArgsByteOffset {Offset }
{}
+#endif
};
@@ -417,31 +430,31 @@ struct DispatchComputeIndirectAttribs
struct ResolveTextureSubresourceAttribs
{
/// Mip level of the source multi-sampled texture to resolve.
- Uint32 SrcMipLevel = 0;
+ Uint32 SrcMipLevel DEFAULT_INITIALIZER(0);
/// Array slice of the source multi-sampled texture to resolve.
- Uint32 SrcSlice = 0;
+ Uint32 SrcSlice DEFAULT_INITIALIZER(0);
/// Source texture state transition mode, see Diligent::RESOURCE_STATE_TRANSITION_MODE.
- RESOURCE_STATE_TRANSITION_MODE SrcTextureTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
+ enum RESOURCE_STATE_TRANSITION_MODE SrcTextureTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE);
/// Mip level of the destination non-multi-sampled texture.
- Uint32 DstMipLevel = 0;
+ Uint32 DstMipLevel DEFAULT_INITIALIZER(0);
/// Array slice of the destination non-multi-sampled texture.
- Uint32 DstSlice = 0;
+ Uint32 DstSlice DEFAULT_INITIALIZER(0);
/// Destination texture state transition mode, see Diligent::RESOURCE_STATE_TRANSITION_MODE.
- RESOURCE_STATE_TRANSITION_MODE DstTextureTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
+ enum RESOURCE_STATE_TRANSITION_MODE DstTextureTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE);
/// If one or both textures are typeless, specifies the type of the typeless texture.
/// If both texture formats are not typeless, in which case they must be identical, this member must be
/// either TEX_FORMAT_UNKNOWN, or match this format.
- TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
+ enum TEXTURE_FORMAT Format DEFAULT_INITIALIZER(TEX_FORMAT_UNKNOWN);
};
/// Defines allowed flags for IDeviceContext::SetVertexBuffers() function.
-enum SET_VERTEX_BUFFERS_FLAGS : Uint8
+DILIGENT_TYPED_ENUM(SET_VERTEX_BUFFERS_FLAGS, Uint8)
{
/// No extra operations.
SET_VERTEX_BUFFERS_FLAG_NONE = 0x00,
@@ -459,26 +472,27 @@ DEFINE_FLAG_ENUM_OPERATORS(SET_VERTEX_BUFFERS_FLAGS)
struct Viewport
{
/// X coordinate of the left boundary of the viewport.
- Float32 TopLeftX = 0.f;
+ Float32 TopLeftX DEFAULT_INITIALIZER(0.f);
/// Y coordinate of the top boundary of the viewport.
/// When defining a viewport, DirectX convention is used:
/// window coordinate systems originates in the LEFT TOP corner
/// of the screen with Y axis pointing down.
- Float32 TopLeftY = 0.f;
+ Float32 TopLeftY DEFAULT_INITIALIZER(0.f);
/// Viewport width.
- Float32 Width = 0.f;
+ Float32 Width DEFAULT_INITIALIZER(0.f);
/// Viewport Height.
- Float32 Height = 0.f;
+ Float32 Height DEFAULT_INITIALIZER(0.f);
/// Minimum depth of the viewport. Ranges between 0 and 1.
- Float32 MinDepth = 0.f;
+ Float32 MinDepth DEFAULT_INITIALIZER(0.f);
/// Maximum depth of the viewport. Ranges between 0 and 1.
- Float32 MaxDepth = 1.f;
+ Float32 MaxDepth DEFAULT_INITIALIZER(1.f);
+#if DILIGENT_CPP_INTERFACE
/// Initializes the structure.
Viewport(Float32 _TopLeftX, Float32 _TopLeftY,
Float32 _Width, Float32 _Height,
@@ -492,6 +506,7 @@ struct Viewport
{}
Viewport()noexcept{}
+#endif
};
/// Describes the rectangle.
@@ -503,11 +518,12 @@ struct Viewport
/// of the screen with Y axis pointing down.
struct Rect
{
- Int32 left = 0; ///< X coordinate of the left boundary of the viewport.
- Int32 top = 0; ///< Y coordinate of the top boundary of the viewport.
- Int32 right = 0; ///< X coordinate of the right boundary of the viewport.
- Int32 bottom = 0; ///< Y coordinate of the bottom boundary of the viewport.
+ Int32 left DEFAULT_INITIALIZER(0); ///< X coordinate of the left boundary of the viewport.
+ Int32 top DEFAULT_INITIALIZER(0); ///< Y coordinate of the top boundary of the viewport.
+ Int32 right DEFAULT_INITIALIZER(0); ///< X coordinate of the right boundary of the viewport.
+ Int32 bottom DEFAULT_INITIALIZER(0); ///< Y coordinate of the bottom boundary of the viewport.
+#if DILIGENT_CPP_INTERFACE
/// Initializes the structure
Rect(Int32 _left, Int32 _top, Int32 _right, Int32 _bottom)noexcept :
left {_left },
@@ -522,6 +538,7 @@ struct Rect
{
return right > left && bottom > top;
}
+#endif
};
@@ -531,41 +548,43 @@ struct Rect
struct CopyTextureAttribs
{
/// Source texture to copy data from.
- ITexture* pSrcTexture = nullptr;
+ class ITexture* pSrcTexture DEFAULT_INITIALIZER(nullptr);
/// Mip level of the source texture to copy data from.
- Uint32 SrcMipLevel = 0;
+ Uint32 SrcMipLevel DEFAULT_INITIALIZER(0);
/// Array slice of the source texture to copy data from. Must be 0 for non-array textures.
- Uint32 SrcSlice = 0;
+ Uint32 SrcSlice DEFAULT_INITIALIZER(0);
/// Source region to copy. Use nullptr to copy the entire subresource.
- const Box* pSrcBox = nullptr;
+ const struct Box* pSrcBox DEFAULT_INITIALIZER(nullptr);
/// Source texture state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE).
- RESOURCE_STATE_TRANSITION_MODE SrcTextureTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
+ enum RESOURCE_STATE_TRANSITION_MODE SrcTextureTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE);
/// Destination texture.
- ITexture* pDstTexture = nullptr;
+ class ITexture* pDstTexture DEFAULT_INITIALIZER(nullptr);
/// Destination mip level.
- Uint32 DstMipLevel = 0;
+ Uint32 DstMipLevel DEFAULT_INITIALIZER(0);
/// Destination array slice. Must be 0 for non-array textures.
- Uint32 DstSlice = 0;
+ Uint32 DstSlice DEFAULT_INITIALIZER(0);
/// X offset on the destination subresource.
- Uint32 DstX = 0;
+ Uint32 DstX DEFAULT_INITIALIZER(0);
/// Y offset on the destination subresource.
- Uint32 DstY = 0;
+ Uint32 DstY DEFAULT_INITIALIZER(0);
/// Z offset on the destination subresource
- Uint32 DstZ = 0;
+ Uint32 DstZ DEFAULT_INITIALIZER(0);
/// Destination texture state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE).
- RESOURCE_STATE_TRANSITION_MODE DstTextureTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
+ enum RESOURCE_STATE_TRANSITION_MODE DstTextureTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE);
+
+#if DILIGENT_CPP_INTERFACE
CopyTextureAttribs()noexcept{}
CopyTextureAttribs(ITexture* _pSrcTexture,
@@ -577,8 +596,13 @@ struct CopyTextureAttribs
pDstTexture {_pDstTexture },
DstTextureTransitionMode{_DstTextureTransitionMode}
{}
+#endif
};
+
+
+#if DILIGENT_CPP_INTERFACE
+
/// Device context interface.
/// \remarks Device context keeps strong references to all objects currently bound to
@@ -1225,4 +1249,10 @@ public:
const ResolveTextureSubresourceAttribs& ResolveAttribs) = 0;
};
-}
+#else
+
+
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/DeviceObject.h b/Graphics/GraphicsEngine/interface/DeviceObject.h
index f2342a8b..a62f7490 100644
--- a/Graphics/GraphicsEngine/interface/DeviceObject.h
+++ b/Graphics/GraphicsEngine/interface/DeviceObject.h
@@ -33,13 +33,15 @@
#include "../../../Primitives/interface/Object.h"
#include "GraphicsTypes.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
// {5B4CCA0B-5075-4230-9759-F48769EE5502}
-static constexpr INTERFACE_ID IID_DeviceObject =
+static const struct INTERFACE_ID IID_DeviceObject =
{0x5b4cca0b, 0x5075, 0x4230, {0x97, 0x59, 0xf4, 0x87, 0x69, 0xee, 0x55, 0x2}};
+#if DILIGENT_CPP_INTERFACE
+
/// Base interface for all objects created by the render device Diligent::IRenderDevice
class IDeviceObject : public IObject
{
@@ -71,4 +73,8 @@ public:
virtual Int32 GetUniqueID() const = 0;
};
-} // namespace Diligent
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/EngineFactory.h b/Graphics/GraphicsEngine/interface/EngineFactory.h
index 108d7fe0..3ea4efcc 100644
--- a/Graphics/GraphicsEngine/interface/EngineFactory.h
+++ b/Graphics/GraphicsEngine/interface/EngineFactory.h
@@ -33,15 +33,15 @@
#include "../../../Primitives/interface/Object.h"
#include "APIInfo.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
class IShaderSourceInputStreamFactory;
// {D932B052-4ED6-4729-A532-F31DEEC100F3}
-static constexpr INTERFACE_ID IID_EngineFactory =
+static const struct INTERFACE_ID IID_EngineFactory =
{0xd932b052, 0x4ed6, 0x4729, {0xa5, 0x32, 0xf3, 0x1d, 0xee, 0xc1, 0x0, 0xf3}};
+#if DILIGENT_CPP_INTERFACE
/// Engine factory base interface
class IEngineFactory : public IObject
@@ -56,13 +56,17 @@ public:
virtual void CreateDefaultShaderSourceStreamFactory(const Char* SearchDirectories,
IShaderSourceInputStreamFactory** ppShaderSourceFactory) const = 0;
-#if PLATFORM_ANDROID
+# if PLATFORM_ANDROID
/// On Android platform, it is necessary to initialize the file system before
/// CreateDefaultShaderSourceStreamFactory() method can be called.
/// \param [in] Activity - Pointer to the activity.
/// \param [in] ActivityClassName - Activity class name.
virtual void InitAndroidFileSystem(void* Activity, const char* ActivityClassName) const = 0;
-#endif
+# endif
};
-} // namespace Diligent
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/Fence.h b/Graphics/GraphicsEngine/interface/Fence.h
index 97264913..4d2060e1 100644
--- a/Graphics/GraphicsEngine/interface/Fence.h
+++ b/Graphics/GraphicsEngine/interface/Fence.h
@@ -32,17 +32,20 @@
#include "DeviceObject.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {3B19184D-32AB-4701-84F4-9A0C03AE1672}
-static constexpr INTERFACE_ID IID_Fence =
+static const struct INTERFACE_ID IID_Fence =
{0x3b19184d, 0x32ab, 0x4701, {0x84, 0xf4, 0x9a, 0xc, 0x3, 0xae, 0x16, 0x72}};
+// clang-format off
/// Fence description
-struct FenceDesc : DeviceObjectAttribs
-{
+struct FenceDesc DILIGENT_DERIVE(DeviceObjectAttribs)
};
+// clang-format on
+
+
+#if DILIGENT_CPP_INTERFACE
/// Fence interface
@@ -70,4 +73,8 @@ public:
virtual void Reset(Uint64 Value) = 0;
};
-} // namespace Diligent
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
index 988824b0..d4e3e858 100644
--- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h
+++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
@@ -38,1914 +38,1953 @@
#include "APIInfo.h"
/// Graphics engine namespace
-namespace Diligent
-{
- class ITexture;
- class IBuffer;
-
- /// Value type
-
- /// This enumeration describes value type. It is used by
- /// - BufferDesc structure to describe value type of a formatted buffer
- /// - DrawAttribs structure to describe index type for an indexed draw call
- enum VALUE_TYPE : Uint8
- {
- VT_UNDEFINED = 0, ///< Undefined type
- VT_INT8, ///< Signed 8-bit integer
- VT_INT16, ///< Signed 16-bit integer
- VT_INT32, ///< Signed 32-bit integer
- VT_UINT8, ///< Unsigned 8-bit integer
- VT_UINT16, ///< Unsigned 16-bit integer
- VT_UINT32, ///< Unsigned 32-bit integer
- VT_FLOAT16, ///< Half-precision 16-bit floating point
- VT_FLOAT32, ///< Full-precision 32-bit floating point
- VT_NUM_TYPES ///< Helper value storing total number of types in the enumeration
- };
-
- /// Resource binding flags
-
- /// [D3D11_BIND_FLAG]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476085(v=vs.85).aspx
- ///
- /// This enumeration describes which parts of the pipeline a resource can be bound to.
- /// It generally mirrors [D3D11_BIND_FLAG][] enumeration. It is used by
- /// - BufferDesc to describe bind flags for a buffer
- /// - TextureDesc to describe bind flags for a texture
- enum BIND_FLAGS : Uint32
- {
- BIND_NONE = 0x0L, ///< Undefined binding
- BIND_VERTEX_BUFFER = 0x1L, ///< A buffer can be bound as a vertex buffer
- BIND_INDEX_BUFFER = 0x2L, ///< A buffer can be bound as an index buffer
- BIND_UNIFORM_BUFFER = 0x4L, ///< A buffer can be bound as a uniform buffer
- /// \warning This flag may not be combined with any other bind flag
- BIND_SHADER_RESOURCE = 0x8L, ///< A buffer or a texture can be bound as a shader resource
- /// \warning This flag cannot be used with MAP_WRITE_NO_OVERWRITE flag
- BIND_STREAM_OUTPUT = 0x10L,///< A buffer can be bound as a target for stream output stage
- BIND_RENDER_TARGET = 0x20L,///< A texture can be bound as a render target
- BIND_DEPTH_STENCIL = 0x40L,///< A texture can be bound as a depth-stencil target
- BIND_UNORDERED_ACCESS = 0x80L,///< A buffer or a texture can be bound as an unordered access view
- BIND_INDIRECT_DRAW_ARGS = 0x100L///< A buffer can be bound as the source buffer for indirect draw commands
- };
- DEFINE_FLAG_ENUM_OPERATORS(BIND_FLAGS)
-
- /// Resource usage
-
- /// [D3D11_USAGE]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476259(v=vs.85).aspx
- /// This enumeration describes expected resource usage. It generally mirrors [D3D11_USAGE] enumeration.
- /// The enumeration is used by
- /// - BufferDesc to describe usage for a buffer
- /// - TextureDesc to describe usage for a texture
- enum USAGE : Uint8
- {
- /// A resource that can only be read by the GPU. It cannot be written by the GPU,
- /// and cannot be accessed at all by the CPU. This type of resource must be initialized
- /// when it is created, since it cannot be changed after creation. \n
- /// D3D11 Counterpart: D3D11_USAGE_IMMUTABLE. OpenGL counterpart: GL_STATIC_DRAW
- USAGE_STATIC = 0,
-
- /// A resource that requires read and write access by the GPU and can also be occasionally
- /// written by the CPU. \n
- /// D3D11 Counterpart: D3D11_USAGE_DEFAULT. OpenGL counterpart: GL_DYNAMIC_DRAW
- USAGE_DEFAULT,
-
- /// A resource that can be read by the GPU and written at least once per frame by the CPU. \n
- /// D3D11 Counterpart: D3D11_USAGE_DYNAMIC. OpenGL counterpart: GL_STREAM_DRAW
- USAGE_DYNAMIC,
-
- /// A resource that facilitates transferring data from GPU to CPU. \n
- /// D3D11 Counterpart: D3D11_USAGE_STAGING. OpenGL counterpart: GL_DYNAMIC_READ
- USAGE_STAGING
- };
-
- /// Allowed CPU access mode flags when mapping a resource
-
- /// The enumeration is used by
- /// - BufferDesc to describe CPU access mode for a buffer
- /// - TextureDesc to describe CPU access mode for a texture
- /// \note Only USAGE_DYNAMIC resources can be mapped
- enum CPU_ACCESS_FLAGS : Uint8
- {
- CPU_ACCESS_NONE = 0x00, ///< No CPU access
- CPU_ACCESS_READ = 0x01, ///< A resource can be mapped for reading
- CPU_ACCESS_WRITE = 0x02 ///< A resource can be mapped for writing
- };
- DEFINE_FLAG_ENUM_OPERATORS(CPU_ACCESS_FLAGS)
-
- /// Resource mapping type
-
- /// [D3D11_MAP]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476181(v=vs.85).aspx
- /// Describes how a mapped resource will be accessed. This enumeration generally
- /// mirrors [D3D11_MAP][] enumeration. It is used by
- /// - IBuffer::Map to describe buffer mapping type
- /// - ITexture::Map to describe texture mapping type
- enum MAP_TYPE : Uint8
- {
- /// The resource is mapped for reading. \n
- /// D3D11 counterpart: D3D11_MAP_READ. OpenGL counterpart: GL_MAP_READ_BIT
- MAP_READ = 0x01,
-
- /// The resource is mapped for writing. \n
- /// D3D11 counterpart: D3D11_MAP_WRITE. OpenGL counterpart: GL_MAP_WRITE_BIT
- MAP_WRITE = 0x02,
-
- /// The resource is mapped for reading and writing. \n
- /// D3D11 counterpart: D3D11_MAP_READ_WRITE. OpenGL counterpart: GL_MAP_WRITE_BIT | GL_MAP_READ_BIT
- MAP_READ_WRITE = 0x03
- };
-
- /// Special map flags
-
- /// Describes special arguments for a map operation.
- /// This enumeration is used by
- /// - IBuffer::Map to describe buffer mapping flags
- /// - ITexture::Map to describe texture mapping flags
- enum MAP_FLAGS : Uint8
- {
- MAP_FLAG_NONE = 0x000,
-
- /// Specifies that map operation should not wait until previous command that
- /// using the same resource completes. Map returns null pointer if the resource
- /// is still in use.\n
- /// D3D11 counterpart: D3D11_MAP_FLAG_DO_NOT_WAIT
- /// \note: OpenGL does not have corresponding flag, so a buffer will always be mapped
- MAP_FLAG_DO_NOT_WAIT = 0x001,
-
- /// Previous contents of the resource will be undefined. This flag is only compatible with MAP_WRITE\n
- /// D3D11 counterpart: D3D11_MAP_WRITE_DISCARD. OpenGL counterpart: GL_MAP_INVALIDATE_BUFFER_BIT
- /// \note OpenGL implementation may orphan a buffer instead
- MAP_FLAG_DISCARD = 0x002,
-
- /// The system will not synchronize pending operations before mapping the buffer. It is responsibility
- /// of the application to make sure that the buffer contents is not overwritten while it is in use by
- /// the GPU.\n
- /// D3D11 counterpart: D3D11_MAP_WRITE_NO_OVERWRITE. OpenGL counterpart: GL_MAP_UNSYNCHRONIZED_BIT
- MAP_FLAG_NO_OVERWRITE = 0x004
- };
- DEFINE_FLAG_ENUM_OPERATORS(MAP_FLAGS)
-
- /// Describes resource dimension
-
- /// This enumeration is used by
- /// - TextureDesc to describe texture type
- /// - TextureViewDesc to describe texture view type
- enum RESOURCE_DIMENSION : Uint8
- {
- RESOURCE_DIM_UNDEFINED = 0, ///< Texture type undefined
- RESOURCE_DIM_BUFFER, ///< Buffer
- RESOURCE_DIM_TEX_1D, ///< One-dimensional texture
- RESOURCE_DIM_TEX_1D_ARRAY, ///< One-dimensional texture array
- RESOURCE_DIM_TEX_2D, ///< Two-dimensional texture
- RESOURCE_DIM_TEX_2D_ARRAY, ///< Two-dimensional texture array
- RESOURCE_DIM_TEX_3D, ///< Three-dimensional texture
- RESOURCE_DIM_TEX_CUBE, ///< Cube-map texture
- RESOURCE_DIM_TEX_CUBE_ARRAY, ///< Cube-map array texture
- RESOURCE_DIM_NUM_DIMENSIONS ///< Helper value that stores the total number of texture types in the enumeration
- };
-
- /// Texture view type
-
- /// This enumeration describes allowed view types for a texture view. It is used by TextureViewDesc
- /// structure.
- enum TEXTURE_VIEW_TYPE : Uint8
- {
- /// Undefined view type
- TEXTURE_VIEW_UNDEFINED = 0,
-
- /// A texture view will define a shader resource view that will be used
- /// as the source for the shader read operations
- TEXTURE_VIEW_SHADER_RESOURCE,
+DILIGENT_BEGIN_NAMESPACE(Diligent)
- /// A texture view will define a render target view that will be used
- /// as the target for rendering operations
- TEXTURE_VIEW_RENDER_TARGET,
+class ITexture;
+class IBuffer;
- /// A texture view will define a depth stencil view that will be used
- /// as the target for rendering operations
- TEXTURE_VIEW_DEPTH_STENCIL,
+/// Value type
- /// A texture view will define an unordered access view that will be used
- /// for unordered read/write operations from the shaders
- TEXTURE_VIEW_UNORDERED_ACCESS,
-
- /// Helper value that stores that total number of texture views
- TEXTURE_VIEW_NUM_VIEWS
- };
+/// This enumeration describes value type. It is used by
+/// - BufferDesc structure to describe value type of a formatted buffer
+/// - DrawAttribs structure to describe index type for an indexed draw call
+DILIGENT_TYPED_ENUM(VALUE_TYPE, Uint8)
+{
+ VT_UNDEFINED = 0, ///< Undefined type
+ VT_INT8, ///< Signed 8-bit integer
+ VT_INT16, ///< Signed 16-bit integer
+ VT_INT32, ///< Signed 32-bit integer
+ VT_UINT8, ///< Unsigned 8-bit integer
+ VT_UINT16, ///< Unsigned 16-bit integer
+ VT_UINT32, ///< Unsigned 32-bit integer
+ VT_FLOAT16, ///< Half-precision 16-bit floating point
+ VT_FLOAT32, ///< Full-precision 32-bit floating point
+ VT_NUM_TYPES ///< Helper value storing total number of types in the enumeration
+};
+
+/// Resource binding flags
+
+/// [D3D11_BIND_FLAG]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476085(v=vs.85).aspx
+///
+/// This enumeration describes which parts of the pipeline a resource can be bound to.
+/// It generally mirrors [D3D11_BIND_FLAG][] enumeration. It is used by
+/// - BufferDesc to describe bind flags for a buffer
+/// - TextureDesc to describe bind flags for a texture
+DILIGENT_TYPED_ENUM(BIND_FLAGS, Uint32)
+{
+ BIND_NONE = 0x0L, ///< Undefined binding
+ BIND_VERTEX_BUFFER = 0x1L, ///< A buffer can be bound as a vertex buffer
+ BIND_INDEX_BUFFER = 0x2L, ///< A buffer can be bound as an index buffer
+ BIND_UNIFORM_BUFFER = 0x4L, ///< A buffer can be bound as a uniform buffer
+ /// \warning This flag may not be combined with any other bind flag
+ BIND_SHADER_RESOURCE = 0x8L, ///< A buffer or a texture can be bound as a shader resource
+ /// \warning This flag cannot be used with MAP_WRITE_NO_OVERWRITE flag
+ BIND_STREAM_OUTPUT = 0x10L,///< A buffer can be bound as a target for stream output stage
+ BIND_RENDER_TARGET = 0x20L,///< A texture can be bound as a render target
+ BIND_DEPTH_STENCIL = 0x40L,///< A texture can be bound as a depth-stencil target
+ BIND_UNORDERED_ACCESS = 0x80L,///< A buffer or a texture can be bound as an unordered access view
+ BIND_INDIRECT_DRAW_ARGS = 0x100L///< A buffer can be bound as the source buffer for indirect draw commands
+};
+DEFINE_FLAG_ENUM_OPERATORS(BIND_FLAGS)
+
+/// Resource usage
+
+/// [D3D11_USAGE]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476259(v=vs.85).aspx
+/// This enumeration describes expected resource usage. It generally mirrors [D3D11_USAGE] enumeration.
+/// The enumeration is used by
+/// - BufferDesc to describe usage for a buffer
+/// - TextureDesc to describe usage for a texture
+DILIGENT_TYPED_ENUM(USAGE, Uint8)
+{
+ /// A resource that can only be read by the GPU. It cannot be written by the GPU,
+ /// and cannot be accessed at all by the CPU. This type of resource must be initialized
+ /// when it is created, since it cannot be changed after creation. \n
+ /// D3D11 Counterpart: D3D11_USAGE_IMMUTABLE. OpenGL counterpart: GL_STATIC_DRAW
+ USAGE_STATIC = 0,
+
+ /// A resource that requires read and write access by the GPU and can also be occasionally
+ /// written by the CPU. \n
+ /// D3D11 Counterpart: D3D11_USAGE_DEFAULT. OpenGL counterpart: GL_DYNAMIC_DRAW
+ USAGE_DEFAULT,
+
+ /// A resource that can be read by the GPU and written at least once per frame by the CPU. \n
+ /// D3D11 Counterpart: D3D11_USAGE_DYNAMIC. OpenGL counterpart: GL_STREAM_DRAW
+ USAGE_DYNAMIC,
+
+ /// A resource that facilitates transferring data from GPU to CPU. \n
+ /// D3D11 Counterpart: D3D11_USAGE_STAGING. OpenGL counterpart: GL_DYNAMIC_READ
+ USAGE_STAGING
+};
+
+/// Allowed CPU access mode flags when mapping a resource
+
+/// The enumeration is used by
+/// - BufferDesc to describe CPU access mode for a buffer
+/// - TextureDesc to describe CPU access mode for a texture
+/// \note Only USAGE_DYNAMIC resources can be mapped
+DILIGENT_TYPED_ENUM(CPU_ACCESS_FLAGS, Uint8)
+{
+ CPU_ACCESS_NONE = 0x00, ///< No CPU access
+ CPU_ACCESS_READ = 0x01, ///< A resource can be mapped for reading
+ CPU_ACCESS_WRITE = 0x02 ///< A resource can be mapped for writing
+};
+DEFINE_FLAG_ENUM_OPERATORS(CPU_ACCESS_FLAGS)
+
+/// Resource mapping type
+
+/// [D3D11_MAP]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476181(v=vs.85).aspx
+/// Describes how a mapped resource will be accessed. This enumeration generally
+/// mirrors [D3D11_MAP][] enumeration. It is used by
+/// - IBuffer::Map to describe buffer mapping type
+/// - ITexture::Map to describe texture mapping type
+DILIGENT_TYPED_ENUM(MAP_TYPE, Uint8)
+{
+ /// The resource is mapped for reading. \n
+ /// D3D11 counterpart: D3D11_MAP_READ. OpenGL counterpart: GL_MAP_READ_BIT
+ MAP_READ = 0x01,
+
+ /// The resource is mapped for writing. \n
+ /// D3D11 counterpart: D3D11_MAP_WRITE. OpenGL counterpart: GL_MAP_WRITE_BIT
+ MAP_WRITE = 0x02,
+
+ /// The resource is mapped for reading and writing. \n
+ /// D3D11 counterpart: D3D11_MAP_READ_WRITE. OpenGL counterpart: GL_MAP_WRITE_BIT | GL_MAP_READ_BIT
+ MAP_READ_WRITE = 0x03
+};
+
+/// Special map flags
+
+/// Describes special arguments for a map operation.
+/// This enumeration is used by
+/// - IBuffer::Map to describe buffer mapping flags
+/// - ITexture::Map to describe texture mapping flags
+DILIGENT_TYPED_ENUM(MAP_FLAGS, Uint8)
+{
+ MAP_FLAG_NONE = 0x000,
+
+ /// Specifies that map operation should not wait until previous command that
+ /// using the same resource completes. Map returns null pointer if the resource
+ /// is still in use.\n
+ /// D3D11 counterpart: D3D11_MAP_FLAG_DO_NOT_WAIT
+ /// \note: OpenGL does not have corresponding flag, so a buffer will always be mapped
+ MAP_FLAG_DO_NOT_WAIT = 0x001,
+
+ /// Previous contents of the resource will be undefined. This flag is only compatible with MAP_WRITE\n
+ /// D3D11 counterpart: D3D11_MAP_WRITE_DISCARD. OpenGL counterpart: GL_MAP_INVALIDATE_BUFFER_BIT
+ /// \note OpenGL implementation may orphan a buffer instead
+ MAP_FLAG_DISCARD = 0x002,
+
+ /// The system will not synchronize pending operations before mapping the buffer. It is responsibility
+ /// of the application to make sure that the buffer contents is not overwritten while it is in use by
+ /// the GPU.\n
+ /// D3D11 counterpart: D3D11_MAP_WRITE_NO_OVERWRITE. OpenGL counterpart: GL_MAP_UNSYNCHRONIZED_BIT
+ MAP_FLAG_NO_OVERWRITE = 0x004
+};
+DEFINE_FLAG_ENUM_OPERATORS(MAP_FLAGS)
+
+/// Describes resource dimension
+
+/// This enumeration is used by
+/// - TextureDesc to describe texture type
+/// - TextureViewDesc to describe texture view type
+DILIGENT_TYPED_ENUM(RESOURCE_DIMENSION, Uint8)
+{
+ RESOURCE_DIM_UNDEFINED = 0, ///< Texture type undefined
+ RESOURCE_DIM_BUFFER, ///< Buffer
+ RESOURCE_DIM_TEX_1D, ///< One-dimensional texture
+ RESOURCE_DIM_TEX_1D_ARRAY, ///< One-dimensional texture array
+ RESOURCE_DIM_TEX_2D, ///< Two-dimensional texture
+ RESOURCE_DIM_TEX_2D_ARRAY, ///< Two-dimensional texture array
+ RESOURCE_DIM_TEX_3D, ///< Three-dimensional texture
+ RESOURCE_DIM_TEX_CUBE, ///< Cube-map texture
+ RESOURCE_DIM_TEX_CUBE_ARRAY, ///< Cube-map array texture
+ RESOURCE_DIM_NUM_DIMENSIONS ///< Helper value that stores the total number of texture types in the enumeration
+};
+
+/// Texture view type
+
+/// This enumeration describes allowed view types for a texture view. It is used by TextureViewDesc
+/// structure.
+DILIGENT_TYPED_ENUM(TEXTURE_VIEW_TYPE, Uint8)
+{
+ /// Undefined view type
+ TEXTURE_VIEW_UNDEFINED = 0,
- /// Buffer view type
+ /// A texture view will define a shader resource view that will be used
+ /// as the source for the shader read operations
+ TEXTURE_VIEW_SHADER_RESOURCE,
- /// This enumeration describes allowed view types for a buffer view. It is used by BufferViewDesc
- /// structure.
- enum BUFFER_VIEW_TYPE : Uint8
- {
- /// Undefined view type
- BUFFER_VIEW_UNDEFINED = 0,
+ /// A texture view will define a render target view that will be used
+ /// as the target for rendering operations
+ TEXTURE_VIEW_RENDER_TARGET,
- /// A buffer view will define a shader resource view that will be used
- /// as the source for the shader read operations
- BUFFER_VIEW_SHADER_RESOURCE,
+ /// A texture view will define a depth stencil view that will be used
+ /// as the target for rendering operations
+ TEXTURE_VIEW_DEPTH_STENCIL,
- /// A buffer view will define an unordered access view that will be used
- /// for unordered read/write operations from the shaders
- BUFFER_VIEW_UNORDERED_ACCESS,
+ /// A texture view will define an unordered access view that will be used
+ /// for unordered read/write operations from the shaders
+ TEXTURE_VIEW_UNORDERED_ACCESS,
- /// Helper value that stores that total number of buffer views
- BUFFER_VIEW_NUM_VIEWS
- };
+ /// Helper value that stores that total number of texture views
+ TEXTURE_VIEW_NUM_VIEWS
+};
- /// Texture formats
+/// Buffer view type
- /// This enumeration describes available texture formats and generally mirrors DXGI_FORMAT enumeration.
- /// The table below provides detailed information on each format. Most of the formats are widely supported
- /// by all modern APIs (DX10+, OpenGL3.3+ and OpenGLES3.0+). Specific requirements are additionally indicated.
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb173059(v=vs.85).aspx">DXGI_FORMAT enumeration on MSDN</a>,
- /// <a href = "https://www.opengl.org/wiki/Image_Format">OpenGL Texture Formats</a>
- ///
- enum TEXTURE_FORMAT : Uint16
- {
- /// Unknown format
- TEX_FORMAT_UNKNOWN = 0,
+/// This enumeration describes allowed view types for a buffer view. It is used by BufferViewDesc
+/// structure.
+DILIGENT_TYPED_ENUM(BUFFER_VIEW_TYPE, Uint8)
+{
+ /// Undefined view type
+ BUFFER_VIEW_UNDEFINED = 0,
+
+ /// A buffer view will define a shader resource view that will be used
+ /// as the source for the shader read operations
+ BUFFER_VIEW_SHADER_RESOURCE,
+
+ /// A buffer view will define an unordered access view that will be used
+ /// for unordered read/write operations from the shaders
+ BUFFER_VIEW_UNORDERED_ACCESS,
+
+ /// Helper value that stores that total number of buffer views
+ BUFFER_VIEW_NUM_VIEWS
+};
+
+/// Texture formats
+
+/// This enumeration describes available texture formats and generally mirrors DXGI_FORMAT enumeration.
+/// The table below provides detailed information on each format. Most of the formats are widely supported
+/// by all modern APIs (DX10+, OpenGL3.3+ and OpenGLES3.0+). Specific requirements are additionally indicated.
+/// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb173059(v=vs.85).aspx">DXGI_FORMAT enumeration on MSDN</a>,
+/// <a href = "https://www.opengl.org/wiki/Image_Format">OpenGL Texture Formats</a>
+///
+DILIGENT_TYPED_ENUM(TEXTURE_FORMAT, Uint16)
+{
+ /// Unknown format
+ TEX_FORMAT_UNKNOWN = 0,
- /// Four-component 128-bit typeless format with 32-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_TYPELESS. OpenGL does not have direct counterpart, GL_RGBA32F is used.
- TEX_FORMAT_RGBA32_TYPELESS,
+ /// Four-component 128-bit typeless format with 32-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_TYPELESS. OpenGL does not have direct counterpart, GL_RGBA32F is used.
+ TEX_FORMAT_RGBA32_TYPELESS,
- /// Four-component 128-bit floating-point format with 32-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_FLOAT. OpenGL counterpart: GL_RGBA32F.
- TEX_FORMAT_RGBA32_FLOAT,
+ /// Four-component 128-bit floating-point format with 32-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_FLOAT. OpenGL counterpart: GL_RGBA32F.
+ TEX_FORMAT_RGBA32_FLOAT,
- /// Four-component 128-bit unsigned-integer format with 32-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_UINT. OpenGL counterpart: GL_RGBA32UI.
- TEX_FORMAT_RGBA32_UINT,
+ /// Four-component 128-bit unsigned-integer format with 32-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_UINT. OpenGL counterpart: GL_RGBA32UI.
+ TEX_FORMAT_RGBA32_UINT,
- /// Four-component 128-bit signed-integer format with 32-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_SINT. OpenGL counterpart: GL_RGBA32I.
- TEX_FORMAT_RGBA32_SINT,
+ /// Four-component 128-bit signed-integer format with 32-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R32G32B32A32_SINT. OpenGL counterpart: GL_RGBA32I.
+ TEX_FORMAT_RGBA32_SINT,
- /// Three-component 96-bit typeless format with 32-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R32G32B32_TYPELESS. OpenGL does not have direct counterpart, GL_RGB32F is used.
- /// \warning This format has weak hardware support and is not recommended
- TEX_FORMAT_RGB32_TYPELESS,
+ /// Three-component 96-bit typeless format with 32-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R32G32B32_TYPELESS. OpenGL does not have direct counterpart, GL_RGB32F is used.
+ /// \warning This format has weak hardware support and is not recommended
+ TEX_FORMAT_RGB32_TYPELESS,
- /// Three-component 96-bit floating-point format with 32-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R32G32B32_FLOAT. OpenGL counterpart: GL_RGB32F.
- /// \warning This format has weak hardware support and is not recommended
- TEX_FORMAT_RGB32_FLOAT,
-
- /// Three-component 96-bit unsigned-integer format with 32-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R32G32B32_UINT. OpenGL counterpart: GL_RGB32UI.
- /// \warning This format has weak hardware support and is not recommended
- TEX_FORMAT_RGB32_UINT,
-
- /// Three-component 96-bit signed-integer format with 32-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R32G32B32_SINT. OpenGL counterpart: GL_RGB32I.
- /// \warning This format has weak hardware support and is not recommended
- TEX_FORMAT_RGB32_SINT,
-
- /// Four-component 64-bit typeless format with 16-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_TYPELESS. OpenGL does not have direct counterpart, GL_RGBA16F is used.
- TEX_FORMAT_RGBA16_TYPELESS,
-
- /// Four-component 64-bit half-precision floating-point format with 16-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_FLOAT. OpenGL counterpart: GL_RGBA16F.
- TEX_FORMAT_RGBA16_FLOAT,
-
- /// Four-component 64-bit unsigned-normalized-integer format with 16-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_UNORM. OpenGL counterpart: GL_RGBA16. \n
- /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
- /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
- TEX_FORMAT_RGBA16_UNORM,
-
- /// Four-component 64-bit unsigned-integer format with 16-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_UINT. OpenGL counterpart: GL_RGBA16UI.
- TEX_FORMAT_RGBA16_UINT,
-
- /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
- /// Four-component 64-bit signed-normalized-integer format with 16-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_SNORM. OpenGL counterpart: GL_RGBA16_SNORM. \n
- /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
- /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
- TEX_FORMAT_RGBA16_SNORM,
-
- /// Four-component 64-bit signed-integer format with 16-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_SINT. OpenGL counterpart: GL_RGBA16I.
- TEX_FORMAT_RGBA16_SINT,
-
- /// Two-component 64-bit typeless format with 32-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R32G32_TYPELESS. OpenGL does not have direct counterpart, GL_RG32F is used.
- TEX_FORMAT_RG32_TYPELESS,
-
- /// Two-component 64-bit floating-point format with 32-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R32G32_FLOAT. OpenGL counterpart: GL_RG32F.
- TEX_FORMAT_RG32_FLOAT,
-
- /// Two-component 64-bit unsigned-integer format with 32-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R32G32_UINT. OpenGL counterpart: GL_RG32UI.
- TEX_FORMAT_RG32_UINT,
-
- /// Two-component 64-bit signed-integer format with 32-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R32G32_SINT. OpenGL counterpart: GL_RG32I.
- TEX_FORMAT_RG32_SINT,
-
- /// Two-component 64-bit typeless format with 32-bits for R channel and 8 bits for G channel. \n
- /// D3D counterpart: DXGI_FORMAT_R32G8X24_TYPELESS. OpenGL does not have direct counterpart, GL_DEPTH32F_STENCIL8 is used.
- TEX_FORMAT_R32G8X24_TYPELESS,
-
- /// Two-component 64-bit format with 32-bit floating-point depth channel and 8-bit stencil channel. \n
- /// D3D counterpart: DXGI_FORMAT_D32_FLOAT_S8X24_UINT. OpenGL counterpart: GL_DEPTH32F_STENCIL8.
- TEX_FORMAT_D32_FLOAT_S8X24_UINT,
-
- /// Two-component 64-bit format with 32-bit floating-point R channel and 8+24-bits of typeless data. \n
- /// D3D counterpart: DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS. OpenGL does not have direct counterpart, GL_DEPTH32F_STENCIL8 is used.
- TEX_FORMAT_R32_FLOAT_X8X24_TYPELESS,
-
- /// Two-component 64-bit format with 32-bit typeless data and 8-bit G channel. \n
- /// D3D counterpart: DXGI_FORMAT_X32_TYPELESS_G8X24_UINT
- /// \warning This format is currently not implemented in OpenGL version
- TEX_FORMAT_X32_TYPELESS_G8X24_UINT,
-
- /// Four-component 32-bit typeless format with 10 bits for RGB and 2 bits for alpha channel. \n
- /// D3D counterpart: DXGI_FORMAT_R10G10B10A2_TYPELESS. OpenGL does not have direct counterpart, GL_RGB10_A2 is used.
- TEX_FORMAT_RGB10A2_TYPELESS,
-
- /// Four-component 32-bit unsigned-normalized-integer format with 10 bits for each color and 2 bits for alpha channel. \n
- /// D3D counterpart: DXGI_FORMAT_R10G10B10A2_UNORM. OpenGL counterpart: GL_RGB10_A2.
- TEX_FORMAT_RGB10A2_UNORM,
-
- /// Four-component 32-bit unsigned-integer format with 10 bits for each color and 2 bits for alpha channel. \n
- /// D3D counterpart: DXGI_FORMAT_R10G10B10A2_UINT. OpenGL counterpart: GL_RGB10_A2UI.
- TEX_FORMAT_RGB10A2_UINT,
-
- /// Three-component 32-bit format encoding three partial precision channels using 11 bits for red and green and 10 bits for blue channel. \n
- /// D3D counterpart: DXGI_FORMAT_R11G11B10_FLOAT. OpenGL counterpart: GL_R11F_G11F_B10F.
- TEX_FORMAT_R11G11B10_FLOAT,
-
- /// Four-component 32-bit typeless format with 8-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_TYPELESS. OpenGL does not have direct counterpart, GL_RGBA8 is used.
- TEX_FORMAT_RGBA8_TYPELESS,
-
- /// Four-component 32-bit unsigned-normalized-integer format with 8-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_UNORM. OpenGL counterpart: GL_RGBA8.
- TEX_FORMAT_RGBA8_UNORM,
-
- /// Four-component 32-bit unsigned-normalized-integer sRGB format with 8-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_UNORM_SRGB. OpenGL counterpart: GL_SRGB8_ALPHA8.
- TEX_FORMAT_RGBA8_UNORM_SRGB,
-
- /// Four-component 32-bit unsigned-integer format with 8-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_UINT. OpenGL counterpart: GL_RGBA8UI.
- TEX_FORMAT_RGBA8_UINT,
-
- /// Four-component 32-bit signed-normalized-integer format with 8-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_SNORM. OpenGL counterpart: GL_RGBA8_SNORM.
- TEX_FORMAT_RGBA8_SNORM,
-
- /// Four-component 32-bit signed-integer format with 8-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_SINT. OpenGL counterpart: GL_RGBA8I.
- TEX_FORMAT_RGBA8_SINT,
-
- /// Two-component 32-bit typeless format with 16-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R16G16_TYPELESS. OpenGL does not have direct counterpart, GL_RG16F is used.
- TEX_FORMAT_RG16_TYPELESS,
-
- /// Two-component 32-bit half-precision floating-point format with 16-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R16G16_FLOAT. OpenGL counterpart: GL_RG16F.
- TEX_FORMAT_RG16_FLOAT,
-
- /// Two-component 32-bit unsigned-normalized-integer format with 16-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R16G16_UNORM. OpenGL counterpart: GL_RG16. \n
- /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
- /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
- TEX_FORMAT_RG16_UNORM,
-
- /// Two-component 32-bit unsigned-integer format with 16-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R16G16_UINT. OpenGL counterpart: GL_RG16UI.
- TEX_FORMAT_RG16_UINT,
-
- /// Two-component 32-bit signed-normalized-integer format with 16-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R16G16_SNORM. OpenGL counterpart: GL_RG16_SNORM. \n
- /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
- /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
- TEX_FORMAT_RG16_SNORM,
-
- /// Two-component 32-bit signed-integer format with 16-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R16G16_SINT. OpenGL counterpart: GL_RG16I.
- TEX_FORMAT_RG16_SINT,
-
- /// Single-component 32-bit typeless format. \n
- /// D3D counterpart: DXGI_FORMAT_R32_TYPELESS. OpenGL does not have direct counterpart, GL_R32F is used.
- TEX_FORMAT_R32_TYPELESS,
-
- /// Single-component 32-bit floating-point depth format. \n
- /// D3D counterpart: DXGI_FORMAT_D32_FLOAT. OpenGL counterpart: GL_DEPTH_COMPONENT32F.
- TEX_FORMAT_D32_FLOAT,
-
- /// Single-component 32-bit floating-point format. \n
- /// D3D counterpart: DXGI_FORMAT_R32_FLOAT. OpenGL counterpart: GL_R32F.
- TEX_FORMAT_R32_FLOAT,
-
- /// Single-component 32-bit unsigned-integer format. \n
- /// D3D counterpart: DXGI_FORMAT_R32_UINT. OpenGL counterpart: GL_R32UI.
- TEX_FORMAT_R32_UINT,
-
- /// Single-component 32-bit signed-integer format. \n
- /// D3D counterpart: DXGI_FORMAT_R32_SINT. OpenGL counterpart: GL_R32I.
- TEX_FORMAT_R32_SINT,
-
- /// Two-component 32-bit typeless format with 24 bits for R and 8 bits for G channel. \n
- /// D3D counterpart: DXGI_FORMAT_R24G8_TYPELESS. OpenGL does not have direct counterpart, GL_DEPTH24_STENCIL8 is used.
- TEX_FORMAT_R24G8_TYPELESS,
-
- /// Two-component 32-bit format with 24 bits for unsigned-normalized-integer depth and 8 bits for stencil. \n
- /// D3D counterpart: DXGI_FORMAT_D24_UNORM_S8_UINT. OpenGL counterpart: GL_DEPTH24_STENCIL8.
- TEX_FORMAT_D24_UNORM_S8_UINT,
-
- /// Two-component 32-bit format with 24 bits for unsigned-normalized-integer data and 8 bits of unreferenced data. \n
- /// D3D counterpart: DXGI_FORMAT_R24_UNORM_X8_TYPELESS. OpenGL does not have direct counterpart, GL_DEPTH24_STENCIL8 is used.
- TEX_FORMAT_R24_UNORM_X8_TYPELESS,
-
- /// Two-component 32-bit format with 24 bits of unreferenced data and 8 bits of unsigned-integer data. \n
- /// D3D counterpart: DXGI_FORMAT_X24_TYPELESS_G8_UINT
- /// \warning This format is currently not implemented in OpenGL version
- TEX_FORMAT_X24_TYPELESS_G8_UINT,
-
- /// Two-component 16-bit typeless format with 8-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R8G8_TYPELESS. OpenGL does not have direct counterpart, GL_RG8 is used.
- TEX_FORMAT_RG8_TYPELESS,
-
- /// Two-component 16-bit unsigned-normalized-integer format with 8-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R8G8_UNORM. OpenGL counterpart: GL_RG8.
- TEX_FORMAT_RG8_UNORM,
-
- /// Two-component 16-bit unsigned-integer format with 8-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R8G8_UINT. OpenGL counterpart: GL_RG8UI.
- TEX_FORMAT_RG8_UINT,
-
- /// Two-component 16-bit signed-normalized-integer format with 8-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R8G8_SNORM. OpenGL counterpart: GL_RG8_SNORM.
- TEX_FORMAT_RG8_SNORM,
-
- /// Two-component 16-bit signed-integer format with 8-bit channels. \n
- /// D3D counterpart: DXGI_FORMAT_R8G8_SINT. OpenGL counterpart: GL_RG8I.
- TEX_FORMAT_RG8_SINT,
-
- /// Single-component 16-bit typeless format. \n
- /// D3D counterpart: DXGI_FORMAT_R16_TYPELESS. OpenGL does not have direct counterpart, GL_R16F is used.
- TEX_FORMAT_R16_TYPELESS,
-
- /// Single-component 16-bit half-precisoin floating-point format. \n
- /// D3D counterpart: DXGI_FORMAT_R16_FLOAT. OpenGL counterpart: GL_R16F.
- TEX_FORMAT_R16_FLOAT,
-
- /// Single-component 16-bit unsigned-normalized-integer depth format. \n
- /// D3D counterpart: DXGI_FORMAT_D16_UNORM. OpenGL counterpart: GL_DEPTH_COMPONENT16.
- TEX_FORMAT_D16_UNORM,
-
- /// Single-component 16-bit unsigned-normalized-integer format. \n
- /// D3D counterpart: DXGI_FORMAT_R16_UNORM. OpenGL counterpart: GL_R16.
- /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
- /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
- TEX_FORMAT_R16_UNORM,
-
- /// Single-component 16-bit unsigned-integer format. \n
- /// D3D counterpart: DXGI_FORMAT_R16_UINT. OpenGL counterpart: GL_R16UI.
- TEX_FORMAT_R16_UINT,
-
- /// Single-component 16-bit signed-normalized-integer format. \n
- /// D3D counterpart: DXGI_FORMAT_R16_SNORM. OpenGL counterpart: GL_R16_SNORM. \n
- /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
- /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
- TEX_FORMAT_R16_SNORM,
-
- /// Single-component 16-bit signed-integer format. \n
- /// D3D counterpart: DXGI_FORMAT_R16_SINT. OpenGL counterpart: GL_R16I.
- TEX_FORMAT_R16_SINT,
-
- /// Single-component 8-bit typeless format. \n
- /// D3D counterpart: DXGI_FORMAT_R8_TYPELESS. OpenGL does not have direct counterpart, GL_R8 is used.
- TEX_FORMAT_R8_TYPELESS,
-
- /// Single-component 8-bit unsigned-normalized-integer format. \n
- /// D3D counterpart: DXGI_FORMAT_R8_UNORM. OpenGL counterpart: GL_R8.
- TEX_FORMAT_R8_UNORM,
-
- /// Single-component 8-bit unsigned-integer format. \n
- /// D3D counterpart: DXGI_FORMAT_R8_UINT. OpenGL counterpart: GL_R8UI.
- TEX_FORMAT_R8_UINT,
-
- /// Single-component 8-bit signed-normalized-integer format. \n
- /// D3D counterpart: DXGI_FORMAT_R8_SNORM. OpenGL counterpart: GL_R8_SNORM.
- TEX_FORMAT_R8_SNORM,
-
- /// Single-component 8-bit signed-integer format. \n
- /// D3D counterpart: DXGI_FORMAT_R8_SINT. OpenGL counterpart: GL_R8I.
- TEX_FORMAT_R8_SINT,
-
- /// Single-component 8-bit unsigned-normalized-integer format for alpha only. \n
- /// D3D counterpart: DXGI_FORMAT_A8_UNORM
- /// \warning This format is not availanle in OpenGL
- TEX_FORMAT_A8_UNORM,
-
- /// Single-component 1-bit format. \n
- /// D3D counterpart: DXGI_FORMAT_R1_UNORM
- /// \warning This format is not availanle in OpenGL
- TEX_FORMAT_R1_UNORM,
-
- /// Three partial-precision floating pointer numbers sharing single exponent encoded into a 32-bit value. \n
- /// D3D counterpart: DXGI_FORMAT_R9G9B9E5_SHAREDEXP. OpenGL counterpart: GL_RGB9_E5.
- TEX_FORMAT_RGB9E5_SHAREDEXP,
-
- /// Four-component unsigned-normalized integer format analogous to UYVY encoding. \n
- /// D3D counterpart: DXGI_FORMAT_R8G8_B8G8_UNORM
- /// \warning This format is not availanle in OpenGL
- TEX_FORMAT_RG8_B8G8_UNORM,
-
- /// Four-component unsigned-normalized integer format analogous to YUY2 encoding. \n
- /// D3D counterpart: DXGI_FORMAT_G8R8_G8B8_UNORM
- /// \warning This format is not availanle in OpenGL
- TEX_FORMAT_G8R8_G8B8_UNORM,
-
- /// Four-component typeless block-compression format with 1:8 compression ratio.\n
- /// D3D counterpart: DXGI_FORMAT_BC1_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGB_S3TC_DXT1_EXT is used. \n
- /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
- /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC1">BC1 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT1_Format">DXT1 on OpenGL.org </a>
- TEX_FORMAT_BC1_TYPELESS,
-
- /// 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.
- /// The pixel data is encoded using 8 bytes per 4x4 block (4 bits per pixel) providing 1:8 compression ratio against RGBA8 format. \n
- /// D3D counterpart: DXGI_FORMAT_BC1_UNORM. OpenGL counterpart: GL_COMPRESSED_RGB_S3TC_DXT1_EXT.\n
- /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
- /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC1">BC1 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT1_Format">DXT1 on OpenGL.org </a>
- TEX_FORMAT_BC1_UNORM,
-
- /// 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
- /// The pixel data is encoded using 8 bytes per 4x4 block (4 bits per pixel) providing 1:8 compression ratio against RGBA8 format. \n
- /// D3D counterpart: DXGI_FORMAT_BC1_UNORM_SRGB. OpenGL counterpart: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT.\n
- /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
- /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC1">BC1 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT1_Format">DXT1 on OpenGL.org </a>
- TEX_FORMAT_BC1_UNORM_SRGB,
-
- /// Four component typeless block-compression format with 1:4 compression ratio.\n
- /// D3D counterpart: DXGI_FORMAT_BC2_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT is used. \n
- /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
- /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC2">BC2 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT3_Format">DXT3 on OpenGL.org </a>
- TEX_FORMAT_BC2_TYPELESS,
-
- /// 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.
- /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:4 compression ratio against RGBA8 format. \n
- /// D3D counterpart: DXGI_FORMAT_BC2_UNORM. OpenGL counterpart: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT. \n
- /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
- /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC2">BC2 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT3_Format">DXT3 on OpenGL.org </a>
- TEX_FORMAT_BC2_UNORM,
-
- /// 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.
- /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:4 compression ratio against RGBA8 format. \n
- /// D3D counterpart: DXGI_FORMAT_BC2_UNORM_SRGB. OpenGL counterpart: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT. \n
- /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
- /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC2">BC2 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT3_Format">DXT3 on OpenGL.org </a>
- TEX_FORMAT_BC2_UNORM_SRGB,
-
- /// Four-component typeless block-compression format with 1:4 compression ratio.\n
- /// D3D counterpart: DXGI_FORMAT_BC3_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT is used. \n
- /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
- /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC3">BC3 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT5_Format">DXT5 on OpenGL.org </a>
- TEX_FORMAT_BC3_TYPELESS,
-
- /// 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.
- /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:4 compression ratio against RGBA8 format. \n
- /// D3D counterpart: DXGI_FORMAT_BC3_UNORM. OpenGL counterpart: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT. \n
- /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
- /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC3">BC3 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT5_Format">DXT5 on OpenGL.org </a>
- TEX_FORMAT_BC3_UNORM,
-
- /// 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.
- /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:4 compression ratio against RGBA8 format. \n
- /// D3D counterpart: DXGI_FORMAT_BC3_UNORM_SRGB. OpenGL counterpart: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT. \n
- /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
- /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC3">BC3 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT5_Format">DXT5 on OpenGL.org </a>
- TEX_FORMAT_BC3_UNORM_SRGB,
-
- /// One-component typeless block-compression format with 1:2 compression ratio. \n
- /// D3D counterpart: DXGI_FORMAT_BC4_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RED_RGTC1 is used. \n
- /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
- /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC4">BC4 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
- TEX_FORMAT_BC4_TYPELESS,
-
- /// One-component unsigned-normalized-integer block-compression format with 8 bits for R channel.
- /// The pixel data is encoded using 8 bytes per 4x4 block (4 bits per pixel) providing 1:2 compression ratio against R8 format. \n
- /// D3D counterpart: DXGI_FORMAT_BC4_UNORM. OpenGL counterpart: GL_COMPRESSED_RED_RGTC1. \n
- /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
- /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC4">BC4 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
- TEX_FORMAT_BC4_UNORM,
-
- /// One-component signed-normalized-integer block-compression format with 8 bits for R channel.
- /// The pixel data is encoded using 8 bytes per 4x4 block (4 bits per pixel) providing 1:2 compression ratio against R8 format. \n
- /// D3D counterpart: DXGI_FORMAT_BC4_SNORM. OpenGL counterpart: GL_COMPRESSED_SIGNED_RED_RGTC1. \n
- /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
- /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC4">BC4 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
- TEX_FORMAT_BC4_SNORM,
-
- /// Two-component typeless block-compression format with 1:2 compression ratio. \n
- /// D3D counterpart: DXGI_FORMAT_BC5_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RG_RGTC2 is used. \n
- /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
- /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC5">BC5 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
- TEX_FORMAT_BC5_TYPELESS,
-
- /// Two-component unsigned-normalized-integer block-compression format with 8 bits for R and 8 bits for G channel.
- /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:2 compression ratio against RG8 format. \n
- /// D3D counterpart: DXGI_FORMAT_BC5_UNORM. OpenGL counterpart: GL_COMPRESSED_RG_RGTC2. \n
- /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
- /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC5">BC5 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
- TEX_FORMAT_BC5_UNORM,
-
- /// Two-component signed-normalized-integer block-compression format with 8 bits for R and 8 bits for G channel.
- /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:2 compression ratio against RG8 format. \n
- /// D3D counterpart: DXGI_FORMAT_BC5_SNORM. OpenGL counterpart: GL_COMPRESSED_SIGNED_RG_RGTC2. \n
- /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
- /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC5">BC5 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
- TEX_FORMAT_BC5_SNORM,
-
- /// Three-component 16-bit unsigned-normalized-integer format with 5 bits for blue, 6 bits for green, and 5 bits for red channel. \n
- /// D3D counterpart: DXGI_FORMAT_B5G6R5_UNORM
- /// \warning This format is not available until D3D11.1 and Windows 8. It is also not available in OpenGL
- TEX_FORMAT_B5G6R5_UNORM,
-
- /// Four-component 16-bit unsigned-normalized-integer format with 5 bits for each color channel and 1-bit alpha. \n
- /// D3D counterpart: DXGI_FORMAT_B5G5R5A1_UNORM
- /// \warning This format is not available until D3D11.1 and Windows 8. It is also not available in OpenGL
- TEX_FORMAT_B5G5R5A1_UNORM,
-
- /// Four-component 32-bit unsigned-normalized-integer format with 8 bits for each channel. \n
- /// D3D counterpart: DXGI_FORMAT_B8G8R8A8_UNORM.
- /// \warning This format is not available in OpenGL
- TEX_FORMAT_BGRA8_UNORM,
-
- /// Four-component 32-bit unsigned-normalized-integer format with 8 bits for each color channel and 8 bits unused. \n
- /// D3D counterpart: DXGI_FORMAT_B8G8R8X8_UNORM.
- /// \warning This format is not available in OpenGL
- TEX_FORMAT_BGRX8_UNORM,
-
- /// Four-component 32-bit 2.8-biased fixed-point format with 10 bits for each color channel and 2-bit alpha. \n
- /// D3D counterpart: DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM.
- /// \warning This format is not available in OpenGL
- TEX_FORMAT_R10G10B10_XR_BIAS_A2_UNORM,
-
- /// Four-component 32-bit typeless format with 8 bits for each channel. \n
- /// D3D counterpart: DXGI_FORMAT_B8G8R8A8_TYPELESS.
- /// \warning This format is not available in OpenGL
- TEX_FORMAT_BGRA8_TYPELESS,
-
- /// Four-component 32-bit unsigned-normalized sRGB format with 8 bits for each channel. \n
- /// D3D counterpart: DXGI_FORMAT_B8G8R8A8_UNORM_SRGB.
- /// \warning This format is not available in OpenGL.
- TEX_FORMAT_BGRA8_UNORM_SRGB,
-
- /// Four-component 32-bit typeless format that with 8 bits for each color channel, and 8 bits are unused. \n
- /// D3D counterpart: DXGI_FORMAT_B8G8R8X8_TYPELESS.
- /// \warning This format is not available in OpenGL.
- TEX_FORMAT_BGRX8_TYPELESS,
-
- /// Four-component 32-bit unsigned-normalized sRGB format with 8 bits for each color channel, and 8 bits are unused. \n
- /// D3D counterpart: DXGI_FORMAT_B8G8R8X8_UNORM_SRGB.
- /// \warning This format is not available in OpenGL.
- TEX_FORMAT_BGRX8_UNORM_SRGB,
-
- /// Three-component typeless block-compression format. \n
- /// D3D counterpart: DXGI_FORMAT_BC6H_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT is used. \n
- /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
- /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308952(v=vs.85).aspx">BC6H on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
- TEX_FORMAT_BC6H_TYPELESS,
-
- /// Three-component unsigned half-precision floating-point format with 16 bits for each channel. \n
- /// D3D counterpart: DXGI_FORMAT_BC6H_UF16. OpenGL counterpart: GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT. \n
- /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
- /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308952(v=vs.85).aspx">BC6H on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
- TEX_FORMAT_BC6H_UF16,
-
- /// Three-channel signed half-precision floating-point format with 16 bits per each channel. \n
- /// D3D counterpart: DXGI_FORMAT_BC6H_SF16. OpenGL counterpart: GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT. \n
- /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
- /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308952(v=vs.85).aspx">BC6H on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
- TEX_FORMAT_BC6H_SF16,
-
- /// Three-component typeless block-compression format. \n
- /// D3D counterpart: DXGI_FORMAT_BC7_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGBA_BPTC_UNORM is used. \n
- /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
- /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308953(v=vs.85).aspx">BC7 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
- TEX_FORMAT_BC7_TYPELESS,
-
- /// Three-component block-compression unsigned-normalized-integer format with 4 to 7 bits per color channel and 0 to 8 bits of alpha. \n
- /// D3D counterpart: DXGI_FORMAT_BC7_UNORM. OpenGL counterpart: GL_COMPRESSED_RGBA_BPTC_UNORM. \n
- /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
- /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308953(v=vs.85).aspx">BC7 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
- TEX_FORMAT_BC7_UNORM,
-
- /// 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
- /// D3D counterpart: DXGI_FORMAT_BC7_UNORM_SRGB. OpenGL counterpart: GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM. \n
- /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
- /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308953(v=vs.85).aspx">BC7 on MSDN </a>,
- /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
- TEX_FORMAT_BC7_UNORM_SRGB,
-
- /// Helper member containing the total number of texture formats in the enumeration
- TEX_FORMAT_NUM_FORMATS
- };
-
- /// Filter type
-
- /// This enumeration defines filter type. It is used by SamplerDesc structure to define min, mag and mip filters.
- /// \note On D3D11, comparison filters only work with textures that have the following formats:
- /// R32_FLOAT_X8X24_TYPELESS, R32_FLOAT, R24_UNORM_X8_TYPELESS, R16_UNORM.
- enum FILTER_TYPE : Uint8
- {
- FILTER_TYPE_UNKNOWN = 0, ///< Unknown filter type
- FILTER_TYPE_POINT, ///< Point filtering
- FILTER_TYPE_LINEAR, ///< Linear filtering
- FILTER_TYPE_ANISOTROPIC, ///< Anisotropic filtering
- FILTER_TYPE_COMPARISON_POINT, ///< Comparison-point filtering
- FILTER_TYPE_COMPARISON_LINEAR, ///< Comparison-linear filtering
- FILTER_TYPE_COMPARISON_ANISOTROPIC, ///< Comparison-anisotropic filtering
- FILTER_TYPE_MINIMUM_POINT, ///< Minimum-point filtering (DX12 only)
- FILTER_TYPE_MINIMUM_LINEAR, ///< Minimum-linear filtering (DX12 only)
- FILTER_TYPE_MINIMUM_ANISOTROPIC, ///< Minimum-anisotropic filtering (DX12 only)
- FILTER_TYPE_MAXIMUM_POINT, ///< Maximum-point filtering (DX12 only)
- FILTER_TYPE_MAXIMUM_LINEAR, ///< Maximum-linear filtering (DX12 only)
- FILTER_TYPE_MAXIMUM_ANISOTROPIC, ///< Maximum-anisotropic filtering (DX12 only)
- FILTER_TYPE_NUM_FILTERS ///< Helper value that stores the total number of filter types in the enumeration
- };
-
- /// Texture address mode
-
- /// [D3D11_TEXTURE_ADDRESS_MODE]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476256(v=vs.85).aspx
- /// [D3D12_TEXTURE_ADDRESS_MODE]: https://msdn.microsoft.com/en-us/library/windows/desktop/dn770441(v=vs.85).aspx
- /// Defines a technique for resolving texture coordinates that are outside of
- /// the boundaries of a texture. The enumeration generally mirrors [D3D11_TEXTURE_ADDRESS_MODE][]/[D3D12_TEXTURE_ADDRESS_MODE][] enumeration.
- /// It is used by SamplerDesc structure to define the address mode for U,V and W texture coordinates.
- enum TEXTURE_ADDRESS_MODE : Uint8
- {
- /// Unknown mode
- TEXTURE_ADDRESS_UNKNOWN = 0,
-
- /// Tile the texture at every integer junction. \n
- /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_WRAP/D3D12_TEXTURE_ADDRESS_MODE_WRAP. OpenGL counterpart: GL_REPEAT
- TEXTURE_ADDRESS_WRAP = 1,
-
- /// Flip the texture at every integer junction. \n
- /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_MIRROR/D3D12_TEXTURE_ADDRESS_MODE_MIRROR. OpenGL counterpart: GL_MIRRORED_REPEAT
- TEXTURE_ADDRESS_MIRROR = 2,
-
- /// Texture coordinates outside the range [0.0, 1.0] are set to the
- /// texture color at 0.0 or 1.0, respectively. \n
- /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_CLAMP/D3D12_TEXTURE_ADDRESS_MODE_CLAMP. OpenGL counterpart: GL_CLAMP_TO_EDGE
- TEXTURE_ADDRESS_CLAMP = 3,
-
- /// Texture coordinates outside the range [0.0, 1.0] are set to the border color specified
- /// specified in SamplerDesc structure. \n
- /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_BORDER/D3D12_TEXTURE_ADDRESS_MODE_BORDER. OpenGL counterpart: GL_CLAMP_TO_BORDER
- TEXTURE_ADDRESS_BORDER = 4,
-
- /// Similar to TEXTURE_ADDRESS_MIRROR and TEXTURE_ADDRESS_CLAMP. Takes the absolute
- /// value of the texture coordinate (thus, mirroring around 0), and then clamps to
- /// the maximum value. \n
- /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_MIRROR_ONCE/D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE. OpenGL counterpart: GL_MIRROR_CLAMP_TO_EDGE
- /// \note GL_MIRROR_CLAMP_TO_EDGE is only available in OpenGL4.4+, and is not available until at least OpenGLES3.1
- TEXTURE_ADDRESS_MIRROR_ONCE = 5,
-
- /// Helper value that stores the total number of texture address modes in the enumeration
- TEXTURE_ADDRESS_NUM_MODES
- };
-
- /// Comparison function
-
- /// [D3D11_COMPARISON_FUNC]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476101(v=vs.85).aspx
- /// [D3D12_COMPARISON_FUNC]: https://msdn.microsoft.com/en-us/library/windows/desktop/dn770349(v=vs.85).aspx
- /// This enumeartion defines a comparison function. It generally mirrors [D3D11_COMPARISON_FUNC]/[D3D12_COMPARISON_FUNC] enum and is used by
- /// - SamplerDesc to define a comparison function if one of the comparison mode filters is used
- /// - StencilOpDesc to define a stencil function
- /// - DepthStencilStateDesc to define a depth function
- enum COMPARISON_FUNCTION : Uint8
- {
- /// Unknown comparison function
- COMPARISON_FUNC_UNKNOWN = 0,
+ /// Three-component 96-bit floating-point format with 32-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R32G32B32_FLOAT. OpenGL counterpart: GL_RGB32F.
+ /// \warning This format has weak hardware support and is not recommended
+ TEX_FORMAT_RGB32_FLOAT,
+
+ /// Three-component 96-bit unsigned-integer format with 32-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R32G32B32_UINT. OpenGL counterpart: GL_RGB32UI.
+ /// \warning This format has weak hardware support and is not recommended
+ TEX_FORMAT_RGB32_UINT,
+
+ /// Three-component 96-bit signed-integer format with 32-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R32G32B32_SINT. OpenGL counterpart: GL_RGB32I.
+ /// \warning This format has weak hardware support and is not recommended
+ TEX_FORMAT_RGB32_SINT,
+
+ /// Four-component 64-bit typeless format with 16-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_TYPELESS. OpenGL does not have direct counterpart, GL_RGBA16F is used.
+ TEX_FORMAT_RGBA16_TYPELESS,
+
+ /// Four-component 64-bit half-precision floating-point format with 16-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_FLOAT. OpenGL counterpart: GL_RGBA16F.
+ TEX_FORMAT_RGBA16_FLOAT,
+
+ /// Four-component 64-bit unsigned-normalized-integer format with 16-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_UNORM. OpenGL counterpart: GL_RGBA16. \n
+ /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
+ /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
+ TEX_FORMAT_RGBA16_UNORM,
+
+ /// Four-component 64-bit unsigned-integer format with 16-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_UINT. OpenGL counterpart: GL_RGBA16UI.
+ TEX_FORMAT_RGBA16_UINT,
+
+ /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
+ /// Four-component 64-bit signed-normalized-integer format with 16-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_SNORM. OpenGL counterpart: GL_RGBA16_SNORM. \n
+ /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
+ /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
+ TEX_FORMAT_RGBA16_SNORM,
+
+ /// Four-component 64-bit signed-integer format with 16-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R16G16B16A16_SINT. OpenGL counterpart: GL_RGBA16I.
+ TEX_FORMAT_RGBA16_SINT,
+
+ /// Two-component 64-bit typeless format with 32-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R32G32_TYPELESS. OpenGL does not have direct counterpart, GL_RG32F is used.
+ TEX_FORMAT_RG32_TYPELESS,
+
+ /// Two-component 64-bit floating-point format with 32-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R32G32_FLOAT. OpenGL counterpart: GL_RG32F.
+ TEX_FORMAT_RG32_FLOAT,
+
+ /// Two-component 64-bit unsigned-integer format with 32-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R32G32_UINT. OpenGL counterpart: GL_RG32UI.
+ TEX_FORMAT_RG32_UINT,
+
+ /// Two-component 64-bit signed-integer format with 32-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R32G32_SINT. OpenGL counterpart: GL_RG32I.
+ TEX_FORMAT_RG32_SINT,
+
+ /// Two-component 64-bit typeless format with 32-bits for R channel and 8 bits for G channel. \n
+ /// D3D counterpart: DXGI_FORMAT_R32G8X24_TYPELESS. OpenGL does not have direct counterpart, GL_DEPTH32F_STENCIL8 is used.
+ TEX_FORMAT_R32G8X24_TYPELESS,
+
+ /// Two-component 64-bit format with 32-bit floating-point depth channel and 8-bit stencil channel. \n
+ /// D3D counterpart: DXGI_FORMAT_D32_FLOAT_S8X24_UINT. OpenGL counterpart: GL_DEPTH32F_STENCIL8.
+ TEX_FORMAT_D32_FLOAT_S8X24_UINT,
+
+ /// Two-component 64-bit format with 32-bit floating-point R channel and 8+24-bits of typeless data. \n
+ /// D3D counterpart: DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS. OpenGL does not have direct counterpart, GL_DEPTH32F_STENCIL8 is used.
+ TEX_FORMAT_R32_FLOAT_X8X24_TYPELESS,
+
+ /// Two-component 64-bit format with 32-bit typeless data and 8-bit G channel. \n
+ /// D3D counterpart: DXGI_FORMAT_X32_TYPELESS_G8X24_UINT
+ /// \warning This format is currently not implemented in OpenGL version
+ TEX_FORMAT_X32_TYPELESS_G8X24_UINT,
+
+ /// Four-component 32-bit typeless format with 10 bits for RGB and 2 bits for alpha channel. \n
+ /// D3D counterpart: DXGI_FORMAT_R10G10B10A2_TYPELESS. OpenGL does not have direct counterpart, GL_RGB10_A2 is used.
+ TEX_FORMAT_RGB10A2_TYPELESS,
+
+ /// Four-component 32-bit unsigned-normalized-integer format with 10 bits for each color and 2 bits for alpha channel. \n
+ /// D3D counterpart: DXGI_FORMAT_R10G10B10A2_UNORM. OpenGL counterpart: GL_RGB10_A2.
+ TEX_FORMAT_RGB10A2_UNORM,
+
+ /// Four-component 32-bit unsigned-integer format with 10 bits for each color and 2 bits for alpha channel. \n
+ /// D3D counterpart: DXGI_FORMAT_R10G10B10A2_UINT. OpenGL counterpart: GL_RGB10_A2UI.
+ TEX_FORMAT_RGB10A2_UINT,
+
+ /// Three-component 32-bit format encoding three partial precision channels using 11 bits for red and green and 10 bits for blue channel. \n
+ /// D3D counterpart: DXGI_FORMAT_R11G11B10_FLOAT. OpenGL counterpart: GL_R11F_G11F_B10F.
+ TEX_FORMAT_R11G11B10_FLOAT,
+
+ /// Four-component 32-bit typeless format with 8-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_TYPELESS. OpenGL does not have direct counterpart, GL_RGBA8 is used.
+ TEX_FORMAT_RGBA8_TYPELESS,
+
+ /// Four-component 32-bit unsigned-normalized-integer format with 8-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_UNORM. OpenGL counterpart: GL_RGBA8.
+ TEX_FORMAT_RGBA8_UNORM,
+
+ /// Four-component 32-bit unsigned-normalized-integer sRGB format with 8-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_UNORM_SRGB. OpenGL counterpart: GL_SRGB8_ALPHA8.
+ TEX_FORMAT_RGBA8_UNORM_SRGB,
+
+ /// Four-component 32-bit unsigned-integer format with 8-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_UINT. OpenGL counterpart: GL_RGBA8UI.
+ TEX_FORMAT_RGBA8_UINT,
+
+ /// Four-component 32-bit signed-normalized-integer format with 8-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_SNORM. OpenGL counterpart: GL_RGBA8_SNORM.
+ TEX_FORMAT_RGBA8_SNORM,
+
+ /// Four-component 32-bit signed-integer format with 8-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R8G8B8A8_SINT. OpenGL counterpart: GL_RGBA8I.
+ TEX_FORMAT_RGBA8_SINT,
+
+ /// Two-component 32-bit typeless format with 16-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R16G16_TYPELESS. OpenGL does not have direct counterpart, GL_RG16F is used.
+ TEX_FORMAT_RG16_TYPELESS,
+
+ /// Two-component 32-bit half-precision floating-point format with 16-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R16G16_FLOAT. OpenGL counterpart: GL_RG16F.
+ TEX_FORMAT_RG16_FLOAT,
+
+ /// Two-component 32-bit unsigned-normalized-integer format with 16-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R16G16_UNORM. OpenGL counterpart: GL_RG16. \n
+ /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
+ /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
+ TEX_FORMAT_RG16_UNORM,
+
+ /// Two-component 32-bit unsigned-integer format with 16-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R16G16_UINT. OpenGL counterpart: GL_RG16UI.
+ TEX_FORMAT_RG16_UINT,
+
+ /// Two-component 32-bit signed-normalized-integer format with 16-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R16G16_SNORM. OpenGL counterpart: GL_RG16_SNORM. \n
+ /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
+ /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
+ TEX_FORMAT_RG16_SNORM,
+
+ /// Two-component 32-bit signed-integer format with 16-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R16G16_SINT. OpenGL counterpart: GL_RG16I.
+ TEX_FORMAT_RG16_SINT,
+
+ /// Single-component 32-bit typeless format. \n
+ /// D3D counterpart: DXGI_FORMAT_R32_TYPELESS. OpenGL does not have direct counterpart, GL_R32F is used.
+ TEX_FORMAT_R32_TYPELESS,
+
+ /// Single-component 32-bit floating-point depth format. \n
+ /// D3D counterpart: DXGI_FORMAT_D32_FLOAT. OpenGL counterpart: GL_DEPTH_COMPONENT32F.
+ TEX_FORMAT_D32_FLOAT,
+
+ /// Single-component 32-bit floating-point format. \n
+ /// D3D counterpart: DXGI_FORMAT_R32_FLOAT. OpenGL counterpart: GL_R32F.
+ TEX_FORMAT_R32_FLOAT,
+
+ /// Single-component 32-bit unsigned-integer format. \n
+ /// D3D counterpart: DXGI_FORMAT_R32_UINT. OpenGL counterpart: GL_R32UI.
+ TEX_FORMAT_R32_UINT,
+
+ /// Single-component 32-bit signed-integer format. \n
+ /// D3D counterpart: DXGI_FORMAT_R32_SINT. OpenGL counterpart: GL_R32I.
+ TEX_FORMAT_R32_SINT,
+
+ /// Two-component 32-bit typeless format with 24 bits for R and 8 bits for G channel. \n
+ /// D3D counterpart: DXGI_FORMAT_R24G8_TYPELESS. OpenGL does not have direct counterpart, GL_DEPTH24_STENCIL8 is used.
+ TEX_FORMAT_R24G8_TYPELESS,
+
+ /// Two-component 32-bit format with 24 bits for unsigned-normalized-integer depth and 8 bits for stencil. \n
+ /// D3D counterpart: DXGI_FORMAT_D24_UNORM_S8_UINT. OpenGL counterpart: GL_DEPTH24_STENCIL8.
+ TEX_FORMAT_D24_UNORM_S8_UINT,
+
+ /// Two-component 32-bit format with 24 bits for unsigned-normalized-integer data and 8 bits of unreferenced data. \n
+ /// D3D counterpart: DXGI_FORMAT_R24_UNORM_X8_TYPELESS. OpenGL does not have direct counterpart, GL_DEPTH24_STENCIL8 is used.
+ TEX_FORMAT_R24_UNORM_X8_TYPELESS,
+
+ /// Two-component 32-bit format with 24 bits of unreferenced data and 8 bits of unsigned-integer data. \n
+ /// D3D counterpart: DXGI_FORMAT_X24_TYPELESS_G8_UINT
+ /// \warning This format is currently not implemented in OpenGL version
+ TEX_FORMAT_X24_TYPELESS_G8_UINT,
+
+ /// Two-component 16-bit typeless format with 8-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R8G8_TYPELESS. OpenGL does not have direct counterpart, GL_RG8 is used.
+ TEX_FORMAT_RG8_TYPELESS,
+
+ /// Two-component 16-bit unsigned-normalized-integer format with 8-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R8G8_UNORM. OpenGL counterpart: GL_RG8.
+ TEX_FORMAT_RG8_UNORM,
+
+ /// Two-component 16-bit unsigned-integer format with 8-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R8G8_UINT. OpenGL counterpart: GL_RG8UI.
+ TEX_FORMAT_RG8_UINT,
+
+ /// Two-component 16-bit signed-normalized-integer format with 8-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R8G8_SNORM. OpenGL counterpart: GL_RG8_SNORM.
+ TEX_FORMAT_RG8_SNORM,
+
+ /// Two-component 16-bit signed-integer format with 8-bit channels. \n
+ /// D3D counterpart: DXGI_FORMAT_R8G8_SINT. OpenGL counterpart: GL_RG8I.
+ TEX_FORMAT_RG8_SINT,
+
+ /// Single-component 16-bit typeless format. \n
+ /// D3D counterpart: DXGI_FORMAT_R16_TYPELESS. OpenGL does not have direct counterpart, GL_R16F is used.
+ TEX_FORMAT_R16_TYPELESS,
+
+ /// Single-component 16-bit half-precisoin floating-point format. \n
+ /// D3D counterpart: DXGI_FORMAT_R16_FLOAT. OpenGL counterpart: GL_R16F.
+ TEX_FORMAT_R16_FLOAT,
+
+ /// Single-component 16-bit unsigned-normalized-integer depth format. \n
+ /// D3D counterpart: DXGI_FORMAT_D16_UNORM. OpenGL counterpart: GL_DEPTH_COMPONENT16.
+ TEX_FORMAT_D16_UNORM,
+
+ /// Single-component 16-bit unsigned-normalized-integer format. \n
+ /// D3D counterpart: DXGI_FORMAT_R16_UNORM. OpenGL counterpart: GL_R16.
+ /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
+ /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
+ TEX_FORMAT_R16_UNORM,
+
+ /// Single-component 16-bit unsigned-integer format. \n
+ /// D3D counterpart: DXGI_FORMAT_R16_UINT. OpenGL counterpart: GL_R16UI.
+ TEX_FORMAT_R16_UINT,
+
+ /// Single-component 16-bit signed-normalized-integer format. \n
+ /// D3D counterpart: DXGI_FORMAT_R16_SNORM. OpenGL counterpart: GL_R16_SNORM. \n
+ /// [GL_EXT_texture_norm16]: https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_norm16.txt
+ /// OpenGLES: [GL_EXT_texture_norm16][] extension is required
+ TEX_FORMAT_R16_SNORM,
+
+ /// Single-component 16-bit signed-integer format. \n
+ /// D3D counterpart: DXGI_FORMAT_R16_SINT. OpenGL counterpart: GL_R16I.
+ TEX_FORMAT_R16_SINT,
+
+ /// Single-component 8-bit typeless format. \n
+ /// D3D counterpart: DXGI_FORMAT_R8_TYPELESS. OpenGL does not have direct counterpart, GL_R8 is used.
+ TEX_FORMAT_R8_TYPELESS,
+
+ /// Single-component 8-bit unsigned-normalized-integer format. \n
+ /// D3D counterpart: DXGI_FORMAT_R8_UNORM. OpenGL counterpart: GL_R8.
+ TEX_FORMAT_R8_UNORM,
+
+ /// Single-component 8-bit unsigned-integer format. \n
+ /// D3D counterpart: DXGI_FORMAT_R8_UINT. OpenGL counterpart: GL_R8UI.
+ TEX_FORMAT_R8_UINT,
+
+ /// Single-component 8-bit signed-normalized-integer format. \n
+ /// D3D counterpart: DXGI_FORMAT_R8_SNORM. OpenGL counterpart: GL_R8_SNORM.
+ TEX_FORMAT_R8_SNORM,
+
+ /// Single-component 8-bit signed-integer format. \n
+ /// D3D counterpart: DXGI_FORMAT_R8_SINT. OpenGL counterpart: GL_R8I.
+ TEX_FORMAT_R8_SINT,
+
+ /// Single-component 8-bit unsigned-normalized-integer format for alpha only. \n
+ /// D3D counterpart: DXGI_FORMAT_A8_UNORM
+ /// \warning This format is not availanle in OpenGL
+ TEX_FORMAT_A8_UNORM,
+
+ /// Single-component 1-bit format. \n
+ /// D3D counterpart: DXGI_FORMAT_R1_UNORM
+ /// \warning This format is not availanle in OpenGL
+ TEX_FORMAT_R1_UNORM,
+
+ /// Three partial-precision floating pointer numbers sharing single exponent encoded into a 32-bit value. \n
+ /// D3D counterpart: DXGI_FORMAT_R9G9B9E5_SHAREDEXP. OpenGL counterpart: GL_RGB9_E5.
+ TEX_FORMAT_RGB9E5_SHAREDEXP,
+
+ /// Four-component unsigned-normalized integer format analogous to UYVY encoding. \n
+ /// D3D counterpart: DXGI_FORMAT_R8G8_B8G8_UNORM
+ /// \warning This format is not availanle in OpenGL
+ TEX_FORMAT_RG8_B8G8_UNORM,
+
+ /// Four-component unsigned-normalized integer format analogous to YUY2 encoding. \n
+ /// D3D counterpart: DXGI_FORMAT_G8R8_G8B8_UNORM
+ /// \warning This format is not availanle in OpenGL
+ TEX_FORMAT_G8R8_G8B8_UNORM,
+
+ /// Four-component typeless block-compression format with 1:8 compression ratio.\n
+ /// D3D counterpart: DXGI_FORMAT_BC1_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGB_S3TC_DXT1_EXT is used. \n
+ /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
+ /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC1">BC1 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT1_Format">DXT1 on OpenGL.org </a>
+ TEX_FORMAT_BC1_TYPELESS,
+
+ /// 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.
+ /// The pixel data is encoded using 8 bytes per 4x4 block (4 bits per pixel) providing 1:8 compression ratio against RGBA8 format. \n
+ /// D3D counterpart: DXGI_FORMAT_BC1_UNORM. OpenGL counterpart: GL_COMPRESSED_RGB_S3TC_DXT1_EXT.\n
+ /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
+ /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC1">BC1 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT1_Format">DXT1 on OpenGL.org </a>
+ TEX_FORMAT_BC1_UNORM,
+
+ /// 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
+ /// The pixel data is encoded using 8 bytes per 4x4 block (4 bits per pixel) providing 1:8 compression ratio against RGBA8 format. \n
+ /// D3D counterpart: DXGI_FORMAT_BC1_UNORM_SRGB. OpenGL counterpart: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT.\n
+ /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
+ /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC1">BC1 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT1_Format">DXT1 on OpenGL.org </a>
+ TEX_FORMAT_BC1_UNORM_SRGB,
+
+ /// Four component typeless block-compression format with 1:4 compression ratio.\n
+ /// D3D counterpart: DXGI_FORMAT_BC2_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT is used. \n
+ /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
+ /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC2">BC2 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT3_Format">DXT3 on OpenGL.org </a>
+ TEX_FORMAT_BC2_TYPELESS,
+
+ /// 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.
+ /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:4 compression ratio against RGBA8 format. \n
+ /// D3D counterpart: DXGI_FORMAT_BC2_UNORM. OpenGL counterpart: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT. \n
+ /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
+ /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC2">BC2 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT3_Format">DXT3 on OpenGL.org </a>
+ TEX_FORMAT_BC2_UNORM,
+
+ /// 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.
+ /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:4 compression ratio against RGBA8 format. \n
+ /// D3D counterpart: DXGI_FORMAT_BC2_UNORM_SRGB. OpenGL counterpart: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT. \n
+ /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
+ /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC2">BC2 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT3_Format">DXT3 on OpenGL.org </a>
+ TEX_FORMAT_BC2_UNORM_SRGB,
+
+ /// Four-component typeless block-compression format with 1:4 compression ratio.\n
+ /// D3D counterpart: DXGI_FORMAT_BC3_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT is used. \n
+ /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
+ /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC3">BC3 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT5_Format">DXT5 on OpenGL.org </a>
+ TEX_FORMAT_BC3_TYPELESS,
+
+ /// 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.
+ /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:4 compression ratio against RGBA8 format. \n
+ /// D3D counterpart: DXGI_FORMAT_BC3_UNORM. OpenGL counterpart: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT. \n
+ /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
+ /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC3">BC3 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT5_Format">DXT5 on OpenGL.org </a>
+ TEX_FORMAT_BC3_UNORM,
+
+ /// 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.
+ /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:4 compression ratio against RGBA8 format. \n
+ /// D3D counterpart: DXGI_FORMAT_BC3_UNORM_SRGB. OpenGL counterpart: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT. \n
+ /// [GL_EXT_texture_compression_s3tc]: https://www.khronos.org/registry/gles/extensions/EXT/texture_compression_s3tc.txt
+ /// OpenGL & OpenGLES: [GL_EXT_texture_compression_s3tc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC3">BC3 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/S3_Texture_Compression#DXT5_Format">DXT5 on OpenGL.org </a>
+ TEX_FORMAT_BC3_UNORM_SRGB,
+
+ /// One-component typeless block-compression format with 1:2 compression ratio. \n
+ /// D3D counterpart: DXGI_FORMAT_BC4_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RED_RGTC1 is used. \n
+ /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
+ /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC4">BC4 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
+ TEX_FORMAT_BC4_TYPELESS,
+
+ /// One-component unsigned-normalized-integer block-compression format with 8 bits for R channel.
+ /// The pixel data is encoded using 8 bytes per 4x4 block (4 bits per pixel) providing 1:2 compression ratio against R8 format. \n
+ /// D3D counterpart: DXGI_FORMAT_BC4_UNORM. OpenGL counterpart: GL_COMPRESSED_RED_RGTC1. \n
+ /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
+ /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC4">BC4 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
+ TEX_FORMAT_BC4_UNORM,
+
+ /// One-component signed-normalized-integer block-compression format with 8 bits for R channel.
+ /// The pixel data is encoded using 8 bytes per 4x4 block (4 bits per pixel) providing 1:2 compression ratio against R8 format. \n
+ /// D3D counterpart: DXGI_FORMAT_BC4_SNORM. OpenGL counterpart: GL_COMPRESSED_SIGNED_RED_RGTC1. \n
+ /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
+ /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC4">BC4 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
+ TEX_FORMAT_BC4_SNORM,
+
+ /// Two-component typeless block-compression format with 1:2 compression ratio. \n
+ /// D3D counterpart: DXGI_FORMAT_BC5_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RG_RGTC2 is used. \n
+ /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
+ /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC5">BC5 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
+ TEX_FORMAT_BC5_TYPELESS,
+
+ /// Two-component unsigned-normalized-integer block-compression format with 8 bits for R and 8 bits for G channel.
+ /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:2 compression ratio against RG8 format. \n
+ /// D3D counterpart: DXGI_FORMAT_BC5_UNORM. OpenGL counterpart: GL_COMPRESSED_RG_RGTC2. \n
+ /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
+ /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC5">BC5 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
+ TEX_FORMAT_BC5_UNORM,
+
+ /// Two-component signed-normalized-integer block-compression format with 8 bits for R and 8 bits for G channel.
+ /// The pixel data is encoded using 16 bytes per 4x4 block (8 bits per pixel) providing 1:2 compression ratio against RG8 format. \n
+ /// D3D counterpart: DXGI_FORMAT_BC5_SNORM. OpenGL counterpart: GL_COMPRESSED_SIGNED_RG_RGTC2. \n
+ /// [GL_ARB_texture_compression_rgtc]: https://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
+ /// OpenGL & OpenGLES: [GL_ARB_texture_compression_rgtc][] extension is required
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb694531(v=vs.85).aspx#BC5">BC5 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/Image_Format#Compressed_formats">Compressed formats on OpenGL.org </a>
+ TEX_FORMAT_BC5_SNORM,
+
+ /// Three-component 16-bit unsigned-normalized-integer format with 5 bits for blue, 6 bits for green, and 5 bits for red channel. \n
+ /// D3D counterpart: DXGI_FORMAT_B5G6R5_UNORM
+ /// \warning This format is not available until D3D11.1 and Windows 8. It is also not available in OpenGL
+ TEX_FORMAT_B5G6R5_UNORM,
+
+ /// Four-component 16-bit unsigned-normalized-integer format with 5 bits for each color channel and 1-bit alpha. \n
+ /// D3D counterpart: DXGI_FORMAT_B5G5R5A1_UNORM
+ /// \warning This format is not available until D3D11.1 and Windows 8. It is also not available in OpenGL
+ TEX_FORMAT_B5G5R5A1_UNORM,
+
+ /// Four-component 32-bit unsigned-normalized-integer format with 8 bits for each channel. \n
+ /// D3D counterpart: DXGI_FORMAT_B8G8R8A8_UNORM.
+ /// \warning This format is not available in OpenGL
+ TEX_FORMAT_BGRA8_UNORM,
+
+ /// Four-component 32-bit unsigned-normalized-integer format with 8 bits for each color channel and 8 bits unused. \n
+ /// D3D counterpart: DXGI_FORMAT_B8G8R8X8_UNORM.
+ /// \warning This format is not available in OpenGL
+ TEX_FORMAT_BGRX8_UNORM,
+
+ /// Four-component 32-bit 2.8-biased fixed-point format with 10 bits for each color channel and 2-bit alpha. \n
+ /// D3D counterpart: DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM.
+ /// \warning This format is not available in OpenGL
+ TEX_FORMAT_R10G10B10_XR_BIAS_A2_UNORM,
+
+ /// Four-component 32-bit typeless format with 8 bits for each channel. \n
+ /// D3D counterpart: DXGI_FORMAT_B8G8R8A8_TYPELESS.
+ /// \warning This format is not available in OpenGL
+ TEX_FORMAT_BGRA8_TYPELESS,
+
+ /// Four-component 32-bit unsigned-normalized sRGB format with 8 bits for each channel. \n
+ /// D3D counterpart: DXGI_FORMAT_B8G8R8A8_UNORM_SRGB.
+ /// \warning This format is not available in OpenGL.
+ TEX_FORMAT_BGRA8_UNORM_SRGB,
+
+ /// Four-component 32-bit typeless format that with 8 bits for each color channel, and 8 bits are unused. \n
+ /// D3D counterpart: DXGI_FORMAT_B8G8R8X8_TYPELESS.
+ /// \warning This format is not available in OpenGL.
+ TEX_FORMAT_BGRX8_TYPELESS,
+
+ /// Four-component 32-bit unsigned-normalized sRGB format with 8 bits for each color channel, and 8 bits are unused. \n
+ /// D3D counterpart: DXGI_FORMAT_B8G8R8X8_UNORM_SRGB.
+ /// \warning This format is not available in OpenGL.
+ TEX_FORMAT_BGRX8_UNORM_SRGB,
+
+ /// Three-component typeless block-compression format. \n
+ /// D3D counterpart: DXGI_FORMAT_BC6H_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT is used. \n
+ /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
+ /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308952(v=vs.85).aspx">BC6H on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
+ TEX_FORMAT_BC6H_TYPELESS,
+
+ /// Three-component unsigned half-precision floating-point format with 16 bits for each channel. \n
+ /// D3D counterpart: DXGI_FORMAT_BC6H_UF16. OpenGL counterpart: GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT. \n
+ /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
+ /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308952(v=vs.85).aspx">BC6H on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
+ TEX_FORMAT_BC6H_UF16,
+
+ /// Three-channel signed half-precision floating-point format with 16 bits per each channel. \n
+ /// D3D counterpart: DXGI_FORMAT_BC6H_SF16. OpenGL counterpart: GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT. \n
+ /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
+ /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308952(v=vs.85).aspx">BC6H on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
+ TEX_FORMAT_BC6H_SF16,
+
+ /// Three-component typeless block-compression format. \n
+ /// D3D counterpart: DXGI_FORMAT_BC7_TYPELESS. OpenGL does not have direct counterpart, GL_COMPRESSED_RGBA_BPTC_UNORM is used. \n
+ /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
+ /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308953(v=vs.85).aspx">BC7 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
+ TEX_FORMAT_BC7_TYPELESS,
+
+ /// Three-component block-compression unsigned-normalized-integer format with 4 to 7 bits per color channel and 0 to 8 bits of alpha. \n
+ /// D3D counterpart: DXGI_FORMAT_BC7_UNORM. OpenGL counterpart: GL_COMPRESSED_RGBA_BPTC_UNORM. \n
+ /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
+ /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308953(v=vs.85).aspx">BC7 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
+ TEX_FORMAT_BC7_UNORM,
+
+ /// 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
+ /// D3D counterpart: DXGI_FORMAT_BC7_UNORM_SRGB. OpenGL counterpart: GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM. \n
+ /// [GL_ARB_texture_compression_bptc]: https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/texture_compression_bptc.txt
+ /// OpenGL: [GL_ARB_texture_compression_bptc][] extension is required. Not supported in at least OpenGLES3.1
+ /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh308953(v=vs.85).aspx">BC7 on MSDN </a>,
+ /// <a href = "https://www.opengl.org/wiki/BPTC_Texture_Compression">BPTC Texture Compression on OpenGL.org </a>
+ TEX_FORMAT_BC7_UNORM_SRGB,
+
+ /// Helper member containing the total number of texture formats in the enumeration
+ TEX_FORMAT_NUM_FORMATS
+};
+
+/// Filter type
+
+/// This enumeration defines filter type. It is used by SamplerDesc structure to define min, mag and mip filters.
+/// \note On D3D11, comparison filters only work with textures that have the following formats:
+/// R32_FLOAT_X8X24_TYPELESS, R32_FLOAT, R24_UNORM_X8_TYPELESS, R16_UNORM.
+DILIGENT_TYPED_ENUM(FILTER_TYPE, Uint8)
+{
+ FILTER_TYPE_UNKNOWN = 0, ///< Unknown filter type
+ FILTER_TYPE_POINT, ///< Point filtering
+ FILTER_TYPE_LINEAR, ///< Linear filtering
+ FILTER_TYPE_ANISOTROPIC, ///< Anisotropic filtering
+ FILTER_TYPE_COMPARISON_POINT, ///< Comparison-point filtering
+ FILTER_TYPE_COMPARISON_LINEAR, ///< Comparison-linear filtering
+ FILTER_TYPE_COMPARISON_ANISOTROPIC, ///< Comparison-anisotropic filtering
+ FILTER_TYPE_MINIMUM_POINT, ///< Minimum-point filtering (DX12 only)
+ FILTER_TYPE_MINIMUM_LINEAR, ///< Minimum-linear filtering (DX12 only)
+ FILTER_TYPE_MINIMUM_ANISOTROPIC, ///< Minimum-anisotropic filtering (DX12 only)
+ FILTER_TYPE_MAXIMUM_POINT, ///< Maximum-point filtering (DX12 only)
+ FILTER_TYPE_MAXIMUM_LINEAR, ///< Maximum-linear filtering (DX12 only)
+ FILTER_TYPE_MAXIMUM_ANISOTROPIC, ///< Maximum-anisotropic filtering (DX12 only)
+ FILTER_TYPE_NUM_FILTERS ///< Helper value that stores the total number of filter types in the enumeration
+};
+
+/// Texture address mode
+
+/// [D3D11_TEXTURE_ADDRESS_MODE]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476256(v=vs.85).aspx
+/// [D3D12_TEXTURE_ADDRESS_MODE]: https://msdn.microsoft.com/en-us/library/windows/desktop/dn770441(v=vs.85).aspx
+/// Defines a technique for resolving texture coordinates that are outside of
+/// the boundaries of a texture. The enumeration generally mirrors [D3D11_TEXTURE_ADDRESS_MODE][]/[D3D12_TEXTURE_ADDRESS_MODE][] enumeration.
+/// It is used by SamplerDesc structure to define the address mode for U,V and W texture coordinates.
+DILIGENT_TYPED_ENUM(TEXTURE_ADDRESS_MODE, Uint8)
+{
+ /// Unknown mode
+ TEXTURE_ADDRESS_UNKNOWN = 0,
+
+ /// Tile the texture at every integer junction. \n
+ /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_WRAP/D3D12_TEXTURE_ADDRESS_MODE_WRAP. OpenGL counterpart: GL_REPEAT
+ TEXTURE_ADDRESS_WRAP = 1,
+
+ /// Flip the texture at every integer junction. \n
+ /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_MIRROR/D3D12_TEXTURE_ADDRESS_MODE_MIRROR. OpenGL counterpart: GL_MIRRORED_REPEAT
+ TEXTURE_ADDRESS_MIRROR = 2,
+
+ /// Texture coordinates outside the range [0.0, 1.0] are set to the
+ /// texture color at 0.0 or 1.0, respectively. \n
+ /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_CLAMP/D3D12_TEXTURE_ADDRESS_MODE_CLAMP. OpenGL counterpart: GL_CLAMP_TO_EDGE
+ TEXTURE_ADDRESS_CLAMP = 3,
+
+ /// Texture coordinates outside the range [0.0, 1.0] are set to the border color specified
+ /// specified in SamplerDesc structure. \n
+ /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_BORDER/D3D12_TEXTURE_ADDRESS_MODE_BORDER. OpenGL counterpart: GL_CLAMP_TO_BORDER
+ TEXTURE_ADDRESS_BORDER = 4,
+
+ /// Similar to TEXTURE_ADDRESS_MIRROR and TEXTURE_ADDRESS_CLAMP. Takes the absolute
+ /// value of the texture coordinate (thus, mirroring around 0), and then clamps to
+ /// the maximum value. \n
+ /// Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_MIRROR_ONCE/D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE. OpenGL counterpart: GL_MIRROR_CLAMP_TO_EDGE
+ /// \note GL_MIRROR_CLAMP_TO_EDGE is only available in OpenGL4.4+, and is not available until at least OpenGLES3.1
+ TEXTURE_ADDRESS_MIRROR_ONCE = 5,
+
+ /// Helper value that stores the total number of texture address modes in the enumeration
+ TEXTURE_ADDRESS_NUM_MODES
+};
+
+/// Comparison function
+
+/// [D3D11_COMPARISON_FUNC]: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476101(v=vs.85).aspx
+/// [D3D12_COMPARISON_FUNC]: https://msdn.microsoft.com/en-us/library/windows/desktop/dn770349(v=vs.85).aspx
+/// This enumeartion defines a comparison function. It generally mirrors [D3D11_COMPARISON_FUNC]/[D3D12_COMPARISON_FUNC] enum and is used by
+/// - SamplerDesc to define a comparison function if one of the comparison mode filters is used
+/// - StencilOpDesc to define a stencil function
+/// - DepthStencilStateDesc to define a depth function
+DILIGENT_TYPED_ENUM(COMPARISON_FUNCTION, Uint8)
+{
+ /// Unknown comparison function
+ COMPARISON_FUNC_UNKNOWN = 0,
- /// Comparison never passes. \n
- /// Direct3D counterpart: D3D11_COMPARISON_NEVER/D3D12_COMPARISON_FUNC_NEVER. OpenGL counterpart: GL_NEVER.
- COMPARISON_FUNC_NEVER,
+ /// Comparison never passes. \n
+ /// Direct3D counterpart: D3D11_COMPARISON_NEVER/D3D12_COMPARISON_FUNC_NEVER. OpenGL counterpart: GL_NEVER.
+ COMPARISON_FUNC_NEVER,
- /// Comparison passes if the source data is less than the destination data.\n
- /// Direct3D counterpart: D3D11_COMPARISON_LESS/D3D12_COMPARISON_FUNC_LESS. OpenGL counterpart: GL_LESS.
- COMPARISON_FUNC_LESS,
+ /// Comparison passes if the source data is less than the destination data.\n
+ /// Direct3D counterpart: D3D11_COMPARISON_LESS/D3D12_COMPARISON_FUNC_LESS. OpenGL counterpart: GL_LESS.
+ COMPARISON_FUNC_LESS,
- /// Comparison passes if the source data is equal to the destination data.\n
- /// Direct3D counterpart: D3D11_COMPARISON_EQUAL/D3D12_COMPARISON_FUNC_EQUAL. OpenGL counterpart: GL_EQUAL.
- COMPARISON_FUNC_EQUAL,
+ /// Comparison passes if the source data is equal to the destination data.\n
+ /// Direct3D counterpart: D3D11_COMPARISON_EQUAL/D3D12_COMPARISON_FUNC_EQUAL. OpenGL counterpart: GL_EQUAL.
+ COMPARISON_FUNC_EQUAL,
- /// Comparison passes if the source data is less than or equal to the destination data.\n
- /// Direct3D counterpart: D3D11_COMPARISON_LESS_EQUAL/D3D12_COMPARISON_FUNC_LESS_EQUAL. OpenGL counterpart: GL_LEQUAL.
- COMPARISON_FUNC_LESS_EQUAL,
+ /// Comparison passes if the source data is less than or equal to the destination data.\n
+ /// Direct3D counterpart: D3D11_COMPARISON_LESS_EQUAL/D3D12_COMPARISON_FUNC_LESS_EQUAL. OpenGL counterpart: GL_LEQUAL.
+ COMPARISON_FUNC_LESS_EQUAL,
- /// Comparison passes if the source data is greater than the destination data.\n
- /// Direct3D counterpart: 3D11_COMPARISON_GREATER/D3D12_COMPARISON_FUNC_GREATER. OpenGL counterpart: GL_GREATER.
- COMPARISON_FUNC_GREATER,
+ /// Comparison passes if the source data is greater than the destination data.\n
+ /// Direct3D counterpart: 3D11_COMPARISON_GREATER/D3D12_COMPARISON_FUNC_GREATER. OpenGL counterpart: GL_GREATER.
+ COMPARISON_FUNC_GREATER,
- /// Comparison passes if the source data is not equal to the destination data.\n
- /// Direct3D counterpart: D3D11_COMPARISON_NOT_EQUAL/D3D12_COMPARISON_FUNC_NOT_EQUAL. OpenGL counterpart: GL_NOTEQUAL.
- COMPARISON_FUNC_NOT_EQUAL,
+ /// Comparison passes if the source data is not equal to the destination data.\n
+ /// Direct3D counterpart: D3D11_COMPARISON_NOT_EQUAL/D3D12_COMPARISON_FUNC_NOT_EQUAL. OpenGL counterpart: GL_NOTEQUAL.
+ COMPARISON_FUNC_NOT_EQUAL,
- /// Comparison passes if the source data is greater than or equal to the destination data.\n
- /// Direct3D counterpart: D3D11_COMPARISON_GREATER_EQUAL/D3D12_COMPARISON_FUNC_GREATER_EQUAL. OpenGL counterpart: GL_GEQUAL.
- COMPARISON_FUNC_GREATER_EQUAL,
+ /// Comparison passes if the source data is greater than or equal to the destination data.\n
+ /// Direct3D counterpart: D3D11_COMPARISON_GREATER_EQUAL/D3D12_COMPARISON_FUNC_GREATER_EQUAL. OpenGL counterpart: GL_GEQUAL.
+ COMPARISON_FUNC_GREATER_EQUAL,
- /// Comparison always passes. \n
- /// Direct3D counterpart: D3D11_COMPARISON_ALWAYS/D3D12_COMPARISON_FUNC_ALWAYS. OpenGL counterpart: GL_ALWAYS.
- COMPARISON_FUNC_ALWAYS,
+ /// Comparison always passes. \n
+ /// Direct3D counterpart: D3D11_COMPARISON_ALWAYS/D3D12_COMPARISON_FUNC_ALWAYS. OpenGL counterpart: GL_ALWAYS.
+ COMPARISON_FUNC_ALWAYS,
- /// Helper value that stores the total number of comparison functions in the enumeration
- COMPARISON_FUNC_NUM_FUNCTIONS
- };
+ /// Helper value that stores the total number of comparison functions in the enumeration
+ COMPARISON_FUNC_NUM_FUNCTIONS
+};
- /// Miscellaneous texture flags
+/// Miscellaneous texture flags
- /// The enumeration is used by TextureDesc to describe misc texture flags
- enum MISC_TEXTURE_FLAGS : Uint8
- {
- MISC_TEXTURE_FLAG_NONE = 0x00,
+/// The enumeration is used by TextureDesc to describe misc texture flags
+DILIGENT_TYPED_ENUM(MISC_TEXTURE_FLAGS, Uint8)
+{
+ MISC_TEXTURE_FLAG_NONE = 0x00,
- /// Allow automatic mipmap generation with ITextureView::GenerateMips()
+ /// Allow automatic mipmap generation with ITextureView::GenerateMips()
- /// \note A texture must be created with BIND_RENDER_TARGET bind flag
- MISC_TEXTURE_FLAG_GENERATE_MIPS = 0x01
- };
- DEFINE_FLAG_ENUM_OPERATORS(MISC_TEXTURE_FLAGS)
+ /// \note A texture must be created with BIND_RENDER_TARGET bind flag
+ MISC_TEXTURE_FLAG_GENERATE_MIPS = 0x01
+};
+DEFINE_FLAG_ENUM_OPERATORS(MISC_TEXTURE_FLAGS)
- /// Input primitive topology.
+/// Input primitive topology.
- /// This enumeration is used by DrawAttribs structure to define input primitive topology.
- enum PRIMITIVE_TOPOLOGY : Uint8
- {
- /// Undefined topology
- PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
+/// This enumeration is used by DrawAttribs structure to define input primitive topology.
+DILIGENT_TYPED_ENUM(PRIMITIVE_TOPOLOGY, Uint8)
+{
+ /// Undefined topology
+ PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
- /// Interpret the vertex data as a list of triangles.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST. OpenGL counterpart: GL_TRIANGLES.
- PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
+ /// Interpret the vertex data as a list of triangles.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST. OpenGL counterpart: GL_TRIANGLES.
+ PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
- /// Interpret the vertex data as a triangle strip.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP. OpenGL counterpart: GL_TRIANGLE_STRIP.
- PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
+ /// Interpret the vertex data as a triangle strip.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP. OpenGL counterpart: GL_TRIANGLE_STRIP.
+ PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
- /// Interpret the vertex data as a list of points.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_POINTLIST. OpenGL counterpart: GL_POINTS.
- PRIMITIVE_TOPOLOGY_POINT_LIST,
+ /// Interpret the vertex data as a list of points.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_POINTLIST. OpenGL counterpart: GL_POINTS.
+ PRIMITIVE_TOPOLOGY_POINT_LIST,
- /// Interpret the vertex data as a list of lines.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_LINELIST. OpenGL counterpart: GL_LINES.
- PRIMITIVE_TOPOLOGY_LINE_LIST,
+ /// Interpret the vertex data as a list of lines.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_LINELIST. OpenGL counterpart: GL_LINES.
+ PRIMITIVE_TOPOLOGY_LINE_LIST,
- /// Interpret the vertex data as a list of one control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of one control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of two control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of two control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of three control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of three control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of four control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of four control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of five control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of five control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of six control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of six control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of seven control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of seven control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of eight control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of eight control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of nine control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of nine control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of ten control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of ten control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 11 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 11 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 12 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 12 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 13 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 13 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 14 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 14 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 15 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 15 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 16 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 16 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 17 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 17 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 18 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 18 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 19 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 19 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 20 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 20 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 21 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 21 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 22 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 22 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 23 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 23 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 24 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 24 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 25 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 25 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 26 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 26 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 27 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 27 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 28 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 28 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 29 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 29 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 30 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 30 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 31 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 31 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST,
- /// Interpret the vertex data as a list of 32 control point patches.\n
- /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
- PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST,
+ /// Interpret the vertex data as a list of 32 control point patches.\n
+ /// D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST. OpenGL counterpart: GL_PATCHES.
+ PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST,
- /// Helper value that stores the total number of topologies in the enumeration
- PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES
- };
+ /// Helper value that stores the total number of topologies in the enumeration
+ PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES
+};
- /// Describes common device object attributes
- struct DeviceObjectAttribs
- {
- /// Object name
- const Char* Name = nullptr;
+/// Describes common device object attributes
+struct DeviceObjectAttribs
+{
+ /// Object name
+ const Char* Name DEFAULT_INITIALIZER(nullptr);
- // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
- // DeviceObjectAttribs{"Name"}
+ // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
+ // DeviceObjectAttribs{"Name"}
- DeviceObjectAttribs()noexcept{}
+#if DILIGENT_CPP_INTERFACE
+ DeviceObjectAttribs()noexcept{}
- explicit DeviceObjectAttribs(const Char* _Name) :
- Name{_Name}
- {}
- };
+ explicit DeviceObjectAttribs(const Char* _Name) :
+ Name{_Name}
+ {}
+#endif
+};
- /// Hardware adapter type
- enum ADAPTER_TYPE : Uint8
- {
- /// Adapter type is unknown
- ADAPTER_TYPE_UNKNOWN = 0,
+/// Hardware adapter type
+DILIGENT_TYPED_ENUM(ADAPTER_TYPE, Uint8)
+{
+ /// Adapter type is unknown
+ ADAPTER_TYPE_UNKNOWN = 0,
- /// Software adapter
- ADAPTER_TYPE_SOFTWARE,
+ /// Software adapter
+ ADAPTER_TYPE_SOFTWARE,
- /// Hardware adapter
- ADAPTER_TYPE_HARDWARE
- };
+ /// Hardware adapter
+ ADAPTER_TYPE_HARDWARE
+};
- /// Adapter attributes
- struct AdapterAttribs
- {
- /// Adapter type. See Diligent::ADAPTER_TYPE.
- ADAPTER_TYPE AdapterType = ADAPTER_TYPE_UNKNOWN;
+/// Adapter attributes
+struct AdapterAttribs
+{
+ /// Adapter type. See Diligent::ADAPTER_TYPE.
+ ADAPTER_TYPE AdapterType DEFAULT_INITIALIZER(ADAPTER_TYPE_UNKNOWN);
- /// A string that contains the adapter description
- char Description[128] = {};
+ /// A string that contains the adapter description
+ char Description[128] DEFAULT_INITIALIZER({});
- /// Dedicated video memory, in bytes
- size_t DedicatedVideoMemory = 0;
+ /// Dedicated video memory, in bytes
+ size_t DedicatedVideoMemory DEFAULT_INITIALIZER(0);
- /// Dedicated system memory, in bytes
- size_t DedicatedSystemMemory = 0;
+ /// Dedicated system memory, in bytes
+ size_t DedicatedSystemMemory DEFAULT_INITIALIZER(0);
- /// Dedicated shared memory, in bytes
- size_t SharedSystemMemory = 0;
+ /// Dedicated shared memory, in bytes
+ size_t SharedSystemMemory DEFAULT_INITIALIZER(0);
- /// The PCI ID of the hardware vendor
- Uint32 VendorId = 0;
+ /// The PCI ID of the hardware vendor
+ Uint32 VendorId DEFAULT_INITIALIZER(0);
- /// The PCI ID of the hardware device
- Uint32 DeviceId = 0;
+ /// The PCI ID of the hardware device
+ Uint32 DeviceId DEFAULT_INITIALIZER(0);
- /// Number of outputs this device has
- Uint32 NumOutputs = 0;
- };
+ /// Number of outputs this device has
+ Uint32 NumOutputs DEFAULT_INITIALIZER(0);
+};
- /// Display mode attributes
- struct DisplayModeAttribs
- {
- /// Flags indicating how an image is stretched to fit a given monitor's resolution.
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb173066(v=vs.85).aspx">DXGI_MODE_SCALING enumeration on MSDN</a>,
- enum SCALING
- {
- /// Unspecified scaling.
- /// D3D Counterpart: DXGI_MODE_SCALING_UNSPECIFIED.
- SCALING_UNSPECIFIED = 0,
-
- /// Specifies no scaling. The image is centered on the display.
- /// This flag is typically used for a fixed-dot-pitch display (such as an LED display).
- /// D3D Counterpart: DXGI_MODE_SCALING_CENTERED.
- SCALING_CENTERED = 1,
-
- /// Specifies stretched scaling.
- /// D3D Counterpart: DXGI_MODE_SCALING_STRETCHED.
- SCALING_STRETCHED = 2
- };
-
- /// Flags indicating the method the raster uses to create an image on a surface.
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb173067">DXGI_MODE_SCANLINE_ORDER enumeration on MSDN</a>,
- enum SCANLINE_ORDER
- {
- /// Scanline order is unspecified
- /// D3D Counterpart: DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED.
- SCANLINE_ORDER_UNSPECIFIED = 0,
+/// Flags indicating how an image is stretched to fit a given monitor's resolution.
+/// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb173066(v=vs.85).aspx">DXGI_MODE_SCALING enumeration on MSDN</a>,
+enum SCALING_MODE
+{
+ /// Unspecified scaling.
+ /// D3D Counterpart: DXGI_MODE_SCALING_UNSPECIFIED.
+ SCALING_MODE_UNSPECIFIED = 0,
- /// The image is created from the first scanline to the last without skipping any
- /// D3D Counterpart: DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE.
- SCANLINE_ORDER_PROGRESSIVE = 1,
+ /// Specifies no scaling. The image is centered on the display.
+ /// This flag is typically used for a fixed-dot-pitch display (such as an LED display).
+ /// D3D Counterpart: DXGI_MODE_SCALING_CENTERED.
+ SCALING_MODE_CENTERED = 1,
- /// The image is created beginning with the upper field
- /// D3D Counterpart: DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST.
- SCANLINE_ORDER_UPPER_FIELD_FIRST = 2,
+ /// Specifies stretched scaling.
+ /// D3D Counterpart: DXGI_MODE_SCALING_STRETCHED.
+ SCALING_MODE_STRETCHED = 2
+};
- /// The image is created beginning with the lower field
- /// D3D Counterpart: DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST.
- SCANLINE_ORDER_LOWER_FIELD_FIRST = 3
- };
-
- /// Display resolution width
- Uint32 Width = 0;
- /// Display resolution height
- Uint32 Height = 0;
+/// Flags indicating the method the raster uses to create an image on a surface.
+/// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/bb173067">DXGI_MODE_SCANLINE_ORDER enumeration on MSDN</a>,
+enum SCANLINE_ORDER
+{
+ /// Scanline order is unspecified
+ /// D3D Counterpart: DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED.
+ SCANLINE_ORDER_UNSPECIFIED = 0,
- /// Display format
- TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
+ /// The image is created from the first scanline to the last without skipping any
+ /// D3D Counterpart: DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE.
+ SCANLINE_ORDER_PROGRESSIVE = 1,
- /// Refresh rate numerator
- Uint32 RefreshRateNumerator = 0;
+ /// The image is created beginning with the upper field
+ /// D3D Counterpart: DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST.
+ SCANLINE_ORDER_UPPER_FIELD_FIRST = 2,
- /// Refresh rate denominator
- Uint32 RefreshRateDenominator = 0;
+ /// The image is created beginning with the lower field
+ /// D3D Counterpart: DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST.
+ SCANLINE_ORDER_LOWER_FIELD_FIRST = 3
+};
- /// The scanline drawing mode.
- SCALING Scaling = SCALING_UNSPECIFIED;
+/// Display mode attributes
+struct DisplayModeAttribs
+{
+ /// Display resolution width
+ Uint32 Width DEFAULT_INITIALIZER(0);
- /// The scaling mode.
- SCANLINE_ORDER ScanlineOrder = SCANLINE_ORDER_UNSPECIFIED;
- };
+ /// Display resolution height
+ Uint32 Height DEFAULT_INITIALIZER(0);
- /// Defines allowed swap chain usage flags
- enum SWAP_CHAIN_USAGE_FLAGS : Uint32
- {
- /// No allowed usage
- SWAP_CHAIN_USAGE_NONE = 0x00L,
+ /// Display format
+ TEXTURE_FORMAT Format DEFAULT_INITIALIZER(TEX_FORMAT_UNKNOWN);
+
+ /// Refresh rate numerator
+ Uint32 RefreshRateNumerator DEFAULT_INITIALIZER(0);
+
+ /// Refresh rate denominator
+ Uint32 RefreshRateDenominator DEFAULT_INITIALIZER(0);
+
+ /// The scanline drawing mode.
+ enum SCALING_MODE Scaling DEFAULT_INITIALIZER(SCALING_MODE_UNSPECIFIED);
+
+ /// The scaling mode.
+ enum SCANLINE_ORDER ScanlineOrder DEFAULT_INITIALIZER(SCANLINE_ORDER_UNSPECIFIED);
+};
+
+/// Defines allowed swap chain usage flags
+DILIGENT_TYPED_ENUM(SWAP_CHAIN_USAGE_FLAGS, Uint32)
+{
+ /// No allowed usage
+ SWAP_CHAIN_USAGE_NONE = 0x00L,
- /// Swap chain can be used as render target ouput
- SWAP_CHAIN_USAGE_RENDER_TARGET = 0x01L,
+ /// Swap chain can be used as render target ouput
+ SWAP_CHAIN_USAGE_RENDER_TARGET = 0x01L,
- /// Swap chain images can be used as shader inputs
- SWAP_CHAIN_USAGE_SHADER_INPUT = 0x02L,
+ /// Swap chain images can be used as shader inputs
+ SWAP_CHAIN_USAGE_SHADER_INPUT = 0x02L,
- /// Swap chain images can be used as source of copy operation
- SWAP_CHAIN_USAGE_COPY_SOURCE = 0x04L
- };
- DEFINE_FLAG_ENUM_OPERATORS(SWAP_CHAIN_USAGE_FLAGS)
+ /// Swap chain images can be used as source of copy operation
+ SWAP_CHAIN_USAGE_COPY_SOURCE = 0x04L
+};
+DEFINE_FLAG_ENUM_OPERATORS(SWAP_CHAIN_USAGE_FLAGS)
- /// Swap chain description
- struct SwapChainDesc
- {
- /// The swap chain width. Default value is 0
- Uint32 Width = 0;
-
- /// The swap chain height. Default value is 0
- Uint32 Height = 0;
-
- /// Back buffer format. Default value is Diligent::TEX_FORMAT_RGBA8_UNORM_SRGB
- TEXTURE_FORMAT ColorBufferFormat = TEX_FORMAT_RGBA8_UNORM_SRGB;
-
- /// Depth buffer format. Default value is Diligent::TEX_FORMAT_D32_FLOAT.
- /// Use Diligent::TEX_FORMAT_UNKNOWN to create the swap chain without depth buffer.
- TEXTURE_FORMAT DepthBufferFormat = TEX_FORMAT_D32_FLOAT;
-
- /// Swap chain usage flags. Default value is Diligent::SWAP_CHAIN_USAGE_RENDER_TARGET
- SWAP_CHAIN_USAGE_FLAGS Usage = SWAP_CHAIN_USAGE_RENDER_TARGET;
-
- /// Number of buffers int the swap chain
- Uint32 BufferCount = 2;
-
- /// Default depth value, which is used as optimized depth clear value in D3D12
- Float32 DefaultDepthValue = 1.f;
-
- /// Default stencil value, which is used as optimized stencil clear value in D3D12
- Uint8 DefaultStencilValue = 0;
-
- /// Indicates if this is a primary swap chain. When Present() is called
- /// for the primary swap chain, the engine releases stale resources.
- bool IsPrimary = true;
-
- SwapChainDesc()noexcept{}
-
- /// Constructor intializes the structure members with default values
- SwapChainDesc(Uint32 _Width,
- Uint32 _Height,
- TEXTURE_FORMAT _ColorBufferFormat,
- TEXTURE_FORMAT _DepthBufferFormat,
- Uint32 _BufferCount = SwapChainDesc{}.BufferCount,
- Float32 _DefaultDepthValue = SwapChainDesc{}.DefaultDepthValue,
- Uint8 _DefaultStencilValue = SwapChainDesc{}.DefaultStencilValue,
- bool _IsPrimary = SwapChainDesc{}.IsPrimary) :
- Width {_Width },
- Height {_Height },
- ColorBufferFormat {_ColorBufferFormat },
- DepthBufferFormat {_DepthBufferFormat },
- BufferCount {_BufferCount },
- DefaultDepthValue {_DefaultDepthValue },
- DefaultStencilValue {_DefaultStencilValue},
- IsPrimary {_IsPrimary }
- {}
- };
-
- /// Full screen mode description
- /// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh404531(v=vs.85).aspx">DXGI_SWAP_CHAIN_FULLSCREEN_DESC structure on MSDN</a>,
- struct FullScreenModeDesc
- {
- /// A Boolean value that specifies whether the swap chain is in fullscreen mode.
- Bool Fullscreen = False;
+/// Swap chain description
+struct SwapChainDesc
+{
+ /// The swap chain width. Default value is 0
+ Uint32 Width DEFAULT_INITIALIZER(0);
+
+ /// The swap chain height. Default value is 0
+ Uint32 Height DEFAULT_INITIALIZER(0);
+
+ /// Back buffer format. Default value is Diligent::TEX_FORMAT_RGBA8_UNORM_SRGB
+ TEXTURE_FORMAT ColorBufferFormat DEFAULT_INITIALIZER(TEX_FORMAT_RGBA8_UNORM_SRGB);
+
+ /// Depth buffer format. Default value is Diligent::TEX_FORMAT_D32_FLOAT.
+ /// Use Diligent::TEX_FORMAT_UNKNOWN to create the swap chain without depth buffer.
+ TEXTURE_FORMAT DepthBufferFormat DEFAULT_INITIALIZER(TEX_FORMAT_D32_FLOAT);
+
+ /// Swap chain usage flags. Default value is Diligent::SWAP_CHAIN_USAGE_RENDER_TARGET
+ SWAP_CHAIN_USAGE_FLAGS Usage DEFAULT_INITIALIZER(SWAP_CHAIN_USAGE_RENDER_TARGET);
+
+ /// Number of buffers int the swap chain
+ Uint32 BufferCount DEFAULT_INITIALIZER(2);
+
+ /// Default depth value, which is used as optimized depth clear value in D3D12
+ Float32 DefaultDepthValue DEFAULT_INITIALIZER(1.f);
+
+ /// Default stencil value, which is used as optimized stencil clear value in D3D12
+ Uint8 DefaultStencilValue DEFAULT_INITIALIZER(0);
+
+ /// Indicates if this is a primary swap chain. When Present() is called
+ /// for the primary swap chain, the engine releases stale resources.
+ bool IsPrimary DEFAULT_INITIALIZER(true);
+
+#if DILIGENT_CPP_INTERFACE
+ SwapChainDesc()noexcept{}
+
+ /// Constructor intializes the structure members with default values
+ SwapChainDesc(Uint32 _Width,
+ Uint32 _Height,
+ TEXTURE_FORMAT _ColorBufferFormat,
+ TEXTURE_FORMAT _DepthBufferFormat,
+ Uint32 _BufferCount = SwapChainDesc{}.BufferCount,
+ Float32 _DefaultDepthValue = SwapChainDesc{}.DefaultDepthValue,
+ Uint8 _DefaultStencilValue = SwapChainDesc{}.DefaultStencilValue,
+ bool _IsPrimary = SwapChainDesc{}.IsPrimary) :
+ Width {_Width },
+ Height {_Height },
+ ColorBufferFormat {_ColorBufferFormat },
+ DepthBufferFormat {_DepthBufferFormat },
+ BufferCount {_BufferCount },
+ DefaultDepthValue {_DefaultDepthValue },
+ DefaultStencilValue {_DefaultStencilValue},
+ IsPrimary {_IsPrimary }
+ {}
+#endif
+};
- /// Refresh rate numerator
- Uint32 RefreshRateNumerator = 0;
+/// Full screen mode description
+/// \sa <a href = "https://msdn.microsoft.com/en-us/library/windows/desktop/hh404531(v=vs.85).aspx">DXGI_SWAP_CHAIN_FULLSCREEN_DESC structure on MSDN</a>,
+struct FullScreenModeDesc
+{
+ /// A Boolean value that specifies whether the swap chain is in fullscreen mode.
+ Bool Fullscreen DEFAULT_INITIALIZER(False);
- /// Refresh rate denominator
- Uint32 RefreshRateDenominator = 0;
+ /// Refresh rate numerator
+ Uint32 RefreshRateNumerator DEFAULT_INITIALIZER(0);
- /// The scanline drawing mode.
- DisplayModeAttribs::SCALING Scaling = DisplayModeAttribs::SCALING_UNSPECIFIED;
+ /// Refresh rate denominator
+ Uint32 RefreshRateDenominator DEFAULT_INITIALIZER(0);
- /// The scaling mode.
- DisplayModeAttribs::SCANLINE_ORDER ScanlineOrder = DisplayModeAttribs::SCANLINE_ORDER_UNSPECIFIED;
- };
+ /// The scanline drawing mode.
+ enum SCALING_MODE Scaling DEFAULT_INITIALIZER(SCALING_MODE_UNSPECIFIED);
- /// Engine creation attibutes
- struct EngineCreateInfo
- {
- /// API version number.
- Int32 APIVersion = DILIGENT_API_VERSION;
+ /// The scaling mode.
+ enum SCANLINE_ORDER ScanlineOrder DEFAULT_INITIALIZER(SCANLINE_ORDER_UNSPECIFIED);
+};
- /// Pointer to the raw memory allocator that will be used for all memory allocation/deallocation
- /// operations in the engine
- class IMemoryAllocator* pRawMemAllocator = nullptr;
+/// Engine creation attibutes
+struct EngineCreateInfo
+{
+ /// API version number.
+ Int32 APIVersion DEFAULT_INITIALIZER(DILIGENT_API_VERSION);
- /// Pointer to the user-specified debug message callback function
- DebugMessageCallbackType DebugMessageCallback = nullptr;
+ /// Pointer to the raw memory allocator that will be used for all memory allocation/deallocation
+ /// operations in the engine
+ class IMemoryAllocator* pRawMemAllocator DEFAULT_INITIALIZER(nullptr);
- /// Number of deferred contexts to create when initializing the engine. If non-zero number
- /// is given, pointers to the contexts are written to ppContexts array by the engine factory
- /// functions (IEngineFactoryD3D11::CreateDeviceAndContextsD3D11,
- /// IEngineFactoryD3D12::CreateDeviceAndContextsD3D12, and IEngineFactoryVk::CreateDeviceAndContextsVk)
- /// starting at position 1.
- Uint32 NumDeferredContexts = 0;
- };
+ /// Pointer to the user-specified debug message callback function
+ DebugMessageCallbackType DebugMessageCallback DEFAULT_INITIALIZER(nullptr);
+ /// Number of deferred contexts to create when initializing the engine. If non-zero number
+ /// is given, pointers to the contexts are written to ppContexts array by the engine factory
+ /// functions (IEngineFactoryD3D11::CreateDeviceAndContextsD3D11,
+ /// IEngineFactoryD3D12::CreateDeviceAndContextsD3D12, and IEngineFactoryVk::CreateDeviceAndContextsVk)
+ /// starting at position 1.
+ Uint32 NumDeferredContexts DEFAULT_INITIALIZER(0);
+};
- /// Attributes of the OpenGL-based engine implementation
- struct EngineGLCreateInfo : public EngineCreateInfo
- {
- /// Native window handle
- /// * On Win32 platform, this is a window handle (HWND)
- /// * On Android platform, this is a pointer to the native window (ANativeWindow*)
- /// * On Linux, this is the native window (Window)
- void* pNativeWndHandle = nullptr;
+/// Attributes of the OpenGL-based engine implementation
+struct EngineGLCreateInfo DILIGENT_DERIVE(EngineCreateInfo)
+
+ /// Native window handle
+
+ /// * On Win32 platform, this is a window handle (HWND)
+ /// * On Android platform, this is a pointer to the native window (ANativeWindow*)
+ /// * On Linux, this is the native window (Window)
+ void* pNativeWndHandle DEFAULT_INITIALIZER(nullptr);
#if PLATFORM_LINUX
- /// For linux platform only, this is the pointer to the display
- void* pDisplay = nullptr;
+ /// For linux platform only, this is the pointer to the display
+ void* pDisplay DEFAULT_INITIALIZER(nullptr);
#endif
- };
+};
- /// Debug flags that can be specified when creating Direct3D11-based engine implementation.
- ///
- /// \sa CreateDeviceAndContextsD3D11Type, CreateSwapChainD3D11Type, LoadGraphicsEngineD3D11
- enum D3D11_DEBUG_FLAGS : Uint32
- {
- /// No debug flag
- D3D11_DEBUG_FLAG_NONE = 0x00,
+/// Debug flags that can be specified when creating Direct3D11-based engine implementation.
+///
+/// \sa CreateDeviceAndContextsD3D11Type, CreateSwapChainD3D11Type, LoadGraphicsEngineD3D11
+DILIGENT_TYPED_ENUM(D3D11_DEBUG_FLAGS, Uint32)
+{
+ /// No debug flag
+ D3D11_DEBUG_FLAG_NONE = 0x00,
- /// Whether to create Direct3D11 debug device
- D3D11_DEBUG_FLAG_CREATE_DEBUG_DEVICE = 0x01,
+ /// Whether to create Direct3D11 debug device
+ D3D11_DEBUG_FLAG_CREATE_DEBUG_DEVICE = 0x01,
- /// Before executing draw/dispatch command, verify that
- /// all required shader resources are bound to the device context
- D3D11_DEBUG_FLAG_VERIFY_COMMITTED_SHADER_RESOURCES = 0x02,
+ /// Before executing draw/dispatch command, verify that
+ /// all required shader resources are bound to the device context
+ D3D11_DEBUG_FLAG_VERIFY_COMMITTED_SHADER_RESOURCES = 0x02,
- /// Verify that all committed cotext resources are relevant,
- /// i.e. they are consistent with the committed resource cache.
- /// This is very expensive and should generally not be necessary.
- D3D11_DEBUG_FLAG_VERIFY_COMMITTED_RESOURCE_RELEVANCE = 0x04
- };
- DEFINE_FLAG_ENUM_OPERATORS(D3D11_DEBUG_FLAGS)
+ /// Verify that all committed cotext resources are relevant,
+ /// i.e. they are consistent with the committed resource cache.
+ /// This is very expensive and should generally not be necessary.
+ D3D11_DEBUG_FLAG_VERIFY_COMMITTED_RESOURCE_RELEVANCE = 0x04
+};
+DEFINE_FLAG_ENUM_OPERATORS(D3D11_DEBUG_FLAGS)
- /// Direct3D11/12 feature level
- enum DIRECT3D_FEATURE_LEVEL : Uint8
- {
- /// Feature level 10.0
- DIRECT3D_FEATURE_LEVEL_10_0,
+/// Direct3D11/12 feature level
+DILIGENT_TYPED_ENUM(DIRECT3D_FEATURE_LEVEL, Uint8)
+{
+ /// Feature level 10.0
+ DIRECT3D_FEATURE_LEVEL_10_0,
- /// Feature level 10.1
- DIRECT3D_FEATURE_LEVEL_10_1,
+ /// Feature level 10.1
+ DIRECT3D_FEATURE_LEVEL_10_1,
- /// Feature level 11.0
- DIRECT3D_FEATURE_LEVEL_11_0,
+ /// Feature level 11.0
+ DIRECT3D_FEATURE_LEVEL_11_0,
- /// Feature level 11.1
- DIRECT3D_FEATURE_LEVEL_11_1,
+ /// Feature level 11.1
+ DIRECT3D_FEATURE_LEVEL_11_1,
- /// Feature level 12.0
- DIRECT3D_FEATURE_LEVEL_12_0,
+ /// Feature level 12.0
+ DIRECT3D_FEATURE_LEVEL_12_0,
- /// Feature level 12.1
- DIRECT3D_FEATURE_LEVEL_12_1
- };
+ /// Feature level 12.1
+ DIRECT3D_FEATURE_LEVEL_12_1
+};
- /// Attributes specific to D3D11 engine
- struct EngineD3D11CreateInfo : public EngineCreateInfo
- {
- static constexpr Uint32 DefaultAdapterId = 0xFFFFFFFF;
-
- /// Id of the hardware adapter the engine should be initialized on.
- Uint32 AdapterId = DefaultAdapterId;
+static const Uint32 DEFAULT_ADAPTER_ID = 0xFFFFFFFFU;
- /// Minimum required Direct3D feature level.
- DIRECT3D_FEATURE_LEVEL MinimumFeatureLevel = DIRECT3D_FEATURE_LEVEL_11_0;
+/// Attributes specific to D3D11 engine
+struct EngineD3D11CreateInfo DILIGENT_DERIVE(EngineCreateInfo)
+
+ /// Id of the hardware adapter the engine should be initialized on.
+ Uint32 AdapterId DEFAULT_INITIALIZER(DEFAULT_ADAPTER_ID);
- /// Debug flags. See Diligent::D3D11_DEBUG_FLAGS for a list of allowed values.
- ///
- /// \sa CreateDeviceAndContextsD3D11Type, CreateSwapChainD3D11Type, LoadGraphicsEngineD3D11
- D3D11_DEBUG_FLAGS DebugFlags = D3D11_DEBUG_FLAG_NONE;
- };
+ /// Minimum required Direct3D feature level.
+ DIRECT3D_FEATURE_LEVEL MinimumFeatureLevel DEFAULT_INITIALIZER(DIRECT3D_FEATURE_LEVEL_11_0);
- /// Attributes specific to D3D12 engine
- struct EngineD3D12CreateInfo : public EngineCreateInfo
- {
- /// Name of the D3D12 DLL to load. Ignored on UWP.
- const char* D3D12DllName = "d3d12.dll";
+ /// Debug flags. See Diligent::D3D11_DEBUG_FLAGS for a list of allowed values.
+ ///
+ /// \sa CreateDeviceAndContextsD3D11Type, CreateSwapChainD3D11Type, LoadGraphicsEngineD3D11
+ D3D11_DEBUG_FLAGS DebugFlags DEFAULT_INITIALIZER(D3D11_DEBUG_FLAG_NONE);
+};
- static constexpr Uint32 DefaultAdapterId = 0xFFFFFFFF;
+/// Attributes specific to D3D12 engine
+struct EngineD3D12CreateInfo DILIGENT_DERIVE(EngineCreateInfo)
- /// Id of the hardware adapter the engine should be initialized on.
- Uint32 AdapterId = DefaultAdapterId;
+ /// Name of the D3D12 DLL to load. Ignored on UWP.
+ const char* D3D12DllName DEFAULT_INITIALIZER("d3d12.dll");
- /// Minimum required Direct3D feature level.
- DIRECT3D_FEATURE_LEVEL MinimumFeatureLevel = DIRECT3D_FEATURE_LEVEL_11_0;
+ /// Id of the hardware adapter the engine should be initialized on.
+ Uint32 AdapterId DEFAULT_INITIALIZER(DEFAULT_ADAPTER_ID);
- /// Enable Direct3D12 debug layer.
- bool EnableDebugLayer = false;
+ /// Minimum required Direct3D feature level.
+ DIRECT3D_FEATURE_LEVEL MinimumFeatureLevel DEFAULT_INITIALIZER(DIRECT3D_FEATURE_LEVEL_11_0);
- /// Enable validation on the GPU timeline.
- /// See https://docs.microsoft.com/en-us/windows/win32/direct3d12/using-d3d12-debug-layer-gpu-based-validation
- /// This flag only has effect if EnableDebugLayer is true.
- /// \note Enabling this option may slow things down a lot.
- bool EnableGPUBasedValidation = false;
+ /// Enable Direct3D12 debug layer.
+ bool EnableDebugLayer DEFAULT_INITIALIZER(false);
- /// Whether to break execution when D3D12 debug layer detects an error.
- /// This flag only has effect if EnableDebugLayer is true.
- bool BreakOnError = false;
+ /// Enable validation on the GPU timeline.
+ /// See https://docs.microsoft.com/en-us/windows/win32/direct3d12/using-d3d12-debug-layer-gpu-based-validation
+ /// This flag only has effect if EnableDebugLayer is true.
+ /// \note Enabling this option may slow things down a lot.
+ bool EnableGPUBasedValidation DEFAULT_INITIALIZER(false);
- /// Whether to break execution when D3D12 debug layer detects a memory corruption.
- /// This flag only has effect if EnableDebugLayer is true.
- bool BreakOnCorruption = true;
+ /// Whether to break execution when D3D12 debug layer detects an error.
+ /// This flag only has effect if EnableDebugLayer is true.
+ bool BreakOnError DEFAULT_INITIALIZER(false);
- /// Size of the CPU descriptor heap allocations for different heap types.
- Uint32 CPUDescriptorHeapAllocationSize[4] =
+ /// Whether to break execution when D3D12 debug layer detects a memory corruption.
+ /// This flag only has effect if EnableDebugLayer is true.
+ bool BreakOnCorruption DEFAULT_INITIALIZER(true);
+
+ /// Size of the CPU descriptor heap allocations for different heap types.
+ Uint32 CPUDescriptorHeapAllocationSize[4]
+#if DILIGENT_CPP_INTERFACE
{
8192, // D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV
2048, // D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER
1024, // D3D12_DESCRIPTOR_HEAP_TYPE_RTV
1024 // D3D12_DESCRIPTOR_HEAP_TYPE_DSV
- };
+ }
+#endif
+ ;
- /// Size of the GPU descriptor heap allocations for different heap types.
- Uint32 GPUDescriptorHeapSize[2] =
+ /// Size of the GPU descriptor heap allocations for different heap types.
+ Uint32 GPUDescriptorHeapSize[2]
+#if DILIGENT_CPP_INTERFACE
{
16384, // D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV
1024 // D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER
- };
+ }
+#endif
+ ;
- /// Size of the dynamic GPU descriptor heap region for different heap types.
- Uint32 GPUDescriptorHeapDynamicSize[2] =
+ /// Size of the dynamic GPU descriptor heap region for different heap types.
+ Uint32 GPUDescriptorHeapDynamicSize[2]
+#if DILIGENT_CPP_INTERFACE
{
8192, // D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV
1024 // D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER
- };
+ }
+#endif
+ ;
- /// This is the size of the chunk that dynamic descriptor allocations manager
- /// request from the main GPU descriptor heap.
- Uint32 DynamicDescriptorAllocationChunkSize[2] =
+ /// This is the size of the chunk that dynamic descriptor allocations manager
+ /// request from the main GPU descriptor heap.
+ Uint32 DynamicDescriptorAllocationChunkSize[2]
+#if DILIGENT_CPP_INTERFACE
{
256, // D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV
32 // D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER
- };
-
- /// Number of commands to flush the command list. Only draw/dispatch commands count
- /// towards the limit. Command lists are only flushed when pipeline state is changed
- /// or when backbuffer is presented.
- Uint32 NumCommandsToFlushCmdList = 256;
-
- /// A device context uses dynamic heap when it needs to allocate temporary
- /// CPU-accessible memory to update a resource via IBufer::UpdateData() or
- /// ITexture::UpdateData(), or to map dynamic resources.
- /// Device contexts first request a chunk of memory from global dynamic
- /// resource manager and then suballocate from this chunk in a lock-free
- /// fashion. DynamicHeapPageSize defines the size of this chunk.
- Uint32 DynamicHeapPageSize = 1 << 20;
-
- /// Number of dynamic heap pages that will be reserved by the
- /// global dynamic heap manager to avoid page creation at run time.
- Uint32 NumDynamicHeapPagesToReserve = 1;
-
- /// Query pool size for each query type.
- Uint32 QueryPoolSizes[5] =
+ }
+#endif
+ ;
+
+ /// Number of commands to flush the command list. Only draw/dispatch commands count
+ /// towards the limit. Command lists are only flushed when pipeline state is changed
+ /// or when backbuffer is presented.
+ Uint32 NumCommandsToFlushCmdList DEFAULT_INITIALIZER(256);
+
+ /// A device context uses dynamic heap when it needs to allocate temporary
+ /// CPU-accessible memory to update a resource via IBufer::UpdateData() or
+ /// ITexture::UpdateData(), or to map dynamic resources.
+ /// Device contexts first request a chunk of memory from global dynamic
+ /// resource manager and then suballocate from this chunk in a lock-free
+ /// fashion. DynamicHeapPageSize defines the size of this chunk.
+ Uint32 DynamicHeapPageSize DEFAULT_INITIALIZER(1 << 20);
+
+ /// Number of dynamic heap pages that will be reserved by the
+ /// global dynamic heap manager to avoid page creation at run time.
+ Uint32 NumDynamicHeapPagesToReserve DEFAULT_INITIALIZER(1);
+
+ /// Query pool size for each query type.
+ Uint32 QueryPoolSizes[5]
+#if DILIGENT_CPP_INTERFACE
{
0, // Ignored
128, // QUERY_TYPE_OCCLUSION
128, // QUERY_TYPE_BINARY_OCCLUSION
512, // QUERY_TYPE_TIMESTAMP
128 // QUERY_TYPE_PIPELINE_STATISTICS
- };
- };
+ }
+#endif
+ ;
+};
- /// Attributes specific to Vulkan engine
- struct EngineVkCreateInfo : public EngineCreateInfo
+/// Descriptor pool size
+struct VulkanDescriptorPoolSize
+{
+ Uint32 MaxDescriptorSets DEFAULT_INITIALIZER(0);
+ Uint32 NumSeparateSamplerDescriptors DEFAULT_INITIALIZER(0);
+ Uint32 NumCombinedSamplerDescriptors DEFAULT_INITIALIZER(0);
+ Uint32 NumSampledImageDescriptors DEFAULT_INITIALIZER(0);
+ Uint32 NumStorageImageDescriptors DEFAULT_INITIALIZER(0);
+ Uint32 NumUniformBufferDescriptors DEFAULT_INITIALIZER(0);
+ Uint32 NumStorageBufferDescriptors DEFAULT_INITIALIZER(0);
+ Uint32 NumUniformTexelBufferDescriptors DEFAULT_INITIALIZER(0);
+ Uint32 NumStorageTexelBufferDescriptors DEFAULT_INITIALIZER(0);
+
+#if DILIGENT_CPP_INTERFACE
+ VulkanDescriptorPoolSize()noexcept {}
+
+ VulkanDescriptorPoolSize(Uint32 _MaxDescriptorSets,
+ Uint32 _NumSeparateSamplerDescriptors,
+ Uint32 _NumCombinedSamplerDescriptors,
+ Uint32 _NumSampledImageDescriptors,
+ Uint32 _NumStorageImageDescriptors,
+ Uint32 _NumUniformBufferDescriptors,
+ Uint32 _NumStorageBufferDescriptors,
+ Uint32 _NumUniformTexelBufferDescriptors,
+ Uint32 _NumStorageTexelBufferDescriptors)noexcept :
+ MaxDescriptorSets {_MaxDescriptorSets },
+ NumSeparateSamplerDescriptors {_NumSeparateSamplerDescriptors },
+ NumCombinedSamplerDescriptors {_NumCombinedSamplerDescriptors },
+ NumSampledImageDescriptors {_NumSampledImageDescriptors },
+ NumStorageImageDescriptors {_NumStorageImageDescriptors },
+ NumUniformBufferDescriptors {_NumUniformBufferDescriptors },
+ NumStorageBufferDescriptors {_NumStorageBufferDescriptors },
+ NumUniformTexelBufferDescriptors{_NumUniformTexelBufferDescriptors},
+ NumStorageTexelBufferDescriptors{_NumStorageTexelBufferDescriptors}
{
- /// Enable Vulkan validation layers.
- bool EnableValidation = false;
+ // On clang aggregate initialization fails to compile if
+ // structure members have default initializers
+ }
+#endif
+};
+
+/// Attributes specific to Vulkan engine
+struct EngineVkCreateInfo DILIGENT_DERIVE(EngineCreateInfo)
+
+ /// Enable Vulkan validation layers.
+ bool EnableValidation DEFAULT_INITIALIZER(false);
- /// Number of global Vulkan extensions
- Uint32 GlobalExtensionCount = 0;
+ /// Number of global Vulkan extensions
+ Uint32 GlobalExtensionCount DEFAULT_INITIALIZER(0);
- /// List of global Vulkan extensions to enable.
- const char* const* ppGlobalExtensionNames = nullptr;
+ /// List of global Vulkan extensions to enable.
+ const char* const* ppGlobalExtensionNames DEFAULT_INITIALIZER(nullptr);
- /// Allocator used as pAllocator parameter in callse to Vulkan Create* functions
- void* pVkAllocator = nullptr;
+ /// Allocator used as pAllocator parameter in callse to Vulkan Create* functions
+ void* pVkAllocator DEFAULT_INITIALIZER(nullptr);
- /// Number of commands to flush the command buffer. Only draw/dispatch commands count
- /// towards the limit. Command buffers are only flushed when pipeline state is changed
- /// or when backbuffer is presented.
- Uint32 NumCommandsToFlushCmdBuffer = 256;
+ /// Number of commands to flush the command buffer. Only draw/dispatch commands count
+ /// towards the limit. Command buffers are only flushed when pipeline state is changed
+ /// or when backbuffer is presented.
+ Uint32 NumCommandsToFlushCmdBuffer DEFAULT_INITIALIZER(256);
+
+ /// Size of the main descriptor pool that is used to allocate descriptor sets
+ /// for static and mutable variables. If allocation from the current pool fails,
+ /// the engine creates another one.
+ struct VulkanDescriptorPoolSize MainDescriptorPoolSize
+#if DILIGENT_CPP_INTERFACE
+ //Max SepSm CmbSm SmpImg StrImg UB SB UTxB StTxB
+ {8192, 1024, 8192, 8192, 1024, 4096, 4096, 1024, 1024}
+#endif
+ ;
- /// Descriptor pool size
- struct DescriptorPoolSize
- {
- Uint32 MaxDescriptorSets = 0;
- Uint32 NumSeparateSamplerDescriptors = 0;
- Uint32 NumCombinedSamplerDescriptors = 0;
- Uint32 NumSampledImageDescriptors = 0;
- Uint32 NumStorageImageDescriptors = 0;
- Uint32 NumUniformBufferDescriptors = 0;
- Uint32 NumStorageBufferDescriptors = 0;
- Uint32 NumUniformTexelBufferDescriptors = 0;
- Uint32 NumStorageTexelBufferDescriptors = 0;
-
- DescriptorPoolSize()noexcept {}
-
- DescriptorPoolSize( Uint32 _MaxDescriptorSets,
- Uint32 _NumSeparateSamplerDescriptors,
- Uint32 _NumCombinedSamplerDescriptors,
- Uint32 _NumSampledImageDescriptors,
- Uint32 _NumStorageImageDescriptors,
- Uint32 _NumUniformBufferDescriptors,
- Uint32 _NumStorageBufferDescriptors,
- Uint32 _NumUniformTexelBufferDescriptors,
- Uint32 _NumStorageTexelBufferDescriptors)noexcept :
- MaxDescriptorSets {_MaxDescriptorSets },
- NumSeparateSamplerDescriptors {_NumSeparateSamplerDescriptors },
- NumCombinedSamplerDescriptors {_NumCombinedSamplerDescriptors },
- NumSampledImageDescriptors {_NumSampledImageDescriptors },
- NumStorageImageDescriptors {_NumStorageImageDescriptors },
- NumUniformBufferDescriptors {_NumUniformBufferDescriptors },
- NumStorageBufferDescriptors {_NumStorageBufferDescriptors },
- NumUniformTexelBufferDescriptors{_NumUniformTexelBufferDescriptors},
- NumStorageTexelBufferDescriptors{_NumStorageTexelBufferDescriptors}
- {
- // On clang aggregate initialization fails to compile if
- // structure members have default initializers
- }
- };
-
- /// Size of the main descriptor pool that is used to allocate descriptor sets
- /// for static and mutable variables. If allocation from the current pool fails,
- /// the engine creates another one.
- // Max SepSm CmbSm SmpImg StrImg UB SB UTxB StTxB
- DescriptorPoolSize MainDescriptorPoolSize {8192, 1024, 8192, 8192, 1024, 4096, 4096, 1024, 1024};
-
- /// Size of the dynamic descriptor pool that is used to allocate descriptor sets
- /// for dynamic variables. Every device context has its own dynamic descriptor set allocator.
- /// The allocator requests pools from global dynamic descriptor pool manager, and then
- /// performs lock-free suballocations from the pool.
- // Max SepSm CmbSm SmpImg StrImg UB SB UTxB StTxB
- DescriptorPoolSize DynamicDescriptorPoolSize {2048, 256, 2048, 2048, 256, 1024, 1024, 256, 256};
-
- /// Allocation granularity for device-local memory
- Uint32 DeviceLocalMemoryPageSize = 16 << 20;
-
- /// Allocation granularity for host-visible memory
- Uint32 HostVisibleMemoryPageSize = 16 << 20;
-
- /// Amount of device-local memory reserved by the engine.
- /// The engine does not pre-allocate the memory, but rather keeps free
- /// pages when resources are released
- Uint32 DeviceLocalMemoryReserveSize = 256 << 20;
-
- /// Amount of host-visible memory reserved by the engine.
- /// The engine does not pre-allocate the memory, but rather keeps free
- /// pages when resources are released
- Uint32 HostVisibleMemoryReserveSize = 256 << 20;
-
- /// Page size of the upload heap that is allocated by immediate/deferred
- /// contexts from the global memory manager to perform lock-free dynamic
- /// suballocations.
- /// Upload heap is used to update resources with UpdateData()
- Uint32 UploadHeapPageSize = 1 << 20;
-
- /// Size of the dynamic heap (the buffer that is used to suballocate
- /// memory for dynamic resources) shared by all contexts.
- Uint32 DynamicHeapSize = 8 << 20;
-
- /// Size of the memory chunk suballocated by immediate/deferred context from
- /// the global dynamic heap to perform lock-free dynamic suballocations
- Uint32 DynamicHeapPageSize = 256 << 10;
-
- /// Query pool size for each query type.
- Uint32 QueryPoolSizes[5] =
- {
- 0, // Ignored
- 128, // QUERY_TYPE_OCCLUSION
- 128, // QUERY_TYPE_BINARY_OCCLUSION
- 512, // QUERY_TYPE_TIMESTAMP
- 128 // QUERY_TYPE_PIPELINE_STATISTICS
- };
- };
+ /// Size of the dynamic descriptor pool that is used to allocate descriptor sets
+ /// for dynamic variables. Every device context has its own dynamic descriptor set allocator.
+ /// The allocator requests pools from global dynamic descriptor pool manager, and then
+ /// performs lock-free suballocations from the pool.
+
+ struct VulkanDescriptorPoolSize DynamicDescriptorPoolSize
+#if DILIGENT_CPP_INTERFACE
+ //Max SepSm CmbSm SmpImg StrImg UB SB UTxB StTxB
+ {2048, 256, 2048, 2048, 256, 1024, 1024, 256, 256}
+#endif
+ ;
+ /// Allocation granularity for device-local memory
+ Uint32 DeviceLocalMemoryPageSize DEFAULT_INITIALIZER(16 << 20);
- /// Attributes of the Metal-based engine implementation
- struct EngineMtlCreateInfo : public EngineCreateInfo
- {
- };
+ /// Allocation granularity for host-visible memory
+ Uint32 HostVisibleMemoryPageSize DEFAULT_INITIALIZER(16 << 20);
+ /// Amount of device-local memory reserved by the engine.
+ /// The engine does not pre-allocate the memory, but rather keeps free
+ /// pages when resources are released
+ Uint32 DeviceLocalMemoryReserveSize DEFAULT_INITIALIZER(256 << 20);
- /// Box
- struct Box
- {
- Uint32 MinX = 0; ///< Minimal X coordinate. Default value is 0
- Uint32 MaxX = 0; ///< Maximal X coordinate. Default value is 0
- Uint32 MinY = 0; ///< Minimal Y coordinate. Default value is 0
- Uint32 MaxY = 0; ///< Maximal Y coordinate. Default value is 0
- Uint32 MinZ = 0; ///< Minimal Z coordinate. Default value is 0
- Uint32 MaxZ = 1; ///< Maximal Z coordinate. Default value is 1
-
- Box(Uint32 _MinX, Uint32 _MaxX,
- Uint32 _MinY, Uint32 _MaxY,
- Uint32 _MinZ, Uint32 _MaxZ) :
- MinX {_MinX},
- MaxX {_MaxX},
- MinY {_MinY},
- MaxY {_MaxY},
- MinZ {_MinZ},
- MaxZ {_MaxZ}
- {}
-
- Box(Uint32 _MinX, Uint32 _MaxX,
- Uint32 _MinY, Uint32 _MaxY) :
- Box{_MinX, _MaxX, _MinY, _MaxY, 0, 1}
- {}
-
- Box(Uint32 _MinX, Uint32 _MaxX) :
- Box{_MinX, _MaxX, 0, 0, 0, 1}
- {}
-
- Box(){}
- };
-
-
- /// Describes texture format component type
- enum COMPONENT_TYPE : Uint8
+ /// Amount of host-visible memory reserved by the engine.
+ /// The engine does not pre-allocate the memory, but rather keeps free
+ /// pages when resources are released
+ Uint32 HostVisibleMemoryReserveSize DEFAULT_INITIALIZER(256 << 20);
+
+ /// Page size of the upload heap that is allocated by immediate/deferred
+ /// contexts from the global memory manager to perform lock-free dynamic
+ /// suballocations.
+ /// Upload heap is used to update resources with UpdateData()
+ Uint32 UploadHeapPageSize DEFAULT_INITIALIZER(1 << 20);
+
+ /// Size of the dynamic heap (the buffer that is used to suballocate
+ /// memory for dynamic resources) shared by all contexts.
+ Uint32 DynamicHeapSize DEFAULT_INITIALIZER(8 << 20);
+
+ /// Size of the memory chunk suballocated by immediate/deferred context from
+ /// the global dynamic heap to perform lock-free dynamic suballocations
+ Uint32 DynamicHeapPageSize DEFAULT_INITIALIZER(256 << 10);
+
+ /// Query pool size for each query type.
+ Uint32 QueryPoolSizes[5]
+#if DILIGENT_CPP_INTERFACE
{
- /// Undefined component type
- COMPONENT_TYPE_UNDEFINED,
+ 0, // Ignored
+ 128, // QUERY_TYPE_OCCLUSION
+ 128, // QUERY_TYPE_BINARY_OCCLUSION
+ 512, // QUERY_TYPE_TIMESTAMP
+ 128 // QUERY_TYPE_PIPELINE_STATISTICS
+ }
+#endif
+ ;
+};
+
- /// Floating point component type
- COMPONENT_TYPE_FLOAT,
+/// Attributes of the Metal-based engine implementation
+struct EngineMtlCreateInfo DILIGENT_DERIVE(EngineCreateInfo)
- /// Signed-normalized-integer component type
- COMPONENT_TYPE_SNORM,
+};
- /// Unsigned-normalized-integer component type
- COMPONENT_TYPE_UNORM,
- /// Unsigned-normalized-integer sRGB component type
- COMPONENT_TYPE_UNORM_SRGB,
+/// Box
+struct Box
+{
+ Uint32 MinX DEFAULT_INITIALIZER(0); ///< Minimal X coordinate. Default value is 0
+ Uint32 MaxX DEFAULT_INITIALIZER(0); ///< Maximal X coordinate. Default value is 0
+ Uint32 MinY DEFAULT_INITIALIZER(0); ///< Minimal Y coordinate. Default value is 0
+ Uint32 MaxY DEFAULT_INITIALIZER(0); ///< Maximal Y coordinate. Default value is 0
+ Uint32 MinZ DEFAULT_INITIALIZER(0); ///< Minimal Z coordinate. Default value is 0
+ Uint32 MaxZ DEFAULT_INITIALIZER(1); ///< Maximal Z coordinate. Default value is 1
+
+#if DILIGENT_CPP_INTERFACE
+ Box(Uint32 _MinX, Uint32 _MaxX,
+ Uint32 _MinY, Uint32 _MaxY,
+ Uint32 _MinZ, Uint32 _MaxZ) noexcept:
+ MinX {_MinX},
+ MaxX {_MaxX},
+ MinY {_MinY},
+ MaxY {_MaxY},
+ MinZ {_MinZ},
+ MaxZ {_MaxZ}
+ {}
+
+ Box(Uint32 _MinX, Uint32 _MaxX,
+ Uint32 _MinY, Uint32 _MaxY) noexcept:
+ Box{_MinX, _MaxX, _MinY, _MaxY, 0, 1}
+ {}
+
+ Box(Uint32 _MinX, Uint32 _MaxX) noexcept:
+ Box{_MinX, _MaxX, 0, 0, 0, 1}
+ {}
+
+ Box() noexcept {}
+#endif
+};
- /// Signed-integer component type
- COMPONENT_TYPE_SINT,
- /// Unsigned-integer component type
- COMPONENT_TYPE_UINT,
+/// Describes texture format component type
+DILIGENT_TYPED_ENUM(COMPONENT_TYPE, Uint8)
+{
+ /// Undefined component type
+ COMPONENT_TYPE_UNDEFINED,
- /// Depth component type
- COMPONENT_TYPE_DEPTH,
+ /// Floating point component type
+ COMPONENT_TYPE_FLOAT,
- /// Depth-stencil component type
- COMPONENT_TYPE_DEPTH_STENCIL,
+ /// Signed-normalized-integer component type
+ COMPONENT_TYPE_SNORM,
- /// Compound component type (example texture formats: TEX_FORMAT_R11G11B10_FLOAT or TEX_FORMAT_RGB9E5_SHAREDEXP)
- COMPONENT_TYPE_COMPOUND,
+ /// Unsigned-normalized-integer component type
+ COMPONENT_TYPE_UNORM,
- /// Compressed component type
- COMPONENT_TYPE_COMPRESSED,
- };
+ /// Unsigned-normalized-integer sRGB component type
+ COMPONENT_TYPE_UNORM_SRGB,
- /// Describes invariant texture format attributes. These attributes are
- /// intrinsic to the texture format itself and do not depend on the
- /// format support.
- struct TextureFormatAttribs
- {
- /// Literal texture format name (for instance, for TEX_FORMAT_RGBA8_UNORM format, this
- /// will be "TEX_FORMAT_RGBA8_UNORM")
- const Char* Name = "TEX_FORMAT_UNKNOWN";
+ /// Signed-integer component type
+ COMPONENT_TYPE_SINT,
- /// Texture format, see Diligent::TEXTURE_FORMAT for a list of supported texture formats
- TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
+ /// Unsigned-integer component type
+ COMPONENT_TYPE_UINT,
- /// Size of one component in bytes (for instance, for TEX_FORMAT_RGBA8_UNORM format, this will be 1)
- /// For compressed formats, this is the block size in bytes (for TEX_FORMAT_BC1_UNORM format, this will be 8)
- Uint8 ComponentSize = 0;
+ /// Depth component type
+ COMPONENT_TYPE_DEPTH,
- /// Number of components
- Uint8 NumComponents = 0;
+ /// Depth-stencil component type
+ COMPONENT_TYPE_DEPTH_STENCIL,
- /// Component type, see Diligent::COMPONENT_TYPE for details.
- COMPONENT_TYPE ComponentType = COMPONENT_TYPE_UNDEFINED;
+ /// Compound component type (example texture formats: TEX_FORMAT_R11G11B10_FLOAT or TEX_FORMAT_RGB9E5_SHAREDEXP)
+ COMPONENT_TYPE_COMPOUND,
- /// Bool flag indicating if the format is a typeless format
- bool IsTypeless = false;
+ /// Compressed component type
+ COMPONENT_TYPE_COMPRESSED,
+};
- /// For block-compressed formats, compression block width
- Uint8 BlockWidth = 0;
+/// Describes invariant texture format attributes. These attributes are
+/// intrinsic to the texture format itself and do not depend on the
+/// format support.
+struct TextureFormatAttribs
+{
+ /// Literal texture format name (for instance, for TEX_FORMAT_RGBA8_UNORM format, this
+ /// will be "TEX_FORMAT_RGBA8_UNORM")
+ const Char* Name DEFAULT_INITIALIZER("TEX_FORMAT_UNKNOWN");
- /// For block-compressed formats, compression block height
- Uint8 BlockHeight = 0;
+ /// Texture format, see Diligent::TEXTURE_FORMAT for a list of supported texture formats
+ TEXTURE_FORMAT Format DEFAULT_INITIALIZER(TEX_FORMAT_UNKNOWN);
- /// For non-compressed formats, returns the texel size.
- /// For block-compressed formats, returns the block size.
- Uint32 GetElementSize() const
- {
- return Uint32{ComponentSize} * (ComponentType != COMPONENT_TYPE_COMPRESSED ? Uint32{NumComponents} : Uint32{1});
- }
+ /// Size of one component in bytes (for instance, for TEX_FORMAT_RGBA8_UNORM format, this will be 1)
+ /// For compressed formats, this is the block size in bytes (for TEX_FORMAT_BC1_UNORM format, this will be 8)
+ Uint8 ComponentSize DEFAULT_INITIALIZER(0);
- /// Initializes the structure
- TextureFormatAttribs( const Char* _Name,
- TEXTURE_FORMAT _Format,
- Uint8 _ComponentSize,
- Uint8 _NumComponents,
- COMPONENT_TYPE _ComponentType,
- bool _IsTypeless,
- Uint8 _BlockWidth,
- Uint8 _BlockHeight)noexcept :
- Name {_Name },
- Format {_Format },
- ComponentSize{_ComponentSize},
- NumComponents{_NumComponents},
- ComponentType{_ComponentType},
- IsTypeless {_IsTypeless },
- BlockWidth {_BlockWidth },
- BlockHeight {_BlockHeight }
- {
- }
+ /// Number of components
+ Uint8 NumComponents DEFAULT_INITIALIZER(0);
- TextureFormatAttribs()noexcept {}
- };
+ /// Component type, see Diligent::COMPONENT_TYPE for details.
+ COMPONENT_TYPE ComponentType DEFAULT_INITIALIZER(COMPONENT_TYPE_UNDEFINED);
- /// Basic texture format description
+ /// Bool flag indicating if the format is a typeless format
+ bool IsTypeless DEFAULT_INITIALIZER(false);
- /// This structure is returned by IRenderDevice::GetTextureFormatInfo()
- struct TextureFormatInfo : public TextureFormatAttribs
- {
- /// Indicates if the format is supported by the device
- bool Supported = false;
- };
+ /// For block-compressed formats, compression block width
+ Uint8 BlockWidth DEFAULT_INITIALIZER(0);
- /// Extended texture format description
+ /// For block-compressed formats, compression block height
+ Uint8 BlockHeight DEFAULT_INITIALIZER(0);
- /// This structure is returned by IRenderDevice::GetTextureFormatInfoExt()
- struct TextureFormatInfoExt : TextureFormatInfo
+#if DILIGENT_CPP_INTERFACE
+ /// For non-compressed formats, returns the texel size.
+ /// For block-compressed formats, returns the block size.
+ Uint32 GetElementSize() const
+ {
+ return Uint32{ComponentSize} * (ComponentType != COMPONENT_TYPE_COMPRESSED ? Uint32{NumComponents} : Uint32{1});
+ }
+
+ /// Initializes the structure
+ TextureFormatAttribs( const Char* _Name,
+ TEXTURE_FORMAT _Format,
+ Uint8 _ComponentSize,
+ Uint8 _NumComponents,
+ COMPONENT_TYPE _ComponentType,
+ bool _IsTypeless,
+ Uint8 _BlockWidth,
+ Uint8 _BlockHeight)noexcept :
+ Name {_Name },
+ Format {_Format },
+ ComponentSize{_ComponentSize},
+ NumComponents{_NumComponents},
+ ComponentType{_ComponentType},
+ IsTypeless {_IsTypeless },
+ BlockWidth {_BlockWidth },
+ BlockHeight {_BlockHeight }
{
- /// Indicates if the format can be filtered
- bool Filterable = false;
+ }
- /// Indicates if the format can be used as a render target format
- bool ColorRenderable = false;
+ TextureFormatAttribs()noexcept {}
+#endif
+};
- /// Indicates if the format can be used as a depth format
- bool DepthRenderable = false;
+/// Basic texture format description
- /// Indicates if the format can be used to create a 1D texture
- bool Tex1DFmt = false;
+/// This structure is returned by IRenderDevice::GetTextureFormatInfo()
+struct TextureFormatInfo DILIGENT_DERIVE(TextureFormatAttribs)
- /// Indicates if the format can be used to create a 2D texture
- bool Tex2DFmt = false;
+ /// Indicates if the format is supported by the device
+ bool Supported DEFAULT_INITIALIZER(false);
+};
- /// Indicates if the format can be used to create a 3D texture
- bool Tex3DFmt = false;
+/// Extended texture format description
- /// Indicates if the format can be used to create a cube texture
- bool TexCubeFmt = false;
+/// This structure is returned by IRenderDevice::GetTextureFormatInfoExt()
+struct TextureFormatInfoExt DILIGENT_DERIVE(TextureFormatInfo)
- /// A bitmask specifying all the supported sample counts for this texture format.
- /// If the format supports n samples, then (SampleCounts & n) != 0
- Uint32 SampleCounts = 0;
- };
+ /// Indicates if the format can be filtered
+ bool Filterable DEFAULT_INITIALIZER(false);
- /// Resource usage state
- enum RESOURCE_STATE : Uint32
- {
- /// The resource state is not known to the engine and is managed by the application
- RESOURCE_STATE_UNKNOWN = 0x0000,
+ /// Indicates if the format can be used as a render target format
+ bool ColorRenderable DEFAULT_INITIALIZER(false);
+
+ /// Indicates if the format can be used as a depth format
+ bool DepthRenderable DEFAULT_INITIALIZER(false);
+
+ /// Indicates if the format can be used to create a 1D texture
+ bool Tex1DFmt DEFAULT_INITIALIZER(false);
+
+ /// Indicates if the format can be used to create a 2D texture
+ bool Tex2DFmt DEFAULT_INITIALIZER(false);
+
+ /// Indicates if the format can be used to create a 3D texture
+ bool Tex3DFmt DEFAULT_INITIALIZER(false);
+
+ /// Indicates if the format can be used to create a cube texture
+ bool TexCubeFmt DEFAULT_INITIALIZER(false);
+
+ /// A bitmask specifying all the supported sample counts for this texture format.
+ /// If the format supports n samples, then (SampleCounts & n) != 0
+ Uint32 SampleCounts DEFAULT_INITIALIZER(0);
+};
+
+/// Resource usage state
+DILIGENT_TYPED_ENUM(RESOURCE_STATE, Uint32)
+{
+ /// The resource state is not known to the engine and is managed by the application
+ RESOURCE_STATE_UNKNOWN = 0x0000,
- /// The resource state is known to the engine, but is undefined. A resource is typically in an undefined state right after initialization.
- RESOURCE_STATE_UNDEFINED = 0x0001,
+ /// The resource state is known to the engine, but is undefined. A resource is typically in an undefined state right after initialization.
+ RESOURCE_STATE_UNDEFINED = 0x0001,
- /// The resource is accessed as vertex buffer
- RESOURCE_STATE_VERTEX_BUFFER = 0x0002,
+ /// The resource is accessed as vertex buffer
+ RESOURCE_STATE_VERTEX_BUFFER = 0x0002,
- /// The resource is accessed as constant (uniform) buffer
- RESOURCE_STATE_CONSTANT_BUFFER = 0x0004,
+ /// The resource is accessed as constant (uniform) buffer
+ RESOURCE_STATE_CONSTANT_BUFFER = 0x0004,
- /// The resource is accessed as index buffer
- RESOURCE_STATE_INDEX_BUFFER = 0x0008,
+ /// The resource is accessed as index buffer
+ RESOURCE_STATE_INDEX_BUFFER = 0x0008,
- /// The resource is accessed as render target
- RESOURCE_STATE_RENDER_TARGET = 0x0010,
+ /// The resource is accessed as render target
+ RESOURCE_STATE_RENDER_TARGET = 0x0010,
- /// The resource is used for unordered access
- RESOURCE_STATE_UNORDERED_ACCESS = 0x0020,
+ /// The resource is used for unordered access
+ RESOURCE_STATE_UNORDERED_ACCESS = 0x0020,
- /// The resource is used in a writable depth-stencil view or in clear operation
- RESOURCE_STATE_DEPTH_WRITE = 0x0040,
+ /// The resource is used in a writable depth-stencil view or in clear operation
+ RESOURCE_STATE_DEPTH_WRITE = 0x0040,
- /// The resource is used in a read-only depth-stencil view
- RESOURCE_STATE_DEPTH_READ = 0x0080,
+ /// The resource is used in a read-only depth-stencil view
+ RESOURCE_STATE_DEPTH_READ = 0x0080,
- /// The resource is accessed from a shader
- RESOURCE_STATE_SHADER_RESOURCE = 0x0100,
+ /// The resource is accessed from a shader
+ RESOURCE_STATE_SHADER_RESOURCE = 0x0100,
- /// The resource is used as the destination for stream output
- RESOURCE_STATE_STREAM_OUT = 0x0200,
+ /// The resource is used as the destination for stream output
+ RESOURCE_STATE_STREAM_OUT = 0x0200,
- /// The resource is used as indirect draw/dispatch arguments buffer
- RESOURCE_STATE_INDIRECT_ARGUMENT = 0x0400,
+ /// The resource is used as indirect draw/dispatch arguments buffer
+ RESOURCE_STATE_INDIRECT_ARGUMENT = 0x0400,
- /// The resource is used as the destination in a copy operation
- RESOURCE_STATE_COPY_DEST = 0x0800,
+ /// The resource is used as the destination in a copy operation
+ RESOURCE_STATE_COPY_DEST = 0x0800,
- /// The resource is used as the source in a copy operation
- RESOURCE_STATE_COPY_SOURCE = 0x1000,
+ /// The resource is used as the source in a copy operation
+ RESOURCE_STATE_COPY_SOURCE = 0x1000,
- /// The resource is used as the destination in a resolve operation
- RESOURCE_STATE_RESOLVE_DEST = 0x2000,
+ /// The resource is used as the destination in a resolve operation
+ RESOURCE_STATE_RESOLVE_DEST = 0x2000,
- /// The resource is used as the source in a resolve operation
- RESOURCE_STATE_RESOLVE_SOURCE = 0x4000,
+ /// The resource is used as the source in a resolve operation
+ RESOURCE_STATE_RESOLVE_SOURCE = 0x4000,
- /// The resource is used for present
- RESOURCE_STATE_PRESENT = 0x8000,
+ /// The resource is used for present
+ RESOURCE_STATE_PRESENT = 0x8000,
- RESOURCE_STATE_MAX_BIT = 0x8000,
+ RESOURCE_STATE_MAX_BIT = 0x8000,
- RESOURCE_STATE_GENERIC_READ = RESOURCE_STATE_VERTEX_BUFFER |
- RESOURCE_STATE_CONSTANT_BUFFER |
- RESOURCE_STATE_INDEX_BUFFER |
- RESOURCE_STATE_SHADER_RESOURCE |
- RESOURCE_STATE_INDIRECT_ARGUMENT |
- RESOURCE_STATE_COPY_SOURCE
- };
+ RESOURCE_STATE_GENERIC_READ = RESOURCE_STATE_VERTEX_BUFFER |
+ RESOURCE_STATE_CONSTANT_BUFFER |
+ RESOURCE_STATE_INDEX_BUFFER |
+ RESOURCE_STATE_SHADER_RESOURCE |
+ RESOURCE_STATE_INDIRECT_ARGUMENT |
+ RESOURCE_STATE_COPY_SOURCE
+};
- /// State transition barrier type
- enum STATE_TRANSITION_TYPE : Uint8
- {
- /// Perform state transition immediately.
- STATE_TRANSITION_TYPE_IMMEDIATE = 0,
-
- /// Begin split barrier. This mode only has effect in Direct3D12 backend, and corresponds to
- /// [D3D12_RESOURCE_BARRIER_FLAG_BEGIN_ONLY](https://docs.microsoft.com/en-us/windows/desktop/api/d3d12/ne-d3d12-d3d12_resource_barrier_flags)
- /// flag. See https://docs.microsoft.com/en-us/windows/desktop/direct3d12/using-resource-barriers-to-synchronize-resource-states-in-direct3d-12#split-barriers.
- /// In other backends, begin-split barriers are ignored.
- STATE_TRANSITION_TYPE_BEGIN,
-
- /// End split barrier. This mode only has effect in Direct3D12 backend, and corresponds to
- /// [D3D12_RESOURCE_BARRIER_FLAG_END_ONLY](https://docs.microsoft.com/en-us/windows/desktop/api/d3d12/ne-d3d12-d3d12_resource_barrier_flags)
- /// flag. See https://docs.microsoft.com/en-us/windows/desktop/direct3d12/using-resource-barriers-to-synchronize-resource-states-in-direct3d-12#split-barriers.
- /// In other backends, this mode is similar to STATE_TRANSITION_TYPE_IMMEDIATE.
- STATE_TRANSITION_TYPE_END
- };
-
- /// Resource state transition barrier description
- struct StateTransitionDesc
- {
- static constexpr const Uint32 RemainingMipLevels = static_cast<Uint32>(-1);
- static constexpr const Uint32 RemainingArraySlices = static_cast<Uint32>(-1);
-
- /// Texture to transition.
- /// \note Exactly one of pTexture or pBuffer must be non-null.
- ITexture* pTexture = nullptr;
-
- /// Buffer to transition.
- /// \note Exactly one of pTexture or pBuffer must be non-null.
- IBuffer* pBuffer = nullptr;
-
- /// When transitioning a texture, first mip level of the subresource range to transition.
- Uint32 FirstMipLevel = 0;
-
- /// When transitioning a texture, number of mip levels of the subresource range to transition.
- Uint32 MipLevelsCount = RemainingMipLevels;
-
- /// When transitioning a texture, first array slice of the subresource range to transition.
- Uint32 FirstArraySlice = 0;
-
- /// When transitioning a texture, number of array slices of the subresource range to transition.
- Uint32 ArraySliceCount = RemainingArraySlices;
-
- /// Resource state before transition. If this value is RESOURCE_STATE_UNKNOWN,
- /// internal resource state will be used, which must be defined in this case.
- RESOURCE_STATE OldState = RESOURCE_STATE_UNKNOWN;
-
- /// Resource state after transition.
- RESOURCE_STATE NewState = RESOURCE_STATE_UNKNOWN;
-
- /// State transition type, see Diligent::STATE_TRANSITION_TYPE.
-
- /// \note When issuing UAV barrier (i.e. OldState and NewState equal RESOURCE_STATE_UNORDERED_ACCESS),
- /// TransitionType must be STATE_TRANSITION_TYPE_IMMEDIATE.
- STATE_TRANSITION_TYPE TransitionType = STATE_TRANSITION_TYPE_IMMEDIATE;
-
- /// If set to true, the internal resource state will be set to NewState and the engine
- /// will be able to take over the resource state management. In this case it is the
- /// responsibility of the application to make sure that all subresources are indeed in
- /// designated state.
- /// If set to false, internal resource state will be unchanged.
- /// \note When TransitionType is STATE_TRANSITION_TYPE_BEGIN, this member must be false.
- bool UpdateResourceState = false;
-
- StateTransitionDesc()noexcept{}
-
- StateTransitionDesc(ITexture* _pTexture,
- RESOURCE_STATE _OldState,
- RESOURCE_STATE _NewState,
- Uint32 _FirstMipLevel = 0,
- Uint32 _MipLevelsCount = RemainingMipLevels,
- Uint32 _FirstArraySlice = 0,
- Uint32 _ArraySliceCount = RemainingArraySlices,
- STATE_TRANSITION_TYPE _TransitionType = STATE_TRANSITION_TYPE_IMMEDIATE,
- bool _UpdateState = false)noexcept :
- pTexture {_pTexture },
- FirstMipLevel {_FirstMipLevel },
- MipLevelsCount {_MipLevelsCount },
- FirstArraySlice {_FirstArraySlice},
- ArraySliceCount {_ArraySliceCount},
- OldState {_OldState },
- NewState {_NewState },
- TransitionType {_TransitionType },
- UpdateResourceState {_UpdateState }
- {}
-
- StateTransitionDesc(ITexture* _pTexture,
- RESOURCE_STATE _OldState,
- RESOURCE_STATE _NewState,
- bool _UpdateState)noexcept :
- StateTransitionDesc
- {
- _pTexture,
- _OldState,
- _NewState,
- 0,
- RemainingMipLevels,
- 0,
- RemainingArraySlices,
- STATE_TRANSITION_TYPE_IMMEDIATE,
- _UpdateState
- }
- {}
-
- StateTransitionDesc(IBuffer* _pBuffer,
- RESOURCE_STATE _OldState,
- RESOURCE_STATE _NewState,
- bool _UpdateState)noexcept :
- pBuffer {_pBuffer },
- OldState {_OldState },
- NewState {_NewState },
- UpdateResourceState {_UpdateState}
- {}
- };
-}
+/// State transition barrier type
+DILIGENT_TYPED_ENUM(STATE_TRANSITION_TYPE, Uint8)
+{
+ /// Perform state transition immediately.
+ STATE_TRANSITION_TYPE_IMMEDIATE = 0,
+
+ /// Begin split barrier. This mode only has effect in Direct3D12 backend, and corresponds to
+ /// [D3D12_RESOURCE_BARRIER_FLAG_BEGIN_ONLY](https://docs.microsoft.com/en-us/windows/desktop/api/d3d12/ne-d3d12-d3d12_resource_barrier_flags)
+ /// flag. See https://docs.microsoft.com/en-us/windows/desktop/direct3d12/using-resource-barriers-to-synchronize-resource-states-in-direct3d-12#split-barriers.
+ /// In other backends, begin-split barriers are ignored.
+ STATE_TRANSITION_TYPE_BEGIN,
+
+ /// End split barrier. This mode only has effect in Direct3D12 backend, and corresponds to
+ /// [D3D12_RESOURCE_BARRIER_FLAG_END_ONLY](https://docs.microsoft.com/en-us/windows/desktop/api/d3d12/ne-d3d12-d3d12_resource_barrier_flags)
+ /// flag. See https://docs.microsoft.com/en-us/windows/desktop/direct3d12/using-resource-barriers-to-synchronize-resource-states-in-direct3d-12#split-barriers.
+ /// In other backends, this mode is similar to STATE_TRANSITION_TYPE_IMMEDIATE.
+ STATE_TRANSITION_TYPE_END
+};
+
+static const Uint32 REMAINING_MIP_LEVELS = 0xFFFFFFFFU;
+static const Uint32 REMAINING_ARRAY_SLICES = 0xFFFFFFFFU;
+
+/// Resource state transition barrier description
+struct StateTransitionDesc
+{
+ /// Texture to transition.
+ /// \note Exactly one of pTexture or pBuffer must be non-null.
+ class ITexture* pTexture DEFAULT_INITIALIZER(nullptr);
+
+ /// Buffer to transition.
+ /// \note Exactly one of pTexture or pBuffer must be non-null.
+ class IBuffer* pBuffer DEFAULT_INITIALIZER(nullptr);
+
+ /// When transitioning a texture, first mip level of the subresource range to transition.
+ Uint32 FirstMipLevel DEFAULT_INITIALIZER(0);
+
+ /// When transitioning a texture, number of mip levels of the subresource range to transition.
+ Uint32 MipLevelsCount DEFAULT_INITIALIZER(REMAINING_MIP_LEVELS);
+
+ /// When transitioning a texture, first array slice of the subresource range to transition.
+ Uint32 FirstArraySlice DEFAULT_INITIALIZER(0);
+
+ /// When transitioning a texture, number of array slices of the subresource range to transition.
+ Uint32 ArraySliceCount DEFAULT_INITIALIZER(REMAINING_ARRAY_SLICES);
+
+ /// Resource state before transition. If this value is RESOURCE_STATE_UNKNOWN,
+ /// internal resource state will be used, which must be defined in this case.
+ RESOURCE_STATE OldState DEFAULT_INITIALIZER(RESOURCE_STATE_UNKNOWN);
+
+ /// Resource state after transition.
+ RESOURCE_STATE NewState DEFAULT_INITIALIZER(RESOURCE_STATE_UNKNOWN);
+
+ /// State transition type, see Diligent::STATE_TRANSITION_TYPE.
+
+ /// \note When issuing UAV barrier (i.e. OldState and NewState equal RESOURCE_STATE_UNORDERED_ACCESS),
+ /// TransitionType must be STATE_TRANSITION_TYPE_IMMEDIATE.
+ STATE_TRANSITION_TYPE TransitionType DEFAULT_INITIALIZER(STATE_TRANSITION_TYPE_IMMEDIATE);
+
+ /// If set to true, the internal resource state will be set to NewState and the engine
+ /// will be able to take over the resource state management. In this case it is the
+ /// responsibility of the application to make sure that all subresources are indeed in
+ /// designated state.
+ /// If set to false, internal resource state will be unchanged.
+ /// \note When TransitionType is STATE_TRANSITION_TYPE_BEGIN, this member must be false.
+ bool UpdateResourceState DEFAULT_INITIALIZER(false);
+
+#if DILIGENT_CPP_INTERFACE
+ StateTransitionDesc()noexcept{}
+
+ StateTransitionDesc(ITexture* _pTexture,
+ RESOURCE_STATE _OldState,
+ RESOURCE_STATE _NewState,
+ Uint32 _FirstMipLevel = 0,
+ Uint32 _MipLevelsCount = REMAINING_MIP_LEVELS,
+ Uint32 _FirstArraySlice = 0,
+ Uint32 _ArraySliceCount = REMAINING_ARRAY_SLICES,
+ STATE_TRANSITION_TYPE _TransitionType = STATE_TRANSITION_TYPE_IMMEDIATE,
+ bool _UpdateState = false)noexcept :
+ pTexture {_pTexture },
+ FirstMipLevel {_FirstMipLevel },
+ MipLevelsCount {_MipLevelsCount },
+ FirstArraySlice {_FirstArraySlice},
+ ArraySliceCount {_ArraySliceCount},
+ OldState {_OldState },
+ NewState {_NewState },
+ TransitionType {_TransitionType },
+ UpdateResourceState {_UpdateState }
+ {}
+
+ StateTransitionDesc(ITexture* _pTexture,
+ RESOURCE_STATE _OldState,
+ RESOURCE_STATE _NewState,
+ bool _UpdateState)noexcept :
+ StateTransitionDesc
+ {
+ _pTexture,
+ _OldState,
+ _NewState,
+ 0,
+ REMAINING_MIP_LEVELS,
+ 0,
+ REMAINING_ARRAY_SLICES,
+ STATE_TRANSITION_TYPE_IMMEDIATE,
+ _UpdateState
+ }
+ {}
+
+ StateTransitionDesc(IBuffer* _pBuffer,
+ RESOURCE_STATE _OldState,
+ RESOURCE_STATE _NewState,
+ bool _UpdateState)noexcept :
+ pBuffer {_pBuffer },
+ OldState {_OldState },
+ NewState {_NewState },
+ UpdateResourceState {_UpdateState}
+ {}
+#endif
+};
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/InputLayout.h b/Graphics/GraphicsEngine/interface/InputLayout.h
index 5861b746..fde6abec 100644
--- a/Graphics/GraphicsEngine/interface/InputLayout.h
+++ b/Graphics/GraphicsEngine/interface/InputLayout.h
@@ -34,88 +34,92 @@
#include "GraphicsTypes.h"
-namespace Diligent
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
+
+static const Uint32 MAX_LAYOUT_ELEMENTS = 16;
+static const Uint32 LAYOUT_ELEMENT_AUTO_OFFSET = 0xFFFFFFFF;
+static const Uint32 LAYOUT_ELEMENT_AUTO_STRIDE = 0xFFFFFFFF;
+
+/// Input frequency
+enum INPUT_ELEMENT_FREQUENCY
{
+ /// Frequency is undefined.
+ INPUT_ELEMENT_FREQUENCY_UNDEFINED = 0,
-static constexpr Uint32 iMaxLayoutElements = 16;
+ /// Input data is per-vertex data.
+ INPUT_ELEMENT_FREQUENCY_PER_VERTEX,
+
+ /// Input data is per-instance data.
+ INPUT_ELEMENT_FREQUENCY_PER_INSTANCE,
+
+ /// Helper value that stores the total number of frequencies in the enumeration.
+ INPUT_ELEMENT_FREQUENCY_NUM_FREQUENCIES
+};
/// Description of a single element of the input layout
struct LayoutElement
{
- static constexpr Uint32 AutoOffset = static_cast<Uint32>(-1);
- static constexpr Uint32 AutoStride = static_cast<Uint32>(-1);
/// HLSL semantic. Default value ("ATTRIB") allows HLSL shaders to be converted
/// to GLSL and used in OpenGL backend as well as compiled to SPIRV and used
/// in Vulkan backend.
/// Any value other than default will only work in Direct3D11 and Direct3D12 backends.
- const char* HLSLSemantic = "ATTRIB";
+ const char* HLSLSemantic DEFAULT_INITIALIZER("ATTRIB");
/// Input index of the element that is specified in the vertex shader.
/// In Direct3D11 and Direct3D12 backends this is the semantic index.
- Uint32 InputIndex = 0;
+ Uint32 InputIndex DEFAULT_INITIALIZER(0);
/// Buffer slot index that this element is read from.
- Uint32 BufferSlot = 0;
+ Uint32 BufferSlot DEFAULT_INITIALIZER(0);
/// Number of components in the element. Allowed values are 1, 2, 3, and 4.
- Uint32 NumComponents = 0;
+ Uint32 NumComponents DEFAULT_INITIALIZER(0);
/// Type of the element components, see Diligent::VALUE_TYPE for details.
- VALUE_TYPE ValueType = VT_FLOAT32;
+ VALUE_TYPE ValueType DEFAULT_INITIALIZER(VT_FLOAT32);
/// For signed and unsigned integer value types
/// (VT_INT8, VT_INT16, VT_INT32, VT_UINT8, VT_UINT16, VT_UINT32)
/// indicates if the value should be normalized to [-1,+1] or
/// [0, 1] range respectively. For floating point types
/// (VT_FLOAT16 and VT_FLOAT32), this member is ignored.
- Bool IsNormalized = True;
+ Bool IsNormalized DEFAULT_INITIALIZER(True);
/// Relative offset, in bytes, to the element bits.
- /// If this value is set to LayoutElement::AutoOffset (default value), the offset will
+ /// If this value is set to LAYOUT_ELEMENT_AUTO_OFFSET (default value), the offset will
/// be computed automatically by placing the element right after the previous one.
- Uint32 RelativeOffset = AutoOffset;
+ Uint32 RelativeOffset DEFAULT_INITIALIZER(LAYOUT_ELEMENT_AUTO_OFFSET);
/// Stride, in bytes, between two elements, for this buffer slot.
- /// If this value is set to LayoutElement::AutoStride, the stride will be
+ /// If this value is set to LAYOUT_ELEMENT_AUTO_STRIDE, the stride will be
/// computed automatically assuming that all elements in the same buffer slot are
/// packed one after another. If the buffer slot contains multiple layout elements,
- /// they all must specify the same stride or use AutoStride value.
- Uint32 Stride = AutoStride;
+ /// they all must specify the same stride or use LAYOUT_ELEMENT_AUTO_STRIDE value.
+ Uint32 Stride DEFAULT_INITIALIZER(LAYOUT_ELEMENT_AUTO_STRIDE);
- /// Input frequency
- enum FREQUENCY : Int32
- {
- /// Frequency is undefined.
- FREQUENCY_UNDEFINED = 0,
-
- /// Input data is per-vertex data.
- FREQUENCY_PER_VERTEX,
-
- /// Input data is per-instance data.
- FREQUENCY_PER_INSTANCE,
-
- /// Helper value that stores the total number of frequencies in the enumeration.
- FREQUENCY_NUM_FREQUENCIES
- };
- FREQUENCY Frequency = FREQUENCY_PER_VERTEX;
+ enum INPUT_ELEMENT_FREQUENCY Frequency DEFAULT_INITIALIZER(INPUT_ELEMENT_FREQUENCY_PER_VERTEX);
/// The number of instances to draw using the same per-instance data before advancing
/// in the buffer by one element.
- Uint32 InstanceDataStepRate = 1;
+ Uint32 InstanceDataStepRate DEFAULT_INITIALIZER(1);
+
+
+#if DILIGENT_CPP_INTERFACE
LayoutElement()noexcept{}
/// Initializes the structure
- LayoutElement(Uint32 _InputIndex,
- Uint32 _BufferSlot,
- Uint32 _NumComponents,
- VALUE_TYPE _ValueType,
- Bool _IsNormalized = LayoutElement{}.IsNormalized,
- Uint32 _RelativeOffset = LayoutElement{}.RelativeOffset,
- Uint32 _Stride = LayoutElement{}.Stride,
- FREQUENCY _Frequency = LayoutElement{}.Frequency,
- Uint32 _InstanceDataStepRate = LayoutElement{}.InstanceDataStepRate)noexcept :
+ LayoutElement(Uint32 _InputIndex,
+ Uint32 _BufferSlot,
+ Uint32 _NumComponents,
+ VALUE_TYPE _ValueType,
+ Bool _IsNormalized = LayoutElement{}.IsNormalized,
+ Uint32 _RelativeOffset = LayoutElement{}.RelativeOffset,
+ Uint32 _Stride = LayoutElement{}.Stride,
+ INPUT_ELEMENT_FREQUENCY _Frequency = LayoutElement{}.Frequency,
+ Uint32 _InstanceDataStepRate = LayoutElement{}.InstanceDataStepRate)noexcept :
InputIndex {_InputIndex },
BufferSlot {_BufferSlot },
NumComponents {_NumComponents },
@@ -128,16 +132,16 @@ struct LayoutElement
{}
/// Initializes the structure
- LayoutElement(const char* _HLSLSemantic,
- Uint32 _InputIndex,
- Uint32 _BufferSlot,
- Uint32 _NumComponents,
- VALUE_TYPE _ValueType,
- Bool _IsNormalized = LayoutElement{}.IsNormalized,
- Uint32 _RelativeOffset = LayoutElement{}.RelativeOffset,
- Uint32 _Stride = LayoutElement{}.Stride,
- FREQUENCY _Frequency = LayoutElement{}.Frequency,
- Uint32 _InstanceDataStepRate = LayoutElement{}.InstanceDataStepRate)noexcept :
+ LayoutElement(const char* _HLSLSemantic,
+ Uint32 _InputIndex,
+ Uint32 _BufferSlot,
+ Uint32 _NumComponents,
+ VALUE_TYPE _ValueType,
+ Bool _IsNormalized = LayoutElement{}.IsNormalized,
+ Uint32 _RelativeOffset = LayoutElement{}.RelativeOffset,
+ Uint32 _Stride = LayoutElement{}.Stride,
+ INPUT_ELEMENT_FREQUENCY _Frequency = LayoutElement{}.Frequency,
+ Uint32 _InstanceDataStepRate = LayoutElement{}.InstanceDataStepRate)noexcept :
HLSLSemantic {_HLSLSemantic },
InputIndex {_InputIndex },
BufferSlot {_BufferSlot },
@@ -151,13 +155,13 @@ struct LayoutElement
{}
/// Initializes the structure
- LayoutElement(Uint32 _InputIndex,
- Uint32 _BufferSlot,
- Uint32 _NumComponents,
- VALUE_TYPE _ValueType,
- Bool _IsNormalized,
- FREQUENCY _Frequency,
- Uint32 _InstanceDataStepRate = LayoutElement{}.InstanceDataStepRate)noexcept :
+ LayoutElement(Uint32 _InputIndex,
+ Uint32 _BufferSlot,
+ Uint32 _NumComponents,
+ VALUE_TYPE _ValueType,
+ Bool _IsNormalized,
+ INPUT_ELEMENT_FREQUENCY _Frequency,
+ Uint32 _InstanceDataStepRate = LayoutElement{}.InstanceDataStepRate)noexcept :
InputIndex {_InputIndex },
BufferSlot {_BufferSlot },
NumComponents {_NumComponents },
@@ -168,6 +172,7 @@ struct LayoutElement
Frequency {_Frequency },
InstanceDataStepRate{_InstanceDataStepRate }
{}
+#endif
};
/// Layout description
@@ -176,10 +181,11 @@ struct LayoutElement
struct InputLayoutDesc
{
/// Array of layout elements
- const LayoutElement* LayoutElements = nullptr;
+ const struct LayoutElement* LayoutElements DEFAULT_INITIALIZER(nullptr);
/// Number of layout elements
- Uint32 NumElements = 0;
+ Uint32 NumElements DEFAULT_INITIALIZER(0);
+#if DILIGENT_CPP_INTERFACE
InputLayoutDesc()noexcept{}
InputLayoutDesc(const LayoutElement* _LayoutElements,
@@ -187,6 +193,7 @@ struct InputLayoutDesc
LayoutElements{_LayoutElements},
NumElements {_NumElements }
{}
+#endif
};
-}
+DILIGENT_END_NAMESPACE
diff --git a/Graphics/GraphicsEngine/interface/PipelineState.h b/Graphics/GraphicsEngine/interface/PipelineState.h
index bc68c300..f36d370e 100644
--- a/Graphics/GraphicsEngine/interface/PipelineState.h
+++ b/Graphics/GraphicsEngine/interface/PipelineState.h
@@ -44,8 +44,8 @@
#include "Shader.h"
#include "Sampler.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
/// Sample description
@@ -53,17 +53,19 @@ namespace Diligent
struct SampleDesc
{
/// Sample count
- Uint8 Count = 1;
+ Uint8 Count DEFAULT_INITIALIZER(1);
/// Quality
- Uint8 Quality = 0;
+ Uint8 Quality DEFAULT_INITIALIZER(0);
+#if DILIGENT_CPP_INTERFACE
SampleDesc()noexcept{}
SampleDesc(Uint8 _Count, Uint8 _Quality) noexcept :
Count {_Count },
Quality {_Quality}
{}
+#endif
};
@@ -71,14 +73,15 @@ struct SampleDesc
struct ShaderResourceVariableDesc
{
/// Shader stages this resources variable applies to. More than one shader stage can be specified.
- SHADER_TYPE ShaderStages = SHADER_TYPE_UNKNOWN;
+ enum SHADER_TYPE ShaderStages DEFAULT_INITIALIZER(SHADER_TYPE_UNKNOWN);
/// Shader variable name
- const Char* Name = nullptr;
+ const Char* Name DEFAULT_INITIALIZER(nullptr);
/// Shader variable type. See Diligent::SHADER_RESOURCE_VARIABLE_TYPE for a list of allowed types
- SHADER_RESOURCE_VARIABLE_TYPE Type = SHADER_RESOURCE_VARIABLE_TYPE_STATIC;
+ SHADER_RESOURCE_VARIABLE_TYPE Type DEFAULT_INITIALIZER(SHADER_RESOURCE_VARIABLE_TYPE_STATIC);
+#if DILIGENT_CPP_INTERFACE
ShaderResourceVariableDesc()noexcept{}
ShaderResourceVariableDesc(SHADER_TYPE _ShaderStages, const Char* _Name, SHADER_RESOURCE_VARIABLE_TYPE _Type)noexcept :
@@ -86,6 +89,7 @@ struct ShaderResourceVariableDesc
Name {_Name },
Type {_Type }
{}
+#endif
};
@@ -93,15 +97,16 @@ struct ShaderResourceVariableDesc
struct StaticSamplerDesc
{
/// Shader stages that this static sampler applies to. More than one shader stage can be specified.
- SHADER_TYPE ShaderStages = SHADER_TYPE_UNKNOWN;
+ enum SHADER_TYPE ShaderStages DEFAULT_INITIALIZER(SHADER_TYPE_UNKNOWN);
/// The name of the sampler itself or the name of the texture variable that
/// this static sampler is assigned to if combined texture samplers are used.
- const Char* SamplerOrTextureName = nullptr;
+ const Char* SamplerOrTextureName DEFAULT_INITIALIZER(nullptr);
/// Sampler description
- SamplerDesc Desc;
+ struct SamplerDesc Desc;
+#if DILIGENT_CPP_INTERFACE
StaticSamplerDesc()noexcept{}
StaticSamplerDesc(SHADER_TYPE _ShaderStages,
@@ -111,6 +116,7 @@ struct StaticSamplerDesc
SamplerOrTextureName{_SamplerOrTextureName},
Desc {_Desc }
{}
+#endif
};
@@ -120,19 +126,19 @@ struct PipelineResourceLayoutDesc
/// Default shader resource variable type. This type will be used if shader
/// variable description is not found in the Variables array
/// or if Variables == nullptr
- SHADER_RESOURCE_VARIABLE_TYPE DefaultVariableType = SHADER_RESOURCE_VARIABLE_TYPE_STATIC;
+ enum SHADER_RESOURCE_VARIABLE_TYPE DefaultVariableType DEFAULT_INITIALIZER(SHADER_RESOURCE_VARIABLE_TYPE_STATIC);
/// Number of elements in Variables array
- Uint32 NumVariables = 0;
+ Uint32 NumVariables DEFAULT_INITIALIZER(0);
/// Array of shader resource variable descriptions
- const ShaderResourceVariableDesc* Variables = nullptr;
+ const struct ShaderResourceVariableDesc* Variables DEFAULT_INITIALIZER(nullptr);
/// Number of static samplers in StaticSamplers array
- Uint32 NumStaticSamplers = 0;
+ Uint32 NumStaticSamplers DEFAULT_INITIALIZER(0);
/// Array of static sampler descriptions
- const StaticSamplerDesc* StaticSamplers = nullptr;
+ const struct StaticSamplerDesc* StaticSamplers DEFAULT_INITIALIZER(nullptr);
};
@@ -142,61 +148,61 @@ struct PipelineResourceLayoutDesc
struct GraphicsPipelineDesc
{
/// Vertex shader to be used with the pipeline
- IShader* pVS = nullptr;
+ class IShader* pVS DEFAULT_INITIALIZER(nullptr);
/// Pixel shader to be used with the pipeline
- IShader* pPS = nullptr;
+ class IShader* pPS DEFAULT_INITIALIZER(nullptr);
/// Domain shader to be used with the pipeline
- IShader* pDS = nullptr;
+ class IShader* pDS DEFAULT_INITIALIZER(nullptr);
/// Hull shader to be used with the pipeline
- IShader* pHS = nullptr;
+ class IShader* pHS DEFAULT_INITIALIZER(nullptr);
/// Geometry shader to be used with the pipeline
- IShader* pGS = nullptr;
+ class IShader* pGS DEFAULT_INITIALIZER(nullptr);
//D3D12_STREAM_OUTPUT_DESC StreamOutput;
/// Blend state description
- BlendStateDesc BlendDesc;
+ struct BlendStateDesc BlendDesc;
/// 32-bit sample mask that determines which samples get updated
/// in all the active render targets. A sample mask is always applied;
/// it is independent of whether multisampling is enabled, and does not
/// depend on whether an application uses multisample render targets.
- Uint32 SampleMask = 0xFFFFFFFF;
+ Uint32 SampleMask DEFAULT_INITIALIZER(0xFFFFFFFF);
/// Rasterizer state description
- RasterizerStateDesc RasterizerDesc;
+ struct RasterizerStateDesc RasterizerDesc;
/// Depth-stencil state description
- DepthStencilStateDesc DepthStencilDesc;
+ struct DepthStencilStateDesc DepthStencilDesc;
/// Input layout
- InputLayoutDesc InputLayout;
+ struct InputLayoutDesc InputLayout;
//D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IBStripCutValue;
/// Primitive topology type
- PRIMITIVE_TOPOLOGY PrimitiveTopology = PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
+ enum PRIMITIVE_TOPOLOGY PrimitiveTopology DEFAULT_INITIALIZER(PRIMITIVE_TOPOLOGY_TRIANGLE_LIST);
/// Number of viewports used by this pipeline
- Uint8 NumViewports = 1;
+ Uint8 NumViewports DEFAULT_INITIALIZER(1);
/// Number of render targets in the RTVFormats member
- Uint8 NumRenderTargets = 0;
+ Uint8 NumRenderTargets DEFAULT_INITIALIZER(0);
/// Render target formats
- TEXTURE_FORMAT RTVFormats[8] = {};
+ enum TEXTURE_FORMAT RTVFormats[8] DEFAULT_INITIALIZER({});
/// Depth-stencil format
- TEXTURE_FORMAT DSVFormat = TEX_FORMAT_UNKNOWN;
+ enum TEXTURE_FORMAT DSVFormat DEFAULT_INITIALIZER(TEX_FORMAT_UNKNOWN);
/// Multisampling parameters
- SampleDesc SmplDesc;
+ struct SampleDesc SmplDesc;
/// Node mask.
- Uint32 NodeMask = 0;
+ Uint32 NodeMask DEFAULT_INITIALIZER(0);
//D3D12_CACHED_PIPELINE_STATE CachedPSO;
//D3D12_PIPELINE_STATE_FLAGS Flags;
@@ -209,38 +215,40 @@ struct GraphicsPipelineDesc
struct ComputePipelineDesc
{
/// Compute shader to be used with the pipeline
- IShader* pCS = nullptr;
+ class IShader* pCS DEFAULT_INITIALIZER(nullptr);
};
/// Pipeline state description
-struct PipelineStateDesc : DeviceObjectAttribs
-{
+struct PipelineStateDesc DILIGENT_DERIVE(DeviceObjectAttribs)
+
/// Flag indicating if pipeline state is a compute pipeline state
- bool IsComputePipeline = false;
+ bool IsComputePipeline DEFAULT_INITIALIZER(false);
/// Shader resource binding allocation granularity
/// This member defines allocation granularity for internal resources required by the shader resource
/// binding object instances.
- Uint32 SRBAllocationGranularity = 1;
+ Uint32 SRBAllocationGranularity DEFAULT_INITIALIZER(1);
/// Defines which command queues this pipeline state can be used with
- Uint64 CommandQueueMask = 1;
+ Uint64 CommandQueueMask DEFAULT_INITIALIZER(1);
/// Pipeline layout description
- PipelineResourceLayoutDesc ResourceLayout;
+ struct PipelineResourceLayoutDesc ResourceLayout;
/// Graphics pipeline state description. This memeber is ignored if IsComputePipeline == True
- GraphicsPipelineDesc GraphicsPipeline;
+ struct GraphicsPipelineDesc GraphicsPipeline;
/// Compute pipeline state description. This memeber is ignored if IsComputePipeline == False
- ComputePipelineDesc ComputePipeline;
+ struct ComputePipelineDesc ComputePipeline;
};
// {06084AE5-6A71-4FE8-84B9-395DD489A28C}
-static constexpr INTERFACE_ID IID_PipelineState =
+static const struct INTERFACE_ID IID_PipelineState =
{0x6084ae5, 0x6a71, 0x4fe8, {0x84, 0xb9, 0x39, 0x5d, 0xd4, 0x89, 0xa2, 0x8c}};
+#if DILIGENT_CPP_INTERFACE
+
/// Pipeline state interface
class IPipelineState : public IDeviceObject
{
@@ -321,4 +329,8 @@ public:
virtual bool IsCompatibleWith(const IPipelineState* pPSO)const = 0;
};
-}
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE
diff --git a/Graphics/GraphicsEngine/interface/Query.h b/Graphics/GraphicsEngine/interface/Query.h
index b5f3949e..7048bd3b 100644
--- a/Graphics/GraphicsEngine/interface/Query.h
+++ b/Graphics/GraphicsEngine/interface/Query.h
@@ -32,11 +32,11 @@
#include "DeviceObject.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
// {70F2A88A-F8BE-4901-8F05-2F72FA695BA0}
-static constexpr INTERFACE_ID IID_Query =
+static const struct INTERFACE_ID IID_Query =
{0x70f2a88a, 0xf8be, 0x4901, {0x8f, 0x5, 0x2f, 0x72, 0xfa, 0x69, 0x5b, 0xa0}};
/// Query type.
@@ -71,11 +71,11 @@ enum QUERY_TYPE
struct QueryDataOcclusion
{
/// Query type - must be Diligent::QUERY_TYPE_OCCLUSION
- const QUERY_TYPE Type = QUERY_TYPE_OCCLUSION;
+ const enum QUERY_TYPE Type DEFAULT_INITIALIZER(QUERY_TYPE_OCCLUSION);
/// The number of samples that passed the depth and stencil tests in between
/// IDeviceContext::BeginQuery and IDeviceContext::EndQuery.
- Uint64 NumSamples = 0;
+ Uint64 NumSamples DEFAULT_INITIALIZER(0);
};
/// Binary occlusion query data.
@@ -83,11 +83,11 @@ struct QueryDataOcclusion
struct QueryDataBinaryOcclusion
{
/// Query type - must be Diligent::QUERY_TYPE_BINARY_OCCLUSION
- const QUERY_TYPE Type = QUERY_TYPE_BINARY_OCCLUSION;
+ const enum QUERY_TYPE Type DEFAULT_INITIALIZER(QUERY_TYPE_BINARY_OCCLUSION);
/// Indicates if at least one sample passed depth and stencil testing in between
/// IDeviceContext::BeginQuery and IDeviceContext::EndQuery.
- bool AnySamplePassed = 0;
+ bool AnySamplePassed DEFAULT_INITIALIZER(0);
};
/// Timestamp query data.
@@ -95,14 +95,14 @@ struct QueryDataBinaryOcclusion
struct QueryDataTimestamp
{
/// Query type - must be Diligent::QUERY_TYPE_TIMESTAMP
- const QUERY_TYPE Type = QUERY_TYPE_TIMESTAMP;
+ const enum QUERY_TYPE Type DEFAULT_INITIALIZER(QUERY_TYPE_TIMESTAMP);
/// The value of a high-frequency counter.
- Uint64 Counter = 0;
+ Uint64 Counter DEFAULT_INITIALIZER(0);
/// The counter frequency, in Hz (ticks/second). If there was an error
/// while getting the timestamp, this value will be 0.
- Uint64 Frequency = 0;
+ Uint64 Frequency DEFAULT_INITIALIZER(0);
};
/// Pipeline statistics query data.
@@ -112,57 +112,65 @@ struct QueryDataTimestamp
struct QueryDataPipelineStatistics
{
/// Query type - must be Diligent::QUERY_TYPE_PIPELINE_STATISTICS
- const QUERY_TYPE Type = QUERY_TYPE_PIPELINE_STATISTICS;
+ const enum QUERY_TYPE Type DEFAULT_INITIALIZER(QUERY_TYPE_PIPELINE_STATISTICS);
/// Number of vertices processed by the input assembler stage.
- Uint64 InputVertices = 0;
+ Uint64 InputVertices DEFAULT_INITIALIZER(0);
/// Number of primitives processed by the input assembler stage.
- Uint64 InputPrimitives = 0;
+ Uint64 InputPrimitives DEFAULT_INITIALIZER(0);
/// Number of primitives output by a geometry shader.
- Uint64 GSPrimitives = 0;
+ Uint64 GSPrimitives DEFAULT_INITIALIZER(0);
/// Number of primitives that were sent to the clipping stage.
- Uint64 ClippingInvocations = 0;
+ Uint64 ClippingInvocations DEFAULT_INITIALIZER(0);
/// Number of primitives that were output by the clipping stage and were rendered.
/// This may be larger or smaller than ClippingInvocations because after a primitive is
/// clipped sometimes it is either broken up into more than one primitive or completely culled.
- Uint64 ClippingPrimitives = 0;
+ Uint64 ClippingPrimitives DEFAULT_INITIALIZER(0);
/// Number of times a vertex shader was invoked.
- Uint64 VSInvocations = 0;
+ Uint64 VSInvocations DEFAULT_INITIALIZER(0);
/// Number of times a geometry shader was invoked.
- Uint64 GSInvocations = 0;
+ Uint64 GSInvocations DEFAULT_INITIALIZER(0);
/// Number of times a pixel shader shader was invoked.
- Uint64 PSInvocations = 0;
+ Uint64 PSInvocations DEFAULT_INITIALIZER(0);
/// Number of times a hull shader shader was invoked.
- Uint64 HSInvocations = 0;
+ Uint64 HSInvocations DEFAULT_INITIALIZER(0);
/// Number of times a domain shader shader was invoked.
- Uint64 DSInvocations = 0;
+ Uint64 DSInvocations DEFAULT_INITIALIZER(0);
/// Number of times a compute shader was invoked.
- Uint64 CSInvocations = 0;
+ Uint64 CSInvocations DEFAULT_INITIALIZER(0);
};
+
+// clang-format off
+
/// Query description.
-struct QueryDesc : DeviceObjectAttribs
-{
+struct QueryDesc DILIGENT_DERIVE(DeviceObjectAttribs)
+
/// Query type, see Diligent::QUERY_TYPE.
- QUERY_TYPE Type = QUERY_TYPE_UNDEFINED;
+ enum QUERY_TYPE Type DEFAULT_INITIALIZER(QUERY_TYPE_UNDEFINED);
+#if DILIGENT_CPP_INTERFACE
QueryDesc() noexcept {};
explicit QueryDesc(QUERY_TYPE _Type) noexcept :
Type(_Type)
{}
+#endif
};
+// clang-format on
+
+#if DILIGENT_CPP_INTERFACE
/// Query interface.
@@ -202,4 +210,8 @@ public:
virtual void Invalidate() = 0;
};
-} // namespace Diligent
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/RasterizerState.h b/Graphics/GraphicsEngine/interface/RasterizerState.h
index 97c2bae9..3d63cb07 100644
--- a/Graphics/GraphicsEngine/interface/RasterizerState.h
+++ b/Graphics/GraphicsEngine/interface/RasterizerState.h
@@ -34,8 +34,8 @@
#include "GraphicsTypes.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
/// Fill mode
@@ -43,8 +43,8 @@ namespace Diligent
/// [D3D12_FILL_MODE]: https://msdn.microsoft.com/en-us/library/windows/desktop/dn770366(v=vs.85).aspx
/// This enumeration determines the fill mode to use when rendering triangles and mirrors the
/// [D3D11_FILL_MODE][]/[D3D12_FILL_MODE][] enum. It is used by RasterizerStateDesc structure to define the fill mode.
-enum FILL_MODE : Int8
-{
+DILIGENT_TYPED_ENUM(FILL_MODE, Int8)
+{
/// Undefined fill mode.
FILL_MODE_UNDEFINED = 0,
@@ -66,7 +66,7 @@ enum FILL_MODE : Int8
/// [D3D12_CULL_MODE]: https://msdn.microsoft.com/en-us/library/windows/desktop/dn770354(v=vs.85).aspx
/// This enumeration defines which triangles are not drawn during the rasterization and mirrors
/// [D3D11_CULL_MODE][]/[D3D12_CULL_MODE][] enum. It is used by RasterizerStateDesc structure to define the polygon cull mode.
-enum CULL_MODE : Int8
+DILIGENT_TYPED_ENUM(CULL_MODE, Int8)
{
/// Undefined cull mode.
CULL_MODE_UNDEFINED = 0,
@@ -97,46 +97,46 @@ struct RasterizerStateDesc
{
/// Determines traingle fill mode, see Diligent::FILL_MODE for details.
/// Default value: Diligent::FILL_MODE_SOLID.
- FILL_MODE FillMode = FILL_MODE_SOLID;
+ enum FILL_MODE FillMode DEFAULT_INITIALIZER(FILL_MODE_SOLID);
/// Determines traingle cull mode, see Diligent::CULL_MODE for details.
/// Default value: Diligent::CULL_MODE_BACK.
- CULL_MODE CullMode = CULL_MODE_BACK;
+ enum CULL_MODE CullMode DEFAULT_INITIALIZER(CULL_MODE_BACK);
/// Determines if a triangle is front- or back-facing. If this parameter is True,
/// a triangle will be considered front-facing if its vertices are counter-clockwise
/// on the render target and considered back-facing if they are clockwise.
/// If this parameter is False, the opposite is true.
/// Default value: False.
- Bool FrontCounterClockwise = False;
+ Bool FrontCounterClockwise DEFAULT_INITIALIZER(False);
/// Enable clipping against near and far clip planes.
/// Default value: True.
- Bool DepthClipEnable = True;
+ Bool DepthClipEnable DEFAULT_INITIALIZER(True);
/// Enable scissor-rectangle culling. All pixels outside an active scissor rectangle are culled.
/// Default value: False.
- Bool ScissorEnable = False;
+ Bool ScissorEnable DEFAULT_INITIALIZER(False);
/// Specifies whether to enable line antialiasing.
/// Default value: False.
- Bool AntialiasedLineEnable = False;
+ Bool AntialiasedLineEnable DEFAULT_INITIALIZER(False);
/// Constant value added to the depth of a given pixel.
/// Default value: 0.
- Int32 DepthBias = 0;
+ Int32 DepthBias DEFAULT_INITIALIZER(0);
/// Maximum depth bias of a pixel.
/// \warning Depth bias clamp is not available in OpenGL
/// Default value: 0.
- Float32 DepthBiasClamp = 0.f;
+ Float32 DepthBiasClamp DEFAULT_INITIALIZER(0.f);
/// Scalar that scales the given pixel's slope before adding to the pixel's depth.
/// Default value: 0.
- Float32 SlopeScaledDepthBias = 0.f;
+ Float32 SlopeScaledDepthBias DEFAULT_INITIALIZER(0.f);
+
- // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
- // RasterizerStateDesc{FILL_MODE_SOLID, CULL_MODE_BACK}
+#if DILIGENT_CPP_INTERFACE
RasterizerStateDesc()noexcept{}
@@ -179,6 +179,7 @@ struct RasterizerStateDesc
ScissorEnable == RHS.ScissorEnable &&
AntialiasedLineEnable == RHS.AntialiasedLineEnable;
}
+#endif
};
-}
+DILIGENT_END_NAMESPACE
diff --git a/Graphics/GraphicsEngine/interface/RenderDevice.h b/Graphics/GraphicsEngine/interface/RenderDevice.h
index 843aecc5..fa776543 100644
--- a/Graphics/GraphicsEngine/interface/RenderDevice.h
+++ b/Graphics/GraphicsEngine/interface/RenderDevice.h
@@ -51,13 +51,14 @@
#include "RasterizerState.h"
#include "BlendState.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {F0E9B607-AE33-4B2B-B1AF-A8B2C3104022}
-static constexpr INTERFACE_ID IID_RenderDevice =
+static const struct INTERFACE_ID IID_RenderDevice =
{0xf0e9b607, 0xae33, 0x4b2b, {0xb1, 0xaf, 0xa8, 0xb2, 0xc3, 0x10, 0x40, 0x22}};
+#if DILIGENT_CPP_INTERFACE
+
/// Render device interface
class IRenderDevice : public IObject
{
@@ -225,4 +226,10 @@ public:
virtual IEngineFactory* GetEngineFactory() const = 0;
};
-} // namespace Diligent
+#else
+
+
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/ResourceMapping.h b/Graphics/GraphicsEngine/interface/ResourceMapping.h
index 88613620..27f7d7a5 100644
--- a/Graphics/GraphicsEngine/interface/ResourceMapping.h
+++ b/Graphics/GraphicsEngine/interface/ResourceMapping.h
@@ -32,10 +32,10 @@
#include "DeviceObject.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
// {6C1AC7A6-B429-4139-9433-9E54E93E384A}
-static constexpr INTERFACE_ID IID_ResourceMapping =
+static const struct INTERFACE_ID IID_ResourceMapping =
{0x6c1ac7a6, 0xb429, 0x4139, {0x94, 0x33, 0x9e, 0x54, 0xe9, 0x3e, 0x38, 0x4a}};
/// Describes the resourse mapping object entry
@@ -44,12 +44,16 @@ struct ResourceMappingEntry
// clang-format off
/// Object name
- const Char* Name = nullptr;
+ const Char* Name DEFAULT_INITIALIZER(nullptr);
/// Pointer to the object's interface
- IDeviceObject *pObject = nullptr;
+ class IDeviceObject* pObject DEFAULT_INITIALIZER(nullptr);
- Uint32 ArrayIndex = 0;
+ Uint32 ArrayIndex DEFAULT_INITIALIZER(0);
+
+
+#if DILIGENT_CPP_INTERFACE
+ ResourceMappingEntry() noexcept {}
/// Initializes the structure members
@@ -61,10 +65,8 @@ struct ResourceMappingEntry
pObject { _pObject },
ArrayIndex{_ArrayIndex}
{}
-
// clang-format on
-
- ResourceMappingEntry() noexcept {}
+#endif
};
/// Resource mapping description
@@ -73,15 +75,21 @@ struct ResourceMappingDesc
/// Pointer to the array of resource mapping entries.
/// The last element in the array must be default value
/// created by ResourceMappingEntry::ResourceMappingEntry()
- ResourceMappingEntry* pEntries = nullptr;
+ struct ResourceMappingEntry* pEntries DEFAULT_INITIALIZER(nullptr);
- ResourceMappingDesc() noexcept {}
+#if DILIGENT_CPP_INTERFACE
+ ResourceMappingDesc() noexcept
+ {}
explicit ResourceMappingDesc(ResourceMappingEntry* _pEntries) noexcept :
pEntries{_pEntries}
{}
+#endif
};
+
+#if DILIGENT_CPP_INTERFACE
+
/// Resouce mapping
/// This interface provides mapping between literal names and resource pointers.
@@ -141,4 +149,9 @@ public:
/// Returns the size of the resource mapping, i.e. the number of objects.
virtual size_t GetSize() = 0;
};
-} // namespace Diligent
+
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/Sampler.h b/Graphics/GraphicsEngine/interface/Sampler.h
index 294d75ee..dfd740b0 100644
--- a/Graphics/GraphicsEngine/interface/Sampler.h
+++ b/Graphics/GraphicsEngine/interface/Sampler.h
@@ -33,13 +33,14 @@
#include <cfloat>
#include "DeviceObject.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
// {595A59BF-FA81-4855-BC5E-C0E048745A95}
-static constexpr INTERFACE_ID IID_Sampler =
+static const struct INTERFACE_ID IID_Sampler =
{0x595a59bf, 0xfa81, 0x4855, {0xbc, 0x5e, 0xc0, 0xe0, 0x48, 0x74, 0x5a, 0x95}};
+
// clang-format off
/// Sampler description
@@ -55,60 +56,62 @@ static constexpr INTERFACE_ID IID_Sampler =
///
/// Both MinFilter and MagFilter must either be regular filters or comparison filters.
/// Mixing comparison and regular filters is an error.
-struct SamplerDesc : DeviceObjectAttribs
-{
+struct SamplerDesc DILIGENT_DERIVE(DeviceObjectAttribs)
+
/// Texture minification filter, see Diligent::FILTER_TYPE for details.
/// Default value: Diligent::FILTER_TYPE_LINEAR.
- FILTER_TYPE MinFilter = FILTER_TYPE_LINEAR;
+ enum FILTER_TYPE MinFilter DEFAULT_INITIALIZER(FILTER_TYPE_LINEAR);
/// Texture magnification filter, see Diligent::FILTER_TYPE for details.
/// Default value: Diligent::FILTER_TYPE_LINEAR.
- FILTER_TYPE MagFilter = FILTER_TYPE_LINEAR;
+ enum FILTER_TYPE MagFilter DEFAULT_INITIALIZER(FILTER_TYPE_LINEAR);
/// Mip filter, see Diligent::FILTER_TYPE for details.
/// Only FILTER_TYPE_POINT, FILTER_TYPE_LINEAR, FILTER_TYPE_ANISOTROPIC, and
/// FILTER_TYPE_COMPARISON_ANISOTROPIC are allowed.
/// Default value: Diligent::FILTER_TYPE_LINEAR.
- FILTER_TYPE MipFilter = FILTER_TYPE_LINEAR;
+ enum FILTER_TYPE MipFilter DEFAULT_INITIALIZER(FILTER_TYPE_LINEAR);
/// Texture address mode for U coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details
/// Default value: Diligent::TEXTURE_ADDRESS_CLAMP.
- TEXTURE_ADDRESS_MODE AddressU = TEXTURE_ADDRESS_CLAMP;
+ enum TEXTURE_ADDRESS_MODE AddressU DEFAULT_INITIALIZER(TEXTURE_ADDRESS_CLAMP);
/// Texture address mode for V coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details
/// Default value: Diligent::TEXTURE_ADDRESS_CLAMP.
- TEXTURE_ADDRESS_MODE AddressV = TEXTURE_ADDRESS_CLAMP;
+ enum TEXTURE_ADDRESS_MODE AddressV DEFAULT_INITIALIZER(TEXTURE_ADDRESS_CLAMP);
/// Texture address mode for W coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details
/// Default value: Diligent::TEXTURE_ADDRESS_CLAMP.
- TEXTURE_ADDRESS_MODE AddressW = TEXTURE_ADDRESS_CLAMP;
+ enum TEXTURE_ADDRESS_MODE AddressW DEFAULT_INITIALIZER(TEXTURE_ADDRESS_CLAMP);
/// Offset from the calculated mipmap level. For example, if a sampler calculates that a texture
/// should be sampled at mipmap level 1.2 and MipLODBias is 2.3, then the texture will be sampled at
/// mipmap level 3.5. Default value: 0.
- Float32 MipLODBias = 0;
+ Float32 MipLODBias DEFAULT_INITIALIZER(0);
/// Maximum anisotropy level for the anisotropic filter. Default value: 0.
- Uint32 MaxAnisotropy = 0;
+ Uint32 MaxAnisotropy DEFAULT_INITIALIZER(0);
/// A function that compares sampled data against existing sampled data when comparsion
/// filter is used. Default value: Diligent::COMPARISON_FUNC_NEVER.
- COMPARISON_FUNCTION ComparisonFunc = COMPARISON_FUNC_NEVER;
+ enum COMPARISON_FUNCTION ComparisonFunc DEFAULT_INITIALIZER(COMPARISON_FUNC_NEVER);
/// Border color to use if TEXTURE_ADDRESS_BORDER is specified for AddressU, AddressV, or AddressW.
/// Default value: {0,0,0,0}
- Float32 BorderColor[4] = {0, 0, 0, 0};
+ Float32 BorderColor[4] DEFAULT_INITIALIZER({});
/// Specifies the minimum value that LOD is clamped to before accessing the texture MIP levels.
/// Must be less than or equal to MaxLOD.
/// Default value: 0.
- float MinLOD = 0;
+ float MinLOD DEFAULT_INITIALIZER(0);
/// Specifies the maximum value that LOD is clamped to before accessing the texture MIP levels.
/// Must be greater than or equal to MinLOD.
/// Default value: +FLT_MAX.
- float MaxLOD = +3.402823466e+38F;
+ float MaxLOD DEFAULT_INITIALIZER(+3.402823466e+38F);
+
+#if DILIGENT_CPP_INTERFACE
SamplerDesc()noexcept{}
SamplerDesc(FILTER_TYPE _MinFilter,
@@ -165,8 +168,12 @@ struct SamplerDesc : DeviceObjectAttribs
MinLOD == RHS.MinLOD &&
MaxLOD == RHS.MaxLOD;
}
+#endif
};
+
+#if DILIGENT_CPP_INTERFACE
+
// clang-format on
/// Texture sampler interface.
@@ -184,4 +191,10 @@ public:
virtual const SamplerDesc& GetDesc() const override = 0;
};
-} // namespace Diligent
+#else
+
+
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h
index b14e94aa..a1117ba6 100644
--- a/Graphics/GraphicsEngine/interface/Shader.h
+++ b/Graphics/GraphicsEngine/interface/Shader.h
@@ -34,15 +34,17 @@
#include "../../../Primitives/interface/FlagEnum.h"
#include "DeviceObject.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
// {2989B45C-143D-4886-B89C-C3271C2DCC5D}
-static constexpr INTERFACE_ID IID_Shader =
+static const struct INTERFACE_ID IID_Shader =
{0x2989b45c, 0x143d, 0x4886, {0xb8, 0x9c, 0xc3, 0x27, 0x1c, 0x2d, 0xcc, 0x5d}};
+// clang-format off
+
/// Describes the shader type
-enum SHADER_TYPE : Uint32
+DILIGENT_TYPED_ENUM(SHADER_TYPE, Uint32)
{
SHADER_TYPE_UNKNOWN = 0x000, ///< Unknown shader type
SHADER_TYPE_VERTEX = 0x001, ///< Vertex shader
@@ -55,7 +57,7 @@ enum SHADER_TYPE : Uint32
DEFINE_FLAG_ENUM_OPERATORS(SHADER_TYPE);
/// Describes shader source code language
-enum SHADER_SOURCE_LANGUAGE : Uint32
+DILIGENT_TYPED_ENUM(SHADER_SOURCE_LANGUAGE, Uint32)
{
/// Default language (GLSL for OpenGL/OpenGLES devices, HLSL for Direct3D11/Direct3D12 devices)
SHADER_SOURCE_LANGUAGE_DEFAULT = 0,
@@ -68,17 +70,21 @@ enum SHADER_SOURCE_LANGUAGE : Uint32
};
/// Shader description
-struct ShaderDesc : DeviceObjectAttribs
-{
+struct ShaderDesc DILIGENT_DERIVE(DeviceObjectAttribs)
+
/// Shader type. See Diligent::SHADER_TYPE.
- SHADER_TYPE ShaderType = SHADER_TYPE_UNKNOWN;
+ SHADER_TYPE ShaderType DEFAULT_INITIALIZER(SHADER_TYPE_UNKNOWN);
};
+// clang-format on
// {3EA98781-082F-4413-8C30-B9BA6D82DBB7}
-static constexpr INTERFACE_ID IID_IShaderSourceInputStreamFactory =
+static const struct INTERFACE_ID IID_IShaderSourceInputStreamFactory =
{0x3ea98781, 0x82f, 0x4413, {0x8c, 0x30, 0xb9, 0xba, 0x6d, 0x82, 0xdb, 0xb7}};
+
+#if DILIGENT_CPP_INTERFACE
+
/// Shader source stream factory interface
class IShaderSourceInputStreamFactory : public IObject
{
@@ -86,17 +92,43 @@ public:
virtual void CreateInputStream(const Diligent::Char* Name, IFileStream** ppStream) = 0;
};
+#else
+
+#endif
+
struct ShaderMacro
{
- const Char* Name = nullptr;
- const Char* Definition = nullptr;
+ const Char* Name DEFAULT_INITIALIZER(nullptr);
+ const Char* Definition DEFAULT_INITIALIZER(nullptr);
- ShaderMacro() noexcept {}
+#if DILIGENT_CPP_INTERFACE
+ ShaderMacro() noexcept
+ {}
ShaderMacro(const Char* _Name,
const Char* _Def) noexcept :
Name{_Name},
Definition{_Def}
{}
+#endif
+};
+
+/// Shader version
+struct ShaderVersion
+{
+ /// Major revision
+ Uint8 Major DEFAULT_INITIALIZER(0);
+
+ /// Minor revision
+ Uint8 Minor DEFAULT_INITIALIZER(0);
+
+#if DILIGENT_CPP_INTERFACE
+ ShaderVersion() noexcept
+ {}
+ ShaderVersion(Uint8 _Major, Uint8 _Minor) noexcept :
+ Major{_Major},
+ Minor{_Minor}
+ {}
+#endif
};
/// Shader creation attributes
@@ -105,13 +137,13 @@ struct ShaderCreateInfo
/// Source file path
/// If source file path is provided, Source and ByteCode members must be null
- const Char* FilePath = nullptr;
+ const Char* FilePath DEFAULT_INITIALIZER(nullptr);
/// Pointer to the shader source input stream factory.
/// The factory is used to load the shader source file if FilePath is not null.
/// It is also used to create additional input streams for shader include files
- IShaderSourceInputStreamFactory* pShaderSourceStreamFactory = nullptr;
+ class IShaderSourceInputStreamFactory* pShaderSourceStreamFactory DEFAULT_INITIALIZER(nullptr);
/// HLSL->GLSL conversion stream
@@ -124,12 +156,12 @@ struct ShaderCreateInfo
/// the first time and will use it in all subsequent times.
/// For all subsequent conversions, FilePath member must be the same, or
/// new stream will be crated and warning message will be displayed.
- class IHLSL2GLSLConversionStream** ppConversionStream = nullptr;
+ class IHLSL2GLSLConversionStream** ppConversionStream DEFAULT_INITIALIZER(nullptr);
/// Shader source
/// If shader source is provided, FilePath and ByteCode members must be null
- const Char* Source = nullptr;
+ const Char* Source DEFAULT_INITIALIZER(nullptr);
/// Compiled shader bytecode.
@@ -140,22 +172,22 @@ struct ShaderCreateInfo
/// The bytecode must contain reflection information. If shaders were compiled
/// using fxc, make sure that /Qstrip_reflect option is *not* specified.
/// HLSL shaders need to be compiled against 4.0 profile or higher.
- const void* ByteCode = nullptr;
+ const void* ByteCode DEFAULT_INITIALIZER(nullptr);
/// Size of the compiled shader bytecode
/// Byte code size (in bytes) must be provided if ByteCode is not null
- size_t ByteCodeSize = 0;
+ size_t ByteCodeSize DEFAULT_INITIALIZER(0);
/// Shader entry point
/// This member is ignored if ByteCode is not null
- const Char* EntryPoint = "main";
+ const Char* EntryPoint DEFAULT_INITIALIZER("main");
/// Shader macros
/// This member is ignored if ByteCode is not null
- const ShaderMacro* Macros = nullptr;
+ const struct ShaderMacro* Macros DEFAULT_INITIALIZER(nullptr);
/// If set to true, textures will be combined with texture samplers.
/// The CombinedSamplerSuffix member defines the suffix added to the texture variable
@@ -163,37 +195,20 @@ struct ShaderCreateInfo
/// the sampler assigned to the shader resource view is automatically set when
/// the view is bound. Otherwise samplers need to be explicitly set similar to other
/// shader variables.
- bool UseCombinedTextureSamplers = false;
+ bool UseCombinedTextureSamplers DEFAULT_INITIALIZER(false);
/// If UseCombinedTextureSamplers is true, defines the suffix added to the
/// texture variable name to get corresponding sampler name. For example,
/// for default value "_sampler", a texture named "tex" will be combined
/// with sampler named "tex_sampler".
/// If UseCombinedTextureSamplers is false, this member is ignored.
- const Char* CombinedSamplerSuffix = "_sampler";
+ const Char* CombinedSamplerSuffix DEFAULT_INITIALIZER("_sampler");
/// Shader description. See Diligent::ShaderDesc.
- ShaderDesc Desc;
+ struct ShaderDesc Desc;
/// Shader source language. See Diligent::SHADER_SOURCE_LANGUAGE.
- SHADER_SOURCE_LANGUAGE SourceLanguage = SHADER_SOURCE_LANGUAGE_DEFAULT;
-
-
- /// Shader version
- struct ShaderVersion
- {
- /// Major revision
- Uint8 Major = 0;
-
- /// Minor revision
- Uint8 Minor = 0;
-
- ShaderVersion() noexcept {}
- ShaderVersion(Uint8 _Major, Uint8 _Minor) noexcept :
- Major{_Major},
- Minor{_Minor}
- {}
- };
+ enum SHADER_SOURCE_LANGUAGE SourceLanguage DEFAULT_INITIALIZER(SHADER_SOURCE_LANGUAGE_DEFAULT);
/// HLSL shader model to use when compiling the shader. When default value
/// is given (0, 0), the engine will attempt to use the highest HLSL shader model
@@ -201,17 +216,17 @@ struct ShaderCreateInfo
/// has no effect.
///
/// \note When HLSL source is converted to GLSL, corresponding GLSL/GLESSL version will be used.
- ShaderVersion HLSLVersion = ShaderVersion{};
+ struct ShaderVersion HLSLVersion DEFAULT_INITIALIZER({});
/// GLSL version to use when creating the shader. When default value
/// is given (0, 0), the engine will attempt to use the highest GLSL version
/// supported by the device.
- ShaderVersion GLSLVersion = ShaderVersion{};
+ struct ShaderVersion GLSLVersion DEFAULT_INITIALIZER({});
/// GLES shading language version to use when creating the shader. When default value
/// is given (0, 0), the engine will attempt to use the highest GLESSL version
/// supported by the device.
- ShaderVersion GLESSLVersion = ShaderVersion{};
+ struct ShaderVersion GLESSLVersion DEFAULT_INITIALIZER({});
/// Memory address where pointer to the compiler messages data blob will be written
@@ -219,12 +234,11 @@ struct ShaderCreateInfo
/// The buffer contains two null-terminated strings. The first one is the compiler
/// output message. The second one is the full shader source code including definitions added
/// by the engine. Data blob object must be released by the client.
- IDataBlob** ppCompilerOutput = nullptr;
+ class IDataBlob** ppCompilerOutput DEFAULT_INITIALIZER(nullptr);
};
/// Describes shader resource type
-enum SHADER_RESOURCE_TYPE : Uint8
-{
+DILIGENT_TYPED_ENUM(SHADER_RESOURCE_TYPE, Uint8){
/// Shader resource type is unknown
SHADER_RESOURCE_TYPE_UNKNOWN = 0,
@@ -244,13 +258,14 @@ enum SHADER_RESOURCE_TYPE : Uint8
SHADER_RESOURCE_TYPE_BUFFER_UAV,
/// Sampler (separate sampler)
- SHADER_RESOURCE_TYPE_SAMPLER
-};
+ SHADER_RESOURCE_TYPE_SAMPLER};
/// Shader resource description
struct ShaderResourceDesc
{
- ShaderResourceDesc() noexcept {}
+#if DILIGENT_CPP_INTERFACE
+ ShaderResourceDesc() noexcept
+ {}
ShaderResourceDesc(const char* _Name,
SHADER_RESOURCE_TYPE _Type,
@@ -259,19 +274,23 @@ struct ShaderResourceDesc
Type{_Type},
ArraySize{_ArraySize}
{}
+#endif
// clang-format off
/// Shader resource name
- const char* Name = nullptr;
+ const char* Name DEFAULT_INITIALIZER(nullptr);
/// Shader resource type, see Diligent::SHADER_RESOURCE_TYPE.
- SHADER_RESOURCE_TYPE Type = SHADER_RESOURCE_TYPE_UNKNOWN;
+ SHADER_RESOURCE_TYPE Type DEFAULT_INITIALIZER(SHADER_RESOURCE_TYPE_UNKNOWN);
/// Array size. For non-array resource this value is 1.
- Uint32 ArraySize = 0;
+ Uint32 ArraySize DEFAULT_INITIALIZER(0);
// clang-format on
};
+
+#if DILIGENT_CPP_INTERFACE
+
/// Shader interface
class IShader : public IDeviceObject
{
@@ -289,4 +308,8 @@ public:
virtual ShaderResourceDesc GetResource(Uint32 Index) const = 0;
};
-} // namespace Diligent
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h b/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h
index 0ddaa872..7bdac2cb 100644
--- a/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h
+++ b/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h
@@ -35,16 +35,17 @@
#include "ShaderResourceVariable.h"
#include "ResourceMapping.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
class IPipelineState;
// {061F8774-9A09-48E8-8411-B5BD20560104}
-static constexpr INTERFACE_ID IID_ShaderResourceBinding =
+static const struct INTERFACE_ID IID_ShaderResourceBinding =
{0x61f8774, 0x9a09, 0x48e8, {0x84, 0x11, 0xb5, 0xbd, 0x20, 0x56, 0x1, 0x4}};
+#if DILIGENT_CPP_INTERFACE
+
/// Shader resource binding interface
class IShaderResourceBinding : public IObject
{
@@ -117,4 +118,8 @@ public:
virtual void InitializeStaticResources(const IPipelineState* pPipelineState = nullptr) = 0;
};
-} // namespace Diligent
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h b/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h
index 7fb1c6c9..e42aa8f8 100644
--- a/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h
+++ b/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h
@@ -35,16 +35,17 @@
#include "DeviceObject.h"
#include "Shader.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
// {0D57DF3F-977D-4C8F-B64C-6675814BC80C}
-static constexpr INTERFACE_ID IID_ShaderResourceVariable =
+static const struct INTERFACE_ID IID_ShaderResourceVariable =
{0xd57df3f, 0x977d, 0x4c8f, {0xb6, 0x4c, 0x66, 0x75, 0x81, 0x4b, 0xc8, 0xc}};
+// clang-format off
/// Describes the type of the shader resource variable
-enum SHADER_RESOURCE_VARIABLE_TYPE : Uint8
+DILIGENT_TYPED_ENUM(SHADER_RESOURCE_VARIABLE_TYPE, Uint8)
{
/// Shader resource bound to the variable is the same for all SRB instances.
/// It must be set *once* directly through Pipeline State object.
@@ -64,11 +65,12 @@ enum SHADER_RESOURCE_VARIABLE_TYPE : Uint8
SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES
};
-
+#ifdef __cplusplus
static_assert(SHADER_RESOURCE_VARIABLE_TYPE_STATIC == 0 && SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE == 1 && SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC == 2 && SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES == 3, "BIND_SHADER_RESOURCES_UPDATE_* flags rely on shader variable SHADER_RESOURCE_VARIABLE_TYPE_* values being 0,1,2");
+#endif
/// Shader resource binding flags
-enum BIND_SHADER_RESOURCES_FLAGS : Uint32
+DILIGENT_TYPED_ENUM(BIND_SHADER_RESOURCES_FLAGS, Uint32)
{
/// Indicates that static shader variable bindings are to be updated.
BIND_SHADER_RESOURCES_UPDATE_STATIC = (0x01 << SHADER_RESOURCE_VARIABLE_TYPE_STATIC),
@@ -100,6 +102,9 @@ enum BIND_SHADER_RESOURCES_FLAGS : Uint32
BIND_SHADER_RESOURCES_VERIFY_ALL_RESOLVED = 0x10
};
+// clang-format on
+
+#if DILIGENT_CPP_INTERFACE
/// Shader resource variable
class IShaderResourceVariable : public IObject
@@ -139,4 +144,8 @@ public:
virtual bool IsBound(Uint32 ArrayIndex) const = 0;
};
-} // namespace Diligent
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/SwapChain.h b/Graphics/GraphicsEngine/interface/SwapChain.h
index 8ab4293b..eb065cfe 100644
--- a/Graphics/GraphicsEngine/interface/SwapChain.h
+++ b/Graphics/GraphicsEngine/interface/SwapChain.h
@@ -34,13 +34,16 @@
#include "TextureView.h"
#include "GraphicsTypes.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
// {1C703B77-6607-4EEC-B1FE-15C82D3B4130}
-static constexpr INTERFACE_ID IID_SwapChain =
+static const struct INTERFACE_ID IID_SwapChain =
{0x1c703b77, 0x6607, 0x4eec, {0xb1, 0xfe, 0x15, 0xc8, 0x2d, 0x3b, 0x41, 0x30}};
+
+#if DILIGENT_CPP_INTERFACE
+
/// Swap chain interface
/// The swap chain is created by a platform-dependent function
@@ -87,4 +90,8 @@ public:
virtual ITextureView* GetDepthBufferDSV() = 0;
};
-} // namespace Diligent
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/Texture.h b/Graphics/GraphicsEngine/interface/Texture.h
index cd6537dc..431e5d9f 100644
--- a/Graphics/GraphicsEngine/interface/Texture.h
+++ b/Graphics/GraphicsEngine/interface/Texture.h
@@ -34,26 +34,22 @@
#include "DeviceObject.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
-class IDeviceContext;
// {A64B0E60-1B5E-4CFD-B880-663A1ADCBE98}
-static constexpr INTERFACE_ID IID_Texture =
+static const struct INTERFACE_ID IID_Texture =
{0xa64b0e60, 0x1b5e, 0x4cfd,{0xb8, 0x80, 0x66, 0x3a, 0x1a, 0xdc, 0xbe, 0x98}};
/// Defines optimized depth-stencil clear value.
struct DepthStencilClearValue
{
/// Depth clear value
- Float32 Depth = 1.f;
+ Float32 Depth DEFAULT_INITIALIZER(1.f);
/// Stencil clear value
- Uint8 Stencil = 0;
-
- // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code:
- // DepthStencilClearValue{1, 0}
+ Uint8 Stencil DEFAULT_INITIALIZER(0);
+#if DILIGENT_CPP_INTERFACE
DepthStencilClearValue()noexcept{}
DepthStencilClearValue(Float32 _Depth,
@@ -61,20 +57,22 @@ struct DepthStencilClearValue
Depth {_Depth },
Stencil {_Stencil}
{}
+#endif
};
/// Defines optimized clear value.
struct OptimizedClearValue
{
/// Format
- TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
+ enum TEXTURE_FORMAT Format DEFAULT_INITIALIZER(TEX_FORMAT_UNKNOWN);
/// Render target clear value
- Float32 Color[4] = {0, 0, 0, 0};
+ Float32 Color[4] DEFAULT_INITIALIZER({});
/// Depth stencil clear value
- DepthStencilClearValue DepthStencil;
+ struct DepthStencilClearValue DepthStencil;
+#if DILIGENT_CPP_INTERFACE
bool operator == (const OptimizedClearValue& rhs)const
{
return Format == rhs.Format &&
@@ -85,63 +83,66 @@ struct OptimizedClearValue
DepthStencil.Depth == rhs.DepthStencil.Depth &&
DepthStencil.Stencil == rhs.DepthStencil.Stencil;
}
+#endif
};
/// Texture description
-struct TextureDesc : DeviceObjectAttribs
-{
+struct TextureDesc DILIGENT_DERIVE(DeviceObjectAttribs)
+
/// Texture type. See Diligent::RESOURCE_DIMENSION for details.
- RESOURCE_DIMENSION Type = RESOURCE_DIM_UNDEFINED;
+ enum RESOURCE_DIMENSION Type DEFAULT_INITIALIZER(RESOURCE_DIM_UNDEFINED);
/// Texture width, in pixels.
- Uint32 Width = 0;
+ Uint32 Width DEFAULT_INITIALIZER(0);
/// Texture height, in pixels.
- Uint32 Height = 0;
+ Uint32 Height DEFAULT_INITIALIZER(0);
union
{
/// For a 1D array or 2D array, number of array slices
- Uint32 ArraySize = 1;
+ Uint32 ArraySize DEFAULT_INITIALIZER(1);
/// For a 3D texture, number of depth slices
Uint32 Depth;
};
/// Texture format, see Diligent::TEXTURE_FORMAT.
- TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
+ enum TEXTURE_FORMAT Format DEFAULT_INITIALIZER(TEX_FORMAT_UNKNOWN);
/// Number of Mip levels in the texture. Multisampled textures can only have 1 Mip level.
/// Specify 0 to create full mipmap chain.
- Uint32 MipLevels = 1;
+ Uint32 MipLevels DEFAULT_INITIALIZER(1);
/// Number of samples.\n
/// Only 2D textures or 2D texture arrays can be multisampled.
- Uint32 SampleCount = 1;
+ Uint32 SampleCount DEFAULT_INITIALIZER(1);
/// Texture usage. See Diligent::USAGE for details.
- USAGE Usage = USAGE_DEFAULT;
+ enum USAGE Usage DEFAULT_INITIALIZER(USAGE_DEFAULT);
/// Bind flags, see Diligent::BIND_FLAGS for details. \n
/// The following bind flags are allowed:
/// Diligent::BIND_SHADER_RESOURCE, Diligent::BIND_RENDER_TARGET, Diligent::BIND_DEPTH_STENCIL,
/// Diligent::and BIND_UNORDERED_ACCESS. \n
/// Multisampled textures cannot have Diligent::BIND_UNORDERED_ACCESS flag set
- BIND_FLAGS BindFlags = BIND_NONE;
+ enum BIND_FLAGS BindFlags DEFAULT_INITIALIZER(BIND_NONE);
/// CPU access flags or 0 if no CPU access is allowed,
/// see Diligent::CPU_ACCESS_FLAGS for details.
- CPU_ACCESS_FLAGS CPUAccessFlags = CPU_ACCESS_NONE;
+ enum CPU_ACCESS_FLAGS CPUAccessFlags DEFAULT_INITIALIZER(CPU_ACCESS_NONE);
/// Miscellaneous flags, see Diligent::MISC_TEXTURE_FLAGS for details.
- MISC_TEXTURE_FLAGS MiscFlags = MISC_TEXTURE_FLAG_NONE;
+ enum MISC_TEXTURE_FLAGS MiscFlags DEFAULT_INITIALIZER(MISC_TEXTURE_FLAG_NONE);
/// Optimized clear value
- OptimizedClearValue ClearValue;
+ struct OptimizedClearValue ClearValue;
/// Defines which command queues this texture can be used with
- Uint64 CommandQueueMask = 1;
+ Uint64 CommandQueueMask DEFAULT_INITIALIZER(1);
+
+#if DILIGENT_CPP_INTERFACE
TextureDesc()noexcept{}
TextureDesc(RESOURCE_DIMENSION _Type,
@@ -199,6 +200,7 @@ struct TextureDesc : DeviceObjectAttribs
ClearValue == RHS.ClearValue &&
CommandQueueMask == RHS.CommandQueueMask;
}
+#endif
};
/// Describes data for one subresource
@@ -206,23 +208,25 @@ struct TextureSubResData
{
/// Pointer to the subresource data in CPU memory.
/// If provided, pSrcBuffer must be null
- const void* pData = nullptr;
+ const void* pData DEFAULT_INITIALIZER(nullptr);
/// Pointer to the GPU buffer that contains subresource data.
/// If provided, pData must be null
- class IBuffer* pSrcBuffer = nullptr;
+ class IBuffer* pSrcBuffer DEFAULT_INITIALIZER(nullptr);
/// When updating data from the buffer (pSrcBuffer is not null),
/// offset from the beginning of the buffer to the data start
- Uint32 SrcOffset = 0;
+ Uint32 SrcOffset DEFAULT_INITIALIZER(0);
/// For 2D and 3D textures, row stride in bytes
- Uint32 Stride = 0;
+ Uint32 Stride DEFAULT_INITIALIZER(0);
/// For 3D textures, depth slice stride in bytes
/// \note On OpenGL, this must be a mutliple of Stride
- Uint32 DepthStride = 0;
+ Uint32 DepthStride DEFAULT_INITIALIZER(0);
+
+#if DILIGENT_CPP_INTERFACE
/// Initializes the structure members with default values
/// Default values:
@@ -251,6 +255,7 @@ struct TextureSubResData
Stride {_Stride },
DepthStride {_DepthStride}
{}
+#endif
};
/// Describes the initial data to store in the texture
@@ -258,14 +263,15 @@ struct TextureData
{
/// Pointer to the array of the TextureSubResData elements containing
/// information about each subresource.
- TextureSubResData* pSubResources = nullptr;
+ struct TextureSubResData* pSubResources DEFAULT_INITIALIZER(nullptr);
/// Number of elements in pSubResources array.
/// NumSubresources must exactly match the number
/// of subresources in the texture. Otherwise an error
/// occurs.
- Uint32 NumSubresources = 0;
+ Uint32 NumSubresources DEFAULT_INITIALIZER(0);
+#if DILIGENT_CPP_INTERFACE
TextureData() noexcept {}
TextureData(TextureSubResData* _pSubResources,
@@ -273,14 +279,16 @@ struct TextureData
pSubResources {_pSubResources },
NumSubresources {_NumSubresources}
{}
+#endif
};
struct MappedTextureSubresource
{
- PVoid pData = nullptr;
- Uint32 Stride = 0;
- Uint32 DepthStride = 0;
+ PVoid pData DEFAULT_INITIALIZER(nullptr);
+ Uint32 Stride DEFAULT_INITIALIZER(0);
+ Uint32 DepthStride DEFAULT_INITIALIZER(0);
+#if DILIGENT_CPP_INTERFACE
MappedTextureSubresource() noexcept {}
MappedTextureSubresource(PVoid _pData,
@@ -290,8 +298,12 @@ struct MappedTextureSubresource
Stride {_Stride },
DepthStride {_DepthStride}
{}
+#endif
};
+
+#if DILIGENT_CPP_INTERFACE
+
/// Texture inteface
class ITexture : public IDeviceObject
{
@@ -353,4 +365,8 @@ public:
virtual RESOURCE_STATE GetState() const = 0;
};
-}
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/TextureView.h b/Graphics/GraphicsEngine/interface/TextureView.h
index cc56b484..d54d4174 100644
--- a/Graphics/GraphicsEngine/interface/TextureView.h
+++ b/Graphics/GraphicsEngine/interface/TextureView.h
@@ -35,17 +35,18 @@
#include "../../../Primitives/interface/FlagEnum.h"
#include "DeviceObject.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
-class IDeviceContext;
// {5B2EA04E-8128-45E4-AA4D-6DC7E70DC424}
-static constexpr INTERFACE_ID IID_TextureView =
+static const struct INTERFACE_ID IID_TextureView =
{0x5b2ea04e, 0x8128, 0x45e4,{0xaa, 0x4d, 0x6d, 0xc7, 0xe7, 0xd, 0xc4, 0x24}};
+// clang-format off
+
/// Describes allowed unordered access view mode
-enum UAV_ACCESS_FLAG : Uint8
+DILIGENT_TYPED_ENUM(UAV_ACCESS_FLAG, Uint8)
{
/// Access mode is unspecified
UAV_ACCESS_UNSPECIFIED = 0x00,
@@ -62,7 +63,7 @@ enum UAV_ACCESS_FLAG : Uint8
DEFINE_FLAG_ENUM_OPERATORS(UAV_ACCESS_FLAG)
/// Texture view flags
-enum TEXTURE_VIEW_FLAGS : Uint8
+DILIGENT_TYPED_ENUM(TEXTURE_VIEW_FLAGS, Uint8)
{
/// No flags
TEXTURE_VIEW_FLAG_NONE = 0x00,
@@ -74,51 +75,49 @@ enum TEXTURE_VIEW_FLAGS : Uint8
};
DEFINE_FLAG_ENUM_OPERATORS(TEXTURE_VIEW_FLAGS)
+
/// Texture view description
-struct TextureViewDesc : DeviceObjectAttribs
-{
- static constexpr Uint32 RemainingMipLevels = static_cast<Uint32>(-1);
- static constexpr Uint32 RemainingArraySlices = static_cast<Uint32>(-1);
+struct TextureViewDesc DILIGENT_DERIVE(DeviceObjectAttribs)
/// Describes the texture view type, see Diligent::TEXTURE_VIEW_TYPE for details.
- TEXTURE_VIEW_TYPE ViewType = TEXTURE_VIEW_UNDEFINED;
+ enum TEXTURE_VIEW_TYPE ViewType DEFAULT_INITIALIZER(TEXTURE_VIEW_UNDEFINED);
- /// View interpretation of the original texture. For instance,
+ /// View interpretation of the original texture. For instance,
/// one slice of a 2D texture array can be viewed as a 2D texture.
/// See Diligent::RESOURCE_DIMENSION for a list of texture types.
/// If default value Diligent::RESOURCE_DIM_UNDEFINED is provided,
/// the view type will match the type of the referenced texture.
- RESOURCE_DIMENSION TextureDim = RESOURCE_DIM_UNDEFINED;
+ enum RESOURCE_DIMENSION TextureDim DEFAULT_INITIALIZER(RESOURCE_DIM_UNDEFINED);
/// View format. If default value Diligent::TEX_FORMAT_UNKNOWN is provided,
/// the view format will match the referenced texture format.
- TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
-
+ enum TEXTURE_FORMAT Format DEFAULT_INITIALIZER(TEX_FORMAT_UNKNOWN);
+
/// Most detailed mip level to use
- Uint32 MostDetailedMip = 0;
+ Uint32 MostDetailedMip DEFAULT_INITIALIZER(0);
/// Total number of mip levels for the view of the texture.
/// Render target and depth stencil views can address only one mip level.
/// If 0 is provided, then for a shader resource view all mip levels will be
- /// referenced, and for a render target or a depth stencil view, one mip level
+ /// referenced, and for a render target or a depth stencil view, one mip level
/// will be referenced.
- Uint32 NumMipLevels = 0;
+ Uint32 NumMipLevels DEFAULT_INITIALIZER(0);
union
{
/// For a texture array, first array slice to address in the view
- Uint32 FirstArraySlice = 0;
+ Uint32 FirstArraySlice DEFAULT_INITIALIZER(0);
/// For a 3D texture, first depth slice to address the view
Uint32 FirstDepthSlice;
};
-
+
union
{
/// For a texture array, number of array slices to address in the view.
/// Set to 0 to address all array slices.
- Uint32 NumArraySlices = 0;
-
+ Uint32 NumArraySlices DEFAULT_INITIALIZER(0);
+
/// For a 3D texture, number of depth slices to address in the view
/// Set to 0 to address all depth slices.
Uint32 NumDepthSlices;
@@ -126,12 +125,14 @@ struct TextureViewDesc : DeviceObjectAttribs
/// For an unordered access view, allowed access flags. See Diligent::UAV_ACCESS_FLAG
/// for details.
- UAV_ACCESS_FLAG AccessFlags = UAV_ACCESS_UNSPECIFIED;
-
+ enum UAV_ACCESS_FLAG AccessFlags DEFAULT_INITIALIZER(UAV_ACCESS_UNSPECIFIED);
+
/// Texture view flags, see Diligent::TEXTURE_VIEW_FLAGS.
- TEXTURE_VIEW_FLAGS Flags = TEXTURE_VIEW_FLAG_NONE;
+ enum TEXTURE_VIEW_FLAGS Flags DEFAULT_INITIALIZER(TEXTURE_VIEW_FLAG_NONE);
+
+#if DILIGENT_CPP_INTERFACE
- TextureViewDesc()noexcept{}
+ TextureViewDesc() noexcept {}
TextureViewDesc(TEXTURE_VIEW_TYPE _ViewType,
RESOURCE_DIMENSION _TextureDim,
@@ -141,42 +142,49 @@ struct TextureViewDesc : DeviceObjectAttribs
Uint32 _FirstArrayOrDepthSlice = TextureViewDesc{}.FirstArraySlice,
Uint32 _NumArrayOrDepthSlices = TextureViewDesc{}.NumArraySlices,
UAV_ACCESS_FLAG _AccessFlags = TextureViewDesc{}.AccessFlags,
- TEXTURE_VIEW_FLAGS _Flags = TextureViewDesc{}.Flags)noexcept :
- ViewType {_ViewType },
- TextureDim {_TextureDim },
- Format {_Format },
- MostDetailedMip {_MostDetailedMip },
- NumMipLevels {_NumMipLevels },
- FirstArraySlice {_FirstArrayOrDepthSlice},
- NumArraySlices {_NumArrayOrDepthSlices },
- AccessFlags {_AccessFlags },
- Flags {_Flags }
+ TEXTURE_VIEW_FLAGS _Flags = TextureViewDesc{}.Flags) noexcept :
+ ViewType{_ViewType},
+ TextureDim{_TextureDim},
+ Format{_Format},
+ MostDetailedMip{_MostDetailedMip},
+ NumMipLevels{_NumMipLevels},
+ FirstArraySlice{_FirstArrayOrDepthSlice},
+ NumArraySlices{_NumArrayOrDepthSlices},
+ AccessFlags{_AccessFlags},
+ Flags{_Flags}
{}
/// Tests if two structures are equivalent
/// \param [in] RHS - reference to the structure to perform comparison with
- /// \return
+ /// \return
/// - True if all members of the two structures are equal.
/// - False otherwise
- bool operator == (const TextureViewDesc& RHS)const
+ bool operator==(const TextureViewDesc& RHS) const
{
- // Name is primarily used for debug purposes and does not affect the view.
- // It is ignored in comparison operation.
+ // Name is primarily used for debug purposes and does not affect the view.
+ // It is ignored in comparison operation.
return //strcmp(Name, RHS.Name) == 0 &&
- ViewType == RHS.ViewType &&
- TextureDim == RHS.TextureDim &&
- Format == RHS.Format &&
- MostDetailedMip == RHS.MostDetailedMip &&
- NumMipLevels == RHS.NumMipLevels &&
- FirstArraySlice == RHS.FirstArraySlice &&
- FirstDepthSlice == RHS.FirstDepthSlice &&
- NumArraySlices == RHS.NumArraySlices &&
- NumDepthSlices == RHS.NumDepthSlices &&
- AccessFlags == RHS.AccessFlags;
+ ViewType == RHS.ViewType &&
+ TextureDim == RHS.TextureDim &&
+ Format == RHS.Format &&
+ MostDetailedMip == RHS.MostDetailedMip &&
+ NumMipLevels == RHS.NumMipLevels &&
+ FirstArraySlice == RHS.FirstArraySlice &&
+ FirstDepthSlice == RHS.FirstDepthSlice &&
+ NumArraySlices == RHS.NumArraySlices &&
+ NumDepthSlices == RHS.NumDepthSlices &&
+ AccessFlags == RHS.AccessFlags;
}
+#else
+
+#endif
};
+// clang-format on
+
+#if DILIGENT_CPP_INTERFACE
+
/// Texture view interface
/// \remarks
@@ -189,29 +197,33 @@ class ITextureView : public IDeviceObject
{
public:
/// Queries the specific interface, see IObject::QueryInterface() for details
- virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override = 0;
+ virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override = 0;
/// Returns the texture view description used to create the object
- virtual const TextureViewDesc& GetDesc()const override = 0;
+ virtual const TextureViewDesc& GetDesc() const override = 0;
/// Sets the texture sampler to use for filtering operations
/// when accessing a texture from shaders. Only
/// shader resource views can be assigned a sampler.
/// The view will keep strong reference to the sampler.
- virtual void SetSampler( class ISampler *pSampler ) = 0;
+ virtual void SetSampler(class ISampler* pSampler) = 0;
/// Returns the pointer to the sampler object set by the ITextureView::SetSampler().
- /// The method does *NOT* call AddRef() on the returned interface,
+ /// The method does *NOT* call AddRef() on the returned interface,
/// so Release() must not be called.
virtual ISampler* GetSampler() = 0;
-
+
/// Returns the pointer to the referenced texture object.
- /// The method does *NOT* call AddRef() on the returned interface,
+ /// The method does *NOT* call AddRef() on the returned interface,
/// so Release() must not be called.
virtual class ITexture* GetTexture() = 0;
};
-}
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE
diff --git a/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp b/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp
index 39f98b55..83daa62d 100644
--- a/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp
+++ b/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp
@@ -30,6 +30,7 @@
#include "ObjectBase.h"
#include "RefCntAutoPtr.h"
#include "EngineMemory.h"
+#include "BasicFileStream.h"
namespace Diligent
{