Textures: micro-optimization
This commit is contained in:
parent
21452fe6ee
commit
6243cc830d
@ -4,11 +4,12 @@
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
void* data;
|
void* data;
|
||||||
size_t size;
|
|
||||||
|
GPU_TEXCOLOR fmt : 4;
|
||||||
|
size_t size : 28;
|
||||||
|
|
||||||
u16 width, height;
|
u16 width, height;
|
||||||
u32 param;
|
u32 param;
|
||||||
GPU_TEXCOLOR fmt;
|
|
||||||
} C3D_Tex;
|
} C3D_Tex;
|
||||||
|
|
||||||
bool C3D_TexInit(C3D_Tex* tex, int width, int height, GPU_TEXCOLOR format);
|
bool C3D_TexInit(C3D_Tex* tex, int width, int height, GPU_TEXCOLOR format);
|
||||||
|
@ -22,17 +22,18 @@ bool C3D_TexInit(C3D_Tex* tex, int width, int height, GPU_TEXCOLOR format)
|
|||||||
{
|
{
|
||||||
if (tex->data) return false;
|
if (tex->data) return false;
|
||||||
|
|
||||||
tex->size = fmtSize(format);
|
u32 size = fmtSize(format);
|
||||||
if (!tex->size) return false;
|
if (!size) return false;
|
||||||
tex->size *= width * height;
|
size *= width * height;
|
||||||
|
|
||||||
tex->data = linearMemAlign(tex->size, 0x80);
|
tex->data = linearMemAlign(size, 0x80);
|
||||||
if (!tex->data) return false;
|
if (!tex->data) return false;
|
||||||
|
|
||||||
tex->width = width;
|
tex->width = width;
|
||||||
tex->height = height;
|
tex->height = height;
|
||||||
tex->param = GPU_TEXTURE_MAG_FILTER(GPU_NEAREST) | GPU_TEXTURE_MIN_FILTER(GPU_NEAREST);
|
tex->param = GPU_TEXTURE_MAG_FILTER(GPU_NEAREST) | GPU_TEXTURE_MIN_FILTER(GPU_NEAREST);
|
||||||
tex->fmt = format;
|
tex->fmt = format;
|
||||||
|
tex->size = size;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user