From d2d4cd68130fdcea22c2945b6d7330ebe4ff95da Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Fri, 8 Feb 2019 13:24:03 -0800 Subject: Defined constructos to fix build errors on Apple's clang --- Graphics/GraphicsEngine/interface/BlendState.h | 40 +++++++++++++++ Graphics/GraphicsEngine/interface/Buffer.h | 35 +++++++++++++ Graphics/GraphicsEngine/interface/BufferView.h | 29 +++++++++++ .../GraphicsEngine/interface/DepthStencilState.h | 35 +++++++++++++ Graphics/GraphicsEngine/interface/GraphicsTypes.h | 30 +++++++++++ Graphics/GraphicsEngine/interface/InputLayout.h | 34 ++++++++----- Graphics/GraphicsEngine/interface/PipelineState.h | 8 +++ .../GraphicsEngine/interface/RasterizerState.h | 27 +++++++++- .../GraphicsEngine/interface/ResourceMapping.h | 15 +++--- Graphics/GraphicsEngine/interface/Sampler.h | 59 ++++++++-------------- Graphics/GraphicsEngine/interface/Shader.h | 15 +++++- Graphics/GraphicsEngine/interface/Texture.h | 40 +++++++++++++++ Graphics/GraphicsEngine/interface/TextureView.h | 19 +++++++ 13 files changed, 323 insertions(+), 63 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/interface/BlendState.h b/Graphics/GraphicsEngine/interface/BlendState.h index b3de5025..8ef91ddf 100644 --- a/Graphics/GraphicsEngine/interface/BlendState.h +++ b/Graphics/GraphicsEngine/interface/BlendState.h @@ -304,6 +304,33 @@ struct RenderTargetBlendDesc /// Default value: Diligent::COLOR_MASK_ALL. Uint8 RenderTargetWriteMask = COLOR_MASK_ALL; + // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code: + // RenderTargetBlendDesc{False, False} + + RenderTargetBlendDesc()noexcept{} + + explicit + RenderTargetBlendDesc(Bool _BlendEnable, + Bool _LogicOperationEnable = RenderTargetBlendDesc{}.LogicOperationEnable , + BLEND_FACTOR _SrcBlend = RenderTargetBlendDesc{}.SrcBlend, + BLEND_FACTOR _DestBlend = RenderTargetBlendDesc{}.DestBlend, + BLEND_OPERATION _BlendOp = RenderTargetBlendDesc{}.BlendOp, + BLEND_FACTOR _SrcBlendAlpha = RenderTargetBlendDesc{}.SrcBlendAlpha, + BLEND_FACTOR _DestBlendAlpha = RenderTargetBlendDesc{}.DestBlendAlpha, + BLEND_OPERATION _BlendOpAlpha = RenderTargetBlendDesc{}.BlendOpAlpha, + LOGIC_OPERATION _LogicOp = RenderTargetBlendDesc{}.LogicOp, + Uint8 _RenderTargetWriteMask = RenderTargetBlendDesc{}.RenderTargetWriteMask) : + BlendEnable (_BlendEnable), + LogicOperationEnable (_LogicOperationEnable), + SrcBlend (_SrcBlend), + DestBlend (_DestBlend), + BlendOp (_BlendOp), + SrcBlendAlpha (_SrcBlendAlpha), + DestBlendAlpha (_DestBlendAlpha), + BlendOpAlpha (_BlendOpAlpha), + LogicOp (_LogicOp), + RenderTargetWriteMask(_RenderTargetWriteMask) + {} /// Comparison operator tests if two structures are equivalent @@ -346,6 +373,19 @@ struct BlendStateDesc /// states for render targets RenderTargetBlendDesc RenderTargets[MaxRenderTargets]; + // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code: + // BlendStateDesc{False, False} + + BlendStateDesc()noexcept{} + + BlendStateDesc(Bool _AlphaToCoverageEnable, + Bool _IndependentBlendEnable, + const RenderTargetBlendDesc& RT0 = RenderTargetBlendDesc{})noexcept : + AlphaToCoverageEnable (_AlphaToCoverageEnable), + IndependentBlendEnable (_IndependentBlendEnable), + RenderTargets {RT0} + { + } /// Comparison operator tests if two structures are equivalent diff --git a/Graphics/GraphicsEngine/interface/Buffer.h b/Graphics/GraphicsEngine/interface/Buffer.h index 94cde8da..3bf17e94 100644 --- a/Graphics/GraphicsEngine/interface/Buffer.h +++ b/Graphics/GraphicsEngine/interface/Buffer.h @@ -99,6 +99,29 @@ struct BufferDesc : DeviceObjectAttribs /// Defines which command queues this buffer can be used with Uint64 CommandQueueMask = 1; + + // We have to explicitly define constructors because otherwise the following initialization fails on Apple's clang: + // BufferDesc{1024, BIND_UNIFORM_BUFFER, USAGE_DEFAULT} + + BufferDesc()noexcept{} + + explicit + BufferDesc(Uint32 _uiSizeInBytes, + BIND_FLAGS _BindFlags, + USAGE _Usage = BufferDesc{}.Usage, + CPU_ACCESS_FLAGS _CPUAccessFlags = BufferDesc{}.CPUAccessFlags, + BUFFER_MODE _Mode = BufferDesc{}.Mode, + Uint32 _ElementByteStride = BufferDesc{}.ElementByteStride, + Uint64 _CommandQueueMask = BufferDesc{}.CommandQueueMask)noexcept : + uiSizeInBytes (_uiSizeInBytes), + BindFlags (_BindFlags), + Usage (_Usage), + Mode (_Mode), + ElementByteStride (_ElementByteStride), + CommandQueueMask (_CommandQueueMask) + { + } + /// Tests if two structures are equivalent /// \param [in] RHS - reference to the structure to perform comparison with @@ -127,6 +150,18 @@ struct BufferData /// Data size, in bytes Uint32 DataSize = 0; + + + // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code: + // BufferData{nullptr, 0} + + BufferData()noexcept{} + + BufferData(const void* _pData, + Uint32 _DataSize): + pData (_pData), + DataSize(_DataSize) + {} }; /// Buffer interface diff --git a/Graphics/GraphicsEngine/interface/BufferView.h b/Graphics/GraphicsEngine/interface/BufferView.h index 6b3baff4..0f396dd4 100644 --- a/Graphics/GraphicsEngine/interface/BufferView.h +++ b/Graphics/GraphicsEngine/interface/BufferView.h @@ -52,6 +52,21 @@ struct BufferFormat /// (VT_FLOAT16 and VT_FLOAT32), this member is ignored. Bool IsNormalized = False; + + // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code: + // BufferFormat{VT_FLOAT32, 4} + + BufferFormat()noexcept{} + + BufferFormat(VALUE_TYPE _ValueType, + Uint8 _NumComponents, + Bool _IsNormalized = BufferFormat{}.IsNormalized)noexcept : + ValueType (_ValueType), + NumComponents (_NumComponents), + IsNormalized (_IsNormalized) + {} + + /// Tests if two structures are equivalent bool operator == (const BufferFormat& RHS)const { @@ -79,6 +94,20 @@ struct BufferViewDesc : DeviceObjectAttribs /// Size in bytes of the referenced buffer region Uint32 ByteWidth = 0; + + BufferViewDesc()noexcept{} + + explicit + BufferViewDesc(BUFFER_VIEW_TYPE _ViewType, + BufferFormat _Format = BufferViewDesc{}.Format, + Uint32 _ByteOffset = BufferViewDesc{}.ByteOffset, + Uint32 _ByteWidth = BufferViewDesc{}.ByteWidth)noexcept : + ViewType (_ViewType), + Format (_Format), + ByteOffset (_ByteOffset), + ByteWidth (_ByteWidth) + {} + /// 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/DepthStencilState.h b/Graphics/GraphicsEngine/interface/DepthStencilState.h index 9307a192..d42da3fd 100644 --- a/Graphics/GraphicsEngine/interface/DepthStencilState.h +++ b/Graphics/GraphicsEngine/interface/DepthStencilState.h @@ -107,6 +107,22 @@ struct StencilOpDesc /// Default value: Diligent::COMPARISON_FUNC_ALWAYS. See Diligent::COMPARISON_FUNCTION. COMPARISON_FUNCTION StencilFunc = COMPARISON_FUNC_ALWAYS; + + // 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} + + StencilOpDesc()noexcept{} + + StencilOpDesc(STENCIL_OP _StencilFailOp, + STENCIL_OP _StencilDepthFailOp, + STENCIL_OP _StencilPassOp, + COMPARISON_FUNCTION _StencilFunc)noexcept : + StencilFailOp (_StencilFailOp), + StencilDepthFailOp (_StencilDepthFailOp), + StencilPassOp (_StencilPassOp), + StencilFunc (_StencilFunc) + {} + /// Tests if two structures are equivalent /// \param [in] rhs - reference to the structure to perform comparison with @@ -162,6 +178,25 @@ struct DepthStencilStateDesc StencilOpDesc BackFace; + // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code: + // DepthStencilStateDesc{False, False} + + DepthStencilStateDesc()noexcept{} + + DepthStencilStateDesc(Bool _DepthEnable, + Bool _DepthWriteEnable, + COMPARISON_FUNCTION _DepthFunc = DepthStencilStateDesc{}.DepthFunc, + Bool _StencilEnable = DepthStencilStateDesc{}.StencilEnable, + Uint8 _StencilReadMask = DepthStencilStateDesc{}.StencilReadMask, + Uint8 _StencilWriteMask = DepthStencilStateDesc{}.StencilWriteMask)noexcept : + DepthEnable ( _DepthEnable ), + DepthWriteEnable( _DepthWriteEnable ), + DepthFunc ( _DepthFunc ), + StencilEnable ( _StencilEnable ), + StencilReadMask ( _StencilReadMask ), + StencilWriteMask( _StencilWriteMask ) + {} + /// Tests if two structures are equivalent /// \param [in] rhs - reference to the structure to perform comparison with diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h index 3277452a..2bc3c871 100644 --- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h +++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h @@ -1071,6 +1071,15 @@ namespace Diligent { /// Object name const Char* Name = nullptr; + + // We have to explicitly define constructors because otherwise Apple's clang fails to compile the following legitimate code: + // DeviceObjectAttribs{"Name"} + + DeviceObjectAttribs()noexcept{} + + explicit DeviceObjectAttribs(const Char* _Name) : + Name(_Name) + {} }; /// Hardware adapter attributes @@ -1189,6 +1198,27 @@ namespace Diligent /// Default stencil value, which is used as optimized stencil clear value in D3D12 Uint8 DefaultStencilValue = 0; + + SwapChainDesc()noexcept{} + + /// Constructor intializes the structure members with default values + SwapChainDesc(Uint32 _Width, + Uint32 _Height, + TEXTURE_FORMAT _ColorBufferFormat, + TEXTURE_FORMAT _DepthBufferFormat, + Uint32 _SamplesCount = SwapChainDesc{}.SamplesCount, + Uint32 _BufferCount = SwapChainDesc{}.BufferCount, + Float32 _DefaultDepthValue = SwapChainDesc{}.DefaultDepthValue, + Uint8 _DefaultStencilValue = SwapChainDesc{}.DefaultStencilValue) : + Width (_Width), + Height (_Height), + ColorBufferFormat (_ColorBufferFormat), + DepthBufferFormat (_DepthBufferFormat), + SamplesCount (_SamplesCount), + BufferCount (_BufferCount), + DefaultDepthValue (_DefaultDepthValue), + DefaultStencilValue(_DefaultStencilValue) + {} }; /// Full screen mode description diff --git a/Graphics/GraphicsEngine/interface/InputLayout.h b/Graphics/GraphicsEngine/interface/InputLayout.h index e27fbd9a..4490f91d 100644 --- a/Graphics/GraphicsEngine/interface/InputLayout.h +++ b/Graphics/GraphicsEngine/interface/InputLayout.h @@ -96,19 +96,19 @@ struct LayoutElement Uint32 _BufferSlot, Uint32 _NumComponents, VALUE_TYPE _ValueType, - Bool _IsNormalized = True, - Uint32 _RelativeOffset = 0, - Uint32 _Stride = 0, - FREQUENCY _Frequency = FREQUENCY_PER_VERTEX, - Uint32 _InstanceDataStepRate = 1)noexcept : - InputIndex(_InputIndex), - BufferSlot(_BufferSlot), - NumComponents(_NumComponents), - ValueType(_ValueType), - IsNormalized(_IsNormalized), - RelativeOffset(_RelativeOffset), - Stride(_Stride), - Frequency(_Frequency), + Bool _IsNormalized = LayoutElement{}.IsNormalized, + Uint32 _RelativeOffset = LayoutElement{}.RelativeOffset, + Uint32 _Stride = LayoutElement{}.Stride, + FREQUENCY _Frequency = LayoutElement{}.Frequency, + Uint32 _InstanceDataStepRate = LayoutElement{}.InstanceDataStepRate)noexcept : + InputIndex (_InputIndex), + BufferSlot (_BufferSlot), + NumComponents (_NumComponents), + ValueType (_ValueType), + IsNormalized (_IsNormalized), + RelativeOffset (_RelativeOffset), + Stride (_Stride), + Frequency (_Frequency), InstanceDataStepRate(_InstanceDataStepRate) {} }; @@ -122,6 +122,14 @@ struct InputLayoutDesc const LayoutElement* LayoutElements = nullptr; /// Number of layout elements Uint32 NumElements = 0; + + InputLayoutDesc()noexcept{} + + InputLayoutDesc(const LayoutElement* _LayoutElements, + Uint32 _NumElements)noexcept : + LayoutElements(_LayoutElements), + NumElements (_NumElements) + {} }; } diff --git a/Graphics/GraphicsEngine/interface/PipelineState.h b/Graphics/GraphicsEngine/interface/PipelineState.h index 5f0a62bf..9dc585c7 100644 --- a/Graphics/GraphicsEngine/interface/PipelineState.h +++ b/Graphics/GraphicsEngine/interface/PipelineState.h @@ -48,6 +48,14 @@ struct SampleDesc /// Quality Uint8 Quality = 0; + + SampleDesc()noexcept{} + + SampleDesc(Uint8 _Count, + Uint8 _Quality) : + Count (_Count), + Quality (_Quality) + {} }; diff --git a/Graphics/GraphicsEngine/interface/RasterizerState.h b/Graphics/GraphicsEngine/interface/RasterizerState.h index f71bafe0..b1638af8 100644 --- a/Graphics/GraphicsEngine/interface/RasterizerState.h +++ b/Graphics/GraphicsEngine/interface/RasterizerState.h @@ -130,7 +130,32 @@ struct RasterizerStateDesc /// Scalar that scales the given pixel's slope before adding to the pixel's depth. /// Default value: 0. Float32 SlopeScaledDepthBias = 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} + + RasterizerStateDesc()noexcept{} + + RasterizerStateDesc(FILL_MODE _FillMode, + CULL_MODE _CullMode, + Bool _FrontCounterClockwise = RasterizerStateDesc{}.FrontCounterClockwise, + Bool _DepthClipEnable = RasterizerStateDesc{}.DepthClipEnable, + Bool _ScissorEnable = RasterizerStateDesc{}.ScissorEnable, + Bool _AntialiasedLineEnable = RasterizerStateDesc{}.AntialiasedLineEnable, + Int32 _DepthBias = RasterizerStateDesc{}.DepthBias, + Float32 _DepthBiasClamp = RasterizerStateDesc{}.DepthBiasClamp, + Float32 _SlopeScaledDepthBias = RasterizerStateDesc{}.SlopeScaledDepthBias)noexcept : + FillMode ( _FillMode ), + CullMode ( _CullMode ), + FrontCounterClockwise( _FrontCounterClockwise ), + DepthClipEnable ( _DepthClipEnable ), + ScissorEnable ( _ScissorEnable ), + AntialiasedLineEnable( _AntialiasedLineEnable ), + DepthBias ( _DepthBias ), + DepthBiasClamp ( _DepthBiasClamp ), + SlopeScaledDepthBias ( _SlopeScaledDepthBias ) + { + } /// Tests if two structures are equivalent diff --git a/Graphics/GraphicsEngine/interface/ResourceMapping.h b/Graphics/GraphicsEngine/interface/ResourceMapping.h index 7efd23a7..40ab56ea 100644 --- a/Graphics/GraphicsEngine/interface/ResourceMapping.h +++ b/Graphics/GraphicsEngine/interface/ResourceMapping.h @@ -50,13 +50,13 @@ namespace Diligent /// \param [in] _Name - Object name. /// \param [in] _pObject - Pointer to the object. /// \param [in] _ArrayIndex - For array resources, index in the array - ResourceMappingEntry (const Char* _Name, IDeviceObject* _pObject, Uint32 _ArrayIndex = 0) : + ResourceMappingEntry (const Char* _Name, IDeviceObject* _pObject, Uint32 _ArrayIndex = 0)noexcept : Name ( _Name ), pObject ( _pObject ), ArrayIndex(_ArrayIndex) {} - ResourceMappingEntry(){} + ResourceMappingEntry()noexcept{} }; /// Resource mapping description @@ -65,14 +65,13 @@ namespace Diligent /// Pointer to the array of resource mapping entries. /// The last element in the array must be default value /// created by ResourceMappingEntry::ResourceMappingEntry() - ResourceMappingEntry* pEntries; + ResourceMappingEntry* pEntries = nullptr; - /// Initializes the structure members with default values + ResourceMappingDesc()noexcept{} - /// Member | Default value - /// ----------------------|-------------- - /// pEntries | nullptr - ResourceMappingDesc() : pEntries(nullptr){} + explicit ResourceMappingDesc(ResourceMappingEntry* _pEntries)noexcept : + pEntries(_pEntries) + {} }; /// Resouce mapping diff --git a/Graphics/GraphicsEngine/interface/Sampler.h b/Graphics/GraphicsEngine/interface/Sampler.h index 0654d243..c8b3c540 100644 --- a/Graphics/GraphicsEngine/interface/Sampler.h +++ b/Graphics/GraphicsEngine/interface/Sampler.h @@ -104,48 +104,29 @@ struct SamplerDesc : DeviceObjectAttribs float MaxLOD = +3.402823466e+38F; SamplerDesc()noexcept{} - - - // Constructor is required because SamplerDesc is not POD. - - /// Initializes the structure members - - /// Member | Default value - /// --------------------|-------------- - /// MinFilter | FILTER_TYPE_LINEAR - /// MagFilter | FILTER_TYPE_LINEAR - /// MipFilter | FILTER_TYPE_LINEAR - /// AddressU | TEXTURE_ADDRESS_CLAMP - /// AddressV | TEXTURE_ADDRESS_CLAMP - /// AddressW | TEXTURE_ADDRESS_CLAMP - /// MipLODBias | 0 - /// MaxAnisotropy | 0 - /// ComparisonFunc | COMPARISON_FUNC_NEVER - /// BorderColor | (0,0,0,0) - /// MinLOD | 0 - /// MaxLOD | +FLT_MAX + 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, - Float32 _MipLODBias = 0, - Uint32 _MaxAnisotropy = 0, - COMPARISON_FUNCTION _ComparisonFunc = COMPARISON_FUNC_NEVER, - float _MinLOD = 0, - 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) + TEXTURE_ADDRESS_MODE _AddressU = SamplerDesc{}.AddressU, + TEXTURE_ADDRESS_MODE _AddressV = SamplerDesc{}.AddressV, + TEXTURE_ADDRESS_MODE _AddressW = SamplerDesc{}.AddressW, + Float32 _MipLODBias = SamplerDesc{}.MipLODBias, + Uint32 _MaxAnisotropy = SamplerDesc{}.MaxAnisotropy, + COMPARISON_FUNCTION _ComparisonFunc = SamplerDesc{}.ComparisonFunc, + float _MinLOD = SamplerDesc{}.MinLOD, + float _MaxLOD = SamplerDesc{}.MaxLOD) : + 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; } diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h index 5530e534..d9e90d87 100644 --- a/Graphics/GraphicsEngine/interface/Shader.h +++ b/Graphics/GraphicsEngine/interface/Shader.h @@ -141,6 +141,14 @@ struct ShaderVariableDesc /// Shader variable type. See Diligent::SHADER_VARIABLE_TYPE for a list of allowed types SHADER_VARIABLE_TYPE Type = SHADER_VARIABLE_TYPE_STATIC; + + ShaderVariableDesc()noexcept{} + + ShaderVariableDesc(const Char* _Name, + SHADER_VARIABLE_TYPE _Type) : + Name(_Name), + Type(_Type) + {} }; @@ -155,7 +163,8 @@ struct StaticSamplerDesc SamplerDesc Desc; StaticSamplerDesc()noexcept{} - StaticSamplerDesc(const Char* _SamplerOrTextureName, const SamplerDesc& _Desc)noexcept : + StaticSamplerDesc(const Char* _SamplerOrTextureName, + const SamplerDesc& _Desc)noexcept : SamplerOrTextureName(_SamplerOrTextureName), Desc (_Desc) {} @@ -168,6 +177,7 @@ struct ShaderDesc : DeviceObjectAttribs SHADER_TYPE ShaderType = SHADER_TYPE_VERTEX; Bool bCacheCompiledShader = False; + SHADER_PROFILE TargetProfile = SHADER_PROFILE_DEFAULT; /// Default shader variable type. This type will be used if shader @@ -201,7 +211,8 @@ struct ShaderMacro const Char* Definition = nullptr; ShaderMacro()noexcept{} - ShaderMacro(const Char* _Name, const Char* _Def)noexcept : + ShaderMacro(const Char* _Name, + const Char* _Def)noexcept : Name ( _Name ), Definition( _Def ) {} diff --git a/Graphics/GraphicsEngine/interface/Texture.h b/Graphics/GraphicsEngine/interface/Texture.h index c44d330b..7c3cb941 100644 --- a/Graphics/GraphicsEngine/interface/Texture.h +++ b/Graphics/GraphicsEngine/interface/Texture.h @@ -44,6 +44,17 @@ struct DepthStencilClearValue Float32 Depth = 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} + + DepthStencilClearValue()noexcept{} + + DepthStencilClearValue(Float32 _Depth, + Uint8 _Stencil)noexcept : + Depth (_Depth), + Stencil (_Stencil) + {} }; /// Defines optimized clear value. @@ -125,6 +136,35 @@ struct TextureDesc : DeviceObjectAttribs /// Defines which command queues this texture can be used with Uint64 CommandQueueMask = 1; + TextureDesc()noexcept{} + + TextureDesc(RESOURCE_DIMENSION _Type, + Uint32 _Width, + Uint32 _Height, + Uint32 _ArraySizeOrDepth, + TEXTURE_FORMAT _Format, + Uint32 _MipLevels = TextureDesc{}.MipLevels, + Uint32 _SampleCount = TextureDesc{}.SampleCount, + USAGE _Usage = TextureDesc{}.Usage, + BIND_FLAGS _BindFlags = TextureDesc{}.BindFlags, + CPU_ACCESS_FLAGS _CPUAccessFlags = TextureDesc{}.CPUAccessFlags, + MISC_TEXTURE_FLAGS _MiscFlags = TextureDesc{}.MiscFlags, + OptimizedClearValue _ClearValue = TextureDesc{}.ClearValue, + Uint64 _CommandQueueMask = TextureDesc{}.CommandQueueMask) : + Type (_Type), + Width (_Width), + Height (_Height), + ArraySize (_ArraySizeOrDepth), + Format (_Format), + MipLevels (_MipLevels), + SampleCount (_SampleCount), + Usage (_Usage), + BindFlags (_BindFlags), + CPUAccessFlags (_CPUAccessFlags), + MiscFlags (_MiscFlags), + ClearValue (_ClearValue), + CommandQueueMask (_CommandQueueMask) + {} /// Tests if two structures are equivalent diff --git a/Graphics/GraphicsEngine/interface/TextureView.h b/Graphics/GraphicsEngine/interface/TextureView.h index f81ddc39..d77cf87a 100644 --- a/Graphics/GraphicsEngine/interface/TextureView.h +++ b/Graphics/GraphicsEngine/interface/TextureView.h @@ -107,6 +107,25 @@ struct TextureViewDesc : DeviceObjectAttribs /// for details. Uint32 AccessFlags = 0; + TextureViewDesc()noexcept{} + + TextureViewDesc(TEXTURE_VIEW_TYPE _ViewType, + RESOURCE_DIMENSION _TextureDim, + TEXTURE_FORMAT _Format = TextureViewDesc{}.Format, + Uint32 _MostDetailedMip = TextureViewDesc{}.MostDetailedMip, + Uint32 _NumMipLevels = TextureViewDesc{}.NumMipLevels, + Uint32 _FirstArrayOrDepthSlice = TextureViewDesc{}.FirstArraySlice, + Uint32 _NumArrayOrDepthSlices = TextureViewDesc{}.NumArraySlices, + Uint32 _AccessFlags = TextureViewDesc{}.AccessFlags)noexcept : + ViewType (_ViewType), + TextureDim (_TextureDim), + Format (_Format), + MostDetailedMip (_MostDetailedMip), + NumMipLevels (_NumMipLevels), + FirstArraySlice (_FirstArrayOrDepthSlice), + NumArraySlices (_NumArrayOrDepthSlices), + AccessFlags (_AccessFlags) + {} /// Tests if two structures are equivalent -- cgit v1.2.3