bool ProgramImpl::Create()
{
// Create and link new program
- auto gl = mImpl->controller.GetGL();
- if(!gl)
- {
- // Do nothing during shutdown
- return false;
- }
-
- auto program = gl->CreateProgram();
+ auto& gl = *mImpl->controller.GetGL();
+ auto program = gl.CreateProgram();
const auto& info = mImpl->createInfo;
for(const auto& state : *info.shaderState)
// Compile shader first (ignored when compiled)
if(shader->Compile())
{
- gl->AttachShader(program, shader->GetGLShader());
+ gl.AttachShader(program, shader->GetGLShader());
}
}
- gl->LinkProgram(program);
+ gl.LinkProgram(program);
GLint status{0};
- gl->GetProgramiv(program, GL_LINK_STATUS, &status);
+ gl.GetProgramiv(program, GL_LINK_STATUS, &status);
if(status != GL_TRUE)
{
char output[4096];
GLsizei size{0u};
- gl->GetProgramInfoLog(program, 4096, &size, output);
+ gl.GetProgramInfoLog(program, 4096, &size, output);
// log on error
// TODO: un-printf-it
printf("Log: %s\n", output);
- gl->DeleteProgram(program);
+ gl.DeleteProgram(program);
return false;
}
*/
#include "gles-graphics-reflection.h"
-
-#include <dali/integration-api/debug.h>
#include <dali/integration-api/gl-abstraction.h>
#include <dali/integration-api/gl-defines.h>
char* name;
auto gl = mController.GetGL();
- if(!gl)
- {
- // Do nothing during shutdown
- return;
- }
gl->GetProgramiv(glProgram, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxLength);
gl->GetProgramiv(glProgram, GL_ACTIVE_ATTRIBUTES, &nAttribs);
int numUniforms = 0;
auto gl = mController.GetGL();
- if(!gl)
- {
- // Do nothing during shutdown
- return;
- }
gl->GetProgramiv(glProgram, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxLen);
gl->GetProgramiv(glProgram, GL_ACTIVE_UNIFORMS, &numUniforms);
auto gl = mController.GetGL();
auto glProgram = mProgram.GetGlProgram();
int numUniformBlocks = 0;
-
- if(!gl)
- {
- // Do nothing during shutdown
- return;
- }
-
gl->GetProgramiv(glProgram, GL_ACTIVE_UNIFORM_BLOCKS, &numUniformBlocks);
mUniformBlocks.clear();
Graphics::ShaderLanguage Reflection::GetLanguage() const
{
- auto version = Graphics::ShaderLanguage::GLSL_3_2;
-
auto gl = mController.GetGL();
- if(!gl)
- {
- // Do nothing during shutdown
- return version;
- }
int majorVersion, minorVersion;
gl->GetIntegerv(GL_MAJOR_VERSION, &majorVersion);
gl->GetIntegerv(GL_MINOR_VERSION, &minorVersion);
- DALI_LOG_RELEASE_INFO("GL Version (integer) : %d.%d\n", majorVersion, minorVersion);
- DALI_LOG_RELEASE_INFO("GLSL Version : %s\n", gl->GetString(GL_SHADING_LANGUAGE_VERSION));
+ printf("GL Version (integer) : %d.%d\n", majorVersion, minorVersion);
+ printf("GLSL Version : %s\n", gl->GetString(GL_SHADING_LANGUAGE_VERSION));
// TODO: the language version is hardcoded for now, but we may use what we get
// from GL_SHADING_LANGUAGE_VERSION?
- return version;
+ return Graphics::ShaderLanguage::GLSL_3_2;
}
} // namespace Dali::Graphics::GLES
#include "gles-graphics-shader.h"
// INTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
#include "egl-graphics-controller.h"
namespace Dali::Graphics::GLES
bool Shader::Compile() const
{
- auto gl = GetController().GetGL();
-
- if(!gl)
- {
- return false;
- }
-
+ auto& gl = *GetController().GetGL();
if(!mImpl->glShader)
{
GLenum pipelineStage{0u};
if(pipelineStage)
{
- auto shader = gl->CreateShader(pipelineStage);
+ auto shader = gl.CreateShader(pipelineStage);
const auto src = reinterpret_cast<const char*>(GetCreateInfo().sourceData);
GLint size = GetCreateInfo().sourceSize;
- gl->ShaderSource(shader, 1, const_cast<const char**>(&src), &size);
- gl->CompileShader(shader);
+ gl.ShaderSource(shader, 1, const_cast<const char**>(&src), &size);
+ gl.CompileShader(shader);
GLint status{0};
- gl->GetShaderiv(shader, GL_COMPILE_STATUS, &status);
+ gl.GetShaderiv(shader, GL_COMPILE_STATUS, &status);
if(status != GL_TRUE)
{
char output[4096];
GLsizei size{0u};
- gl->GetShaderInfoLog(shader, 4096, &size, output);
- DALI_LOG_RELEASE_INFO("Code: %s\n", reinterpret_cast<const char*>(GetCreateInfo().sourceData));
- DALI_LOG_RELEASE_INFO("Log: %s\n", output);
- gl->DeleteShader(shader);
+ gl.GetShaderInfoLog(shader, 4096, &size, output);
+ printf("Code: %s\n", reinterpret_cast<const char*>(GetCreateInfo().sourceData));
+ printf("Log: %s\n", output);
+ gl.DeleteShader(shader);
return false;
}
GetController().DiscardResource(this);
}
-} // namespace Dali::Graphics::GLES
+} // namespace Dali::Graphics::GLES
\ No newline at end of file
auto gl = mController.GetGL();
GLuint texture{0};
- if(!gl)
- {
- // Do nothing during shutdown
- return false;
- }
-
NativeImageInterfacePtr nativeImage = mCreateInfo.nativeImagePtr;
bool created = nativeImage->CreateResource();
mGlTarget = nativeImage->GetTextureTarget();
bool Texture::InitializeTexture()
{
auto gl = mController.GetGL();
- if(!gl)
- {
- // Do nothing during shutdown
- return false;
- }
GLuint texture{0};
void Texture::Bind(const TextureBinding& binding) const
{
auto gl = mController.GetGL();
- if(!gl)
- {
- // Do nothing during shutdown
- return;
- }
gl->ActiveTexture(GL_TEXTURE0 + binding.binding);
gl->BindTexture(mGlTarget, mTextureId);