소스 검색

Fixed Linux build.

Branimir Karadzic 13 년 전
부모
커밋
4614bc1106
3개의 변경된 파일14개의 추가작업 그리고 11개의 파일을 삭제
  1. 10 10
      examples/03-raymarch/raymarch.cpp
  2. 3 0
      premake/premake4.lua
  3. 1 1
      src/renderer_gl.cpp

+ 10 - 10
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);
 	}
 }

+ 3 - 0
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",
 	}

+ 1 - 1
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)