Rename GPUgstate to GEState

This commit is contained in:
Henrik Rydgård
2026-06-30 16:24:15 +02:00
parent 35e21dead8
commit 1b2f87bf1a
20 changed files with 48 additions and 48 deletions
+1 -1
View File
@@ -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();
+3 -3
View File
@@ -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,
+1 -1
View File
@@ -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];
+1 -1
View File
@@ -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()));
}
+1 -1
View File
@@ -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.
+2 -2
View File
@@ -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) {
+2 -2
View File
@@ -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 &params, 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());
+1 -1
View File
@@ -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]) {
+2 -2
View File
@@ -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;
}
+1 -1
View File
@@ -47,5 +47,5 @@ namespace GPUStepping {
bool GPU_FlushDrawing();
// Can be used to highlight differences in a debugger.
const GPUgstate &LastState();
const GEState &LastState();
};
+1 -1
View File
@@ -1707,7 +1707,7 @@ u32 GPUCommon::GetIndexAddress() {
return gstate_c.indexAddr;
}
const GPUgstate &GPUCommon::GetGState() {
const GEState &GPUCommon::GetGState() {
return gstate;
}
+2 -2
View File
@@ -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) {
+5 -5
View File
@@ -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];
+2 -2
View File
@@ -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.
+3 -3
View File
@@ -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);
}
+1 -1
View File
@@ -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) {
+9 -9
View File
@@ -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();
}
+6 -6
View File
@@ -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;
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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);
};