From 4614bc1106c51c3172a31675f6cd058ab8b497fc Mon Sep 17 00:00:00 2001 From: Branimir Karadzic Date: Sun, 11 Nov 2012 13:12:16 -0800 Subject: [PATCH] Fixed Linux build. --- examples/03-raymarch/raymarch.cpp | 20 ++++++++++---------- premake/premake4.lua | 3 +++ src/renderer_gl.cpp | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/examples/03-raymarch/raymarch.cpp b/examples/03-raymarch/raymarch.cpp index a660c651..97fc31b3 100644 --- a/examples/03-raymarch/raymarch.cpp +++ b/examples/03-raymarch/raymarch.cpp @@ -97,13 +97,13 @@ static bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName) 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) && bgfx::checkAvailTransientIndexBuffer(_numIndices) ) { - _vb = bgfx::allocTransientVertexBuffer(_numVertices, _decl); - bgfx::allocTransientIndexBuffer(&_ib, _numIndices); + bgfx::allocTransientVertexBuffer(_tvb, _numVertices, _decl); + bgfx::allocTransientIndexBuffer(_tib, _numIndices); 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) { - const bgfx::TransientVertexBuffer* vb; - const bgfx::TransientIndexBuffer ib; + bgfx::TransientVertexBuffer tvb; + 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; @@ -159,7 +159,7 @@ void renderScreenSpaceQuad(uint32_t _view, bgfx::ProgramHandle _program, float _ vertex[3].m_u = minu; vertex[3].m_v = maxv; - uint16_t* indices = (uint16_t*)ib->data; + uint16_t* indices = (uint16_t*)tib.data; indices[0] = 0; indices[1] = 1; @@ -170,8 +170,8 @@ void renderScreenSpaceQuad(uint32_t _view, bgfx::ProgramHandle _program, float _ bgfx::setProgram(_program); bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_DEPTH_TEST_LESS|BGFX_STATE_DEPTH_WRITE); - bgfx::setIndexBuffer(ib); - bgfx::setVertexBuffer(vb); + bgfx::setIndexBuffer(&tib); + bgfx::setVertexBuffer(&tvb); bgfx::submit(_view); } } diff --git a/premake/premake4.lua b/premake/premake4.lua index 23296f00..da87919d 100644 --- a/premake/premake4.lua +++ b/premake/premake4.lua @@ -184,6 +184,9 @@ configuration { "linux" } "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic. "-msse2", } + links { + "rt", + } linkoptions { "-Wl,--gc-sections", } diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 3ea99e05..47397cb4 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -1947,10 +1947,10 @@ namespace bgfx GL_GET(GL_MAX_TEXTURE_SIZE, 64); GL_GET(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, 0); GL_GET(GL_MAX_RENDERBUFFER_SIZE, 1); -#endif // BGFX_CONFIG_DEBUG const char* version = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION); BX_TRACE("GLSL version: %s", version); +#endif // BGFX_CONFIG_DEBUG const char* extensions = (const char*)glGetString(GL_EXTENSIONS); if (NULL != extensions)