(Vita) Fix duplicate symbols with some cores

This commit is contained in:
Francisco José García García 2019-12-15 11:02:34 +01:00
parent 42aa83b2a5
commit 0545c42db9
6 changed files with 38 additions and 38 deletions

View File

@ -79,8 +79,8 @@ void glDeleteFramebuffers(GLsizei n, GLuint *framebuffers) {
fb->target = NULL;
}
if (fb->depth_buffer_addr) {
mempool_free(fb->depth_buffer_addr, fb->depth_buffer_mem_type);
mempool_free(fb->stencil_buffer_addr, fb->stencil_buffer_mem_type);
vitagl_mempool_free(fb->depth_buffer_addr, fb->depth_buffer_mem_type);
vitagl_mempool_free(fb->stencil_buffer_addr, fb->stencil_buffer_mem_type);
fb->depth_buffer_addr = NULL;
fb->stencil_buffer_addr = NULL;
}

View File

@ -128,9 +128,9 @@ void initGxmContext(void) {
void termGxmContext(void) {
// Deallocating ring buffers
mempool_free(vdm_ring_buffer_addr, VGL_MEM_VRAM);
mempool_free(vertex_ring_buffer_addr, VGL_MEM_VRAM);
mempool_free(fragment_ring_buffer_addr, VGL_MEM_VRAM);
vitagl_mempool_free(vdm_ring_buffer_addr, VGL_MEM_VRAM);
vitagl_mempool_free(vertex_ring_buffer_addr, VGL_MEM_VRAM);
vitagl_mempool_free(fragment_ring_buffer_addr, VGL_MEM_VRAM);
gpu_fragment_usse_free_mapped(fragment_usse_ring_buffer_addr);
// Destroying sceGxm context
@ -188,7 +188,7 @@ void termDisplayColorSurfaces(void) {
// Deallocating display's color surfaces and destroying sync objects
int i;
for (i = 0; i < DISPLAY_BUFFER_COUNT; i++) {
mempool_free(gxm_color_surfaces_addr[i], VGL_MEM_VRAM);
vitagl_mempool_free(gxm_color_surfaces_addr[i], VGL_MEM_VRAM);
sceGxmSyncObjectDestroy(gxm_sync_objects[i]);
}
}
@ -227,8 +227,8 @@ void initDepthStencilSurfaces(void) {
void termDepthStencilSurfaces(void) {
// Deallocating depth and stencil surfaces memblocks
mempool_free(gxm_depth_surface_addr, VGL_MEM_VRAM);
mempool_free(gxm_stencil_surface_addr, VGL_MEM_VRAM);
vitagl_mempool_free(gxm_depth_surface_addr, VGL_MEM_VRAM);
vitagl_mempool_free(gxm_stencil_surface_addr, VGL_MEM_VRAM);
}
void startShaderPatcher(void) {
@ -282,7 +282,7 @@ void stopShaderPatcher(void) {
sceGxmShaderPatcherDestroy(gxm_shader_patcher);
// Freeing shader patcher buffers
mempool_free(gxm_shader_patcher_buffer_addr, VGL_MEM_VRAM);
vitagl_mempool_free(gxm_shader_patcher_buffer_addr, VGL_MEM_VRAM);
gpu_vertex_usse_free_mapped(gxm_shader_patcher_vertex_usse_addr);
gpu_fragment_usse_free_mapped(gxm_shader_patcher_fragment_usse_addr);
}

View File

@ -15,18 +15,18 @@ static unsigned int pool_size = 0;
void *gpu_alloc_mapped(size_t size, vglMemType *type) {
// Allocating requested memblock
void *res = mempool_alloc(size, *type);
void *res = vitagl_mempool_alloc(size, *type);
// Requested memory type finished, using other one
if (res == NULL) {
*type = use_vram ? VGL_MEM_RAM : VGL_MEM_VRAM;
res = mempool_alloc(size, *type);
res = vitagl_mempool_alloc(size, *type);
}
// Even the other one failed, using our last resort
if (res == NULL) {
*type = VGL_MEM_SLOW;
res = mempool_alloc(size, *type);
res = vitagl_mempool_alloc(size, *type);
}
if (res == NULL) {
@ -39,7 +39,7 @@ void *gpu_alloc_mapped(size_t size, vglMemType *type) {
void *gpu_vertex_usse_alloc_mapped(size_t size, unsigned int *usse_offset) {
// Allocating memblock
void *addr = mempool_alloc(size, VGL_MEM_RAM);
void *addr = vitagl_mempool_alloc(size, VGL_MEM_RAM);
// Mapping memblock into sceGxm as vertex USSE memory
sceGxmMapVertexUsseMemory(addr, size, usse_offset);
@ -53,12 +53,12 @@ void gpu_vertex_usse_free_mapped(void *addr) {
sceGxmUnmapVertexUsseMemory(addr);
// Deallocating memblock
mempool_free(addr, VGL_MEM_RAM);
vitagl_mempool_free(addr, VGL_MEM_RAM);
}
void *gpu_fragment_usse_alloc_mapped(size_t size, unsigned int *usse_offset) {
// Allocating memblock
void *addr = mempool_alloc(size, VGL_MEM_RAM);
void *addr = vitagl_mempool_alloc(size, VGL_MEM_RAM);
// Mapping memblock into sceGxm as fragment USSE memory
sceGxmMapFragmentUsseMemory(addr, size, usse_offset);
@ -72,7 +72,7 @@ void gpu_fragment_usse_free_mapped(void *addr) {
sceGxmUnmapFragmentUsseMemory(addr);
// Deallocating memblock
mempool_free(addr, VGL_MEM_RAM);
vitagl_mempool_free(addr, VGL_MEM_RAM);
}
void *gpu_pool_malloc(unsigned int size) {
@ -166,7 +166,7 @@ palette *gpu_alloc_palette(const void *data, uint32_t w, uint32_t bpe) {
void gpu_free_texture(texture *tex) {
// Deallocating texture
if (tex->data != NULL)
mempool_free(tex->data, tex->mtype);
vitagl_mempool_free(tex->data, tex->mtype);
// Invalidating texture object
tex->valid = 0;
@ -325,6 +325,6 @@ void gpu_free_palette(palette *pal) {
// Deallocating palette memblock and object
if (pal == NULL)
return;
mempool_free(pal->data, pal->type);
vitagl_mempool_free(pal->data, pal->type);
free(pal);
}

View File

@ -238,7 +238,7 @@ static void heap_free(void *addr) {
heap_blk_free((uintptr_t)addr);
}
void mem_term(void) {
void vitagl_mem_term(void) {
heap_destroy();
if (mempool_addr[0] != NULL) {
sceKernelFreeMemBlock(mempool_id[0]);
@ -250,9 +250,9 @@ void mem_term(void) {
}
}
int mem_init(size_t size_ram, size_t size_cdram, size_t size_phycont) {
int vitagl_mem_init(size_t size_ram, size_t size_cdram, size_t size_phycont) {
if (mempool_addr[0] != NULL)
mem_term();
vitagl_mem_term();
mempool_size[0] = ALIGN(size_cdram, 256 * 1024);
mempool_size[1] = ALIGN(size_ram, 4 * 1024);
@ -277,14 +277,14 @@ int mem_init(size_t size_ram, size_t size_cdram, size_t size_phycont) {
return 1;
}
void mempool_free(void *ptr, vglMemType type) {
void vitagl_mempool_free(void *ptr, vglMemType type) {
if (type == VGL_MEM_EXTERNAL)
free(ptr);
else
heap_free(ptr); // type is already stored in heap for alloc'd blocks
}
void *mempool_alloc(size_t size, vglMemType type) {
void *vitagl_mempool_alloc(size_t size, vglMemType type) {
void *res = NULL;
if (size <= tm_free[type])
res = heap_alloc(type, size, MEM_ALIGNMENT);
@ -292,6 +292,6 @@ void *mempool_alloc(size_t size, vglMemType type) {
}
// Returns currently free space on mempool
size_t mempool_get_free_space(vglMemType type) {
size_t vitagl_mempool_get_free_space(vglMemType type) {
return tm_free[type];
}

View File

@ -6,10 +6,10 @@
#ifndef _MEM_UTILS_H_
#define _MEM_UTILS_H_
int mem_init(size_t size_ram, size_t size_cdram, size_t size_phycont); // Initialize mempools
void mem_term(void); // Terminate both CDRAM and RAM mempools
size_t mempool_get_free_space(vglMemType type); // Return free space in bytes for a mempool
void *mempool_alloc(size_t size, vglMemType type); // Allocate a memory block on a mempool
void mempool_free(void *ptr, vglMemType type); // Free a memory block on a mempool
int vitagl_mem_init(size_t size_ram, size_t size_cdram, size_t size_phycont); // Initialize mempools
void vitagl_mem_term(void); // Terminate both CDRAM and RAM mempools
size_t vitagl_mempool_get_free_space(vglMemType type); // Return free space in bytes for a mempool
void *vitagl_mempool_alloc(size_t size, vglMemType type); // Allocate a memory block on a mempool
void vitagl_mempool_free(void *ptr, vglMemType type); // Free a memory block on a mempool
#endif

View File

@ -211,7 +211,7 @@ void vglInitExtended(uint32_t gpu_pool_size, int width, int height, int ram_thre
sceKernelGetFreeMemorySize(&info);
// Initializing memory heap for CDRAM and RAM memory
mem_init(info.size_user - ram_threshold, info.size_cdram - 1 * 1024 * 1024, info.size_phycont - 1 * 1024 * 1024); // leave some just in case
vitagl_mem_init(info.size_user - ram_threshold, info.size_cdram - 1 * 1024 * 1024, info.size_phycont - 1 * 1024 * 1024); // leave some just in case
// Initializing sceGxm context
initGxmContext();
@ -642,10 +642,10 @@ void vglEnd(void) {
waitRenderingDone();
// Deallocating default vertices buffers
mempool_free(clear_vertices, VGL_MEM_RAM);
mempool_free(depth_vertices, VGL_MEM_RAM);
mempool_free(depth_clear_indices, VGL_MEM_RAM);
mempool_free(scissor_test_vertices, VGL_MEM_RAM);
vitagl_mempool_free(clear_vertices, VGL_MEM_RAM);
vitagl_mempool_free(depth_vertices, VGL_MEM_RAM);
vitagl_mempool_free(depth_clear_indices, VGL_MEM_RAM);
vitagl_mempool_free(scissor_test_vertices, VGL_MEM_RAM);
// Releasing shader programs from sceGxmShaderPatcher
sceGxmShaderPatcherReleaseFragmentProgram(gxm_shader_patcher, scissor_test_fragment_program);
@ -744,7 +744,7 @@ void glDeleteBuffers(GLsizei n, const GLuint *gl_buffers) {
uint8_t idx = gl_buffers[j] - BUFFERS_ADDR;
buffers[idx] = gl_buffers[j];
if (gpu_buffers[idx].ptr != NULL) {
mempool_free(gpu_buffers[idx].ptr, VGL_MEM_VRAM);
vitagl_mempool_free(gpu_buffers[idx].ptr, VGL_MEM_VRAM);
gpu_buffers[idx].ptr = NULL;
}
}
@ -2096,15 +2096,15 @@ void vglDrawObjects(GLenum mode, GLsizei count, GLboolean implicit_wvp) {
size_t vglMemFree(vglMemType type) {
if (type >= VGL_MEM_TYPE_COUNT)
return 0;
return mempool_get_free_space(type);
return vitagl_mempool_get_free_space(type);
}
void *vglAlloc(uint32_t size, vglMemType type) {
if (type >= VGL_MEM_TYPE_COUNT)
return NULL;
return mempool_alloc(size, type);
return vitagl_mempool_alloc(size, type);
}
void vglFree(void *addr) {
mempool_free(addr, VGL_MEM_RAM); // Type is discarded so we just pass a random one
vitagl_mempool_free(addr, VGL_MEM_RAM); // Type is discarded so we just pass a random one
}