From 09578d522b203458d8196001bc5130de8c4e619a Mon Sep 17 00:00:00 2001
From: ivchodev <ivchodev@noreply.localhost>
Date: Tue, 26 Mar 2024 18:38:52 +0100
Subject: [PATCH] revert 925ce2fad34aeb890103d52ea50c151a94fdcd1f

Reverting potentially plagiarized code. The developer team did not sign off on this commit.
---
 .../glasm/emit_glasm_context_get_set.cpp       |  4 ----
 .../backend/glasm/glasm_emit_context.h         |  1 -
 .../backend/glsl/emit_glsl_context_get_set.cpp |  4 ----
 .../spirv/emit_spirv_context_get_set.cpp       |  2 --
 src/shader_recompiler/runtime_info.h           | 18 ------------------
 5 files changed, 29 deletions(-)

diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
index 75c89ebd02..c7d7d5fefb 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
@@ -406,10 +406,6 @@ void EmitInvocationInfo(EmitContext& ctx, IR::Inst& inst) {
     case Stage::TessellationEval:
         ctx.Add("SHL.U {}.x,primitive.vertexcount,16;", inst);
         break;
-    case Stage::Geometry:
-        ctx.Add("SHL.U {}.x,{},16;", inst,
-            InputTopologyVertices::vertices(ctx.runtime_info.input_topology));
-        break;
     default:
         LOG_WARNING(Shader, "(STUBBED) called");
         ctx.Add("MOV.S {}.x,0x00ff0000;", inst);
diff --git a/src/shader_recompiler/backend/glasm/glasm_emit_context.h b/src/shader_recompiler/backend/glasm/glasm_emit_context.h
index b4d66ea559..a81d64a9e4 100644
--- a/src/shader_recompiler/backend/glasm/glasm_emit_context.h
+++ b/src/shader_recompiler/backend/glasm/glasm_emit_context.h
@@ -11,7 +11,6 @@
 
 #include "shader_recompiler/backend/glasm/reg_alloc.h"
 #include "shader_recompiler/stage.h"
-#include "shader_recompiler/runtime_info.h"
 
 namespace Shader {
 struct Info;
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
index 35d99bad3e..2e369ed723 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
@@ -426,10 +426,6 @@ void EmitInvocationInfo(EmitContext& ctx, IR::Inst& inst) {
     case Stage::TessellationEval:
         ctx.AddU32("{}=uint(gl_PatchVerticesIn)<<16;", inst);
         break;
-    case Stage::Geometry:
-        ctx.AddU32("{}=uint({}<<16);", inst,
-            InputTopologyVertices::vertices(ctx.runtime_info.input_topology));
-        break;
     default:
         LOG_WARNING(Shader, "(STUBBED) called");
         ctx.AddU32("{}=uint(0x00ff0000);", inst);
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp
index 2e7643fe9a..feca5105f9 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp
@@ -549,8 +549,6 @@ Id EmitInvocationInfo(EmitContext& ctx) {
     case Stage::TessellationEval:
         return ctx.OpShiftLeftLogical(ctx.U32[1], ctx.OpLoad(ctx.U32[1], ctx.patch_vertices_in),
                                       ctx.Const(16u));
-    case Stage::Geometry:
-        return ctx.Const(InputTopologyVertices::vertices(ctx.runtime_info.input_topology) << 16);
     default:
         LOG_WARNING(Shader, "(STUBBED) called");
         return ctx.Const(0x00ff0000u);
diff --git a/src/shader_recompiler/runtime_info.h b/src/shader_recompiler/runtime_info.h
index dc54d932a6..619c0b1387 100644
--- a/src/shader_recompiler/runtime_info.h
+++ b/src/shader_recompiler/runtime_info.h
@@ -30,24 +30,6 @@ enum class InputTopology {
     TrianglesAdjacency,
 };
 
-struct InputTopologyVertices {
-    static u32 vertices(InputTopology input_topology) {
-        switch (input_topology) {
-        case InputTopology::Lines:
-            return 2;
-        case InputTopology::LinesAdjacency:
-            return 4;
-        case InputTopology::Triangles:
-            return 3;
-        case InputTopology::TrianglesAdjacency:
-            return 6;
-        case InputTopology::Points:
-        default:
-            return 1;
-        }
-    }
-};
-
 enum class CompareFunction {
     Never,
     Less,
-- 
GitLab