mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
VideoCommon/VertexShaderManager: Use std::array where applicable
We can use this to shorten up the initialization code a little bit. Despite being saved to savestates, this is a non-breaking change.
This commit is contained in:
@ -29,13 +29,17 @@
|
|||||||
alignas(16) static std::array<float, 16> g_fProjectionMatrix;
|
alignas(16) static std::array<float, 16> g_fProjectionMatrix;
|
||||||
|
|
||||||
// track changes
|
// track changes
|
||||||
static bool bTexMatricesChanged[2], bPosNormalMatrixChanged, bProjectionChanged, bViewportChanged;
|
static std::array<bool, 2> bTexMatricesChanged;
|
||||||
static bool bTexMtxInfoChanged, bLightingConfigChanged;
|
static bool bPosNormalMatrixChanged;
|
||||||
|
static bool bProjectionChanged;
|
||||||
|
static bool bViewportChanged;
|
||||||
|
static bool bTexMtxInfoChanged;
|
||||||
|
static bool bLightingConfigChanged;
|
||||||
static BitSet32 nMaterialsChanged;
|
static BitSet32 nMaterialsChanged;
|
||||||
static int nTransformMatricesChanged[2]; // min,max
|
static std::array<int, 2> nTransformMatricesChanged; // min,max
|
||||||
static int nNormalMatricesChanged[2]; // min,max
|
static std::array<int, 2> nNormalMatricesChanged; // min,max
|
||||||
static int nPostTransformMatricesChanged[2]; // min,max
|
static std::array<int, 2> nPostTransformMatricesChanged; // min,max
|
||||||
static int nLightsChanged[2]; // min,max
|
static std::array<int, 2> nLightsChanged; // min,max
|
||||||
|
|
||||||
static Common::Matrix44 s_viewportCorrection;
|
static Common::Matrix44 s_viewportCorrection;
|
||||||
static Common::Matrix44 s_freelook_matrix;
|
static Common::Matrix44 s_freelook_matrix;
|
||||||
@ -95,17 +99,12 @@ static void ViewportCorrectionMatrix(Common::Matrix44& result)
|
|||||||
void VertexShaderManager::Init()
|
void VertexShaderManager::Init()
|
||||||
{
|
{
|
||||||
// Initialize state tracking variables
|
// Initialize state tracking variables
|
||||||
nTransformMatricesChanged[0] = -1;
|
nTransformMatricesChanged.fill(-1);
|
||||||
nTransformMatricesChanged[1] = -1;
|
nNormalMatricesChanged.fill(-1);
|
||||||
nNormalMatricesChanged[0] = -1;
|
nPostTransformMatricesChanged.fill(-1);
|
||||||
nNormalMatricesChanged[1] = -1;
|
nLightsChanged.fill(-1);
|
||||||
nPostTransformMatricesChanged[0] = -1;
|
|
||||||
nPostTransformMatricesChanged[1] = -1;
|
|
||||||
nLightsChanged[0] = -1;
|
|
||||||
nLightsChanged[1] = -1;
|
|
||||||
nMaterialsChanged = BitSet32(0);
|
nMaterialsChanged = BitSet32(0);
|
||||||
bTexMatricesChanged[0] = false;
|
bTexMatricesChanged.fill(false);
|
||||||
bTexMatricesChanged[1] = false;
|
|
||||||
bPosNormalMatrixChanged = false;
|
bPosNormalMatrixChanged = false;
|
||||||
bProjectionChanged = true;
|
bProjectionChanged = true;
|
||||||
bViewportChanged = false;
|
bViewportChanged = false;
|
||||||
@ -672,17 +671,17 @@ void VertexShaderManager::TransformToClipSpace(const float* data, float* out, u3
|
|||||||
|
|
||||||
void VertexShaderManager::DoState(PointerWrap& p)
|
void VertexShaderManager::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
p.Do(g_fProjectionMatrix);
|
p.DoArray(g_fProjectionMatrix);
|
||||||
p.Do(s_viewportCorrection);
|
p.Do(s_viewportCorrection);
|
||||||
p.Do(s_freelook_matrix);
|
p.Do(s_freelook_matrix);
|
||||||
|
|
||||||
p.Do(nTransformMatricesChanged);
|
p.DoArray(nTransformMatricesChanged);
|
||||||
p.Do(nNormalMatricesChanged);
|
p.DoArray(nNormalMatricesChanged);
|
||||||
p.Do(nPostTransformMatricesChanged);
|
p.DoArray(nPostTransformMatricesChanged);
|
||||||
p.Do(nLightsChanged);
|
p.DoArray(nLightsChanged);
|
||||||
|
|
||||||
p.Do(nMaterialsChanged);
|
p.Do(nMaterialsChanged);
|
||||||
p.Do(bTexMatricesChanged);
|
p.DoArray(bTexMatricesChanged);
|
||||||
p.Do(bPosNormalMatrixChanged);
|
p.Do(bPosNormalMatrixChanged);
|
||||||
p.Do(bProjectionChanged);
|
p.Do(bProjectionChanged);
|
||||||
p.Do(bViewportChanged);
|
p.Do(bViewportChanged);
|
||||||
|
Reference in New Issue
Block a user