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
6db89702
Commit
6db89702
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/tests: Use CRT allocation functions.
parent
a70e3059
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
46 deletions
+45
-46
device.c
dlls/d3d8/tests/device.c
+21
-22
stateblock.c
dlls/d3d8/tests/stateblock.c
+20
-20
visual.c
dlls/d3d8/tests/visual.c
+4
-4
No files found.
dlls/d3d8/tests/device.c
View file @
6db89702
...
...
@@ -26,7 +26,6 @@
#include <initguid.h>
#include <d3d8.h>
#include "wine/test.h"
#include "wine/heap.h"
struct
vec3
{
...
...
@@ -129,7 +128,7 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_
DISPLAY_DEVICEW
display_device
;
DEVMODEW
*
modes
,
*
tmp
;
if
(
!
(
modes
=
heap_
alloc
(
size
*
sizeof
(
*
modes
))))
if
(
!
(
modes
=
m
alloc
(
size
*
sizeof
(
*
modes
))))
return
FALSE
;
display_device
.
cb
=
sizeof
(
display_device
);
...
...
@@ -145,9 +144,9 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_
if
(
count
>=
size
)
{
size
*=
2
;
if
(
!
(
tmp
=
heap_
realloc
(
modes
,
size
*
sizeof
(
*
modes
))))
if
(
!
(
tmp
=
realloc
(
modes
,
size
*
sizeof
(
*
modes
))))
{
heap_
free
(
modes
);
free
(
modes
);
return
FALSE
;
}
modes
=
tmp
;
...
...
@@ -157,7 +156,7 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_
modes
[
count
].
dmSize
=
sizeof
(
modes
[
count
]);
if
(
!
EnumDisplaySettingsW
(
display_device
.
DeviceName
,
ENUM_CURRENT_SETTINGS
,
&
modes
[
count
]))
{
heap_
free
(
modes
);
free
(
modes
);
return
FALSE
;
}
...
...
@@ -1554,7 +1553,7 @@ static void test_reset(void)
hr
=
IDirect3D8_GetAdapterDisplayMode
(
d3d8
,
D3DADAPTER_DEFAULT
,
&
d3ddm
);
ok
(
SUCCEEDED
(
hr
),
"GetAdapterDisplayMode failed, hr %#lx.
\n
"
,
hr
);
adapter_mode_count
=
IDirect3D8_GetAdapterModeCount
(
d3d8
,
D3DADAPTER_DEFAULT
);
modes
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
modes
)
*
adapter_mode_count
);
modes
=
malloc
(
sizeof
(
*
modes
)
*
adapter_mode_count
);
for
(
i
=
0
;
i
<
adapter_mode_count
;
++
i
)
{
UINT
j
;
...
...
@@ -2120,7 +2119,7 @@ static void test_reset(void)
IDirect3DSurface8_Release
(
surface
);
cleanup:
HeapFree
(
GetProcessHeap
(),
0
,
modes
);
free
(
modes
);
if
(
device2
)
IDirect3DDevice8_Release
(
device2
);
if
(
device1
)
...
...
@@ -2264,7 +2263,7 @@ static void test_shader(void)
hr
=
IDirect3DDevice8_GetVertexShaderDeclaration
(
device
,
hVertexShader
,
NULL
,
&
data_size
);
ok
(
hr
==
D3D_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
data_size
==
vertex_decl_size
,
"Got data_size %lu, expected %lu.
\n
"
,
data_size
,
vertex_decl_size
);
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
vertex_decl_size
);
data
=
malloc
(
vertex_decl_size
);
data_size
=
1
;
hr
=
IDirect3DDevice8_GetVertexShaderDeclaration
(
device
,
hVertexShader
,
data
,
&
data_size
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Got hr %#lx.
\n
"
,
hr
);
...
...
@@ -2274,12 +2273,12 @@ static void test_shader(void)
ok
(
hr
==
D3D_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
data_size
==
vertex_decl_size
,
"Got data_size %lu, expected %lu.
\n
"
,
data_size
,
vertex_decl_size
);
ok
(
!
memcmp
(
data
,
dwVertexDecl
,
vertex_decl_size
),
"data not equal to shader declaration
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
/* Verify that we can retrieve the shader function */
hr
=
IDirect3DDevice8_GetVertexShaderFunction
(
device
,
hVertexShader
,
NULL
,
&
data_size
);
ok
(
hr
==
D3D_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
data_size
==
simple_vs_size
,
"Got data_size %lu, expected %lu.
\n
"
,
data_size
,
simple_vs_size
);
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
simple_vs_size
);
data
=
malloc
(
simple_vs_size
);
data_size
=
1
;
hr
=
IDirect3DDevice8_GetVertexShaderFunction
(
device
,
hVertexShader
,
data
,
&
data_size
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Got hr %#lx.
\n
"
,
hr
);
...
...
@@ -2289,7 +2288,7 @@ static void test_shader(void)
ok
(
hr
==
D3D_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
data_size
==
simple_vs_size
,
"Got data_size %lu, expected %lu.
\n
"
,
data_size
,
simple_vs_size
);
ok
(
!
memcmp
(
data
,
simple_vs
,
simple_vs_size
),
"data not equal to shader function
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
/* Delete the assigned shader. This is supposed to work */
hr
=
IDirect3DDevice8_DeleteVertexShader
(
device
,
hVertexShader
);
ok
(
hr
==
D3D_OK
,
"Got hr %#lx.
\n
"
,
hr
);
...
...
@@ -2331,7 +2330,7 @@ static void test_shader(void)
hr
=
IDirect3DDevice8_GetPixelShaderFunction
(
device
,
hPixelShader
,
NULL
,
&
data_size
);
ok
(
hr
==
D3D_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
data_size
==
simple_ps_size
,
"Got data_size %lu, expected %lu.
\n
"
,
data_size
,
simple_ps_size
);
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
simple_ps_size
);
data
=
malloc
(
simple_ps_size
);
data_size
=
1
;
hr
=
IDirect3DDevice8_GetPixelShaderFunction
(
device
,
hPixelShader
,
data
,
&
data_size
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Got hr %#lx.
\n
"
,
hr
);
...
...
@@ -2341,7 +2340,7 @@ static void test_shader(void)
ok
(
hr
==
D3D_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
data_size
==
simple_ps_size
,
"Got data_size %lu, expected %lu.
\n
"
,
data_size
,
simple_ps_size
);
ok
(
!
memcmp
(
data
,
simple_ps
,
simple_ps_size
),
"data not equal to shader function
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
/* Delete the assigned shader. This is supposed to work */
hr
=
IDirect3DDevice8_DeletePixelShader
(
device
,
hPixelShader
);
ok
(
hr
==
D3D_OK
,
"Got hr %#lx.
\n
"
,
hr
);
...
...
@@ -4711,7 +4710,7 @@ done:
IDirect3D8_Release
(
d3d8
);
ret
=
restore_display_modes
(
original_modes
,
display_count
);
ok
(
ret
,
"Failed to restore display modes.
\n
"
);
heap_
free
(
original_modes
);
free
(
original_modes
);
}
static
void
test_device_window_reset
(
void
)
...
...
@@ -5052,11 +5051,11 @@ static void test_validate_vs(void)
hr
=
ValidateVertexShader
(
NULL
,
NULL
,
NULL
,
FALSE
,
&
errors
);
ok
(
hr
==
E_FAIL
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!*
errors
,
"Got unexpected string
\"
%s
\"
.
\n
"
,
errors
);
heap_
free
(
errors
);
free
(
errors
);
hr
=
ValidateVertexShader
(
NULL
,
NULL
,
NULL
,
TRUE
,
&
errors
);
ok
(
hr
==
E_FAIL
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!!*
errors
,
"Got unexpected empty string.
\n
"
);
heap_
free
(
errors
);
free
(
errors
);
hr
=
ValidateVertexShader
(
vs_code
,
NULL
,
NULL
,
FALSE
,
NULL
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
...
...
@@ -5065,7 +5064,7 @@ static void test_validate_vs(void)
hr
=
ValidateVertexShader
(
vs_code
,
NULL
,
NULL
,
TRUE
,
&
errors
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!*
errors
,
"Got unexpected string
\"
%s
\"
.
\n
"
,
errors
);
heap_
free
(
errors
);
free
(
errors
);
hr
=
ValidateVertexShader
(
vs_code
,
declaration_valid1
,
NULL
,
FALSE
,
NULL
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
...
...
@@ -5102,11 +5101,11 @@ static void test_validate_vs(void)
hr
=
ValidateVertexShader
(
vs_code
,
NULL
,
NULL
,
FALSE
,
&
errors
);
ok
(
hr
==
E_FAIL
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!*
errors
,
"Got unexpected string
\"
%s
\"
.
\n
"
,
errors
);
heap_
free
(
errors
);
free
(
errors
);
hr
=
ValidateVertexShader
(
vs_code
,
NULL
,
NULL
,
TRUE
,
&
errors
);
ok
(
hr
==
E_FAIL
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!!*
errors
,
"Got unexpected empty string.
\n
"
);
heap_
free
(
errors
);
free
(
errors
);
}
static
void
test_validate_ps
(
void
)
...
...
@@ -5150,7 +5149,7 @@ static void test_validate_ps(void)
hr
=
ValidatePixelShader
(
ps_1_1_code
,
NULL
,
TRUE
,
&
errors
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!*
errors
,
"Got unexpected string
\"
%s
\"
.
\n
"
,
errors
);
heap_
free
(
errors
);
free
(
errors
);
memset
(
&
caps
,
0
,
sizeof
(
caps
));
caps
.
PixelShaderVersion
=
D3DPS_VERSION
(
1
,
1
);
...
...
@@ -5180,11 +5179,11 @@ static void test_validate_ps(void)
hr
=
ValidatePixelShader
(
ps_1_1_code
,
NULL
,
FALSE
,
&
errors
);
ok
(
hr
==
E_FAIL
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!*
errors
,
"Got unexpected string
\"
%s
\"
.
\n
"
,
errors
);
heap_
free
(
errors
);
free
(
errors
);
hr
=
ValidatePixelShader
(
ps_1_1_code
,
NULL
,
TRUE
,
&
errors
);
ok
(
hr
==
E_FAIL
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!!*
errors
,
"Got unexpected empty string.
\n
"
);
heap_
free
(
errors
);
free
(
errors
);
}
static
void
test_volume_get_container
(
void
)
...
...
dlls/d3d8/tests/stateblock.c
View file @
6db89702
...
...
@@ -1408,7 +1408,7 @@ static HRESULT render_state_test_init(IDirect3DDevice8 *device, struct state_tes
const
struct
render_state_arg
*
rsarg
=
test
->
test_arg
;
unsigned
int
i
,
j
;
struct
render_state_context
*
ctx
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
ctx
));
struct
render_state_context
*
ctx
=
calloc
(
1
,
sizeof
(
*
ctx
));
if
(
!
ctx
)
return
E_FAIL
;
test
->
test_context
=
ctx
;
...
...
@@ -1451,7 +1451,7 @@ static HRESULT render_state_test_init(IDirect3DDevice8 *device, struct state_tes
static
void
render_state_test_cleanup
(
IDirect3DDevice8
*
device
,
struct
state_test
*
test
)
{
HeapFree
(
GetProcessHeap
(),
0
,
test
->
test_context
);
free
(
test
->
test_context
);
}
static
void
render_states_queue_test
(
struct
state_test
*
test
,
const
struct
render_state_arg
*
test_arg
)
...
...
@@ -1590,12 +1590,12 @@ static void resource_default_data_init(struct resource_test_data *data, const st
data
->
vs
=
0
;
data
->
ps
=
0
;
data
->
ib
=
NULL
;
data
->
vb
=
HeapAlloc
(
GetProcessHeap
(),
0
,
arg
->
stream_count
*
sizeof
(
*
data
->
vb
));
data
->
vb
=
malloc
(
arg
->
stream_count
*
sizeof
(
*
data
->
vb
));
for
(
i
=
0
;
i
<
arg
->
stream_count
;
++
i
)
{
data
->
vb
[
i
]
=
NULL
;
}
data
->
tex
=
HeapAlloc
(
GetProcessHeap
(),
0
,
arg
->
tex_count
*
sizeof
(
*
data
->
tex
));
data
->
tex
=
malloc
(
arg
->
tex_count
*
sizeof
(
*
data
->
tex
));
for
(
i
=
0
;
i
<
arg
->
tex_count
;
++
i
)
{
data
->
tex
[
i
]
=
NULL
;
...
...
@@ -1650,7 +1650,7 @@ static void resource_test_data_init(IDirect3DDevice8 *device,
hr
=
IDirect3DDevice8_CreateIndexBuffer
(
device
,
64
,
D3DUSAGE_DYNAMIC
,
D3DFMT_INDEX32
,
D3DPOOL_DEFAULT
,
&
data
->
ib
);
ok
(
SUCCEEDED
(
hr
),
"CreateIndexBuffer returned hr %#lx.
\n
"
,
hr
);
data
->
vb
=
HeapAlloc
(
GetProcessHeap
(),
0
,
arg
->
stream_count
*
sizeof
(
*
data
->
vb
));
data
->
vb
=
malloc
(
arg
->
stream_count
*
sizeof
(
*
data
->
vb
));
for
(
i
=
0
;
i
<
arg
->
stream_count
;
++
i
)
{
hr
=
IDirect3DDevice8_CreateVertexBuffer
(
device
,
64
,
D3DUSAGE_DYNAMIC
,
...
...
@@ -1658,7 +1658,7 @@ static void resource_test_data_init(IDirect3DDevice8 *device,
ok
(
SUCCEEDED
(
hr
),
"CreateVertexBuffer (%u) returned hr %#lx.
\n
"
,
i
,
hr
);
}
data
->
tex
=
HeapAlloc
(
GetProcessHeap
(),
0
,
arg
->
tex_count
*
sizeof
(
*
data
->
tex
));
data
->
tex
=
malloc
(
arg
->
tex_count
*
sizeof
(
*
data
->
tex
));
for
(
i
=
0
;
i
<
arg
->
tex_count
;
++
i
)
{
hr
=
IDirect3DDevice8_CreateTexture
(
device
,
64
,
64
,
0
,
0
,
...
...
@@ -1675,12 +1675,12 @@ static void resource_poison_data_init(struct resource_test_data *data, const str
data
->
vs
=
poison
++
;
data
->
ps
=
poison
++
;
data
->
ib
=
(
IDirect3DIndexBuffer8
*
)
poison
++
;
data
->
vb
=
HeapAlloc
(
GetProcessHeap
(),
0
,
arg
->
stream_count
*
sizeof
(
*
data
->
vb
));
data
->
vb
=
malloc
(
arg
->
stream_count
*
sizeof
(
*
data
->
vb
));
for
(
i
=
0
;
i
<
arg
->
stream_count
;
++
i
)
{
data
->
vb
[
i
]
=
(
IDirect3DVertexBuffer8
*
)
poison
++
;
}
data
->
tex
=
HeapAlloc
(
GetProcessHeap
(),
0
,
arg
->
tex_count
*
sizeof
(
*
data
->
tex
));
data
->
tex
=
malloc
(
arg
->
tex_count
*
sizeof
(
*
data
->
tex
));
for
(
i
=
0
;
i
<
arg
->
tex_count
;
++
i
)
{
data
->
tex
[
i
]
=
(
IDirect3DTexture8
*
)
poison
++
;
...
...
@@ -1692,7 +1692,7 @@ static HRESULT resource_test_init(IDirect3DDevice8 *device, struct state_test *t
const
struct
resource_test_arg
*
arg
=
test
->
test_arg
;
struct
resource_test_context
*
ctx
;
ctx
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
ctx
));
ctx
=
calloc
(
1
,
sizeof
(
*
ctx
));
if
(
!
ctx
)
return
E_OUTOFMEMORY
;
test
->
test_context
=
ctx
;
...
...
@@ -1747,17 +1747,17 @@ static void resource_test_cleanup(IDirect3DDevice8 *device, struct state_test *t
IDirect3DBaseTexture8_Release
(
ctx
->
test_data_all
.
tex
[
i
]);
}
HeapFree
(
GetProcessHeap
(),
0
,
ctx
->
default_data
.
vb
);
HeapFree
(
GetProcessHeap
(),
0
,
ctx
->
default_data
.
tex
);
HeapFree
(
GetProcessHeap
(),
0
,
ctx
->
test_data_all
.
vb
);
HeapFree
(
GetProcessHeap
(),
0
,
ctx
->
test_data_all
.
tex
);
HeapFree
(
GetProcessHeap
(),
0
,
ctx
->
test_data_vertex
.
vb
);
HeapFree
(
GetProcessHeap
(),
0
,
ctx
->
test_data_vertex
.
tex
);
HeapFree
(
GetProcessHeap
(),
0
,
ctx
->
test_data_pixel
.
vb
);
HeapFree
(
GetProcessHeap
(),
0
,
ctx
->
test_data_pixel
.
tex
);
HeapFree
(
GetProcessHeap
(),
0
,
ctx
->
poison_data
.
vb
);
HeapFree
(
GetProcessHeap
(),
0
,
ctx
->
poison_data
.
tex
);
HeapFree
(
GetProcessHeap
(),
0
,
ctx
);
free
(
ctx
->
default_data
.
vb
);
free
(
ctx
->
default_data
.
tex
);
free
(
ctx
->
test_data_all
.
vb
);
free
(
ctx
->
test_data_all
.
tex
);
free
(
ctx
->
test_data_vertex
.
vb
);
free
(
ctx
->
test_data_vertex
.
tex
);
free
(
ctx
->
test_data_pixel
.
vb
);
free
(
ctx
->
test_data_pixel
.
tex
);
free
(
ctx
->
poison_data
.
vb
);
free
(
ctx
->
poison_data
.
tex
);
free
(
ctx
);
}
static
void
resource_test_queue
(
struct
state_test
*
test
,
const
struct
resource_test_arg
*
test_arg
)
...
...
dlls/d3d8/tests/visual.c
View file @
6db89702
...
...
@@ -941,8 +941,8 @@ static void test_specular_lighting(void)
}
*
quad
;
WORD
*
indices
;
quad
=
HeapAlloc
(
GetProcessHeap
(),
0
,
vertices_side
*
vertices_side
*
sizeof
(
*
quad
));
indices
=
HeapAlloc
(
GetProcessHeap
(),
0
,
indices_count
*
sizeof
(
*
indices
));
quad
=
malloc
(
vertices_side
*
vertices_side
*
sizeof
(
*
quad
));
indices
=
malloc
(
indices_count
*
sizeof
(
*
indices
));
for
(
i
=
0
,
y
=
0
;
y
<
vertices_side
;
++
y
)
{
for
(
x
=
0
;
x
<
vertices_side
;
++
x
)
...
...
@@ -1044,8 +1044,8 @@ static void test_specular_lighting(void)
done:
IDirect3D8_Release
(
d3d
);
DestroyWindow
(
window
);
HeapFree
(
GetProcessHeap
(),
0
,
indices
);
HeapFree
(
GetProcessHeap
(),
0
,
quad
);
free
(
indices
);
free
(
quad
);
}
static
void
clear_test
(
void
)
...
...
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