summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/src/renderer_gl.h
diff options
context:
space:
mode:
author Julian Sikorski <belegdol+github@gmail.com>2019-10-13 13:50:38 +0200
committer R. Belmont <rb6502@users.noreply.github.com>2019-10-13 07:50:38 -0400
commit0837e7451a84f95c29dbdb9bd6b8b931fee1635d (patch)
tree626bcbd250a7fbebdf5958a288d2f438d4f9fb5a /3rdparty/bgfx/src/renderer_gl.h
parentc913ccb59d713ce0b91135520719ac5385e54358 (diff)
WIP: sync bgfx, bx and bimg with latest upstream (#5723)
* Sync with bgfx upstream revision b91d0b6 * Sync with bx upstream revision d60912b * Sync with bimg upstream revision bd81f60 * Add astc-codec decoder * Rename VertexDecl to VertexLayout * Rename UniformType enum Int1 to Sampler. * Add NVN stub * Fix unused-const-variable error on macOS * Drop redundant explicit language parameters buildoptions_cpp are only applied to c++ files and buildoptions_objcpp are only applied to objective c++ files. As such, hardcoding -x offers no benefit while preventing overrides (such as one needed by 3rdparty/bgfx/src/renderer_vk.cpp on macOS) from working. * Re-introduce -x c++ in places where C code is compiled as C++ to prevent clang from throwing a warning * Build bgfx as Objective-C++ on macOS It is needed due to included headers * Enable Direct3D12 and Vulkan bgfx rendering backends * Enable building of spirv shaders * Properly escape /c in cmd call * Comment out dx12 bgfx renderer * Honor VERBOSE setting during shaders build * Only invert hlsl shader XYZ_TO_sRGB matrix for opengl * Add spirv shaders * OpenGL ES needs transposed matrix too * Metal needs transposed matrix as well
Diffstat (limited to '3rdparty/bgfx/src/renderer_gl.h')
-rw-r--r--3rdparty/bgfx/src/renderer_gl.h55
1 files changed, 47 insertions, 8 deletions
diff --git a/3rdparty/bgfx/src/renderer_gl.h b/3rdparty/bgfx/src/renderer_gl.h
index bccee98fe48..e8d653c93ce 100644
--- a/3rdparty/bgfx/src/renderer_gl.h
+++ b/3rdparty/bgfx/src/renderer_gl.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2018 Branimir Karadzic. All rights reserved.
+ * Copyright 2011-2019 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
@@ -9,7 +9,6 @@
#define BGFX_USE_EGL (BGFX_CONFIG_RENDERER_OPENGLES && (0 \
|| BX_PLATFORM_ANDROID \
|| BX_PLATFORM_BSD \
- || BX_PLATFORM_EMSCRIPTEN \
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_NX \
|| BX_PLATFORM_RPI \
@@ -17,6 +16,10 @@
|| BX_PLATFORM_WINDOWS \
) )
+#define BGFX_USE_HTML5 (BGFX_CONFIG_RENDERER_OPENGLES && (0 \
+ || BX_PLATFORM_EMSCRIPTEN \
+ ) )
+
#define BGFX_USE_WGL (BGFX_CONFIG_RENDERER_OPENGL && BX_PLATFORM_WINDOWS)
#define BGFX_USE_GLX (BGFX_CONFIG_RENDERER_OPENGL && (0 \
|| BX_PLATFORM_BSD \
@@ -30,6 +33,24 @@
|| BX_PLATFORM_WINDOWS \
)
+#define BGFX_GL_PROFILER_BEGIN(_view, _abgr) \
+ BX_MACRO_BLOCK_BEGIN \
+ GL_CHECK(glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, s_viewName[view]) ); \
+ BGFX_PROFILER_BEGIN(s_viewName[view], _abgr); \
+ BX_MACRO_BLOCK_END
+
+#define BGFX_GL_PROFILER_BEGIN_LITERAL(_name, _abgr) \
+ BX_MACRO_BLOCK_BEGIN \
+ GL_CHECK(glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, "" # _name) ); \
+ BGFX_PROFILER_BEGIN_LITERAL("" # _name, _abgr); \
+ BX_MACRO_BLOCK_END
+
+#define BGFX_GL_PROFILER_END() \
+ BX_MACRO_BLOCK_BEGIN \
+ BGFX_PROFILER_END(); \
+ GL_CHECK(glPopDebugGroup() ); \
+ BX_MACRO_BLOCK_END
+
#if BGFX_CONFIG_RENDERER_OPENGL
# if BGFX_CONFIG_RENDERER_OPENGL >= 31
# include <gl/glcorearb.h>
@@ -107,6 +128,10 @@ typedef uint64_t GLuint64;
# include "glcontext_egl.h"
# endif // BGFX_USE_EGL
+# if BGFX_USE_HTML5
+# include "glcontext_html5.h"
+# endif // BGFX_USE_EGL
+
# if BX_PLATFORM_EMSCRIPTEN
# include <emscripten/emscripten.h>
# endif // BX_PLATFORM_EMSCRIPTEN
@@ -587,6 +612,10 @@ typedef uint64_t GLuint64;
# define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
#endif // GL_MAX_ARRAY_TEXTURE_LAYERS
+#ifndef GL_MAX_LABEL_LENGTH
+# define GL_MAX_LABEL_LENGTH 0x82E8
+#endif // GL_MAX_LABEL_LENGTH
+
#ifndef GL_QUERY_RESULT
# define GL_QUERY_RESULT 0x8866
#endif // GL_QUERY_RESULT
@@ -631,7 +660,7 @@ typedef uint64_t GLuint64;
# define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
#endif // GL_RENDERBUFFER_FREE_MEMORY_ATI
-// http://developer.download.nvidia.com/opengl/specs/GL_NVX_gpu_memory_info.txt
+// https://web.archive.org/web/20190207230448/http://developer.download.nvidia.com/opengl/specs/GL_NVX_gpu_memory_info.txt
#ifndef GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX
# define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
#endif // GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX
@@ -916,6 +945,14 @@ typedef uint64_t GLuint64;
# define GL_TEXTURE 0x1702
#endif // GL_TEXTURE
+#ifndef GL_BUFFER
+# define GL_BUFFER 0x82E0
+#endif // GL_BUFFER
+
+#ifndef GL_COMMAND_BARRIER_BIT
+# define GL_COMMAND_BARRIER_BIT 0x00000040
+#endif // GL_COMMAND_BARRIER_BIT
+
// _KHR or _ARB...
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
@@ -1177,10 +1214,10 @@ namespace bgfx { namespace gl
struct VertexBufferGL
{
- void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint16_t _flags)
+ void create(uint32_t _size, void* _data, VertexLayoutHandle _layoutHandle, uint16_t _flags)
{
m_size = _size;
- m_decl = _declHandle;
+ m_layoutHandle = _layoutHandle;
const bool drawIndirect = 0 != (_flags & BGFX_BUFFER_DRAW_INDIRECT);
m_target = drawIndirect ? GL_DRAW_INDIRECT_BUFFER : GL_ARRAY_BUFFER;
@@ -1204,7 +1241,7 @@ namespace bgfx { namespace gl
{
// orphan buffer...
destroy();
- create(m_size, NULL, m_decl, 0);
+ create(m_size, NULL, m_layoutHandle, 0);
}
GL_CHECK(glBindBuffer(m_target, m_id) );
@@ -1221,7 +1258,7 @@ namespace bgfx { namespace gl
GLuint m_id;
GLenum m_target;
uint32_t m_size;
- VertexDeclHandle m_decl;
+ VertexLayoutHandle m_layoutHandle;
};
struct TextureGL
@@ -1265,6 +1302,7 @@ namespace bgfx { namespace gl
uint32_t m_width;
uint32_t m_height;
uint32_t m_depth;
+ uint32_t m_numLayers;
uint8_t m_numMips;
uint8_t m_requestedFormat;
uint8_t m_textureFormat;
@@ -1304,6 +1342,7 @@ namespace bgfx { namespace gl
uint16_t destroy();
void resolve();
void discard(uint16_t _flags);
+ void set();
SwapChainGL* m_swapChain;
GLuint m_fbo[2];
@@ -1336,7 +1375,7 @@ namespace bgfx { namespace gl
bx::memCopy(m_unboundUsedAttrib, m_used, sizeof(m_unboundUsedAttrib) );
}
- void bindAttributes(const VertexDecl& _vertexDecl, uint32_t _baseVertex = 0);
+ void bindAttributes(const VertexLayout& _layout, uint32_t _baseVertex = 0);
void bindAttributesEnd()
{