(SVACE Issues Fix) Initialise uninitialised member variables
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles / gl-extensions.cpp
index 3cc449a..f61d9dd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,9 +19,9 @@
 #include <dali/internal/graphics/gles/gl-extensions.h>
 
 // EXTERNAL INCLUDES
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
+#include <dali/internal/graphics/common/egl-include.h>
 
+// INTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 
 namespace Dali
@@ -33,20 +33,18 @@ namespace Internal
 namespace Adaptor
 {
 
-namespace ECoreX
-{
-
 GlExtensions::GlExtensions()
 :
-#if DALI_GLES_VERSION < 30
 #ifdef GL_EXT_discard_framebuffer
-  mGlDiscardFramebuffer( NULL ),
+  mGlDiscardFramebuffer( nullptr ),
 #endif
 #ifdef GL_OES_get_program_binary
-  mGlGetProgramBinaryOES( NULL ),
-  mGlProgramBinaryOES( NULL ),
+  mGlGetProgramBinaryOES( nullptr ),
+  mGlProgramBinaryOES( nullptr ),
+#endif
+#ifdef GL_KHR_blend_equation_advanced
+  mBlendBarrierKHR( nullptr ),
 #endif
-#endif // DALI_GLES_VERSION < 30
   mInitialized( false )
 {
 }
@@ -55,8 +53,6 @@ GlExtensions::~GlExtensions()
 {
 }
 
-#if DALI_GLES_VERSION < 30
-
 void GlExtensions::DiscardFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
 {
   // initialize extension on first use as on some hw platforms a context
@@ -122,6 +118,27 @@ void GlExtensions::ProgramBinaryOES(GLuint program, GLenum binaryFormat, const G
 #endif
 }
 
+bool GlExtensions::BlendBarrierKHR()
+{
+  // initialize extension on first use as on some hw platforms a context
+  // has to be bound for the extensions to return correct pointer
+  if( !mInitialized )
+  {
+    Initialize();
+  }
+
+#ifdef GL_KHR_blend_equation_advanced
+  if (mBlendBarrierKHR)
+  {
+    mBlendBarrierKHR();
+    return true;
+  }
+  return false;
+#endif
+
+  return false;
+}
+
 void GlExtensions::Initialize()
 {
   mInitialized = true;
@@ -134,11 +151,11 @@ void GlExtensions::Initialize()
   mGlGetProgramBinaryOES = reinterpret_cast< PFNGLGETPROGRAMBINARYOESPROC >( eglGetProcAddress("glGetProgramBinaryOES") );
   mGlProgramBinaryOES = reinterpret_cast< PFNGLPROGRAMBINARYOESPROC >( eglGetProcAddress("glProgramBinaryOES") );
 #endif
-}
-
-#endif // DALI_GLES_VERSION < 30
 
-} // namespace ECoreX
+#ifdef GL_KHR_blend_equation_advanced
+  mBlendBarrierKHR = reinterpret_cast< PFNGLBLENDBARRIERKHRPROC >( eglGetProcAddress("glBlendBarrierKHR") );
+#endif
+}
 
 } // namespace Adaptor