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
0c8e78f8
Commit
0c8e78f8
authored
Aug 04, 2015
by
Henri Verbeet
Committed by
Alexandre Julliard
Aug 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: Don't assert on invalid IDirect3DBaseTexture9 interfaces.
parent
cd59e3db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
5 deletions
+29
-5
device.c
dlls/d3d9/tests/device.c
+20
-2
texture.c
dlls/d3d9/texture.c
+9
-3
No files found.
dlls/d3d9/tests/device.c
View file @
0c8e78f8
...
@@ -6627,8 +6627,9 @@ static void test_filter(void)
...
@@ -6627,8 +6627,9 @@ static void test_filter(void)
DestroyWindow
(
window
);
DestroyWindow
(
window
);
}
}
static
void
test_get_texture
(
void
)
static
void
test_get_
set_
texture
(
void
)
{
{
const
IDirect3DBaseTexture9Vtbl
*
texture_vtbl
;
IDirect3DBaseTexture9
*
texture
;
IDirect3DBaseTexture9
*
texture
;
IDirect3DDevice9
*
device
;
IDirect3DDevice9
*
device
;
IDirect3D9
*
d3d
;
IDirect3D9
*
d3d
;
...
@@ -6655,6 +6656,23 @@ static void test_get_texture(void)
...
@@ -6655,6 +6656,23 @@ static void test_get_texture(void)
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
D3D_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
texture
,
"Got unexpected texture %p.
\n
"
,
texture
);
ok
(
!
texture
,
"Got unexpected texture %p.
\n
"
,
texture
);
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
16
,
16
,
1
,
0
,
D3DFMT_A8R8G8B8
,
D3DPOOL_MANAGED
,
(
IDirect3DTexture9
**
)
&
texture
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create texture, hr %#x.
\n
"
,
hr
);
texture_vtbl
=
texture
->
lpVtbl
;
texture
->
lpVtbl
=
(
IDirect3DBaseTexture9Vtbl
*
)
0xdeadbeef
;
hr
=
IDirect3DDevice9_SetTexture
(
device
,
0
,
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTexture
(
device
,
0
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture, hr %#x.
\n
"
,
hr
);
texture
->
lpVtbl
=
NULL
;
hr
=
IDirect3DDevice9_SetTexture
(
device
,
0
,
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTexture
(
device
,
0
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture, hr %#x.
\n
"
,
hr
);
texture
->
lpVtbl
=
texture_vtbl
;
IDirect3DBaseTexture9_Release
(
texture
);
refcount
=
IDirect3DDevice9_Release
(
device
);
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
IDirect3D9_Release
(
d3d
);
IDirect3D9_Release
(
d3d
);
...
@@ -10231,7 +10249,7 @@ START_TEST(device)
...
@@ -10231,7 +10249,7 @@ START_TEST(device)
test_cube_textures
();
test_cube_textures
();
test_mipmap_gen
();
test_mipmap_gen
();
test_filter
();
test_filter
();
test_get_texture
();
test_get_
set_
texture
();
test_lod
();
test_lod
();
test_surface_get_container
();
test_surface_get_container
();
test_surface_alignment
();
test_surface_alignment
();
...
...
dlls/d3d9/texture.c
View file @
0c8e78f8
...
@@ -1252,9 +1252,15 @@ struct d3d9_texture *unsafe_impl_from_IDirect3DBaseTexture9(IDirect3DBaseTexture
...
@@ -1252,9 +1252,15 @@ struct d3d9_texture *unsafe_impl_from_IDirect3DBaseTexture9(IDirect3DBaseTexture
{
{
if
(
!
iface
)
if
(
!
iface
)
return
NULL
;
return
NULL
;
assert
(
iface
->
lpVtbl
==
(
const
IDirect3DBaseTexture9Vtbl
*
)
&
d3d9_texture_2d_vtbl
||
iface
->
lpVtbl
==
(
const
IDirect3DBaseTexture9Vtbl
*
)
&
d3d9_texture_cube_vtbl
if
(
iface
->
lpVtbl
!=
(
const
IDirect3DBaseTexture9Vtbl
*
)
&
d3d9_texture_2d_vtbl
||
iface
->
lpVtbl
==
(
const
IDirect3DBaseTexture9Vtbl
*
)
&
d3d9_texture_3d_vtbl
);
&&
iface
->
lpVtbl
!=
(
const
IDirect3DBaseTexture9Vtbl
*
)
&
d3d9_texture_cube_vtbl
&&
iface
->
lpVtbl
!=
(
const
IDirect3DBaseTexture9Vtbl
*
)
&
d3d9_texture_3d_vtbl
)
{
WARN
(
"%p is not a valid IDirect3DBaseTexture9 interface.
\n
"
,
iface
);
return
NULL
;
}
return
CONTAINING_RECORD
(
iface
,
struct
d3d9_texture
,
IDirect3DBaseTexture9_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
d3d9_texture
,
IDirect3DBaseTexture9_iface
);
}
}
...
...
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