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
f83181fc
Commit
f83181fc
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: Add test for 2D texture interfaces.
parent
44d493aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
169 additions
and
0 deletions
+169
-0
d3d11.c
dlls/d3d11/tests/d3d11.c
+169
-0
No files found.
dlls/d3d11/tests/d3d11.c
View file @
f83181fc
...
...
@@ -241,9 +241,178 @@ static void test_create_texture2d(void)
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
}
static
void
test_texture2d_interfaces
(
void
)
{
ID3D10Texture2D
*
d3d10_texture
;
D3D11_TEXTURE2D_DESC
desc
;
ID3D11Texture2D
*
texture
;
IDXGISurface
*
surface
;
ID3D11Device
*
device
;
unsigned
int
i
;
ULONG
refcount
;
HRESULT
hr
;
static
const
struct
test
{
BOOL
implements_d3d10_interfaces
;
UINT
bind_flags
;
UINT
misc_flags
;
UINT
expected_bind_flags
;
UINT
expected_misc_flags
;
}
desc_conversion_tests
[]
=
{
{
TRUE
,
D3D11_BIND_SHADER_RESOURCE
,
0
,
D3D10_BIND_SHADER_RESOURCE
,
0
},
{
TRUE
,
D3D11_BIND_UNORDERED_ACCESS
,
0
,
D3D11_BIND_UNORDERED_ACCESS
,
0
},
{
FALSE
,
0
,
D3D11_RESOURCE_MISC_RESOURCE_CLAMP
,
0
,
0
},
{
TRUE
,
0
,
D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX
,
0
,
D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX
},
{
TRUE
,
0
,
D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX
|
D3D11_RESOURCE_MISC_SHARED_NTHANDLE
,
0
,
D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX
},
};
if
(
!
(
device
=
create_device
(
NULL
)))
{
skip
(
"Failed to create ID3D11Device, skipping tests.
\n
"
);
return
;
}
desc
.
Width
=
512
;
desc
.
Height
=
512
;
desc
.
MipLevels
=
0
;
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
,
NULL
,
&
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create a 2d texture, hr %#x.
\n
"
,
hr
);
hr
=
ID3D11Texture2D_QueryInterface
(
texture
,
&
IID_IDXGISurface
,
(
void
**
)
&
surface
);
ok
(
hr
==
E_NOINTERFACE
,
"Texture should not implement IDXGISurface.
\n
"
);
hr
=
ID3D11Texture2D_QueryInterface
(
texture
,
&
IID_ID3D10Texture2D
,
(
void
**
)
&
d3d10_texture
);
ok
(
SUCCEEDED
(
hr
)
||
broken
(
hr
==
E_NOINTERFACE
)
/* Not available on all Windows versions. */
,
"Texture should implement ID3D10Texture2D.
\n
"
);
if
(
SUCCEEDED
(
hr
))
ID3D10Texture2D_Release
(
d3d10_texture
);
ID3D11Texture2D_Release
(
texture
);
if
(
FAILED
(
hr
))
{
win_skip
(
"2D textures do not implement ID3D10Texture2D, skipping tests.
\n
"
);
ID3D11Device_Release
(
device
);
return
;
}
for
(
i
=
0
;
i
<
sizeof
(
desc_conversion_tests
)
/
sizeof
(
*
desc_conversion_tests
);
++
i
)
{
const
struct
test
*
current
=
&
desc_conversion_tests
[
i
];
D3D10_TEXTURE2D_DESC
d3d10_desc
;
ID3D10Device
*
d3d10_device
;
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
=
current
->
bind_flags
;
desc
.
CPUAccessFlags
=
0
;
desc
.
MiscFlags
=
current
->
misc_flags
;
hr
=
ID3D11Device_CreateTexture2D
(
device
,
&
desc
,
NULL
,
&
texture
);
/* Shared resources are not supported by REF and WARP devices. */
ok
(
SUCCEEDED
(
hr
)
||
broken
(
hr
==
E_OUTOFMEMORY
),
"Test %u: Failed to create a 2d texture, hr %#x.
\n
"
,
i
,
hr
);
if
(
FAILED
(
hr
))
{
win_skip
(
"Failed to create ID3D11Texture2D, skipping test %u.
\n
"
,
i
);
continue
;
}
hr
=
ID3D11Texture2D_QueryInterface
(
texture
,
&
IID_IDXGISurface
,
(
void
**
)
&
surface
);
ok
(
SUCCEEDED
(
hr
),
"Test %u: Texture should implement IDXGISurface.
\n
"
,
i
);
IDXGISurface_Release
(
surface
);
hr
=
ID3D11Texture2D_QueryInterface
(
texture
,
&
IID_ID3D10Texture2D
,
(
void
**
)
&
d3d10_texture
);
ID3D11Texture2D_Release
(
texture
);
if
(
current
->
implements_d3d10_interfaces
)
{
ok
(
SUCCEEDED
(
hr
),
"Test %u: Texture should implement ID3D10Texture2D.
\n
"
,
i
);
}
else
{
todo_wine
ok
(
hr
==
E_NOINTERFACE
,
"Test %u: Texture should not implement ID3D10Texture2D.
\n
"
,
i
);
if
(
SUCCEEDED
(
hr
))
ID3D10Texture2D_Release
(
d3d10_texture
);
continue
;
}
ID3D10Texture2D_GetDesc
(
d3d10_texture
,
&
d3d10_desc
);
ok
(
d3d10_desc
.
Width
==
desc
.
Width
,
"Test %u: Got unexpected Width %u.
\n
"
,
i
,
d3d10_desc
.
Width
);
ok
(
d3d10_desc
.
Height
==
desc
.
Height
,
"Test %u: Got unexpected Height %u.
\n
"
,
i
,
d3d10_desc
.
Height
);
ok
(
d3d10_desc
.
MipLevels
==
desc
.
MipLevels
,
"Test %u: Got unexpected MipLevels %u.
\n
"
,
i
,
d3d10_desc
.
MipLevels
);
ok
(
d3d10_desc
.
ArraySize
==
desc
.
ArraySize
,
"Test %u: Got unexpected ArraySize %u.
\n
"
,
i
,
d3d10_desc
.
ArraySize
);
ok
(
d3d10_desc
.
Format
==
desc
.
Format
,
"Test %u: Got unexpected Format %u.
\n
"
,
i
,
d3d10_desc
.
Format
);
ok
(
d3d10_desc
.
SampleDesc
.
Count
==
desc
.
SampleDesc
.
Count
,
"Test %u: Got unexpected SampleDesc.Count %u.
\n
"
,
i
,
d3d10_desc
.
SampleDesc
.
Count
);
ok
(
d3d10_desc
.
SampleDesc
.
Quality
==
desc
.
SampleDesc
.
Quality
,
"Test %u: Got unexpected SampleDesc.Quality %u.
\n
"
,
i
,
d3d10_desc
.
SampleDesc
.
Quality
);
ok
(
d3d10_desc
.
Usage
==
(
D3D10_USAGE
)
desc
.
Usage
,
"Test %u: Got unexpected Usage %u.
\n
"
,
i
,
d3d10_desc
.
Usage
);
ok
(
d3d10_desc
.
BindFlags
==
current
->
expected_bind_flags
,
"Test %u: Got unexpected BindFlags %#x.
\n
"
,
i
,
d3d10_desc
.
BindFlags
);
ok
(
d3d10_desc
.
CPUAccessFlags
==
desc
.
CPUAccessFlags
,
"Test %u: Got unexpected CPUAccessFlags %#x.
\n
"
,
i
,
d3d10_desc
.
CPUAccessFlags
);
ok
(
d3d10_desc
.
MiscFlags
==
current
->
expected_misc_flags
,
"Test %u: Got unexpected MiscFlags %#x.
\n
"
,
i
,
d3d10_desc
.
MiscFlags
);
d3d10_device
=
(
ID3D10Device
*
)
0xdeadbeef
;
ID3D10Texture2D_GetDevice
(
d3d10_texture
,
&
d3d10_device
);
todo_wine
ok
(
!
d3d10_device
,
"Test %u: Got unexpected device pointer %p, expected NULL.
\n
"
,
i
,
d3d10_device
);
if
(
d3d10_device
)
ID3D10Device_Release
(
d3d10_device
);
ID3D10Texture2D_Release
(
d3d10_texture
);
}
refcount
=
ID3D11Device_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
}
START_TEST
(
d3d11
)
{
test_create_device
();
test_device_interfaces
();
test_create_texture2d
();
test_texture2d_interfaces
();
}
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