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
acc0f49a
Commit
acc0f49a
authored
Feb 18, 2018
by
Henri Verbeet
Committed by
Alexandre Julliard
Feb 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Introduce separate read and write resource map flags.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0282f3aa
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
103 additions
and
72 deletions
+103
-72
utils.c
dlls/d3d11/utils.c
+7
-5
device.c
dlls/d3d8/device.c
+11
-6
device.c
dlls/d3d9/device.c
+11
-6
device.c
dlls/ddraw/device.c
+7
-7
executebuffer.c
dlls/ddraw/executebuffer.c
+3
-4
surface.c
dlls/ddraw/surface.c
+2
-2
utils.c
dlls/ddraw/utils.c
+8
-3
buffer.c
dlls/wined3d/buffer.c
+4
-4
context.c
dlls/wined3d/context.c
+2
-2
device.c
dlls/wined3d/device.c
+4
-4
resource.c
dlls/wined3d/resource.c
+25
-13
surface.c
dlls/wined3d/surface.c
+9
-8
texture.c
dlls/wined3d/texture.c
+3
-2
wined3d.h
include/wine/wined3d.h
+7
-6
No files found.
dlls/d3d11/utils.c
View file @
acc0f49a
...
...
@@ -758,21 +758,23 @@ DWORD wined3d_map_flags_from_d3d11_map_type(D3D11_MAP map_type)
switch
(
map_type
)
{
case
D3D11_MAP_WRITE
:
return
WINED3D_MAP_WRITE
;
case
D3D11_MAP_READ_WRITE
:
return
0
;
return
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
;
case
D3D11_MAP_READ
:
return
WINED3D_MAP_READ
ONLY
;
return
WINED3D_MAP_READ
;
case
D3D11_MAP_WRITE_DISCARD
:
return
WINED3D_MAP_DISCARD
;
return
WINED3D_MAP_
WRITE
|
WINED3D_MAP_
DISCARD
;
case
D3D11_MAP_WRITE_NO_OVERWRITE
:
return
WINED3D_MAP_NOOVERWRITE
;
return
WINED3D_MAP_
WRITE
|
WINED3D_MAP_
NOOVERWRITE
;
default:
FIXME
(
"Unhandled map_type %#x.
\n
"
,
map_type
);
return
0
;
return
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
;
}
}
...
...
dlls/d3d8/device.c
View file @
acc0f49a
...
...
@@ -143,15 +143,20 @@ enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format)
unsigned
int
wined3dmapflags_from_d3dmapflags
(
unsigned
int
flags
)
{
static
const
unsigned
int
handled
=
D3DLOCK_READONLY
|
D3DLOCK_NOSYSLOCK
static
const
unsigned
int
handled
=
D3DLOCK_NOSYSLOCK
|
D3DLOCK_NOOVERWRITE
|
D3DLOCK_DISCARD
|
D3DLOCK_NO_DIRTY_UPDATE
;
unsigned
int
wined3d_flags
;
wined3d_flags
=
flags
&
handled
;
flags
&=
~
handled
;
if
(
!
(
flags
&
(
D3DLOCK_NOOVERWRITE
|
D3DLOCK_DISCARD
)))
wined3d_flags
|=
WINED3D_MAP_READ
;
if
(
!
(
flags
&
D3DLOCK_READONLY
))
wined3d_flags
|=
WINED3D_MAP_WRITE
;
if
(
!
(
wined3d_flags
&
(
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
)))
wined3d_flags
|=
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
;
flags
&=
~
(
handled
|
D3DLOCK_READONLY
);
if
(
flags
)
FIXME
(
"Unhandled flags %#x.
\n
"
,
flags
);
...
...
@@ -2225,7 +2230,7 @@ static HRESULT WINAPI d3d8_device_DrawPrimitiveUP(IDirect3DDevice8 *iface,
wined3d_box
.
right
=
vb_pos
+
size
;
vb
=
wined3d_buffer_get_resource
(
device
->
vertex_buffer
);
if
(
FAILED
(
wined3d_resource_map
(
vb
,
0
,
&
wined3d_map_desc
,
&
wined3d_box
,
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)))
WINED3D_MAP_WRITE
|
(
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)
)))
goto
done
;
memcpy
(
wined3d_map_desc
.
data
,
data
,
size
);
wined3d_resource_unmap
(
vb
,
0
);
...
...
@@ -2326,7 +2331,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
wined3d_box
.
right
=
vb_pos
+
vtx_size
;
vb
=
wined3d_buffer_get_resource
(
device
->
vertex_buffer
);
if
(
FAILED
(
hr
=
wined3d_resource_map
(
vb
,
0
,
&
wined3d_map_desc
,
&
wined3d_box
,
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)))
WINED3D_MAP_WRITE
|
(
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)
)))
goto
done
;
memcpy
(
wined3d_map_desc
.
data
,
(
char
*
)
vertex_data
+
min_vertex_idx
*
vertex_stride
,
vtx_size
);
wined3d_resource_unmap
(
vb
,
0
);
...
...
@@ -2348,7 +2353,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
wined3d_box
.
right
=
ib_pos
+
idx_size
;
ib
=
wined3d_buffer_get_resource
(
device
->
index_buffer
);
if
(
FAILED
(
hr
=
wined3d_resource_map
(
ib
,
0
,
&
wined3d_map_desc
,
&
wined3d_box
,
ib_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)))
WINED3D_MAP_WRITE
|
(
ib_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)
)))
goto
done
;
memcpy
(
wined3d_map_desc
.
data
,
index_data
,
idx_size
);
wined3d_resource_unmap
(
ib
,
0
);
...
...
dlls/d3d9/device.c
View file @
acc0f49a
...
...
@@ -162,8 +162,7 @@ enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format)
unsigned
int
wined3dmapflags_from_d3dmapflags
(
unsigned
int
flags
)
{
static
const
unsigned
int
handled
=
D3DLOCK_READONLY
|
D3DLOCK_NOSYSLOCK
static
const
unsigned
int
handled
=
D3DLOCK_NOSYSLOCK
|
D3DLOCK_NOOVERWRITE
|
D3DLOCK_DISCARD
|
D3DLOCK_DONOTWAIT
...
...
@@ -171,7 +170,13 @@ unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags)
unsigned
int
wined3d_flags
;
wined3d_flags
=
flags
&
handled
;
flags
&=
~
handled
;
if
(
!
(
flags
&
(
D3DLOCK_NOOVERWRITE
|
D3DLOCK_DISCARD
)))
wined3d_flags
|=
WINED3D_MAP_READ
;
if
(
!
(
flags
&
D3DLOCK_READONLY
))
wined3d_flags
|=
WINED3D_MAP_WRITE
;
if
(
!
(
wined3d_flags
&
(
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
)))
wined3d_flags
|=
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
;
flags
&=
~
(
handled
|
D3DLOCK_READONLY
);
if
(
flags
)
FIXME
(
"Unhandled flags %#x.
\n
"
,
flags
);
...
...
@@ -2737,7 +2742,7 @@ static HRESULT WINAPI d3d9_device_DrawPrimitiveUP(IDirect3DDevice9Ex *iface,
wined3d_box
.
right
=
vb_pos
+
size
;
vb
=
wined3d_buffer_get_resource
(
device
->
vertex_buffer
);
if
(
FAILED
(
hr
=
wined3d_resource_map
(
vb
,
0
,
&
wined3d_map_desc
,
&
wined3d_box
,
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)))
WINED3D_MAP_WRITE
|
(
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)
)))
goto
done
;
memcpy
(
wined3d_map_desc
.
data
,
data
,
size
);
wined3d_resource_unmap
(
vb
,
0
);
...
...
@@ -2848,7 +2853,7 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *ifa
wined3d_box
.
right
=
vb_pos
+
vtx_size
;
vb
=
wined3d_buffer_get_resource
(
device
->
vertex_buffer
);
if
(
FAILED
(
hr
=
wined3d_resource_map
(
vb
,
0
,
&
wined3d_map_desc
,
&
wined3d_box
,
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)))
WINED3D_MAP_WRITE
|
(
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)
)))
goto
done
;
memcpy
(
wined3d_map_desc
.
data
,
(
char
*
)
vertex_data
+
min_vertex_idx
*
vertex_stride
,
vtx_size
);
wined3d_resource_unmap
(
vb
,
0
);
...
...
@@ -2870,7 +2875,7 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *ifa
wined3d_box
.
right
=
ib_pos
+
idx_size
;
ib
=
wined3d_buffer_get_resource
(
device
->
index_buffer
);
if
(
FAILED
(
hr
=
wined3d_resource_map
(
ib
,
0
,
&
wined3d_map_desc
,
&
wined3d_box
,
ib_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)))
WINED3D_MAP_WRITE
|
(
ib_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)
)))
goto
done
;
memcpy
(
wined3d_map_desc
.
data
,
index_data
,
idx_size
);
wined3d_resource_unmap
(
ib
,
0
);
...
...
dlls/ddraw/device.c
View file @
acc0f49a
...
...
@@ -3533,7 +3533,7 @@ static HRESULT d3d_device7_DrawPrimitive(IDirect3DDevice7 *iface,
wined3d_box
.
right
=
vb_pos
+
size
;
vb
=
wined3d_buffer_get_resource
(
device
->
vertex_buffer
);
if
(
FAILED
(
hr
=
wined3d_resource_map
(
vb
,
0
,
&
wined3d_map_desc
,
&
wined3d_box
,
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)))
WINED3D_MAP_WRITE
|
(
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)
)))
goto
done
;
memcpy
(
wined3d_map_desc
.
data
,
vertices
,
size
);
wined3d_resource_unmap
(
vb
,
0
);
...
...
@@ -3725,7 +3725,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
wined3d_box
.
right
=
vb_pos
+
vtx_size
;
vb
=
wined3d_buffer_get_resource
(
device
->
vertex_buffer
);
if
(
FAILED
(
hr
=
wined3d_resource_map
(
vb
,
0
,
&
wined3d_map_desc
,
&
wined3d_box
,
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)))
WINED3D_MAP_WRITE
|
(
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)
)))
goto
done
;
memcpy
(
wined3d_map_desc
.
data
,
vertices
,
vtx_size
);
wined3d_resource_unmap
(
vb
,
0
);
...
...
@@ -3742,7 +3742,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
wined3d_box
.
right
=
ib_pos
+
idx_size
;
ib
=
wined3d_buffer_get_resource
(
device
->
index_buffer
);
if
(
FAILED
(
hr
=
wined3d_resource_map
(
ib
,
0
,
&
wined3d_map_desc
,
&
wined3d_box
,
ib_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)))
WINED3D_MAP_WRITE
|
(
ib_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)
)))
goto
done
;
memcpy
(
wined3d_map_desc
.
data
,
indices
,
idx_size
);
wined3d_resource_unmap
(
ib
,
0
);
...
...
@@ -4056,7 +4056,7 @@ static HRESULT d3d_device7_DrawPrimitiveStrided(IDirect3DDevice7 *iface, D3DPRIM
wined3d_box
.
right
=
vb_pos
+
dst_size
;
vb
=
wined3d_buffer_get_resource
(
device
->
vertex_buffer
);
if
(
FAILED
(
hr
=
wined3d_resource_map
(
vb
,
0
,
&
wined3d_map_desc
,
&
wined3d_box
,
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)))
WINED3D_MAP_WRITE
|
(
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)
)))
goto
done
;
pack_strided_data
(
wined3d_map_desc
.
data
,
vertex_count
,
strided_data
,
fvf
);
wined3d_resource_unmap
(
vb
,
0
);
...
...
@@ -4172,7 +4172,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveStrided(IDirect3DDevice7 *iface,
wined3d_box
.
right
=
vb_pos
+
vtx_dst_size
;
vb
=
wined3d_buffer_get_resource
(
device
->
vertex_buffer
);
if
(
FAILED
(
hr
=
wined3d_resource_map
(
vb
,
0
,
&
wined3d_map_desc
,
&
wined3d_box
,
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)))
WINED3D_MAP_WRITE
|
(
vb_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)
)))
goto
done
;
pack_strided_data
(
wined3d_map_desc
.
data
,
vertex_count
,
strided_data
,
fvf
);
wined3d_resource_unmap
(
vb
,
0
);
...
...
@@ -4189,7 +4189,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveStrided(IDirect3DDevice7 *iface,
wined3d_box
.
right
=
ib_pos
+
idx_size
;
ib
=
wined3d_buffer_get_resource
(
device
->
index_buffer
);
if
(
FAILED
(
hr
=
wined3d_resource_map
(
ib
,
0
,
&
wined3d_map_desc
,
&
wined3d_box
,
ib_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)))
WINED3D_MAP_WRITE
|
(
ib_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)
)))
goto
done
;
memcpy
(
wined3d_map_desc
.
data
,
indices
,
idx_size
);
wined3d_resource_unmap
(
ib
,
0
);
...
...
@@ -4409,7 +4409,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
wined3d_box
.
right
=
ib_pos
+
index_count
*
sizeof
(
WORD
);
ib
=
wined3d_buffer_get_resource
(
device
->
index_buffer
);
if
(
FAILED
(
hr
=
wined3d_resource_map
(
ib
,
0
,
&
wined3d_map_desc
,
&
wined3d_box
,
ib_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)))
WINED3D_MAP_WRITE
|
(
ib_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
)
)))
{
ERR
(
"Failed to map buffer, hr %#x.
\n
"
,
hr
);
wined3d_mutex_unlock
();
...
...
dlls/ddraw/executebuffer.c
View file @
acc0f49a
...
...
@@ -152,9 +152,8 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
box
.
left
=
index_pos
*
sizeof
(
*
indices
);
box
.
right
=
(
index_pos
+
index_count
)
*
sizeof
(
*
indices
);
hr
=
wined3d_resource_map
(
wined3d_buffer_get_resource
(
buffer
->
index_buffer
),
0
,
&
map_desc
,
&
box
,
index_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
=
wined3d_resource_map
(
wined3d_buffer_get_resource
(
buffer
->
index_buffer
),
0
,
&
map_desc
,
&
box
,
WINED3D_MAP_WRITE
|
(
index_pos
?
WINED3D_MAP_NOOVERWRITE
:
WINED3D_MAP_DISCARD
))))
return
hr
;
indices
=
map_desc
.
data
;
...
...
@@ -661,7 +660,7 @@ static HRESULT WINAPI d3d_execute_buffer_SetExecuteData(IDirect3DExecuteBuffer *
box
.
left
=
buffer
->
src_vertex_pos
*
sizeof
(
D3DVERTEX
);
box
.
right
=
box
.
left
+
data
->
dwVertexCount
*
sizeof
(
D3DVERTEX
);
if
(
FAILED
(
hr
=
wined3d_resource_map
(
wined3d_buffer_get_resource
(
buffer
->
src_vertex_buffer
),
0
,
&
map_desc
,
&
box
,
0
)))
0
,
&
map_desc
,
&
box
,
WINED3D_MAP_WRITE
)))
return
hr
;
memcpy
(
map_desc
.
data
,
((
BYTE
*
)
buffer
->
desc
.
lpData
)
+
data
->
dwVertexOffset
,
...
...
dlls/ddraw/surface.c
View file @
acc0f49a
...
...
@@ -5281,7 +5281,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
}
if
(
FAILED
(
hr
=
wined3d_resource_map
(
src_resource
,
src_surface
->
sub_resource_idx
,
&
src_map_desc
,
NULL
,
0
)))
src_surface
->
sub_resource_idx
,
&
src_map_desc
,
NULL
,
WINED3D_MAP_READ
)))
{
ERR
(
"Failed to lock source surface, hr %#x.
\n
"
,
hr
);
wined3d_mutex_unlock
();
...
...
@@ -5289,7 +5289,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
}
if
(
FAILED
(
hr
=
wined3d_resource_map
(
dst_resource
,
dst_surface
->
sub_resource_idx
,
&
dst_map_desc
,
NULL
,
0
)))
dst_surface
->
sub_resource_idx
,
&
dst_map_desc
,
NULL
,
WINED3D_MAP_WRITE
)))
{
ERR
(
"Failed to lock destination surface, hr %#x.
\n
"
,
hr
);
wined3d_resource_unmap
(
src_resource
,
src_surface
->
sub_resource_idx
);
...
...
dlls/ddraw/utils.c
View file @
acc0f49a
...
...
@@ -563,17 +563,22 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix
unsigned
int
wined3dmapflags_from_ddrawmapflags
(
unsigned
int
flags
)
{
static
const
unsigned
int
handled
=
DDLOCK_READONLY
|
DDLOCK_NOSYSLOCK
static
const
unsigned
int
handled
=
DDLOCK_NOSYSLOCK
|
DDLOCK_NOOVERWRITE
|
DDLOCK_DISCARDCONTENTS
|
DDLOCK_DONOTWAIT
;
unsigned
int
wined3d_flags
;
wined3d_flags
=
flags
&
handled
;
if
(
!
(
flags
&
(
DDLOCK_NOOVERWRITE
|
DDLOCK_DISCARDCONTENTS
)))
wined3d_flags
|=
WINED3D_MAP_READ
;
if
(
!
(
flags
&
DDLOCK_READONLY
))
wined3d_flags
|=
WINED3D_MAP_WRITE
;
if
(
!
(
wined3d_flags
&
(
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
)))
wined3d_flags
|=
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
;
if
(
flags
&
DDLOCK_NODIRTYUPDATE
)
wined3d_flags
|=
WINED3D_MAP_NO_DIRTY_UPDATE
;
flags
&=
~
(
handled
|
DDLOCK_WAIT
|
DDLOCK_NODIRTYUPDATE
);
flags
&=
~
(
handled
|
DDLOCK_WAIT
|
DDLOCK_
READONLY
|
DDLOCK_
NODIRTYUPDATE
);
if
(
flags
)
FIXME
(
"Unhandled flags %#x.
\n
"
,
flags
);
...
...
dlls/wined3d/buffer.c
View file @
acc0f49a
...
...
@@ -1024,8 +1024,8 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
dirty_size
=
0
;
}
if
(
!
(
flags
&
(
WINED3D_MAP_NOOVERWRITE
|
WINED3D_MAP_DISCARD
|
WINED3D_MAP_READONLY
))
||
(
(
flags
&
WINED3D_MAP_READONLY
)
&&
(
buffer
->
locations
&
WINED3D_LOCATION_SYSMEM
))
if
(
((
flags
&
WINED3D_MAP_WRITE
)
&&
!
(
flags
&
(
WINED3D_MAP_NOOVERWRITE
|
WINED3D_MAP_DISCARD
)
))
||
(
!
(
flags
&
WINED3D_MAP_WRITE
)
&&
(
buffer
->
locations
&
WINED3D_LOCATION_SYSMEM
))
||
buffer
->
flags
&
WINED3D_BUFFER_PIN_SYSMEM
)
{
if
(
!
(
buffer
->
locations
&
WINED3D_LOCATION_SYSMEM
))
...
...
@@ -1035,7 +1035,7 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
context_release
(
context
);
}
if
(
!
(
flags
&
WINED3D_MAP_READONLY
)
)
if
(
flags
&
WINED3D_MAP_WRITE
)
wined3d_buffer_invalidate_range
(
buffer
,
WINED3D_LOCATION_BUFFER
,
dirty_offset
,
dirty_size
);
}
else
...
...
@@ -1050,7 +1050,7 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
else
wined3d_buffer_load_location
(
buffer
,
context
,
WINED3D_LOCATION_BUFFER
);
if
(
!
(
flags
&
WINED3D_MAP_READONLY
)
)
if
(
flags
&
WINED3D_MAP_WRITE
)
buffer_invalidate_bo_range
(
buffer
,
dirty_offset
,
dirty_size
);
if
((
flags
&
WINED3D_MAP_DISCARD
)
&&
buffer
->
resource
.
heap_memory
)
...
...
dlls/wined3d/context.c
View file @
acc0f49a
...
...
@@ -2837,8 +2837,8 @@ void context_copy_bo_address(struct wined3d_context *context,
}
else
{
src_ptr
=
context_map_bo_address
(
context
,
src
,
size
,
src_binding
,
WINED3D_MAP_READ
ONLY
);
dst_ptr
=
context_map_bo_address
(
context
,
dst
,
size
,
dst_binding
,
0
);
src_ptr
=
context_map_bo_address
(
context
,
src
,
size
,
src_binding
,
WINED3D_MAP_READ
);
dst_ptr
=
context_map_bo_address
(
context
,
dst
,
size
,
dst_binding
,
WINED3D_MAP_WRITE
);
memcpy
(
dst_ptr
,
src_ptr
,
size
);
...
...
dlls/wined3d/device.c
View file @
acc0f49a
...
...
@@ -3078,7 +3078,7 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO
vertex_size
=
get_flexible_vertex_size
(
DestFVF
);
box
.
left
=
dwDestIndex
*
vertex_size
;
box
.
right
=
box
.
left
+
dwCount
*
vertex_size
;
if
(
FAILED
(
hr
=
wined3d_resource_map
(
&
dest
->
resource
,
0
,
&
map_desc
,
&
box
,
0
)))
if
(
FAILED
(
hr
=
wined3d_resource_map
(
&
dest
->
resource
,
0
,
&
map_desc
,
&
box
,
WINED3D_MAP_WRITE
)))
{
WARN
(
"Failed to map buffer, hr %#x.
\n
"
,
hr
);
return
hr
;
...
...
@@ -3342,7 +3342,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
resource
=
&
state
->
streams
[
e
->
stream_idx
].
buffer
->
resource
;
box
.
left
=
src_start_idx
*
e
->
stride
;
box
.
right
=
box
.
left
+
vertex_count
*
e
->
stride
;
if
(
FAILED
(
wined3d_resource_map
(
resource
,
0
,
&
map_desc
,
&
box
,
WINED3D_MAP_READ
ONLY
)))
if
(
FAILED
(
wined3d_resource_map
(
resource
,
0
,
&
map_desc
,
&
box
,
WINED3D_MAP_READ
)))
ERR
(
"Failed to map resource.
\n
"
);
e
->
data
.
buffer_object
=
0
;
e
->
data
.
addr
+=
(
ULONG_PTR
)
map_desc
.
data
;
...
...
@@ -4499,7 +4499,7 @@ static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined
struct
wined3d_texture
*
texture
;
HRESULT
hr
;
if
(
FAILED
(
wined3d_resource_map
(
&
cursor_image
->
resource
,
sub_resource_idx
,
&
map_desc
,
NULL
,
WINED3D_MAP_READ
ONLY
)))
if
(
FAILED
(
wined3d_resource_map
(
&
cursor_image
->
resource
,
sub_resource_idx
,
&
map_desc
,
NULL
,
WINED3D_MAP_READ
)))
{
ERR
(
"Failed to map source texture.
\n
"
);
return
NULL
;
...
...
@@ -4603,7 +4603,7 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
memset
(
mask_bits
,
0xff
,
mask_size
);
wined3d_resource_map
(
&
texture
->
resource
,
sub_resource_idx
,
&
map_desc
,
NULL
,
WINED3D_MAP_NO_DIRTY_UPDATE
|
WINED3D_MAP_READ
ONLY
);
WINED3D_MAP_NO_DIRTY_UPDATE
|
WINED3D_MAP_READ
);
cursor_info
.
fIcon
=
FALSE
;
cursor_info
.
xHotspot
=
x_hotspot
;
cursor_info
.
yHotspot
=
y_hotspot
;
...
...
dlls/wined3d/resource.c
View file @
acc0f49a
...
...
@@ -306,17 +306,17 @@ static DWORD wined3d_resource_sanitise_map_flags(const struct wined3d_resource *
{
/* Not all flags make sense together, but Windows never returns an error.
* Catch the cases that could cause issues. */
if
(
flags
&
WINED3D_MAP_READ
ONLY
)
if
(
flags
&
WINED3D_MAP_READ
)
{
if
(
flags
&
WINED3D_MAP_DISCARD
)
{
WARN
(
"WINED3D_MAP_READ
ONLY
combined with WINED3D_MAP_DISCARD, ignoring flags.
\n
"
);
return
0
;
WARN
(
"WINED3D_MAP_READ combined with WINED3D_MAP_DISCARD, ignoring flags.
\n
"
);
return
flags
&
(
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
)
;
}
if
(
flags
&
WINED3D_MAP_NOOVERWRITE
)
{
WARN
(
"WINED3D_MAP_READ
ONLY
combined with WINED3D_MAP_NOOVERWRITE, ignoring flags.
\n
"
);
return
0
;
WARN
(
"WINED3D_MAP_READ combined with WINED3D_MAP_NOOVERWRITE, ignoring flags.
\n
"
);
return
flags
&
(
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
)
;
}
}
else
if
(
flags
&
(
WINED3D_MAP_DISCARD
|
WINED3D_MAP_NOOVERWRITE
))
...
...
@@ -324,7 +324,7 @@ static DWORD wined3d_resource_sanitise_map_flags(const struct wined3d_resource *
if
(
!
(
resource
->
usage
&
WINED3DUSAGE_DYNAMIC
))
{
WARN
(
"DISCARD or NOOVERWRITE map on non-dynamic buffer, ignoring.
\n
"
);
return
0
;
return
flags
&
(
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
)
;
}
if
((
flags
&
(
WINED3D_MAP_DISCARD
|
WINED3D_MAP_NOOVERWRITE
))
==
(
WINED3D_MAP_DISCARD
|
WINED3D_MAP_NOOVERWRITE
))
...
...
@@ -343,6 +343,12 @@ HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned i
TRACE
(
"resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.
\n
"
,
resource
,
sub_resource_idx
,
map_desc
,
debug_box
(
box
),
flags
);
if
(
!
(
flags
&
(
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
)))
{
WARN
(
"No read/write flags specified.
\n
"
);
return
E_INVALIDARG
;
}
if
(
!
(
resource
->
access
&
WINED3D_RESOURCE_ACCESS_MAP
))
{
WARN
(
"Resource is not mappable.
\n
"
);
...
...
@@ -399,9 +405,9 @@ GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags)
{
GLbitfield
ret
=
0
;
if
(
!
(
d3d_flags
&
WINED3D_MAP_READONLY
)
)
if
(
d3d_flags
&
WINED3D_MAP_WRITE
)
ret
|=
GL_MAP_WRITE_BIT
|
GL_MAP_FLUSH_EXPLICIT_BIT
;
if
(
!
(
d3d_flags
&
(
WINED3D_MAP_DISCARD
|
WINED3D_MAP_NOOVERWRITE
))
)
if
(
d3d_flags
&
WINED3D_MAP_READ
)
ret
|=
GL_MAP_READ_BIT
;
if
(
d3d_flags
&
WINED3D_MAP_DISCARD
)
...
...
@@ -414,11 +420,17 @@ GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags)
GLenum
wined3d_resource_gl_legacy_map_flags
(
DWORD
d3d_flags
)
{
if
(
d3d_flags
&
WINED3D_MAP_READONLY
)
return
GL_READ_ONLY_ARB
;
if
(
d3d_flags
&
(
WINED3D_MAP_DISCARD
|
WINED3D_MAP_NOOVERWRITE
))
return
GL_WRITE_ONLY_ARB
;
return
GL_READ_WRITE_ARB
;
switch
(
d3d_flags
&
(
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
))
{
case
WINED3D_MAP_READ
:
return
GL_READ_ONLY_ARB
;
case
WINED3D_MAP_WRITE
:
return
GL_WRITE_ONLY_ARB
;
default:
return
GL_READ_WRITE_ARB
;
}
}
BOOL
wined3d_resource_is_offscreen
(
struct
wined3d_resource
*
resource
)
...
...
dlls/wined3d/surface.c
View file @
acc0f49a
...
...
@@ -1369,9 +1369,9 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
wined3d_texture_get_memory
(
dst_texture
,
0
,
&
dst_data
,
map_binding
);
src
=
context_map_bo_address
(
context
,
&
src_data
,
src_texture
->
sub_resources
[
sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
0
);
src_texture
->
sub_resources
[
sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
);
dst
=
context_map_bo_address
(
context
,
&
dst_data
,
dst_texture
->
sub_resources
[
0
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
0
);
&
dst_data
,
dst_texture
->
sub_resources
[
0
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_WRITE
);
conv
->
convert
(
src
,
dst
,
src_row_pitch
,
dst_row_pitch
,
desc
.
width
,
desc
.
height
);
...
...
@@ -2325,7 +2325,7 @@ static BOOL surface_load_texture(struct wined3d_surface *surface,
wined3d_format_calculate_pitch
(
&
format
,
1
,
width
,
height
,
&
dst_row_pitch
,
&
dst_slice_pitch
);
src_mem
=
context_map_bo_address
(
context
,
&
data
,
src_slice_pitch
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
ONLY
);
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
);
if
(
!
(
dst_mem
=
heap_alloc
(
dst_slice_pitch
)))
{
ERR
(
"Out of memory (%u).
\n
"
,
dst_slice_pitch
);
...
...
@@ -2349,7 +2349,7 @@ static BOOL surface_load_texture(struct wined3d_surface *surface,
width
,
height
,
&
dst_row_pitch
,
&
dst_slice_pitch
);
src_mem
=
context_map_bo_address
(
context
,
&
data
,
src_slice_pitch
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
ONLY
);
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
);
if
(
!
(
dst_mem
=
heap_alloc
(
dst_slice_pitch
)))
{
ERR
(
"Out of memory (%u).
\n
"
,
dst_slice_pitch
);
...
...
@@ -3113,7 +3113,8 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
wined3d_texture_get_pitch
(
dst_texture
,
texture_level
,
&
dst_map
.
row_pitch
,
&
dst_map
.
slice_pitch
);
wined3d_texture_get_memory
(
dst_texture
,
dst_sub_resource_idx
,
&
dst_data
,
map_binding
);
dst_map
.
data
=
context_map_bo_address
(
context
,
&
dst_data
,
dst_texture
->
sub_resources
[
dst_sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
0
);
dst_texture
->
sub_resources
[
dst_sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
);
src_map
=
dst_map
;
src_format
=
dst_texture
->
resource
.
format
;
...
...
@@ -3149,7 +3150,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
wined3d_texture_get_pitch
(
src_texture
,
texture_level
,
&
src_map
.
row_pitch
,
&
src_map
.
slice_pitch
);
wined3d_texture_get_memory
(
src_texture
,
src_sub_resource_idx
,
&
src_data
,
map_binding
);
src_map
.
data
=
context_map_bo_address
(
context
,
&
src_data
,
src_texture
->
sub_resources
[
src_sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
0
);
src_texture
->
sub_resources
[
src_sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
);
map_binding
=
dst_texture
->
resource
.
map_binding
;
texture_level
=
dst_sub_resource_idx
%
dst_texture
->
level_count
;
...
...
@@ -3159,7 +3160,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
wined3d_texture_get_pitch
(
dst_texture
,
texture_level
,
&
dst_map
.
row_pitch
,
&
dst_map
.
slice_pitch
);
wined3d_texture_get_memory
(
dst_texture
,
dst_sub_resource_idx
,
&
dst_data
,
map_binding
);
dst_map
.
data
=
context_map_bo_address
(
context
,
&
dst_data
,
dst_texture
->
sub_resources
[
dst_sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
0
);
dst_texture
->
sub_resources
[
dst_sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_WRITE
);
}
flags
&=
~
WINED3D_BLT_RAW
;
...
...
@@ -3600,7 +3601,7 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
&
map
.
row_pitch
,
&
map
.
slice_pitch
);
wined3d_texture_get_memory
(
texture
,
view
->
sub_resource_idx
,
&
data
,
map_binding
);
map
.
data
=
context_map_bo_address
(
context
,
&
data
,
texture
->
sub_resources
[
view
->
sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
0
);
texture
->
sub_resources
[
view
->
sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_WRITE
);
map
.
data
=
(
BYTE
*
)
map
.
data
+
(
box
->
front
*
map
.
slice_pitch
)
+
((
box
->
top
/
view
->
format
->
block_height
)
*
map
.
row_pitch
)
...
...
dlls/wined3d/texture.c
View file @
acc0f49a
...
...
@@ -1224,7 +1224,8 @@ static void texture2d_create_dc(void *object)
wined3d_texture_get_pitch
(
texture
,
surface
->
texture_level
,
&
row_pitch
,
&
slice_pitch
);
wined3d_texture_get_memory
(
texture
,
sub_resource_idx
,
&
data
,
texture
->
resource
.
map_binding
);
desc
.
pMemory
=
context_map_bo_address
(
context
,
&
data
,
texture
->
sub_resources
[
sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
0
);
texture
->
sub_resources
[
sub_resource_idx
].
size
,
GL_PIXEL_UNPACK_BUFFER
,
WINED3D_MAP_READ
|
WINED3D_MAP_WRITE
);
if
(
context
)
context_release
(
context
);
...
...
@@ -1903,7 +1904,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
return
E_OUTOFMEMORY
;
}
if
(
!
(
flags
&
WINED3D_MAP_READONLY
)
if
(
flags
&
WINED3D_MAP_WRITE
&&
(
!
(
flags
&
WINED3D_MAP_NO_DIRTY_UPDATE
)
||
(
resource
->
usage
&
WINED3DUSAGE_DYNAMIC
)))
wined3d_texture_invalidate_location
(
texture
,
sub_resource_idx
,
~
resource
->
map_binding
);
...
...
include/wine/wined3d.h
View file @
acc0f49a
...
...
@@ -912,12 +912,13 @@ enum wined3d_shader_byte_code_format
#define WINED3DUSAGE_QUERY_WRAPANDMIP 0x00200000
#define WINED3DUSAGE_QUERY_MASK 0x003f8400
#define WINED3D_MAP_READONLY 0x0010
#define WINED3D_MAP_NOSYSLOCK 0x0800
#define WINED3D_MAP_NOOVERWRITE 0x1000
#define WINED3D_MAP_DISCARD 0x2000
#define WINED3D_MAP_DONOTWAIT 0x4000
#define WINED3D_MAP_NO_DIRTY_UPDATE 0x8000
#define WINED3D_MAP_NOSYSLOCK 0x00000800
#define WINED3D_MAP_NOOVERWRITE 0x00001000
#define WINED3D_MAP_DISCARD 0x00002000
#define WINED3D_MAP_DONOTWAIT 0x00004000
#define WINED3D_MAP_NO_DIRTY_UPDATE 0x00008000
#define WINED3D_MAP_WRITE 0x40000000
#define WINED3D_MAP_READ 0x80000000
#define WINED3DPRESENT_RATE_DEFAULT 0x00000000
...
...
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