Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
9a5b854e
Commit
9a5b854e
authored
Oct 29, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Oct 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: Use CRT allocation functions.
parent
6db89702
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
68 additions
and
83 deletions
+68
-83
buffer.c
dlls/d3d9/buffer.c
+2
-2
d3d9_main.c
dlls/d3d9/d3d9_main.c
+4
-4
d3d9_private.h
dlls/d3d9/d3d9_private.h
+0
-1
device.c
dlls/d3d9/device.c
+33
-47
directx.c
dlls/d3d9/directx.c
+7
-7
query.c
dlls/d3d9/query.c
+1
-1
shader.c
dlls/d3d9/shader.c
+2
-2
stateblock.c
dlls/d3d9/stateblock.c
+1
-1
surface.c
dlls/d3d9/surface.c
+2
-2
swapchain.c
dlls/d3d9/swapchain.c
+3
-3
texture.c
dlls/d3d9/texture.c
+1
-1
vertexdeclaration.c
dlls/d3d9/vertexdeclaration.c
+11
-11
volume.c
dlls/d3d9/volume.c
+1
-1
No files found.
dlls/d3d9/buffer.c
View file @
9a5b854e
...
...
@@ -266,7 +266,7 @@ static void STDMETHODCALLTYPE d3d9_vertexbuffer_wined3d_object_destroyed(void *p
if
(
buffer
->
draw_buffer
)
wined3d_buffer_decref
(
buffer
->
wined3d_buffer
);
d3d9_resource_cleanup
(
&
buffer
->
resource
);
heap_
free
(
buffer
);
free
(
buffer
);
}
static
const
struct
wined3d_parent_ops
d3d9_vertexbuffer_wined3d_parent_ops
=
...
...
@@ -586,7 +586,7 @@ static void STDMETHODCALLTYPE d3d9_indexbuffer_wined3d_object_destroyed(void *pa
struct
d3d9_indexbuffer
*
buffer
=
parent
;
d3d9_resource_cleanup
(
&
buffer
->
resource
);
heap_
free
(
buffer
);
free
(
buffer
);
}
static
const
struct
wined3d_parent_ops
d3d9_indexbuffer_wined3d_parent_ops
=
...
...
dlls/d3d9/d3d9_main.c
View file @
9a5b854e
...
...
@@ -38,13 +38,13 @@ IDirect3D9 * WINAPI DECLSPEC_HOTPATCH Direct3DCreate9(UINT sdk_version)
TRACE
(
"sdk_version %#x.
\n
"
,
sdk_version
);
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
NULL
;
if
(
!
d3d9_init
(
object
,
FALSE
))
{
WARN
(
"Failed to initialize d3d9.
\n
"
);
heap_
free
(
object
);
free
(
object
);
return
NULL
;
}
...
...
@@ -59,13 +59,13 @@ HRESULT WINAPI DECLSPEC_HOTPATCH Direct3DCreate9Ex(UINT sdk_version, IDirect3D9E
TRACE
(
"sdk_version %#x, d3d9ex %p.
\n
"
,
sdk_version
,
d3d9ex
);
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
if
(
!
d3d9_init
(
object
,
TRUE
))
{
WARN
(
"Failed to initialize d3d9.
\n
"
);
heap_
free
(
object
);
free
(
object
);
return
D3DERR_NOTAVAILABLE
;
}
...
...
dlls/d3d9/d3d9_private.h
View file @
9a5b854e
...
...
@@ -32,7 +32,6 @@
#include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "d3d9.h"
#include "wine/wined3d.h"
...
...
dlls/d3d9/device.c
View file @
9a5b854e
...
...
@@ -661,7 +661,7 @@ static ULONG WINAPI DECLSPEC_HOTPATCH d3d9_device_Release(IDirect3DDevice9Ex *if
{
wined3d_vertex_declaration_decref
(
device
->
fvf_decls
[
i
].
decl
);
}
heap_
free
(
device
->
fvf_decls
);
free
(
device
->
fvf_decls
);
wined3d_streaming_buffer_cleanup
(
&
device
->
vertex_buffer
);
wined3d_streaming_buffer_cleanup
(
&
device
->
index_buffer
);
...
...
@@ -670,7 +670,7 @@ static ULONG WINAPI DECLSPEC_HOTPATCH d3d9_device_Release(IDirect3DDevice9Ex *if
{
wined3d_swapchain_decref
(
device
->
implicit_swapchains
[
i
]);
}
heap_
free
(
device
->
implicit_swapchains
);
free
(
device
->
implicit_swapchains
);
if
(
device
->
recording
)
wined3d_stateblock_decref
(
device
->
recording
);
...
...
@@ -682,7 +682,7 @@ static ULONG WINAPI DECLSPEC_HOTPATCH d3d9_device_Release(IDirect3DDevice9Ex *if
IDirect3D9Ex_Release
(
&
device
->
d3d_parent
->
IDirect3D9Ex_iface
);
heap_
free
(
device
);
free
(
device
);
}
return
refcount
;
...
...
@@ -1030,7 +1030,7 @@ static HRESULT d3d9_device_get_swapchains(struct d3d9_device *device)
{
UINT
i
,
new_swapchain_count
=
wined3d_device_get_swapchain_count
(
device
->
wined3d_device
);
if
(
!
(
device
->
implicit_swapchains
=
heap_
alloc
(
new_swapchain_count
*
sizeof
(
*
device
->
implicit_swapchains
))))
if
(
!
(
device
->
implicit_swapchains
=
m
alloc
(
new_swapchain_count
*
sizeof
(
*
device
->
implicit_swapchains
))))
return
E_OUTOFMEMORY
;
for
(
i
=
0
;
i
<
new_swapchain_count
;
++
i
)
...
...
@@ -1137,7 +1137,7 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device,
{
struct
d3d9_surface
*
surface
;
heap_
free
(
device
->
implicit_swapchains
);
free
(
device
->
implicit_swapchains
);
if
(
!
extended
)
{
...
...
@@ -1405,14 +1405,14 @@ static HRESULT WINAPI d3d9_device_CreateTexture(IDirect3DDevice9Ex *iface,
}
}
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
D3DERR_OUTOFVIDEOMEMORY
;
hr
=
d3d9_texture_2d_init
(
object
,
device
,
width
,
height
,
levels
,
usage
,
format
,
pool
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize texture, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -1469,14 +1469,14 @@ static HRESULT WINAPI d3d9_device_CreateVolumeTexture(IDirect3DDevice9Ex *iface,
FIXME
(
"Resource sharing not implemented, *shared_handle %p.
\n
"
,
*
shared_handle
);
}
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
D3DERR_OUTOFVIDEOMEMORY
;
hr
=
d3d9_texture_3d_init
(
object
,
device
,
width
,
height
,
depth
,
levels
,
usage
,
format
,
pool
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize volume texture, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -1515,14 +1515,14 @@ static HRESULT WINAPI d3d9_device_CreateCubeTexture(IDirect3DDevice9Ex *iface,
FIXME
(
"Resource sharing not implemented, *shared_handle %p.
\n
"
,
*
shared_handle
);
}
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
D3DERR_OUTOFVIDEOMEMORY
;
hr
=
d3d9_texture_cube_init
(
object
,
device
,
edge_length
,
levels
,
usage
,
format
,
pool
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize cube texture, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -1569,14 +1569,14 @@ static HRESULT WINAPI d3d9_device_CreateVertexBuffer(IDirect3DDevice9Ex *iface,
FIXME
(
"Resource sharing not implemented, *shared_handle %p.
\n
"
,
*
shared_handle
);
}
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
D3DERR_OUTOFVIDEOMEMORY
;
hr
=
vertexbuffer_init
(
object
,
device
,
size
,
usage
,
fvf
,
pool
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize vertex buffer, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -1613,14 +1613,14 @@ static HRESULT WINAPI d3d9_device_CreateIndexBuffer(IDirect3DDevice9Ex *iface, U
FIXME
(
"Resource sharing not implemented, *shared_handle %p.
\n
"
,
*
shared_handle
);
}
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
D3DERR_OUTOFVIDEOMEMORY
;
hr
=
indexbuffer_init
(
object
,
device
,
size
,
usage
,
format
,
pool
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize index buffer, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -2591,14 +2591,14 @@ static HRESULT WINAPI d3d9_device_CreateStateBlock(IDirect3DDevice9Ex *iface,
}
wined3d_mutex_unlock
();
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
hr
=
stateblock_init
(
object
,
device
,
type
,
NULL
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize stateblock, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -2653,7 +2653,7 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire
device
->
update_state
=
device
->
state
;
wined3d_mutex_unlock
();
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
{
wined3d_stateblock_decref
(
wined3d_stateblock
);
return
E_OUTOFMEMORY
;
...
...
@@ -2664,7 +2664,7 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire
{
WARN
(
"Failed to initialize stateblock, hr %#lx.
\n
"
,
hr
);
wined3d_stateblock_decref
(
wined3d_stateblock
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -3499,7 +3499,7 @@ static struct wined3d_vertex_declaration *device_get_fvf_declaration(struct d3d9
return
NULL
;
hr
=
d3d9_vertex_declaration_create
(
device
,
elements
,
&
d3d9_declaration
);
heap_
free
(
elements
);
free
(
elements
);
if
(
FAILED
(
hr
))
return
NULL
;
...
...
@@ -3507,7 +3507,7 @@ static struct wined3d_vertex_declaration *device_get_fvf_declaration(struct d3d9
{
UINT
grow
=
max
(
device
->
fvf_decl_size
/
2
,
8
);
if
(
!
(
fvf_decls
=
heap_
realloc
(
fvf_decls
,
sizeof
(
*
fvf_decls
)
*
(
device
->
fvf_decl_size
+
grow
))))
if
(
!
(
fvf_decls
=
realloc
(
fvf_decls
,
sizeof
(
*
fvf_decls
)
*
(
device
->
fvf_decl_size
+
grow
))))
{
IDirect3DVertexDeclaration9_Release
(
&
d3d9_declaration
->
IDirect3DVertexDeclaration9_iface
);
return
NULL
;
...
...
@@ -3592,14 +3592,14 @@ static HRESULT WINAPI d3d9_device_CreateVertexShader(IDirect3DDevice9Ex *iface,
TRACE
(
"iface %p, byte_code %p, shader %p.
\n
"
,
iface
,
byte_code
,
shader
);
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
hr
=
vertexshader_init
(
object
,
device
,
byte_code
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize vertex shader, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -3923,7 +3923,7 @@ static HRESULT WINAPI d3d9_device_CreatePixelShader(IDirect3DDevice9Ex *iface,
TRACE
(
"iface %p, byte_code %p, shader %p.
\n
"
,
iface
,
byte_code
,
shader
);
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
{
FIXME
(
"Failed to allocate pixel shader memory.
\n
"
);
return
E_OUTOFMEMORY
;
...
...
@@ -3933,7 +3933,7 @@ static HRESULT WINAPI d3d9_device_CreatePixelShader(IDirect3DDevice9Ex *iface,
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize pixel shader, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -4108,14 +4108,14 @@ static HRESULT WINAPI d3d9_device_CreateQuery(IDirect3DDevice9Ex *iface, D3DQUER
TRACE
(
"iface %p, type %#x, query %p.
\n
"
,
iface
,
type
,
query
);
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
hr
=
query_init
(
object
,
device
,
type
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize query, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -4574,7 +4574,7 @@ static HRESULT CDECL device_parent_texture_sub_resource_created(struct wined3d_d
{
struct
d3d9_volume
*
d3d_volume
;
if
(
!
(
d3d_volume
=
heap_alloc_zero
(
sizeof
(
*
d3d_volume
))))
if
(
!
(
d3d_volume
=
calloc
(
1
,
sizeof
(
*
d3d_volume
))))
return
E_OUTOFMEMORY
;
volume_init
(
d3d_volume
,
wined3d_texture
,
sub_resource_idx
,
parent_ops
);
...
...
@@ -4701,7 +4701,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
}
}
if
(
!
(
swapchain_desc
=
heap_
alloc
(
sizeof
(
*
swapchain_desc
)
*
count
)))
if
(
!
(
swapchain_desc
=
m
alloc
(
sizeof
(
*
swapchain_desc
)
*
count
)))
{
ERR
(
"Failed to allocate wined3d parameters.
\n
"
);
wined3d_device_release_focus_window
(
device
->
wined3d_device
);
...
...
@@ -4717,7 +4717,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
{
wined3d_device_release_focus_window
(
device
->
wined3d_device
);
wined3d_device_decref
(
device
->
wined3d_device
);
heap_
free
(
swapchain_desc
);
free
(
swapchain_desc
);
wined3d_mutex_unlock
();
return
D3DERR_INVALIDCALL
;
}
...
...
@@ -4731,7 +4731,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
{
WARN
(
"Failed to create swapchain, hr %#lx.
\n
"
,
hr
);
wined3d_device_release_focus_window
(
device
->
wined3d_device
);
heap_
free
(
swapchain_desc
);
free
(
swapchain_desc
);
wined3d_device_decref
(
device
->
wined3d_device
);
wined3d_mutex_unlock
();
return
hr
;
...
...
@@ -4749,7 +4749,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
wined3d_swapchain_decref
(
d3d_swapchain
->
wined3d_swapchain
);
wined3d_device_release_focus_window
(
device
->
wined3d_device
);
wined3d_device_decref
(
device
->
wined3d_device
);
heap_
free
(
swapchain_desc
);
free
(
swapchain_desc
);
wined3d_mutex_unlock
();
return
E_OUTOFMEMORY
;
}
...
...
@@ -4762,21 +4762,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
wined3d_mutex_unlock
();
heap_free
(
swapchain_desc
);
/* Initialize the converted declaration array. This creates a valid pointer
* and when adding decls HeapReAlloc() can be used without further checking. */
if
(
!
(
device
->
fvf_decls
=
heap_alloc
(
0
)))
{
ERR
(
"Failed to allocate FVF vertex declaration map memory.
\n
"
);
wined3d_mutex_lock
();
heap_free
(
device
->
implicit_swapchains
);
wined3d_swapchain_decref
(
d3d_swapchain
->
wined3d_swapchain
);
wined3d_device_release_focus_window
(
device
->
wined3d_device
);
wined3d_device_decref
(
device
->
wined3d_device
);
wined3d_mutex_unlock
();
return
E_OUTOFMEMORY
;
}
free
(
swapchain_desc
);
/* We could also simply ignore the initial rendertarget since it's known
* not to be a texture (we currently use these only for automatic mipmap
...
...
dlls/d3d9/directx.c
View file @
9a5b854e
...
...
@@ -83,8 +83,8 @@ static ULONG WINAPI d3d9_Release(IDirect3D9Ex *iface)
{
wined3d_decref
(
d3d9
->
wined3d
);
heap_
free
(
d3d9
->
wined3d_outputs
);
heap_
free
(
d3d9
);
free
(
d3d9
->
wined3d_outputs
);
free
(
d3d9
);
}
return
refcount
;
...
...
@@ -489,14 +489,14 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDevice(IDirect3D9Ex *iface, U
TRACE
(
"iface %p, adapter %u, device_type %#x, focus_window %p, flags %#lx, parameters %p, device %p.
\n
"
,
iface
,
adapter
,
device_type
,
focus_window
,
flags
,
parameters
,
device
);
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
hr
=
device_init
(
object
,
d3d9
,
d3d9
->
wined3d
,
adapter
,
device_type
,
focus_window
,
flags
,
parameters
,
NULL
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize device, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -610,14 +610,14 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDeviceEx(IDirect3D9Ex *iface,
TRACE
(
"iface %p, adapter %u, device_type %#x, focus_window %p, flags %#lx, parameters %p, mode %p, device %p.
\n
"
,
iface
,
adapter
,
device_type
,
focus_window
,
flags
,
parameters
,
mode
,
device
);
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
hr
=
device_init
(
object
,
d3d9
,
d3d9
->
wined3d
,
adapter
,
device_type
,
focus_window
,
flags
,
parameters
,
mode
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize device, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -710,7 +710,7 @@ BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended)
output_count
+=
wined3d_adapter_get_output_count
(
wined3d_adapter
);
}
d3d9
->
wined3d_outputs
=
heap_
calloc
(
output_count
,
sizeof
(
*
d3d9
->
wined3d_outputs
));
d3d9
->
wined3d_outputs
=
calloc
(
output_count
,
sizeof
(
*
d3d9
->
wined3d_outputs
));
if
(
!
d3d9
->
wined3d_outputs
)
{
wined3d_decref
(
d3d9
->
wined3d
);
...
...
dlls/d3d9/query.c
View file @
9a5b854e
...
...
@@ -78,7 +78,7 @@ static ULONG WINAPI d3d9_query_Release(IDirect3DQuery9 *iface)
{
wined3d_query_decref
(
query
->
wined3d_query
);
IDirect3DDevice9Ex_Release
(
query
->
parent_device
);
heap_
free
(
query
);
free
(
query
);
}
return
refcount
;
}
...
...
dlls/d3d9/shader.c
View file @
9a5b854e
...
...
@@ -119,7 +119,7 @@ static const IDirect3DVertexShader9Vtbl d3d9_vertexshader_vtbl =
static
void
STDMETHODCALLTYPE
d3d9_vertexshader_wined3d_object_destroyed
(
void
*
parent
)
{
heap_
free
(
parent
);
free
(
parent
);
}
static
const
struct
wined3d_parent_ops
d3d9_vertexshader_wined3d_parent_ops
=
...
...
@@ -262,7 +262,7 @@ static const IDirect3DPixelShader9Vtbl d3d9_pixelshader_vtbl =
static
void
STDMETHODCALLTYPE
d3d9_pixelshader_wined3d_object_destroyed
(
void
*
parent
)
{
heap_
free
(
parent
);
free
(
parent
);
}
static
const
struct
wined3d_parent_ops
d3d9_pixelshader_wined3d_parent_ops
=
...
...
dlls/d3d9/stateblock.c
View file @
9a5b854e
...
...
@@ -69,7 +69,7 @@ static ULONG WINAPI d3d9_stateblock_Release(IDirect3DStateBlock9 *iface)
wined3d_stateblock_decref
(
stateblock
->
wined3d_stateblock
);
IDirect3DDevice9Ex_Release
(
stateblock
->
parent_device
);
heap_
free
(
stateblock
);
free
(
stateblock
);
}
return
refcount
;
...
...
dlls/d3d9/surface.c
View file @
9a5b854e
...
...
@@ -345,7 +345,7 @@ static void STDMETHODCALLTYPE surface_wined3d_object_destroyed(void *parent)
{
struct
d3d9_surface
*
surface
=
parent
;
d3d9_resource_cleanup
(
&
surface
->
resource
);
heap_
free
(
surface
);
free
(
surface
);
}
static
const
struct
wined3d_parent_ops
d3d9_surface_wined3d_parent_ops
=
...
...
@@ -359,7 +359,7 @@ struct d3d9_surface *d3d9_surface_create(struct wined3d_texture *wined3d_texture
IDirect3DBaseTexture9
*
texture
;
struct
d3d9_surface
*
surface
;
if
(
!
(
surface
=
heap_alloc_zero
(
sizeof
(
*
surface
))))
if
(
!
(
surface
=
calloc
(
1
,
sizeof
(
*
surface
))))
return
NULL
;
surface
->
IDirect3DSurface9_iface
.
lpVtbl
=
&
d3d9_surface_vtbl
;
...
...
dlls/d3d9/swapchain.c
View file @
9a5b854e
...
...
@@ -348,7 +348,7 @@ static const struct IDirect3DSwapChain9ExVtbl d3d9_swapchain_vtbl =
static
void
STDMETHODCALLTYPE
d3d9_swapchain_wined3d_object_released
(
void
*
parent
)
{
heap_
free
(
parent
);
free
(
parent
);
}
static
const
struct
wined3d_parent_ops
d3d9_swapchain_wined3d_parent_ops
=
...
...
@@ -399,13 +399,13 @@ HRESULT d3d9_swapchain_create(struct d3d9_device *device, struct wined3d_swapcha
unsigned
int
i
;
HRESULT
hr
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
swapchain_init
(
object
,
device
,
desc
,
swap_interval
)))
{
WARN
(
"Failed to initialize swapchain, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
dlls/d3d9/texture.c
View file @
9a5b854e
...
...
@@ -1264,7 +1264,7 @@ static void STDMETHODCALLTYPE d3d9_texture_wined3d_object_destroyed(void *parent
if
(
texture
->
draw_texture
)
wined3d_texture_decref
(
texture
->
wined3d_texture
);
d3d9_resource_cleanup
(
&
texture
->
resource
);
heap_
free
(
texture
);
free
(
texture
);
}
static
const
struct
wined3d_parent_ops
d3d9_texture_wined3d_parent_ops
=
...
...
dlls/d3d9/vertexdeclaration.c
View file @
9a5b854e
...
...
@@ -88,7 +88,7 @@ HRESULT vdecl_convert_fvf(
has_psize
+
has_diffuse
+
has_specular
+
num_textures
+
1
;
/* convert the declaration */
if
(
!
(
elements
=
heap_
alloc
(
size
*
sizeof
(
*
elements
))))
if
(
!
(
elements
=
m
alloc
(
size
*
sizeof
(
*
elements
))))
return
D3DERR_OUTOFVIDEOMEMORY
;
elements
[
size
-
1
]
=
end_element
;
...
...
@@ -305,8 +305,8 @@ struct d3d9_vertex_declaration *unsafe_impl_from_IDirect3DVertexDeclaration9(IDi
static
void
STDMETHODCALLTYPE
d3d9_vertexdeclaration_wined3d_object_destroyed
(
void
*
parent
)
{
struct
d3d9_vertex_declaration
*
declaration
=
parent
;
heap_
free
(
declaration
->
elements
);
heap_
free
(
declaration
);
free
(
declaration
->
elements
);
free
(
declaration
);
}
static
const
struct
wined3d_parent_ops
d3d9_vertexdeclaration_wined3d_parent_ops
=
...
...
@@ -333,7 +333,7 @@ static HRESULT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9 *d3d9_elem
/* Skip the END element */
--
count
;
if
(
!
(
*
wined3d_elements
=
heap_
alloc
(
count
*
sizeof
(
**
wined3d_elements
))))
if
(
!
(
*
wined3d_elements
=
m
alloc
(
count
*
sizeof
(
**
wined3d_elements
))))
{
FIXME
(
"Memory allocation failed
\n
"
);
return
D3DERR_OUTOFVIDEOMEMORY
;
...
...
@@ -344,7 +344,7 @@ static HRESULT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9 *d3d9_elem
if
(
d3d9_elements
[
i
].
Type
>=
ARRAY_SIZE
(
d3d_dtype_lookup
))
{
WARN
(
"Invalid element type %#x.
\n
"
,
d3d9_elements
[
i
].
Type
);
heap_
free
(
*
wined3d_elements
);
free
(
*
wined3d_elements
);
return
E_FAIL
;
}
(
*
wined3d_elements
)[
i
].
format
=
d3d_dtype_lookup
[
d3d9_elements
[
i
].
Type
].
format
;
...
...
@@ -384,9 +384,9 @@ static HRESULT vertexdeclaration_init(struct d3d9_vertex_declaration *declaratio
declaration
->
refcount
=
1
;
element_count
=
wined3d_element_count
+
1
;
if
(
!
(
declaration
->
elements
=
heap_
alloc
(
element_count
*
sizeof
(
*
declaration
->
elements
))))
if
(
!
(
declaration
->
elements
=
m
alloc
(
element_count
*
sizeof
(
*
declaration
->
elements
))))
{
heap_
free
(
wined3d_elements
);
free
(
wined3d_elements
);
ERR
(
"Failed to allocate vertex declaration elements memory.
\n
"
);
return
D3DERR_OUTOFVIDEOMEMORY
;
}
...
...
@@ -397,10 +397,10 @@ static HRESULT vertexdeclaration_init(struct d3d9_vertex_declaration *declaratio
hr
=
wined3d_vertex_declaration_create
(
device
->
wined3d_device
,
wined3d_elements
,
wined3d_element_count
,
declaration
,
&
d3d9_vertexdeclaration_wined3d_parent_ops
,
&
declaration
->
wined3d_declaration
);
wined3d_mutex_unlock
();
heap_
free
(
wined3d_elements
);
free
(
wined3d_elements
);
if
(
FAILED
(
hr
))
{
heap_
free
(
declaration
->
elements
);
free
(
declaration
->
elements
);
WARN
(
"Failed to create wined3d vertex declaration, hr %#lx.
\n
"
,
hr
);
if
(
hr
==
E_INVALIDARG
)
hr
=
E_FAIL
;
...
...
@@ -419,14 +419,14 @@ HRESULT d3d9_vertex_declaration_create(struct d3d9_device *device,
struct
d3d9_vertex_declaration
*
object
;
HRESULT
hr
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
hr
=
vertexdeclaration_init
(
object
,
device
,
elements
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize vertex declaration, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
dlls/d3d9/volume.c
View file @
9a5b854e
...
...
@@ -193,7 +193,7 @@ static void STDMETHODCALLTYPE volume_wined3d_object_destroyed(void *parent)
{
struct
d3d9_volume
*
volume
=
parent
;
d3d9_resource_cleanup
(
&
volume
->
resource
);
heap_
free
(
volume
);
free
(
volume
);
}
static
const
struct
wined3d_parent_ops
d3d9_volume_wined3d_parent_ops
=
...
...
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