Skip to content

Commit

Permalink
IDeviceContext::TransitionShaderResources removed unused pPipelineSta…
Browse files Browse the repository at this point in the history
…te parameter (API254001)
  • Loading branch information
TheMostDiligent committed Oct 7, 2023
1 parent 0981e67 commit 2ad7e7a
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Graphics/GraphicsEngine/interface/APIInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/// \file
/// Diligent API information

#define DILIGENT_API_VERSION 254000
#define DILIGENT_API_VERSION 254001

#include "../../../Primitives/interface/BasicTypes.h"

Expand Down
2 changes: 0 additions & 2 deletions Graphics/GraphicsEngine/interface/DeviceContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -2122,7 +2122,6 @@ DILIGENT_BEGIN_INTERFACE(IDeviceContext, IObject)

/// Transitions shader resources to the states required by Draw or Dispatch command.
///
/// \param [in] pPipelineState - Pipeline state object that was used to create the shader resource binding.
/// \param [in] pShaderResourceBinding - Shader resource binding whose resources will be transitioned.
///
/// \remarks This method explicitly transitions all resources except ones in unknown state to the states required
Expand All @@ -2139,7 +2138,6 @@ DILIGENT_BEGIN_INTERFACE(IDeviceContext, IObject)
/// Refer to http://diligentgraphics.com/2018/12/09/resource-state-management/ for detailed explanation
/// of resource state management in Diligent Engine.
VIRTUAL void METHOD(TransitionShaderResources)(THIS_
IPipelineState* pPipelineState,
IShaderResourceBinding* pShaderResourceBinding) PURE;

/// Commits shader resources to the device context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ class DeviceContextD3D11Impl final : public DeviceContextBase<EngineD3D11ImplTra
virtual void DILIGENT_CALL_TYPE SetPipelineState(IPipelineState* pPipelineState) override final;

/// Implementation of IDeviceContext::TransitionShaderResources() in Direct3D11 backend.
virtual void DILIGENT_CALL_TYPE TransitionShaderResources(IPipelineState* pPipelineState,
IShaderResourceBinding* pShaderResourceBinding) override final;
virtual void DILIGENT_CALL_TYPE TransitionShaderResources(IShaderResourceBinding* pShaderResourceBinding) override final;

/// Implementation of IDeviceContext::CommitShaderResources() in Direct3D11 backend.
virtual void DILIGENT_CALL_TYPE CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding,
Expand Down
3 changes: 1 addition & 2 deletions Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,8 @@ static const decltype (&ID3D11DeviceContext1::VSSetConstantBuffers1) SetCB1Metho

// clang-format on

void DeviceContextD3D11Impl::TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding)
void DeviceContextD3D11Impl::TransitionShaderResources(IShaderResourceBinding* pShaderResourceBinding)
{
DEV_CHECK_ERR(pPipelineState != nullptr, "Pipeline state must not be null");
DEV_CHECK_ERR(pShaderResourceBinding != nullptr, "Shader resource binding must not be null");
if (m_pActiveRenderPass)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ class DeviceContextD3D12Impl final : public DeviceContextNextGenBase<EngineD3D12
virtual void DILIGENT_CALL_TYPE SetPipelineState(IPipelineState* pPipelineState) override final;

/// Implementation of IDeviceContext::TransitionShaderResources() in Direct3D12 backend.
virtual void DILIGENT_CALL_TYPE TransitionShaderResources(IPipelineState* pPipelineState,
IShaderResourceBinding* pShaderResourceBinding) override final;
virtual void DILIGENT_CALL_TYPE TransitionShaderResources(IShaderResourceBinding* pShaderResourceBinding) override final;

/// Implementation of IDeviceContext::CommitShaderResources() in Direct3D12 backend.
virtual void DILIGENT_CALL_TYPE CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding,
Expand Down
3 changes: 1 addition & 2 deletions Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,8 @@ void DeviceContextD3D12Impl::CommitRootTablesAndViews(RootTableInfo& RootInfo, U
RootInfo.StaleSRBMask &= ~RootInfo.ActiveSRBMask;
}

void DeviceContextD3D12Impl::TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding)
void DeviceContextD3D12Impl::TransitionShaderResources(IShaderResourceBinding* pShaderResourceBinding)
{
DEV_CHECK_ERR(pPipelineState != nullptr, "Pipeline state must not be null");
DEV_CHECK_ERR(!m_pActiveRenderPass, "State transitions are not allowed inside a render pass.");

auto& CmdCtx = GetCmdContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class DeviceContextGLImpl final : public DeviceContextBase<EngineGLImplTraits>
virtual void DILIGENT_CALL_TYPE SetPipelineState(IPipelineState* pPipelineState) override final;

/// Implementation of IDeviceContext::TransitionShaderResources() in OpenGL backend.
virtual void DILIGENT_CALL_TYPE TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding) override final;
virtual void DILIGENT_CALL_TYPE TransitionShaderResources(IShaderResourceBinding* pShaderResourceBinding) override final;

/// Implementation of IDeviceContext::CommitShaderResources() in OpenGL backend.
virtual void DILIGENT_CALL_TYPE CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding,
Expand Down
2 changes: 1 addition & 1 deletion Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ void DeviceContextGLImpl::SetPipelineState(IPipelineState* pPipelineState)
PrepareCommittedResources(m_BindInfo, DvpCompatibleSRBCount);
}

