Просмотр исходного кода

Removed glFlush. Added D3D adapter debug output.

bkaradzic 13 лет назад
Родитель
Сommit
33730efaa0
3 измененных файлов с 38 добавлено и 15 удалено
  1. 18 0
      src/renderer_d3d9.cpp
  2. 14 9
      src/renderer_gl.cpp
  3. 6 6
      src/renderer_gl.h

+ 18 - 0
src/renderer_d3d9.cpp

@@ -153,6 +153,24 @@ namespace bgfx
 
 			BGFX_FATAL(m_d3d9, bgfx::Fatal::D3D9_UnableToCreateInterface, "Unable to create Direct3D.");
 
+			uint32_t adapterCount = m_d3d9->GetAdapterCount();
+			for (uint32_t ii = 0; ii < adapterCount; ++ii)
+			{
+				D3DADAPTER_IDENTIFIER9 identifier;
+				DX_CHECK(m_d3d9->GetAdapterIdentifier(ii, 0, &identifier) );
+
+				BX_TRACE("Adapter #%d", ii);
+				BX_TRACE("\tDriver: %s", identifier.Driver);
+				BX_TRACE("\tDescription: %s", identifier.Description);
+				BX_TRACE("\tDeviceName: %s", identifier.DeviceName);
+				BX_TRACE("\tVendorId: 0x%08x, DeviceId: 0x%08x, SubSysId: 0x%08x, Revision: 0x%08x"
+						, identifier.VendorId
+						, identifier.DeviceId
+						, identifier.SubSysId
+						, identifier.Revision
+						);
+			}
+
 			uint32_t behaviorFlags[] =
 			{
 				D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE,

+ 14 - 9
src/renderer_gl.cpp

@@ -10,17 +10,17 @@
 #	include <bx/timer.h>
 #	include <bx/uint32_t.h>
 
-#if BX_PLATFORM_WINDOWS
+#if BGFX_CONFIG_RENDERER_OPENGL
 #	define glClearDepthf(_depth) glClearDepth(_depth)
-#endif // BX_PLATFROM_WINDOWS
+#endif // BGFX_CONFIG_RENDERER_OPENGL
 
 namespace bgfx
 {
-#if BX_PLATFORM_WINDOWS
-#define GL_IMPORT(_optional, _proto, _func) _proto _func
-#include "glimports.h"
-#undef GL_IMPORT
-#endif // BX_PLATFORM_WINDOWS
+#if BGFX_CONFIG_RENDERER_OPENGL
+#	define GL_IMPORT(_optional, _proto, _func) _proto _func
+#	include "glimports.h"
+#	undef GL_IMPORT
+#endif // BGFX_CONFIG_RENDERER_OPENGL
 
 	typedef void (*PostSwapBuffersFn)(uint32_t _width, uint32_t _height);
 
@@ -254,6 +254,13 @@ namespace bgfx
 
 					glXMakeCurrent(display, window, m_context);
 
+#	define GL_IMPORT(_optional, _proto, _func) \
+				{ \
+					_func = (_proto)glXGetProcAddress((const GLubyte*)#_func); \
+					BGFX_FATAL(!_optional && NULL != _func, bgfx::Fatal::OPENGL_UnableToCreateContext, "Failed to create OpenGL context. glXGetProcAddress %s", #_func); \
+				}
+#	include "glimports.h"
+#	undef GL_IMPORT
 					glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
 					glClear(GL_COLOR_BUFFER_BIT);
 					glXSwapBuffers(display, window);
@@ -1573,8 +1580,6 @@ namespace bgfx
 
 				if (key.m_view != view)
 				{
-					GL_CHECK(glFlush() );
-
 					currentState.clear();
 					changedFlags = BGFX_STATE_MASK;
 					currentState.m_flags = newFlags;

+ 6 - 6
src/renderer_gl.h

@@ -7,7 +7,7 @@
 #define __RENDERER_GL_H__
 
 #if BGFX_CONFIG_RENDERER_OPENGL
-#	include <gl/GL.h>
+#	include <GL/gl.h>
 #	include <gl/glext.h>
 #elif BGFX_CONFIG_RENDERER_OPENGLES
 #	include <GLES2/gl2.h>
@@ -65,11 +65,11 @@ namespace bgfx
 #	define GL_CHECK(_call) _call
 #endif // BGFX_CONFIG_DEBUG
 
-#if BX_PLATFORM_WINDOWS
-#define GL_IMPORT(_optional, _proto, _func) extern _proto _func
-#include "glimports.h"
-#undef GL_IMPORT
-#endif // BX_PLATFORM_WINDOWS
+#if BGFX_CONFIG_RENDERER_OPENGL
+#	define GL_IMPORT(_optional, _proto, _func) extern _proto _func
+#	include "glimports.h"
+#	undef GL_IMPORT
+#endif // BGFX_CONFIG_RENDERER_OPENGL
 	
 	class ConstantBuffer;