summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-02-08 19:14:34 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-02-08 19:14:34 +0000
commitfdb17bd1b125ced2d7d1e871de4184433446f6b1 (patch)
treeeee1b24f0a2ae298da1ae55c3cf9d5e4438cc9d2 /Graphics/GraphicsEngine
parentMinor updates to StandardFile (diff)
downloadDiligentCore-fdb17bd1b125ced2d7d1e871de4184433446f6b1.tar.gz
DiligentCore-fdb17bd1b125ced2d7d1e871de4184433446f6b1.zip
Cleared interface: removed superfluous default constructors; added default memeber initializers instead.
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/PipelineStateBase.h2
-rw-r--r--Graphics/GraphicsEngine/interface/BlendState.h83
-rw-r--r--Graphics/GraphicsEngine/interface/Buffer.h32
-rw-r--r--Graphics/GraphicsEngine/interface/BufferView.h12
-rw-r--r--Graphics/GraphicsEngine/interface/Constants.h8
-rw-r--r--Graphics/GraphicsEngine/interface/DepthStencilState.h81
-rw-r--r--Graphics/GraphicsEngine/interface/DeviceCaps.h14
-rw-r--r--Graphics/GraphicsEngine/interface/DeviceContext.h48
-rw-r--r--Graphics/GraphicsEngine/interface/DeviceObject.h2
-rw-r--r--Graphics/GraphicsEngine/interface/GraphicsTypes.h130
-rw-r--r--Graphics/GraphicsEngine/interface/InputLayout.h39
-rw-r--r--Graphics/GraphicsEngine/interface/MapHelper.h66
-rw-r--r--Graphics/GraphicsEngine/interface/PipelineState.h32
-rw-r--r--Graphics/GraphicsEngine/interface/RasterizerState.h61
-rw-r--r--Graphics/GraphicsEngine/interface/Sampler.h84
-rw-r--r--Graphics/GraphicsEngine/interface/Shader.h50
-rw-r--r--Graphics/GraphicsEngine/interface/ShaderResourceBinding.h2
-rw-r--r--Graphics/GraphicsEngine/interface/Texture.h88
-rw-r--r--Graphics/GraphicsEngine/interface/TextureView.h43
19 files changed, 338 insertions, 539 deletions
diff --git a/Graphics/GraphicsEngine/include/PipelineStateBase.h b/Graphics/GraphicsEngine/include/PipelineStateBase.h
index 38fb3677..e9b21986 100644
--- a/Graphics/GraphicsEngine/include/PipelineStateBase.h
+++ b/Graphics/GraphicsEngine/include/PipelineStateBase.h
@@ -62,7 +62,7 @@ public:
const PipelineStateDesc& PSODesc,
bool bIsDeviceInternal = false ) :
TDeviceObjectBase( pRefCounters, pDevice, PSODesc, bIsDeviceInternal ),
- m_LayoutElements( PSODesc.GraphicsPipeline.InputLayout.NumElements, LayoutElement(), STD_ALLOCATOR_RAW_MEM(LayoutElement, GetRawAllocator(), "Allocator for vector<LayoutElement>" ) ),
+ m_LayoutElements( PSODesc.GraphicsPipeline.InputLayout.NumElements, LayoutElement{}, STD_ALLOCATOR_RAW_MEM(LayoutElement, GetRawAllocator(), "Allocator for vector<LayoutElement>" ) ),
m_NumShaders(0)
{
if (this->m_Desc.IsComputePipeline)
diff --git a/Graphics/GraphicsEngine/interface/BlendState.h b/Graphics/GraphicsEngine/interface/BlendState.h
index b19d6dca..b3de5025 100644
--- a/Graphics/GraphicsEngine/interface/BlendState.h
+++ b/Graphics/GraphicsEngine/interface/BlendState.h
@@ -262,66 +262,47 @@ enum LOGIC_OPERATION : Int8
/// blend states for render targets
struct RenderTargetBlendDesc
{
- /// Enable or disable blending for this render target.
- Bool BlendEnable;
+ /// Enable or disable blending for this render target. Default value: False.
+ Bool BlendEnable = False;
- /// Enable or disable a logical operation for this render target.
- Bool LogicOperationEnable;
+ /// Enable or disable a logical operation for this render target. Default value: False.
+ Bool LogicOperationEnable = False;
/// Specifies the blend factor to apply to the RGB value output from the pixel shader
- BLEND_FACTOR SrcBlend;
+ /// Default value: Diligent::BLEND_FACTOR_ONE.
+ BLEND_FACTOR SrcBlend = BLEND_FACTOR_ONE;
/// Specifies the blend factor to apply to the RGB value in the render target
- BLEND_FACTOR DestBlend;
+ /// Default value: Diligent::BLEND_FACTOR_ZERO.
+ BLEND_FACTOR DestBlend = BLEND_FACTOR_ZERO;
/// Defines how to combine the source and destination RGB values
/// after applying the SrcBlend and DestBlend factors.
- BLEND_OPERATION BlendOp;
+ /// Default value: Diligent::BLEND_OPERATION_ADD.
+ BLEND_OPERATION BlendOp = 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.
- BLEND_FACTOR SrcBlendAlpha;
+ /// Default value: Diligent::BLEND_FACTOR_ONE.
+ BLEND_FACTOR SrcBlendAlpha = 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.
- BLEND_FACTOR DestBlendAlpha;
+ /// Default value: Diligent::BLEND_FACTOR_ZERO.
+ BLEND_FACTOR DestBlendAlpha = BLEND_FACTOR_ZERO;
/// Defines how to combine the source and destination alpha values
/// after applying the SrcBlendAlpha and DestBlendAlpha factors.
- BLEND_OPERATION BlendOpAlpha;
+ /// Default value: Diligent::BLEND_OPERATION_ADD.
+ BLEND_OPERATION BlendOpAlpha = BLEND_OPERATION_ADD;
/// Defines logical operation for the render target.
- LOGIC_OPERATION LogicOp;
-
- /// Render target write mask
- Uint8 RenderTargetWriteMask;
-
- /// Constructor initializes structure members with default values
-
- /// Member | Default value
- /// ----------------------|--------------
- /// BlendEnable | False
- /// LogicOperationEnable | False
- /// SrcBlend | Diligent::BLEND_FACTOR_ONE
- /// DestBlend | Diligent::BLEND_FACTOR_ZERO
- /// BlendOp | Diligent::BLEND_OPERATION_ADD
- /// SrcBlendAlpha | Diligent::BLEND_FACTOR_ONE
- /// DestBlendAlpha | Diligent::BLEND_FACTOR_ZERO
- /// BlendOpAlpha | Diligent::BLEND_OPERATION_ADD
- /// LogicOp | Diligent::LOGIC_OP_NOOP
- /// RenderTargetWriteMask | Diligent::COLOR_MASK_ALL
- RenderTargetBlendDesc() :
- BlendEnable ( False ),
- LogicOperationEnable(False),
- SrcBlend ( BLEND_FACTOR_ONE ),
- DestBlend ( BLEND_FACTOR_ZERO ),
- BlendOp ( BLEND_OPERATION_ADD ),
- SrcBlendAlpha ( BLEND_FACTOR_ONE ),
- DestBlendAlpha ( BLEND_FACTOR_ZERO ),
- BlendOpAlpha ( BLEND_OPERATION_ADD ),
- LogicOp ( LOGIC_OP_NOOP ),
- RenderTargetWriteMask( COLOR_MASK_ALL )
- {}
+ /// Default value: Diligent::LOGIC_OP_NOOP.
+ LOGIC_OPERATION LogicOp = LOGIC_OP_NOOP;
+
+ /// Render target write mask.
+ /// Default value: Diligent::COLOR_MASK_ALL.
+ Uint8 RenderTargetWriteMask = COLOR_MASK_ALL;
/// Comparison operator tests if two structures are equivalent
@@ -352,11 +333,11 @@ 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;
+ Bool AlphaToCoverageEnable = 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;
+ Bool IndependentBlendEnable = False;
/// Constant member defining the maximum number of render targets
static constexpr int MaxRenderTargets = 8;
@@ -365,21 +346,7 @@ struct BlendStateDesc
/// states for render targets
RenderTargetBlendDesc RenderTargets[MaxRenderTargets];
- /// Constructor initializes structure members with default values
-
- /// Member | Default value
- /// ----------------------|--------------
- /// AlphaToCoverageEnable | False
- /// IndependentBlendEnable| False
- ///
- /// Members of RenderTargets[] are initialized with default values by
- /// RenderTargetBlendDesc::RenderTargetBlendDesc()
- BlendStateDesc() :
- AlphaToCoverageEnable(False),
- IndependentBlendEnable(False)
- {
- }
-
+
/// Comparison operator tests if two structures are equivalent
/// \param [in] RHS - reference to the structure to perform comparison with
diff --git a/Graphics/GraphicsEngine/interface/Buffer.h b/Graphics/GraphicsEngine/interface/Buffer.h
index 0cf6efe4..94cde8da 100644
--- a/Graphics/GraphicsEngine/interface/Buffer.h
+++ b/Graphics/GraphicsEngine/interface/Buffer.h
@@ -67,7 +67,7 @@ enum BUFFER_MODE : Uint8
struct BufferDesc : DeviceObjectAttribs
{
/// Size of the buffer, in bytes. For a uniform buffer, this must be multiple of 16.
- Uint32 uiSizeInBytes = 0;
+ Uint32 uiSizeInBytes = 0;
/// Buffer bind flags, see Diligent::BIND_FLAGS for details
@@ -75,17 +75,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 = BIND_NONE;
/// Buffer usage, see Diligent::USAGE for details
- USAGE Usage = USAGE_DEFAULT;
+ USAGE Usage = 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;
/// Buffer mode, see Diligent::BUFFER_MODE
- BUFFER_MODE Mode = BUFFER_MODE_UNDEFINED;
+ BUFFER_MODE Mode = BUFFER_MODE_UNDEFINED;
/// Buffer element stride, in bytes.
@@ -94,10 +94,10 @@ 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 = 0;
/// Defines which command queues this buffer can be used with
- Uint64 CommandQueueMask = 1;
+ Uint64 CommandQueueMask = 1;
/// Tests if two structures are equivalent
@@ -123,22 +123,10 @@ struct BufferDesc : DeviceObjectAttribs
struct BufferData
{
/// Pointer to the data
- const void* pData;
+ const void* pData = nullptr;
/// Data size, in bytes
- Uint32 DataSize;
-
- /// Initializes the structure members with default values
-
- /// Default values:
- /// Member | Default value
- /// --------------------|--------------
- /// pData | nullptr
- /// DataSize | 0
- BufferData() :
- pData(nullptr),
- DataSize(0)
- {}
+ Uint32 DataSize = 0;
};
/// Buffer interface
@@ -148,7 +136,7 @@ class IBuffer : public IDeviceObject
{
public:
/// Queries the specific interface, see IObject::QueryInterface() for details
- virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface ) = 0;
+ virtual void QueryInterface( const Diligent::INTERFACE_ID& IID, IObject** ppInterface ) = 0;
/// Returns the buffer description used to create the object
virtual const BufferDesc& GetDesc()const = 0;
@@ -164,7 +152,7 @@ public:
/// until all views are released.\n
/// The function calls AddRef() for the created interface, so it must be released by
/// a call to Release() when it is no longer needed.
- virtual void CreateView( const struct BufferViewDesc &ViewDesc, class IBufferView **ppView ) = 0;
+ virtual void CreateView( const struct BufferViewDesc& ViewDesc, class IBufferView** ppView ) = 0;
/// Returns the pointer to the default view.
diff --git a/Graphics/GraphicsEngine/interface/BufferView.h b/Graphics/GraphicsEngine/interface/BufferView.h
index c61988fe..6b3baff4 100644
--- a/Graphics/GraphicsEngine/interface/BufferView.h
+++ b/Graphics/GraphicsEngine/interface/BufferView.h
@@ -39,18 +39,18 @@ static constexpr INTERFACE_ID IID_BufferView =
struct BufferFormat
{
/// Type of components. For a formatted buffer views, this value cannot be VT_UNDEFINED
- VALUE_TYPE ValueType = VT_UNDEFINED;
+ VALUE_TYPE ValueType = 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 = 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 = False;
/// Tests if two structures are equivalent
bool operator == (const BufferFormat& RHS)const
@@ -74,10 +74,10 @@ struct BufferViewDesc : DeviceObjectAttribs
/// 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 = 0;
/// Size in bytes of the referenced buffer region
- Uint32 ByteWidth = 0;
+ Uint32 ByteWidth = 0;
/// Comparison operator tests if two structures are equivalent
@@ -109,7 +109,7 @@ class IBufferView : public IDeviceObject
{
public:
/// Queries the specific interface, see IObject::QueryInterface() for details
- virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface ) = 0;
+ virtual void QueryInterface( const Diligent::INTERFACE_ID& IID, IObject** ppInterface ) = 0;
/// Returns the buffer view description used to create the object
virtual const BufferViewDesc& GetDesc()const = 0;
diff --git a/Graphics/GraphicsEngine/interface/Constants.h b/Graphics/GraphicsEngine/interface/Constants.h
index d3743811..3b60052f 100644
--- a/Graphics/GraphicsEngine/interface/Constants.h
+++ b/Graphics/GraphicsEngine/interface/Constants.h
@@ -32,14 +32,14 @@ namespace Diligent
{
/// Maximum number of input buffer slots.
/// D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT == 32
- static constexpr Uint32 MaxBufferSlots = 32;
+ static constexpr Uint32 MaxBufferSlots = 32;
/// Maximum number of simultaneous render targets.
- static constexpr Uint32 MaxRenderTargets = 8;
+ static constexpr Uint32 MaxRenderTargets = 8;
/// Maximum number of viewports.
- static constexpr Uint32 MaxViewports = 16;
+ static constexpr Uint32 MaxViewports = 16;
/// Maximum number of shader stages in a pipeline.
- static constexpr Uint32 MaxShadersInPipeline = 5;
+ static constexpr Uint32 MaxShadersInPipeline = 5;
}
diff --git a/Graphics/GraphicsEngine/interface/DepthStencilState.h b/Graphics/GraphicsEngine/interface/DepthStencilState.h
index 2e062e7b..9307a192 100644
--- a/Graphics/GraphicsEngine/interface/DepthStencilState.h
+++ b/Graphics/GraphicsEngine/interface/DepthStencilState.h
@@ -92,33 +92,20 @@ enum STENCIL_OP : Int8
struct StencilOpDesc
{
/// The stencil operation to perform when stencil testing fails.
- STENCIL_OP StencilFailOp;
+ /// Default value: Diligent::STENCIL_OP_KEEP.
+ STENCIL_OP StencilFailOp = STENCIL_OP_KEEP;
/// The stencil operation to perform when stencil testing passes and depth testing fails.
- STENCIL_OP StencilDepthFailOp;
+ /// Default value: Diligent::STENCIL_OP_KEEP.
+ STENCIL_OP StencilDepthFailOp = STENCIL_OP_KEEP;
/// The stencil operation to perform when stencil testing and depth testing both pass.
- STENCIL_OP StencilPassOp;
-
- /// A function that compares stencil data against existing stencil data. See
- /// Diligent::COMPARISON_FUNCTION.
- COMPARISON_FUNCTION StencilFunc;
-
- /// Initializes the structure members with default values
-
- /// Default values:
- /// Member | Default value
- /// --------------------|--------------
- /// StencilFailOp | Diligent::STENCIL_OP_KEEP
- /// StencilDepthFailOp | Diligent::STENCIL_OP_KEEP
- /// StencilPassOp | Diligent::STENCIL_OP_KEEP
- /// StencilFunc | Diligent::COMPARISON_FUNC_ALWAYS
- StencilOpDesc() :
- StencilFailOp ( STENCIL_OP_KEEP ),
- StencilDepthFailOp( STENCIL_OP_KEEP ),
- StencilPassOp ( STENCIL_OP_KEEP ),
- StencilFunc ( COMPARISON_FUNC_ALWAYS )
- {}
+ /// Default value: Diligent::STENCIL_OP_KEEP.
+ STENCIL_OP StencilPassOp = 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;
/// Tests if two structures are equivalent
@@ -146,24 +133,27 @@ 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
- Bool DepthEnable;
+ /// and no stencil operations are performed. Default value: True.
+ Bool DepthEnable = True;
- /// Enable or disable writes to a depth buffer
- Bool DepthWriteEnable;
+ /// Enable or disable writes to a depth buffer. Default value: True.
+ Bool DepthWriteEnable = True;
/// A function that compares depth data against existing depth data.
/// See Diligent::COMPARISON_FUNCTION for details.
- COMPARISON_FUNCTION DepthFunc;
+ /// Default value: Diligent::COMPARISON_FUNC_LESS.
+ COMPARISON_FUNCTION DepthFunc = COMPARISON_FUNC_LESS;
- /// Enable stencil opertaions.
- Bool StencilEnable;
+ /// Enable stencil opertaions. Default value: False.
+ Bool StencilEnable = False;
/// Identify which bits of the depth-stencil buffer are accessed when reading stencil data.
- Uint8 StencilReadMask;
+ /// Default value: 0xFF.
+ Uint8 StencilReadMask = 0xFF;
/// Identify which bits of the depth-stencil buffer are accessed when writing stencil data.
- Uint8 StencilWriteMask;
+ /// Default value: 0xFF.
+ Uint8 StencilWriteMask = 0xFF;
/// Identify stencil operations for the front-facing triangles, see Diligent::StencilOpDesc.
StencilOpDesc FrontFace;
@@ -171,33 +161,6 @@ struct DepthStencilStateDesc
/// Identify stencil operations for the back-facing triangles, see Diligent::StencilOpDesc.
StencilOpDesc BackFace;
- /// Initializes the structure members
-
- /// Default values:
- /// Member | Default value
- /// --------------------|--------------
- /// DepthEnable | True
- /// DepthWriteEnable | True
- /// DepthFunc | Diligent::COMPARISON_FUNC_LESS
- /// StencilEnable | False
- /// StencilReadMask | 0xFF
- /// StencilWriteMask | 0xFF
- ///
- /// Members of FrontFace and BackFace
- /// are initialized by StencilOpDesc::StencilOpDesc()
- DepthStencilStateDesc(Bool _DepthEnable = True,
- Bool _DepthWriteEnable = True,
- COMPARISON_FUNCTION _DepthFunc = COMPARISON_FUNC_LESS,
- Bool _StencilEnable = False,
- Uint8 _StencilReadMask = 0xFF,
- Uint8 _StencilWriteMask = 0xFF) :
- DepthEnable ( _DepthEnable ),
- DepthWriteEnable( _DepthWriteEnable ),
- DepthFunc ( _DepthFunc ),
- StencilEnable ( _StencilEnable ),
- StencilReadMask ( _StencilReadMask ),
- StencilWriteMask( _StencilWriteMask )
- {}
/// Tests if two structures are equivalent
diff --git a/Graphics/GraphicsEngine/interface/DeviceCaps.h b/Graphics/GraphicsEngine/interface/DeviceCaps.h
index 10751f2e..c6b30671 100644
--- a/Graphics/GraphicsEngine/interface/DeviceCaps.h
+++ b/Graphics/GraphicsEngine/interface/DeviceCaps.h
@@ -46,35 +46,35 @@ namespace Diligent
struct SamplerCaps
{
/// Indicates if device supports border texture addressing mode
- Bool bBorderSamplingModeSupported = True;
+ Bool bBorderSamplingModeSupported = True;
/// Indicates if device supports anisotrpoic filtering
Bool bAnisotropicFilteringSupported = True;
/// Indicates if device supports MIP load bias
- Bool bLODBiasSupported = True;
+ Bool bLODBiasSupported = True;
};
/// Texture capabilities
struct TextureCaps
{
/// Indicates if device supports 1D textures
- Bool bTexture1DSupported = True;
+ Bool bTexture1DSupported = True;
/// Indicates if device supports 1D texture arrays
- Bool bTexture1DArraySupported = True;
+ Bool bTexture1DArraySupported = True;
/// Indicates if device supports 2D multisampled textures
- Bool bTexture2DMSSupported = True;
+ Bool bTexture2DMSSupported = True;
/// Indicates if device supports 2D multisampled texture arrays
Bool bTexture2DMSArraySupported = True;
/// Indicates if device supports texture views
- Bool bTextureViewSupported = True;
+ Bool bTextureViewSupported = True;
/// Indicates if device supports cubemap arrays
- Bool bCubemapArraysSupported = True;
+ Bool bCubemapArraysSupported = True;
};
/// Device capabilities
diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h
index f12ef6b6..ed9aa996 100644
--- a/Graphics/GraphicsEngine/interface/DeviceContext.h
+++ b/Graphics/GraphicsEngine/interface/DeviceContext.h
@@ -114,29 +114,29 @@ struct DrawAttribs
};
/// Indicates if index buffer will be used to index input vertices.
- Bool IsIndexed = False;
+ Bool IsIndexed = False;
/// For an indexed draw call, type of elements in the index buffer.
/// Allowed values: VT_UINT16 and VT_UINT32. Ignored if DrawAttribs::IsIndexed is False.
- VALUE_TYPE IndexType = VT_UNDEFINED;
+ VALUE_TYPE IndexType = VT_UNDEFINED;
/// Additional flags, see Diligent::DRAW_FLAGS.
- DRAW_FLAGS Flags = DRAW_FLAG_NONE;
+ DRAW_FLAGS Flags = DRAW_FLAG_NONE;
/// State transition mode for indirect draw arguments buffer. Ignored if pIndirectDrawAttribs member is null.
RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
/// Number of instances to draw. If more than one instance is specified,
/// instanced draw call will be performed.
- Uint32 NumInstances = 1;
+ Uint32 NumInstances = 1;
/// For indexed rendering, a constant which is added to each index before
/// accessing the vertex buffer.
- Uint32 BaseVertex = 0;
+ Uint32 BaseVertex = 0;
/// For indirect rendering, offset from the beginning of the buffer to the location
/// of draw command attributes. Ignored if DrawAttribs::pIndirectDrawAttribs is null.
- Uint32 IndirectDrawArgsOffset = 0;
+ Uint32 IndirectDrawArgsOffset = 0;
union
{
@@ -257,29 +257,31 @@ DEFINE_FLAG_ENUM_OPERATORS(CLEAR_DEPTH_STENCIL_FLAGS)
/// This structure is used by IDeviceContext::DispatchCompute().
struct DispatchComputeAttribs
{
- Uint32 ThreadGroupCountX; ///< Number of groups dispatched in X direction.
- Uint32 ThreadGroupCountY; ///< Number of groups dispatched in Y direction.
- Uint32 ThreadGroupCountZ; ///< Number of groups dispatched in Z direction.
+ 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.
/// Pointer to the buffer containing dispatch arguments.
/// If not nullptr, then indirect dispatch command is executed, and
/// ThreadGroupCountX, ThreadGroupCountY, and ThreadGroupCountZ are ignored.
- IBuffer* pIndirectDispatchAttribs;
+ IBuffer* pIndirectDispatchAttribs = nullptr;
/// If pIndirectDispatchAttribs is not nullptr, indicates offset from the beginning
/// of the buffer to the dispatch command arguments. Ignored otherwise.
- Uint32 DispatchArgsByteOffset;
+ Uint32 DispatchArgsByteOffset = 0;
/// State transition mode for indirect dispatch attributes buffer. This member is ignored if pIndirectDispatchAttribs member is null.
RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
+ DispatchComputeAttribs()noexcept{}
+
/// Initializes the structure to perform non-indirect dispatch command.
/// \param [in] GroupsX - Number of groups dispatched in X direction. Default value is 1.
/// \param [in] GroupsY - Number of groups dispatched in Y direction. Default value is 1.
/// \param [in] GroupsZ - Number of groups dispatched in Z direction. Default value is 1.
explicit
- DispatchComputeAttribs(Uint32 GroupsX = 1, Uint32 GroupsY = 1, Uint32 GroupsZ = 1) :
+ DispatchComputeAttribs(Uint32 GroupsX, Uint32 GroupsY = 1, Uint32 GroupsZ = 1)noexcept :
ThreadGroupCountX (GroupsX),
ThreadGroupCountY (GroupsY),
ThreadGroupCountZ (GroupsZ),
@@ -323,25 +325,25 @@ 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 = 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 = 0.f;
/// Viewport width.
- Float32 Width = 0.f;
+ Float32 Width = 0.f;
/// Viewport Height.
- Float32 Height = 0.f;
+ Float32 Height = 0.f;
/// Minimum depth of the viewport. Ranges between 0 and 1.
- Float32 MinDepth = 0.f;
+ Float32 MinDepth = 0.f;
/// Maximum depth of the viewport. Ranges between 0 and 1.
- Float32 MaxDepth = 1.f;
+ Float32 MaxDepth = 1.f;
/// Initializes the structure.
Viewport(Float32 _TopLeftX, Float32 _TopLeftY,
@@ -373,14 +375,14 @@ struct Rect
Int32 bottom = 0; ///< Y coordinate of the bottom boundary of the viewport.
/// Initializes the structure
- Rect(Int32 _left, Int32 _top, Int32 _right, Int32 _bottom) :
+ Rect(Int32 _left, Int32 _top, Int32 _right, Int32 _bottom)noexcept :
left ( _left ),
top ( _top ),
right ( _right ),
bottom( _bottom )
{}
- Rect(){}
+ Rect()noexcept{}
};
@@ -425,12 +427,12 @@ struct CopyTextureAttribs
/// Destination texture state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE).
RESOURCE_STATE_TRANSITION_MODE DstTextureTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
- CopyTextureAttribs(){}
+ CopyTextureAttribs()noexcept{}
CopyTextureAttribs(ITexture* _pSrcTexture,
RESOURCE_STATE_TRANSITION_MODE _SrcTextureTransitionMode,
ITexture* _pDstTexture,
- RESOURCE_STATE_TRANSITION_MODE _DstTextureTransitionMode) :
+ RESOURCE_STATE_TRANSITION_MODE _DstTextureTransitionMode)noexcept :
pSrcTexture (_pSrcTexture),
SrcTextureTransitionMode(_SrcTextureTransitionMode),
pDstTexture (_pDstTexture),
@@ -448,7 +450,7 @@ class IDeviceContext : public IObject
{
public:
/// Queries the specific interface, see IObject::QueryInterface() for details.
- virtual void QueryInterface(const Diligent::INTERFACE_ID &IID, IObject** ppInterface) = 0;
+ virtual void QueryInterface(const Diligent::INTERFACE_ID& IID, IObject** ppInterface) = 0;
/// Sets the pipeline state.
diff --git a/Graphics/GraphicsEngine/interface/DeviceObject.h b/Graphics/GraphicsEngine/interface/DeviceObject.h
index 0664e863..e74ebdc7 100644
--- a/Graphics/GraphicsEngine/interface/DeviceObject.h
+++ b/Graphics/GraphicsEngine/interface/DeviceObject.h
@@ -41,7 +41,7 @@ class IDeviceObject : public IObject
{
public:
/// Queries the specific interface, see IObject::QueryInterface() for details
- virtual void QueryInterface( const INTERFACE_ID &IID, IObject **ppInterface ) = 0;
+ virtual void QueryInterface( const INTERFACE_ID& IID, IObject** ppInterface ) = 0;
/// Returns the buffer object description
virtual const DeviceObjectAttribs& GetDesc()const = 0;
diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
index d3a44f2a..3277452a 100644
--- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h
+++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
@@ -1070,37 +1070,32 @@ namespace Diligent
struct DeviceObjectAttribs
{
/// Object name
- const Char* Name;
-
- /// Constructor intializes the structure members with default values
- DeviceObjectAttribs() :
- Name(nullptr)
- {}
+ const Char* Name = nullptr;
};
/// Hardware adapter attributes
struct HardwareAdapterAttribs
{
/// A string that contains the adapter description
- char Description[128];
+ char Description[128] = {};
/// Dedicated video memory, in bytes
- size_t DedicatedVideoMemory;
+ size_t DedicatedVideoMemory = 0;
/// Dedicated system memory, in bytes
- size_t DedicatedSystemMemory;
+ size_t DedicatedSystemMemory = 0;
/// Dedicated shared memory, in bytes
- size_t SharedSystemMemory;
+ size_t SharedSystemMemory = 0;
/// The PCI ID of the hardware vendor
- Uint32 VendorId;
+ Uint32 VendorId = 0;
/// The PCI ID of the hardware device
- Uint32 DeviceId;
+ Uint32 DeviceId = 0;
/// Number of outputs this device has
- Uint32 NumOutputs;
+ Uint32 NumOutputs = 0;
};
@@ -1147,65 +1142,53 @@ namespace Diligent
};
/// Display resolution width
- Uint32 Width = 0;
+ Uint32 Width = 0;
/// Display resolution height
- Uint32 Height = 0;
+ Uint32 Height = 0;
/// Display format
- TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
+ TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
/// Refresh rate numerator
- Uint32 RefreshRateNumerator = 0;
+ Uint32 RefreshRateNumerator = 0;
/// Refresh rate denominator
- Uint32 RefreshRateDenominator = 0;
+ Uint32 RefreshRateDenominator = 0;
/// The scanline drawing mode.
- SCALING Scaling = SCALING_UNSPECIFIED;
+ SCALING Scaling = SCALING_UNSPECIFIED;
/// The scaling mode.
- SCANLINE_ORDER ScanlineOrder = SCANLINE_ORDER_UNSPECIFIED;
+ SCANLINE_ORDER ScanlineOrder = SCANLINE_ORDER_UNSPECIFIED;
};
/// Swap chain description
struct SwapChainDesc
{
/// The swap chain width. Default value is 0
- Uint32 Width;
+ Uint32 Width = 0;
/// The swap chain height. Default value is 0
- Uint32 Height;
+ Uint32 Height = 0;
- /// Back buffer format. Default value is TEX_FORMAT_RGBA8_UNORM_SRGB
- TEXTURE_FORMAT ColorBufferFormat;
+ /// 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 TEX_FORMAT_D32_FLOAT
- TEXTURE_FORMAT DepthBufferFormat;
+ /// Depth buffer format. Default value is Diligent::TEX_FORMAT_D32_FLOAT
+ TEXTURE_FORMAT DepthBufferFormat = TEX_FORMAT_D32_FLOAT;
/// Sample count. Default value is 1
- Uint32 SamplesCount;
+ Uint32 SamplesCount = 1;
/// Number of buffers int the swap chain
- Uint32 BufferCount;
+ Uint32 BufferCount = 2;
/// Default depth value, which is used as optimized depth clear value in D3D12
- Float32 DefaultDepthValue;
+ Float32 DefaultDepthValue = 1.f;
/// Default stencil value, which is used as optimized stencil clear value in D3D12
- Uint8 DefaultStencilValue;
-
- /// Constructor intializes the structure members with default values
- SwapChainDesc() :
- Width(0),
- Height(0),
- ColorBufferFormat( TEX_FORMAT_RGBA8_UNORM_SRGB ),
- DepthBufferFormat( TEX_FORMAT_D32_FLOAT ),
- SamplesCount( 1 ),
- BufferCount( 2 ),
- DefaultDepthValue(1.f),
- DefaultStencilValue(0)
- {}
+ Uint8 DefaultStencilValue = 0;
};
/// Full screen mode description
@@ -1213,13 +1196,13 @@ namespace Diligent
struct FullScreenModeDesc
{
/// A Boolean value that specifies whether the swap chain is in fullscreen mode.
- Bool Fullscreen = False;
+ Bool Fullscreen = False;
/// Refresh rate numerator
- Uint32 RefreshRateNumerator = 0;
+ Uint32 RefreshRateNumerator = 0;
/// Refresh rate denominator
- Uint32 RefreshRateDenominator = 0;
+ Uint32 RefreshRateDenominator = 0;
/// The scanline drawing mode.
DisplayModeAttribs::SCALING Scaling = DisplayModeAttribs::SCALING_UNSPECIFIED;
@@ -1233,7 +1216,7 @@ namespace Diligent
{
/// Pointer to the raw memory allocator that will be used for all memory allocation/deallocation
/// operations in the engine
- class IMemoryAllocator *pRawMemAllocator = nullptr;
+ class IMemoryAllocator* pRawMemAllocator = nullptr;
/// Pointer to the user-specified debug message callback function
DebugMessageCallbackType DebugMessageCallback = nullptr;
@@ -1349,7 +1332,7 @@ namespace Diligent
Uint32 NumUniformTexelBufferDescriptors = 0;
Uint32 NumStorageTexelBufferDescriptors = 0;
- DescriptorPoolSize() {}
+ DescriptorPoolSize()noexcept {}
DescriptorPoolSize( Uint32 _MaxDescriptorSets,
Uint32 _NumSeparateSamplerDescriptors,
@@ -1359,7 +1342,7 @@ namespace Diligent
Uint32 _NumUniformBufferDescriptors,
Uint32 _NumStorageBufferDescriptors,
Uint32 _NumUniformTexelBufferDescriptors,
- Uint32 _NumStorageTexelBufferDescriptors) :
+ Uint32 _NumStorageTexelBufferDescriptors)noexcept :
MaxDescriptorSets (_MaxDescriptorSets ),
NumSeparateSamplerDescriptors (_NumSeparateSamplerDescriptors ),
NumCombinedSamplerDescriptors (_NumCombinedSamplerDescriptors ),
@@ -1494,7 +1477,7 @@ namespace Diligent
{
/// Literal texture format name (for instance, for TEX_FORMAT_RGBA8_UNORM format, this
/// will be "TEX_FORMAT_RGBA8_UNORM")
- const Char *Name;
+ const Char* Name;
/// Texture format, see Diligent::TEXTURE_FORMAT for a list of supported texture formats
TEXTURE_FORMAT Format;
@@ -1519,14 +1502,14 @@ namespace Diligent
Uint8 BlockHeight;
/// Initializes the structure
- explicit TextureFormatAttribs( const Char* _Name,
- TEXTURE_FORMAT _Format,
- Uint8 _ComponentSize,
- Uint8 _NumComponents,
- COMPONENT_TYPE _ComponentType,
- bool _IsTypeless,
- Uint8 _BlockWidth,
- Uint8 _BlockHeight) :
+ 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),
@@ -1538,7 +1521,7 @@ namespace Diligent
{
}
- TextureFormatAttribs() :
+ TextureFormatAttribs()noexcept :
Name ("TEX_FORMAT_UNKNOWN"),
Format (TEX_FORMAT_UNKNOWN),
ComponentSize(0),
@@ -1556,12 +1539,7 @@ namespace Diligent
struct TextureFormatInfo : public TextureFormatAttribs
{
/// Indicates if the format is supported by the device
- bool Supported;
-
- /// Initializes the structure with default values
- explicit TextureFormatInfo() :
- Supported(false)
- {}
+ bool Supported = false;
};
/// Extended texture format description
@@ -1570,29 +1548,29 @@ namespace Diligent
struct TextureFormatInfoExt : TextureFormatInfo
{
/// Indicates if the format can be filtered
- bool Filterable = false;
+ bool Filterable = false;
/// Indicates if the format can be used as a render target format
- bool ColorRenderable = false;
+ bool ColorRenderable = false;
/// Indicates if the format can be used as a depth format
- bool DepthRenderable = false;
+ bool DepthRenderable = false;
/// Indicates if the format can be used to create a 1D texture
- bool Tex1DFmt = false;
+ bool Tex1DFmt = false;
/// Indicates if the format can be used to create a 2D texture
- bool Tex2DFmt = false;
+ bool Tex2DFmt = false;
/// Indicates if the format can be used to create a 3D texture
- bool Tex3DFmt = false;
+ bool Tex3DFmt = false;
/// Indicates if the format can be used to create a cube texture
- bool TexCubeFmt = false;
+ bool TexCubeFmt = 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 = 0;
+ Uint32 SampleCounts = 0;
};
/// Resource usage state
@@ -1725,7 +1703,7 @@ namespace Diligent
/// \note When TransitionType is STATE_TRANSITION_TYPE_BEGIN, this member must be false.
bool UpdateResourceState = false;
- StateTransitionDesc(){}
+ StateTransitionDesc()noexcept{}
StateTransitionDesc(ITexture* _pTexture,
RESOURCE_STATE _OldState,
@@ -1735,7 +1713,7 @@ namespace Diligent
Uint32 _FirstArraySlice = 0,
Uint32 _ArraySliceCount = RemainingArraySlices,
STATE_TRANSITION_TYPE _TransitionType = STATE_TRANSITION_TYPE_IMMEDIATE,
- bool _UpdateState = false) :
+ bool _UpdateState = false)noexcept :
pTexture (_pTexture),
FirstMipLevel (_FirstMipLevel),
MipLevelsCount (_MipLevelsCount),
@@ -1750,14 +1728,14 @@ namespace Diligent
StateTransitionDesc(ITexture* _pTexture,
RESOURCE_STATE _OldState,
RESOURCE_STATE _NewState,
- bool _UpdateState) :
+ 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) :
+ bool _UpdateState)noexcept :
pBuffer (_pBuffer),
OldState (_OldState),
NewState (_NewState),
diff --git a/Graphics/GraphicsEngine/interface/InputLayout.h b/Graphics/GraphicsEngine/interface/InputLayout.h
index d1b7c1e9..e27fbd9a 100644
--- a/Graphics/GraphicsEngine/interface/InputLayout.h
+++ b/Graphics/GraphicsEngine/interface/InputLayout.h
@@ -37,36 +37,36 @@ static constexpr Uint32 iMaxLayoutElements = 16;
struct LayoutElement
{
/// Input index of the element, which is specified in the vertex shader.
- Uint32 InputIndex;
+ Uint32 InputIndex = 0;
/// Buffer slot index that this element is read from.
- Uint32 BufferSlot;
+ Uint32 BufferSlot = 0;
/// Number of components in the element. Allowed values are 1, 2, 3, and 4.
- Uint32 NumComponents;
+ Uint32 NumComponents = 0;
/// Type of the element components, see Diligent::VALUE_TYPE for details.
- VALUE_TYPE ValueType;
+ VALUE_TYPE ValueType = 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;
+ Bool IsNormalized = True;
/// Relative offset, in bytes, to the element bits.
/// If this value is zero, the offset will be computed automatically assuming
/// that all previous elements in the same buffer slot are tightly packed.
/// Overlapping elements are not allowed.
- Uint32 RelativeOffset;
+ Uint32 RelativeOffset = 0;
/// Stride, in bytes, between two elements, for this buffer slot.
/// If this value is zero, stride will be computed automatically assuming
/// that all elements in the same buffer slot are tightly packed.
/// If buffer slot contains multiple layout elements, they all must use
/// the same stride or zero.
- Uint32 Stride;
+ Uint32 Stride = 0;
/// Input frequency
enum FREQUENCY : Int32
@@ -82,22 +82,25 @@ struct LayoutElement
/// Helper value that stores the total number of frequencies in the enumeration.
FREQUENCY_NUM_FREQUENCIES
- }Frequency;
+ };
+ FREQUENCY Frequency = 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;
+ Uint32 InstanceDataStepRate = 1;
+
+ LayoutElement()noexcept{}
/// Initializes the structure
- LayoutElement(Uint32 _InputIndex = 0,
- Uint32 _BufferSlot = 0,
- Uint32 _NumComponents = 0,
- VALUE_TYPE _ValueType = VT_FLOAT32,
+ LayoutElement(Uint32 _InputIndex,
+ Uint32 _BufferSlot,
+ Uint32 _NumComponents,
+ VALUE_TYPE _ValueType,
Bool _IsNormalized = True,
Uint32 _RelativeOffset = 0,
Uint32 _Stride = 0,
FREQUENCY _Frequency = FREQUENCY_PER_VERTEX,
- Uint32 _InstanceDataStepRate = 1) :
+ Uint32 _InstanceDataStepRate = 1)noexcept :
InputIndex(_InputIndex),
BufferSlot(_BufferSlot),
NumComponents(_NumComponents),
@@ -116,13 +119,9 @@ struct LayoutElement
struct InputLayoutDesc
{
/// Array of layout elements
- const LayoutElement *LayoutElements;
+ const LayoutElement* LayoutElements = nullptr;
/// Number of layout elements
- Uint32 NumElements;
- InputLayoutDesc() :
- LayoutElements(nullptr),
- NumElements(0)
- {}
+ Uint32 NumElements = 0;
};
}
diff --git a/Graphics/GraphicsEngine/interface/MapHelper.h b/Graphics/GraphicsEngine/interface/MapHelper.h
index 252171b9..cda8dfea 100644
--- a/Graphics/GraphicsEngine/interface/MapHelper.h
+++ b/Graphics/GraphicsEngine/interface/MapHelper.h
@@ -53,17 +53,17 @@ public:
/// Initializes the class member with null values
MapHelper() :
- m_pBuffer(nullptr),
- m_pContext(nullptr),
- m_pMappedData(nullptr),
- m_MapType(static_cast<MAP_TYPE>(-1)),
- m_MapFlags(static_cast<Uint32>(-1))
+ m_pBuffer (nullptr),
+ m_pContext (nullptr),
+ m_pMappedData (nullptr),
+ m_MapType (static_cast<MAP_TYPE>(-1)),
+ m_MapFlags (static_cast<Uint32>(-1))
{
}
/// Initializes the object and maps the provided resource.
/// See Map() for details.
- MapHelper( IDeviceContext *pContext, IBuffer *pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags ) :
+ MapHelper( IDeviceContext* pContext, IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags ) :
MapHelper()
{
Map(pContext, pBuffer, MapType, MapFlags);
@@ -71,32 +71,32 @@ public:
/// Move constructor: takes over resource ownership from Helper
MapHelper(MapHelper&& Helper) :
- m_pBuffer( std::move(Helper.m_pBuffer) ),
- m_pMappedData( std::move(Helper.m_pMappedData) ),
- m_pContext( std::move(Helper.m_pContext) ),
- m_MapType( std::move(Helper.m_MapType) ),
- m_MapFlags( std::move(Helper.m_MapFlags) )
+ m_pBuffer (std::move(Helper.m_pBuffer)),
+ m_pMappedData (std::move(Helper.m_pMappedData)),
+ m_pContext (std::move(Helper.m_pContext)),
+ m_MapType (std::move(Helper.m_MapType)),
+ m_MapFlags (std::move(Helper.m_MapFlags))
{
- Helper.m_pBuffer = nullptr;
- Helper.m_pContext = nullptr;
- Helper.m_pMappedData = nullptr;
- Helper.m_MapType = static_cast<MAP_TYPE>(-1);
- Helper.m_MapFlags = static_cast<Uint32>(-1);
+ Helper.m_pBuffer = nullptr;
+ Helper.m_pContext = nullptr;
+ Helper.m_pMappedData = nullptr;
+ Helper.m_MapType = static_cast<MAP_TYPE>(-1);
+ Helper.m_MapFlags = static_cast<Uint32>(-1);
}
/// Move-assignement operator: takes over resource ownership from Helper
MapHelper& operator = (MapHelper&& Helper)
{
- m_pBuffer = std::move(Helper.m_pBuffer);
- m_pMappedData = std::move(Helper.m_pMappedData);
- m_pContext = std::move( Helper.m_pContext );
- m_MapType = std::move(Helper.m_MapType);
- m_MapFlags = std::move(Helper.m_MapFlags);
- Helper.m_pBuffer = nullptr;
- Helper.m_pContext = nullptr;
- Helper.m_pMappedData = nullptr;
- Helper.m_MapType = static_cast<MAP_TYPE>(-1);
- Helper.m_MapFlags = static_cast<Uint32>(-1);
+ m_pBuffer = std::move(Helper.m_pBuffer);
+ m_pMappedData = std::move(Helper.m_pMappedData);
+ m_pContext = std::move( Helper.m_pContext );
+ m_MapType = std::move(Helper.m_MapType);
+ m_MapFlags = std::move(Helper.m_MapFlags);
+ Helper.m_pBuffer = nullptr;
+ Helper.m_pContext = nullptr;
+ Helper.m_pMappedData = nullptr;
+ Helper.m_MapType = static_cast<MAP_TYPE>(-1);
+ Helper.m_MapFlags = static_cast<Uint32>(-1);
return *this;
}
@@ -106,7 +106,7 @@ public:
/// \param pBuffer - Pointer to the buffer interface to map.
/// \param MapType - Type of the map operation, see Diligent::MAP_TYPE for details.
/// \param MapFlags - Additional map flags, see Diligent::MAP_FLAGS.
- void Map( IDeviceContext *pContext, IBuffer *pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags )
+ void Map( IDeviceContext* pContext, IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags )
{
VERIFY(!m_pBuffer && !m_pMappedData && !m_pContext, "Object already mapped");
Unmap();
@@ -130,12 +130,12 @@ public:
if( m_pBuffer )
{
m_pContext->UnmapBuffer(m_pBuffer, m_MapType);
- m_pBuffer = nullptr;
- m_MapType = static_cast<MAP_TYPE>(-1);
- m_MapFlags = static_cast<Uint32>(-1);
+ m_pBuffer = nullptr;
+ m_MapType = static_cast<MAP_TYPE>(-1);
+ m_MapFlags = static_cast<Uint32>(-1);
}
- m_pContext = nullptr;
- m_pMappedData = nullptr;
+ m_pContext = nullptr;
+ m_pMappedData = nullptr;
}
/// Converts mapped data pointer to DataType*
@@ -182,7 +182,7 @@ private:
typename PtrTypeSelector<IDeviceContext, KeepStrongReferences>::Type m_pContext;
/// Pointer to the mapped data
- DataType *m_pMappedData;
+ DataType* m_pMappedData;
MAP_TYPE m_MapType;
diff --git a/Graphics/GraphicsEngine/interface/PipelineState.h b/Graphics/GraphicsEngine/interface/PipelineState.h
index 2232eedc..5f0a62bf 100644
--- a/Graphics/GraphicsEngine/interface/PipelineState.h
+++ b/Graphics/GraphicsEngine/interface/PipelineState.h
@@ -44,15 +44,10 @@ namespace Diligent
struct SampleDesc
{
/// Sample count
- Uint8 Count;
+ Uint8 Count = 1;
/// Quality
- Uint8 Quality;
-
- SampleDesc() :
- Count(1),
- Quality(0)
- {}
+ Uint8 Quality = 0;
};
@@ -107,10 +102,10 @@ struct GraphicsPipelineDesc
Uint8 NumRenderTargets = 0;
/// Render target formats
- TEXTURE_FORMAT RTVFormats[8];
+ TEXTURE_FORMAT RTVFormats[8] = {};
/// Depth-stencil format
- TEXTURE_FORMAT DSVFormat;
+ TEXTURE_FORMAT DSVFormat = TEX_FORMAT_UNKNOWN;
/// Multisampling parameters
SampleDesc SmplDesc;
@@ -120,13 +115,6 @@ struct GraphicsPipelineDesc
//D3D12_CACHED_PIPELINE_STATE CachedPSO;
//D3D12_PIPELINE_STATE_FLAGS Flags;
-
- GraphicsPipelineDesc()
- {
- for(size_t rt = 0; rt < _countof(RTVFormats); ++rt)
- RTVFormats[rt] = TEX_FORMAT_UNKNOWN;
- DSVFormat = TEX_FORMAT_UNKNOWN;
- };
};
@@ -143,7 +131,7 @@ struct ComputePipelineDesc
struct PipelineStateDesc : DeviceObjectAttribs
{
/// Flag indicating if pipeline state is a compute pipeline state
- bool IsComputePipeline = false;
+ bool IsComputePipeline = false;
/// Shader resource binding allocation granularity
@@ -152,7 +140,7 @@ struct PipelineStateDesc : DeviceObjectAttribs
Uint32 SRBAllocationGranularity = 1;
/// Defines which command queues this pipeline state can be used with
- Uint64 CommandQueueMask = 1;
+ Uint64 CommandQueueMask = 1;
/// Graphics pipeline state description. This memeber is ignored if IsComputePipeline == True
GraphicsPipelineDesc GraphicsPipeline;
@@ -172,7 +160,7 @@ class IPipelineState : public IDeviceObject
{
public:
/// Queries the specific interface, see IObject::QueryInterface() for details
- virtual void QueryInterface( const INTERFACE_ID &IID, IObject **ppInterface ) = 0;
+ virtual void QueryInterface( const INTERFACE_ID& IID, IObject** ppInterface ) = 0;
/// Returns the blend state description used to create the object
virtual const PipelineStateDesc& GetDesc()const = 0;
@@ -184,7 +172,7 @@ public:
/// \remarks For older OpenGL devices that do not support program pipelines
/// (OpenGL4.1-, OpenGLES3.0-). This function is the only way to bind
/// shader resources.
- virtual void BindShaderResources( IResourceMapping *pResourceMapping, Uint32 Flags ) = 0;
+ virtual void BindShaderResources( IResourceMapping* pResourceMapping, Uint32 Flags ) = 0;
/// Creates a shader resource binding object
@@ -193,7 +181,7 @@ public:
/// \param [in] InitStaticResources - if set to true, the method will initialize static resources in
/// the created object, which has the exact same effect as calling
/// IShaderResourceBinding::InitializeStaticResources().
- virtual void CreateShaderResourceBinding( IShaderResourceBinding **ppShaderResourceBinding, bool InitStaticResources = false ) = 0;
+ virtual void CreateShaderResourceBinding( IShaderResourceBinding** ppShaderResourceBinding, bool InitStaticResources = false ) = 0;
/// Checks if this pipeline state object is compatible with another PSO
@@ -209,7 +197,7 @@ public:
/// to commit resources for the second pipeline, a runtime error will occur.\n
/// The function only checks compatibility of shader resource layouts. It does not take
/// into account vertex shader input layout, number of outputs, etc.
- virtual bool IsCompatibleWith(const IPipelineState *pPSO)const = 0;
+ virtual bool IsCompatibleWith(const IPipelineState* pPSO)const = 0;
};
}
diff --git a/Graphics/GraphicsEngine/interface/RasterizerState.h b/Graphics/GraphicsEngine/interface/RasterizerState.h
index aa80951d..f71bafe0 100644
--- a/Graphics/GraphicsEngine/interface/RasterizerState.h
+++ b/Graphics/GraphicsEngine/interface/RasterizerState.h
@@ -90,70 +90,47 @@ enum CULL_MODE : Int8
struct RasterizerStateDesc
{
/// Determines traingle fill mode, see Diligent::FILL_MODE for details.
- FILL_MODE FillMode;
+ /// Default value: Diligent::FILL_MODE_SOLID.
+ FILL_MODE FillMode = FILL_MODE_SOLID;
/// Determines traingle cull mode, see Diligent::CULL_MODE for details.
- CULL_MODE CullMode;
+ /// Default value: Diligent::CULL_MODE_BACK.
+ CULL_MODE CullMode = 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.
- Bool FrontCounterClockwise;
+ /// Default value: False.
+ Bool FrontCounterClockwise = False;
/// Enable clipping based on distance.
/// \warning On DirectX this only disables clipping against far clipping plane,
/// while on OpenGL this disables clipping against both far and near clip planes.
- Bool DepthClipEnable;
+ /// Default value: True.
+ Bool DepthClipEnable = True;
/// Enable scissor-rectangle culling. All pixels outside an active scissor rectangle are culled.
- Bool ScissorEnable;
+ /// Default value: False.
+ Bool ScissorEnable = False;
/// Specifies whether to enable line antialiasing.
- Bool AntialiasedLineEnable;
+ /// Default value: False.
+ Bool AntialiasedLineEnable = False;
/// Constant value added to the depth of a given pixel.
- Int32 DepthBias;
+ /// Default value: 0.
+ Int32 DepthBias = 0;
/// Maximum depth bias of a pixel.
/// \warning Depth bias clamp is not available in OpenGL
- Float32 DepthBiasClamp;
+ /// Default value: 0.
+ Float32 DepthBiasClamp = 0.f;
/// Scalar that scales the given pixel's slope before adding to the pixel's depth.
- Float32 SlopeScaledDepthBias;
-
- /// Member | Default value
- /// ----------------------|--------------
- /// FillMode | FILL_MODE_SOLID
- /// CullMode | CULL_MODE_BACK
- /// FrontCounterClockwise | False
- /// DepthBias | 0
- /// DepthBiasClamp | 0.f
- /// SlopeScaledDepthBias | 0.f
- /// DepthClipEnable | True
- /// ScissorEnable | False
- /// AntialiasedLineEnable | False
- RasterizerStateDesc(FILL_MODE _FillMode = FILL_MODE_SOLID,
- CULL_MODE _CullMode = CULL_MODE_BACK,
- Bool _FrontCounterClockwise = False,
- Int32 _DepthBias = 0,
- Float32 _DepthBiasClamp = 0.f,
- Float32 _SlopeScaledDepthBias = 0.f,
- Bool _DepthClipEnable = True,
- Bool _ScissorEnable = False,
- Bool _AntialiasedLineEnable = False) :
- FillMode ( _FillMode ),
- CullMode ( _CullMode ),
- FrontCounterClockwise( _FrontCounterClockwise ),
- DepthClipEnable ( _DepthClipEnable ),
- ScissorEnable ( _ScissorEnable ),
- AntialiasedLineEnable( _AntialiasedLineEnable ),
- DepthBias ( _DepthBias ),
- DepthBiasClamp ( _DepthBiasClamp ),
- SlopeScaledDepthBias ( _SlopeScaledDepthBias )
- {
- }
-
+ /// Default value: 0.
+ Float32 SlopeScaledDepthBias = 0.f;
+
/// Tests if two structures are equivalent
diff --git a/Graphics/GraphicsEngine/interface/Sampler.h b/Graphics/GraphicsEngine/interface/Sampler.h
index 918aa38c..0654d243 100644
--- a/Graphics/GraphicsEngine/interface/Sampler.h
+++ b/Graphics/GraphicsEngine/interface/Sampler.h
@@ -52,47 +52,61 @@ static constexpr INTERFACE_ID IID_Sampler =
struct SamplerDesc : DeviceObjectAttribs
{
/// Texture minification filter, see Diligent::FILTER_TYPE for details.
- FILTER_TYPE MinFilter;
+ /// Default value: Diligent::FILTER_TYPE_LINEAR.
+ FILTER_TYPE MinFilter = FILTER_TYPE_LINEAR;
/// Texture magnification filter, see Diligent::FILTER_TYPE for details.
- FILTER_TYPE MagFilter;
+ /// Default value: Diligent::FILTER_TYPE_LINEAR.
+ FILTER_TYPE MagFilter = 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.
- FILTER_TYPE MipFilter;
+ /// Default value: Diligent::FILTER_TYPE_LINEAR.
+ FILTER_TYPE MipFilter = FILTER_TYPE_LINEAR;
/// Texture address mode for U coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details
- TEXTURE_ADDRESS_MODE AddressU;
+ /// Default value: Diligent::TEXTURE_ADDRESS_CLAMP.
+ TEXTURE_ADDRESS_MODE AddressU = TEXTURE_ADDRESS_CLAMP;
/// Texture address mode for V coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details
- TEXTURE_ADDRESS_MODE AddressV;
+ /// Default value: Diligent::TEXTURE_ADDRESS_CLAMP.
+ TEXTURE_ADDRESS_MODE AddressV = TEXTURE_ADDRESS_CLAMP;
/// Texture address mode for W coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details
- TEXTURE_ADDRESS_MODE AddressW;
+ /// Default value: Diligent::TEXTURE_ADDRESS_CLAMP.
+ TEXTURE_ADDRESS_MODE AddressW = 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.
- Float32 MipLODBias;
+ /// mipmap level 3.5. Default value: 0.
+ Float32 MipLODBias = 0;
- /// Maximum anisotropy level for the anisotropic filter.
- Uint32 MaxAnisotropy;
+ /// Maximum anisotropy level for the anisotropic filter. Default value: 0.
+ Uint32 MaxAnisotropy = 0;
/// A function that compares sampled data against existing sampled data when comparsion
- /// filter is used.
- COMPARISON_FUNCTION ComparisonFunc;
+ /// filter is used. Default value: Diligent::COMPARISON_FUNC_NEVER.
+ COMPARISON_FUNCTION ComparisonFunc = COMPARISON_FUNC_NEVER;
/// Border color to use if TEXTURE_ADDRESS_BORDER is specified for AddressU, AddressV, or AddressW.
- Float32 BorderColor[4];
+ /// Default value: {0,0,0,0}
+ Float32 BorderColor[4] = {0, 0, 0, 0};
/// Specifies the minimum value that LOD is clamped to before accessing the texture MIP levels.
/// Must be less than or equal to MaxLOD.
- float MinLOD;
+ /// Default value: 0.
+ float MinLOD = 0;
/// Specifies the maximum value that LOD is clamped to before accessing the texture MIP levels.
/// Must be greater than or equal to MinLOD.
- float MaxLOD;
+ /// Default value: +FLT_MAX.
+ float MaxLOD = +3.402823466e+38F;
+
+ SamplerDesc()noexcept{}
+
+
+ // Constructor is required because SamplerDesc is not POD.
/// Initializes the structure members
@@ -110,9 +124,9 @@ struct SamplerDesc : DeviceObjectAttribs
/// BorderColor | (0,0,0,0)
/// MinLOD | 0
/// MaxLOD | +FLT_MAX
- SamplerDesc(FILTER_TYPE _MinFilter = FILTER_TYPE_LINEAR,
- FILTER_TYPE _MagFilter = FILTER_TYPE_LINEAR,
- FILTER_TYPE _MipFilter = FILTER_TYPE_LINEAR,
+ SamplerDesc(FILTER_TYPE _MinFilter,
+ FILTER_TYPE _MagFilter,
+ FILTER_TYPE _MipFilter,
TEXTURE_ADDRESS_MODE _AddressU = TEXTURE_ADDRESS_CLAMP,
TEXTURE_ADDRESS_MODE _AddressV = TEXTURE_ADDRESS_CLAMP,
TEXTURE_ADDRESS_MODE _AddressW = TEXTURE_ADDRESS_CLAMP,
@@ -120,27 +134,21 @@ struct SamplerDesc : DeviceObjectAttribs
Uint32 _MaxAnisotropy = 0,
COMPARISON_FUNCTION _ComparisonFunc = COMPARISON_FUNC_NEVER,
float _MinLOD = 0,
- float _MaxLOD = +FLT_MAX) :
- MinFilter(_MinFilter),
- MagFilter(_MagFilter),
- MipFilter(_MipFilter),
- AddressU(_AddressU),
- AddressV(_AddressV),
- AddressW(_AddressW),
- MipLODBias(_MipLODBias),
- MaxAnisotropy(_MaxAnisotropy),
- ComparisonFunc(_ComparisonFunc),
- MinLOD(_MinLOD),
- MaxLOD(_MaxLOD)
+ float _MaxLOD = +3.402823466e+38F) :
+ MinFilter (_MinFilter),
+ MagFilter (_MagFilter),
+ MipFilter (_MipFilter),
+ AddressU (_AddressU),
+ AddressV (_AddressV),
+ AddressW (_AddressW),
+ MipLODBias (_MipLODBias),
+ MaxAnisotropy (_MaxAnisotropy),
+ ComparisonFunc (_ComparisonFunc),
+ MinLOD (_MinLOD),
+ MaxLOD (_MaxLOD)
{
BorderColor[0] = BorderColor[1] = BorderColor[2] = BorderColor[3] = 0;
}
-
- SamplerDesc(const SamplerDesc&) = default;
- SamplerDesc(SamplerDesc&&) = default;
- SamplerDesc& operator = (const SamplerDesc&) = default;
- SamplerDesc& operator = (SamplerDesc&&) = default;
-
/// Tests if two structures are equivalent
/// \param [in] RHS - reference to the structure to perform comparison with
@@ -149,7 +157,7 @@ struct SamplerDesc : DeviceObjectAttribs
/// - False otherwise.
/// The operator ignores DeviceObjectAttribs::Name field as it does not affect
/// the sampler state.
- bool operator ==(const SamplerDesc& RHS)const
+ bool operator == (const SamplerDesc& RHS)const
{
// Name is primarily used for debug purposes and does not affect the state.
// It is ignored in comparison operation.
@@ -181,7 +189,7 @@ class ISampler : public IDeviceObject
{
public:
/// Queries the specific interface, see IObject::QueryInterface() for details
- virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface ) = 0;
+ virtual void QueryInterface( const Diligent::INTERFACE_ID& IID, IObject** ppInterface ) = 0;
/// Returns the sampler description used to create the object
virtual const SamplerDesc& GetDesc()const = 0;
diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h
index d1cafb35..5530e534 100644
--- a/Graphics/GraphicsEngine/interface/Shader.h
+++ b/Graphics/GraphicsEngine/interface/Shader.h
@@ -137,14 +137,10 @@ enum BIND_SHADER_RESOURCES_FLAGS : Uint32
struct ShaderVariableDesc
{
/// Shader variable name
- const Char *Name;
+ const Char* Name = nullptr;
/// Shader variable type. See Diligent::SHADER_VARIABLE_TYPE for a list of allowed types
- SHADER_VARIABLE_TYPE Type;
- ShaderVariableDesc(const Char *_Name = nullptr, SHADER_VARIABLE_TYPE _Type = SHADER_VARIABLE_TYPE_STATIC) :
- Name(_Name),
- Type(_Type)
- {}
+ SHADER_VARIABLE_TYPE Type = SHADER_VARIABLE_TYPE_STATIC;
};
@@ -158,8 +154,8 @@ struct StaticSamplerDesc
/// Sampler description
SamplerDesc Desc;
- StaticSamplerDesc(){}
- StaticSamplerDesc(const Char* _SamplerOrTextureName, const SamplerDesc& _Desc) :
+ StaticSamplerDesc()noexcept{}
+ StaticSamplerDesc(const Char* _SamplerOrTextureName, const SamplerDesc& _Desc)noexcept :
SamplerOrTextureName(_SamplerOrTextureName),
Desc (_Desc)
{}
@@ -169,38 +165,27 @@ struct StaticSamplerDesc
struct ShaderDesc : DeviceObjectAttribs
{
/// Shader type. See Diligent::SHADER_TYPE
- SHADER_TYPE ShaderType;
+ SHADER_TYPE ShaderType = SHADER_TYPE_VERTEX;
- Bool bCacheCompiledShader;
- SHADER_PROFILE TargetProfile;
+ Bool bCacheCompiledShader = False;
+ SHADER_PROFILE TargetProfile = SHADER_PROFILE_DEFAULT;
/// Default shader variable type. This type will be used if shader
/// variable description is not found in array VariableDesc points to
/// or if VariableDesc == nullptr
- SHADER_VARIABLE_TYPE DefaultVariableType;
+ SHADER_VARIABLE_TYPE DefaultVariableType = SHADER_VARIABLE_TYPE_STATIC;
/// Array of shader variable descriptions
- const ShaderVariableDesc *VariableDesc;
+ const ShaderVariableDesc* VariableDesc = nullptr;
/// Number of elements in VariableDesc array
- Uint32 NumVariables;
+ Uint32 NumVariables = 0;
/// Number of static samplers in StaticSamplers array
- Uint32 NumStaticSamplers;
+ Uint32 NumStaticSamplers = 0;
/// Array of static sampler descriptions
- const StaticSamplerDesc *StaticSamplers;
-
- ShaderDesc() :
- ShaderType(SHADER_TYPE_VERTEX),
- bCacheCompiledShader(False),
- TargetProfile(SHADER_PROFILE_DEFAULT),
- DefaultVariableType(SHADER_VARIABLE_TYPE_STATIC),
- VariableDesc(nullptr),
- NumVariables(0),
- NumStaticSamplers(0),
- StaticSamplers(nullptr)
- {}
+ const StaticSamplerDesc* StaticSamplers = nullptr;
};
/// Shader source stream factory interface
@@ -212,9 +197,14 @@ public:
struct ShaderMacro
{
- const Char* Name;
- const Char* Definition;
- ShaderMacro(const Char* _Name, const Char* _Def) : Name( _Name ), Definition( _Def ) {}
+ const Char* Name = nullptr;
+ const Char* Definition = nullptr;
+
+ ShaderMacro()noexcept{}
+ ShaderMacro(const Char* _Name, const Char* _Def)noexcept :
+ Name ( _Name ),
+ Definition( _Def )
+ {}
};
/// Shader creation attributes
diff --git a/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h b/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h
index 35ccc428..8671c3f7 100644
--- a/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h
+++ b/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h
@@ -44,7 +44,7 @@ class IShaderResourceBinding : public IObject
{
public:
/// Queries the specific interface, see IObject::QueryInterface() for details
- virtual void QueryInterface( const INTERFACE_ID &IID, IObject **ppInterface ) = 0;
+ virtual void QueryInterface( const INTERFACE_ID& IID, IObject** ppInterface ) = 0;
/// Returns pointer to the referenced buffer object.
diff --git a/Graphics/GraphicsEngine/interface/Texture.h b/Graphics/GraphicsEngine/interface/Texture.h
index 444464bd..c44d330b 100644
--- a/Graphics/GraphicsEngine/interface/Texture.h
+++ b/Graphics/GraphicsEngine/interface/Texture.h
@@ -41,32 +41,22 @@ static constexpr INTERFACE_ID IID_Texture =
struct DepthStencilClearValue
{
/// Depth clear value
- Float32 Depth;
+ Float32 Depth = 1.f;
/// Stencil clear value
- Uint8 Stencil;
- DepthStencilClearValue() :
- Depth(1.f),
- Stencil(0)
- {}
+ Uint8 Stencil = 0;
};
/// Defines optimized clear value.
struct OptimizedClearValue
{
/// Format
- TEXTURE_FORMAT Format;
+ TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
+
/// Render target clear value
- Float32 Color[ 4 ];
+ Float32 Color[4] = {0, 0, 0, 0};
+
/// Depth stencil clear value
DepthStencilClearValue DepthStencil;
- OptimizedClearValue() :
- Format(TEX_FORMAT_UNKNOWN)
- {
- Color[0] = 0;
- Color[1] = 0;
- Color[2] = 0;
- Color[3] = 0;
- }
bool operator == (const OptimizedClearValue& rhs)const
{
@@ -87,71 +77,54 @@ struct TextureDesc : DeviceObjectAttribs
RESOURCE_DIMENSION Type = RESOURCE_DIM_UNDEFINED;
/// Texture width, in pixels.
- Uint32 Width = 0;
+ Uint32 Width = 0;
/// Texture height, in pixels.
- Uint32 Height = 0;
+ Uint32 Height = 0;
+
union
{
/// For a 1D array or 2D array, number of array slices
- Uint32 ArraySize = 1;
+ Uint32 ArraySize = 1;
/// For a 3D texture, number of depth slices
Uint32 Depth;
};
/// Texture format, see Diligent::TEXTURE_FORMAT.
- TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
+ TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
/// Number of Mip levels in the texture. Multisampled textures can only have 1 Mip level.
/// Specify 0 to generate full mipmap chain.
- Uint32 MipLevels = 1;
+ Uint32 MipLevels = 1;
/// Number of samples.\n
/// Only 2D textures or 2D texture arrays can be multisampled.
- Uint32 SampleCount = 1;
+ Uint32 SampleCount = 1;
/// Texture usage. See Diligent::USAGE for details.
- USAGE Usage = USAGE_DEFAULT;
+ USAGE Usage = 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;
+ BIND_FLAGS BindFlags = 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;
/// Miscellaneous flags, see Diligent::MISC_TEXTURE_FLAGS for details.
- MISC_TEXTURE_FLAGS MiscFlags = MISC_TEXTURE_FLAG_NONE;
+ MISC_TEXTURE_FLAGS MiscFlags = MISC_TEXTURE_FLAG_NONE;
/// Optimized clear value
OptimizedClearValue ClearValue;
/// Defines which command queues this texture can be used with
- Uint64 CommandQueueMask = 1;
-
- /// Initializes the structure members with default values
+ Uint64 CommandQueueMask = 1;
- /// Default values:
- /// Member | Default value
- /// ----------------|--------------
- /// Type | RESOURCE_DIM_UNDEFINED
- /// Width | 0
- /// Height | 0
- /// ArraySize | 1
- /// Format | TEX_FORMAT_UNKNOWN
- /// MipLevels | 1
- /// SampleCount | 1
- /// Usage | USAGE_DEFAULT
- /// BindFlags | 0
- /// CPUAccessFlags | 0
- /// MiscFlags | 0
- /// CommandQueueMask| 1
- TextureDesc() {}
/// Tests if two structures are equivalent
@@ -187,22 +160,22 @@ struct TextureSubResData
{
/// Pointer to the subresource data in CPU memory.
/// If provided, pSrcBuffer must be null
- const void* pData = nullptr;
+ const void* pData = nullptr;
/// Pointer to the GPU buffer that contains subresource data.
/// If provided, pData must be null
- class IBuffer* pSrcBuffer = nullptr;
+ class IBuffer* pSrcBuffer = 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 = 0;
/// For 2D and 3D textures, row stride in bytes
- Uint32 Stride = 0;
+ Uint32 Stride = 0;
/// For 3D textures, depth slice stride in bytes
/// \note On OpenGL, this must be a mutliple of Stride
- Uint32 DepthStride = 0;
+ Uint32 DepthStride = 0;
/// Initializes the structure members with default values
@@ -213,10 +186,10 @@ struct TextureSubResData
/// SrcOffset | 0
/// Stride | 0
/// DepthStride | 0
- TextureSubResData(){}
+ TextureSubResData()noexcept{}
/// Initializes the structure members to perform copy from the CPU memory
- TextureSubResData(void *_pData, Uint32 _Stride, Uint32 _DepthStride = 0) :
+ TextureSubResData(void *_pData, Uint32 _Stride, Uint32 _DepthStride = 0)noexcept :
pData (_pData),
pSrcBuffer (nullptr),
SrcOffset (0),
@@ -225,7 +198,7 @@ struct TextureSubResData
{}
/// Initializes the structure members to perform copy from the GPU buffer
- TextureSubResData(IBuffer *_pBuffer, Uint32 _SrcOffset, Uint32 _Stride, Uint32 _DepthStride = 0) :
+ TextureSubResData(IBuffer *_pBuffer, Uint32 _SrcOffset, Uint32 _Stride, Uint32 _DepthStride = 0)noexcept :
pData (nullptr),
pSrcBuffer (_pBuffer),
SrcOffset (_SrcOffset),
@@ -245,16 +218,7 @@ struct TextureData
/// NumSubresources must exactly match the number
/// of subresources in the texture. Otherwise an error
/// occurs.
- Uint32 NumSubresources = 0;
-
- /// Initializes the structure members with default values
-
- /// Default values:
- /// Member | Default value
- /// ----------------|--------------
- /// pSubResources | nullptr
- /// NumSubresources | 0
- TextureData(){}
+ Uint32 NumSubresources = 0;
};
struct MappedTextureSubresource
diff --git a/Graphics/GraphicsEngine/interface/TextureView.h b/Graphics/GraphicsEngine/interface/TextureView.h
index 81bc3b1c..f81ddc39 100644
--- a/Graphics/GraphicsEngine/interface/TextureView.h
+++ b/Graphics/GraphicsEngine/interface/TextureView.h
@@ -60,33 +60,33 @@ struct TextureViewDesc : DeviceObjectAttribs
static constexpr Uint32 RemainingArraySlices = static_cast<Uint32>(-1);
/// Describes the texture view type, see Diligent::TEXTURE_VIEW_TYPE for details.
- TEXTURE_VIEW_TYPE ViewType;
+ TEXTURE_VIEW_TYPE ViewType = TEXTURE_VIEW_UNDEFINED;
/// 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_DIMENSION TextureDim = 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;
+ TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
/// Most detailed mip level to use
- Uint32 MostDetailedMip;
+ Uint32 MostDetailedMip = 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
/// will be referenced.
- Uint32 NumMipLevels;
+ Uint32 NumMipLevels = 0;
union
{
/// For a texture array, first array slice to address in the view
- Uint32 FirstArraySlice;
+ Uint32 FirstArraySlice = 0;
/// For a 3D texture, first depth slice to address the view
Uint32 FirstDepthSlice;
@@ -96,7 +96,7 @@ struct TextureViewDesc : DeviceObjectAttribs
{
/// For a texture array, number of array slices to address in the view.
/// Set to 0 to address all array slices.
- Uint32 NumArraySlices;
+ Uint32 NumArraySlices = 0;
/// For a 3D texture, number of depth slices to address in the view
/// Set to 0 to address all depth slices.
@@ -105,33 +105,8 @@ struct TextureViewDesc : DeviceObjectAttribs
/// For an unordered access view, allowed access flags. See Diligent::UAV_ACCESS_FLAG
/// for details.
- Uint32 AccessFlags;
-
-
- /// Initializes the structure members with default values
-
- /// Default values:
- /// Member | Default value
- /// --------------------|--------------
- /// ViewType | TEXTURE_VIEW_UNDEFINED
- /// TextureDim | RESOURCE_DIM_UNDEFINED
- /// Format | TEX_FORMAT_UNKNOWN
- /// MostDetailedMip | 0
- /// NumMipLevels | 0
- /// FirstArraySlice | 0
- /// NumArraySlices | 0
- /// AccessFlags | 0
- TextureViewDesc() :
- ViewType( TEXTURE_VIEW_UNDEFINED ),
- TextureDim( RESOURCE_DIM_UNDEFINED ),
- Format(TEX_FORMAT_UNKNOWN),
- MostDetailedMip(0),
- NumMipLevels(0),
- FirstArraySlice(0),
- NumArraySlices(0),
- AccessFlags(0)
- {
- }
+ Uint32 AccessFlags = 0;
+
/// Tests if two structures are equivalent