void DeviceContextGLImpl::TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding)
void DeviceContextGLImpl::TransitionShaderResources(IShaderResourceBinding* pShaderResourceBinding)
{
DEV_CHECK_ERR(!m_pActiveRenderPass, "State transitions are not allowed inside a render pass.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ class DeviceContextVkImpl final : public DeviceContextNextGenBase<EngineVkImplTr
virtual void DILIGENT_CALL_TYPE SetPipelineState(IPipelineState* pPipelineState) override final;

/// Implementation of IDeviceContext::TransitionShaderResources() in Vulkan backend.
virtual void DILIGENT_CALL_TYPE TransitionShaderResources(IPipelineState* pPipelineState,
IShaderResourceBinding* pShaderResourceBinding) override final;
virtual void DILIGENT_CALL_TYPE TransitionShaderResources(IShaderResourceBinding* pShaderResourceBinding) override final;

/// Implementation of IDeviceContext::CommitShaderResources() in Vulkan backend.
virtual void DILIGENT_CALL_TYPE CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding,
Expand Down
2 changes: 1 addition & 1 deletion Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ void DeviceContextVkImpl::DvpValidateCommittedShaderResources(ResourceBindInfo&
}
#endif

void DeviceContextVkImpl::TransitionShaderResources(IPipelineState*, IShaderResourceBinding* pShaderResourceBinding)
void DeviceContextVkImpl::TransitionShaderResources(IShaderResourceBinding* pShaderResourceBinding)
{
DEV_CHECK_ERR(!m_pActiveRenderPass, "State transitions are not allowed inside a render pass.");
DEV_CHECK_ERR(pShaderResourceBinding != nullptr, "pShaderResourceBinding must not be null");
Expand Down
4 changes: 4 additions & 0 deletions ReleaseHistory.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Current progress

* `IDeviceContext::TransitionShaderResources`: removed unused `pPipelineState` parameter (API254001)

## v2.5.4

* Use thread group count X/Y/Z for mesh draw commands (API253012)
Expand Down
4 changes: 2 additions & 2 deletions Tests/DiligentCoreAPITest/src/DrawCommandTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2681,14 +2681,14 @@ void DrawCommandTest::DrawWithStructuredOrFormattedBuffers(bool

UpdateBuffer(pPositionsBuffView, Pos, 0, sizeof(float4) * 3);
UpdateBuffer(pColorsBuffView, Color4, 4, sizeof(float4) * 3);
pContext->TransitionShaderResources(pPSO, pSRB);
pContext->TransitionShaderResources(pSRB);

DrawAttribs drawAttrs{3, DRAW_FLAG_VERIFY_ALL};
pContext->Draw(drawAttrs);

UpdateBuffer(pPositionsBuffView, Pos + 3, 0, sizeof(float4) * 3);
UpdateBuffer(pColorsBuffView, Color4, 4, sizeof(float4) * 3);
pContext->TransitionShaderResources(pPSO, pSRB);
pContext->TransitionShaderResources(pSRB);

pContext->Draw(drawAttrs);

Expand Down
8 changes: 4 additions & 4 deletions Tests/DiligentCoreAPITest/src/RenderStateCacheTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void TestDraw(IShader* pVS,
pPSO->CreateShaderResourceBinding(&_pSRB);
VERIFY_EXPR(pTexSRV != nullptr);
_pSRB->GetVariableByName(SHADER_TYPE_PIXEL, "g_Tex2D")->Set(pTexSRV);
pCtx->TransitionShaderResources(pPSO, _pSRB);
pCtx->TransitionShaderResources(_pSRB);
pSRB = _pSRB;
}

Expand Down Expand Up @@ -519,7 +519,7 @@ void TestGraphicsPSO(bool UseRenderPass)
RefCntAutoPtr<IShaderResourceBinding> pRefSRB;
pRefPSO->CreateShaderResourceBinding(&pRefSRB);
pRefSRB->GetVariableByName(SHADER_TYPE_PIXEL, "g_Tex2D")->Set(pTexSRV);
pCtx->TransitionShaderResources(pRefPSO, pRefSRB);
pCtx->TransitionShaderResources(pRefSRB);

for (Uint32 HotReload = 0; HotReload < 2; ++HotReload)
{
Expand Down Expand Up @@ -1229,9 +1229,9 @@ void TestPipelineReload(bool UseRenderPass, bool CreateSrbBeforeReload = false,
(UseSignatures ? pSRB1 : pSRB0)->GetVariableByName(SHADER_TYPE_PIXEL, "g_Tex2D_Mut")->Set(RefTextures.GetView(2));
pSRB0->GetVariableByName(SHADER_TYPE_PIXEL, "g_Tex2D_Dyn")->Set(RefTextures.GetView(3));

pCtx->TransitionShaderResources(pPSO, pSRB0);
pCtx->TransitionShaderResources(pSRB0);
if (pSRB1)
pCtx->TransitionShaderResources(pPSO, pSRB1);
pCtx->TransitionShaderResources(pSRB1);
};

RefCntAutoPtr<IShaderResourceBinding> pSRB0, pSRB1;
Expand Down
2 changes: 1 addition & 1 deletion Tests/IncludeTest/GraphicsEngine/DeviceContextH_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void TestDeviceContextCInterface(struct IDeviceContext* pCtx)

IDeviceContext_Begin(pCtx, 0u);

IDeviceContext_TransitionShaderResources(pCtx, (struct IPipelineState*)NULL, (struct IShaderResourceBinding*)NULL);
IDeviceContext_TransitionShaderResources(pCtx, (struct IShaderResourceBinding*)NULL);
IDeviceContext_TransitionResourceStates(pCtx, 1u, (const struct StateTransitionDesc*)NULL);

IDeviceContext_SetPipelineState(pCtx, (struct IPipelineState*)NULL);
Expand Down

0 comments on commit 2ad7e7a

Please sign in to comment.