diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-08-20 22:52:28 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-08-20 22:52:28 +0000 |
| commit | 93eda1da4a8a35c8f4558b48815a08603cb9c99e (patch) | |
| tree | 4ff74683764f30a3911d07ff5447578c41fee1a4 /Graphics/GraphicsEngineOpenGL | |
| parent | D3D12 backend: removed ID3D12GraphicsCommandList5 that is not support by CI (diff) | |
| download | DiligentCore-93eda1da4a8a35c8f4558b48815a08603cb9c99e.tar.gz DiligentCore-93eda1da4a8a35c8f4558b48815a08603cb9c99e.zip | |
GL backend: committing GL program or pipeline in SetPipelineState function
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp index cf655a01..4155f51e 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp @@ -144,6 +144,11 @@ void DeviceContextGLImpl::SetPipelineState(IPipelineState* pPipelineState) } m_ContextState.InvalidateVAO(); } + + // Note that the program may change if a shader is created after the call + // (GLProgramResources needs to bind a program to load uniforms), but before + // the draw command. + m_pPipelineState->CommitProgram(m_ContextState); } void DeviceContextGLImpl::TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding) @@ -881,6 +886,8 @@ void DeviceContextGLImpl::PrepareForDraw(DRAW_FLAGS Flags, bool IsIndexed, GLenu DvpVerifyRenderTargets(); #endif + // The program might have changed since the last SetPipelineState call if a shader was + // created after the call (GLProgramResources needs to bind a program to load uniforms). m_pPipelineState->CommitProgram(m_ContextState); auto CurrNativeGLContext = m_pDevice->m_GLContext.GetCurrentNativeGLContext(); @@ -1101,6 +1108,8 @@ void DeviceContextGLImpl::DispatchCompute(const DispatchComputeAttribs& Attribs) return; #if GL_ARB_compute_shader + // The program might have changed since the last SetPipelineState call if a shader was + // created after the call (GLProgramResources needs to bind a program to load uniforms). m_pPipelineState->CommitProgram(m_ContextState); glDispatchCompute(Attribs.ThreadGroupCountX, Attribs.ThreadGroupCountY, Attribs.ThreadGroupCountZ); DEV_CHECK_GL_ERROR("glDispatchCompute() failed"); @@ -1117,6 +1126,8 @@ void DeviceContextGLImpl::DispatchComputeIndirect(const DispatchComputeIndirectA return; #if GL_ARB_compute_shader + // The program might have changed since the last SetPipelineState call if a shader was + // created after the call (GLProgramResources needs to bind a program to load uniforms). m_pPipelineState->CommitProgram(m_ContextState); auto* pBufferGL = ValidatedCast<BufferGLImpl>(pAttribsBuffer); |
