Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
b6f917b1
Commit
b6f917b1
authored
Feb 16, 2018
by
Henri Verbeet
Committed by
Alexandre Julliard
Feb 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d11: Set resource access based on usage and CPU access flags.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0509b9a4
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
38 additions
and
20 deletions
+38
-20
device.c
dlls/d3d10core/tests/device.c
+8
-8
buffer.c
dlls/d3d11/buffer.c
+1
-3
d3d11_private.h
dlls/d3d11/d3d11_private.h
+1
-0
d3d11.c
dlls/d3d11/tests/d3d11.c
+4
-4
texture.c
dlls/d3d11/texture.c
+4
-4
utils.c
dlls/d3d11/utils.c
+15
-0
volume.c
dlls/d3d8/volume.c
+2
-0
volume.c
dlls/d3d9/volume.c
+2
-0
resource.c
dlls/wined3d/resource.c
+1
-1
No files found.
dlls/d3d10core/tests/device.c
View file @
b6f917b1
...
...
@@ -8199,28 +8199,28 @@ static void check_buffer_cpu_access_(unsigned int line, ID3D10Buffer *buffer,
expected_hr
=
cpu_read
?
S_OK
:
E_INVALIDARG
;
hr
=
ID3D10Buffer_Map
(
buffer
,
D3D10_MAP_READ
,
0
,
&
data
);
todo_wine_if
(
expected_hr
!=
S_OK
)
todo_wine_if
(
expected_hr
!=
S_OK
&&
cpu_access
)
ok_
(
__FILE__
,
line
)(
hr
==
expected_hr
,
"Got hr %#x for READ.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
ID3D10Buffer_Unmap
(
buffer
);
expected_hr
=
!
dynamic
&&
cpu_write
?
S_OK
:
E_INVALIDARG
;
hr
=
ID3D10Buffer_Map
(
buffer
,
D3D10_MAP_WRITE
,
0
,
&
data
);
todo_wine_if
(
expected_hr
!=
S_OK
)
todo_wine_if
(
expected_hr
!=
S_OK
&&
cpu_access
)
ok_
(
__FILE__
,
line
)(
hr
==
expected_hr
,
"Got hr %#x for WRITE.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
ID3D10Buffer_Unmap
(
buffer
);
expected_hr
=
cpu_read
&&
cpu_write
?
S_OK
:
E_INVALIDARG
;
hr
=
ID3D10Buffer_Map
(
buffer
,
D3D10_MAP_READ_WRITE
,
0
,
&
data
);
todo_wine_if
(
expected_hr
!=
S_OK
)
todo_wine_if
(
expected_hr
!=
S_OK
&&
cpu_access
)
ok_
(
__FILE__
,
line
)(
hr
==
expected_hr
,
"Got hr %#x for READ_WRITE.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
ID3D10Buffer_Unmap
(
buffer
);
expected_hr
=
dynamic
?
S_OK
:
E_INVALIDARG
;
hr
=
ID3D10Buffer_Map
(
buffer
,
D3D10_MAP_WRITE_DISCARD
,
0
,
&
data
);
todo_wine_if
(
expected_hr
!=
S_OK
)
todo_wine_if
(
expected_hr
!=
S_OK
&&
cpu_access
)
ok_
(
__FILE__
,
line
)(
hr
==
expected_hr
,
"Got hr %#x for WRITE_DISCARD.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
ID3D10Buffer_Unmap
(
buffer
);
...
...
@@ -8254,28 +8254,28 @@ static void check_texture_cpu_access_(unsigned int line, ID3D10Texture2D *textur
expected_hr
=
cpu_read
?
S_OK
:
E_INVALIDARG
;
hr
=
ID3D10Texture2D_Map
(
texture
,
0
,
D3D10_MAP_READ
,
0
,
&
map_desc
);
todo_wine_if
(
expected_hr
!=
S_OK
)
todo_wine_if
(
expected_hr
!=
S_OK
&&
cpu_access
)
ok_
(
__FILE__
,
line
)(
hr
==
expected_hr
,
"Got hr %#x for READ.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
ID3D10Texture2D_Unmap
(
texture
,
0
);
expected_hr
=
!
dynamic
&&
cpu_write
?
S_OK
:
E_INVALIDARG
;
hr
=
ID3D10Texture2D_Map
(
texture
,
0
,
D3D10_MAP_WRITE
,
0
,
&
map_desc
);
todo_wine_if
(
expected_hr
!=
S_OK
)
todo_wine_if
(
expected_hr
!=
S_OK
&&
cpu_access
)
ok_
(
__FILE__
,
line
)(
hr
==
expected_hr
,
"Got hr %#x for WRITE.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
ID3D10Texture2D_Unmap
(
texture
,
0
);
expected_hr
=
cpu_read
&&
cpu_write
?
S_OK
:
E_INVALIDARG
;
hr
=
ID3D10Texture2D_Map
(
texture
,
0
,
D3D10_MAP_READ_WRITE
,
0
,
&
map_desc
);
todo_wine_if
(
expected_hr
!=
S_OK
)
todo_wine_if
(
expected_hr
!=
S_OK
&&
cpu_access
)
ok_
(
__FILE__
,
line
)(
hr
==
expected_hr
,
"Got hr %#x for READ_WRITE.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
ID3D10Texture2D_Unmap
(
texture
,
0
);
expected_hr
=
dynamic
?
S_OK
:
E_INVALIDARG
;
hr
=
ID3D10Texture2D_Map
(
texture
,
0
,
D3D10_MAP_WRITE_DISCARD
,
0
,
&
map_desc
);
todo_wine_if
(
expected_hr
!=
S_OK
)
todo_wine_if
(
expected_hr
!=
S_OK
&&
cpu_access
)
ok_
(
__FILE__
,
line
)(
hr
==
expected_hr
,
"Got hr %#x for WRITE_DISCARD.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
ID3D10Texture2D_Unmap
(
texture
,
0
);
...
...
dlls/d3d11/buffer.c
View file @
b6f917b1
...
...
@@ -452,9 +452,7 @@ static HRESULT d3d_buffer_init(struct d3d_buffer *buffer, struct d3d_device *dev
wined3d_desc
.
byte_width
=
buffer
->
desc
.
ByteWidth
;
wined3d_desc
.
usage
=
wined3d_usage_from_d3d11
(
0
,
buffer
->
desc
.
Usage
);
wined3d_desc
.
bind_flags
=
buffer
->
desc
.
BindFlags
;
if
(
~
buffer
->
desc
.
CPUAccessFlags
&
(
D3D11_CPU_ACCESS_WRITE
|
D3D11_CPU_ACCESS_READ
))
FIXME
(
"Ignoring CPU access flags %#x.
\n
"
,
buffer
->
desc
.
CPUAccessFlags
);
wined3d_desc
.
access
=
WINED3D_RESOURCE_ACCESS_GPU
|
WINED3D_RESOURCE_ACCESS_CPU
|
WINED3D_RESOURCE_ACCESS_MAP
;
wined3d_desc
.
access
=
wined3d_access_from_d3d11
(
buffer
->
desc
.
Usage
,
buffer
->
desc
.
CPUAccessFlags
);
wined3d_desc
.
misc_flags
=
buffer
->
desc
.
MiscFlags
;
wined3d_desc
.
structure_byte_stride
=
buffer
->
desc
.
StructureByteStride
;
...
...
dlls/d3d11/d3d11_private.h
View file @
b6f917b1
...
...
@@ -74,6 +74,7 @@ struct wined3d_resource *wined3d_resource_from_d3d11_resource(ID3D11Resource *re
struct
wined3d_resource
*
wined3d_resource_from_d3d10_resource
(
ID3D10Resource
*
resource
)
DECLSPEC_HIDDEN
;
DWORD
wined3d_map_flags_from_d3d11_map_type
(
D3D11_MAP
map_type
)
DECLSPEC_HIDDEN
;
DWORD
wined3d_clear_flags_from_d3d11_clear_flags
(
UINT
clear_flags
)
DECLSPEC_HIDDEN
;
unsigned
int
wined3d_access_from_d3d11
(
D3D11_USAGE
usage
,
UINT
cpu_access
)
DECLSPEC_HIDDEN
;
enum
D3D11_USAGE
d3d11_usage_from_d3d10_usage
(
enum
D3D10_USAGE
usage
)
DECLSPEC_HIDDEN
;
enum
D3D10_USAGE
d3d10_usage_from_d3d11_usage
(
enum
D3D11_USAGE
usage
)
DECLSPEC_HIDDEN
;
...
...
dlls/d3d11/tests/d3d11.c
View file @
b6f917b1
...
...
@@ -11029,7 +11029,7 @@ static void check_resource_cpu_access_(unsigned int line, ID3D11DeviceContext *c
expected_hr
=
cpu_read
?
S_OK
:
E_INVALIDARG
;
hr
=
ID3D11DeviceContext_Map
(
context
,
resource
,
0
,
D3D11_MAP_READ
,
0
,
&
map_desc
);
todo_wine_if
(
expected_hr
!=
S_OK
)
todo_wine_if
(
expected_hr
!=
S_OK
&&
cpu_access
)
ok_
(
__FILE__
,
line
)(
hr
==
expected_hr
,
"Got hr %#x for READ.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
ID3D11DeviceContext_Unmap
(
context
,
resource
,
0
);
...
...
@@ -11037,21 +11037,21 @@ static void check_resource_cpu_access_(unsigned int line, ID3D11DeviceContext *c
/* WRITE_DISCARD and WRITE_NO_OVERWRITE are the only allowed options for dynamic resources. */
expected_hr
=
!
dynamic
&&
cpu_write
?
S_OK
:
E_INVALIDARG
;
hr
=
ID3D11DeviceContext_Map
(
context
,
resource
,
0
,
D3D11_MAP_WRITE
,
0
,
&
map_desc
);
todo_wine_if
(
expected_hr
!=
S_OK
)
todo_wine_if
(
expected_hr
!=
S_OK
&&
cpu_access
)
ok_
(
__FILE__
,
line
)(
hr
==
expected_hr
,
"Got hr %#x for WRITE.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
ID3D11DeviceContext_Unmap
(
context
,
resource
,
0
);
expected_hr
=
cpu_read
&&
cpu_write
?
S_OK
:
E_INVALIDARG
;
hr
=
ID3D11DeviceContext_Map
(
context
,
resource
,
0
,
D3D11_MAP_READ_WRITE
,
0
,
&
map_desc
);
todo_wine_if
(
expected_hr
!=
S_OK
)
todo_wine_if
(
expected_hr
!=
S_OK
&&
cpu_access
)
ok_
(
__FILE__
,
line
)(
hr
==
expected_hr
,
"Got hr %#x for READ_WRITE.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
ID3D11DeviceContext_Unmap
(
context
,
resource
,
0
);
expected_hr
=
dynamic
?
S_OK
:
E_INVALIDARG
;
hr
=
ID3D11DeviceContext_Map
(
context
,
resource
,
0
,
D3D11_MAP_WRITE_DISCARD
,
0
,
&
map_desc
);
todo_wine_if
(
expected_hr
!=
S_OK
)
todo_wine_if
(
expected_hr
!=
S_OK
&&
cpu_access
)
ok_
(
__FILE__
,
line
)(
hr
==
expected_hr
,
"Got hr %#x for WRITE_DISCARD.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
ID3D11DeviceContext_Unmap
(
context
,
resource
,
0
);
dlls/d3d11/texture.c
View file @
b6f917b1
...
...
@@ -517,7 +517,8 @@ HRESULT d3d_texture2d_create(struct d3d_device *device, const D3D11_TEXTURE2D_DE
wined3d_desc
.
multisample_type
=
desc
->
SampleDesc
.
Count
>
1
?
desc
->
SampleDesc
.
Count
:
WINED3D_MULTISAMPLE_NONE
;
wined3d_desc
.
multisample_quality
=
desc
->
SampleDesc
.
Quality
;
wined3d_desc
.
usage
=
wined3d_usage_from_d3d11
(
desc
->
BindFlags
,
desc
->
Usage
);
wined3d_desc
.
access
=
WINED3D_RESOURCE_ACCESS_GPU
|
WINED3D_RESOURCE_ACCESS_MAP
;
wined3d_desc
.
access
=
wined3d_access_from_d3d11
(
desc
->
Usage
,
desc
->
Usage
==
D3D11_USAGE_DEFAULT
?
0
:
desc
->
CPUAccessFlags
);
wined3d_desc
.
width
=
desc
->
Width
;
wined3d_desc
.
height
=
desc
->
Height
;
wined3d_desc
.
depth
=
1
;
...
...
@@ -974,9 +975,8 @@ static HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_devi
wined3d_desc
.
multisample_type
=
WINED3D_MULTISAMPLE_NONE
;
wined3d_desc
.
multisample_quality
=
0
;
wined3d_desc
.
usage
=
wined3d_usage_from_d3d11
(
desc
->
BindFlags
,
desc
->
Usage
);
wined3d_desc
.
access
=
WINED3D_RESOURCE_ACCESS_GPU
;
if
(
desc
->
Usage
==
D3D11_USAGE_STAGING
)
wined3d_desc
.
access
|=
WINED3D_RESOURCE_ACCESS_CPU
|
WINED3D_RESOURCE_ACCESS_MAP
;
wined3d_desc
.
access
=
wined3d_access_from_d3d11
(
desc
->
Usage
,
desc
->
Usage
==
D3D11_USAGE_DEFAULT
?
0
:
desc
->
CPUAccessFlags
);
wined3d_desc
.
width
=
desc
->
Width
;
wined3d_desc
.
height
=
desc
->
Height
;
wined3d_desc
.
depth
=
desc
->
Depth
;
...
...
dlls/d3d11/utils.c
View file @
b6f917b1
...
...
@@ -791,6 +791,21 @@ DWORD wined3d_clear_flags_from_d3d11_clear_flags(UINT clear_flags)
return
wined3d_clear_flags
;
}
unsigned
int
wined3d_access_from_d3d11
(
D3D11_USAGE
usage
,
UINT
cpu_access
)
{
unsigned
int
access
;
access
=
usage
==
D3D11_USAGE_STAGING
?
WINED3D_RESOURCE_ACCESS_CPU
:
WINED3D_RESOURCE_ACCESS_GPU
;
if
(
cpu_access
)
{
if
(
~
cpu_access
&
(
D3D11_CPU_ACCESS_WRITE
|
D3D11_CPU_ACCESS_READ
))
FIXME
(
"Ignoring CPU access flags %#x.
\n
"
,
cpu_access
);
access
|=
WINED3D_RESOURCE_ACCESS_MAP
;
}
return
access
;
}
HRESULT
d3d_get_private_data
(
struct
wined3d_private_store
*
store
,
REFGUID
guid
,
UINT
*
data_size
,
void
*
data
)
{
...
...
dlls/d3d8/volume.c
View file @
b6f917b1
...
...
@@ -155,6 +155,8 @@ static HRESULT WINAPI d3d8_volume_LockBox(IDirect3DVolume8 *iface,
locked_box
->
SlicePitch
=
map_desc
.
slice_pitch
;
locked_box
->
pBits
=
map_desc
.
data
;
if
(
hr
==
E_INVALIDARG
)
return
D3DERR_INVALIDCALL
;
return
hr
;
}
...
...
dlls/d3d9/volume.c
View file @
b6f917b1
...
...
@@ -155,6 +155,8 @@ static HRESULT WINAPI d3d9_volume_LockBox(IDirect3DVolume9 *iface,
locked_box
->
SlicePitch
=
map_desc
.
slice_pitch
;
locked_box
->
pBits
=
map_desc
.
data
;
if
(
hr
==
E_INVALIDARG
)
return
D3DERR_INVALIDCALL
;
return
hr
;
}
...
...
dlls/wined3d/resource.c
View file @
b6f917b1
...
...
@@ -346,7 +346,7 @@ HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned i
if
(
!
(
resource
->
access
&
WINED3D_RESOURCE_ACCESS_MAP
))
{
WARN
(
"Resource is not mappable.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
return
E_INVALIDARG
;
}
flags
=
wined3d_resource_sanitise_map_flags
(
resource
,
flags
);
...
...
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