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
eb45704b
Commit
eb45704b
authored
Sep 10, 2015
by
Józef Kucia
Committed by
Alexandre Julliard
Sep 10, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d11/tests: Port test_create_shader_resource_view() from d3d10core.
parent
8972105e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
0 deletions
+97
-0
d3d11.c
dlls/d3d11/tests/d3d11.c
+97
-0
No files found.
dlls/d3d11/tests/d3d11.c
View file @
eb45704b
...
@@ -989,6 +989,102 @@ static void test_create_rendertarget_view(void)
...
@@ -989,6 +989,102 @@ static void test_create_rendertarget_view(void)
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
}
}
static
void
test_create_shader_resource_view
(
void
)
{
D3D11_SHADER_RESOURCE_VIEW_DESC
srv_desc
;
D3D11_TEXTURE2D_DESC
texture_desc
;
ULONG
refcount
,
expected_refcount
;
ID3D11ShaderResourceView
*
srview
;
D3D11_BUFFER_DESC
buffer_desc
;
ID3D11Device
*
device
,
*
tmp
;
ID3D11Texture2D
*
texture
;
ID3D11Buffer
*
buffer
;
IUnknown
*
iface
;
HRESULT
hr
;
if
(
!
(
device
=
create_device
(
NULL
)))
{
skip
(
"Failed to create device.
\n
"
);
return
;
}
buffer_desc
.
ByteWidth
=
1024
;
buffer_desc
.
Usage
=
D3D11_USAGE_DEFAULT
;
buffer_desc
.
BindFlags
=
D3D11_BIND_SHADER_RESOURCE
;
buffer_desc
.
CPUAccessFlags
=
0
;
buffer_desc
.
MiscFlags
=
0
;
buffer_desc
.
StructureByteStride
=
0
;
hr
=
ID3D11Device_CreateBuffer
(
device
,
&
buffer_desc
,
NULL
,
&
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create a buffer, hr %#x.
\n
"
,
hr
);
hr
=
ID3D11Device_CreateShaderResourceView
(
device
,
(
ID3D11Resource
*
)
buffer
,
NULL
,
&
srview
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#x.
\n
"
,
hr
);
srv_desc
.
Format
=
DXGI_FORMAT_R32G32B32A32_FLOAT
;
srv_desc
.
ViewDimension
=
D3D11_SRV_DIMENSION_BUFFER
;
U
(
srv_desc
).
Buffer
.
ElementOffset
=
0
;
U
(
srv_desc
).
Buffer
.
ElementWidth
=
64
;
expected_refcount
=
get_refcount
((
IUnknown
*
)
device
)
+
1
;
hr
=
ID3D11Device_CreateShaderResourceView
(
device
,
(
ID3D11Resource
*
)
buffer
,
&
srv_desc
,
&
srview
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create a shader resource view, 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
;
ID3D11ShaderResourceView_GetDevice
(
srview
,
&
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
=
ID3D11ShaderResourceView_QueryInterface
(
srview
,
&
IID_ID3D10ShaderResourceView
,
(
void
**
)
&
iface
);
ok
(
SUCCEEDED
(
hr
)
||
broken
(
hr
==
E_NOINTERFACE
)
/* Not available on all Windows versions. */
,
"Shader resource view should implement ID3D10ShaderResourceView.
\n
"
);
if
(
SUCCEEDED
(
hr
))
IUnknown_Release
(
iface
);
ID3D11ShaderResourceView_Release
(
srview
);
ID3D11Buffer_Release
(
buffer
);
texture_desc
.
Width
=
512
;
texture_desc
.
Height
=
512
;
texture_desc
.
MipLevels
=
0
;
texture_desc
.
ArraySize
=
1
;
texture_desc
.
Format
=
DXGI_FORMAT_R8G8B8A8_UNORM
;
texture_desc
.
SampleDesc
.
Count
=
1
;
texture_desc
.
SampleDesc
.
Quality
=
0
;
texture_desc
.
Usage
=
D3D11_USAGE_DEFAULT
;
texture_desc
.
BindFlags
=
D3D11_BIND_SHADER_RESOURCE
;
texture_desc
.
CPUAccessFlags
=
0
;
texture_desc
.
MiscFlags
=
0
;
hr
=
ID3D11Device_CreateTexture2D
(
device
,
&
texture_desc
,
NULL
,
&
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create a 2d texture, hr %#x.
\n
"
,
hr
);
hr
=
ID3D11Device_CreateShaderResourceView
(
device
,
(
ID3D11Resource
*
)
texture
,
NULL
,
&
srview
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create a shader resource view, hr %#x.
\n
"
,
hr
);
hr
=
ID3D11ShaderResourceView_QueryInterface
(
srview
,
&
IID_ID3D10ShaderResourceView
,
(
void
**
)
&
iface
);
ok
(
SUCCEEDED
(
hr
)
||
broken
(
hr
==
E_NOINTERFACE
)
/* Not available on all Windows versions. */
,
"Shader resource view should implement ID3D10ShaderResourceView.
\n
"
);
if
(
SUCCEEDED
(
hr
))
IUnknown_Release
(
iface
);
ID3D11ShaderResourceView_GetDesc
(
srview
,
&
srv_desc
);
ok
(
srv_desc
.
Format
==
texture_desc
.
Format
,
"Got unexpected format %#x.
\n
"
,
srv_desc
.
Format
);
ok
(
srv_desc
.
ViewDimension
==
D3D11_SRV_DIMENSION_TEXTURE2D
,
"Got unexpected view dimension %#x.
\n
"
,
srv_desc
.
ViewDimension
);
ok
(
U
(
srv_desc
).
Texture2D
.
MostDetailedMip
==
0
,
"Got unexpected MostDetailedMip %u.
\n
"
,
U
(
srv_desc
).
Texture2D
.
MostDetailedMip
);
ok
(
U
(
srv_desc
).
Texture2D
.
MipLevels
==
10
,
"Got unexpected MipLevels %u.
\n
"
,
U
(
srv_desc
).
Texture2D
.
MipLevels
);
ID3D11ShaderResourceView_Release
(
srview
);
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
();
...
@@ -1000,4 +1096,5 @@ START_TEST(d3d11)
...
@@ -1000,4 +1096,5 @@ START_TEST(d3d11)
test_buffer_interfaces
();
test_buffer_interfaces
();
test_depthstencil_view_interfaces
();
test_depthstencil_view_interfaces
();
test_create_rendertarget_view
();
test_create_rendertarget_view
();
test_create_shader_resource_view
();
}
}
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