From 1f89ae680ab2cf80a5e226338f6bb311e53857cd Mon Sep 17 00:00:00 2001 From: Adam Bialogonski Date: Tue, 8 Jun 2021 09:28:41 +0100 Subject: [PATCH] Fixed the case when the new program is not set whe GLES Context Flush() is called. Change-Id: I071cdb6f356f22550d5a319d90ec135d96f8d11a --- dali/internal/graphics/gles-impl/gles-context.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/dali/internal/graphics/gles-impl/gles-context.cpp b/dali/internal/graphics/gles-impl/gles-context.cpp index fb32249..31e0713 100644 --- a/dali/internal/graphics/gles-impl/gles-context.cpp +++ b/dali/internal/graphics/gles-impl/gles-context.cpp @@ -181,11 +181,25 @@ void Context::Flush(bool reset, const GLES::DrawCallDescriptor& drawCall) { auto& gl = *mImpl->mController.GetGL(); + // early out if neither current nor new pipelines are set + // this behaviour may be valid so no assert + if(!mImpl->mCurrentPipeline && !mImpl->mNewPipeline) + { + return; + } + // Execute states if pipeline is changed - const auto& currentProgram = mImpl->mCurrentPipeline ? static_cast(mImpl->mCurrentPipeline->GetCreateInfo().programState->program) : nullptr; - const auto& newProgram = static_cast(mImpl->mNewPipeline->GetCreateInfo().programState->program); + const auto currentProgram = mImpl->mCurrentPipeline ? static_cast(mImpl->mCurrentPipeline->GetCreateInfo().programState->program) : nullptr; + + // case when new pipeline has been set + const GLES::Program* newProgram = nullptr; + + if(mImpl->mNewPipeline) + { + newProgram = static_cast(mImpl->mNewPipeline->GetCreateInfo().programState->program); + } - if(mImpl->mCurrentPipeline != mImpl->mNewPipeline) + if(mImpl->mNewPipeline && mImpl->mCurrentPipeline != mImpl->mNewPipeline) { if(!currentProgram || currentProgram->GetImplementation()->GetGlProgram() != newProgram->GetImplementation()->GetGlProgram()) { @@ -204,7 +218,7 @@ void Context::Flush(bool reset, const GLES::DrawCallDescriptor& drawCall) // Bind textures // Map binding# to sampler location - const auto& reflection = newProgram->GetReflection(); + const auto& reflection = !newProgram ? currentProgram->GetReflection() : newProgram->GetReflection(); const auto& samplers = reflection.GetSamplers(); for(const auto& binding : mImpl->mCurrentTextureBindings) { -- 2.7.4