Cleanup dead and duplicate code

This commit is contained in:
Ivan Epifanov 2021-06-10 12:14:14 +03:00 committed by Ryan C. Gordon
parent c2b8b55634
commit a4442476df
3 changed files with 1 additions and 40 deletions

View File

@ -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);
}
free_gxm_texture(vita_texture->tex);
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);
}
mem_gpu_free(vita_texture->tex->data_UID);
SDL_free(vita_texture->tex);
SDL_free(vita_texture);
texture->driverdata = NULL;

View File

@ -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);

View File

@ -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;