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
555cee64
Commit
555cee64
authored
Feb 02, 2023
by
Zebediah Figura
Committed by
Alexandre Julliard
Feb 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dxgi: Implement IDXGIResource::GetUsage().
parent
302996ef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
13 deletions
+45
-13
resource.c
dlls/dxgi/resource.c
+28
-2
dxgi.c
dlls/dxgi/tests/dxgi.c
+17
-8
utils.c
dlls/dxgi/utils.c
+0
-3
No files found.
dlls/dxgi/resource.c
View file @
555cee64
...
...
@@ -350,9 +350,35 @@ static HRESULT STDMETHODCALLTYPE dxgi_resource_GetSharedHandle(IDXGIResource *if
static
HRESULT
STDMETHODCALLTYPE
dxgi_resource_GetUsage
(
IDXGIResource
*
iface
,
DXGI_USAGE
*
usage
)
{
FIXME
(
"iface %p, usage %p stub!
\n
"
,
iface
,
usage
);
struct
dxgi_resource
*
resource
=
impl_from_IDXGIResource
(
iface
);
struct
wined3d_resource_desc
resource_desc
;
return
E_NOTIMPL
;
TRACE
(
"iface %p, usage %p.
\n
"
,
iface
,
usage
);
wined3d_resource_get_desc
(
resource
->
wined3d_resource
,
&
resource_desc
);
*
usage
=
dxgi_usage_from_wined3d_bind_flags
(
resource_desc
.
bind_flags
);
if
(
resource_desc
.
resource_type
!=
WINED3D_RTYPE_BUFFER
)
{
struct
wined3d_texture
*
texture
=
wined3d_texture_from_resource
(
resource
->
wined3d_resource
);
struct
wined3d_swapchain_desc
swapchain_desc
;
struct
wined3d_swapchain
*
swapchain
;
if
((
swapchain
=
wined3d_texture_get_swapchain
(
texture
)))
{
*
usage
|=
DXGI_USAGE_BACK_BUFFER
;
wined3d_swapchain_get_desc
(
swapchain
,
&
swapchain_desc
);
if
(
swapchain_desc
.
swap_effect
==
WINED3D_SWAP_EFFECT_DISCARD
)
*
usage
|=
DXGI_USAGE_DISCARD_ON_PRESENT
;
if
(
wined3d_swapchain_get_back_buffer
(
swapchain
,
0
)
!=
texture
)
*
usage
|=
DXGI_USAGE_READ_ONLY
;
}
}
return
S_OK
;
}
static
HRESULT
STDMETHODCALLTYPE
dxgi_resource_SetEvictionPriority
(
IDXGIResource
*
iface
,
UINT
eviction_priority
)
...
...
dlls/dxgi/tests/dxgi.c
View file @
555cee64
...
...
@@ -4016,6 +4016,7 @@ static void test_swapchain_resize(IUnknown *device, BOOL is_d3d12)
{
DXGI_SWAP_CHAIN_DESC
swapchain_desc
;
DXGI_SWAP_EFFECT
swap_effect
;
IDXGIResource
*
dxgi_resource
;
IDXGISwapChain3
*
swapchain3
;
IUnknown
*
present_queue
[
2
];
IDXGISwapChain
*
swapchain
;
...
...
@@ -4056,13 +4057,18 @@ static void test_swapchain_resize(IUnknown *device, BOOL is_d3d12)
hr
=
IDXGIFactory_CreateSwapChain
(
factory
,
device
,
&
swapchain_desc
,
&
swapchain
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IDXGISwapChain_GetBuffer
(
swapchain
,
0
,
&
IID_IDXGISurface
,
(
void
**
)
&
surface
);
expected_hr
=
is_d3d12
?
E_NOINTERFACE
:
S_OK
;
hr
=
IDXGISwapChain_GetBuffer
(
swapchain
,
0
,
&
IID_IDXGIResource
,
(
void
**
)
&
dxgi_resource
);
ok
(
hr
==
expected_hr
,
"Got unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
expected_hr
);
ok
(
!
dxgi_resource
||
hr
==
S_OK
,
"Got unexpected pointer %p.
\n
"
,
dxgi_resource
);
hr
=
IDXGISwapChain_GetBuffer
(
swapchain
,
0
,
&
IID_IDXGISurface
,
(
void
**
)
&
surface
);
ok
(
hr
==
expected_hr
,
"Got unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
expected_hr
);
ok
(
!
surface
||
hr
==
S_OK
,
"Got unexpected pointer %p.
\n
"
,
surface
);
hr
=
IDXGISwapChain_GetBuffer
(
swapchain
,
0
,
&
IID_ID3D10Texture2D
,
(
void
**
)
&
texture
);
ok
(
hr
==
expected_hr
,
"Got unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
expected_hr
);
ok
(
!
texture
||
hr
==
S_OK
,
"Got unexpected pointer %p.
\n
"
,
texture
);
expected_hr
=
is_d3d12
?
S_OK
:
E_NOINTERFACE
;
hr
=
IDXGISwapChain_GetBuffer
(
swapchain
,
0
,
&
IID_ID3D12Resource
,
(
void
**
)
&
resource
);
ok
(
hr
==
expected_hr
,
"Got unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
expected_hr
);
...
...
@@ -4175,16 +4181,23 @@ static void test_swapchain_resize(IUnknown *device, BOOL is_d3d12)
check_resource_desc
(
resource
,
&
swapchain_desc
);
ID3D12Resource_Release
(
resource
);
}
if
(
dxgi_resource
)
IDXGIResource_Release
(
dxgi_resource
);
hr
=
IDXGISwapChain_ResizeBuffers
(
swapchain
,
2
,
320
,
240
,
DXGI_FORMAT_B8G8R8A8_UNORM
,
0
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IDXGISwapChain_GetBuffer
(
swapchain
,
0
,
&
IID_IDXGISurface
,
(
void
**
)
&
surface
);
expected_hr
=
is_d3d12
?
E_NOINTERFACE
:
S_OK
;
hr
=
IDXGISwapChain_GetBuffer
(
swapchain
,
0
,
&
IID_IDXGIResource
,
(
void
**
)
&
dxgi_resource
);
ok
(
hr
==
expected_hr
,
"Got unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
expected_hr
);
ok
(
!
surface
||
hr
==
S_OK
,
"Got unexpected pointer %p.
\n
"
,
surface
);
hr
=
IDXGISwapChain_GetBuffer
(
swapchain
,
0
,
&
IID_IDXGISurface
,
(
void
**
)
&
surface
);
ok
(
hr
==
expected_hr
,
"Got unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
expected_hr
);
ok
(
!
surface
||
hr
==
S_OK
,
"Got unexpected pointer %p.
\n
"
,
surface
);
hr
=
IDXGISwapChain_GetBuffer
(
swapchain
,
0
,
&
IID_ID3D10Texture2D
,
(
void
**
)
&
texture
);
ok
(
hr
==
expected_hr
,
"Got unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
expected_hr
);
ok
(
!
texture
||
hr
==
S_OK
,
"Got unexpected pointer %p.
\n
"
,
texture
);
expected_hr
=
is_d3d12
?
S_OK
:
E_NOINTERFACE
;
hr
=
IDXGISwapChain_GetBuffer
(
swapchain
,
0
,
&
IID_ID3D12Resource
,
(
void
**
)
&
resource
);
ok
(
hr
==
expected_hr
,
"Got unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
expected_hr
);
...
...
@@ -4246,6 +4259,8 @@ static void test_swapchain_resize(IUnknown *device, BOOL is_d3d12)
check_resource_desc
(
resource
,
&
swapchain_desc
);
ID3D12Resource_Release
(
resource
);
}
if
(
dxgi_resource
)
IDXGIResource_Release
(
dxgi_resource
);
hr
=
IDXGISwapChain_ResizeBuffers
(
swapchain
,
0
,
0
,
0
,
DXGI_FORMAT_UNKNOWN
,
0
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
...
...
@@ -4495,9 +4510,7 @@ static void test_swapchain_parameters(void)
expected_usage
=
DXGI_USAGE_RENDER_TARGET_OUTPUT
|
DXGI_USAGE_BACK_BUFFER
;
hr
=
IDXGIResource_GetUsage
(
resource
,
&
usage
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx, test %u.
\n
"
,
hr
,
i
);
todo_wine
ok
((
usage
&
expected_usage
)
==
expected_usage
,
"Got usage %x, expected %x, test %u.
\n
"
,
usage
,
expected_usage
,
i
);
...
...
@@ -4534,9 +4547,7 @@ static void test_swapchain_parameters(void)
broken_usage
|=
DXGI_USAGE_READ_ONLY
;
hr
=
IDXGIResource_GetUsage
(
resource
,
&
usage
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx, test %u, buffer %u.
\n
"
,
hr
,
i
,
j
);
todo_wine
ok
(
usage
==
expected_usage
||
broken
(
usage
==
broken_usage
),
"Got usage %x, expected %x, test %u, buffer %u.
\n
"
,
usage
,
expected_usage
,
i
,
j
);
...
...
@@ -4607,9 +4618,7 @@ static void test_swapchain_parameters(void)
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx, test %u.
\n
"
,
hr
,
i
);
expected_usage
=
usage
|
DXGI_USAGE_BACK_BUFFER
|
DXGI_USAGE_DISCARD_ON_PRESENT
;
hr
=
IDXGIResource_GetUsage
(
resource
,
&
usage
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx, test %u.
\n
"
,
hr
,
i
);
todo_wine_if
(
i
!=
7
)
ok
(
usage
==
expected_usage
,
"Got usage %x, expected %x, test %u.
\n
"
,
usage
,
expected_usage
,
i
);
IDXGIResource_Release
(
resource
);
...
...
dlls/dxgi/utils.c
View file @
555cee64
...
...
@@ -494,9 +494,6 @@ DXGI_USAGE dxgi_usage_from_wined3d_bind_flags(unsigned int wined3d_bind_flags)
if
(
wined3d_bind_flags
&
WINED3D_BIND_UNORDERED_ACCESS
)
dxgi_usage
|=
DXGI_USAGE_UNORDERED_ACCESS
;
wined3d_bind_flags
&=
~
(
WINED3D_BIND_SHADER_RESOURCE
|
WINED3D_BIND_RENDER_TARGET
|
WINED3D_BIND_UNORDERED_ACCESS
);
if
(
wined3d_bind_flags
)
FIXME
(
"Unhandled wined3d bind flags %#x.
\n
"
,
wined3d_bind_flags
);
return
dxgi_usage
;
}
...
...
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