From 7a9fb864ad855f43889d4f203dafe4c80acde9c6 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 2 Jul 2021 10:36:47 -0700 Subject: [PATCH] [glsl-in] Add support for gl_FragCoord / gl_FragDepth And remove the ability to read gl_Position in fragment. --- src/front/glsl/variables.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/front/glsl/variables.rs b/src/front/glsl/variables.rs index 529036caa8..cec46cdfff 100644 --- a/src/front/glsl/variables.rs +++ b/src/front/glsl/variables.rs @@ -100,8 +100,27 @@ impl Program<'_> { }, BuiltIn::Position, true, + PrologueStage::empty(), + ), + "gl_FragCoord" => add_builtin( + TypeInner::Vector { + size: VectorSize::Quad, + kind: ScalarKind::Float, + width: 4, + }, + BuiltIn::Position, + false, PrologueStage::FRAGMENT, ), + "gl_FragDepth" => add_builtin( + TypeInner::Scalar { + kind: ScalarKind::Float, + width: 4, + }, + BuiltIn::FragDepth, + true, + PrologueStage::empty(), + ), "gl_VertexIndex" => add_builtin( TypeInner::Scalar { kind: ScalarKind::Uint,