This commit is contained in:
Branimir Karadžić 2014-03-12 22:32:27 -07:00
parent cec1b79390
commit e24c3f42b3
3 changed files with 22 additions and 5 deletions

View file

@ -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
{

View file

@ -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);

View file

@ -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 <length> is 0 then <marker> 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) );
}
}