Add missing WebGPU checks (#9037)

part of BUGS = [424157731]
This commit is contained in:
Juan Caldas
2025-08-06 16:18:18 -04:00
committed by GitHub
parent 59f4d1ba20
commit a07c19e5b7
2 changed files with 4 additions and 3 deletions

View File

@@ -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 {};

View File

@@ -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
})" };