mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 16:37:08 +00:00
GLSL: fix clip space mismatch in gl_Position.
OpenGL clips against [-w, w], while WebGPU uses [0, w]. The fix is to modify gl_Position.z on output to match GLSL semantics. (This is the same code used by SPIRV-Cross under the fixup_clipspace option.) Bug: tint:1401 Change-Id: I1b1511352eee11cd9b095cd809aa8e1263c6cf4c Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78261 Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
committed by
Tint LUCI CQ
parent
520bccf8d8
commit
b1d2b84f7d
@@ -56,6 +56,7 @@ void main() {
|
||||
tint_symbol_3 outputs;
|
||||
outputs = vert_main(inputs);
|
||||
gl_Position = outputs.value;
|
||||
gl_Position.z = 2.0 * gl_Position.z - gl_Position.w;
|
||||
gl_Position.y = -gl_Position.y;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ void main() {
|
||||
outputs = vtx_main(inputs);
|
||||
vtxFragColor = outputs.vtxFragColor;
|
||||
gl_Position = outputs.Position;
|
||||
gl_Position.z = 2.0 * gl_Position.z - gl_Position.w;
|
||||
gl_Position.y = -gl_Position.y;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ void main() {
|
||||
tint_symbol_2 outputs;
|
||||
outputs = tint_symbol_1();
|
||||
gl_Position = outputs.tint_symbol;
|
||||
gl_Position.z = 2.0 * gl_Position.z - gl_Position.w;
|
||||
gl_Position.y = -gl_Position.y;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ void main() {
|
||||
tint_symbol_2 outputs;
|
||||
outputs = vtx_main(inputs);
|
||||
gl_Position = outputs.value;
|
||||
gl_Position.z = 2.0 * gl_Position.z - gl_Position.w;
|
||||
gl_Position.y = -gl_Position.y;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user