softgpu: Restrict CLUT to proper size.

We had 15 KB more space than needed before.
This commit is contained in:
Unknown W. Brackets 2022-08-20 17:36:15 -07:00
parent 229c944208
commit 3d52b445f1
3 changed files with 7 additions and 4 deletions

View File

@ -1408,7 +1408,7 @@ bool GetCurrentTexture(GPUDebugBuffer &buffer, int level)
SamplerID id;
ComputeSamplerID(&id);
id.cached.clut = (const u8 *)clut;
id.cached.clut = clut;
Sampler::FetchFunc sampler = Sampler::GetFetchFunc(id);

View File

@ -52,7 +52,7 @@
const int FB_WIDTH = 480;
const int FB_HEIGHT = 272;
u32 clut[4096];
uint8_t clut[1024];
FormatBuffer fb;
FormatBuffer depthbuf;
@ -971,7 +971,10 @@ void SoftGPU::Execute_Spline(u32 op, u32 diff) {
void SoftGPU::Execute_LoadClut(u32 op, u32 diff) {
u32 clutAddr = gstate.getClutAddress();
u32 clutTotalBytes = gstate.getClutLoadBytes();
// Avoid the hack in getClutLoadBytes() to inaccurately allow more palette data.
u32 clutTotalBytes = (gstate.getClutLoadBlocks() & 0x3F) * 32;
if (clutTotalBytes > 1024)
clutTotalBytes = 1024;
// Might be copying drawing into the CLUT, so flush.
drawEngine_->transformUnit.FlushIfOverlap("loadclut", clutAddr, clutTotalBytes, clutTotalBytes, 1);

View File

@ -216,7 +216,7 @@ private:
};
// TODO: These shouldn't be global.
extern u32 clut[4096];
extern uint8_t clut[1024];
extern FormatBuffer fb;
extern FormatBuffer depthbuf;