diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index e56122ad26..7d4644b279 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -313,7 +313,7 @@ void FramebufferManagerCommon::EstimateDrawingSize(u32 fb_address, int fb_stride DEBUG_LOG(Log::G3D, "Est: %08x V: %ix%i, R: %ix%i, S: %ix%i, STR: %i, THR:%i, Z:%08x = %ix%i %s", fb_address, viewport_width,viewport_height, region_width, region_height, scissor_width, scissor_height, fb_stride, gstate.isModeThrough(), gstate.isDepthWriteEnabled() ? gstate.getDepthBufAddress() : 0, drawing_width, drawing_height, margin ? " (margin!)" : ""); } -void GetFramebufferHeuristicInputs(FramebufferHeuristicParams *params, const GPUgstate &gstate) { +void GetFramebufferHeuristicInputs(FramebufferHeuristicParams *params, const GEState &gstate) { // GetFramebufferHeuristicInputs is only called from rendering, and thus, it's VRAM. params->fb_address = gstate.getFrameBufRawAddress() | 0x04000000; params->fb_stride = gstate.FrameBufStride(); diff --git a/GPU/Common/FramebufferManagerCommon.h b/GPU/Common/FramebufferManagerCommon.h index 0072a48d18..6bfb46af8f 100644 --- a/GPU/Common/FramebufferManagerCommon.h +++ b/GPU/Common/FramebufferManagerCommon.h @@ -195,10 +195,10 @@ struct FramebufferHeuristicParams { int16_t scissorBottom; }; -struct GPUgstate; -extern GPUgstate gstate; +struct GEState; +extern GEState gstate; -void GetFramebufferHeuristicInputs(FramebufferHeuristicParams *params, const GPUgstate &gstate); +void GetFramebufferHeuristicInputs(FramebufferHeuristicParams *params, const GEState &gstate); enum BindFramebufferColorFlags { BINDFBCOLOR_SKIP_COPY = 0, diff --git a/GPU/Common/GPUDebugInterface.cpp b/GPU/Common/GPUDebugInterface.cpp index 32418754fc..959d6d7c72 100644 --- a/GPU/Common/GPUDebugInterface.cpp +++ b/GPU/Common/GPUDebugInterface.cpp @@ -621,7 +621,7 @@ bool GEExpressionFunctions::parseSymbol(char *str, uint32_t &symbolValue) { } uint32_t GEExpressionFunctions::getReferenceValue(uint32_t referenceIndex) { - GPUgstate state = gpu_->GetGState(); + GEState state = gpu_->GetGState(); if (referenceIndex < 0x100) { GECmdFormat fmt = GECmdInfoByCmd(GECommand(referenceIndex)).cmdFmt; uint32_t value = state.cmdmem[referenceIndex]; diff --git a/GPU/Common/GPUStateUtils.h b/GPU/Common/GPUStateUtils.h index 707d60c505..f43c95b3c7 100644 --- a/GPU/Common/GPUStateUtils.h +++ b/GPU/Common/GPUStateUtils.h @@ -59,7 +59,7 @@ bool NeedsTestDiscard(); bool IsDepthTestEffectivelyDisabled(); bool IsStencilTestOutputDisabled(); -inline bool CanForceBilinear(const GPUgstate &gstate) { +inline bool CanForceBilinear(const GEState &gstate) { return ((!gstate.isColorTestEnabled() || IsColorTestTriviallyTrue()) && (!gstate.isAlphaTestEnabled() || IsAlphaTestTriviallyTrue())); } diff --git a/GPU/Common/ShaderUniforms.cpp b/GPU/Common/ShaderUniforms.cpp index 89a61fed3d..ca27ff6628 100644 --- a/GPU/Common/ShaderUniforms.cpp +++ b/GPU/Common/ShaderUniforms.cpp @@ -254,7 +254,7 @@ void BoneUpdateUniforms(UB_VS_Bones *ub, uint64_t dirtyUniforms) { } } -void UpdateFogCoef(const GPUgstate &state, float fogCoef[2]) { +void UpdateFogCoef(const GEState &state, float fogCoef[2]) { fogCoef[0] = getFloat24(gstate.fog1); fogCoef[1] = getFloat24(gstate.fog2); // The PSP just ignores infnan here (ignoring IEEE), so take it down to a valid float. diff --git a/GPU/Common/ShaderUniforms.h b/GPU/Common/ShaderUniforms.h index 76413051aa..8d48cff974 100644 --- a/GPU/Common/ShaderUniforms.h +++ b/GPU/Common/ShaderUniforms.h @@ -123,10 +123,10 @@ void BoneUpdateUniforms(UB_VS_Bones *ub, uint64_t dirtyUniforms); uint32_t PackLightControlBits(); uint32_t PackDepalBits(); -void UpdateFogCoef(const GPUgstate &state, float fogCoef[2]); +void UpdateFogCoef(const GEState &state, float fogCoef[2]); // This happens so much that I want it inline. -inline void UpdateUVScaleOff(const GPUgstate &state, float uvScaleOff[4]) { +inline void UpdateUVScaleOff(const GEState &state, float uvScaleOff[4]) { float widthFactor; float heightFactor; if (gstate_c.textureIsFramebuffer) { diff --git a/GPU/Common/SoftwareTransformCommon.cpp b/GPU/Common/SoftwareTransformCommon.cpp index 9f9289c714..0c100d8c51 100644 --- a/GPU/Common/SoftwareTransformCommon.cpp +++ b/GPU/Common/SoftwareTransformCommon.cpp @@ -80,7 +80,7 @@ static void RotateUV(TransformedVertex v[4]) { } } -static bool ShouldApplySpriteBorderFix(const GPUgstate &gstate) { +static bool ShouldApplySpriteBorderFix(const GEState &gstate) { return gstate.isMagnifyFilteringEnabled() && gstate.isAlphaBlendEnabled() && gstate.getBlendFuncA() != GE_SRCBLEND_FIXA && gstate.isTextureAlphaUsed(); } @@ -407,7 +407,7 @@ SoftwareTransformAction RunSoftwareTransform(SoftwareTransformParams ¶ms, in // Modifies the vertices in-place. Applies viewport and projection. // TODO: SIMD. -static void ProjectVertices(const GPUgstate &gstate, TransformedVertex *transformed, int vertexCount) { +static void ProjectVertices(const GEState &gstate, TransformedVertex *transformed, int vertexCount) { #if 0 Lin::Vec3 vpOffset(gstate.getViewportXCenter(), gstate.getViewportYCenter(), gstate.getViewportZCenter()); Lin::Vec3 vpScale(gstate.getViewportXScale(), gstate.getViewportYScale(), gstate.getViewportZScale()); diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 6e85e362aa..579a25b5f4 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -2301,7 +2301,7 @@ static bool CanDepalettizeBufferAs(GETextureFormat texFormat, GEBufferFormat buf // But we only do it if the mask/shift exactly matches a color channel, else something different might be going // on and we definitely don't want to interpolate. // Great enhancement for Test Drive and Manhunt 2. -static bool CanUseSmoothDepal(const GPUgstate &gstate, GEBufferFormat framebufferFormat, const ClutTexture &clutTexture) { +static bool CanUseSmoothDepal(const GEState &gstate, GEBufferFormat framebufferFormat, const ClutTexture &clutTexture) { for (int i = 0; i < ClutTexture::MAX_RAMPS; i++) { if (gstate.getClutIndexStartPos() == clutTexture.rampStarts[i] && gstate.getClutIndexMask() < clutTexture.rampLengths[i]) { diff --git a/GPU/Debugger/Stepping.cpp b/GPU/Debugger/Stepping.cpp index 6710c7b7fc..9b5f155207 100644 --- a/GPU/Debugger/Stepping.cpp +++ b/GPU/Debugger/Stepping.cpp @@ -68,7 +68,7 @@ static bool lastWasFramebuffer; static u32 pauseSetCmdValue; // This is used only to highlight differences. Should really be owned by the debugger. -static GPUgstate lastGState; +static GEState lastGState; const char *PauseActionToString(PauseAction action) { switch (action) { @@ -291,7 +291,7 @@ bool GPU_FlushDrawing() { return true; } -const GPUgstate &LastState() { +const GEState &LastState() { return lastGState; } diff --git a/GPU/Debugger/Stepping.h b/GPU/Debugger/Stepping.h index cf02a0c39e..95ec53895a 100644 --- a/GPU/Debugger/Stepping.h +++ b/GPU/Debugger/Stepping.h @@ -47,5 +47,5 @@ namespace GPUStepping { bool GPU_FlushDrawing(); // Can be used to highlight differences in a debugger. - const GPUgstate &LastState(); + const GEState &LastState(); }; diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 4e6e416e57..36b1edd434 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -1707,7 +1707,7 @@ u32 GPUCommon::GetIndexAddress() { return gstate_c.indexAddr; } -const GPUgstate &GPUCommon::GetGState() { +const GEState &GPUCommon::GetGState() { return gstate; } diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 8178114656..af1553be34 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -30,7 +30,7 @@ class TextureCacheCommon; class DrawEngineCommon; class GraphicsContext; struct PspGeListArgs; -struct GPUgstate; +struct GEState; class PointerWrap; struct VirtualFramebuffer; @@ -221,7 +221,7 @@ public: u32 GetRelativeAddress(u32 data); u32 GetVertexAddress(); u32 GetIndexAddress(); - const GPUgstate &GetGState(); + const GEState &GetGState(); void SetCmdValue(u32 op); DisplayList* getList(int listid) { diff --git a/GPU/GPUState.cpp b/GPU/GPUState.cpp index b8323eada2..ccc970a32b 100644 --- a/GPU/GPUState.cpp +++ b/GPU/GPUState.cpp @@ -27,7 +27,7 @@ #include "GPU/GPUState.h" // This must be aligned so that the matrices within are aligned. -alignas(16) GPUgstate gstate; +alignas(16) GEState gstate; // Let's align this one too for good measure. alignas(16) GPUStateCache gstate_c; @@ -102,7 +102,7 @@ static const u32_le *LoadMatrix(const u32_le *cmds, float *mtx, int sz) { return cmds; } -void GPUgstate::Reset() { +void GEState::Reset() { memset(gstate.cmdmem, 0, sizeof(gstate.cmdmem)); for (int i = 0; i < 256; i++) { gstate.cmdmem[i] = i << 24; @@ -120,7 +120,7 @@ void GPUgstate::Reset() { gstate_c.Dirty(DIRTY_WORLD_VIEW_PROJ_MATRIX | DIRTY_VIEW_PROJ_MATRIX | DIRTY_CULL_MATRIX); } -void GPUgstate::Save(u32_le *ptr) { +void GEState::Save(u32_le *ptr) { // Not sure what the first 10 values are, exactly, but these seem right. ptr[5] = gstate_c.vertexAddr; ptr[6] = gstate_c.indexAddr; @@ -168,7 +168,7 @@ void GPUgstate::Save(u32_le *ptr) { } } -void GPUgstate::FastLoadBoneMatrix(u32 addr) { +void GEState::FastLoadBoneMatrix(u32 addr) { const u32 *src = (const u32 *)Memory::GetPointerUnchecked(addr); u32 num = boneMatrixNumber; u32 *dst = (u32 *)(boneMatrix + (num & 0x7F)); @@ -204,7 +204,7 @@ void GPUgstate::FastLoadBoneMatrix(u32 addr) { gstate.boneMatrixNumber = (GE_CMD_BONEMATRIXNUMBER << 24) | (num & 0x00FFFFFF); } -void GPUgstate::Restore(const u32_le *ptr) { +void GEState::Restore(const u32_le *ptr) { // Not sure what the first 10 values are, exactly, but these seem right. gstate_c.vertexAddr = ptr[5]; gstate_c.indexAddr = ptr[6]; diff --git a/GPU/GPUState.h b/GPU/GPUState.h index c86b71e19f..2da2e260c2 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -31,7 +31,7 @@ class PointerWrap; -struct GPUgstate { +struct GEState { // Getting rid of this ugly union in favor of the accessor functions // might be a good idea.... union { @@ -514,7 +514,7 @@ enum class SubmitType { SPLINE, }; -extern GPUgstate gstate; +extern GEState gstate; struct GPUStateCache { bool Use(u32 flags) const { return (useFlags_ & flags) != 0; } // Return true if ANY of flags are true. diff --git a/GPU/GPUStateSIMDUtil.h b/GPU/GPUStateSIMDUtil.h index 175944a60f..b7d956ac94 100644 --- a/GPU/GPUStateSIMDUtil.h +++ b/GPU/GPUStateSIMDUtil.h @@ -3,14 +3,14 @@ #include "Common/Math/CrossSIMD.h" #include "GPU/GPUState.h" -inline Vec4F32 LoadViewportOffsetVec(const GPUgstate &gstate) { +inline Vec4F32 LoadViewportOffsetVec(const GEState &gstate) { // We ignore the last member. return Vec4F32::LoadF24x4(&gstate.viewportxcenter); } -inline Vec4F32 LoadViewportScaleVec(const GPUgstate &gstate) { +inline Vec4F32 LoadViewportScaleVec(const GEState &gstate) { // We ignore the last member. return Vec4F32::LoadF24x4(&gstate.viewportxscale); } -inline Vec4F32 LoadUVScaleOffsetVec(const GPUgstate &gstate) { +inline Vec4F32 LoadUVScaleOffsetVec(const GEState &gstate) { return Vec4F32::LoadF24x4(&gstate.texscaleu); } diff --git a/UI/ImDebugger/ImGe.cpp b/UI/ImDebugger/ImGe.cpp index ff3890973d..00b3fecd65 100644 --- a/UI/ImDebugger/ImGe.cpp +++ b/UI/ImDebugger/ImGe.cpp @@ -1643,7 +1643,7 @@ void ImGeStateWindow::Draw(ImConfig &cfg, ImControl &control, GPUCommon *gpuDebu bool sectionOpen = false; for (size_t i = 0; i < numRows; i++) { const GECmdInfo &info = GECmdInfoByCmd(rows[i].cmd); - const GPUgstate &lastState = GPUStepping::LastState(); + const GEState &lastState = GPUStepping::LastState(); bool diff = lastState.cmdmem[rows[i].cmd] != gstate.cmdmem[rows[i].cmd]; if (rows[i].header) { diff --git a/Windows/GEDebugger/GEDebugger.cpp b/Windows/GEDebugger/GEDebugger.cpp index 3942d1d7ba..d39bf1ed87 100644 --- a/Windows/GEDebugger/GEDebugger.cpp +++ b/Windows/GEDebugger/GEDebugger.cpp @@ -377,7 +377,7 @@ void CGEDebugger::SetupPreviews() { } } -void CGEDebugger::DescribePrimaryPreview(const GPUgstate &state, char desc[256]) { +void CGEDebugger::DescribePrimaryPreview(const GEState &state, char desc[256]) { if (primaryTrackX_ < primaryBuffer_->GetStride() && primaryTrackY_ < primaryBuffer_->GetHeight()) { u32 pix = primaryBuffer_->GetRawPixel(primaryTrackX_, primaryTrackY_); DescribePixel(pix, primaryBuffer_->GetFormat(), primaryTrackX_, primaryTrackY_, desc); @@ -410,7 +410,7 @@ void CGEDebugger::DescribePrimaryPreview(const GPUgstate &state, char desc[256]) } } -void CGEDebugger::DescribeSecondPreview(const GPUgstate &state, char desc[256]) { +void CGEDebugger::DescribeSecondPreview(const GEState &state, char desc[256]) { if (secondTrackX_ != 0xFFFFFFFF) { uint32_t x = secondTrackX_; uint32_t y = secondTrackY_; @@ -557,7 +557,7 @@ void CGEDebugger::UpdatePreviews() { return; } - GPUgstate state{}; + GEState state{}; if (gpu != nullptr) { state = gpu->GetGState(); @@ -663,7 +663,7 @@ int CGEDebugger::HasTabIndex(GEDebuggerTab *tab, GETabPosition pos) { return -1; } -u32 CGEDebugger::TexturePreviewFlags(const GPUgstate &state) { +u32 CGEDebugger::TexturePreviewFlags(const GEState &state) { if (state.isTextureAlphaUsed() && !forceOpaque_) { return SimpleGLWindow::ALPHA_BLEND | SimpleGLWindow::RESIZE_BEST_CENTER; } else { @@ -671,7 +671,7 @@ u32 CGEDebugger::TexturePreviewFlags(const GPUgstate &state) { } } -void CGEDebugger::UpdatePrimaryPreview(const GPUgstate &state) { +void CGEDebugger::UpdatePrimaryPreview(const GEState &state) { bool bufferResult = false; u32 flags = SimpleGLWindow::ALPHA_IGNORE | SimpleGLWindow::RESIZE_SHRINK_CENTER; @@ -724,7 +724,7 @@ void CGEDebugger::UpdatePrimaryPreview(const GPUgstate &state) { } } -void CGEDebugger::UpdateSecondPreview(const GPUgstate &state) { +void CGEDebugger::UpdateSecondPreview(const GEState &state) { bool bufferResult = false; SetupPreviews(); @@ -784,7 +784,7 @@ void CGEDebugger::PrimaryPreviewHover(int x, int y) { desc[0] = 0; } else if (x < 0 || y < 0) { // This means they left the area. - GPUgstate state{}; + GEState state{}; if (gpu != nullptr) { state = gpu->GetGState(); } @@ -812,7 +812,7 @@ void CGEDebugger::SecondPreviewHover(int x, int y) { desc[0] = 0; } else if (x < 0 || y < 0) { // This means they left the area. - GPUgstate state{}; + GEState state{}; if (gpu != nullptr) { state = gpu->GetGState(); } @@ -834,7 +834,7 @@ void CGEDebugger::SecondPreviewHover(int x, int y) { } void CGEDebugger::UpdateTextureLevel(int level) { - GPUgstate state{}; + GEState state{}; if (gpu != nullptr) { state = gpu->GetGState(); } diff --git a/Windows/GEDebugger/GEDebugger.h b/Windows/GEDebugger/GEDebugger.h index 2f908025c4..34c692a362 100644 --- a/Windows/GEDebugger/GEDebugger.h +++ b/Windows/GEDebugger/GEDebugger.h @@ -43,7 +43,7 @@ class TabStateSettings; class TabVertices; class TabMatrices; class TabStateWatch; -struct GPUgstate; +struct GEState; enum class GETabPosition { LEFT = 1, @@ -100,8 +100,8 @@ protected: private: void SetupPreviews(); void UpdatePreviews(); - void UpdatePrimaryPreview(const GPUgstate &state); - void UpdateSecondPreview(const GPUgstate &state); + void UpdatePrimaryPreview(const GEState &state); + void UpdateSecondPreview(const GEState &state); static u32 PrimPreviewOp(); void UpdatePrimPreview(u32 op, int which); void CleanupPrimPreview(); @@ -109,8 +109,8 @@ private: void UpdateSize(WORD width, WORD height); void SavePosition(); void UpdateTextureLevel(int level); - void DescribePrimaryPreview(const GPUgstate &state, char desc[256]); - void DescribeSecondPreview(const GPUgstate &state, char desc[256]); + void DescribePrimaryPreview(const GEState &state, char desc[256]); + void DescribeSecondPreview(const GEState &state, char desc[256]); void PrimaryPreviewHover(int x, int y); void SecondPreviewHover(int x, int y); void PreviewExport(const GPUDebugBuffer *buffer); @@ -122,7 +122,7 @@ private: int HasTabIndex(GEDebuggerTab *tab, GETabPosition pos); void CheckTabMessage(TabControl *t, GETabPosition pos, LPARAM lParam); - u32 TexturePreviewFlags(const GPUgstate &state); + u32 TexturePreviewFlags(const GEState &state); SimpleGLWindow *primaryWindow = nullptr; SimpleGLWindow *secondWindow = nullptr; diff --git a/Windows/GEDebugger/TabVertices.cpp b/Windows/GEDebugger/TabVertices.cpp index 799f8a15b2..feecf3b626 100644 --- a/Windows/GEDebugger/TabVertices.cpp +++ b/Windows/GEDebugger/TabVertices.cpp @@ -328,7 +328,7 @@ bool CtrlMatrixList::OnColPrePaint(int row, int col, LPNMLVCUSTOMDRAW msg) { return false; } -bool CtrlMatrixList::ColChanged(const GPUgstate &lastState, const GPUgstate &state, int row, int col) { +bool CtrlMatrixList::ColChanged(const GEState &lastState, const GEState &state, int row, int col) { union { float f; uint32_t u; @@ -340,7 +340,7 @@ bool CtrlMatrixList::ColChanged(const GPUgstate &lastState, const GPUgstate &sta return newVal.u != oldVal.u; } -bool CtrlMatrixList::GetValue(const GPUgstate &state, int row, int col, float &val) { +bool CtrlMatrixList::GetValue(const GEState &state, int row, int col, float &val) { if (!gpu || row < 0 || row >= MATRIXLIST_ROW_COUNT || col < 0 || col >= MATRIXLIST_COL_COUNT) return false; diff --git a/Windows/GEDebugger/TabVertices.h b/Windows/GEDebugger/TabVertices.h index c39824642b..cd873a66be 100644 --- a/Windows/GEDebugger/TabVertices.h +++ b/Windows/GEDebugger/TabVertices.h @@ -83,8 +83,8 @@ protected: bool OnColPrePaint(int row, int col, LPNMLVCUSTOMDRAW msg) override; private: - bool GetValue(const GPUgstate &state, int row, int col, float &val); - bool ColChanged(const GPUgstate &lastState, const GPUgstate &state, int row, int col); + bool GetValue(const GEState &state, int row, int col, float &val); + bool ColChanged(const GEState &lastState, const GEState &state, int row, int col); void ToggleBreakpoint(int row); void PromptBreakpointCond(int row); };