Skip to content

Commit

Permalink
Use define to set alignment for vram assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkwouter committed Dec 4, 2024
1 parent 28c2948 commit a79285c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gu/vram.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
#include <pspge.h>
#include <pspgu.h>

#define ALIGNMENT 16

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 @@ -40,7 +41,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);
staticOffset = (staticOffset + (ALIGNMENT-1)) &~ (ALIGNMENT-1);
void* result = (void*)staticOffset;
staticOffset += memSize;

Expand Down

0 comments on commit a79285c

Please sign in to comment.