Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
789372af
Commit
789372af
authored
Sep 23, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 24, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Don't free D3D pixel shaders until the wined3d pixel shader is destroyed.
parent
717419da
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
16 deletions
+69
-16
shader.c
dlls/d3d10core/shader.c
+19
-4
pixelshader.c
dlls/d3d8/pixelshader.c
+19
-3
pixelshader.c
dlls/d3d9/pixelshader.c
+21
-4
device.c
dlls/wined3d/device.c
+3
-2
pixelshader.c
dlls/wined3d/pixelshader.c
+3
-1
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-1
wined3d.idl
include/wine/wined3d.idl
+2
-1
No files found.
dlls/d3d10core/shader.c
View file @
789372af
...
...
@@ -394,6 +394,11 @@ static ULONG STDMETHODCALLTYPE d3d10_pixel_shader_AddRef(ID3D10PixelShader *ifac
TRACE
(
"%p increasing refcount to %u
\n
"
,
This
,
refcount
);
if
(
refcount
==
1
)
{
IWineD3DPixelShader_AddRef
(
This
->
wined3d_shader
);
}
return
refcount
;
}
...
...
@@ -407,8 +412,6 @@ static ULONG STDMETHODCALLTYPE d3d10_pixel_shader_Release(ID3D10PixelShader *ifa
if
(
!
refcount
)
{
IWineD3DPixelShader_Release
(
This
->
wined3d_shader
);
shader_free_signature
(
&
This
->
output_signature
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
refcount
;
...
...
@@ -460,6 +463,18 @@ static const struct ID3D10PixelShaderVtbl d3d10_pixel_shader_vtbl =
d3d10_pixel_shader_SetPrivateDataInterface
,
};
static
void
STDMETHODCALLTYPE
d3d10_pixel_shader_wined3d_object_destroyed
(
void
*
parent
)
{
struct
d3d10_pixel_shader
*
shader
=
parent
;
shader_free_signature
(
&
shader
->
output_signature
);
HeapFree
(
GetProcessHeap
(),
0
,
shader
);
}
static
const
struct
wined3d_parent_ops
d3d10_pixel_shader_wined3d_parent_ops
=
{
d3d10_pixel_shader_wined3d_object_destroyed
,
};
HRESULT
d3d10_pixel_shader_init
(
struct
d3d10_pixel_shader
*
shader
,
struct
d3d10_device
*
device
,
const
void
*
byte_code
,
SIZE_T
byte_code_length
)
{
...
...
@@ -478,8 +493,8 @@ HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_
}
hr
=
IWineD3DDevice_CreatePixelShader
(
device
->
wined3d_device
,
shader_info
.
shader_code
,
&
shader
->
output_signature
,
&
shader
->
wined3d_shader
,
(
IUnknown
*
)
shader
);
shader_info
.
shader_code
,
&
shader
->
output_signature
,
&
shader
->
wined3d_shader
,
(
IUnknown
*
)
shader
,
&
d3d10_pixel_shader_wined3d_parent_ops
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create wined3d pixel shader, hr %#x.
\n
"
,
hr
);
...
...
dlls/d3d8/pixelshader.c
View file @
789372af
...
...
@@ -46,6 +46,13 @@ static ULONG WINAPI IDirect3DPixelShader8Impl_AddRef(IDirect3DPixelShader8 *ifac
TRACE
(
"(%p) : AddRef from %d
\n
"
,
This
,
ref
-
1
);
if
(
ref
==
1
)
{
wined3d_mutex_lock
();
IWineD3DPixelShader_AddRef
(
This
->
wineD3DPixelShader
);
wined3d_mutex_unlock
();
}
return
ref
;
}
...
...
@@ -59,8 +66,6 @@ static ULONG WINAPI IDirect3DPixelShader8Impl_Release(IDirect3DPixelShader8 * if
wined3d_mutex_lock
();
IWineD3DPixelShader_Release
(
This
->
wineD3DPixelShader
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
}
...
...
@@ -73,6 +78,16 @@ static const IDirect3DPixelShader8Vtbl Direct3DPixelShader8_Vtbl =
IDirect3DPixelShader8Impl_Release
,
};
static
void
STDMETHODCALLTYPE
d3d8_pixelshader_wined3d_object_destroyed
(
void
*
parent
)
{
HeapFree
(
GetProcessHeap
(),
0
,
parent
);
}
static
const
struct
wined3d_parent_ops
d3d8_pixelshader_wined3d_parent_ops
=
{
d3d8_pixelshader_wined3d_object_destroyed
,
};
HRESULT
pixelshader_init
(
IDirect3DPixelShader8Impl
*
shader
,
IDirect3DDevice8Impl
*
device
,
const
DWORD
*
byte_code
,
DWORD
shader_handle
)
{
...
...
@@ -84,7 +99,8 @@ HRESULT pixelshader_init(IDirect3DPixelShader8Impl *shader, IDirect3DDevice8Impl
wined3d_mutex_lock
();
hr
=
IWineD3DDevice_CreatePixelShader
(
device
->
WineD3DDevice
,
byte_code
,
NULL
,
&
shader
->
wineD3DPixelShader
,
(
IUnknown
*
)
shader
);
NULL
,
&
shader
->
wineD3DPixelShader
,
(
IUnknown
*
)
shader
,
&
d3d8_pixelshader_wined3d_parent_ops
);
wined3d_mutex_unlock
();
if
(
FAILED
(
hr
))
{
...
...
dlls/d3d9/pixelshader.c
View file @
789372af
...
...
@@ -46,6 +46,14 @@ static ULONG WINAPI IDirect3DPixelShader9Impl_AddRef(LPDIRECT3DPIXELSHADER9 ifac
TRACE
(
"(%p) : AddRef from %d
\n
"
,
This
,
ref
-
1
);
if
(
ref
==
1
)
{
IDirect3DDevice9Ex_AddRef
(
This
->
parentDevice
);
wined3d_mutex_lock
();
IWineD3DPixelShader_AddRef
(
This
->
wineD3DPixelShader
);
wined3d_mutex_unlock
();
}
return
ref
;
}
...
...
@@ -56,12 +64,10 @@ static ULONG WINAPI IDirect3DPixelShader9Impl_Release(LPDIRECT3DPIXELSHADER9 ifa
TRACE
(
"(%p) : ReleaseRef to %d
\n
"
,
This
,
ref
);
if
(
ref
==
0
)
{
IDirect3DDevice9Ex_Release
(
This
->
parentDevice
);
wined3d_mutex_lock
();
IWineD3DPixelShader_Release
(
This
->
wineD3DPixelShader
);
wined3d_mutex_unlock
();
IDirect3DDevice9Ex_Release
(
This
->
parentDevice
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
}
...
...
@@ -107,6 +113,16 @@ static const IDirect3DPixelShader9Vtbl Direct3DPixelShader9_Vtbl =
IDirect3DPixelShader9Impl_GetFunction
};
static
void
STDMETHODCALLTYPE
d3d9_pixelshader_wined3d_object_destroyed
(
void
*
parent
)
{
HeapFree
(
GetProcessHeap
(),
0
,
parent
);
}
static
const
struct
wined3d_parent_ops
d3d9_pixelshader_wined3d_parent_ops
=
{
d3d9_pixelshader_wined3d_object_destroyed
,
};
HRESULT
pixelshader_init
(
IDirect3DPixelShader9Impl
*
shader
,
IDirect3DDevice9Impl
*
device
,
const
DWORD
*
byte_code
)
{
HRESULT
hr
;
...
...
@@ -116,7 +132,8 @@ HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader, IDirect3DDevice9Impl
wined3d_mutex_lock
();
hr
=
IWineD3DDevice_CreatePixelShader
(
device
->
WineD3DDevice
,
byte_code
,
NULL
,
&
shader
->
wineD3DPixelShader
,
(
IUnknown
*
)
shader
);
NULL
,
&
shader
->
wineD3DPixelShader
,
(
IUnknown
*
)
shader
,
&
d3d9_pixelshader_wined3d_parent_ops
);
wined3d_mutex_unlock
();
if
(
FAILED
(
hr
))
{
...
...
dlls/wined3d/device.c
View file @
789372af
...
...
@@ -1792,7 +1792,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *ifac
static
HRESULT
WINAPI
IWineD3DDeviceImpl_CreatePixelShader
(
IWineD3DDevice
*
iface
,
const
DWORD
*
pFunction
,
const
struct
wined3d_shader_signature
*
output_signature
,
IWineD3DPixelShader
**
ppPixelShader
,
IUnknown
*
parent
)
IWineD3DPixelShader
**
ppPixelShader
,
IUnknown
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DPixelShaderImpl
*
object
;
...
...
@@ -1805,7 +1806,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface
return
E_OUTOFMEMORY
;
}
hr
=
pixelshader_init
(
object
,
This
,
pFunction
,
output_signature
,
parent
);
hr
=
pixelshader_init
(
object
,
This
,
pFunction
,
output_signature
,
parent
,
parent_ops
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize pixel shader, hr %#x.
\n
"
,
hr
);
...
...
dlls/wined3d/pixelshader.c
View file @
789372af
...
...
@@ -71,6 +71,7 @@ static ULONG WINAPI IWineD3DPixelShaderImpl_Release(IWineD3DPixelShader *iface)
if
(
!
refcount
)
{
shader_cleanup
((
IWineD3DBaseShader
*
)
iface
);
This
->
parent_ops
->
wined3d_object_destroyed
(
This
->
parent
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -424,7 +425,7 @@ void find_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWineD3DStateBlockImp
HRESULT
pixelshader_init
(
IWineD3DPixelShaderImpl
*
shader
,
IWineD3DDeviceImpl
*
device
,
const
DWORD
*
byte_code
,
const
struct
wined3d_shader_signature
*
output_signature
,
IUnknown
*
parent
)
IUnknown
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
{
HRESULT
hr
;
...
...
@@ -432,6 +433,7 @@ HRESULT pixelshader_init(IWineD3DPixelShaderImpl *shader, IWineD3DDeviceImpl *de
shader
->
lpVtbl
=
&
IWineD3DPixelShader_Vtbl
;
shader
->
parent
=
parent
;
shader
->
parent_ops
=
parent_ops
;
shader_init
(
&
shader
->
baseShader
,
(
IWineD3DDevice
*
)
device
);
list_add_head
(
&
device
->
shaders
,
&
shader
->
baseShader
.
shader_list_entry
);
...
...
dlls/wined3d/wined3d_private.h
View file @
789372af
...
...
@@ -2813,6 +2813,7 @@ typedef struct IWineD3DPixelShaderImpl {
/* IWineD3DPixelShaderImpl */
IUnknown
*
parent
;
const
struct
wined3d_parent_ops
*
parent_ops
;
/* Pixel shader input semantics */
struct
wined3d_shader_signature_element
input_signature
[
MAX_REG_INPUT
];
...
...
@@ -2833,7 +2834,7 @@ typedef struct IWineD3DPixelShaderImpl {
HRESULT
pixelshader_init
(
IWineD3DPixelShaderImpl
*
shader
,
IWineD3DDeviceImpl
*
device
,
const
DWORD
*
byte_code
,
const
struct
wined3d_shader_signature
*
output_signature
,
IUnknown
*
parent
)
DECLSPEC_HIDDEN
;
IUnknown
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
DECLSPEC_HIDDEN
;
void
pixelshader_update_samplers
(
struct
shader_reg_maps
*
reg_maps
,
IWineD3DBaseTexture
*
const
*
textures
)
DECLSPEC_HIDDEN
;
void
find_ps_compile_args
(
IWineD3DPixelShaderImpl
*
shader
,
IWineD3DStateBlockImpl
*
stateblock
,
...
...
include/wine/wined3d.idl
View file @
789372af
...
...
@@ -3013,7 +3013,8 @@ interface IWineD3DDevice : IWineD3DBase
[
in
]
const
DWORD
*
function
,
[
in
]
const
struct
wined3d_shader_signature
*
output_signature
,
[
out
]
IWineD3DPixelShader
**
shader
,
[
in
]
IUnknown
*
parent
[
in
]
IUnknown
*
parent
,
[
in
]
const
struct
wined3d_parent_ops
*
parent_ops
)
;
HRESULT
CreatePalette
(
[
in
]
DWORD
flags
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment