Skip to content

Commit

Permalink
Align memory to 16 when giving out vram for textures and buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkwouter committed Dec 4, 2024
1 parent 9caeefe commit 28c2948
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gu/vram.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <pspgu.h>

static unsigned int staticOffset = 0;
static const unsigned int alignment = 16;

static unsigned int getMemorySize(unsigned int width, unsigned int height, unsigned int psm)
{
Expand Down Expand Up @@ -39,6 +40,7 @@ static unsigned int getMemorySize(unsigned int width, unsigned int height, unsig
void* guGetStaticVramBuffer(unsigned int width, unsigned int height, unsigned int psm)
{
unsigned int memSize = getMemorySize(width,height,psm);
staticOffset = (staticOffset + (alignment-1)) &~ (alignment-1);
void* result = (void*)staticOffset;
staticOffset += memSize;

Expand Down

0 comments on commit 28c2948

Please sign in to comment.