Convert ShaderHostConfig to BitField

This commit is contained in:
Pokechu22 2021-07-28 21:11:15 -07:00
parent c86c02e46b
commit eb81968fe6
3 changed files with 26 additions and 29 deletions

View File

@ -35,7 +35,7 @@ ShaderCache::~ShaderCache()
bool ShaderCache::Initialize() bool ShaderCache::Initialize()
{ {
m_api_type = g_ActiveConfig.backend_info.api_type; m_api_type = g_ActiveConfig.backend_info.api_type;
m_host_config = ShaderHostConfig::GetCurrent(); m_host_config.bits = ShaderHostConfig::GetCurrent().bits;
if (!CompileSharedPipelines()) if (!CompileSharedPipelines())
return false; return false;

View File

@ -53,7 +53,7 @@ public:
void InitializeShaderCache(); void InitializeShaderCache();
// Changes the shader host config. Shaders should be reloaded afterwards. // Changes the shader host config. Shaders should be reloaded afterwards.
void SetHostConfig(const ShaderHostConfig& host_config) { m_host_config = host_config; } void SetHostConfig(const ShaderHostConfig& host_config) { m_host_config.bits = host_config.bits; }
// Reloads/recreates all shaders and pipelines. // Reloads/recreates all shaders and pipelines.
void Reload(); void Reload();

View File

@ -11,6 +11,7 @@
#include <fmt/format.h> #include <fmt/format.h>
#include "Common/BitField.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
@ -143,33 +144,29 @@ union ShaderHostConfig
{ {
u32 bits; u32 bits;
struct BitField<0, 1, bool, u32> msaa;
{ BitField<1, 1, bool, u32> ssaa;
u32 msaa : 1; BitField<2, 1, bool, u32> stereo;
u32 ssaa : 1; BitField<3, 1, bool, u32> wireframe;
u32 stereo : 1; BitField<4, 1, bool, u32> per_pixel_lighting;
u32 wireframe : 1; BitField<5, 1, bool, u32> vertex_rounding;
u32 per_pixel_lighting : 1; BitField<6, 1, bool, u32> fast_depth_calc;
u32 vertex_rounding : 1; BitField<7, 1, bool, u32> bounding_box;
u32 fast_depth_calc : 1; BitField<8, 1, bool, u32> backend_dual_source_blend;
u32 bounding_box : 1; BitField<9, 1, bool, u32> backend_geometry_shaders;
u32 backend_dual_source_blend : 1; BitField<10, 1, bool, u32> backend_early_z;
u32 backend_geometry_shaders : 1; BitField<11, 1, bool, u32> backend_bbox;
u32 backend_early_z : 1; BitField<12, 1, bool, u32> backend_gs_instancing;
u32 backend_bbox : 1; BitField<13, 1, bool, u32> backend_clip_control;
u32 backend_gs_instancing : 1; BitField<14, 1, bool, u32> backend_ssaa;
u32 backend_clip_control : 1; BitField<15, 1, bool, u32> backend_atomics;
u32 backend_ssaa : 1; BitField<16, 1, bool, u32> backend_depth_clamp;
u32 backend_atomics : 1; BitField<17, 1, bool, u32> backend_reversed_depth_range;
u32 backend_depth_clamp : 1; BitField<18, 1, bool, u32> backend_bitfield;
u32 backend_reversed_depth_range : 1; BitField<19, 1, bool, u32> backend_dynamic_sampler_indexing;
u32 backend_bitfield : 1; BitField<20, 1, bool, u32> backend_shader_framebuffer_fetch;
u32 backend_dynamic_sampler_indexing : 1; BitField<21, 1, bool, u32> backend_logic_op;
u32 backend_shader_framebuffer_fetch : 1; BitField<22, 1, bool, u32> backend_palette_conversion;
u32 backend_logic_op : 1;
u32 backend_palette_conversion : 1;
u32 pad : 9;
};
static ShaderHostConfig GetCurrent(); static ShaderHostConfig GetCurrent();
}; };