mirror of https://github.com/mgba-emu/mgba.git
3DS: Allocate memory for textures in VRAM
This commit is contained in:
parent
58f97980e7
commit
a623bcadc3
|
@ -26,18 +26,20 @@ struct GUIFont* GUIFontCreate(void) {
|
||||||
|
|
||||||
struct ctrTexture* tex = &guiFont->texture;
|
struct ctrTexture* tex = &guiFont->texture;
|
||||||
ctrTexture_Init(tex);
|
ctrTexture_Init(tex);
|
||||||
tex->data = linearAlloc(256 * 128 * 2);
|
tex->data = vramAlloc(256 * 128 * 2);
|
||||||
tex->format = GPU_RGBA5551;
|
tex->format = GPU_RGBA5551;
|
||||||
tex->width = 256;
|
tex->width = 256;
|
||||||
tex->height = 128;
|
tex->height = 128;
|
||||||
memcpy(tex->data, font, font_size);
|
|
||||||
GSPGPU_FlushDataCache(NULL, tex->data, font_size);
|
GSPGPU_FlushDataCache(NULL, (u8*)font, font_size);
|
||||||
|
GX_RequestDma(NULL, (u32*)font, tex->data, font_size);
|
||||||
|
gspWaitForDMA();
|
||||||
|
|
||||||
return guiFont;
|
return guiFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIFontDestroy(struct GUIFont* font) {
|
void GUIFontDestroy(struct GUIFont* font) {
|
||||||
linearFree(font->texture.data);
|
vramFree(font->texture.data);
|
||||||
free(font);
|
free(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -363,8 +363,14 @@ int main() {
|
||||||
gbaOutputTexture.filter = GPU_LINEAR;
|
gbaOutputTexture.filter = GPU_LINEAR;
|
||||||
gbaOutputTexture.width = 256;
|
gbaOutputTexture.width = 256;
|
||||||
gbaOutputTexture.height = 256;
|
gbaOutputTexture.height = 256;
|
||||||
gbaOutputTexture.data = linearAlloc(256 * 256 * 2);
|
gbaOutputTexture.data = vramAlloc(256 * 256 * 2);
|
||||||
memset(gbaOutputTexture.data, 0, 256 * 256 * 2);
|
void* outputTextureEnd = (u8*)gbaOutputTexture.data + 256 * 256 * 2;
|
||||||
|
|
||||||
|
// Zero texture data to make sure no garbage around the border interferes with filtering
|
||||||
|
GX_SetMemoryFill(NULL,
|
||||||
|
gbaOutputTexture.data, 0x0000, outputTextureEnd, GX_FILL_16BIT_DEPTH | GX_FILL_TRIGGER,
|
||||||
|
NULL, 0, NULL, 0);
|
||||||
|
gspWaitForPSC0();
|
||||||
|
|
||||||
sdmcArchive = (FS_archive) {
|
sdmcArchive = (FS_archive) {
|
||||||
ARCH_SDMC,
|
ARCH_SDMC,
|
||||||
|
@ -410,7 +416,7 @@ cleanup:
|
||||||
linearFree(renderer.outputBuffer);
|
linearFree(renderer.outputBuffer);
|
||||||
|
|
||||||
ctrDeinitGpu();
|
ctrDeinitGpu();
|
||||||
linearFree(gbaOutputTexture.data);
|
vramFree(gbaOutputTexture.data);
|
||||||
|
|
||||||
gfxExit();
|
gfxExit();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue