mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-12-24 04:32:36 +00:00
Align memory to 16 when giving out vram for textures and buffers
This commit is contained in:
committed by
Wouter Wijsman
parent
9caeefe9e9
commit
28c294881d
@@ -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)
|
||||
{
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user