Cleanup dead and duplicate code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c
index f346cc6..9376d12 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm.c
+++ b/src/render/vitagxm/SDL_render_vita_gxm.c
@@ -1144,20 +1144,8 @@ VITA_GXM_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
sceGxmFinish(data->gxm_context);
- if (vita_texture->tex->gxm_rendertarget) {
- sceGxmDestroyRenderTarget(vita_texture->tex->gxm_rendertarget);
- }
-
- if (vita_texture->tex->depth_UID) {
- mem_gpu_free(vita_texture->tex->depth_UID);
- }
-
- if (vita_texture->tex->palette_UID) {
- mem_gpu_free(vita_texture->tex->palette_UID);
- }
+ free_gxm_texture(vita_texture->tex);
- mem_gpu_free(vita_texture->tex->data_UID);
- SDL_free(vita_texture->tex);
SDL_free(vita_texture);
texture->driverdata = NULL;
diff --git a/src/render/vitagxm/SDL_render_vita_gxm_tools.c b/src/render/vitagxm/SDL_render_vita_gxm_tools.c
index 349e48f..3ce7c14 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm_tools.c
+++ b/src/render/vitagxm/SDL_render_vita_gxm_tools.c
@@ -1001,9 +1001,6 @@ free_gxm_texture(gxm_texture *texture)
if (texture->depth_UID) {
mem_gpu_free(texture->depth_UID);
}
- if (texture->palette_UID) {
- mem_gpu_free(texture->palette_UID);
- }
mem_gpu_free(texture->data_UID);
SDL_free(texture);
}
@@ -1070,29 +1067,6 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc
/* Create the gxm texture */
sceGxmTextureInitLinear( &texture->gxm_tex, texture_data, format, w, h, 0);
- if ((format & 0x9f000000U) == SCE_GXM_TEXTURE_BASE_FORMAT_P8) {
- const int pal_size = 256 * sizeof(uint32_t);
-
- void *texture_palette = mem_gpu_alloc(
- SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW,
- pal_size,
- SCE_GXM_PALETTE_ALIGNMENT,
- SCE_GXM_MEMORY_ATTRIB_READ,
- &texture->palette_UID);
-
- if (!texture_palette) {
- texture->palette_UID = 0;
- free_gxm_texture(texture);
- return NULL;
- }
-
- SDL_memset(texture_palette, 0, pal_size);
-
- sceGxmTextureSetPalette(&texture->gxm_tex, texture_palette);
- } else {
- texture->palette_UID = 0;
- }
-
if (isRenderTarget) {
void *depthBufferData;
const uint32_t alignedWidth = ALIGN(w, SCE_GXM_TILE_SIZEX);
diff --git a/src/render/vitagxm/SDL_render_vita_gxm_types.h b/src/render/vitagxm/SDL_render_vita_gxm_types.h
index fa146ac..d1cb249 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm_types.h
+++ b/src/render/vitagxm/SDL_render_vita_gxm_types.h
@@ -76,7 +76,6 @@ typedef struct texture_vertex {
typedef struct gxm_texture {
SceGxmTexture gxm_tex;
SceUID data_UID;
- SceUID palette_UID;
SceGxmRenderTarget *gxm_rendertarget;
SceGxmColorSurface gxm_colorsurface;
SceGxmDepthStencilSurface gxm_depthstencil;