diff --git a/deps/vitaGL/source/framebuffers.c b/deps/vitaGL/source/framebuffers.c index fc157443b7..c4443277f8 100644 --- a/deps/vitaGL/source/framebuffers.c +++ b/deps/vitaGL/source/framebuffers.c @@ -97,8 +97,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); + vgl_mem_free(fb->depth_buffer_addr, fb->depth_buffer_mem_type); + vgl_mem_free(fb->stencil_buffer_addr, fb->stencil_buffer_mem_type); fb->depth_buffer_addr = NULL; fb->stencil_buffer_addr = NULL; } diff --git a/deps/vitaGL/source/gxm.c b/deps/vitaGL/source/gxm.c index f0b496a3a0..0e1f6eb454 100644 --- a/deps/vitaGL/source/gxm.c +++ b/deps/vitaGL/source/gxm.c @@ -146,9 +146,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); + vgl_mem_free(vdm_ring_buffer_addr, VGL_MEM_VRAM); + vgl_mem_free(vertex_ring_buffer_addr, VGL_MEM_VRAM); + vgl_mem_free(fragment_ring_buffer_addr, VGL_MEM_VRAM); gpu_fragment_usse_free_mapped(fragment_usse_ring_buffer_addr); // Destroying sceGxm context @@ -206,7 +206,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); + vgl_mem_free(gxm_color_surfaces_addr[i], VGL_MEM_VRAM); sceGxmSyncObjectDestroy(gxm_sync_objects[i]); } } @@ -245,8 +245,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); + vgl_mem_free(gxm_depth_surface_addr, VGL_MEM_VRAM); + vgl_mem_free(gxm_stencil_surface_addr, VGL_MEM_VRAM); } void startShaderPatcher(void) { @@ -300,7 +300,7 @@ void stopShaderPatcher(void) { sceGxmShaderPatcherDestroy(gxm_shader_patcher); // Freeing shader patcher buffers - mempool_free(gxm_shader_patcher_buffer_addr, VGL_MEM_VRAM); + vgl_mem_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); } diff --git a/deps/vitaGL/source/utils/gpu_utils.c b/deps/vitaGL/source/utils/gpu_utils.c index 8497a8de7d..cdda870475 100644 --- a/deps/vitaGL/source/utils/gpu_utils.c +++ b/deps/vitaGL/source/utils/gpu_utils.c @@ -87,18 +87,18 @@ void dxt_compress(uint8_t *dst, uint8_t *src, int w, int h, int isdxt5) { void *gpu_alloc_mapped(size_t size, vglMemType *type) { // Allocating requested memblock - void *res = mempool_alloc(size, *type); + void *res = vgl_mempool_alloc(size, *type); // Requested memory type finished, using other one if (res == NULL) { *type = *type == VGL_MEM_VRAM ? VGL_MEM_RAM : VGL_MEM_VRAM; - res = mempool_alloc(size, *type); + res = vgl_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 = vgl_mempool_alloc(size, *type); } if (res == NULL && use_extra_mem) { @@ -126,7 +126,7 @@ void gpu_vertex_usse_free_mapped(void *addr) { sceGxmUnmapVertexUsseMemory(addr); // Deallocating memblock - mempool_free(addr, vert_usse_type); + vgl_mem_free(addr, vert_usse_type); } void *gpu_fragment_usse_alloc_mapped(size_t size, unsigned int *usse_offset) { @@ -146,7 +146,7 @@ void gpu_fragment_usse_free_mapped(void *addr) { sceGxmUnmapFragmentUsseMemory(addr); // Deallocating memblock - mempool_free(addr, frag_usse_type); + vgl_mem_free(addr, frag_usse_type); } void *gpu_pool_malloc(unsigned int size) { @@ -249,7 +249,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); + vgl_mem_free(tex->data, tex->mtype); // Invalidating texture object tex->valid = 0; @@ -468,6 +468,6 @@ void gpu_free_palette(palette *pal) { // Deallocating palette memblock and object if (pal == NULL) return; - mempool_free(pal->data, pal->type); + vgl_mem_free(pal->data, pal->type); free(pal); } \ No newline at end of file diff --git a/deps/vitaGL/source/utils/mem_utils.c b/deps/vitaGL/source/utils/mem_utils.c index fe586fa4a2..0a46a312eb 100644 --- a/deps/vitaGL/source/utils/mem_utils.c +++ b/deps/vitaGL/source/utils/mem_utils.c @@ -295,14 +295,14 @@ int vgl_mem_init(size_t size_ram, size_t size_cdram, size_t size_phycont) { return 1; } -void mempool_free(void *ptr, vglMemType type) { +void vgl_mem_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 *vgl_mempool_alloc(size_t size, vglMemType type) { void *res = NULL; if (size <= tm_free[type]) res = heap_alloc(type, size, MEM_ALIGNMENT); @@ -310,6 +310,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 vgl_mempool_get_free_space(vglMemType type) { return tm_free[type]; } diff --git a/deps/vitaGL/source/utils/mem_utils.h b/deps/vitaGL/source/utils/mem_utils.h index a9d50f45c4..c54f46f89b 100644 --- a/deps/vitaGL/source/utils/mem_utils.h +++ b/deps/vitaGL/source/utils/mem_utils.h @@ -26,8 +26,8 @@ int vgl_mem_init(size_t size_ram, size_t size_cdram, size_t size_phycont); // Initialize mempools void vgl_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 +size_t vgl_mempool_get_free_space(vglMemType type); // Return free space in bytes for a mempool +void *vgl_mempool_alloc(size_t size, vglMemType type); // Allocate a memory block on a mempool +void vgl_mem_free(void *ptr, vglMemType type); // Free a memory block on a mempool #endif \ No newline at end of file diff --git a/deps/vitaGL/source/vitaGL.c b/deps/vitaGL/source/vitaGL.c index 8ba51d1715..7b90dbe95d 100644 --- a/deps/vitaGL/source/vitaGL.c +++ b/deps/vitaGL/source/vitaGL.c @@ -644,10 +644,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); + vgl_mem_free(clear_vertices, VGL_MEM_RAM); + vgl_mem_free(depth_vertices, VGL_MEM_RAM); + vgl_mem_free(depth_clear_indices, VGL_MEM_RAM); + vgl_mem_free(scissor_test_vertices, VGL_MEM_RAM); // Releasing shader programs from sceGxmShaderPatcher sceGxmShaderPatcherReleaseFragmentProgram(gxm_shader_patcher, scissor_test_fragment_program); @@ -746,7 +746,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); + vgl_mem_free(gpu_buffers[idx].ptr, VGL_MEM_VRAM); gpu_buffers[idx].ptr = NULL; } } @@ -2088,17 +2088,17 @@ 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 vgl_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 vgl_mempool_alloc(size, type); } void vglFree(void *addr) { - mempool_free(addr, VGL_MEM_RAM); // Type is discarded so we just pass a random one + vgl_mem_free(addr, VGL_MEM_RAM); // Type is discarded so we just pass a random one } void vglUseExtraMem(GLboolean use) {