From a07c19e5b7cf117d3c301b06c0ad5a38ccbc64c4 Mon Sep 17 00:00:00 2001 From: Juan Caldas Date: Wed, 6 Aug 2025 16:18:18 -0400 Subject: [PATCH] Add missing WebGPU checks (#9037) part of BUGS = [424157731] --- filament/backend/test/ShaderGenerator.cpp | 1 + filament/backend/test/SharedShaders.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/filament/backend/test/ShaderGenerator.cpp b/filament/backend/test/ShaderGenerator.cpp index e9979d0cfe..e575d8334f 100644 --- a/filament/backend/test/ShaderGenerator.cpp +++ b/filament/backend/test/ShaderGenerator.cpp @@ -173,6 +173,7 @@ ShaderGenerator::Blob ShaderGenerator::transpileShader(ShaderStage stage, std::s return { (uint8_t*)spirv.data(), (uint8_t*)(spirv.data() + spirv.size()) }; } else if (backend == Backend::WEBGPU){ filamat::GLSLPostProcessor::spirvToWgsl(&spirv, &result); + return { result.c_str(), result.c_str() + result.length() + 1 }; } return {}; diff --git a/filament/backend/test/SharedShaders.cpp b/filament/backend/test/SharedShaders.cpp index bbc7520d3f..02c6762c7d 100644 --- a/filament/backend/test/SharedShaders.cpp +++ b/filament/backend/test/SharedShaders.cpp @@ -47,7 +47,7 @@ layout(location = 0) in vec4 mesh_position; void main() { gl_Position = vec4(mesh_position.xy, 0.0, 1.0); #if defined(TARGET_VULKAN_ENVIRONMENT) - // In Vulkan, clip space is Y-down. In OpenGL and Metal, clip space is Y-up. + // In Vulkan, clip space is Y-down. In OpenGL, Metal and WebGPU, clip space is Y-up. gl_Position.y = -gl_Position.y; #endif })" }; @@ -64,7 +64,7 @@ void main() { params.scaleMinusOne.z + 1.0, 1.0); #if defined(TARGET_VULKAN_ENVIRONMENT) - // In Vulkan, clip space is Y-down. In OpenGL and Metal, clip space is Y-up. + // In Vulkan, clip space is Y-down. In OpenGL, Metal and WebGPU, clip space is Y-up. gl_Position.y = -gl_Position.y; #endif })" }; @@ -80,7 +80,7 @@ void main() { gl_Position = vec4(mesh_position.xy, 0.0, 1.0); uv = (mesh_position.xy * 0.5 + 0.5); #if defined(TARGET_VULKAN_ENVIRONMENT) - // In Vulkan, clip space is Y-down. In OpenGL and Metal, clip space is Y-up. + // In Vulkan, clip space is Y-down. In OpenGL, Metal and WebGPU, clip space is Y-up. gl_Position.y = -gl_Position.y; #endif })" };