From 1b370520d877d14179b39943cf6783f21677b55c Mon Sep 17 00:00:00 2001 From: Wunkolo Date: Sun, 3 Mar 2024 14:00:03 -0800 Subject: [PATCH] spv_shader_gen: Move common vs/fs types to spv_shader_gen Share more code and types between these two generators --- src/video_core/shader/generator/spv_fs_shader_gen.cpp | 2 -- src/video_core/shader/generator/spv_fs_shader_gen.h | 5 ----- src/video_core/shader/generator/spv_shader_gen.cpp | 3 --- src/video_core/shader/generator/spv_shader_gen.h | 4 ++++ 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/video_core/shader/generator/spv_fs_shader_gen.cpp b/src/video_core/shader/generator/spv_fs_shader_gen.cpp index 5f3158a73..03bf7f49f 100644 --- a/src/video_core/shader/generator/spv_fs_shader_gen.cpp +++ b/src/video_core/shader/generator/spv_fs_shader_gen.cpp @@ -15,8 +15,6 @@ using Pica::TexturingRegs; using TevStageConfig = TexturingRegs::TevStageConfig; using TextureType = TexturingRegs::TextureConfig::TextureType; -constexpr u32 SPIRV_VERSION_1_3 = 0x00010300; - FragmentModule::FragmentModule(const FSConfig& config_, const Profile& profile_) : Sirit::Module{SPIRV_VERSION_1_3}, config{config_}, profile{profile_}, use_fragment_shader_barycentric{profile.has_fragment_shader_barycentric && diff --git a/src/video_core/shader/generator/spv_fs_shader_gen.h b/src/video_core/shader/generator/spv_fs_shader_gen.h index ad0ebc57a..ae86e8565 100644 --- a/src/video_core/shader/generator/spv_fs_shader_gen.h +++ b/src/video_core/shader/generator/spv_fs_shader_gen.h @@ -12,11 +12,6 @@ #include "video_core/pica/regs_framebuffer.h" #include "video_core/pica/regs_texturing.h" -namespace Pica::Shader { -struct FSConfig; -struct Profile; -} // namespace Pica::Shader - namespace Pica::Shader::Generator::SPIRV { using Sirit::Id; diff --git a/src/video_core/shader/generator/spv_shader_gen.cpp b/src/video_core/shader/generator/spv_shader_gen.cpp index 98557422b..048eaad34 100644 --- a/src/video_core/shader/generator/spv_shader_gen.cpp +++ b/src/video_core/shader/generator/spv_shader_gen.cpp @@ -5,15 +5,12 @@ #include "video_core/pica/regs_rasterizer.h" #include "video_core/shader/generator/shader_gen.h" -// #include "video_core/shader/generator/spv_shader_decompiler.h" #include "video_core/shader/generator/spv_shader_gen.h" using VSOutputAttributes = Pica::RasterizerRegs::VSOutputAttributes; namespace Pica::Shader::Generator::SPIRV { -constexpr u32 SPIRV_VERSION_1_3 = 0x00010300; - VertexModule::VertexModule() : Sirit::Module{SPIRV_VERSION_1_3} { DefineArithmeticTypes(); DefineInterface(); diff --git a/src/video_core/shader/generator/spv_shader_gen.h b/src/video_core/shader/generator/spv_shader_gen.h index d45cb19cf..df98c3cb8 100644 --- a/src/video_core/shader/generator/spv_shader_gen.h +++ b/src/video_core/shader/generator/spv_shader_gen.h @@ -6,6 +6,7 @@ #include +#include "common/common_types.h" #include "common/unique_function.h" namespace Pica { @@ -14,6 +15,7 @@ struct ShaderSetup; namespace Pica::Shader { struct VSConfig; +struct FSConfig; struct Profile; } // namespace Pica::Shader @@ -25,6 +27,8 @@ namespace Pica::Shader::Generator::SPIRV { using Sirit::Id; +constexpr u32 SPIRV_VERSION_1_3 = 0x00010300; + struct VectorIds { /// Returns the type id of the vector with the provided size [[nodiscard]] constexpr Id Get(u32 size) const {