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
44d493aa
Commit
44d493aa
authored
Aug 30, 2015
by
Józef Kucia
Committed by
Alexandre Julliard
Aug 31, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d11/tests: Port test_create_texture2d() from d3d10core.
parent
e0e72d28
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
8 deletions
+104
-8
d3d11.c
dlls/d3d11/tests/d3d11.c
+104
-8
No files found.
dlls/d3d11/tests/d3d11.c
View file @
44d493aa
/*
/*
* Copyright 2008 Henri Verbeet for CodeWeavers
* Copyright 2015 Józef Kucia for CodeWeavers
* Copyright 2015 Józef Kucia for CodeWeavers
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
...
@@ -27,18 +28,19 @@ static ULONG get_refcount(IUnknown *iface)
...
@@ -27,18 +28,19 @@ static ULONG get_refcount(IUnknown *iface)
return
IUnknown_Release
(
iface
);
return
IUnknown_Release
(
iface
);
}
}
static
ID3D11Device
*
create_device
(
D3D_FEATURE_LEVEL
feature_level
)
static
ID3D11Device
*
create_device
(
const
D3D_FEATURE_LEVEL
*
feature_level
)
{
{
ID3D11Device
*
device
;
ID3D11Device
*
device
;
UINT
feature_level_count
=
feature_level
?
1
:
0
;
if
(
SUCCEEDED
(
D3D11CreateDevice
(
NULL
,
D3D_DRIVER_TYPE_HARDWARE
,
NULL
,
0
,
&
feature_level
,
1
,
D3D11_SDK_VERSION
,
if
(
SUCCEEDED
(
D3D11CreateDevice
(
NULL
,
D3D_DRIVER_TYPE_HARDWARE
,
NULL
,
0
,
feature_level
,
feature_level_count
,
&
device
,
NULL
,
NULL
)))
D3D11_SDK_VERSION
,
&
device
,
NULL
,
NULL
)))
return
device
;
return
device
;
if
(
SUCCEEDED
(
D3D11CreateDevice
(
NULL
,
D3D_DRIVER_TYPE_WARP
,
NULL
,
0
,
&
feature_level
,
1
,
D3D11_SDK_VERSION
,
if
(
SUCCEEDED
(
D3D11CreateDevice
(
NULL
,
D3D_DRIVER_TYPE_WARP
,
NULL
,
0
,
feature_level
,
feature_level_count
,
&
device
,
NULL
,
NULL
)))
D3D11_SDK_VERSION
,
&
device
,
NULL
,
NULL
)))
return
device
;
return
device
;
if
(
SUCCEEDED
(
D3D11CreateDevice
(
NULL
,
D3D_DRIVER_TYPE_REFERENCE
,
NULL
,
0
,
&
feature_level
,
1
,
D3D11_SDK_VERSION
,
if
(
SUCCEEDED
(
D3D11CreateDevice
(
NULL
,
D3D_DRIVER_TYPE_REFERENCE
,
NULL
,
0
,
feature_level
,
feature_level_count
,
&
device
,
NULL
,
NULL
)))
D3D11_SDK_VERSION
,
&
device
,
NULL
,
NULL
)))
return
device
;
return
device
;
return
NULL
;
return
NULL
;
...
@@ -110,7 +112,7 @@ static void test_device_interfaces(void)
...
@@ -110,7 +112,7 @@ static void test_device_interfaces(void)
for
(
i
=
0
;
i
<
sizeof
(
feature_levels
)
/
sizeof
(
*
feature_levels
);
i
++
)
for
(
i
=
0
;
i
<
sizeof
(
feature_levels
)
/
sizeof
(
*
feature_levels
);
i
++
)
{
{
if
(
!
(
device
=
create_device
(
feature_levels
[
i
])))
if
(
!
(
device
=
create_device
(
&
feature_levels
[
i
])))
{
{
skip
(
"Failed to create device for feature level %#x, skipping tests.
\n
"
,
feature_levels
[
i
]);
skip
(
"Failed to create device for feature level %#x, skipping tests.
\n
"
,
feature_levels
[
i
]);
continue
;
continue
;
...
@@ -146,8 +148,102 @@ static void test_device_interfaces(void)
...
@@ -146,8 +148,102 @@ static void test_device_interfaces(void)
}
}
}
}
static
void
test_create_texture2d
(
void
)
{
ULONG
refcount
,
expected_refcount
;
D3D11_SUBRESOURCE_DATA
data
=
{
0
};
ID3D11Device
*
device
,
*
tmp
;
D3D11_TEXTURE2D_DESC
desc
;
ID3D11Texture2D
*
texture
;
IDXGISurface
*
surface
;
HRESULT
hr
;
if
(
!
(
device
=
create_device
(
NULL
)))
{
skip
(
"Failed to create device, skipping tests.
\n
"
);
return
;
}
desc
.
Width
=
512
;
desc
.
Height
=
512
;
desc
.
MipLevels
=
1
;
desc
.
ArraySize
=
1
;
desc
.
Format
=
DXGI_FORMAT_R8G8B8A8_UNORM
;
desc
.
SampleDesc
.
Count
=
1
;
desc
.
SampleDesc
.
Quality
=
0
;
desc
.
Usage
=
D3D11_USAGE_DEFAULT
;
desc
.
BindFlags
=
D3D11_BIND_RENDER_TARGET
;
desc
.
CPUAccessFlags
=
0
;
desc
.
MiscFlags
=
0
;
hr
=
ID3D11Device_CreateTexture2D
(
device
,
&
desc
,
&
data
,
&
texture
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#x.
\n
"
,
hr
);
expected_refcount
=
get_refcount
((
IUnknown
*
)
device
)
+
1
;
hr
=
ID3D11Device_CreateTexture2D
(
device
,
&
desc
,
NULL
,
&
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create a 2d texture, hr %#x.
\n
"
,
hr
);
refcount
=
get_refcount
((
IUnknown
*
)
device
);
ok
(
refcount
>=
expected_refcount
,
"Got unexpected refcount %u, expected >= %u.
\n
"
,
refcount
,
expected_refcount
);
tmp
=
NULL
;
expected_refcount
=
refcount
+
1
;
ID3D11Texture2D_GetDevice
(
texture
,
&
tmp
);
ok
(
tmp
==
device
,
"Got unexpected device %p, expected %p.
\n
"
,
tmp
,
device
);
refcount
=
get_refcount
((
IUnknown
*
)
device
);
ok
(
refcount
==
expected_refcount
,
"Got unexpected refcount %u, expected %u.
\n
"
,
refcount
,
expected_refcount
);
ID3D11Device_Release
(
tmp
);
hr
=
ID3D11Texture2D_QueryInterface
(
texture
,
&
IID_IDXGISurface
,
(
void
**
)
&
surface
);
ok
(
SUCCEEDED
(
hr
),
"Texture should implement IDXGISurface.
\n
"
);
IDXGISurface_Release
(
surface
);
ID3D11Texture2D_Release
(
texture
);
desc
.
MipLevels
=
0
;
expected_refcount
=
get_refcount
((
IUnknown
*
)
device
)
+
1
;
hr
=
ID3D11Device_CreateTexture2D
(
device
,
&
desc
,
NULL
,
&
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create a 2d texture, hr %#x.
\n
"
,
hr
);
refcount
=
get_refcount
((
IUnknown
*
)
device
);
ok
(
refcount
>=
expected_refcount
,
"Got unexpected refcount %u, expected >= %u.
\n
"
,
refcount
,
expected_refcount
);
tmp
=
NULL
;
expected_refcount
=
refcount
+
1
;
ID3D11Texture2D_GetDevice
(
texture
,
&
tmp
);
ok
(
tmp
==
device
,
"Got unexpected device %p, expected %p.
\n
"
,
tmp
,
device
);
refcount
=
get_refcount
((
IUnknown
*
)
device
);
ok
(
refcount
==
expected_refcount
,
"Got unexpected refcount %u, expected %u.
\n
"
,
refcount
,
expected_refcount
);
ID3D11Device_Release
(
tmp
);
ID3D11Texture2D_GetDesc
(
texture
,
&
desc
);
ok
(
desc
.
Width
==
512
,
"Got unexpected Width %u.
\n
"
,
desc
.
Width
);
ok
(
desc
.
Height
==
512
,
"Got unexpected Height %u.
\n
"
,
desc
.
Height
);
ok
(
desc
.
MipLevels
==
10
,
"Got unexpected MipLevels %u.
\n
"
,
desc
.
MipLevels
);
ok
(
desc
.
ArraySize
==
1
,
"Got unexpected ArraySize %u.
\n
"
,
desc
.
ArraySize
);
ok
(
desc
.
Format
==
DXGI_FORMAT_R8G8B8A8_UNORM
,
"Got unexpected Format %#x.
\n
"
,
desc
.
Format
);
ok
(
desc
.
SampleDesc
.
Count
==
1
,
"Got unexpected SampleDesc.Count %u.
\n
"
,
desc
.
SampleDesc
.
Count
);
ok
(
desc
.
SampleDesc
.
Quality
==
0
,
"Got unexpected SampleDesc.Quality %u.
\n
"
,
desc
.
SampleDesc
.
Quality
);
ok
(
desc
.
Usage
==
D3D11_USAGE_DEFAULT
,
"Got unexpected Usage %u.
\n
"
,
desc
.
Usage
);
ok
(
desc
.
BindFlags
==
D3D11_BIND_RENDER_TARGET
,
"Got unexpected BindFlags %#x.
\n
"
,
desc
.
BindFlags
);
ok
(
desc
.
CPUAccessFlags
==
0
,
"Got unexpected CPUAccessFlags %#x.
\n
"
,
desc
.
CPUAccessFlags
);
ok
(
desc
.
MiscFlags
==
0
,
"Got unexpected MiscFlags %#x.
\n
"
,
desc
.
MiscFlags
);
hr
=
ID3D11Texture2D_QueryInterface
(
texture
,
&
IID_IDXGISurface
,
(
void
**
)
&
surface
);
ok
(
FAILED
(
hr
),
"Texture should not implement IDXGISurface.
\n
"
);
ID3D11Texture2D_Release
(
texture
);
desc
.
MipLevels
=
1
;
desc
.
ArraySize
=
2
;
hr
=
ID3D11Device_CreateTexture2D
(
device
,
&
desc
,
NULL
,
&
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create a 2d texture, hr %#x.
\n
"
,
hr
);
hr
=
ID3D11Texture2D_QueryInterface
(
texture
,
&
IID_IDXGISurface
,
(
void
**
)
&
surface
);
ok
(
FAILED
(
hr
),
"Texture should not implement IDXGISurface.
\n
"
);
ID3D11Texture2D_Release
(
texture
);
refcount
=
ID3D11Device_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
}
START_TEST
(
d3d11
)
START_TEST
(
d3d11
)
{
{
test_create_device
();
test_create_device
();
test_device_interfaces
();
test_device_interfaces
();
test_create_texture2d
();
}
}
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