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
7df19367
Commit
7df19367
authored
Apr 19, 2008
by
David Adam
Committed by
Alexandre Julliard
Apr 21, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Fix a possible null dereference.
parent
66271816
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
0 deletions
+75
-0
device.c
dlls/d3d8/tests/device.c
+37
-0
device.c
dlls/d3d9/tests/device.c
+36
-0
device.c
dlls/wined3d/device.c
+2
-0
No files found.
dlls/d3d8/tests/device.c
View file @
7df19367
...
...
@@ -1281,6 +1281,42 @@ static void test_render_zero_triangles(void)
if
(
d3d8
)
IDirect3D8_Release
(
d3d8
);
}
static
void
test_set_material
(
void
)
{
D3DPRESENT_PARAMETERS
present_parameters
;
IDirect3DDevice8
*
device
=
NULL
;
IDirect3D8
*
d3d8
;
HWND
hwnd
;
HRESULT
hr
;
d3d8
=
pDirect3DCreate8
(
D3D_SDK_VERSION
);
ok
(
d3d8
!=
NULL
,
"Failed to create IDirect3D8 object
\n
"
);
hwnd
=
CreateWindow
(
"static"
,
"d3d8_test"
,
WS_OVERLAPPEDWINDOW
,
100
,
100
,
160
,
160
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hwnd
!=
NULL
,
"Failed to create window
\n
"
);
if
(
!
d3d8
||
!
hwnd
)
goto
cleanup
;
ZeroMemory
(
&
present_parameters
,
sizeof
(
present_parameters
));
present_parameters
.
Windowed
=
TRUE
;
present_parameters
.
hDeviceWindow
=
hwnd
;
present_parameters
.
SwapEffect
=
D3DSWAPEFFECT_DISCARD
;
hr
=
IDirect3D8_CreateDevice
(
d3d8
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
hwnd
,
D3DCREATE_HARDWARE_VERTEXPROCESSING
|
D3DCREATE_PUREDEVICE
,
&
present_parameters
,
&
device
);
ok
(
hr
==
D3D_OK
||
hr
==
D3DERR_NOTAVAILABLE
,
"IDirect3D8_CreateDevice failed with %s
\n
"
,
DXGetErrorString8
(
hr
));
if
(
!
device
)
{
skip
(
"Failed to create a d3d device
\n
"
);
goto
cleanup
;
}
hr
=
IDirect3DDevice8_SetMaterial
(
device
,
NULL
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %s
\n
"
,
DXGetErrorString8
(
hr
));
cleanup:
if
(
device
)
IDirect3DDevice8_Release
(
device
);
if
(
d3d8
)
IDirect3D8_Release
(
d3d8
);
}
START_TEST
(
device
)
{
HMODULE
d3d8_handle
=
LoadLibraryA
(
"d3d8.dll"
);
...
...
@@ -1306,5 +1342,6 @@ START_TEST(device)
test_limits
();
test_lights
();
test_render_zero_triangles
();
test_set_material
();
}
}
dlls/d3d9/tests/device.c
View file @
7df19367
...
...
@@ -1994,6 +1994,41 @@ static void test_display_formats()
if
(
d3d9
)
IDirect3D9_Release
(
d3d9
);
}
static
void
test_set_material
(
void
)
{
D3DPRESENT_PARAMETERS
present_parameters
;
IDirect3DDevice9
*
device
=
NULL
;
IDirect3D9
*
d3d9
;
HWND
hwnd
;
HRESULT
hr
;
d3d9
=
pDirect3DCreate9
(
D3D_SDK_VERSION
);
ok
(
d3d9
!=
NULL
,
"Failed to create IDirect3D9 object
\n
"
);
hwnd
=
CreateWindow
(
"static"
,
"d3d9_test"
,
WS_OVERLAPPEDWINDOW
,
100
,
100
,
160
,
160
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hwnd
!=
NULL
,
"Failed to create window
\n
"
);
if
(
!
d3d9
||
!
hwnd
)
goto
cleanup
;
ZeroMemory
(
&
present_parameters
,
sizeof
(
present_parameters
));
present_parameters
.
Windowed
=
TRUE
;
present_parameters
.
hDeviceWindow
=
hwnd
;
present_parameters
.
SwapEffect
=
D3DSWAPEFFECT_DISCARD
;
IDirect3D9_CreateDevice
(
d3d9
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
hwnd
,
D3DCREATE_HARDWARE_VERTEXPROCESSING
|
D3DCREATE_PUREDEVICE
,
&
present_parameters
,
&
device
);
if
(
!
device
)
{
skip
(
"Failed to create a d3d device
\n
"
);
goto
cleanup
;
}
hr
=
IDirect3DDevice9_SetMaterial
(
device
,
NULL
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %s
\n
"
,
DXGetErrorString9
(
hr
));
cleanup:
if
(
device
)
IDirect3DDevice9_Release
(
device
);
if
(
d3d9
)
IDirect3D9_Release
(
d3d9
);
}
START_TEST
(
device
)
{
HMODULE
d3d9_handle
=
LoadLibraryA
(
"d3d9.dll"
);
...
...
@@ -2023,5 +2058,6 @@ START_TEST(device)
test_vertex_buffer_alignment
();
test_lights
();
test_set_stream_source
();
test_set_material
();
}
}
dlls/wined3d/device.c
View file @
7df19367
...
...
@@ -3086,6 +3086,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetClipStatus(IWineD3DDevice *iface,
static
HRESULT
WINAPI
IWineD3DDeviceImpl_SetMaterial
(
IWineD3DDevice
*
iface
,
CONST
WINED3DMATERIAL
*
pMaterial
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
if
(
!
pMaterial
)
return
WINED3DERR_INVALIDCALL
;
This
->
updateStateBlock
->
changed
.
material
=
TRUE
;
This
->
updateStateBlock
->
material
=
*
pMaterial
;
...
...
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