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
Expand all
Hide 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
...
@@ -270,7 +270,7 @@ static void STDMETHODCALLTYPE d3d8_vertexbuffer_wined3d_object_destroyed(void *p
if
(
buffer
->
draw_buffer
)
if
(
buffer
->
draw_buffer
)
wined3d_buffer_decref
(
buffer
->
wined3d_buffer
);
wined3d_buffer_decref
(
buffer
->
wined3d_buffer
);
d3d8_resource_cleanup
(
&
buffer
->
resource
);
d3d8_resource_cleanup
(
&
buffer
->
resource
);
heap_
free
(
buffer
);
free
(
buffer
);
}
}
static
const
struct
wined3d_parent_ops
d3d8_vertexbuffer_wined3d_parent_ops
=
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
...
@@ -588,7 +588,7 @@ static void STDMETHODCALLTYPE d3d8_indexbuffer_wined3d_object_destroyed(void *pa
struct
d3d8_indexbuffer
*
buffer
=
parent
;
struct
d3d8_indexbuffer
*
buffer
=
parent
;
d3d8_resource_cleanup
(
&
buffer
->
resource
);
d3d8_resource_cleanup
(
&
buffer
->
resource
);
heap_
free
(
buffer
);
free
(
buffer
);
}
}
static
const
struct
wined3d_parent_ops
d3d8_indexbuffer_wined3d_parent_ops
=
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)
...
@@ -40,13 +40,13 @@ IDirect3D8 * WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT sdk_version)
TRACE
(
"sdk_version %#x.
\n
"
,
sdk_version
);
TRACE
(
"sdk_version %#x.
\n
"
,
sdk_version
);
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
NULL
;
return
NULL
;
if
(
!
d3d8_init
(
object
))
if
(
!
d3d8_init
(
object
))
{
{
WARN
(
"Failed to initialize d3d8.
\n
"
);
WARN
(
"Failed to initialize d3d8.
\n
"
);
heap_
free
(
object
);
free
(
object
);
return
NULL
;
return
NULL
;
}
}
...
@@ -95,7 +95,7 @@ done:
...
@@ -95,7 +95,7 @@ done:
if
(
!
return_error
)
if
(
!
return_error
)
message
=
""
;
message
=
""
;
message_size
=
strlen
(
message
)
+
1
;
message_size
=
strlen
(
message
)
+
1
;
if
(
errors
&&
(
*
errors
=
heap_
alloc
(
message_size
)))
if
(
errors
&&
(
*
errors
=
m
alloc
(
message_size
)))
memcpy
(
*
errors
,
message
,
message_size
);
memcpy
(
*
errors
,
message
,
message_size
);
return
hr
;
return
hr
;
...
@@ -140,7 +140,7 @@ done:
...
@@ -140,7 +140,7 @@ done:
if
(
!
return_error
)
if
(
!
return_error
)
message
=
""
;
message
=
""
;
message_size
=
strlen
(
message
)
+
1
;
message_size
=
strlen
(
message
)
+
1
;
if
(
errors
&&
(
*
errors
=
heap_
alloc
(
message_size
)))
if
(
errors
&&
(
*
errors
=
m
alloc
(
message_size
)))
memcpy
(
*
errors
,
message
,
message_size
);
memcpy
(
*
errors
,
message
,
message_size
);
return
hr
;
return
hr
;
...
...
dlls/d3d8/d3d8_private.h
View file @
a70e3059
...
@@ -31,7 +31,6 @@
...
@@ -31,7 +31,6 @@
#include "winbase.h"
#include "winbase.h"
#include "wingdi.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "d3d8.h"
#include "d3d8.h"
#include "wine/wined3d.h"
#include "wine/wined3d.h"
...
...
dlls/d3d8/device.c
View file @
a70e3059
This diff is collapsed.
Click to expand it.
dlls/d3d8/directx.c
View file @
a70e3059
...
@@ -70,8 +70,8 @@ static ULONG WINAPI d3d8_Release(IDirect3D8 *iface)
...
@@ -70,8 +70,8 @@ static ULONG WINAPI d3d8_Release(IDirect3D8 *iface)
wined3d_decref
(
d3d8
->
wined3d
);
wined3d_decref
(
d3d8
->
wined3d
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
heap_
free
(
d3d8
->
wined3d_outputs
);
free
(
d3d8
->
wined3d_outputs
);
heap_
free
(
d3d8
);
free
(
d3d8
);
}
}
return
refcount
;
return
refcount
;
...
@@ -432,14 +432,14 @@ static HRESULT WINAPI d3d8_CreateDevice(IDirect3D8 *iface, UINT adapter,
...
@@ -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
"
,
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
);
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
;
return
E_OUTOFMEMORY
;
hr
=
device_init
(
object
,
d3d8
,
d3d8
->
wined3d
,
adapter
,
device_type
,
focus_window
,
flags
,
parameters
);
hr
=
device_init
(
object
,
d3d8
,
d3d8
->
wined3d
,
adapter
,
device_type
,
focus_window
,
flags
,
parameters
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
WARN
(
"Failed to initialize device, hr %#lx.
\n
"
,
hr
);
WARN
(
"Failed to initialize device, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
return
hr
;
}
}
...
@@ -498,7 +498,7 @@ BOOL d3d8_init(struct d3d8 *d3d8)
...
@@ -498,7 +498,7 @@ BOOL d3d8_init(struct d3d8 *d3d8)
output_count
+=
wined3d_adapter_get_output_count
(
wined3d_adapter
);
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
)
if
(
!
d3d8
->
wined3d_outputs
)
{
{
wined3d_decref
(
d3d8
->
wined3d
);
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
...
@@ -25,7 +25,7 @@ static void STDMETHODCALLTYPE d3d8_vertexshader_wined3d_object_destroyed(void *p
{
{
struct
d3d8_vertex_shader
*
shader
=
parent
;
struct
d3d8_vertex_shader
*
shader
=
parent
;
d3d8_vertex_declaration_destroy
(
shader
->
vertex_declaration
);
d3d8_vertex_declaration_destroy
(
shader
->
vertex_declaration
);
heap_
free
(
shader
);
free
(
shader
);
}
}
void
d3d8_vertex_shader_destroy
(
struct
d3d8_vertex_shader
*
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
...
@@ -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
"
,
TRACE
(
"device %p, declaration %p, shader_handle %#lx, decl_ptr %p.
\n
"
,
device
,
declaration
,
shader_handle
,
decl_ptr
);
device
,
declaration
,
shader_handle
,
decl_ptr
);
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
hr
=
d3d8_vertex_declaration_init
(
object
,
device
,
declaration
,
shader_handle
);
hr
=
d3d8_vertex_declaration_init
(
object
,
device
,
declaration
,
shader_handle
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
WARN
(
"Failed to initialize vertex declaration, hr %#lx.
\n
"
,
hr
);
WARN
(
"Failed to initialize vertex declaration, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
return
hr
;
}
}
...
@@ -136,7 +136,7 @@ HRESULT d3d8_vertex_shader_init(struct d3d8_vertex_shader *shader, struct d3d8_d
...
@@ -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
)
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
)
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)
...
@@ -307,7 +307,7 @@ static void STDMETHODCALLTYPE surface_wined3d_object_destroyed(void *parent)
{
{
struct
d3d8_surface
*
surface
=
parent
;
struct
d3d8_surface
*
surface
=
parent
;
d3d8_resource_cleanup
(
&
surface
->
resource
);
d3d8_resource_cleanup
(
&
surface
->
resource
);
heap_
free
(
surface
);
free
(
surface
);
}
}
static
const
struct
wined3d_parent_ops
d3d8_surface_wined3d_parent_ops
=
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
...
@@ -321,7 +321,7 @@ struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture
IDirect3DBaseTexture8
*
texture
;
IDirect3DBaseTexture8
*
texture
;
struct
d3d8_surface
*
surface
;
struct
d3d8_surface
*
surface
;
if
(
!
(
surface
=
heap_alloc_zero
(
sizeof
(
*
surface
))))
if
(
!
(
surface
=
calloc
(
1
,
sizeof
(
*
surface
))))
return
NULL
;
return
NULL
;
surface
->
IDirect3DSurface8_iface
.
lpVtbl
=
&
d3d8_surface_vtbl
;
surface
->
IDirect3DSurface8_iface
.
lpVtbl
=
&
d3d8_surface_vtbl
;
...
...
dlls/d3d8/swapchain.c
View file @
a70e3059
...
@@ -148,7 +148,7 @@ static const IDirect3DSwapChain8Vtbl d3d8_swapchain_vtbl =
...
@@ -148,7 +148,7 @@ static const IDirect3DSwapChain8Vtbl d3d8_swapchain_vtbl =
static
void
STDMETHODCALLTYPE
d3d8_swapchain_wined3d_object_released
(
void
*
parent
)
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
=
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
...
@@ -199,13 +199,13 @@ HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapcha
unsigned
int
i
;
unsigned
int
i
;
HRESULT
hr
;
HRESULT
hr
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
swapchain_init
(
object
,
device
,
desc
,
swap_interval
)))
if
(
FAILED
(
hr
=
swapchain_init
(
object
,
device
,
desc
,
swap_interval
)))
{
{
WARN
(
"Failed to initialize swapchain, hr %#lx.
\n
"
,
hr
);
WARN
(
"Failed to initialize swapchain, hr %#lx.
\n
"
,
hr
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
return
hr
;
}
}
...
...
dlls/d3d8/texture.c
View file @
a70e3059
...
@@ -1041,7 +1041,7 @@ static void STDMETHODCALLTYPE d3d8_texture_wined3d_object_destroyed(void *parent
...
@@ -1041,7 +1041,7 @@ static void STDMETHODCALLTYPE d3d8_texture_wined3d_object_destroyed(void *parent
if
(
texture
->
draw_texture
)
if
(
texture
->
draw_texture
)
wined3d_texture_decref
(
texture
->
wined3d_texture
);
wined3d_texture_decref
(
texture
->
wined3d_texture
);
d3d8_resource_cleanup
(
&
texture
->
resource
);
d3d8_resource_cleanup
(
&
texture
->
resource
);
heap_
free
(
texture
);
free
(
texture
);
}
}
static
const
struct
wined3d_parent_ops
d3d8_texture_wined3d_parent_ops
=
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
...
@@ -261,7 +261,7 @@ static UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3
*
stream_map
=
0
;
*
stream_map
=
0
;
/* 128 should be enough for anyone... */
/* 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
)
while
(
D3DVSD_END
()
!=
*
token
)
{
{
token_type
=
((
*
token
&
D3DVSD_TOKENTYPEMASK
)
>>
D3DVSD_TOKENTYPESHIFT
);
token_type
=
((
*
token
&
D3DVSD_TOKENTYPEMASK
)
>>
D3DVSD_TOKENTYPESHIFT
);
...
@@ -311,8 +311,8 @@ static UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3
...
@@ -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
)
static
void
STDMETHODCALLTYPE
d3d8_vertexdeclaration_wined3d_object_destroyed
(
void
*
parent
)
{
{
struct
d3d8_vertex_declaration
*
declaration
=
parent
;
struct
d3d8_vertex_declaration
*
declaration
=
parent
;
heap_
free
(
declaration
->
elements
);
free
(
declaration
->
elements
);
heap_
free
(
declaration
);
free
(
declaration
);
}
}
void
d3d8_vertex_declaration_destroy
(
struct
d3d8_vertex_declaration
*
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
...
@@ -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_element_count
=
convert_to_wined3d_declaration
(
elements
,
&
declaration
->
elements_size
,
&
wined3d_elements
,
&
declaration
->
stream_map
);
&
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
"
);
ERR
(
"Failed to allocate vertex declaration elements memory.
\n
"
);
heap_
free
(
wined3d_elements
);
free
(
wined3d_elements
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
...
@@ -351,11 +351,11 @@ HRESULT d3d8_vertex_declaration_init(struct d3d8_vertex_declaration *declaration
...
@@ -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
,
hr
=
wined3d_vertex_declaration_create
(
device
->
wined3d_device
,
wined3d_elements
,
wined3d_element_count
,
declaration
,
&
d3d8_vertexdeclaration_wined3d_parent_ops
,
&
declaration
->
wined3d_vertex_declaration
);
declaration
,
&
d3d8_vertexdeclaration_wined3d_parent_ops
,
&
declaration
->
wined3d_vertex_declaration
);
wined3d_mutex_unlock
();
wined3d_mutex_unlock
();
heap_
free
(
wined3d_elements
);
free
(
wined3d_elements
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
WARN
(
"Failed to create wined3d vertex declaration, hr %#lx.
\n
"
,
hr
);
WARN
(
"Failed to create wined3d vertex declaration, hr %#lx.
\n
"
,
hr
);
heap_
free
(
declaration
->
elements
);
free
(
declaration
->
elements
);
if
(
hr
==
E_INVALIDARG
)
if
(
hr
==
E_INVALIDARG
)
hr
=
E_FAIL
;
hr
=
E_FAIL
;
return
hr
;
return
hr
;
...
...
dlls/d3d8/volume.c
View file @
a70e3059
...
@@ -192,7 +192,7 @@ static void STDMETHODCALLTYPE volume_wined3d_object_destroyed(void *parent)
...
@@ -192,7 +192,7 @@ static void STDMETHODCALLTYPE volume_wined3d_object_destroyed(void *parent)
{
{
struct
d3d8_volume
*
volume
=
parent
;
struct
d3d8_volume
*
volume
=
parent
;
d3d8_resource_cleanup
(
&
volume
->
resource
);
d3d8_resource_cleanup
(
&
volume
->
resource
);
heap_
free
(
volume
);
free
(
volume
);
}
}
static
const
struct
wined3d_parent_ops
d3d8_volume_wined3d_parent_ops
=
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