From 65b88200aae28dcd4b3e48672126bc7556d7bb49 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Fri, 19 Jan 2018 09:44:57 -0800 Subject: Fixed some clang compiler warnings --- .../interface/VariableSizeAllocationsManager.h | 6 ++--- Graphics/GraphicsEngine/include/DeviceObjectBase.h | 2 +- Graphics/GraphicsEngine/include/RenderDeviceBase.h | 2 +- .../include/ShaderResourceBindingBase.h | 4 +-- .../GraphicsEngine/include/StateObjectsRegistry.h | 4 +-- Graphics/GraphicsEngine/interface/MapHelper.h | 4 +-- Graphics/GraphicsEngine/interface/PipelineState.h | 29 ++++++++-------------- .../include/GLProgramResources.h | 4 +-- .../GraphicsEngineOpenGL/src/GLContextMacOS.cpp | 8 +++--- .../src/HLSL2GLSLConverterImpl.cpp | 4 +-- 10 files changed, 28 insertions(+), 39 deletions(-) (limited to 'Graphics') diff --git a/Graphics/GraphicsAccessories/interface/VariableSizeAllocationsManager.h b/Graphics/GraphicsAccessories/interface/VariableSizeAllocationsManager.h index a4519c7c..2dd5f443 100644 --- a/Graphics/GraphicsAccessories/interface/VariableSizeAllocationsManager.h +++ b/Graphics/GraphicsAccessories/interface/VariableSizeAllocationsManager.h @@ -92,10 +92,10 @@ namespace Diligent public: VariableSizeAllocationsManager(OffsetType MaxSize, IMemoryAllocator &Allocator) : - m_MaxSize(MaxSize), - m_FreeSize(MaxSize), m_FreeBlocksByOffset( STD_ALLOCATOR_RAW_MEM(TFreeBlocksByOffsetMap::value_type, Allocator, "Allocator for map") ), - m_FreeBlocksBySize( STD_ALLOCATOR_RAW_MEM(TFreeBlocksBySizeMap::value_type, Allocator, "Allocator for multimap") ) + m_FreeBlocksBySize( STD_ALLOCATOR_RAW_MEM(TFreeBlocksBySizeMap::value_type, Allocator, "Allocator for multimap") ), + m_MaxSize(MaxSize), + m_FreeSize(MaxSize) { // Insert single maximum-size block AddNewBlock(0, m_MaxSize); diff --git a/Graphics/GraphicsEngine/include/DeviceObjectBase.h b/Graphics/GraphicsEngine/include/DeviceObjectBase.h index f7e05d7a..af5fed00 100644 --- a/Graphics/GraphicsEngine/include/DeviceObjectBase.h +++ b/Graphics/GraphicsEngine/include/DeviceObjectBase.h @@ -54,9 +54,9 @@ public: const ObjectDescType &ObjDesc, bool bIsDeviceInternal = false) : TBase(pRefCounters), - m_pDevice( pDevice ), // Do not keep strong reference to the device if the object is an internal device object m_spDevice( bIsDeviceInternal ? nullptr : pDevice ), + m_pDevice( pDevice ), m_ObjectNameCopy(ObjDesc.Name ? ObjDesc.Name : ""), m_Desc( ObjDesc ) { diff --git a/Graphics/GraphicsEngine/include/RenderDeviceBase.h b/Graphics/GraphicsEngine/include/RenderDeviceBase.h index f26c4afa..16d84daf 100644 --- a/Graphics/GraphicsEngine/include/RenderDeviceBase.h +++ b/Graphics/GraphicsEngine/include/RenderDeviceBase.h @@ -209,10 +209,10 @@ public: size_t PSOSize, size_t SRBSize) : TObjectBase(pRefCounters), + m_SamplersRegistry(RawMemAllocator, "sampler"), m_TextureFormatsInfo( TEX_FORMAT_NUM_FORMATS, TextureFormatInfoExt(), STD_ALLOCATOR_RAW_MEM(TextureFormatInfoExt, RawMemAllocator, "Allocator for vector") ), m_TexFmtInfoInitFlags( TEX_FORMAT_NUM_FORMATS, false, STD_ALLOCATOR_RAW_MEM(bool, RawMemAllocator, "Allocator for vector") ), m_wpDeferredContexts(NumDeferredContexts, RefCntWeakPtr(), STD_ALLOCATOR_RAW_MEM(RefCntWeakPtr, RawMemAllocator, "Allocator for vector< RefCntWeakPtr >")), - m_SamplersRegistry(RawMemAllocator, "sampler"), m_TexObjAllocator(RawMemAllocator, TextureObjSize, 64), m_TexViewObjAllocator(RawMemAllocator, TexViewObjSize, 64), m_BufObjAllocator(RawMemAllocator, BufferObjSize, 128), diff --git a/Graphics/GraphicsEngine/include/ShaderResourceBindingBase.h b/Graphics/GraphicsEngine/include/ShaderResourceBindingBase.h index b2e0c923..14e4e89e 100644 --- a/Graphics/GraphicsEngine/include/ShaderResourceBindingBase.h +++ b/Graphics/GraphicsEngine/include/ShaderResourceBindingBase.h @@ -50,8 +50,8 @@ public: /// must not keep a strong reference to the PSO. ShaderResourceBindingBase( IReferenceCounters *pRefCounters, IPipelineState *pPSO, bool IsInternal = false ) : TObjectBase( pRefCounters ), - m_pPSO( pPSO ), - m_spPSO( IsInternal ? nullptr : pPSO ) + m_spPSO( IsInternal ? nullptr : pPSO ), + m_pPSO( pPSO ) {} IMPLEMENT_QUERY_INTERFACE_IN_PLACE( IID_ShaderResourceBinding, TObjectBase ) diff --git a/Graphics/GraphicsEngine/include/StateObjectsRegistry.h b/Graphics/GraphicsEngine/include/StateObjectsRegistry.h index 93e7bf82..2f735477 100644 --- a/Graphics/GraphicsEngine/include/StateObjectsRegistry.h +++ b/Graphics/GraphicsEngine/include/StateObjectsRegistry.h @@ -62,8 +62,8 @@ namespace Diligent static constexpr int DeletedObjectsToPurge = 32; StateObjectsRegistry(IMemoryAllocator &RawAllocator, const Char* RegistryName) : - m_RegistryName( RegistryName ), - m_DescToObjHashMap(STD_ALLOCATOR_RAW_MEM(HashMapElem, RawAllocator, "Allocator for unordered_map >") ) + m_DescToObjHashMap(STD_ALLOCATOR_RAW_MEM(HashMapElem, RawAllocator, "Allocator for unordered_map >") ), + m_RegistryName( RegistryName ) {} ~StateObjectsRegistry() diff --git a/Graphics/GraphicsEngine/interface/MapHelper.h b/Graphics/GraphicsEngine/interface/MapHelper.h index ea1f0e28..527421de 100644 --- a/Graphics/GraphicsEngine/interface/MapHelper.h +++ b/Graphics/GraphicsEngine/interface/MapHelper.h @@ -49,10 +49,10 @@ class MapHelper public: /// Initializes the class member with null values - MapHelper() : - m_pMappedData(nullptr), + MapHelper() : m_pBuffer(nullptr), m_pContext(nullptr), + m_pMappedData(nullptr), m_MapType(static_cast(-1)), m_MapFlags(static_cast(-1)) { diff --git a/Graphics/GraphicsEngine/interface/PipelineState.h b/Graphics/GraphicsEngine/interface/PipelineState.h index dbb89660..0fa55d1e 100644 --- a/Graphics/GraphicsEngine/interface/PipelineState.h +++ b/Graphics/GraphicsEngine/interface/PipelineState.h @@ -89,19 +89,19 @@ struct SampleDesc struct GraphicsPipelineDesc { /// Vertex shader to be used with the pipeline - IShader *pVS; + IShader *pVS = nullptr; /// Pixel shader to be used with the pipeline - IShader *pPS; + IShader *pPS = nullptr; /// Domain shader to be used with the pipeline - IShader *pDS; + IShader *pDS = nullptr; /// Hull shader to be used with the pipeline - IShader *pHS; + IShader *pHS = nullptr; /// Geometry shader to be used with the pipeline - IShader *pGS; + IShader *pGS = nullptr; //D3D12_STREAM_OUTPUT_DESC StreamOutput; @@ -112,7 +112,7 @@ struct GraphicsPipelineDesc /// 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; + Uint32 SampleMask = 0xFFFFFFFF; /// Rasterizer state description RasterizerStateDesc RasterizerDesc; @@ -125,10 +125,10 @@ struct GraphicsPipelineDesc //D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IBStripCutValue; /// Primitive topology type - PRIMITIVE_TOPOLOGY_TYPE PrimitiveTopologyType; + PRIMITIVE_TOPOLOGY_TYPE PrimitiveTopologyType = PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; /// Number of render targets in the RTVFormats member - Uint32 NumRenderTargets; + Uint32 NumRenderTargets = 0; /// Render target formats TEXTURE_FORMAT RTVFormats[8]; @@ -140,21 +140,12 @@ struct GraphicsPipelineDesc SampleDesc SmplDesc; /// Node mask. - Uint32 NodeMask; + Uint32 NodeMask = 0; //D3D12_CACHED_PIPELINE_STATE CachedPSO; //D3D12_PIPELINE_STATE_FLAGS Flags; - GraphicsPipelineDesc() : - pVS(nullptr), - pPS(nullptr), - pDS(nullptr), - pHS(nullptr), - pGS(nullptr), - PrimitiveTopologyType(PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE), - SampleMask(0xFFFFFFFF), - NumRenderTargets(0), - NodeMask(0) + GraphicsPipelineDesc() { for(size_t rt = 0; rt < _countof(RTVFormats); ++rt) RTVFormats[rt] = TEX_FORMAT_UNKNOWN; diff --git a/Graphics/GraphicsEngineOpenGL/include/GLProgramResources.h b/Graphics/GraphicsEngineOpenGL/include/GLProgramResources.h index 1442319c..d26c8ba4 100644 --- a/Graphics/GraphicsEngineOpenGL/include/GLProgramResources.h +++ b/Graphics/GraphicsEngineOpenGL/include/GLProgramResources.h @@ -56,8 +56,8 @@ namespace Diligent { GLProgramVariableBase( const Char* _Name, size_t _ArraySize, SHADER_VARIABLE_TYPE _VarType) : Name( _Name ), - VarType(_VarType), - pResources(_ArraySize) + pResources(_ArraySize), + VarType(_VarType) { VERIFY_EXPR(_ArraySize >= 1); } diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.cpp index be1a37fc..74e3d996 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.cpp @@ -84,10 +84,10 @@ namespace Diligent }*/ GLContext::GLContext( const ContextInitInfo &Info, DeviceCaps &DeviceCaps ) : - m_SwapChainAttribs(Info.SwapChainAttribs), - m_Context(0), - m_pNativeWindow(Info.pNativeWndHandle), - m_pDisplay(Info.pDisplay) + m_pNativeWindow(Info.pNativeWndHandle), + m_pDisplay(Info.pDisplay), + m_Context(0), + m_SwapChainAttribs(Info.SwapChainAttribs) { #if 0 auto CurrentCtx = glXGetCurrentContext(); diff --git a/Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp b/Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp index cdb8084a..78bc255b 100644 --- a/Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp +++ b/Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp @@ -1425,7 +1425,6 @@ void HLSL2GLSLConverterImpl::ConversionStream::ProcessStructuredBuffer(TokenList Token->Literal = "layout(std140) buffer"; // buffer g_Data; // ^ - auto StructuredBftToken = Token; ++Token; // buffer g_Data; @@ -3590,7 +3589,7 @@ void HLSL2GLSLConverterImpl::ConversionStream::ProcessHullShaderArguments( Token if (ConstFuncIt == Attributes.end()) LOG_ERROR_AND_THROW( "Hull shader patch constant function is not specified. Use \"patchconstantfunc\" attribute" ); - auto MaxTessFactorIt = Attributes.find("maxtessfactor"); + //auto MaxTessFactorIt = Attributes.find("maxtessfactor"); auto NumControlPointsIt = Attributes.find("outputcontrolpoints"); if(NumControlPointsIt == Attributes.end()) LOG_ERROR_AND_THROW( "Number of output control points is not specified. Use \"outputcontrolpoints\" attribute" ); @@ -4144,7 +4143,6 @@ void HLSL2GLSLConverterImpl::ConversionStream::RemoveSemanticsFromBlock(TokenLis // ^ if( tkn->Type == TokenType::Identifier ) { - auto SemanticToken = tkn; ++tkn; // float4 Pos : POSITION; // ^ -- cgit v1.2.3