From 8bb8bbf4ae2ef259857efe49436dfd71758ea092 Mon Sep 17 00:00:00 2001
From: ameerj <52414509+ameerj@users.noreply.github.com>
Date: Tue, 8 Jun 2021 01:55:12 -0400
Subject: glsl: Implement fswzadd

and wip nv thread shuffle impl
---
 src/shader_recompiler/backend/glsl/emit_context.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'src/shader_recompiler/backend/glsl/emit_context.cpp')

diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp
index ed0955da09..6c28286446 100644
--- a/src/shader_recompiler/backend/glsl/emit_context.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_context.cpp
@@ -306,6 +306,7 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
     SetupImages(bindings);
     SetupTextures(bindings);
     DefineHelperFunctions();
+    DefineConstants();
 }
 
 void EmitContext::SetupExtensions(std::string&) {
@@ -339,6 +340,9 @@ void EmitContext::SetupExtensions(std::string&) {
         if (!info.uses_int64) {
             header += "#extension GL_ARB_gpu_shader_int64 : enable\n";
         }
+        if (profile.support_gl_warp_intrinsics) {
+            header += "#extension GL_NV_shader_thread_shuffle : enable\n";
+        }
     }
     if (info.stores_viewport_index && profile.support_viewport_index_layer_non_geometry &&
         stage != Stage::Geometry) {
@@ -605,4 +609,11 @@ void EmitContext::SetupTextures(Bindings& bindings) {
     }
 }
 
+void EmitContext::DefineConstants() {
+    if (info.uses_fswzadd) {
+        header += "const float FSWZ_A[]=float[4](-1.f,1.f,-1.f,0.f);"
+                  "const float FSWZ_B[]=float[4](-1.f,-1.f,1.f,-1.f);";
+    }
+}
+
 } // namespace Shader::Backend::GLSL
-- 
cgit v1.2.3-70-g09d2