From 033df9926683c316614e0e3da03b30e1ec992de4 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sat, 23 Nov 2019 17:02:30 -0800 Subject: Updated clang-format workaround for brace-on-the-same line in lambdas --- .../src/RenderDeviceD3D11Impl.cpp | 40 ++++++------ .../src/ShaderResourceLayoutD3D11.cpp | 76 +++++++++++----------- .../src/ShaderResourcesD3D11.cpp | 24 +++---- 3 files changed, 70 insertions(+), 70 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp index 26ff378b..3f7e4fea 100644 --- a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp @@ -138,8 +138,8 @@ IMPLEMENT_QUERY_INTERFACE(RenderDeviceD3D11Impl, IID_RenderDeviceD3D11, TRenderD void RenderDeviceD3D11Impl ::CreateBufferFromD3DResource(ID3D11Buffer* pd3d11Buffer, const BufferDesc& BuffDesc, RESOURCE_STATE InitialState, IBuffer** ppBuffer) { CreateDeviceObject("buffer", BuffDesc, ppBuffer, - [&]() // clang-format off - { // clang-format on + [&]() // + { BufferD3D11Impl* pBufferD3D11(NEW_RC_OBJ(m_BufObjAllocator, "BufferD3D11Impl instance", BufferD3D11Impl)(m_BuffViewObjAllocator, this, BuffDesc, InitialState, pd3d11Buffer)); pBufferD3D11->QueryInterface(IID_Buffer, reinterpret_cast(ppBuffer)); pBufferD3D11->CreateDefaultViews(); @@ -150,8 +150,8 @@ void RenderDeviceD3D11Impl ::CreateBufferFromD3DResource(ID3D11Buffer* pd3d11Buf void RenderDeviceD3D11Impl ::CreateBuffer(const BufferDesc& BuffDesc, const BufferData* pBuffData, IBuffer** ppBuffer) { CreateDeviceObject("buffer", BuffDesc, ppBuffer, - [&]() // clang-format off - { // clang-format on + [&]() // + { BufferD3D11Impl* pBufferD3D11(NEW_RC_OBJ(m_BufObjAllocator, "BufferD3D11Impl instance", BufferD3D11Impl)(m_BuffViewObjAllocator, this, BuffDesc, pBuffData)); pBufferD3D11->QueryInterface(IID_Buffer, reinterpret_cast(ppBuffer)); pBufferD3D11->CreateDefaultViews(); @@ -162,8 +162,8 @@ void RenderDeviceD3D11Impl ::CreateBuffer(const BufferDesc& BuffDesc, const Buff void RenderDeviceD3D11Impl ::CreateShader(const ShaderCreateInfo& ShaderCI, IShader** ppShader) { CreateDeviceObject("shader", ShaderCI.Desc, ppShader, - [&]() // clang-format off - { // clang-format on + [&]() // + { ShaderD3D11Impl* pShaderD3D11(NEW_RC_OBJ(m_ShaderObjAllocator, "ShaderD3D11Impl instance", ShaderD3D11Impl)(this, ShaderCI)); pShaderD3D11->QueryInterface(IID_Shader, reinterpret_cast(ppShader)); @@ -179,8 +179,8 @@ void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture1D* pd3d11 TextureDesc TexDesc; TexDesc.Name = "Texture1D from native d3d11 texture"; CreateDeviceObject("texture", TexDesc, ppTexture, - [&]() // clang-format off - { // clang-format on + [&]() // + { TextureBaseD3D11* pTextureD3D11 = NEW_RC_OBJ(m_TexObjAllocator, "Texture1D_D3D11 instance", Texture1D_D3D11)(m_TexViewObjAllocator, this, InitialState, pd3d11Texture); pTextureD3D11->QueryInterface(IID_Texture, reinterpret_cast(ppTexture)); pTextureD3D11->CreateDefaultViews(); @@ -196,8 +196,8 @@ void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture2D* pd3d11 TextureDesc TexDesc; TexDesc.Name = "Texture2D from native d3d11 texture"; CreateDeviceObject("texture", TexDesc, ppTexture, - [&]() // clang-format off - { // clang-format on + [&]() // + { TextureBaseD3D11* pTextureD3D11 = NEW_RC_OBJ(m_TexObjAllocator, "Texture2D_D3D11 instance", Texture2D_D3D11)(m_TexViewObjAllocator, this, InitialState, pd3d11Texture); pTextureD3D11->QueryInterface(IID_Texture, reinterpret_cast(ppTexture)); pTextureD3D11->CreateDefaultViews(); @@ -213,8 +213,8 @@ void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture3D* pd3d11 TextureDesc TexDesc; TexDesc.Name = "Texture3D from native d3d11 texture"; CreateDeviceObject("texture", TexDesc, ppTexture, - [&]() // clang-format off - { // clang-format on + [&]() // + { TextureBaseD3D11* pTextureD3D11 = NEW_RC_OBJ(m_TexObjAllocator, "Texture3D_D3D11 instance", Texture3D_D3D11)(m_TexViewObjAllocator, this, InitialState, pd3d11Texture); pTextureD3D11->QueryInterface(IID_Texture, reinterpret_cast(ppTexture)); pTextureD3D11->CreateDefaultViews(); @@ -226,8 +226,8 @@ void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture3D* pd3d11 void RenderDeviceD3D11Impl ::CreateTexture(const TextureDesc& TexDesc, const TextureData* pData, ITexture** ppTexture) { CreateDeviceObject("texture", TexDesc, ppTexture, - [&]() // clang-format off - { // clang-format on + [&]() // + { TextureBaseD3D11* pTextureD3D11 = nullptr; switch (TexDesc.Type) { @@ -258,8 +258,8 @@ void RenderDeviceD3D11Impl ::CreateTexture(const TextureDesc& TexDesc, const Tex void RenderDeviceD3D11Impl ::CreateSampler(const SamplerDesc& SamplerDesc, ISampler** ppSampler) { CreateDeviceObject("sampler", SamplerDesc, ppSampler, - [&]() // clang-format off - { // clang-format on + [&]() // + { m_SamplersRegistry.Find(SamplerDesc, reinterpret_cast(ppSampler)); if (*ppSampler == nullptr) { @@ -274,8 +274,8 @@ void RenderDeviceD3D11Impl ::CreateSampler(const SamplerDesc& SamplerDesc, ISamp void RenderDeviceD3D11Impl::CreatePipelineState(const PipelineStateDesc& PipelineDesc, IPipelineState** ppPipelineState) { CreateDeviceObject("Pipeline state", PipelineDesc, ppPipelineState, - [&]() // clang-format off - { // clang-format on + [&]() // + { PipelineStateD3D11Impl* pPipelineStateD3D11(NEW_RC_OBJ(m_PSOAllocator, "PipelineStateD3D11Impl instance", PipelineStateD3D11Impl)(this, PipelineDesc)); pPipelineStateD3D11->QueryInterface(IID_PipelineState, reinterpret_cast(ppPipelineState)); OnCreateDeviceObject(pPipelineStateD3D11); @@ -285,8 +285,8 @@ void RenderDeviceD3D11Impl::CreatePipelineState(const PipelineStateDesc& Pipelin void RenderDeviceD3D11Impl::CreateFence(const FenceDesc& Desc, IFence** ppFence) { CreateDeviceObject("Fence", Desc, ppFence, - [&]() // clang-format off - { // clang-format on + [&]() // + { FenceD3D11Impl* pFenceD3D11(NEW_RC_OBJ(m_FenceAllocator, "FenceD3D11Impl instance", FenceD3D11Impl)(this, Desc)); pFenceD3D11->QueryInterface(IID_Fence, reinterpret_cast(ppFence)); OnCreateDeviceObject(pFenceD3D11); diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp index 4378b419..d4140c43 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp @@ -123,8 +123,8 @@ ShaderResourceLayoutD3D11::ShaderResourceLayoutD3D11(IObject& // Initialize offsets size_t CurrentOffset = 0; - auto AdvanceOffset = [&CurrentOffset](size_t NumBytes) // clang-format off - { // clang-format on + auto AdvanceOffset = [&CurrentOffset](size_t NumBytes) // + { constexpr size_t MaxOffset = std::numeric_limits::max(); VERIFY(CurrentOffset <= MaxOffset, "Current offser (", CurrentOffset, ") exceeds max allowed value (", MaxOffset, ")"); auto Offset = static_cast(CurrentOffset); @@ -172,8 +172,8 @@ ShaderResourceLayoutD3D11::ShaderResourceLayoutD3D11(IObject& Uint32 NumSamplerSlots = 0; Uint32 NumUAVSlots = 0; m_pResources->ProcessResources( - [&](const D3DShaderResourceAttribs& CB, Uint32) // clang-format off - { // clang-format on + [&](const D3DShaderResourceAttribs& CB, Uint32) // + { auto VarType = m_pResources->FindVariableType(CB, ResourceLayout); if (IsAllowedType(VarType, AllowedTypeBits)) { @@ -183,8 +183,8 @@ ShaderResourceLayoutD3D11::ShaderResourceLayoutD3D11(IObject& } }, - [&](const D3DShaderResourceAttribs& Sampler, Uint32) // clang-format off - { // clang-format on + [&](const D3DShaderResourceAttribs& Sampler, Uint32) // + { auto VarType = m_pResources->FindVariableType(Sampler, ResourceLayout); if (IsAllowedType(VarType, AllowedTypeBits)) { @@ -202,8 +202,8 @@ ShaderResourceLayoutD3D11::ShaderResourceLayoutD3D11(IObject& } }, - [&](const D3DShaderResourceAttribs& TexSRV, Uint32) // clang-format off - { // clang-format on + [&](const D3DShaderResourceAttribs& TexSRV, Uint32) // + { auto VarType = m_pResources->FindVariableType(TexSRV, ResourceLayout); if (!IsAllowedType(VarType, AllowedTypeBits)) return; @@ -262,8 +262,8 @@ ShaderResourceLayoutD3D11::ShaderResourceLayoutD3D11(IObject& NumSRVSlots = std::max(NumSRVSlots, Uint32{TexSRV.BindPoint} + Uint32{TexSRV.BindCount}); }, - [&](const D3DShaderResourceAttribs& TexUAV, Uint32) // clang-format off - { // clang-format on + [&](const D3DShaderResourceAttribs& TexUAV, Uint32) // + { auto VarType = m_pResources->FindVariableType(TexUAV, ResourceLayout); if (IsAllowedType(VarType, AllowedTypeBits)) { @@ -273,8 +273,8 @@ ShaderResourceLayoutD3D11::ShaderResourceLayoutD3D11(IObject& } }, - [&](const D3DShaderResourceAttribs& BuffSRV, Uint32) // clang-format off - { // clang-format on + [&](const D3DShaderResourceAttribs& BuffSRV, Uint32) // + { auto VarType = m_pResources->FindVariableType(BuffSRV, ResourceLayout); if (IsAllowedType(VarType, AllowedTypeBits)) { @@ -284,8 +284,8 @@ ShaderResourceLayoutD3D11::ShaderResourceLayoutD3D11(IObject& } }, - [&](const D3DShaderResourceAttribs& BuffUAV, Uint32) // clang-format off - { // clang-format on + [&](const D3DShaderResourceAttribs& BuffUAV, Uint32) // + { auto VarType = m_pResources->FindVariableType(BuffUAV, ResourceLayout); if (IsAllowedType(VarType, AllowedTypeBits)) { @@ -356,8 +356,8 @@ void ShaderResourceLayoutD3D11::CopyResources(ShaderResourceCacheD3D11& DstCache // clang-format on HandleConstResources( - [&](const ConstBuffBindInfo& cb) // clang-format off - { // clang-format on + [&](const ConstBuffBindInfo& cb) // + { for (auto CBSlot = cb.m_Attribs.BindPoint; CBSlot < cb.m_Attribs.BindPoint + cb.m_Attribs.BindCount; ++CBSlot) { VERIFY_EXPR(CBSlot < m_ResourceCache.GetCBCount() && CBSlot < DstCache.GetCBCount()); @@ -366,8 +366,8 @@ void ShaderResourceLayoutD3D11::CopyResources(ShaderResourceCacheD3D11& DstCache } }, - [&](const TexSRVBindInfo& ts) // clang-format off - { // clang-format on + [&](const TexSRVBindInfo& ts) // + { for (auto SRVSlot = ts.m_Attribs.BindPoint; SRVSlot < ts.m_Attribs.BindPoint + ts.m_Attribs.BindCount; ++SRVSlot) { VERIFY_EXPR(SRVSlot < m_ResourceCache.GetSRVCount() && SRVSlot < DstCache.GetSRVCount()); @@ -376,8 +376,8 @@ void ShaderResourceLayoutD3D11::CopyResources(ShaderResourceCacheD3D11& DstCache } }, - [&](const TexUAVBindInfo& uav) // clang-format off - { // clang-format on + [&](const TexUAVBindInfo& uav) // + { for (auto UAVSlot = uav.m_Attribs.BindPoint; UAVSlot < uav.m_Attribs.BindPoint + uav.m_Attribs.BindCount; ++UAVSlot) { VERIFY_EXPR(UAVSlot < m_ResourceCache.GetUAVCount() && UAVSlot < DstCache.GetUAVCount()); @@ -386,8 +386,8 @@ void ShaderResourceLayoutD3D11::CopyResources(ShaderResourceCacheD3D11& DstCache } }, - [&](const BuffSRVBindInfo& srv) // clang-format off - { // clang-format on + [&](const BuffSRVBindInfo& srv) // + { for (auto SRVSlot = srv.m_Attribs.BindPoint; SRVSlot < srv.m_Attribs.BindPoint + srv.m_Attribs.BindCount; ++SRVSlot) { VERIFY_EXPR(SRVSlot < m_ResourceCache.GetSRVCount() && SRVSlot < DstCache.GetSRVCount()); @@ -396,8 +396,8 @@ void ShaderResourceLayoutD3D11::CopyResources(ShaderResourceCacheD3D11& DstCache } }, - [&](const BuffUAVBindInfo& uav) // clang-format off - { // clang-format on + [&](const BuffUAVBindInfo& uav) // + { for (auto UAVSlot = uav.m_Attribs.BindPoint; UAVSlot < uav.m_Attribs.BindPoint + uav.m_Attribs.BindCount; ++UAVSlot) { VERIFY_EXPR(UAVSlot < m_ResourceCache.GetUAVCount() && UAVSlot < DstCache.GetUAVCount()); @@ -406,8 +406,8 @@ void ShaderResourceLayoutD3D11::CopyResources(ShaderResourceCacheD3D11& DstCache } }, - [&](const SamplerBindInfo& sam) // clang-format off - { // clang-format on + [&](const SamplerBindInfo& sam) // + { //VERIFY(!sam.IsStaticSampler, "Variables are not created for static samplers"); for (auto SamSlot = sam.m_Attribs.BindPoint; SamSlot < sam.m_Attribs.BindPoint + sam.m_Attribs.BindCount; ++SamSlot) { @@ -896,8 +896,8 @@ bool ShaderResourceLayoutD3D11::dvpVerifyBindings() const bool BindingsOK = true; HandleConstResources( - [&](const ConstBuffBindInfo& cb) // clang-format off - { // clang-format on + [&](const ConstBuffBindInfo& cb) // + { for (Uint32 BindPoint = cb.m_Attribs.BindPoint; BindPoint < Uint32{cb.m_Attribs.BindPoint} + cb.m_Attribs.BindCount; ++BindPoint) { if (!m_ResourceCache.IsCBBound(BindPoint)) @@ -908,8 +908,8 @@ bool ShaderResourceLayoutD3D11::dvpVerifyBindings() const } }, - [&](const TexSRVBindInfo& ts) // clang-format off - { // clang-format on + [&](const TexSRVBindInfo& ts) // + { for (Uint32 BindPoint = ts.m_Attribs.BindPoint; BindPoint < Uint32{ts.m_Attribs.BindPoint} + ts.m_Attribs.BindCount; ++BindPoint) { if (!m_ResourceCache.IsSRVBound(BindPoint, true)) @@ -951,8 +951,8 @@ bool ShaderResourceLayoutD3D11::dvpVerifyBindings() const } }, - [&](const TexUAVBindInfo& uav) // clang-format off - { // clang-format on + [&](const TexUAVBindInfo& uav) // + { for (Uint32 BindPoint = uav.m_Attribs.BindPoint; BindPoint < Uint32{uav.m_Attribs.BindPoint} + uav.m_Attribs.BindCount; ++BindPoint) { if (!m_ResourceCache.IsUAVBound(BindPoint, true)) @@ -963,8 +963,8 @@ bool ShaderResourceLayoutD3D11::dvpVerifyBindings() const } }, - [&](const BuffSRVBindInfo& buf) // clang-format off - { // clang-format on + [&](const BuffSRVBindInfo& buf) // + { for (Uint32 BindPoint = buf.m_Attribs.BindPoint; BindPoint < Uint32{buf.m_Attribs.BindPoint} + buf.m_Attribs.BindCount; ++BindPoint) { if (!m_ResourceCache.IsSRVBound(BindPoint, false)) @@ -975,8 +975,8 @@ bool ShaderResourceLayoutD3D11::dvpVerifyBindings() const } }, - [&](const BuffUAVBindInfo& uav) // clang-format off - { // clang-format on + [&](const BuffUAVBindInfo& uav) // + { for (Uint32 BindPoint = uav.m_Attribs.BindPoint; BindPoint < Uint32{uav.m_Attribs.BindPoint} + uav.m_Attribs.BindCount; ++BindPoint) { if (!m_ResourceCache.IsUAVBound(BindPoint, false)) @@ -987,8 +987,8 @@ bool ShaderResourceLayoutD3D11::dvpVerifyBindings() const } }, - [&](const SamplerBindInfo& sam) // clang-format off - { // clang-format on + [&](const SamplerBindInfo& sam) // + { for (Uint32 BindPoint = sam.m_Attribs.BindPoint; BindPoint < Uint32{sam.m_Attribs.BindPoint} + sam.m_Attribs.BindCount; ++BindPoint) { if (!m_ResourceCache.IsSamplerBound(BindPoint)) diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp index 7c3f9942..03d0e076 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp @@ -148,8 +148,8 @@ void ShaderResourcesD3D11::dvpVerifyCommittedResources(ID3D11Buffer* // clang-format on ProcessResources( - [&](const D3DShaderResourceAttribs& cb, Uint32) // clang-format off - { // clang-format on + [&](const D3DShaderResourceAttribs& cb, Uint32) // + { for (auto BindPoint = cb.BindPoint; BindPoint < cb.BindPoint + cb.BindCount; ++BindPoint) { if (BindPoint >= ResourceCache.GetCBCount()) @@ -194,8 +194,8 @@ void ShaderResourcesD3D11::dvpVerifyCommittedResources(ID3D11Buffer* } }, - [&](const D3DShaderResourceAttribs& sam, Uint32) // clang-format off - { // clang-format on + [&](const D3DShaderResourceAttribs& sam, Uint32) // + { for (auto BindPoint = sam.BindPoint; BindPoint < sam.BindPoint + sam.BindCount; ++BindPoint) { if (BindPoint >= ResourceCache.GetSamplerCount()) @@ -230,8 +230,8 @@ void ShaderResourcesD3D11::dvpVerifyCommittedResources(ID3D11Buffer* } }, - [&](const D3DShaderResourceAttribs& tex, Uint32) // clang-format off - { // clang-format on + [&](const D3DShaderResourceAttribs& tex, Uint32) // + { for (auto BindPoint = tex.BindPoint; BindPoint < tex.BindPoint + tex.BindCount; ++BindPoint) { if (BindPoint >= ResourceCache.GetSRVCount()) @@ -286,8 +286,8 @@ void ShaderResourcesD3D11::dvpVerifyCommittedResources(ID3D11Buffer* } }, - [&](const D3DShaderResourceAttribs& uav, Uint32) // clang-format off - { // clang-format on + [&](const D3DShaderResourceAttribs& uav, Uint32) // + { for (auto BindPoint = uav.BindPoint; BindPoint < uav.BindPoint + uav.BindCount; ++BindPoint) { if (BindPoint >= ResourceCache.GetUAVCount()) @@ -334,8 +334,8 @@ void ShaderResourcesD3D11::dvpVerifyCommittedResources(ID3D11Buffer* }, - [&](const D3DShaderResourceAttribs& buf, Uint32) // clang-format off - { // clang-format on + [&](const D3DShaderResourceAttribs& buf, Uint32) // + { for (auto BindPoint = buf.BindPoint; BindPoint < buf.BindPoint + buf.BindCount; ++BindPoint) { if (BindPoint >= ResourceCache.GetSRVCount()) @@ -384,8 +384,8 @@ void ShaderResourcesD3D11::dvpVerifyCommittedResources(ID3D11Buffer* } }, - [&](const D3DShaderResourceAttribs& uav, Uint32) // clang-format off - { // clang-format on + [&](const D3DShaderResourceAttribs& uav, Uint32) // + { for (auto BindPoint = uav.BindPoint; BindPoint < uav.BindPoint + uav.BindCount; ++BindPoint) { if (BindPoint >= ResourceCache.GetUAVCount()) -- cgit v1.2.3