Commit 6b9118e4 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Pass an IWineD3DDeviceImpl pointer to alloc_private().

parent 00550613
...@@ -5460,24 +5460,27 @@ static void arbfp_enable(BOOL enable) ...@@ -5460,24 +5460,27 @@ static void arbfp_enable(BOOL enable)
LEAVE_GL(); LEAVE_GL();
} }
static HRESULT arbfp_alloc(IWineD3DDevice *iface) { static HRESULT arbfp_alloc(IWineD3DDeviceImpl *device)
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; {
struct shader_arb_priv *priv; struct shader_arb_priv *priv;
/* Share private data between the shader backend and the pipeline replacement, if both /* 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 * are the arb implementation. This is needed to figure out whether ARBfp should be disabled
* if no pixel shader is bound or not * if no pixel shader is bound or not
*/ */
if(This->shader_backend == &arb_program_shader_backend) { if (device->shader_backend == &arb_program_shader_backend)
This->fragment_priv = This->shader_priv; {
} else { device->fragment_priv = device->shader_priv;
This->fragment_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct shader_arb_priv));
if(!This->fragment_priv) return E_OUTOFMEMORY;
} }
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) if (wine_rb_init(&priv->fragment_shaders, &wined3d_ffp_frag_program_rb_functions) == -1)
{ {
ERR("Failed to initialize rbtree.\n"); ERR("Failed to initialize rbtree.\n");
HeapFree(GetProcessHeap(), 0, This->fragment_priv); HeapFree(GetProcessHeap(), 0, device->fragment_priv);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
priv->use_arbfp_fixed_func = TRUE; priv->use_arbfp_fixed_func = TRUE;
......
...@@ -1114,20 +1114,21 @@ static void atifs_get_caps(const struct wined3d_gl_info *gl_info, struct fragmen ...@@ -1114,20 +1114,21 @@ static void atifs_get_caps(const struct wined3d_gl_info *gl_info, struct fragmen
caps->MaxSimultaneousTextures = 6; caps->MaxSimultaneousTextures = 6;
} }
static HRESULT atifs_alloc(IWineD3DDevice *iface) { static HRESULT atifs_alloc(IWineD3DDeviceImpl *device)
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; {
struct atifs_private_data *priv; struct atifs_private_data *priv;
This->fragment_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct atifs_private_data)); device->fragment_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct atifs_private_data));
if(!This->fragment_priv) { if (!device->fragment_priv)
{
ERR("Out of memory\n"); ERR("Out of memory\n");
return E_OUTOFMEMORY; 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) if (wine_rb_init(&priv->fragment_shaders, &wined3d_ffp_frag_program_rb_functions) == -1)
{ {
ERR("Failed to initialize rbtree.\n"); ERR("Failed to initialize rbtree.\n");
HeapFree(GetProcessHeap(), 0, This->fragment_priv); HeapFree(GetProcessHeap(), 0, device->fragment_priv);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
return WINED3D_OK; return WINED3D_OK;
......
...@@ -1968,7 +1968,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, ...@@ -1968,7 +1968,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
TRACE("Shader private data couldn't be allocated\n"); TRACE("Shader private data couldn't be allocated\n");
goto err_out; goto err_out;
} }
hr = This->frag_pipe->alloc_private(iface); hr = This->frag_pipe->alloc_private(This);
if(FAILED(hr)) { if(FAILED(hr)) {
TRACE("Fragment pipeline private data couldn't be allocated\n"); TRACE("Fragment pipeline private data couldn't be allocated\n");
goto err_out; goto err_out;
...@@ -6251,7 +6251,7 @@ static HRESULT create_primary_opengl_context(IWineD3DDevice *iface, IWineD3DSwap ...@@ -6251,7 +6251,7 @@ static HRESULT create_primary_opengl_context(IWineD3DDevice *iface, IWineD3DSwap
goto err; goto err;
} }
hr = This->frag_pipe->alloc_private(iface); hr = This->frag_pipe->alloc_private(This);
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("Failed to allocate fragment pipe private data, hr %#x.\n", hr); ERR("Failed to allocate fragment pipe private data, hr %#x.\n", hr);
......
...@@ -693,7 +693,7 @@ static void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct ...@@ -693,7 +693,7 @@ static void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct
pCaps->MaxSimultaneousTextures = gl_info->limits.textures; 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. */ /* Context activation is done by the caller. */
static void nvrc_fragment_free(IWineD3DDevice *iface) {} static void nvrc_fragment_free(IWineD3DDevice *iface) {}
......
...@@ -5696,7 +5696,7 @@ static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct ...@@ -5696,7 +5696,7 @@ static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct
pCaps->MaxSimultaneousTextures = gl_info->limits.textures; 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 void ffp_fragment_free(IWineD3DDevice *iface) {}
static BOOL ffp_color_fixup_supported(struct color_fixup_desc fixup) static BOOL ffp_color_fixup_supported(struct color_fixup_desc fixup)
{ {
......
...@@ -1145,7 +1145,7 @@ struct fragment_pipeline ...@@ -1145,7 +1145,7 @@ struct fragment_pipeline
{ {
void (*enable_extension)(BOOL enable); void (*enable_extension)(BOOL enable);
void (*get_caps)(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps); 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); void (*free_private)(IWineD3DDevice *iface);
BOOL (*color_fixup_supported)(struct color_fixup_desc fixup); BOOL (*color_fixup_supported)(struct color_fixup_desc fixup);
const struct StateEntryTemplate *states; const struct StateEntryTemplate *states;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment