Бранимир Караџић 3 месяцев назад
Родитель
Сommit
89e24f1849
4 измененных файлов с 49 добавлено и 47 удалено
  1. 48 0
      src/bgfx.cpp
  2. 1 0
      src/bgfx_p.h
  3. 0 46
      src/debug_renderdoc.cpp
  4. 0 1
      src/debug_renderdoc.h

+ 48 - 0
src/bgfx.cpp

@@ -2621,6 +2621,54 @@ namespace bgfx
 	};
 	};
 	static_assert(BX_COUNTOF(s_rendererCreator) == RendererType::Count);
 	static_assert(BX_COUNTOF(s_rendererCreator) == RendererType::Count);
 
 
+	void* findModule(const char* _name)
+	{
+#if BX_PLATFORM_WINDOWS
+		// NOTE: there was some reason to do it this way instead of simply calling GetModuleHandleA,
+		// but not sure what it was.
+		HANDLE process = GetCurrentProcess();
+		DWORD size;
+		BOOL result = EnumProcessModules(process
+						, NULL
+						, 0
+						, &size
+						);
+		if (0 != result)
+		{
+			HMODULE* modules = (HMODULE*)BX_STACK_ALLOC(size);
+			result = EnumProcessModules(process
+				, modules
+				, size
+				, &size
+				);
+
+			if (0 != result)
+			{
+				char moduleName[MAX_PATH];
+
+				for (uint32_t ii = 0, num = uint32_t(size/sizeof(HMODULE) ); ii < num; ++ii)
+				{
+					result = GetModuleBaseNameA(process
+						, modules[ii]
+						, moduleName
+						, BX_COUNTOF(moduleName)
+						);
+
+					if (0 != result
+					&&  0 == bx::strCmpI(_name, moduleName) )
+					{
+						return (void*)modules[ii];
+					}
+				}
+			}
+		}
+#else
+		BX_UNUSED(_name);
+#endif // BX_PLATFORM_WINDOWS
+
+		return NULL;
+	}
+
 	bool windowsVersionIs(Condition::Enum _op, uint32_t _version, uint32_t _build)
 	bool windowsVersionIs(Condition::Enum _op, uint32_t _version, uint32_t _build)
 	{
 	{
 #if BX_PLATFORM_WINDOWS
 #if BX_PLATFORM_WINDOWS

+ 1 - 0
src/bgfx_p.h

@@ -427,6 +427,7 @@ namespace bgfx
 		};
 		};
 	};
 	};
 
 
+	void* findModule(const char* _name);
 	bool windowsVersionIs(Condition::Enum _op, uint32_t _version, uint32_t _build = UINT32_MAX);
 	bool windowsVersionIs(Condition::Enum _op, uint32_t _version, uint32_t _build = UINT32_MAX);
 
 
 	constexpr bool isShaderType(uint32_t _magic, char _type)
 	constexpr bool isShaderType(uint32_t _magic, char _type)

+ 0 - 46
src/debug_renderdoc.cpp

@@ -17,52 +17,6 @@
 
 
 namespace bgfx
 namespace bgfx
 {
 {
-	void* findModule(const char* _name)
-	{
-#if BX_PLATFORM_WINDOWS
-		// NOTE: there was some reason to do it this way instead of simply calling GetModuleHandleA,
-		// but not sure what it was.
-		HANDLE process = GetCurrentProcess();
-		DWORD size;
-		BOOL result = EnumProcessModules(process
-						, NULL
-						, 0
-						, &size
-						);
-		if (0 != result)
-		{
-			HMODULE* modules = (HMODULE*)BX_STACK_ALLOC(size);
-			result = EnumProcessModules(process
-				, modules
-				, size
-				, &size
-				);
-
-			if (0 != result)
-			{
-				char moduleName[MAX_PATH];
-				for (uint32_t ii = 0, num = uint32_t(size/sizeof(HMODULE) ); ii < num; ++ii)
-				{
-					result = GetModuleBaseNameA(process
-								, modules[ii]
-								, moduleName
-								, BX_COUNTOF(moduleName)
-								);
-					if (0 != result
-					&&  0 == bx::strCmpI(_name, moduleName) )
-					{
-						return (void*)modules[ii];
-					}
-				}
-			}
-		}
-#else
-		BX_UNUSED(_name);
-#endif // BX_PLATFORM_WINDOWS
-
-		return NULL;
-	}
-
 	pRENDERDOC_GetAPI RENDERDOC_GetAPI;
 	pRENDERDOC_GetAPI RENDERDOC_GetAPI;
 	static RENDERDOC_API_1_1_2* s_renderDoc = NULL;
 	static RENDERDOC_API_1_1_2* s_renderDoc = NULL;
 	static void* s_renderDocDll = NULL;
 	static void* s_renderDocDll = NULL;

+ 0 - 1
src/debug_renderdoc.h

@@ -8,7 +8,6 @@
 
 
 namespace bgfx
 namespace bgfx
 {
 {
-	void* findModule(const char* _name);
 	void* loadRenderDoc();
 	void* loadRenderDoc();
 	void unloadRenderDoc(void*);
 	void unloadRenderDoc(void*);
 	void renderDocTriggerCapture();
 	void renderDocTriggerCapture();