Fixed Linux build.

This commit is contained in:
Branimir Karadzic 2012-11-11 13:12:16 -08:00
parent 0b60a52286
commit 4614bc1106
3 changed files with 14 additions and 11 deletions

View file

@ -97,13 +97,13 @@ static bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName)
return program; return program;
} }
bool allocTransientBuffers(const bgfx::TransientVertexBuffer*& _vb, const bgfx::VertexDecl& _decl, uint16_t _numVertices, bgfx::TransientIndexBuffer* _ib, uint16_t _numIndices) bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexDecl& _decl, uint16_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint16_t _numIndices)
{ {
if (bgfx::checkAvailTransientVertexBuffer(_numVertices, _decl) if (bgfx::checkAvailTransientVertexBuffer(_numVertices, _decl)
&& bgfx::checkAvailTransientIndexBuffer(_numIndices) ) && bgfx::checkAvailTransientIndexBuffer(_numIndices) )
{ {
_vb = bgfx::allocTransientVertexBuffer(_numVertices, _decl); bgfx::allocTransientVertexBuffer(_tvb, _numVertices, _decl);
bgfx::allocTransientIndexBuffer(&_ib, _numIndices); bgfx::allocTransientIndexBuffer(_tib, _numIndices);
return true; return true;
} }
@ -112,12 +112,12 @@ bool allocTransientBuffers(const bgfx::TransientVertexBuffer*& _vb, const bgfx::
void renderScreenSpaceQuad(uint32_t _view, bgfx::ProgramHandle _program, float _x, float _y, float _width, float _height) void renderScreenSpaceQuad(uint32_t _view, bgfx::ProgramHandle _program, float _x, float _y, float _width, float _height)
{ {
const bgfx::TransientVertexBuffer* vb; bgfx::TransientVertexBuffer tvb;
const bgfx::TransientIndexBuffer ib; bgfx::TransientIndexBuffer tib;
if (allocTransientBuffers(vb, s_PosColorTexCoord0Decl, 4, &ib, 6) ) if (allocTransientBuffers(&tvb, s_PosColorTexCoord0Decl, 4, &tib, 6) )
{ {
PosColorTexCoord0Vertex* vertex = (PosColorTexCoord0Vertex*)vb->data; PosColorTexCoord0Vertex* vertex = (PosColorTexCoord0Vertex*)tvb.data;
float zz = 0.0f; float zz = 0.0f;
@ -159,7 +159,7 @@ void renderScreenSpaceQuad(uint32_t _view, bgfx::ProgramHandle _program, float _
vertex[3].m_u = minu; vertex[3].m_u = minu;
vertex[3].m_v = maxv; vertex[3].m_v = maxv;
uint16_t* indices = (uint16_t*)ib->data; uint16_t* indices = (uint16_t*)tib.data;
indices[0] = 0; indices[0] = 0;
indices[1] = 1; indices[1] = 1;
@ -170,8 +170,8 @@ void renderScreenSpaceQuad(uint32_t _view, bgfx::ProgramHandle _program, float _
bgfx::setProgram(_program); bgfx::setProgram(_program);
bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_DEPTH_TEST_LESS|BGFX_STATE_DEPTH_WRITE); bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_DEPTH_TEST_LESS|BGFX_STATE_DEPTH_WRITE);
bgfx::setIndexBuffer(ib); bgfx::setIndexBuffer(&tib);
bgfx::setVertexBuffer(vb); bgfx::setVertexBuffer(&tvb);
bgfx::submit(_view); bgfx::submit(_view);
} }
} }

View file

@ -184,6 +184,9 @@ configuration { "linux" }
"-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic. "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
"-msse2", "-msse2",
} }
links {
"rt",
}
linkoptions { linkoptions {
"-Wl,--gc-sections", "-Wl,--gc-sections",
} }

View file

@ -1947,10 +1947,10 @@ namespace bgfx
GL_GET(GL_MAX_TEXTURE_SIZE, 64); GL_GET(GL_MAX_TEXTURE_SIZE, 64);
GL_GET(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, 0); GL_GET(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, 0);
GL_GET(GL_MAX_RENDERBUFFER_SIZE, 1); GL_GET(GL_MAX_RENDERBUFFER_SIZE, 1);
#endif // BGFX_CONFIG_DEBUG
const char* version = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION); const char* version = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
BX_TRACE("GLSL version: %s", version); BX_TRACE("GLSL version: %s", version);
#endif // BGFX_CONFIG_DEBUG
const char* extensions = (const char*)glGetString(GL_EXTENSIONS); const char* extensions = (const char*)glGetString(GL_EXTENSIONS);
if (NULL != extensions) if (NULL != extensions)