From 7080bc2a91f2290120d31f2ad0bc6a36c8a54837 Mon Sep 17 00:00:00 2001 From: Northfear <11291116+Northfear@users.noreply.github.com> Date: Mon, 20 Sep 2021 23:02:01 +0300 Subject: [PATCH] Fallback to SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE if CDRAM texture allocation fails --- src/render/vitagxm/SDL_render_vita_gxm_tools.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/render/vitagxm/SDL_render_vita_gxm_tools.c b/src/render/vitagxm/SDL_render_vita_gxm_tools.c index 2190b66de..f4133a9d9 100644 --- a/src/render/vitagxm/SDL_render_vita_gxm_tools.c +++ b/src/render/vitagxm/SDL_render_vita_gxm_tools.c @@ -1027,6 +1027,18 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc &texture->data_UID ); + /* Try SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE in case we're out of VRAM */ + if (!texture_data) { + SDL_LogWarn(SDL_LOG_CATEGORY_RENDER, "CDRAM texture allocation failed\n"); + texture_data = mem_gpu_alloc( + SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, + tex_size, + SCE_GXM_TEXTURE_ALIGNMENT, + SCE_GXM_MEMORY_ATTRIB_READ | SCE_GXM_MEMORY_ATTRIB_WRITE, + &texture->data_UID + ); + } + if (!texture_data) { free(texture); return NULL;