summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-09-16 04:28:56 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-09-16 04:28:56 +0000
commit25065248960b73ac7a9f671b232e24e27b46e7dc (patch)
treeb2e7981c6583f00cf8569261ce0574a1e3052430 /Graphics/GraphicsEngineOpenGL
parentImproved format support tests in Vulkan backend (diff)
downloadDiligentCore-25065248960b73ac7a9f671b232e24e27b46e7dc.tar.gz
DiligentCore-25065248960b73ac7a9f671b232e24e27b46e7dc.zip
Fixed Android build
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/GLContextState.hpp6
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/GLStubsAndroid.h3
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp38
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/GLStubsAndroid.cpp8
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp33
5 files changed, 66 insertions, 22 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/include/GLContextState.hpp b/Graphics/GraphicsEngineOpenGL/include/GLContextState.hpp
index 7ced4cc6..aa96ec4d 100644
--- a/Graphics/GraphicsEngineOpenGL/include/GLContextState.hpp
+++ b/Graphics/GraphicsEngineOpenGL/include/GLContextState.hpp
@@ -81,6 +81,8 @@ public:
void GetColorWriteMask(Uint32 RTIndex, Uint32& WriteMask, Bool& bIsIndependent);
void SetColorWriteMask(Uint32 RTIndex, Uint32 WriteMask, Bool bIsIndependent);
+ void GetBoundImage(Uint32 Index, GLuint& GLHandle, GLint& MipLevel, GLboolean& IsLayered, GLint& Layer, GLenum& Access, GLenum& Format) const;
+
// clang-format on
void SetNumPatchVertices(Int32 NumVertices);
@@ -131,6 +133,7 @@ private:
struct BoundImageInfo
{
UniqueIdentifier InterfaceID = -1;
+ GLuint GLHandle = 0;
GLint MipLevel = 0;
GLboolean IsLayered = 0;
GLint Layer = 0;
@@ -140,6 +143,7 @@ private:
BoundImageInfo(){};
BoundImageInfo(UniqueIdentifier _UniqueID,
+ GLuint _GLHandle,
GLint _MipLevel,
GLboolean _IsLayered,
GLint _Layer,
@@ -147,6 +151,7 @@ private:
GLenum _Format) :
// clang-format off
InterfaceID{_UniqueID},
+ GLHandle {_GLHandle},
MipLevel {_MipLevel},
IsLayered {_IsLayered},
Layer {_Layer},
@@ -159,6 +164,7 @@ private:
{
// clang-format off
return InterfaceID == rhs.InterfaceID &&
+ GLHandle == rhs.GLHandle &&
MipLevel == rhs.MipLevel &&
IsLayered == rhs.IsLayered &&
Layer == rhs.Layer &&
diff --git a/Graphics/GraphicsEngineOpenGL/include/GLStubsAndroid.h b/Graphics/GraphicsEngineOpenGL/include/GLStubsAndroid.h
index 88b3f468..3eaf32c5 100644
--- a/Graphics/GraphicsEngineOpenGL/include/GLStubsAndroid.h
+++ b/Graphics/GraphicsEngineOpenGL/include/GLStubsAndroid.h
@@ -1208,6 +1208,9 @@ extern PFNGLQUERYCOUNTERPROC glQueryCounter;
typedef void (GL_APIENTRY* PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam);
extern PFNGLDEBUGMESSAGECALLBACKPROC glDebugMessageCallback;
+ #define LOAD_DEBUG_MESSAGE_CONTROL
+ typedef void (GL_APIENTRY* PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled);
+ extern PFNGLDEBUGMESSAGECONTROLPROC glDebugMessageControl;
#endif
void LoadGLFunctions();
diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp
index ff0c3803..bc312120 100644
--- a/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp
@@ -249,6 +249,7 @@ void GLContextState::BindImage(Uint32 Index,
BoundImageInfo NewImageInfo //
{
pTexView->GetUniqueID(),
+ pTexView->GetHandle(),
MipLevel,
IsLayered,
Layer,
@@ -260,8 +261,7 @@ void GLContextState::BindImage(Uint32 Index,
if (!(m_BoundImages[Index] == NewImageInfo))
{
m_BoundImages[Index] = NewImageInfo;
- GLint GLTexHandle = pTexView->GetHandle();
- glBindImageTexture(Index, GLTexHandle, MipLevel, IsLayered, Layer, Access, Format);
+ glBindImageTexture(Index, NewImageInfo.GLHandle, MipLevel, IsLayered, Layer, Access, Format);
DEV_CHECK_GL_ERROR("glBindImageTexture() failed");
}
#else
@@ -275,6 +275,7 @@ void GLContextState::BindImage(Uint32 Index, BufferViewGLImpl* pBuffView, GLenum
BoundImageInfo NewImageInfo //
{
pBuffView->GetUniqueID(),
+ pBuffView->GetTexBufferHandle(),
0,
GL_FALSE,
0,
@@ -286,8 +287,7 @@ void GLContextState::BindImage(Uint32 Index, BufferViewGLImpl* pBuffView, GLenum
if (!(m_BoundImages[Index] == NewImageInfo))
{
m_BoundImages[Index] = NewImageInfo;
- GLint GLBuffHandle = pBuffView->GetTexBufferHandle();
- glBindImageTexture(Index, GLBuffHandle, 0, GL_FALSE, 0, Access, Format);
+ glBindImageTexture(Index, NewImageInfo.GLHandle, 0, GL_FALSE, 0, Access, Format);
DEV_CHECK_GL_ERROR("glBindImageTexture() failed");
}
#else
@@ -295,6 +295,36 @@ void GLContextState::BindImage(Uint32 Index, BufferViewGLImpl* pBuffView, GLenum
#endif
}
+void GLContextState::GetBoundImage(Uint32 Index,
+ GLuint& ImgHandle,
+ GLint& MipLevel,
+ GLboolean& IsLayered,
+ GLint& Layer,
+ GLenum& Access,
+ GLenum& Format) const
+{
+ if (Index < m_BoundImages.size())
+ {
+ const auto& BoundImg = m_BoundImages[Index];
+
+ ImgHandle = BoundImg.GLHandle;
+ MipLevel = BoundImg.MipLevel;
+ IsLayered = BoundImg.IsLayered;
+ Layer = BoundImg.Layer;
+ Access = BoundImg.Access;
+ Format = BoundImg.Format;
+ }
+ else
+ {
+ ImgHandle = 0;
+ MipLevel = 0;
+ IsLayered = GL_FALSE;
+ Layer = 0;
+ Access = GL_READ_ONLY;
+ Format = GL_R8;
+ }
+}
+
void GLContextState::BindUniformBuffer(Int32 Index, const GLObjectWrappers::GLBufferObj& Buff)
{
VERIFY(0 <= Index && Index < m_Caps.m_iMaxUniformBufferBindings, "Uniform buffer index is out of range");
diff --git a/Graphics/GraphicsEngineOpenGL/src/GLStubsAndroid.cpp b/Graphics/GraphicsEngineOpenGL/src/GLStubsAndroid.cpp
index 54258fa7..c51e57f6 100644
--- a/Graphics/GraphicsEngineOpenGL/src/GLStubsAndroid.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/GLStubsAndroid.cpp
@@ -199,6 +199,10 @@
DECLARE_GL_FUNCTION( glDebugMessageCallback, PFNGLDEBUGMESSAGECALLBACKPROC, GLDEBUGPROC callback, const void *userParam)
#endif
+#ifdef LOAD_DEBUG_MESSAGE_CONTROL
+ DECLARE_GL_FUNCTION( glDebugMessageControl, PFNGLDEBUGMESSAGECONTROLPROC, GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled);
+#endif
+
#ifdef LOAD_GL_GET_QUERY_OBJECT_UI64V
DECLARE_GL_FUNCTION( glGetQueryObjectui64v, PFNGLGETQUERYOBJECTUI64VPROC, GLuint id, GLenum pname, GLuint64* params)
#endif
@@ -376,6 +380,10 @@ Func = (FuncType)eglGetProcAddress( #Func );\
LOAD_GL_FUNCTION(glDebugMessageCallback, PFNGLDEBUGMESSAGECALLBACKPROC)
#endif
+#ifdef LOAD_DEBUG_MESSAGE_CONTROL
+ LOAD_GL_FUNCTION(glDebugMessageControl, PFNGLDEBUGMESSAGECONTROLPROC);
+#endif
+
#ifdef LOAD_GL_GET_QUERY_OBJECT_UI64V
// Do not use stub
glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC)eglGetProcAddress( "glGetQueryObjectui64vEXT" );
diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
index cad867a9..1d006454 100644
--- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
@@ -174,14 +174,17 @@ RenderDeviceGLImpl::RenderDeviceGLImpl(IReferenceCounters* pRefCounters,
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
glDebugMessageCallback(openglCallbackFunction, &m_ShowDebugGLOutput);
GLuint unusedIds = 0;
- glDebugMessageControl(
- GL_DONT_CARE, // Source of debug messages to enable or disable
- GL_DONT_CARE, // Type of debug messages to enable or disable
- GL_DONT_CARE, // Severity of debug messages to enable or disable
- 0, // The length of the array ids
- &unusedIds, // Array of unsigned integers contianing the ids of the messages to enable or disable
- GL_TRUE // Flag determining whether the selected messages should be enabled or disabled
- );
+ if (glDebugMessageControl != nullptr)
+ {
+ glDebugMessageControl(
+ GL_DONT_CARE, // Source of debug messages to enable or disable
+ GL_DONT_CARE, // Type of debug messages to enable or disable
+ GL_DONT_CARE, // Severity of debug messages to enable or disable
+ 0, // The length of the array ids
+ &unusedIds, // Array of unsigned integers contianing the ids of the messages to enable or disable
+ GL_TRUE // Flag determining whether the selected messages should be enabled or disabled
+ );
+ }
if (glGetError() != GL_NO_ERROR)
LOG_ERROR_MESSAGE("Failed to enable debug messages");
}
@@ -1086,19 +1089,13 @@ void RenderDeviceGLImpl::TestTextureFormat(TEXTURE_FORMAT TexFormat)
#if GL_ARB_shader_image_load_store
{
- GLint CurrentImg = 0;
+ GLuint CurrentImg = 0;
GLint CurrentLevel = 0;
GLboolean CurrentLayered = 0;
GLint CurrentLayer = 0;
- GLint CurrenAccess = 0;
- GLint CurrenFormat = 0;
- glGetIntegeri_v(GL_IMAGE_BINDING_NAME, 0, &CurrentImg);
- glGetIntegeri_v(GL_IMAGE_BINDING_LEVEL, 0, &CurrentLevel);
- glGetBooleani_v(GL_IMAGE_BINDING_LAYERED, 0, &CurrentLayered);
- glGetIntegeri_v(GL_IMAGE_BINDING_LAYER, 0, &CurrentLayer);
- glGetIntegeri_v(GL_IMAGE_BINDING_ACCESS, 0, &CurrenAccess);
- glGetIntegeri_v(GL_IMAGE_BINDING_FORMAT, 0, &CurrenFormat);
- CHECK_GL_ERROR("Failed to get current image properties");
+ GLenum CurrenAccess = 0;
+ GLenum CurrenFormat = 0;
+ ContextState.GetBoundImage(0, CurrentImg, CurrentLevel, CurrentLayered, CurrentLayer, CurrenAccess, CurrenFormat);
glBindImageTexture(0, TestGLTex2D, 0, GL_FALSE, 0, GL_READ_WRITE, GLFmt);
if (glGetError() == GL_NO_ERROR)