mirror of
https://github.com/libretro/RetroArch
synced 2025-03-09 13:13:31 +00:00
(360) Attempt to fix memory leaks - still broken
This commit is contained in:
parent
48b8c78de2
commit
1cdaa652a9
@ -189,14 +189,15 @@ static void xdk360_gfx_free(void * data)
|
||||
if (!vid)
|
||||
return;
|
||||
|
||||
hlsl_deinit();
|
||||
|
||||
D3DResource_Release((D3DResource *)vid->lpTexture);
|
||||
D3DResource_Release((D3DResource *)vid->vertex_buf);
|
||||
D3DResource_Release((D3DResource *)vid->v_decl);
|
||||
D3DDevice_Release(vid->xdk360_render_device);
|
||||
Direct3D_Release();
|
||||
|
||||
//breaks right now
|
||||
//hlsl_deinit();
|
||||
|
||||
free(vid);
|
||||
}
|
||||
|
||||
|
@ -106,6 +106,11 @@ static bool load_program(unsigned index, const char *prog, bool path_is_file)
|
||||
ret_fp = false;
|
||||
ret_vp = false;
|
||||
|
||||
if(prg[index].f_ctable)
|
||||
D3DResource_Release((D3DResource *)prg[index].f_ctable);
|
||||
if(prg[index].v_ctable)
|
||||
D3DResource_Release((D3DResource *)prg[0].v_ctable);
|
||||
|
||||
if (path_is_file)
|
||||
{
|
||||
ret_fp = D3DXCompileShaderFromFile(prog, NULL, NULL, "main_fragment", "ps_2_0", 0, &code_f, &listing_f, &prg[index].f_ctable);
|
||||
@ -130,6 +135,11 @@ static bool load_program(unsigned index, const char *prog, bool path_is_file)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if(prg[index].fprg)
|
||||
D3DResource_Release((D3DResource *)prg[0].fprg);
|
||||
if(prg[index].vprg)
|
||||
D3DResource_Release((D3DResource *)prg[0].vprg);
|
||||
|
||||
prg[index].fprg = D3DDevice_CreatePixelShader((const DWORD*)code_f->GetBufferPointer());
|
||||
prg[index].vprg = D3DDevice_CreateVertexShader((const DWORD*)code_v->GetBufferPointer());
|
||||
code_f->Release();
|
||||
@ -171,12 +181,6 @@ static bool load_plain(const char *path)
|
||||
|
||||
static void hlsl_deinit_progs(void)
|
||||
{
|
||||
if (prg[0].fprg)
|
||||
D3DResource_Release((D3DResource *)prg[0].fprg);
|
||||
if (prg[0].vprg)
|
||||
D3DResource_Release((D3DResource *)prg[0].vprg);
|
||||
D3DResource_Release((D3DResource *)prg[0].f_ctable);
|
||||
D3DResource_Release((D3DResource *)prg[0].v_ctable);
|
||||
}
|
||||
|
||||
static void hlsl_deinit_state(void)
|
||||
@ -210,10 +214,10 @@ static void set_program_attributes(unsigned i)
|
||||
|
||||
bool hlsl_init(const char *path, IDirect3DDevice9 * device_ptr)
|
||||
{
|
||||
if (device_ptr != NULL)
|
||||
d3d_device_ptr = device_ptr;
|
||||
else
|
||||
return false;
|
||||
if(!device_ptr)
|
||||
return false;
|
||||
|
||||
d3d_device_ptr = device_ptr;
|
||||
|
||||
if (strstr(path, ".cgp"))
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef __SSNES_HLSL_H
|
||||
#define __SSNES_HLSL_H
|
||||
|
||||
#include "../boolean.h"
|
||||
#include <stdint.h>
|
||||
|
||||
bool hlsl_init(const char *path, IDirect3DDevice9 * device_ptr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user