From e24c3f42b3ebbb02881efa68521325f099c50850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 12 Mar 2014 22:32:27 -0700 Subject: [PATCH] Cleanup. --- examples/17-drawstress/drawstress.cpp | 9 +++++---- src/glimports.h | 13 +++++++++++++ src/renderer_gl.cpp | 5 ++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/examples/17-drawstress/drawstress.cpp b/examples/17-drawstress/drawstress.cpp index ca3e23f0..429c4445 100644 --- a/examples/17-drawstress/drawstress.cpp +++ b/examples/17-drawstress/drawstress.cpp @@ -149,12 +149,13 @@ int _main_(int /*_argc*/, char** /*_argv*/) { int64_t now = bx::getHPCounter(); static int64_t last = now; + const int64_t hpFreq = bx::getHPFrequency(); const int64_t frameTime = now - last; last = now; - const double freq = double(bx::getHPFrequency() ); + const double freq = double(hpFreq); const double toMs = 1000.0/freq; - deltaTimeNs += frameTime*1000000/bx::getHPFrequency(); + deltaTimeNs += frameTime*1000000/hpFreq; if (deltaTimeNs > 1000000) { @@ -172,8 +173,8 @@ int _main_(int /*_argc*/, char** /*_argv*/) } } - deltaTimeNs = deltaTimeAvgNs; - numFrames = 1; + deltaTimeNs = 0; + numFrames = 0; } else { diff --git a/src/glimports.h b/src/glimports.h index 50665678..27afab36 100644 --- a/src/glimports.h +++ b/src/glimports.h @@ -45,9 +45,13 @@ typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuin typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array); typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); @@ -195,9 +199,13 @@ GL_IMPORT______(false, PFNGLBINDTEXTUREPROC, glBindTexture GL_IMPORT______(true, PFNGLBINDVERTEXARRAYPROC, glBindVertexArray); GL_IMPORT______(true, PFNGLBLENDCOLORPROC, glBlendColor); GL_IMPORT______(false, PFNGLBLENDEQUATIONPROC, glBlendEquation); +GL_IMPORT______(true, PFNGLBLENDEQUATIONIPROC, glBlendEquationi); GL_IMPORT______(true, PFNGLBLENDEQUATIONSEPARATEPROC, glBlendEquationSeparate); +GL_IMPORT______(true, PFNGLBLENDEQUATIONSEPARATEIPROC, glBlendEquationSeparatei); GL_IMPORT______(false, PFNGLBLENDFUNCPROC, glBlendFunc); +GL_IMPORT______(true, PFNGLBLENDFUNCIPROC, glBlendFunci); GL_IMPORT______(true, PFNGLBLENDFUNCSEPARATEPROC, glBlendFuncSeparate); +GL_IMPORT______(true, PFNGLBLENDFUNCSEPARATEIPROC, glBlendFuncSeparatei); GL_IMPORT______(true, PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer); GL_IMPORT______(false, PFNGLBUFFERDATAPROC, glBufferData); GL_IMPORT______(false, PFNGLBUFFERSUBDATAPROC, glBufferSubData); @@ -336,6 +344,11 @@ GL_IMPORT_ARB__(true, PFNGLOBJECTPTRLABELPROC, glObjectPtrLa GL_IMPORT_ARB__(true, PFNGLGETOBJECTPTRLABELPROC, glGetObjectPtrLabel); GL_IMPORT_ARB__(true, PFNGLGETPOINTERVPROC, glGetPointerv); +GL_IMPORT_ARB__(true, PFNGLBLENDEQUATIONIPROC, glBlendEquationi); +GL_IMPORT_ARB__(true, PFNGLBLENDEQUATIONSEPARATEIPROC, glBlendEquationSeparatei); +GL_IMPORT_ARB__(true, PFNGLBLENDFUNCIPROC, glBlendFunci); +GL_IMPORT_ARB__(true, PFNGLBLENDFUNCSEPARATEIPROC, glBlendFuncSeparatei); + GL_IMPORT_ARB__(true, PFNGLVERTEXATTRIBDIVISORPROC, glVertexAttribDivisor); GL_IMPORT_ARB__(true, PFNGLDRAWARRAYSINSTANCEDPROC, glDrawArraysInstanced); GL_IMPORT_ARB__(true, PFNGLDRAWELEMENTSINSTANCEDPROC, glDrawElementsInstanced); diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index e40076df..958d8792 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -216,6 +216,7 @@ namespace bgfx ARB_debug_label, ARB_debug_output, ARB_depth_clamp, + ARB_draw_buffers_blend, ARB_ES3_compatibility, ARB_framebuffer_object, ARB_framebuffer_sRGB, @@ -335,6 +336,7 @@ namespace bgfx { "GL_ARB_debug_label", false, true }, { "GL_ARB_debug_output", BGFX_CONFIG_RENDERER_OPENGL >= 43, true }, { "GL_ARB_depth_clamp", BGFX_CONFIG_RENDERER_OPENGL >= 32, true }, + { "GL_ARB_draw_buffers_blend", BGFX_CONFIG_RENDERER_OPENGL >= 40, true }, { "GL_ARB_ES3_compatibility", BGFX_CONFIG_RENDERER_OPENGL >= 43, true }, { "GL_ARB_framebuffer_object", BGFX_CONFIG_RENDERER_OPENGL >= 30, true }, { "GL_ARB_framebuffer_sRGB", BGFX_CONFIG_RENDERER_OPENGL >= 30, true }, @@ -512,7 +514,7 @@ namespace bgfx // // If is 0 then is assumed to be null-terminated. - uint32_t size = (0 == _length ? strlen(_marker) : _length) + 1; + uint32_t size = (0 == _length ? (uint32_t)strlen(_marker) : _length) + 1; size *= sizeof(wchar_t); wchar_t* name = (wchar_t*)alloca(size); mbstowcs(name, _marker, size-2); @@ -1859,6 +1861,7 @@ namespace bgfx else { BX_UNUSED(_zoffset, _depth); + BX_TRACE("x %d, y %d, w %d, h %d", _xoffset, _yoffset, _width, _height); GL_CHECK(glTexSubImage2D(_target, _level, _xoffset, _yoffset, _width, _height, _format, _type, _data) ); } }