From: Adam Bialogonski Date: Tue, 8 Jun 2021 08:28:41 +0000 (+0100) Subject: Fixed the case when the new program is not set whe GLES Context Flush() is called. X-Git-Tag: dali_2.0.30~6^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F55%2F259455%2F1;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Fixed the case when the new program is not set whe GLES Context Flush() is called. Change-Id: I071cdb6f356f22550d5a319d90ec135d96f8d11a --- 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) {