summaryrefslogtreecommitdiff
path: root/src/gpu/gpu.h
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-01-31 20:44:23 +0100
committerskal <pascal.massimino@gmail.com>2026-01-31 20:44:23 +0100
commitc6b33c5e9b2325ca472dab8c4b64d1dab7b2885a (patch)
treebdd7ad7a253562a5860fb9db20a9179931401672 /src/gpu/gpu.h
parent4a55151d1a30f03ce1aa67e4c952ff6759c480c9 (diff)
fix(gpu): resolve multiple WebGPU validation and runtime errors
- Fixed 'Invalid sample count 0' and 'Invalid anisotropic clamp: 0' by ensuring explicit pipeline and sampler states. - Resolved WGSL parsing errors by replacing swizzle assignments in compute shaders. - Fixed 'Texture destroyed' error in render_frame by reordering command submission and resource presentation/release. - Added WGPU_DEPTH_SLICE_UNDEFINED for Windows compatibility and ensured consistent resolveTarget initialization. - Cleaned up PassthroughEffect bind group layout mismatch and redundant string helper definitions. - Verified all tests pass and applied consistent formatting.
Diffstat (limited to 'src/gpu/gpu.h')
-rw-r--r--src/gpu/gpu.h56
1 files changed, 16 insertions, 40 deletions
diff --git a/src/gpu/gpu.h b/src/gpu/gpu.h
index 0bc20b7..c2c0670 100644
--- a/src/gpu/gpu.h
+++ b/src/gpu/gpu.h
@@ -8,8 +8,6 @@
#include <cstring> // For strlen
-
-
#if defined(DEMO_CROSS_COMPILE_WIN32)
// Windows (MinGW) using wgpu-native v0.19.4.1
@@ -18,69 +16,52 @@
#include <webgpu/wgpu.h>
+static inline const char *str_view(const char *str) {
+ return str;
+}
-
-static inline const char *str_view(const char *str) { return str; }
-
-
-
-static inline const char *label_view(const char *str) { return str; }
-
-
-
-
-
-
+static inline const char *label_view(const char *str) {
+ return str;
+}
#define WGPUSType_ShaderSourceWGSL WGPUSType_ShaderModuleWGSLDescriptor
-
-
using WGPUShaderSourceWGSL = WGPUShaderModuleWGSLDescriptor;
+#define WGPUSurfaceGetCurrentTextureStatus_SuccessOptimal \
+ WGPUSurfaceGetCurrentTextureStatus_Success
-
-#define WGPUSurfaceGetCurrentTextureStatus_SuccessOptimal WGPUSurfaceGetCurrentTextureStatus_Success
-
-
-
-#define WGPUSurfaceGetCurrentTextureStatus_SuccessSuboptimal WGPUSurfaceGetCurrentTextureStatus_Success
-
-
+#define WGPUSurfaceGetCurrentTextureStatus_SuccessSuboptimal \
+ WGPUSurfaceGetCurrentTextureStatus_Success
#define WGPUCallbackMode_WaitAnyOnly 0
-
-
-
+#define WGPU_DEPTH_SLICE_UNDEFINED (0xffffffff)
#else
-// Native (macOS/Linux) using newer wgpu-native
+// Native (macOS/Linux) using newer wgpu-native
#include <webgpu.h>
#include <wgpu.h>
-
-
static inline WGPUStringView str_view(const char *str) {
- if (!str) return {nullptr, 0};
+ if (!str)
+ return {nullptr, 0};
return {str, strlen(str)};
-
}
-
-
static inline WGPUStringView label_view(const char *str) {
#ifndef STRIP_ALL
- if (!str) return {nullptr, 0};
+ if (!str)
+ return {nullptr, 0};
return {str, strlen(str)};
@@ -91,15 +72,10 @@ static inline WGPUStringView label_view(const char *str) {
return {nullptr, 0};
#endif
-
}
-
-
#endif
-
-
struct GLFWwindow;
// Basic wrapper for WebGPU buffers