Henri Verbeet : wined3d: Pass an IWineD3DDeviceImpl pointer to alloc_private().
Alexandre Julliard
julliard at winehq.org
Thu Dec 2 12:23:56 CST 2010
Module: wine
Branch: master
Commit: 6b9118e4628059f166d1dcfcf71648e5aa1fc6ad
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6b9118e4628059f166d1dcfcf71648e5aa1fc6ad
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Wed Dec 1 20:50:46 2010 +0100
wined3d: Pass an IWineD3DDeviceImpl pointer to alloc_private().
---
dlls/wined3d/arb_program_shader.c | 21 ++++++++++++---------
dlls/wined3d/ati_fragment_shader.c | 13 +++++++------
dlls/wined3d/device.c | 4 ++--
dlls/wined3d/nvidia_texture_shader.c | 2 +-
dlls/wined3d/state.c | 2 +-
dlls/wined3d/wined3d_private.h | 2 +-
6 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index efc0ab0..196d901 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -5460,24 +5460,27 @@ static void arbfp_enable(BOOL enable)
LEAVE_GL();
}
-static HRESULT arbfp_alloc(IWineD3DDevice *iface) {
- IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
+static HRESULT arbfp_alloc(IWineD3DDeviceImpl *device)
+{
struct shader_arb_priv *priv;
/* Share private data between the shader backend and the pipeline replacement, if both
* are the arb implementation. This is needed to figure out whether ARBfp should be disabled
* if no pixel shader is bound or not
*/
- if(This->shader_backend == &arb_program_shader_backend) {
- This->fragment_priv = This->shader_priv;
- } else {
- This->fragment_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct shader_arb_priv));
- if(!This->fragment_priv) return E_OUTOFMEMORY;
+ if (device->shader_backend == &arb_program_shader_backend)
+ {
+ device->fragment_priv = device->shader_priv;
}
- priv = This->fragment_priv;
+ else
+ {
+ device->fragment_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct shader_arb_priv));
+ if (!device->fragment_priv) return E_OUTOFMEMORY;
+ }
+ priv = device->fragment_priv;
if (wine_rb_init(&priv->fragment_shaders, &wined3d_ffp_frag_program_rb_functions) == -1)
{
ERR("Failed to initialize rbtree.\n");
- HeapFree(GetProcessHeap(), 0, This->fragment_priv);
+ HeapFree(GetProcessHeap(), 0, device->fragment_priv);
return E_OUTOFMEMORY;
}
priv->use_arbfp_fixed_func = TRUE;
diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c
index 8ea0cd5..85903ee 100644
--- a/dlls/wined3d/ati_fragment_shader.c
+++ b/dlls/wined3d/ati_fragment_shader.c
@@ -1114,20 +1114,21 @@ static void atifs_get_caps(const struct wined3d_gl_info *gl_info, struct fragmen
caps->MaxSimultaneousTextures = 6;
}
-static HRESULT atifs_alloc(IWineD3DDevice *iface) {
- IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
+static HRESULT atifs_alloc(IWineD3DDeviceImpl *device)
+{
struct atifs_private_data *priv;
- This->fragment_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct atifs_private_data));
- if(!This->fragment_priv) {
+ device->fragment_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct atifs_private_data));
+ if (!device->fragment_priv)
+ {
ERR("Out of memory\n");
return E_OUTOFMEMORY;
}
- priv = This->fragment_priv;
+ priv = device->fragment_priv;
if (wine_rb_init(&priv->fragment_shaders, &wined3d_ffp_frag_program_rb_functions) == -1)
{
ERR("Failed to initialize rbtree.\n");
- HeapFree(GetProcessHeap(), 0, This->fragment_priv);
+ HeapFree(GetProcessHeap(), 0, device->fragment_priv);
return E_OUTOFMEMORY;
}
return WINED3D_OK;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 102b65c..4a7f6dd 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1968,7 +1968,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
TRACE("Shader private data couldn't be allocated\n");
goto err_out;
}
- hr = This->frag_pipe->alloc_private(iface);
+ hr = This->frag_pipe->alloc_private(This);
if(FAILED(hr)) {
TRACE("Fragment pipeline private data couldn't be allocated\n");
goto err_out;
@@ -6251,7 +6251,7 @@ static HRESULT create_primary_opengl_context(IWineD3DDevice *iface, IWineD3DSwap
goto err;
}
- hr = This->frag_pipe->alloc_private(iface);
+ hr = This->frag_pipe->alloc_private(This);
if (FAILED(hr))
{
ERR("Failed to allocate fragment pipe private data, hr %#x.\n", hr);
diff --git a/dlls/wined3d/nvidia_texture_shader.c b/dlls/wined3d/nvidia_texture_shader.c
index dcf7816..8e52057 100644
--- a/dlls/wined3d/nvidia_texture_shader.c
+++ b/dlls/wined3d/nvidia_texture_shader.c
@@ -693,7 +693,7 @@ static void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct
pCaps->MaxSimultaneousTextures = gl_info->limits.textures;
}
-static HRESULT nvrc_fragment_alloc(IWineD3DDevice *iface) { return WINED3D_OK; }
+static HRESULT nvrc_fragment_alloc(IWineD3DDeviceImpl *device) { return WINED3D_OK; }
/* Context activation is done by the caller. */
static void nvrc_fragment_free(IWineD3DDevice *iface) {}
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 8c5db84..d4c2d11 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -5696,7 +5696,7 @@ static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct
pCaps->MaxSimultaneousTextures = gl_info->limits.textures;
}
-static HRESULT ffp_fragment_alloc(IWineD3DDevice *iface) { return WINED3D_OK; }
+static HRESULT ffp_fragment_alloc(IWineD3DDeviceImpl *device) { return WINED3D_OK; }
static void ffp_fragment_free(IWineD3DDevice *iface) {}
static BOOL ffp_color_fixup_supported(struct color_fixup_desc fixup)
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e04c71e..1a0500f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1145,7 +1145,7 @@ struct fragment_pipeline
{
void (*enable_extension)(BOOL enable);
void (*get_caps)(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps);
- HRESULT (*alloc_private)(IWineD3DDevice *iface);
+ HRESULT (*alloc_private)(IWineD3DDeviceImpl *device);
void (*free_private)(IWineD3DDevice *iface);
BOOL (*color_fixup_supported)(struct color_fixup_desc fixup);
const struct StateEntryTemplate *states;
More information about the wine-cvs
mailing list