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
a70e3059
Commit
a70e3059
authored
Oct 29, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Oct 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8: Use CRT allocation functions.
parent
f2d17347
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
61 additions
and
62 deletions
+61
-62
buffer.c
dlls/d3d8/buffer.c
+2
-2
d3d8_main.c
dlls/d3d8/d3d8_main.c
+4
-4
d3d8_private.h
dlls/d3d8/d3d8_private.h
+0
-1
device.c
dlls/d3d8/device.c
+32
-32
directx.c
dlls/d3d8/directx.c
+5
-5
shader.c
dlls/d3d8/shader.c
+4
-4
surface.c
dlls/d3d8/surface.c
+2
-2
swapchain.c
dlls/d3d8/swapchain.c
+3
-3
texture.c
dlls/d3d8/texture.c
+1
-1
vertexdeclaration.c
dlls/d3d8/vertexdeclaration.c
+7
-7
volume.c
dlls/d3d8/volume.c
+1
-1
No files found.
dlls/d3d8/buffer.c
View file @
a70e3059
...
...
@@ -270,7 +270,7 @@ static void STDMETHODCALLTYPE d3d8_vertexbuffer_wined3d_object_destroyed(void *p
if
(
buffer
->
draw_buffer
)
wined3d_buffer_decref
(
buffer
->
wined3d_buffer
);
d3d8_resource_cleanup
(
&
buffer
->
resource
);
heap_
free
(
buffer
);
free
(
buffer
);
}
static
const
struct
wined3d_parent_ops
d3d8_vertexbuffer_wined3d_parent_ops
=
...
...
@@ -588,7 +588,7 @@ static void STDMETHODCALLTYPE d3d8_indexbuffer_wined3d_object_destroyed(void *pa
struct
d3d8_indexbuffer
*
buffer
=
parent
;
d3d8_resource_cleanup
(
&
buffer
->
resource
);
heap_
free
(
buffer
);
free
(
buffer
);
}
static
const
struct
wined3d_parent_ops
d3d8_indexbuffer_wined3d_parent_ops
=
...
...
dlls/d3d8/d3d8_main.c
View file @
a70e3059
...
...
@@ -40,13 +40,13 @@ IDirect3D8 * WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(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
(
!
d3d8_init
(
object
))
{
WARN
(
"Failed to initialize d3d8.
\n
"
);
heap_
free
(
object
);
free
(
object
);
return
NULL
;
}
...
...
@@ -95,7 +95,7 @@ done:
if
(
!
return_error
)
message
=
""
;
message_size
=
strlen
(
message
)
+
1
;
if
(
errors
&&
(
*
errors
=
heap_
alloc
(
message_size
)))
if
(
errors
&&
(
*
errors
=
m
alloc
(
message_size
)))
memcpy
(
*
errors
,
message
,
message_size
);
return
hr
;
...
...
@@ -140,7 +140,7 @@ done:
if
(
!
return_error
)
message
=
""
;
message_size
=
strlen
(
message
)
+
1
;
if
(
errors
&&
(
*
errors
=
heap_
alloc
(
message_size
)))
if
(
errors
&&
(
*
errors
=
m
alloc
(
message_size
)))
memcpy
(
*
errors
,
message
,
message_size
);
return
hr
;
...
...
dlls/d3d8/d3d8_private.h
View file @
a70e3059
...
...
@@ -31,7 +31,6 @@
#include "winbase.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "d3d8.h"
#include "wine/wined3d.h"
...
...
dlls/d3d8/device.c
View file @
a70e3059
...
...
@@ -494,7 +494,7 @@ static DWORD d3d8_allocate_handle(struct d3d8_handle_table *t, void *object, enu
UINT
new_size
=
t
->
table_size
+
(
t
->
table_size
>>
1
);
struct
d3d8_handle_entry
*
new_entries
;
if
(
!
(
new_entries
=
heap_
realloc
(
t
->
entries
,
new_size
*
sizeof
(
*
t
->
entries
))))
if
(
!
(
new_entries
=
realloc
(
t
->
entries
,
new_size
*
sizeof
(
*
t
->
entries
))))
{
ERR
(
"Failed to grow the handle table.
\n
"
);
return
D3D8_INVALID_HANDLE
;
...
...
@@ -623,7 +623,7 @@ static ULONG WINAPI d3d8_device_Release(IDirect3DDevice8 *iface)
{
d3d8_vertex_declaration_destroy
(
device
->
decls
[
i
].
declaration
);
}
heap_
free
(
device
->
decls
);
free
(
device
->
decls
);
wined3d_streaming_buffer_cleanup
(
&
device
->
vertex_buffer
);
wined3d_streaming_buffer_cleanup
(
&
device
->
index_buffer
);
...
...
@@ -635,8 +635,8 @@ static ULONG WINAPI d3d8_device_Release(IDirect3DDevice8 *iface)
wined3d_swapchain_decref
(
device
->
implicit_swapchain
);
wined3d_device_release_focus_window
(
device
->
wined3d_device
);
wined3d_device_decref
(
device
->
wined3d_device
);
heap_
free
(
device
->
handle_table
.
entries
);
heap_
free
(
device
);
free
(
device
->
handle_table
.
entries
);
free
(
device
);
wined3d_mutex_unlock
();
...
...
@@ -1127,14 +1127,14 @@ static HRESULT WINAPI d3d8_device_CreateTexture(IDirect3DDevice8 *iface,
return
D3DERR_INVALIDCALL
;
*
texture
=
NULL
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
D3DERR_OUTOFVIDEOMEMORY
;
hr
=
d3d8_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
;
}
...
...
@@ -1169,14 +1169,14 @@ static HRESULT WINAPI d3d8_device_CreateVolumeTexture(IDirect3DDevice8 *iface,
return
D3DERR_INVALIDCALL
;
*
texture
=
NULL
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
D3DERR_OUTOFVIDEOMEMORY
;
hr
=
d3d8_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
;
}
...
...
@@ -1201,14 +1201,14 @@ static HRESULT WINAPI d3d8_device_CreateCubeTexture(IDirect3DDevice8 *iface, UIN
return
D3DERR_INVALIDCALL
;
*
texture
=
NULL
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
D3DERR_OUTOFVIDEOMEMORY
;
hr
=
d3d8_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
;
}
...
...
@@ -1238,14 +1238,14 @@ static HRESULT WINAPI d3d8_device_CreateVertexBuffer(IDirect3DDevice8 *iface, UI
TRACE
(
"iface %p, size %u, usage %#lx, fvf %#lx, pool %#x, buffer %p.
\n
"
,
iface
,
size
,
usage
,
fvf
,
pool
,
buffer
);
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
;
}
...
...
@@ -1265,14 +1265,14 @@ static HRESULT WINAPI d3d8_device_CreateIndexBuffer(IDirect3DDevice8 *iface, UIN
TRACE
(
"iface %p, size %u, usage %#lx, format %#x, pool %#x, buffer %p.
\n
"
,
iface
,
size
,
usage
,
format
,
pool
,
buffer
);
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
;
}
...
...
@@ -2831,7 +2831,7 @@ static HRESULT WINAPI d3d8_device_CreateVertexShader(IDirect3DDevice8 *iface,
TRACE
(
"iface %p, declaration %p, byte_code %p, shader %p, usage %#lx.
\n
"
,
iface
,
declaration
,
byte_code
,
shader
,
usage
);
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
{
*
shader
=
0
;
return
E_OUTOFMEMORY
;
...
...
@@ -2843,7 +2843,7 @@ static HRESULT WINAPI d3d8_device_CreateVertexShader(IDirect3DDevice8 *iface,
if
(
handle
==
D3D8_INVALID_HANDLE
)
{
ERR
(
"Failed to allocate vertex shader handle.
\n
"
);
heap_
free
(
object
);
free
(
object
);
*
shader
=
0
;
return
E_OUTOFMEMORY
;
}
...
...
@@ -2857,7 +2857,7 @@ static HRESULT WINAPI d3d8_device_CreateVertexShader(IDirect3DDevice8 *iface,
wined3d_mutex_lock
();
d3d8_free_handle
(
&
device
->
handle_table
,
handle
,
D3D8_HANDLE_VS
);
wined3d_mutex_unlock
();
heap_
free
(
object
);
free
(
object
);
*
shader
=
0
;
return
hr
;
}
...
...
@@ -2897,13 +2897,13 @@ static struct d3d8_vertex_declaration *d3d8_device_get_fvf_declaration(struct d3
}
TRACE
(
"not found. Creating and inserting at position %d.
\n
"
,
low
);
if
(
!
(
d3d8_declaration
=
heap_
alloc
(
sizeof
(
*
d3d8_declaration
))))
if
(
!
(
d3d8_declaration
=
m
alloc
(
sizeof
(
*
d3d8_declaration
))))
return
NULL
;
if
(
FAILED
(
hr
=
d3d8_vertex_declaration_init_fvf
(
d3d8_declaration
,
device
,
fvf
)))
{
WARN
(
"Failed to initialize vertex declaration, hr %#lx.
\n
"
,
hr
);
heap_
free
(
d3d8_declaration
);
free
(
d3d8_declaration
);
return
NULL
;
}
...
...
@@ -2911,7 +2911,7 @@ static struct d3d8_vertex_declaration *d3d8_device_get_fvf_declaration(struct d3
{
UINT
grow
=
device
->
declArraySize
/
2
;
if
(
!
(
convertedDecls
=
heap_
realloc
(
convertedDecls
,
if
(
!
(
convertedDecls
=
realloc
(
convertedDecls
,
sizeof
(
*
convertedDecls
)
*
(
device
->
numConvertedDecls
+
grow
))))
{
d3d8_vertex_declaration_destroy
(
d3d8_declaration
);
...
...
@@ -3205,7 +3205,7 @@ static HRESULT WINAPI d3d8_device_CreatePixelShader(IDirect3DDevice8 *iface,
if
(
!
shader
)
return
D3DERR_INVALIDCALL
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
wined3d_mutex_lock
();
...
...
@@ -3214,7 +3214,7 @@ static HRESULT WINAPI d3d8_device_CreatePixelShader(IDirect3DDevice8 *iface,
if
(
handle
==
D3D8_INVALID_HANDLE
)
{
ERR
(
"Failed to allocate pixel shader handle.
\n
"
);
heap_
free
(
object
);
free
(
object
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -3227,7 +3227,7 @@ static HRESULT WINAPI d3d8_device_CreatePixelShader(IDirect3DDevice8 *iface,
wined3d_mutex_lock
();
d3d8_free_handle
(
&
device
->
handle_table
,
handle
,
D3D8_HANDLE_PS
);
wined3d_mutex_unlock
();
heap_
free
(
object
);
free
(
object
);
*
shader
=
0
;
return
hr
;
}
...
...
@@ -3623,7 +3623,7 @@ static HRESULT CDECL device_parent_texture_sub_resource_created(struct wined3d_d
{
struct
d3d8_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
);
...
...
@@ -3692,8 +3692,8 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
device
->
device_parent
.
ops
=
&
d3d8_wined3d_device_parent_ops
;
device
->
adapter_ordinal
=
adapter
;
device
->
ref
=
1
;
if
(
!
(
device
->
handle_table
.
entries
=
heap_alloc_zero
(
D3D8_INITIAL_HANDLE_TABLE_SIZE
*
sizeof
(
*
device
->
handle_table
.
entries
))))
if
(
!
(
device
->
handle_table
.
entries
=
calloc
(
D3D8_INITIAL_HANDLE_TABLE_SIZE
,
sizeof
(
*
device
->
handle_table
.
entries
))))
{
ERR
(
"Failed to allocate handle table memory.
\n
"
);
return
E_OUTOFMEMORY
;
...
...
@@ -3711,7 +3711,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
{
WARN
(
"Failed to create wined3d device, hr %#lx.
\n
"
,
hr
);
wined3d_mutex_unlock
();
heap_
free
(
device
->
handle_table
.
entries
);
free
(
device
->
handle_table
.
entries
);
return
hr
;
}
...
...
@@ -3742,7 +3742,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
ERR
(
"Failed to acquire focus window, hr %#lx.
\n
"
,
hr
);
wined3d_device_decref
(
device
->
wined3d_device
);
wined3d_mutex_unlock
();
heap_
free
(
device
->
handle_table
.
entries
);
free
(
device
->
handle_table
.
entries
);
return
hr
;
}
}
...
...
@@ -3755,7 +3755,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
wined3d_device_release_focus_window
(
device
->
wined3d_device
);
wined3d_device_decref
(
device
->
wined3d_device
);
wined3d_mutex_unlock
();
heap_
free
(
device
->
handle_table
.
entries
);
free
(
device
->
handle_table
.
entries
);
return
D3DERR_INVALIDCALL
;
}
swapchain_desc
.
flags
|=
WINED3D_SWAPCHAIN_IMPLICIT
;
...
...
@@ -3767,7 +3767,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
wined3d_device_release_focus_window
(
device
->
wined3d_device
);
wined3d_device_decref
(
device
->
wined3d_device
);
wined3d_mutex_unlock
();
heap_
free
(
device
->
handle_table
.
entries
);
free
(
device
->
handle_table
.
entries
);
return
hr
;
}
...
...
@@ -3785,7 +3785,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
&
swapchain_desc
,
parameters
->
FullScreen_PresentationInterval
);
device
->
declArraySize
=
16
;
if
(
!
(
device
->
decls
=
heap_
alloc
(
device
->
declArraySize
*
sizeof
(
*
device
->
decls
))))
if
(
!
(
device
->
decls
=
m
alloc
(
device
->
declArraySize
*
sizeof
(
*
device
->
decls
))))
{
ERR
(
"Failed to allocate FVF vertex declaration map memory.
\n
"
);
hr
=
E_OUTOFMEMORY
;
...
...
@@ -3805,6 +3805,6 @@ err:
wined3d_device_release_focus_window
(
device
->
wined3d_device
);
wined3d_device_decref
(
device
->
wined3d_device
);
wined3d_mutex_unlock
();
heap_
free
(
device
->
handle_table
.
entries
);
free
(
device
->
handle_table
.
entries
);
return
hr
;
}
dlls/d3d8/directx.c
View file @
a70e3059
...
...
@@ -70,8 +70,8 @@ static ULONG WINAPI d3d8_Release(IDirect3D8 *iface)
wined3d_decref
(
d3d8
->
wined3d
);
wined3d_mutex_unlock
();
heap_
free
(
d3d8
->
wined3d_outputs
);
heap_
free
(
d3d8
);
free
(
d3d8
->
wined3d_outputs
);
free
(
d3d8
);
}
return
refcount
;
...
...
@@ -432,14 +432,14 @@ static HRESULT WINAPI d3d8_CreateDevice(IDirect3D8 *iface, UINT adapter,
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
,
d3d8
,
d3d8
->
wined3d
,
adapter
,
device_type
,
focus_window
,
flags
,
parameters
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize device, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -498,7 +498,7 @@ BOOL d3d8_init(struct d3d8 *d3d8)
output_count
+=
wined3d_adapter_get_output_count
(
wined3d_adapter
);
}
d3d8
->
wined3d_outputs
=
heap_
calloc
(
output_count
,
sizeof
(
*
d3d8
->
wined3d_outputs
));
d3d8
->
wined3d_outputs
=
calloc
(
output_count
,
sizeof
(
*
d3d8
->
wined3d_outputs
));
if
(
!
d3d8
->
wined3d_outputs
)
{
wined3d_decref
(
d3d8
->
wined3d
);
...
...
dlls/d3d8/shader.c
View file @
a70e3059
...
...
@@ -25,7 +25,7 @@ static void STDMETHODCALLTYPE d3d8_vertexshader_wined3d_object_destroyed(void *p
{
struct
d3d8_vertex_shader
*
shader
=
parent
;
d3d8_vertex_declaration_destroy
(
shader
->
vertex_declaration
);
heap_
free
(
shader
);
free
(
shader
);
}
void
d3d8_vertex_shader_destroy
(
struct
d3d8_vertex_shader
*
shader
)
...
...
@@ -58,14 +58,14 @@ static HRESULT d3d8_vertexshader_create_vertexdeclaration(struct d3d8_device *de
TRACE
(
"device %p, declaration %p, shader_handle %#lx, decl_ptr %p.
\n
"
,
device
,
declaration
,
shader_handle
,
decl_ptr
);
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
hr
=
d3d8_vertex_declaration_init
(
object
,
device
,
declaration
,
shader_handle
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize vertex declaration, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -136,7 +136,7 @@ HRESULT d3d8_vertex_shader_init(struct d3d8_vertex_shader *shader, struct d3d8_d
static
void
STDMETHODCALLTYPE
d3d8_pixelshader_wined3d_object_destroyed
(
void
*
parent
)
{
heap_
free
(
parent
);
free
(
parent
);
}
void
d3d8_pixel_shader_destroy
(
struct
d3d8_pixel_shader
*
shader
)
...
...
dlls/d3d8/surface.c
View file @
a70e3059
...
...
@@ -307,7 +307,7 @@ static void STDMETHODCALLTYPE surface_wined3d_object_destroyed(void *parent)
{
struct
d3d8_surface
*
surface
=
parent
;
d3d8_resource_cleanup
(
&
surface
->
resource
);
heap_
free
(
surface
);
free
(
surface
);
}
static
const
struct
wined3d_parent_ops
d3d8_surface_wined3d_parent_ops
=
...
...
@@ -321,7 +321,7 @@ struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture
IDirect3DBaseTexture8
*
texture
;
struct
d3d8_surface
*
surface
;
if
(
!
(
surface
=
heap_alloc_zero
(
sizeof
(
*
surface
))))
if
(
!
(
surface
=
calloc
(
1
,
sizeof
(
*
surface
))))
return
NULL
;
surface
->
IDirect3DSurface8_iface
.
lpVtbl
=
&
d3d8_surface_vtbl
;
...
...
dlls/d3d8/swapchain.c
View file @
a70e3059
...
...
@@ -148,7 +148,7 @@ static const IDirect3DSwapChain8Vtbl d3d8_swapchain_vtbl =
static
void
STDMETHODCALLTYPE
d3d8_swapchain_wined3d_object_released
(
void
*
parent
)
{
heap_
free
(
parent
);
free
(
parent
);
}
static
const
struct
wined3d_parent_ops
d3d8_swapchain_wined3d_parent_ops
=
...
...
@@ -199,13 +199,13 @@ HRESULT d3d8_swapchain_create(struct d3d8_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/d3d8/texture.c
View file @
a70e3059
...
...
@@ -1041,7 +1041,7 @@ static void STDMETHODCALLTYPE d3d8_texture_wined3d_object_destroyed(void *parent
if
(
texture
->
draw_texture
)
wined3d_texture_decref
(
texture
->
wined3d_texture
);
d3d8_resource_cleanup
(
&
texture
->
resource
);
heap_
free
(
texture
);
free
(
texture
);
}
static
const
struct
wined3d_parent_ops
d3d8_texture_wined3d_parent_ops
=
...
...
dlls/d3d8/vertexdeclaration.c
View file @
a70e3059
...
...
@@ -261,7 +261,7 @@ static UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3
*
stream_map
=
0
;
/* 128 should be enough for anyone... */
*
wined3d_elements
=
heap_alloc_zero
(
128
*
sizeof
(
**
wined3d_elements
));
*
wined3d_elements
=
calloc
(
128
,
sizeof
(
**
wined3d_elements
));
while
(
D3DVSD_END
()
!=
*
token
)
{
token_type
=
((
*
token
&
D3DVSD_TOKENTYPEMASK
)
>>
D3DVSD_TOKENTYPESHIFT
);
...
...
@@ -311,8 +311,8 @@ static UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3
static
void
STDMETHODCALLTYPE
d3d8_vertexdeclaration_wined3d_object_destroyed
(
void
*
parent
)
{
struct
d3d8_vertex_declaration
*
declaration
=
parent
;
heap_
free
(
declaration
->
elements
);
heap_
free
(
declaration
);
free
(
declaration
->
elements
);
free
(
declaration
);
}
void
d3d8_vertex_declaration_destroy
(
struct
d3d8_vertex_declaration
*
declaration
)
...
...
@@ -338,10 +338,10 @@ HRESULT d3d8_vertex_declaration_init(struct d3d8_vertex_declaration *declaration
wined3d_element_count
=
convert_to_wined3d_declaration
(
elements
,
&
declaration
->
elements_size
,
&
wined3d_elements
,
&
declaration
->
stream_map
);
if
(
!
(
declaration
->
elements
=
heap_
alloc
(
declaration
->
elements_size
)))
if
(
!
(
declaration
->
elements
=
m
alloc
(
declaration
->
elements_size
)))
{
ERR
(
"Failed to allocate vertex declaration elements memory.
\n
"
);
heap_
free
(
wined3d_elements
);
free
(
wined3d_elements
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -351,11 +351,11 @@ HRESULT d3d8_vertex_declaration_init(struct d3d8_vertex_declaration *declaration
hr
=
wined3d_vertex_declaration_create
(
device
->
wined3d_device
,
wined3d_elements
,
wined3d_element_count
,
declaration
,
&
d3d8_vertexdeclaration_wined3d_parent_ops
,
&
declaration
->
wined3d_vertex_declaration
);
wined3d_mutex_unlock
();
heap_
free
(
wined3d_elements
);
free
(
wined3d_elements
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create wined3d vertex declaration, hr %#lx.
\n
"
,
hr
);
heap_
free
(
declaration
->
elements
);
free
(
declaration
->
elements
);
if
(
hr
==
E_INVALIDARG
)
hr
=
E_FAIL
;
return
hr
;
...
...
dlls/d3d8/volume.c
View file @
a70e3059
...
...
@@ -192,7 +192,7 @@ static void STDMETHODCALLTYPE volume_wined3d_object_destroyed(void *parent)
{
struct
d3d8_volume
*
volume
=
parent
;
d3d8_resource_cleanup
(
&
volume
->
resource
);
heap_
free
(
volume
);
free
(
volume
);
}
static
const
struct
wined3d_parent_ops
d3d8_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