[sprite glow] fix crashes (#2256)

Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
This commit is contained in:
water111 2023-02-25 20:21:42 -05:00 committed by GitHub
parent 618455500d
commit 41fabd43f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -409,7 +409,8 @@ void GlowRenderer::add_sprite_pass_3(const SpriteGlowOutput& data, int sprite_id
// handle adgif stuff
{
ASSERT(data.adgif.tex0_addr == (u32)GsRegisterAddress::TEX0_1);
// don't check upper bits: ps2 GS ignores them and ND uses them as flags.
ASSERT((u8)data.adgif.tex0_addr == (u8)GsRegisterAddress::TEX0_1);
GsTex0 reg(data.adgif.tex0_data);
record.tbp = reg.tbp0();
record.draw_mode.set_tcc(reg.tcc());

View file

@ -73,7 +73,9 @@ class GlowRenderer {
GLuint tex;
};
static constexpr int kDownsampleBatchWidth = 16;
// max sprites should be 128 in simple sprite, plus 256 from aux = 384
// 20 width = 20 * 20 = 400 sprites > 384.
static constexpr int kDownsampleBatchWidth = 20;
static constexpr int kMaxSprites = kDownsampleBatchWidth * kDownsampleBatchWidth;
static constexpr int kMaxVertices = kMaxSprites * 32; // check.
static constexpr int kMaxIndices = kMaxSprites * 32; // check.