mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 22:50:45 +00:00
Write constant buffers if changed or layout changed
This commit is contained in:
parent
c48346c551
commit
632ad33f80
5 changed files with 13 additions and 15 deletions
|
@ -138,7 +138,7 @@ void fhImmediateMode::End()
|
|||
vertexBuffer.Update( drawVerts, drawVertsUsed * sizeof( idDrawVert ), 0, false, commandList );
|
||||
indexBuffer.Update( lineIndices, drawVertsUsed * sizeof( triIndex_t ), 0, false, commandList );
|
||||
|
||||
renderProgManager.CommitConstantBuffer( commandList );
|
||||
renderProgManager.CommitConstantBuffer( commandList, true );
|
||||
|
||||
int bindingLayoutType = renderProgManager.BindingLayoutType();
|
||||
|
||||
|
|
|
@ -469,12 +469,15 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
|
|||
}
|
||||
#endif
|
||||
|
||||
if( renderProgManager.CommitConstantBuffer( commandList ) )
|
||||
if( renderProgManager.CommitConstantBuffer( commandList, bindingLayoutType != prevBindingLayoutType ) )
|
||||
{
|
||||
// Reset the graphics state if the constant buffer is written to since
|
||||
// the render pass is ended for vulkan. setGraphicsState will
|
||||
// reinstate the render pass.
|
||||
changeState = true;
|
||||
if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN )
|
||||
{
|
||||
// Reset the graphics state if the constant buffer is written to since
|
||||
// the render pass is ended for vulkan. setGraphicsState will
|
||||
// reinstate the render pass.
|
||||
changeState = true;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1421,15 +1424,10 @@ void idRenderBackend::GetCurrentBindingLayout( int type )
|
|||
}
|
||||
else
|
||||
{
|
||||
desc[0].bindings[0].resourceHandle = paramCb;
|
||||
desc[0].bindings[0].range = range;
|
||||
auto& bindings = desc[0].bindings;
|
||||
bindings[0].resourceHandle = paramCb;
|
||||
bindings[0].range = range;
|
||||
|
||||
bindings[0].resourceHandle = paramCb;
|
||||
bindings[0].range = range;
|
||||
|
||||
bindings[1].resourceHandle = currentJointBuffer;
|
||||
bindings[1].range = nvrhi::BufferRange{ currentJointOffset, sizeof( idVec4 )* numBoneMatrices };
|
||||
}
|
||||
|
|
|
@ -307,11 +307,11 @@ void idRenderProgManager::ZeroUniforms()
|
|||
}
|
||||
|
||||
// Only updates the constant buffer if it was updated at all
|
||||
bool idRenderProgManager::CommitConstantBuffer( nvrhi::ICommandList* commandList )
|
||||
bool idRenderProgManager::CommitConstantBuffer( nvrhi::ICommandList* commandList, bool bindingLayoutTypeChanged )
|
||||
{
|
||||
// RB: It would be better to NUM_BINDING_LAYOUTS uniformsChanged entrys but we don't know the current binding layout type when we set the uniforms.
|
||||
// The vkDoom3 backend even didn't bother with this and always fired the uniforms for each draw call.
|
||||
//if( uniformsChanged )
|
||||
if( uniformsChanged || bindingLayoutTypeChanged )
|
||||
{
|
||||
commandList->writeBuffer( constantBuffer[BindingLayoutType()], uniforms.Ptr(), uniforms.Allocated() );
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ void BasicTriangle::Render( nvrhi::IFramebuffer* framebuffer )
|
|||
renderProgManager.SetRenderParm( renderParm_t::RENDERPARM_PROJMATRIX_W, &projMat[12] );
|
||||
}
|
||||
|
||||
renderProgManager.CommitConstantBuffer( commandList );
|
||||
renderProgManager.CommitConstantBuffer( commandList, true );
|
||||
|
||||
idVertexBuffer* vertexBuffer;
|
||||
uint vertOffset = 0;
|
||||
|
|
|
@ -1017,7 +1017,7 @@ public:
|
|||
int UniformSize();
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
bool CommitConstantBuffer( nvrhi::ICommandList* commandList );
|
||||
bool CommitConstantBuffer( nvrhi::ICommandList* commandList, bool bindingLayoutTypeChanged );
|
||||
|
||||
ID_INLINE nvrhi::IBuffer* ConstantBuffer()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue