mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
GL: Draw indirect WIP.
This commit is contained in:
parent
3a0f46fe3f
commit
2194728394
3 changed files with 31 additions and 0 deletions
|
@ -95,10 +95,12 @@ typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint
|
|||
typedef void (GL_APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
|
||||
typedef void (GL_APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERPROC) (GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
|
||||
typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
|
||||
typedef void (GL_APIENTRYP PFNGLENABLEIPROC) (GLenum cap, GLuint index);
|
||||
|
@ -264,10 +266,12 @@ GL_IMPORT______(false, PFNGLDISABLEVERTEXATTRIBARRAYPROC, glDisableVert
|
|||
GL_IMPORT______(true, PFNGLDISPATCHCOMPUTEPROC, glDispatchCompute);
|
||||
GL_IMPORT______(true, PFNGLDISPATCHCOMPUTEINDIRECTPROC, glDispatchComputeIndirect);
|
||||
GL_IMPORT______(false, PFNGLDRAWARRAYSPROC, glDrawArrays);
|
||||
GL_IMPORT______(true, PFNGLDRAWARRAYSINDIRECTPROC, glDrawArraysInderect);
|
||||
GL_IMPORT______(true, PFNGLDRAWARRAYSINSTANCEDPROC, glDrawArraysInstanced);
|
||||
GL_IMPORT______(true, PFNGLDRAWBUFFERPROC, glDrawBuffer);
|
||||
GL_IMPORT______(true, PFNGLDRAWBUFFERSPROC, glDrawBuffers);
|
||||
GL_IMPORT______(false, PFNGLDRAWELEMENTSPROC, glDrawElements);
|
||||
GL_IMPORT______(true, PFNGLDRAWELEMENTSINDIRECTPROC, glDrawElementsIndirect);
|
||||
GL_IMPORT______(true, PFNGLDRAWELEMENTSINSTANCEDPROC, glDrawElementsInstanced);
|
||||
GL_IMPORT______(false, PFNGLENABLEPROC, glEnable);
|
||||
GL_IMPORT______(true, PFNGLENABLEIPROC, glEnablei);
|
||||
|
@ -439,6 +443,9 @@ GL_IMPORT_EXT__(true, PFNGLPUSHGROUPMARKEREXTPROC, glPushGroupMa
|
|||
GL_IMPORT_EXT__(true, PFNGLPOPGROUPMARKEREXTPROC, glPopGroupMarker);
|
||||
GL_IMPORT_EXT__(true, PFNGLOBJECTLABELPROC, glObjectLabel);
|
||||
|
||||
GL_IMPORT_EXT__(true, PFNGLDRAWARRAYSINDIRECTPROC, glDrawArraysInderect);
|
||||
GL_IMPORT_EXT__(true, PFNGLDRAWELEMENTSINDIRECTPROC, glDrawElementsIndirect);
|
||||
|
||||
GL_IMPORT_OES__(true, PFNGLGETPROGRAMBINARYPROC, glGetProgramBinary);
|
||||
GL_IMPORT_OES__(true, PFNGLPROGRAMBINARYPROC, glProgramBinary);
|
||||
|
||||
|
|
|
@ -352,6 +352,7 @@ namespace bgfx { namespace gl
|
|||
enum Enum
|
||||
{
|
||||
AMD_conservative_depth,
|
||||
AMD_multi_draw_indirect,
|
||||
|
||||
ANGLE_depth_texture,
|
||||
ANGLE_framebuffer_blit,
|
||||
|
@ -373,6 +374,7 @@ namespace bgfx { namespace gl
|
|||
ARB_depth_buffer_float,
|
||||
ARB_depth_clamp,
|
||||
ARB_draw_buffers_blend,
|
||||
ARB_draw_indirect,
|
||||
ARB_draw_instanced,
|
||||
ARB_ES3_compatibility,
|
||||
ARB_framebuffer_object,
|
||||
|
@ -383,6 +385,7 @@ namespace bgfx { namespace gl
|
|||
ARB_instanced_arrays,
|
||||
ARB_invalidate_subdata,
|
||||
ARB_map_buffer_range,
|
||||
ARB_multi_draw_indirect,
|
||||
ARB_multisample,
|
||||
ARB_occlusion_query,
|
||||
ARB_occlusion_query2,
|
||||
|
@ -432,6 +435,7 @@ namespace bgfx { namespace gl
|
|||
EXT_framebuffer_blit,
|
||||
EXT_framebuffer_object,
|
||||
EXT_framebuffer_sRGB,
|
||||
EXT_multi_draw_indirect,
|
||||
EXT_occlusion_query_boolean,
|
||||
EXT_packed_float,
|
||||
EXT_read_format_bgra,
|
||||
|
@ -540,6 +544,7 @@ namespace bgfx { namespace gl
|
|||
static Extension s_extension[] =
|
||||
{
|
||||
{ "AMD_conservative_depth", false, true },
|
||||
{ "AMD_multi_draw_indirect", false, true },
|
||||
|
||||
{ "ANGLE_depth_texture", false, true },
|
||||
{ "ANGLE_framebuffer_blit", false, true },
|
||||
|
@ -561,6 +566,7 @@ namespace bgfx { namespace gl
|
|||
{ "ARB_depth_buffer_float", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
|
||||
{ "ARB_depth_clamp", BGFX_CONFIG_RENDERER_OPENGL >= 32, true },
|
||||
{ "ARB_draw_buffers_blend", BGFX_CONFIG_RENDERER_OPENGL >= 40, true },
|
||||
{ "ARB_draw_indirect", BGFX_CONFIG_RENDERER_OPENGL >= 40, true },
|
||||
{ "ARB_draw_instanced", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
|
||||
{ "ARB_ES3_compatibility", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
|
||||
{ "ARB_framebuffer_object", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
|
||||
|
@ -571,6 +577,7 @@ namespace bgfx { namespace gl
|
|||
{ "ARB_instanced_arrays", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
|
||||
{ "ARB_invalidate_subdata", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
|
||||
{ "ARB_map_buffer_range", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
|
||||
{ "ARB_multi_draw_indirect", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
|
||||
{ "ARB_multisample", false, true },
|
||||
{ "ARB_occlusion_query", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
|
||||
{ "ARB_occlusion_query2", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
|
||||
|
@ -620,6 +627,7 @@ namespace bgfx { namespace gl
|
|||
{ "EXT_framebuffer_blit", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
|
||||
{ "EXT_framebuffer_object", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
|
||||
{ "EXT_framebuffer_sRGB", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
|
||||
{ "EXT_multi_draw_indirect", false, true }, // GLES3.1 extension.
|
||||
{ "EXT_occlusion_query_boolean", false, true },
|
||||
{ "EXT_packed_float", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
|
||||
{ "EXT_read_format_bgra", false, true },
|
||||
|
@ -1386,6 +1394,18 @@ namespace bgfx { namespace gl
|
|||
: 0
|
||||
;
|
||||
|
||||
const bool drawIndirectSupported = false
|
||||
|| s_extension[Extension::AMD_multi_draw_indirect].m_supported
|
||||
|| s_extension[Extension::ARB_draw_indirect ].m_supported
|
||||
|| s_extension[Extension::ARB_multi_draw_indirect].m_supported
|
||||
|| s_extension[Extension::EXT_multi_draw_indirect].m_supported
|
||||
;
|
||||
|
||||
g_caps.supported |= drawIndirectSupported
|
||||
? 0 //BGFX_CAPS_DRAW_INDIRECT
|
||||
: 0
|
||||
;
|
||||
|
||||
g_caps.maxTextureSize = uint16_t(glGet(GL_MAX_TEXTURE_SIZE) );
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
|
||||
|
|
|
@ -621,6 +621,10 @@ typedef uint64_t GLuint64;
|
|||
# define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
|
||||
#endif // GL_TEXTURE_CUBE_MAP_SEAMLESS
|
||||
|
||||
#ifndef GL_DRAW_INDIRECT_BUFFER
|
||||
# define GL_DRAW_INDIRECT_BUFFER 0x8F3F
|
||||
#endif // GL_DRAW_INDIRECT_BUFFER
|
||||
|
||||
#if BX_PLATFORM_NACL
|
||||
# include "glcontext_ppapi.h"
|
||||
#elif BX_PLATFORM_WINDOWS
|
||||
|
|
Loading…
Reference in a new issue