spv_shader_gen: Move common vs/fs types to spv_shader_gen

Share more code and types between these two generators
This commit is contained in:
Wunkolo 2024-03-03 14:00:03 -08:00
parent eb814f77c7
commit 1b370520d8
4 changed files with 4 additions and 10 deletions

View file

@ -15,8 +15,6 @@ using Pica::TexturingRegs;
using TevStageConfig = TexturingRegs::TevStageConfig; using TevStageConfig = TexturingRegs::TevStageConfig;
using TextureType = TexturingRegs::TextureConfig::TextureType; using TextureType = TexturingRegs::TextureConfig::TextureType;
constexpr u32 SPIRV_VERSION_1_3 = 0x00010300;
FragmentModule::FragmentModule(const FSConfig& config_, const Profile& profile_) FragmentModule::FragmentModule(const FSConfig& config_, const Profile& profile_)
: Sirit::Module{SPIRV_VERSION_1_3}, config{config_}, profile{profile_}, : Sirit::Module{SPIRV_VERSION_1_3}, config{config_}, profile{profile_},
use_fragment_shader_barycentric{profile.has_fragment_shader_barycentric && use_fragment_shader_barycentric{profile.has_fragment_shader_barycentric &&

View file

@ -12,11 +12,6 @@
#include "video_core/pica/regs_framebuffer.h" #include "video_core/pica/regs_framebuffer.h"
#include "video_core/pica/regs_texturing.h" #include "video_core/pica/regs_texturing.h"
namespace Pica::Shader {
struct FSConfig;
struct Profile;
} // namespace Pica::Shader
namespace Pica::Shader::Generator::SPIRV { namespace Pica::Shader::Generator::SPIRV {
using Sirit::Id; using Sirit::Id;

View file

@ -5,15 +5,12 @@
#include "video_core/pica/regs_rasterizer.h" #include "video_core/pica/regs_rasterizer.h"
#include "video_core/shader/generator/shader_gen.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" #include "video_core/shader/generator/spv_shader_gen.h"
using VSOutputAttributes = Pica::RasterizerRegs::VSOutputAttributes; using VSOutputAttributes = Pica::RasterizerRegs::VSOutputAttributes;
namespace Pica::Shader::Generator::SPIRV { namespace Pica::Shader::Generator::SPIRV {
constexpr u32 SPIRV_VERSION_1_3 = 0x00010300;
VertexModule::VertexModule() : Sirit::Module{SPIRV_VERSION_1_3} { VertexModule::VertexModule() : Sirit::Module{SPIRV_VERSION_1_3} {
DefineArithmeticTypes(); DefineArithmeticTypes();
DefineInterface(); DefineInterface();

View file

@ -6,6 +6,7 @@
#include <sirit/sirit.h> #include <sirit/sirit.h>
#include "common/common_types.h"
#include "common/unique_function.h" #include "common/unique_function.h"
namespace Pica { namespace Pica {
@ -14,6 +15,7 @@ struct ShaderSetup;
namespace Pica::Shader { namespace Pica::Shader {
struct VSConfig; struct VSConfig;
struct FSConfig;
struct Profile; struct Profile;
} // namespace Pica::Shader } // namespace Pica::Shader
@ -25,6 +27,8 @@ namespace Pica::Shader::Generator::SPIRV {
using Sirit::Id; using Sirit::Id;
constexpr u32 SPIRV_VERSION_1_3 = 0x00010300;
struct VectorIds { struct VectorIds {
/// Returns the type id of the vector with the provided size /// Returns the type id of the vector with the provided size
[[nodiscard]] constexpr Id Get(u32 size) const { [[nodiscard]] constexpr Id Get(u32 size) const {