#include "gles-context.h"
#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
+#include <dali/integration-api/debug.h>
#include <dali/integration-api/gl-abstraction.h>
#include <dali/integration-api/gl-defines.h>
#include <dali/internal/graphics/common/graphics-interface.h>
mProgramVAOCurrentState = iter->second;
gl.BindVertexArray(iter->second);
}
+
+ // We should re-check enable attribute usage because geometry might be changed.
+ // @todo : We can remove this loop if we enable vertex attrib by shader's information.
+ for(const auto& attr : vertexInputState.attributes)
+ {
+ gl.EnableVertexAttribArray(attr.location);
+ }
return;
}
gl.GenVertexArrays(1, &vao);
gl.BindVertexArray(vao);
mProgramVAOMap[program] = vao;
+
+ // @todo : Enable vertex attrib only by shader's information, not with Geometry.
+ // Currently, vertexInputState.attributes depend on Geometry's VertexBuffer.
for(const auto& attr : vertexInputState.attributes)
{
gl.EnableVertexAttribArray(attr.location);
newProgram = static_cast<const GLES::Program*>(mImpl->mNewPipeline->GetCreateInfo().programState->program);
}
+ if(!currentProgram && !newProgram)
+ {
+ // Early out if we have no program for this pipeline.
+ DALI_LOG_ERROR("No program defined for pipeline\n");
+ return;
+ }
+
if(mImpl->mNewPipeline && mImpl->mCurrentPipeline != mImpl->mNewPipeline)
{
if(!currentProgram || currentProgram->GetImplementation()->GetGlProgram() != newProgram->GetImplementation()->GetGlProgram())
{
// Attempt to reinitialize
// @todo need to put this somewhere else where it isn't const.
- // Maybe post it bac/k on end of initialize queue if initialization fails?
+ // Maybe post it back on end of initialize queue if initialization fails?
texture->InitializeResource();
}
mImpl->FlushVertexAttributeLocations();
}
- //@todo Wait if textures need syncing
gl.DrawArrays(GLESTopology(ia->topology),
drawCall.draw.firstVertex,
drawCall.draw.vertexCount);
if(!mImpl->mNativeDrawContext)
{
EGLint configId{0u};
- EGLint size{0u};
- eglGetConfigs(display, nullptr, 0, &size);
- std::vector<EGLConfig> configs;
- configs.resize(size);
- eglGetConfigs(display, configs.data(), configs.size(), &size);
+ eglQueryContext(display, mImpl->mController.GetSharedContext(), EGL_CONFIG_ID, &configId);
- eglQueryContext(display, context, EGL_CONFIG_ID, &configId);
+ EGLint configAttribs[3];
+ configAttribs[0] = EGL_CONFIG_ID;
+ configAttribs[1] = configId;
+ configAttribs[2] = EGL_NONE;
+
+ EGLConfig config;
+ EGLint numConfigs;
+ if(eglChooseConfig(display, configAttribs, &config, 1, &numConfigs) != EGL_TRUE)
+ {
+ DALI_LOG_ERROR("eglChooseConfig failed!\n");
+ return;
+ }
auto version = int(mImpl->mController.GetGLESVersion());
attribs.push_back(version % 10);
attribs.push_back(EGL_NONE);
- mImpl->mNativeDrawContext = eglCreateContext(display, configs[configId], mImpl->mController.GetSharedContext(), attribs.data());
+ mImpl->mNativeDrawContext = eglCreateContext(display, config, mImpl->mController.GetSharedContext(), attribs.data());
+ if(mImpl->mNativeDrawContext == EGL_NO_CONTEXT)
+ {
+ DALI_LOG_ERROR("eglCreateContext failed!\n");
+ return;
+ }
}
eglMakeCurrent(display, drawSurface, readSurface, mImpl->mNativeDrawContext);