Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash in levelshot command #264

Merged
merged 3 commits into from
May 26, 2024

Conversation

zturtleman
Copy link
Contributor

@zturtleman zturtleman commented May 24, 2024

This fixes the game crashing in opengl1 and OpenGL2 renderers when running the levelshot command. It also fixes incorrect usage of memory alignment handling for source and resample buffers from my ioq3 PR this is based on.

Fixes #256.

Setting packAlign was removed [1] and later set to 0 [2] and this caused
PADP( ..., 0 ) to return NULL which later gets passed to R_GammaCorrect()
and crashed.

It seems I left packAlign in my PNG/levelshot changes [3] even though
it's not needed in R_LevelShot().

Set packAlign to 1 which is single byte alignment and doesn't allocate
additional memory. PADP( ..., 1 ) returns the same address and it
doesn't crash later.

1: b514a01
2: 688f4f5
3: ioquake/ioq3#262
Fix using offset for source returned by RB_ReadPixels(). In practice
this shouldn't be an issue because Hunk_AllocateTempMemory() should
already be aligned to sizeof(intptr_t).
Filling the resample buffer didn't correctly handle offset for packAlign
if it didn't match the alignment returned by Hunk_AllocateTempMemory().

There isn't SIMD or something that the code wants a specific alignment.
Hunk_AllocateTempMemory() is aligned to sizeof(intptr_t) anyway so there
isn't a reason to add a memory alignment here.
@kai-li-wop kai-li-wop added the bug Something isn't working label May 26, 2024
@kai-li-wop kai-li-wop added this to the v1.7.0 milestone May 26, 2024
@kai-li-wop kai-li-wop merged commit f957138 into PadWorld-Entertainment:main May 26, 2024
5 of 6 checks passed
@zturtleman zturtleman deleted the fix_levelshot branch May 27, 2024 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Using command "screenshot levelshot" leads to a full crash
2 participants