From 73b11f390e3dabf42d22af78670c8aa6d8f52cee Mon Sep 17 00:00:00 2001
From: Feng Chen <vonchenplus@gmail.com>
Date: Wed, 1 Sep 2021 00:07:25 +0800
Subject: Add colorfront and txtcoord support

---
 src/shader_recompiler/backend/spirv/emit_context.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

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

diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp
index 2d29d8c145..89c75c52d4 100644
--- a/src/shader_recompiler/backend/spirv/emit_context.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_context.cpp
@@ -1201,6 +1201,12 @@ void EmitContext::DefineInputs(const IR::Program& program) {
             }
         }
     }
+    if (loads.AllComponents(IR::Attribute::ColorFrontDiffuseR)) {
+        input_front_color = DefineInput(*this, F32[4], true);
+    }
+    if (loads.AllComponents(IR::Attribute::FixedFncTexture0S)) {
+        input_txt_coord = DefineInput(*this, F32[4], true);
+    }
     if (loads[IR::Attribute::InstanceId]) {
         if (profile.support_vertex_instance_id) {
             instance_id = DefineInput(*this, U32[1], true, spv::BuiltIn::InstanceId);
@@ -1282,6 +1288,9 @@ void EmitContext::DefineOutputs(const IR::Program& program) {
     if (info.stores.AnyComponent(IR::Attribute::PositionX) || stage == Stage::VertexB) {
         output_position = DefineOutput(*this, F32[4], invocations, spv::BuiltIn::Position);
     }
+    if (info.stores.AnyComponent(IR::Attribute::ColorFrontDiffuseR) || stage == Stage::VertexB) {
+        output_front_color = DefineOutput(*this, F32[4], invocations);
+    }
     if (info.stores[IR::Attribute::PointSize] || runtime_info.fixed_state_point_size) {
         if (stage == Stage::Fragment) {
             throw NotImplementedException("Storing PointSize in fragment stage");
@@ -1313,6 +1322,11 @@ void EmitContext::DefineOutputs(const IR::Program& program) {
         viewport_mask = DefineOutput(*this, TypeArray(U32[1], Const(1u)), std::nullopt,
                                      spv::BuiltIn::ViewportMaskNV);
     }
+
+    if (info.stores.AnyComponent(IR::Attribute::FixedFncTexture0S)) {
+        output_txt_coord = DefineOutput(*this, F32[4], invocations);
+    }
+
     for (size_t index = 0; index < IR::NUM_GENERICS; ++index) {
         if (info.stores.Generic(index)) {
             DefineGenericOutput(*this, index, invocations);
-- 
cgit v1.2.3-70-g09d2