H. Verbeet : wined3d: Destroy depth_blt resources in the backend' s destructor.
Alexandre Julliard
julliard at winehq.org
Thu Jul 10 08:58:21 CDT 2008
Module: wine
Branch: master
Commit: 54ae3ebfd4bc6fab1e322b92fe84909535f9f26e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=54ae3ebfd4bc6fab1e322b92fe84909535f9f26e
Author: H. Verbeet <hverbeet at gmail.com>
Date: Wed Jul 9 17:59:39 2008 +0200
wined3d: Destroy depth_blt resources in the backend's destructor.
No need to expose this in the interface.
---
dlls/wined3d/arb_program_shader.c | 26 ++++++++++----------------
dlls/wined3d/ati_fragment_shader.c | 5 -----
dlls/wined3d/baseshader.c | 2 --
dlls/wined3d/device.c | 2 --
dlls/wined3d/glsl_shader.c | 21 +++++++++------------
dlls/wined3d/wined3d_private.h | 1 -
6 files changed, 19 insertions(+), 38 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 12d6a5b..a62aed7 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -1819,21 +1819,6 @@ static void shader_arb_select_depth_blt(IWineD3DDevice *iface) {
glEnable(GL_FRAGMENT_PROGRAM_ARB);
}
-static void shader_arb_destroy_depth_blt(IWineD3DDevice *iface) {
- IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- struct shader_arb_priv *priv = (struct shader_arb_priv *) This->shader_priv;
- WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
-
- if(priv->depth_blt_vprogram_id) {
- GL_EXTCALL(glDeleteProgramsARB(1, &priv->depth_blt_vprogram_id));
- priv->depth_blt_vprogram_id = 0;
- }
- if(priv->depth_blt_fprogram_id) {
- GL_EXTCALL(glDeleteProgramsARB(1, &priv->depth_blt_fprogram_id));
- priv->depth_blt_fprogram_id = 0;
- }
-}
-
static void shader_arb_cleanup(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
@@ -1861,6 +1846,16 @@ static HRESULT shader_arb_alloc(IWineD3DDevice *iface) {
static void shader_arb_free(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+ WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
+ struct shader_arb_priv *priv = (struct shader_arb_priv *) This->shader_priv;
+
+ if(priv->depth_blt_vprogram_id) {
+ GL_EXTCALL(glDeleteProgramsARB(1, &priv->depth_blt_vprogram_id));
+ }
+ if(priv->depth_blt_fprogram_id) {
+ GL_EXTCALL(glDeleteProgramsARB(1, &priv->depth_blt_fprogram_id));
+ }
+
HeapFree(GetProcessHeap(), 0, This->shader_priv);
}
@@ -2097,7 +2092,6 @@ static void shader_arb_fragment_enable(IWineD3DDevice *iface, BOOL enable) {
const shader_backend_t arb_program_shader_backend = {
shader_arb_select,
shader_arb_select_depth_blt,
- shader_arb_destroy_depth_blt,
shader_arb_load_constants,
shader_arb_cleanup,
shader_arb_color_correction,
diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c
index ebbb0c6..0c34474 100644
--- a/dlls/wined3d/ati_fragment_shader.c
+++ b/dlls/wined3d/ati_fragment_shader.c
@@ -976,10 +976,6 @@ static void shader_atifs_select_depth_blt(IWineD3DDevice *iface) {
arb_program_shader_backend.shader_select_depth_blt(iface);
}
-static void shader_atifs_destroy_depth_blt(IWineD3DDevice *iface) {
- arb_program_shader_backend.shader_destroy_depth_blt(iface);
-}
-
static void shader_atifs_load_constants(IWineD3DDevice *iface, char usePS, char useVS) {
arb_program_shader_backend.shader_load_constants(iface, usePS, useVS);
}
@@ -1111,7 +1107,6 @@ static void shader_atifs_fragment_enable(IWineD3DDevice *iface, BOOL enable) {
const shader_backend_t atifs_shader_backend = {
shader_atifs_select,
shader_atifs_select_depth_blt,
- shader_atifs_destroy_depth_blt,
shader_atifs_load_constants,
shader_atifs_cleanup,
shader_atifs_color_correction,
diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c
index 11d807f..a8806d3 100644
--- a/dlls/wined3d/baseshader.c
+++ b/dlls/wined3d/baseshader.c
@@ -1091,7 +1091,6 @@ void shader_trace_init(
static void shader_none_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {}
static void shader_none_select_depth_blt(IWineD3DDevice *iface) {}
-static void shader_none_destroy_depth_blt(IWineD3DDevice *iface) {}
static void shader_none_load_constants(IWineD3DDevice *iface, char usePS, char useVS) {}
static void shader_none_cleanup(IWineD3DDevice *iface) {}
static void shader_none_color_correction(SHADER_OPCODE_ARG* arg) {}
@@ -1202,7 +1201,6 @@ static void shader_none_fragment_enable(IWineD3DDevice *iface, BOOL enable) {
const shader_backend_t none_shader_backend = {
shader_none_select,
shader_none_select_depth_blt,
- shader_none_destroy_depth_blt,
shader_none_load_constants,
shader_none_cleanup,
shader_none_color_correction,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 3f94a3f..d25e1bc 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2283,7 +2283,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_D
This->depth_blt_rb_w = 0;
This->depth_blt_rb_h = 0;
}
- This->shader_backend->shader_destroy_depth_blt(iface);
This->shader_backend->shader_free_private(iface);
/* Release the update stateblock */
@@ -7218,7 +7217,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE
This->depth_blt_rb_w = 0;
This->depth_blt_rb_h = 0;
}
- This->shader_backend->shader_destroy_depth_blt(iface);
This->shader_backend->shader_free_private(iface);
for (i = 0; i < GL_LIMITS(textures); i++) {
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 070aecb..1ff7e11 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -3398,17 +3398,6 @@ static void shader_glsl_select_depth_blt(IWineD3DDevice *iface) {
GL_EXTCALL(glUniform1iARB(loc, 0));
}
-static void shader_glsl_destroy_depth_blt(IWineD3DDevice *iface) {
- IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- struct shader_glsl_priv *priv = (struct shader_glsl_priv *) This->shader_priv;
- WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
-
- if(priv->depth_blt_glsl_program_id) {
- GL_EXTCALL(glDeleteObjectARB(priv->depth_blt_glsl_program_id));
- priv->depth_blt_glsl_program_id = 0;
- }
-}
-
static void shader_glsl_cleanup(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
@@ -3483,6 +3472,15 @@ static HRESULT shader_glsl_alloc(IWineD3DDevice *iface) {
static void shader_glsl_free(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+ WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
+ struct shader_glsl_priv *priv = (struct shader_glsl_priv *)This->shader_priv;
+
+ if(priv->depth_blt_glsl_program_id) {
+ GL_EXTCALL(glDeleteObjectARB(priv->depth_blt_glsl_program_id));
+ }
+
+ hash_table_destroy(priv->glsl_program_lookup);
+
HeapFree(GetProcessHeap(), 0, This->shader_priv);
This->shader_priv = NULL;
}
@@ -3697,7 +3695,6 @@ static void shader_glsl_fragment_enable(IWineD3DDevice *iface, BOOL enable) {
const shader_backend_t glsl_shader_backend = {
shader_glsl_select,
shader_glsl_select_depth_blt,
- shader_glsl_destroy_depth_blt,
shader_glsl_load_constants,
shader_glsl_cleanup,
shader_glsl_color_correction,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index cb019c7..808d9bf 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -289,7 +289,6 @@ struct shader_caps {
typedef struct {
void (*shader_select)(IWineD3DDevice *iface, BOOL usePS, BOOL useVS);
void (*shader_select_depth_blt)(IWineD3DDevice *iface);
- void (*shader_destroy_depth_blt)(IWineD3DDevice *iface);
void (*shader_load_constants)(IWineD3DDevice *iface, char usePS, char useVS);
void (*shader_cleanup)(IWineD3DDevice *iface);
void (*shader_color_correction)(struct SHADER_OPCODE_ARG *arg);
More information about the wine-cvs
mailing list