2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "gl-extensions.h"
23 #include <EGL/eglext.h>
26 #include <dali/integration-api/debug.h>
40 GlExtensions::GlExtensions()
41 : mInitialized( false )
45 GlExtensions::~GlExtensions()
49 #if DALI_GLES_VERSION < 30
51 void GlExtensions::DiscardFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
53 // initialize extension on first use as on some hw platforms a context
54 // has to be bound for the extensions to return correct pointer
60 #ifdef GL_EXT_discard_framebuffer
61 if( mGlDiscardFramebuffer )
63 mGlDiscardFramebuffer(target, numAttachments, attachments);
67 DALI_LOG_ERROR("Error: glDiscardFramebufferEXT extension is not available\n");
72 void GlExtensions::GetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary)
74 // initialize extension on first use as on some hw platforms a context
75 // has to be bound for the extensions to return correct pointer
81 #ifdef GL_OES_get_program_binary
82 if (mGlGetProgramBinaryOES)
84 mGlGetProgramBinaryOES(program, bufSize, length, binaryFormat, binary);
88 DALI_LOG_ERROR("Error: glGetProgramBinaryOES extension is not available\n");
94 void GlExtensions::ProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length)
96 // initialize extension on first use as on some hw platforms a context
97 // has to be bound for the extensions to return correct pointer
103 #ifdef GL_OES_get_program_binary
104 if (mGlProgramBinaryOES)
106 mGlProgramBinaryOES(program, binaryFormat, binary, length);
110 DALI_LOG_ERROR("Error: glProgramBinaryOES extension is not available\n");
111 DALI_ASSERT_DEBUG(0);
116 void GlExtensions::Initialize()
120 #ifdef GL_EXT_discard_framebuffer
121 mGlDiscardFramebuffer = (PFNGLDISCARDFRAMEBUFFEREXTPROC) eglGetProcAddress("glDiscardFramebufferEXT");
124 #ifdef GL_OES_get_program_binary
125 mGlGetProgramBinaryOES = (PFNGLGETPROGRAMBINARYOESPROC) eglGetProcAddress("glGetProgramBinaryOES");
126 mGlProgramBinaryOES = (PFNGLPROGRAMBINARYOESPROC) eglGetProcAddress("glProgramBinaryOES");
130 #endif // DALI_GLES_VERSION < 30
132 } // namespace ECoreX
134 } // namespace Adaptor
136 } // namespace Internal