Бранимир Караџић 5 years ago
parent
commit
7a687904c7
3 changed files with 33 additions and 28 deletions
  1. 1 0
      src/amalgamated.cpp
  2. 17 14
      src/renderer_webgpu.cpp
  3. 15 14
      src/renderer_webgpu.h

+ 1 - 0
src/amalgamated.cpp

@@ -19,6 +19,7 @@
 #include "renderer_noop.cpp"
 #include "renderer_nvn.cpp"
 #include "renderer_vk.cpp"
+#include "renderer_webgpu.cpp"
 #include "shader_dx9bc.cpp"
 #include "shader_dxbc.cpp"
 #include "shader_spirv.cpp"

+ 17 - 14
src/renderer_webgpu.cpp

@@ -13,24 +13,27 @@
 #	include "renderer.h"
 #	include "debug_renderdoc.h"
 
-#ifdef DAWN_ENABLE_BACKEND_VULKAN
-#	include "renderer_vk.h"
-#endif
-
-#if !BX_PLATFORM_EMSCRIPTEN
-#	ifdef DAWN_ENABLE_BACKEND_D3D12
-#		include <dawn_native/D3D12Backend.h>
-#	endif
 #	ifdef DAWN_ENABLE_BACKEND_VULKAN
-#		include <dawn_native/VulkanBackend.h>
-#	endif
-#	include <dawn_native/DawnNative.h>
-#	include <dawn/dawn_wsi.h>
-#	include <dawn/dawn_proc.h>
+#		include "renderer_vk.h"
+#	endif // DAWN_ENABLE_BACKEND_VULKAN
+
+#	if !BX_PLATFORM_EMSCRIPTEN
+#		ifdef DAWN_ENABLE_BACKEND_D3D12
+#			include <dawn_native/D3D12Backend.h>
+#		endif // !BX_PLATFORM_EMSCRIPTEN
+
+#		ifdef DAWN_ENABLE_BACKEND_VULKAN
+#			include <dawn_native/VulkanBackend.h>
+#		endif // DAWN_ENABLE_BACKEND_VULKAN
+
+#		include <dawn_native/DawnNative.h>
+#		include <dawn/dawn_wsi.h>
+#		include <dawn/dawn_proc.h>
+#	endif // !BX_PLATFORM_EMSCRIPTEN
 #else
 #	include <emscripten/emscripten.h>
 #	include <emscripten/html5.h>
-#endif
+#endif // BGFX_CONFIG_RENDERER_WEBGPU
 
 namespace bgfx { namespace webgpu
 {

+ 15 - 14
src/renderer_webgpu.h

@@ -11,34 +11,34 @@
 #if BGFX_CONFIG_RENDERER_WEBGPU
 
 #if !BX_PLATFORM_EMSCRIPTEN
-#include <dawn/webgpu_cpp.h>
-#include <dawn/dawn_wsi.h>
+#	include <dawn/webgpu_cpp.h>
+#	include <dawn/dawn_wsi.h>
 #else
-#include <webgpu/webgpu_cpp.h>
-#endif
+#	include <webgpu/webgpu_cpp.h>
+#endif // !BX_PLATFORM_EMSCRIPTEN
 
-#define BGFX_WEBGPU_PROFILER_BEGIN(_view, _abgr)         \
+#define BGFX_WEBGPU_PROFILER_BEGIN(_view, _abgr)      \
 	BX_MACRO_BLOCK_BEGIN                              \
 		BGFX_PROFILER_BEGIN(s_viewName[view], _abgr); \
 	BX_MACRO_BLOCK_END
 
-#define BGFX_WEBGPU_PROFILER_BEGIN_LITERAL(_name, _abgr)   \
-	BX_MACRO_BLOCK_BEGIN                                \
-		BGFX_PROFILER_BEGIN_LITERAL("" # _name, _abgr); \
+#define BGFX_WEBGPU_PROFILER_BEGIN_LITERAL(_name, _abgr) \
+	BX_MACRO_BLOCK_BEGIN                                 \
+		BGFX_PROFILER_BEGIN_LITERAL("" # _name, _abgr);  \
 	BX_MACRO_BLOCK_END
 
 #define BGFX_WEBGPU_PROFILER_END() \
-	BX_MACRO_BLOCK_BEGIN        \
-		BGFX_PROFILER_END();    \
+	BX_MACRO_BLOCK_BEGIN           \
+		BGFX_PROFILER_END();       \
 	BX_MACRO_BLOCK_END
 
 #define WEBGPU_MAX_FRAMES_IN_FLIGHT 3
-#define WEBGPU_NUM_UNIFORM_BUFFERS 8
+#define WEBGPU_NUM_UNIFORM_BUFFERS  8
 
-namespace bgfx {
+namespace bgfx
+{
 	namespace webgpu
 	{
-
 		template <typename Ty>
 		class StateCacheT
 		{
@@ -560,7 +560,8 @@ namespace bgfx {
 			bx::RingBufferControl m_control;
 		};
 
-	} /* namespace metal */
+	} // namespace webgpu
+
 } // namespace bgfx
 
 #endif // BGFX_CONFIG_RENDERER_WEBGPU