From 34cab1f1c50047f2a82cbb2656921c2d88e39ee7 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Thu, 29 Nov 2018 22:40:42 -0800 Subject: Improved type safety of different flag types --- .../GraphicsEngine/include/DeviceContextBase.h | 18 +++---- Graphics/GraphicsEngine/interface/Buffer.h | 6 +-- Graphics/GraphicsEngine/interface/DeviceContext.h | 56 +++++++++++++--------- Graphics/GraphicsEngine/interface/GraphicsTypes.h | 18 +++++-- Graphics/GraphicsEngine/interface/MapHelper.h | 4 +- Graphics/GraphicsEngine/interface/Texture.h | 10 ++-- .../include/D3D11TypeConversions.h | 38 +++++++-------- .../include/DeviceContextD3D11Impl.h | 10 ++-- .../src/DeviceContextD3D11Impl.cpp | 10 ++-- .../GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp | 4 +- .../include/DeviceContextD3D12Impl.h | 10 ++-- .../src/DeviceContextD3D12Impl.cpp | 10 ++-- .../GraphicsEngineD3D12/src/TextureD3D12Impl.cpp | 2 +- .../include/DeviceContextGLImpl.h | 10 ++-- .../src/DeviceContextGLImpl.cpp | 10 ++-- .../include/DeviceContextVkImpl.h | 10 ++-- .../src/DeviceContextVkImpl.cpp | 10 ++-- .../src/GenerateMipsVkHelper.cpp | 2 +- Graphics/GraphicsTools/include/GraphicsUtilities.h | 2 +- Graphics/GraphicsTools/src/GraphicsUtilities.cpp | 4 +- 20 files changed, 132 insertions(+), 112 deletions(-) (limited to 'Graphics') diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.h b/Graphics/GraphicsEngine/include/DeviceContextBase.h index ad012626..293e438c 100644 --- a/Graphics/GraphicsEngine/include/DeviceContextBase.h +++ b/Graphics/GraphicsEngine/include/DeviceContextBase.h @@ -89,12 +89,12 @@ public: /// Base implementation of IDeviceContext::SetVertexBuffers(); validates parameters and /// caches references to the buffers. - inline virtual void SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer** ppBuffers, Uint32* pOffsets, Uint32 Flags )override = 0; + inline virtual void SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer** ppBuffers, Uint32* pOffsets, SET_VERTEX_BUFFERS_FLAGS Flags )override = 0; inline virtual void InvalidateState()override = 0; /// Base implementation of IDeviceContext::CommitShaderResources(); validates parameters. - inline bool CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, Uint32 Flags, int); + inline bool CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, COMMIT_SHADER_RESOURCES_FLAGS Flags, int); /// Base implementation of IDeviceContext::SetIndexBuffer(); caches the strong reference to the index buffer inline virtual void SetIndexBuffer( IBuffer* pIndexBuffer, Uint32 ByteOffset )override = 0; @@ -116,7 +116,7 @@ public: virtual void CopyBuffer(IBuffer *pSrcBuffer, Uint32 SrcOffset, IBuffer *pDstBuffer, Uint32 DstOffset, Uint32 Size)override = 0; /// Base implementation of IDeviceContext::MapBuffer(); validates input parameters. - virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, Uint32 MapFlags, PVoid& pMappedData)override = 0; + virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData)override = 0; /// Base implementation of IDeviceContext::UnmapBuffer() virtual void UnmapBuffer(IBuffer* pBuffer)override = 0; @@ -141,7 +141,7 @@ public: Uint32 MipLevel, Uint32 ArraySlice, MAP_TYPE MapType, - Uint32 MapFlags, + MAP_FLAGS MapFlags, const Box* pMapRegion, MappedTextureSubresource& MappedData)override = 0; @@ -257,7 +257,8 @@ protected: template -inline void DeviceContextBase :: SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer** ppBuffers, Uint32* pOffsets, Uint32 Flags ) +inline void DeviceContextBase :: + SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer** ppBuffers, Uint32* pOffsets, SET_VERTEX_BUFFERS_FLAGS Flags ) { #ifdef DEVELOPMENT if ( StartSlot >= MaxBufferSlots ) @@ -314,7 +315,8 @@ inline void DeviceContextBase -inline bool DeviceContextBase :: CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, Uint32 Flags, int) +inline bool DeviceContextBase :: + CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, COMMIT_SHADER_RESOURCES_FLAGS Flags, int) { #ifdef DEVELOPMENT if (!m_pPipelineState) @@ -695,7 +697,7 @@ inline void DeviceContextBase inline void DeviceContextBase :: - MapBuffer( IBuffer* pBuffer, MAP_TYPE MapType, Uint32 MapFlags, PVoid& pMappedData ) + MapBuffer( IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData ) { VERIFY(pBuffer, "pBuffer must not be null"); @@ -779,7 +781,7 @@ inline void DeviceContextBase(pPipelineState, pShaderResourceBinding, false); } - void DeviceContextD3D11Impl::CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, Uint32 Flags) + void DeviceContextD3D11Impl::CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, COMMIT_SHADER_RESOURCES_FLAGS Flags) { if (!DeviceContextBase::CommitShaderResources(pShaderResourceBinding, Flags, 0 /*Dummy*/)) return; @@ -872,7 +872,7 @@ namespace Diligent m_pd3d11DeviceContext->Dispatch( DispatchAttrs.ThreadGroupCountX, DispatchAttrs.ThreadGroupCountY, DispatchAttrs.ThreadGroupCountZ ); } - void DeviceContextD3D11Impl::ClearDepthStencil( ITextureView* pView, Uint32 ClearFlags, float fDepth, Uint8 Stencil ) + void DeviceContextD3D11Impl::ClearDepthStencil( ITextureView* pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil ) { if (pView == nullptr) { @@ -973,7 +973,7 @@ namespace Diligent } - void DeviceContextD3D11Impl::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, Uint32 MapFlags, PVoid& pMappedData) + void DeviceContextD3D11Impl::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData) { TDeviceContextBase::MapBuffer(pBuffer, MapType, MapFlags, pMappedData); @@ -1076,7 +1076,7 @@ namespace Diligent Uint32 MipLevel, Uint32 ArraySlice, MAP_TYPE MapType, - Uint32 MapFlags, + MAP_FLAGS MapFlags, const Box* pMapRegion, MappedTextureSubresource& MappedData ) { @@ -1126,7 +1126,7 @@ namespace Diligent { } - void DeviceContextD3D11Impl::SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32* pOffsets, Uint32 Flags ) + void DeviceContextD3D11Impl::SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32* pOffsets, SET_VERTEX_BUFFERS_FLAGS Flags ) { TDeviceContextBase::SetVertexBuffers( StartSlot, NumBuffersSet, ppBuffers, pOffsets, Flags ); m_bCommittedD3D11VBsUpToDate = false; diff --git a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp index e37584ad..cb25af84 100644 --- a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp @@ -86,8 +86,8 @@ void SwapChainD3D11Impl::CreateRTVandDSV() DepthBufferDesc.SampleCount = m_SwapChainDesc.SamplesCount; DepthBufferDesc.Usage = USAGE_DEFAULT; DepthBufferDesc.BindFlags = BIND_DEPTH_STENCIL; - DepthBufferDesc.CPUAccessFlags = 0; - DepthBufferDesc.MiscFlags = 0; + DepthBufferDesc.CPUAccessFlags = CPU_ACCESS_NONE; + DepthBufferDesc.MiscFlags = MISC_TEXTURE_FLAG_NONE; RefCntAutoPtr ptex2DDepthBuffer; m_pRenderDevice->CreateTexture(DepthBufferDesc, TextureData{}, &ptex2DDepthBuffer); auto pDSV = ptex2DDepthBuffer->GetDefaultView(TEXTURE_VIEW_DEPTH_STENCIL); diff --git a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h index 23fd4a93..142ca7cb 100644 --- a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h @@ -60,13 +60,13 @@ public: virtual void TransitionShaderResources(IPipelineState *pPipelineState, IShaderResourceBinding *pShaderResourceBinding)override final; - virtual void CommitShaderResources(IShaderResourceBinding *pShaderResourceBinding, Uint32 Flags)override final; + virtual void CommitShaderResources(IShaderResourceBinding *pShaderResourceBinding, COMMIT_SHADER_RESOURCES_FLAGS Flags)override final; virtual void SetStencilRef(Uint32 StencilRef)override final; virtual void SetBlendFactors(const float* pBlendFactors = nullptr)override final; - virtual void SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pOffsets, Uint32 Flags )override final; + virtual void SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pOffsets, SET_VERTEX_BUFFERS_FLAGS Flags )override final; virtual void InvalidateState()override final; @@ -82,7 +82,7 @@ public: virtual void DispatchCompute( const DispatchComputeAttribs &DispatchAttrs )override final; - virtual void ClearDepthStencil( ITextureView *pView, Uint32 ClearFlags, float fDepth, Uint8 Stencil)override final; + virtual void ClearDepthStencil( ITextureView *pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil)override final; virtual void ClearRenderTarget( ITextureView *pView, const float *RGBA )override final; @@ -92,7 +92,7 @@ public: virtual void CopyBuffer(IBuffer *pSrcBuffer, Uint32 SrcOffset, IBuffer *pDstBuffer, Uint32 DstOffset, Uint32 Size)override final; - virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, Uint32 MapFlags, PVoid& pMappedData)override final; + virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData)override final; virtual void UnmapBuffer(IBuffer* pBuffer)override final; @@ -113,7 +113,7 @@ public: Uint32 MipLevel, Uint32 ArraySlice, MAP_TYPE MapType, - Uint32 MapFlags, + MAP_FLAGS MapFlags, const Box* pMapRegion, MappedTextureSubresource& MappedData )override final; diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index 2a9f5aa6..f37691ac 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -232,7 +232,7 @@ namespace Diligent pPipelineStateD3D12->CommitAndTransitionShaderResources(pShaderResourceBinding, Ctx, false, true, false); } - void DeviceContextD3D12Impl::CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, Uint32 Flags) + void DeviceContextD3D12Impl::CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, COMMIT_SHADER_RESOURCES_FLAGS Flags) { if (!DeviceContextBase::CommitShaderResources(pShaderResourceBinding, Flags, 0 /*Dummy*/)) return; @@ -585,7 +585,7 @@ namespace Diligent ++m_State.NumCommands; } - void DeviceContextD3D12Impl::ClearDepthStencil( ITextureView* pView, Uint32 ClearFlags, float fDepth, Uint8 Stencil ) + void DeviceContextD3D12Impl::ClearDepthStencil( ITextureView* pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil ) { ITextureViewD3D12 *pDSVD3D12 = nullptr; if( pView != nullptr ) @@ -724,7 +724,7 @@ namespace Diligent EndFrame(*m_pDevice.RawPtr()); } - void DeviceContextD3D12Impl::SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer** ppBuffers, Uint32* pOffsets, Uint32 Flags ) + void DeviceContextD3D12Impl::SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer** ppBuffers, Uint32* pOffsets, SET_VERTEX_BUFFERS_FLAGS Flags ) { TDeviceContextBase::SetVertexBuffers( StartSlot, NumBuffersSet, ppBuffers, pOffsets, Flags ); m_State.bCommittedD3D12VBsUpToDate = false; @@ -948,7 +948,7 @@ namespace Diligent ++m_State.NumCommands; } - void DeviceContextD3D12Impl::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, Uint32 MapFlags, PVoid& pMappedData) + void DeviceContextD3D12Impl::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData) { TDeviceContextBase::MapBuffer(pBuffer, MapType, MapFlags, pMappedData); auto* pBufferD3D12 = ValidatedCast(pBuffer); @@ -1338,7 +1338,7 @@ namespace Diligent Uint32 MipLevel, Uint32 ArraySlice, MAP_TYPE MapType, - Uint32 MapFlags, + MAP_FLAGS MapFlags, const Box* pMapRegion, MappedTextureSubresource& MappedData ) { diff --git a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp index cdc89e94..173049cc 100644 --- a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp @@ -308,7 +308,7 @@ static TextureDesc InitTexDescFromD3D12Resource(ID3D12Resource* pTexture, const TexDesc.SampleCount = ResourceDesc.SampleDesc.Count; TexDesc.Usage = USAGE_DEFAULT; - TexDesc.BindFlags = 0; + TexDesc.BindFlags = BIND_NONE; if( (ResourceDesc.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) != 0 ) TexDesc.BindFlags |= BIND_RENDER_TARGET; if( (ResourceDesc.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) != 0 ) diff --git a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h index 96d7840d..fe4afb36 100644 --- a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h @@ -50,13 +50,13 @@ public: virtual void TransitionShaderResources(IPipelineState *pPipelineState, IShaderResourceBinding *pShaderResourceBinding)override final; - virtual void CommitShaderResources(IShaderResourceBinding *pShaderResourceBinding, Uint32 Flags)override final; + virtual void CommitShaderResources(IShaderResourceBinding *pShaderResourceBinding, COMMIT_SHADER_RESOURCES_FLAGS Flags)override final; virtual void SetStencilRef(Uint32 StencilRef)override final; virtual void SetBlendFactors(const float* pBlendFactors = nullptr)override final; - virtual void SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pOffsets, Uint32 Flags )override final; + virtual void SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pOffsets, SET_VERTEX_BUFFERS_FLAGS Flags )override final; virtual void InvalidateState()override final; @@ -72,7 +72,7 @@ public: virtual void DispatchCompute( const DispatchComputeAttribs &DispatchAttrs )override final; - virtual void ClearDepthStencil( ITextureView *pView, Uint32 ClearFlags, float fDepth, Uint8 Stencil)override final; + virtual void ClearDepthStencil( ITextureView *pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil)override final; virtual void ClearRenderTarget( ITextureView *pView, const float *RGBA )override final; @@ -82,7 +82,7 @@ public: virtual void CopyBuffer(IBuffer *pSrcBuffer, Uint32 SrcOffset, IBuffer *pDstBuffer, Uint32 DstOffset, Uint32 Size)override final; - virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, Uint32 MapFlags, PVoid& pMappedData)override final; + virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData)override final; virtual void UnmapBuffer(IBuffer* pBuffer)override final; @@ -103,7 +103,7 @@ public: Uint32 MipLevel, Uint32 ArraySlice, MAP_TYPE MapType, - Uint32 MapFlags, + MAP_FLAGS MapFlags, const Box* pMapRegion, MappedTextureSubresource& MappedData )override final; diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp index 1687316d..872e9f0f 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp @@ -130,7 +130,7 @@ namespace Diligent } - void DeviceContextGLImpl::CommitShaderResources(IShaderResourceBinding *pShaderResourceBinding, Uint32 Flags) + void DeviceContextGLImpl::CommitShaderResources(IShaderResourceBinding *pShaderResourceBinding, COMMIT_SHADER_RESOURCES_FLAGS Flags) { if(!DeviceContextBase::CommitShaderResources(pShaderResourceBinding, Flags, 0)) return; @@ -161,7 +161,7 @@ namespace Diligent } } - void DeviceContextGLImpl::SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pOffsets, Uint32 Flags ) + void DeviceContextGLImpl::SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pOffsets, SET_VERTEX_BUFFERS_FLAGS Flags ) { TDeviceContextBase::SetVertexBuffers( StartSlot, NumBuffersSet, ppBuffers, pOffsets, Flags ); m_bVAOIsUpToDate = false; @@ -866,7 +866,7 @@ namespace Diligent #endif } - void DeviceContextGLImpl::ClearDepthStencil( ITextureView *pView, Uint32 ClearFlags, float fDepth, Uint8 Stencil ) + void DeviceContextGLImpl::ClearDepthStencil( ITextureView *pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil ) { // Unlike OpenGL, in D3D10+, the full extent of the resource view is always cleared. // Viewport and scissor settings are not applied. @@ -1028,7 +1028,7 @@ namespace Diligent pDstBufferGL->CopyData(m_ContextState, *pSrcBufferGL, SrcOffset, DstOffset, Size); } - void DeviceContextGLImpl::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, Uint32 MapFlags, PVoid& pMappedData) + void DeviceContextGLImpl::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData) { TDeviceContextBase::MapBuffer(pBuffer, MapType, MapFlags, pMappedData); auto* pBufferGL = ValidatedCast(pBuffer); @@ -1071,7 +1071,7 @@ namespace Diligent Uint32 MipLevel, Uint32 ArraySlice, MAP_TYPE MapType, - Uint32 MapFlags, + MAP_FLAGS MapFlags, const Box* pMapRegion, MappedTextureSubresource& MappedData ) { diff --git a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h index a1d645af..8678f2af 100644 --- a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h @@ -67,13 +67,13 @@ public: virtual void TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding)override final; - virtual void CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, Uint32 Flags)override final; + virtual void CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, COMMIT_SHADER_RESOURCES_FLAGS Flags)override final; virtual void SetStencilRef(Uint32 StencilRef)override final; virtual void SetBlendFactors(const float* pBlendFactors = nullptr)override final; - virtual void SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32* pOffsets, Uint32 Flags )override final; + virtual void SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32* pOffsets, SET_VERTEX_BUFFERS_FLAGS Flags )override final; virtual void InvalidateState()override final; @@ -89,7 +89,7 @@ public: virtual void DispatchCompute( const DispatchComputeAttribs& DispatchAttrs )override final; - virtual void ClearDepthStencil( ITextureView* pView, Uint32 ClearFlags, float fDepth, Uint8 Stencil)override final; + virtual void ClearDepthStencil( ITextureView* pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil)override final; virtual void ClearRenderTarget( ITextureView* pView, const float* RGBA )override final; @@ -99,7 +99,7 @@ public: virtual void CopyBuffer(IBuffer *pSrcBuffer, Uint32 SrcOffset, IBuffer *pDstBuffer, Uint32 DstOffset, Uint32 Size)override final; - virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, Uint32 MapFlags, PVoid& pMappedData)override final; + virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData)override final; virtual void UnmapBuffer(IBuffer* pBuffer)override final; @@ -120,7 +120,7 @@ public: Uint32 MipLevel, Uint32 ArraySlice, MAP_TYPE MapType, - Uint32 MapFlags, + MAP_FLAGS MapFlags, const Box* pMapRegion, MappedTextureSubresource& MappedData )override final; diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index de99f36f..b594aa35 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -263,7 +263,7 @@ namespace Diligent pPipelineStateVk->CommitAndTransitionShaderResources(pShaderResourceBinding, this, false, COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES, nullptr); } - void DeviceContextVkImpl::CommitShaderResources(IShaderResourceBinding *pShaderResourceBinding, Uint32 Flags) + void DeviceContextVkImpl::CommitShaderResources(IShaderResourceBinding *pShaderResourceBinding, COMMIT_SHADER_RESOURCES_FLAGS Flags) { if (!DeviceContextBase::CommitShaderResources(pShaderResourceBinding, Flags, 0 /*Dummy*/)) return; @@ -636,7 +636,7 @@ namespace Diligent ++m_State.NumCommands; } - void DeviceContextVkImpl::ClearDepthStencil( ITextureView* pView, Uint32 ClearFlags, float fDepth, Uint8 Stencil ) + void DeviceContextVkImpl::ClearDepthStencil( ITextureView* pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil ) { ITextureViewVk* pVkDSV = nullptr; if ( pView != nullptr ) @@ -968,7 +968,7 @@ namespace Diligent m_pPipelineState = nullptr; } - void DeviceContextVkImpl::SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pOffsets, Uint32 Flags ) + void DeviceContextVkImpl::SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pOffsets, SET_VERTEX_BUFFERS_FLAGS Flags ) { TDeviceContextBase::SetVertexBuffers( StartSlot, NumBuffersSet, ppBuffers, pOffsets, Flags ); m_State.CommittedVBsUpToDate = false; @@ -1292,7 +1292,7 @@ namespace Diligent ++m_State.NumCommands; } - void DeviceContextVkImpl::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, Uint32 MapFlags, PVoid& pMappedData) + void DeviceContextVkImpl::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData) { TDeviceContextBase::MapBuffer(pBuffer, MapType, MapFlags, pMappedData); auto* pBufferVk = ValidatedCast(pBuffer); @@ -1709,7 +1709,7 @@ namespace Diligent Uint32 MipLevel, Uint32 ArraySlice, MAP_TYPE MapType, - Uint32 MapFlags, + MAP_FLAGS MapFlags, const Box* pMapRegion, MappedTextureSubresource& MappedData ) { diff --git a/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp b/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp index 7fcc6b27..ec6d61c3 100644 --- a/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp +++ b/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp @@ -304,7 +304,7 @@ namespace Diligent if (CurrLayout != VK_IMAGE_LAYOUT_GENERAL) Ctx.TransitionImageLayout(*pTexVk, CurrLayout, VK_IMAGE_LAYOUT_GENERAL, SubresRange); - Ctx.CommitShaderResources(&SRB, 0); + Ctx.CommitShaderResources(&SRB, COMMIT_SHADER_RESOURCES_FLAG_NONE); DispatchComputeAttribs DispatchAttrs((DstWidth + 7) / 8, (DstHeight + 7) / 8, ViewDesc.NumArraySlices); Ctx.DispatchCompute(DispatchAttrs); diff --git a/Graphics/GraphicsTools/include/GraphicsUtilities.h b/Graphics/GraphicsTools/include/GraphicsUtilities.h index 6f7b4361..bd56011a 100644 --- a/Graphics/GraphicsTools/include/GraphicsUtilities.h +++ b/Graphics/GraphicsTools/include/GraphicsUtilities.h @@ -32,6 +32,6 @@ namespace Diligent { -void CreateUniformBuffer( IRenderDevice *pDevice, Uint32 Size, const Char *Name, IBuffer **ppBuffer, USAGE Usage = USAGE_DYNAMIC, Uint32 BindFlag = BIND_UNIFORM_BUFFER, Uint8 CPUAccessFlags = CPU_ACCESS_WRITE ); +void CreateUniformBuffer( IRenderDevice *pDevice, Uint32 Size, const Char *Name, IBuffer **ppBuffer, USAGE Usage = USAGE_DYNAMIC, BIND_FLAGS BindFlag = BIND_UNIFORM_BUFFER, CPU_ACCESS_FLAGS CPUAccessFlags = CPU_ACCESS_WRITE ); void GenerateCheckerBoardPattern(Uint32 Width, Uint32 Height, TEXTURE_FORMAT Fmt, Uint32 HorzCells, Uint32 VertCells, Uint8 *pData, Uint32 StrideInBytes ); } diff --git a/Graphics/GraphicsTools/src/GraphicsUtilities.cpp b/Graphics/GraphicsTools/src/GraphicsUtilities.cpp index 2abbd9ce..8052d2b5 100644 --- a/Graphics/GraphicsTools/src/GraphicsUtilities.cpp +++ b/Graphics/GraphicsTools/src/GraphicsUtilities.cpp @@ -33,13 +33,13 @@ namespace Diligent { -void CreateUniformBuffer( IRenderDevice *pDevice, Uint32 Size, const Char *Name, IBuffer **ppBuffer, USAGE Usage, Uint32 BindFlag, Uint8 CPUAccessFlags) +void CreateUniformBuffer( IRenderDevice *pDevice, Uint32 Size, const Char *Name, IBuffer **ppBuffer, USAGE Usage, BIND_FLAGS BindFlags, CPU_ACCESS_FLAGS CPUAccessFlags) { BufferDesc CBDesc; CBDesc.Name = Name; CBDesc.uiSizeInBytes = Size; CBDesc.Usage = Usage; - CBDesc.BindFlags = BindFlag; + CBDesc.BindFlags = BindFlags; CBDesc.CPUAccessFlags = CPUAccessFlags; pDevice->CreateBuffer( CBDesc, BufferData(), ppBuffer ); } -- cgit v1.2.3