From 85a4282de6669c70cf705fb91bb6466967755c19 Mon Sep 17 00:00:00 2001 From: Stephen White Date: Thu, 28 Oct 2021 19:24:48 +0000 Subject: [PATCH] GLSL: perform Y flip in vertex shader. Change-Id: If7d038b4739f475bd26e0f7b3eaeec364df35ad5 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67860 Kokoro: Kokoro Reviewed-by: Ben Clayton Commit-Queue: Stephen White --- src/writer/glsl/generator_impl.cc | 3 +++ src/writer/glsl/generator_impl_function_test.cc | 1 + 2 files changed, 4 insertions(+) diff --git a/src/writer/glsl/generator_impl.cc b/src/writer/glsl/generator_impl.cc index 80db771f28..0909adc12a 100644 --- a/src/writer/glsl/generator_impl.cc +++ b/src/writer/glsl/generator_impl.cc @@ -1914,6 +1914,9 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) { out << " = outputs." << name << ";" << std::endl; } } + if (func->PipelineStage() == ast::PipelineStage::kVertex) { + out << " gl_Position.y = -gl_Position.y;" << std::endl; + } out << "}" << std::endl << std::endl; diff --git a/src/writer/glsl/generator_impl_function_test.cc b/src/writer/glsl/generator_impl_function_test.cc index 0cd8b97aa2..9f82acb94a 100644 --- a/src/writer/glsl/generator_impl_function_test.cc +++ b/src/writer/glsl/generator_impl_function_test.cc @@ -292,6 +292,7 @@ void main() { col1 = outputs.col1; col2 = outputs.col2; gl_Position = outputs.pos; + gl_Position.y = -gl_Position.y; }