Merge branch 'master' of github.com:bkaradzic/bgfx
This commit is contained in:
commit
1279f4c95c
@ -385,6 +385,7 @@ int _main_(int _argc, char** _argv)
|
||||
bgfx::destroyUniform(u_shadowMap);
|
||||
bgfx::destroyUniform(u_lightPos);
|
||||
bgfx::destroyUniform(u_lightMtx);
|
||||
bgfx::destroyUniform(u_depthScaleOffset);
|
||||
|
||||
// Shutdown bgfx.
|
||||
bgfx::shutdown();
|
||||
|
@ -1077,6 +1077,8 @@ namespace bgfx
|
||||
|
||||
/// Returns performance counters.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_get_stats`.
|
||||
///
|
||||
const Stats* getStats();
|
||||
|
||||
/// Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx.
|
||||
|
@ -162,6 +162,7 @@ typedef void (GL_APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, G
|
||||
typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label);
|
||||
typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
|
||||
typedef void (GL_APIENTRYP PFNGLPOINTSIZEPROC) (GLfloat size);
|
||||
typedef void (GL_APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
|
||||
@ -404,7 +405,8 @@ GL_IMPORT______(false, PFNGLVIEWPORTPROC, glViewport);
|
||||
|
||||
# if BGFX_CONFIG_RENDERER_OPENGL
|
||||
GL_IMPORT______(false, PFNGLCLEARDEPTHPROC, glClearDepth);
|
||||
GL_IMPORT______(false, PFNGLPOINTSIZEPROC, glPointSize);
|
||||
GL_IMPORT______(true, PFNGLPOINTSIZEPROC, glPointSize);
|
||||
GL_IMPORT______(true, PFNGLPOLYGONMODEPROC, glPolygonMode);
|
||||
|
||||
GL_IMPORT_ARB__(true, PFNGLDEBUGMESSAGECONTROLPROC, glDebugMessageControl);
|
||||
GL_IMPORT_ARB__(true, PFNGLDEBUGMESSAGEINSERTPROC, glDebugMessageInsert);
|
||||
@ -467,6 +469,8 @@ GL_IMPORT______(true, PFNGLFRAMETERMINATORGREMEDYPROC, glFrameTermin
|
||||
GL_IMPORT______(true, PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC, glGetTranslatedShaderSourceANGLE);
|
||||
|
||||
#if !BGFX_CONFIG_RENDERER_OPENGL
|
||||
GL_IMPORT______(true, PFNGLPOINTSIZEPROC, glPointSize);
|
||||
GL_IMPORT______(true, PFNGLPOLYGONMODEPROC, glPolygonMode);
|
||||
GL_IMPORT_ANGLE(true, PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer);
|
||||
GL_IMPORT_ANGLE(true, PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample);
|
||||
|
||||
|
@ -1015,6 +1015,10 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
}
|
||||
|
||||
static void GL_APIENTRY stubPolygonMode(GLenum /*_face*/, GLenum /*_mode*/)
|
||||
{
|
||||
}
|
||||
|
||||
typedef void (*PostSwapBuffersFn)(uint32_t _width, uint32_t _height);
|
||||
|
||||
static const char* getGLString(GLenum _name)
|
||||
@ -1928,6 +1932,11 @@ namespace bgfx { namespace gl
|
||||
: 0
|
||||
;
|
||||
|
||||
if (NULL == glPolygonMode)
|
||||
{
|
||||
glPolygonMode = stubPolygonMode;
|
||||
}
|
||||
|
||||
if (s_extension[Extension::ARB_copy_image].m_supported
|
||||
|| s_extension[Extension::EXT_copy_image].m_supported
|
||||
|| s_extension[Extension:: NV_copy_image].m_supported
|
||||
@ -6139,11 +6148,17 @@ namespace bgfx { namespace gl
|
||||
|
||||
uint8_t primIndex;
|
||||
{
|
||||
const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : 0;
|
||||
const uint64_t pt = 0;
|
||||
primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT);
|
||||
}
|
||||
PrimInfo prim = s_primInfo[primIndex];
|
||||
|
||||
GL_CHECK(glPolygonMode(GL_FRONT_AND_BACK
|
||||
, _render->m_debug&BGFX_DEBUG_WIREFRAME
|
||||
? GL_LINE
|
||||
: GL_FILL
|
||||
) );
|
||||
|
||||
uint32_t baseVertex = 0;
|
||||
GLuint currentVao = 0;
|
||||
bool wasCompute = false;
|
||||
@ -6643,38 +6658,39 @@ namespace bgfx { namespace gl
|
||||
viewState.m_alphaRef = ref/255.0f;
|
||||
}
|
||||
|
||||
#if BGFX_CONFIG_RENDERER_OPENGL
|
||||
if ( (BGFX_STATE_PT_POINTS|BGFX_STATE_POINT_SIZE_MASK) & changedFlags)
|
||||
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
|
||||
{
|
||||
float pointSize = (float)(bx::uint32_max(1, (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT) );
|
||||
GL_CHECK(glPointSize(pointSize) );
|
||||
}
|
||||
if ( (BGFX_STATE_PT_POINTS|BGFX_STATE_POINT_SIZE_MASK) & changedFlags)
|
||||
{
|
||||
float pointSize = (float)(bx::uint32_max(1, (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT) );
|
||||
GL_CHECK(glPointSize(pointSize) );
|
||||
}
|
||||
|
||||
if (BGFX_STATE_MSAA & changedFlags)
|
||||
{
|
||||
GL_CHECK(BGFX_STATE_MSAA & newFlags
|
||||
? glEnable(GL_MULTISAMPLE)
|
||||
: glDisable(GL_MULTISAMPLE)
|
||||
);
|
||||
}
|
||||
if (BGFX_STATE_MSAA & changedFlags)
|
||||
{
|
||||
GL_CHECK(BGFX_STATE_MSAA & newFlags
|
||||
? glEnable(GL_MULTISAMPLE)
|
||||
: glDisable(GL_MULTISAMPLE)
|
||||
);
|
||||
}
|
||||
|
||||
if (BGFX_STATE_LINEAA & changedFlags)
|
||||
{
|
||||
GL_CHECK(BGFX_STATE_LINEAA & newFlags
|
||||
? glEnable(GL_LINE_SMOOTH)
|
||||
: glDisable(GL_LINE_SMOOTH)
|
||||
);
|
||||
}
|
||||
if (BGFX_STATE_LINEAA & changedFlags)
|
||||
{
|
||||
GL_CHECK(BGFX_STATE_LINEAA & newFlags
|
||||
? glEnable(GL_LINE_SMOOTH)
|
||||
: glDisable(GL_LINE_SMOOTH)
|
||||
);
|
||||
}
|
||||
|
||||
if (m_conservativeRasterSupport
|
||||
&& BGFX_STATE_CONSERVATIVE_RASTER & changedFlags)
|
||||
{
|
||||
GL_CHECK(BGFX_STATE_CONSERVATIVE_RASTER & newFlags
|
||||
? glEnable(GL_CONSERVATIVE_RASTERIZATION_NV)
|
||||
: glDisable(GL_CONSERVATIVE_RASTERIZATION_NV)
|
||||
);
|
||||
if (m_conservativeRasterSupport
|
||||
&& BGFX_STATE_CONSERVATIVE_RASTER & changedFlags)
|
||||
{
|
||||
GL_CHECK(BGFX_STATE_CONSERVATIVE_RASTER & newFlags
|
||||
? glEnable(GL_CONSERVATIVE_RASTERIZATION_NV)
|
||||
: glDisable(GL_CONSERVATIVE_RASTERIZATION_NV)
|
||||
);
|
||||
}
|
||||
}
|
||||
#endif // BGFX_CONFIG_RENDERER_OPENGL
|
||||
|
||||
if ( (BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE) & changedFlags)
|
||||
{
|
||||
@ -6804,7 +6820,7 @@ namespace bgfx { namespace gl
|
||||
blendFactor = draw.m_rgba;
|
||||
}
|
||||
|
||||
const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : newFlags&BGFX_STATE_PT_MASK;
|
||||
const uint64_t pt = newFlags&BGFX_STATE_PT_MASK;
|
||||
primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT);
|
||||
prim = s_primInfo[primIndex];
|
||||
}
|
||||
|
@ -915,6 +915,22 @@ typedef uint64_t GLuint64;
|
||||
# define GL_DEBUG_SEVERITY_NOTIFICATION 0x826b
|
||||
#endif // GL_DEBUG_SEVERITY_NOTIFICATION
|
||||
|
||||
#ifndef GL_LINE
|
||||
# define GL_LINE 0x1B01
|
||||
#endif // GL_LINE
|
||||
|
||||
#ifndef GL_FILL
|
||||
# define GL_FILL 0x1B02
|
||||
#endif // GL_FILL
|
||||
|
||||
#ifndef GL_MULTISAMPLE
|
||||
# define GL_MULTISAMPLE 0x809D
|
||||
#endif // GL_MULTISAMPLE
|
||||
|
||||
#ifndef GL_LINE_SMOOTH
|
||||
# define GL_LINE_SMOOTH 0x0B20
|
||||
#endif // GL_LINE_SMOOTH
|
||||
|
||||
#if BX_PLATFORM_NACL
|
||||
# include "glcontext_ppapi.h"
|
||||
#elif BX_PLATFORM_WINDOWS
|
||||
|
Loading…
Reference in New Issue
Block a user