Merge branch 'master' of github.com:bkaradzic/bgfx

This commit is contained in:
Branimir Karadžić 2016-02-25 20:29:20 -08:00
commit ae778b06df
3 changed files with 17 additions and 4 deletions

View File

@ -169,9 +169,14 @@ class Terrain : public entry::AppI
bgfx::destroyProgram(m_terrainProgram);
bgfx::destroyProgram(m_terrainHeightTextureProgram);
BX_FREE(entry::getAllocator(), m_terrain.m_vertices);
BX_FREE(entry::getAllocator(), m_terrain.m_indices);
BX_FREE(entry::getAllocator(), m_terrain.m_heightMap);
/// When data is passed to bgfx via makeRef we need to make
/// sure library is done with it before freeing memory blocks.
bgfx::frame();
bx::AllocatorI* allocator = entry::getAllocator();
BX_FREE(allocator, m_terrain.m_vertices);
BX_FREE(allocator, m_terrain.m_indices);
BX_FREE(allocator, m_terrain.m_heightMap);
// Shutdown bgfx.
bgfx::shutdown();

View File

@ -121,11 +121,13 @@ namespace bgfx { namespace gl
static void GL_APIENTRY naclGetQueryObjectiv(GLuint _id, GLenum _pname, GLint* _params)
{
BX_UNUSED(_id, _pname);
s_ppapi.m_query->GetQueryivEXT(s_ppapi.m_context, GL_ANY_SAMPLES_PASSED_EXT, GL_CURRENT_QUERY_EXT, _params);
}
static void GL_APIENTRY naclGetQueryObjectui64v(GLuint _id, GLenum _pname, GLuint64* _params)
{
BX_UNUSED(_id, _pname);
GLint params;
s_ppapi.m_query->GetQueryivEXT(s_ppapi.m_context, GL_ANY_SAMPLES_PASSED_EXT, GL_CURRENT_QUERY_EXT, &params);
*_params = params;
@ -192,7 +194,7 @@ namespace bgfx { namespace gl
BX_UNUSED(_width, _height);
BX_TRACE("GlContext::create");
g_internalData.context = m_context;
g_internalData.context = &s_ppapi.m_context;
}
void GlContext::destroy()

View File

@ -1572,6 +1572,12 @@ namespace bgfx
return true;
}
bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height)
{
const uint32_t srcBpp = s_imageBlockInfo[_srcFormat].bitsPerPixel;
return imageConvert(_dst, _dstFormat, _src, _srcFormat, _width, _height, _width*srcBpp);
}
uint8_t bitRangeConvert(uint32_t _in, uint32_t _from, uint32_t _to)
{
using namespace bx;