Skip to content

Commit 28c2948

Browse files
committed
Align memory to 16 when giving out vram for textures and buffers
1 parent 9caeefe commit 28c2948

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/gu/vram.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <pspgu.h>
1111

1212
static unsigned int staticOffset = 0;
13+
static const unsigned int alignment = 16;
1314

1415
static unsigned int getMemorySize(unsigned int width, unsigned int height, unsigned int psm)
1516
{
@@ -39,6 +40,7 @@ static unsigned int getMemorySize(unsigned int width, unsigned int height, unsig
3940
void* guGetStaticVramBuffer(unsigned int width, unsigned int height, unsigned int psm)
4041
{
4142
unsigned int memSize = getMemorySize(width,height,psm);
43+
staticOffset = (staticOffset + (alignment-1)) &~ (alignment-1);
4244
void* result = (void*)staticOffset;
4345
staticOffset += memSize;
4446

0 commit comments

Comments
 (0)