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
4ecf938d
Commit
4ecf938d
authored
Jun 02, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d11: Do not return uninitialized values on Map() failure.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
d95780ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
6 deletions
+27
-6
device.c
dlls/d3d11/device.c
+9
-6
d3d11.c
dlls/d3d11/tests/d3d11.c
+18
-0
No files found.
dlls/d3d11/device.c
View file @
4ecf938d
...
...
@@ -799,18 +799,21 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_context_Map(ID3D11DeviceContext1 *
if
(
map_flags
)
FIXME
(
"Ignoring map_flags %#x.
\n
"
,
map_flags
);
mapped_subresource
->
pData
=
NULL
;
if
(
context
->
type
!=
D3D11_DEVICE_CONTEXT_IMMEDIATE
&&
map_type
!=
D3D11_MAP_WRITE_DISCARD
&&
map_type
!=
D3D11_MAP_WRITE_NO_OVERWRITE
)
return
E_INVALIDARG
;
wined3d_resource
=
wined3d_resource_from_d3d11_resource
(
resource
);
hr
=
wined3d_device_context_map
(
context
->
wined3d_context
,
wined3d_resource
,
subresource_idx
,
&
map_desc
,
NULL
,
wined3d_map_flags_from_d3d11_map_type
(
map_type
));
mapped_subresource
->
pData
=
map_desc
.
data
;
mapped_subresource
->
RowPitch
=
map_desc
.
row_pitch
;
mapped_subresource
->
DepthPitch
=
map_desc
.
slice_pitch
;
if
(
SUCCEEDED
(
hr
=
wined3d_device_context_map
(
context
->
wined3d_context
,
wined3d_resource
,
subresource_idx
,
&
map_desc
,
NULL
,
wined3d_map_flags_from_d3d11_map_type
(
map_type
))))
{
mapped_subresource
->
pData
=
map_desc
.
data
;
mapped_subresource
->
RowPitch
=
map_desc
.
row_pitch
;
mapped_subresource
->
DepthPitch
=
map_desc
.
slice_pitch
;
}
return
hr
;
}
...
...
dlls/d3d11/tests/d3d11.c
View file @
4ecf938d
...
...
@@ -14934,8 +14934,14 @@ static void test_resource_map(void)
hr
=
ID3D11Device_CreateBuffer
(
device
,
&
buffer_desc
,
NULL
,
&
buffer
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
mapped_subresource
.
pData
=
(
void
*
)
0xdeadbeef
;
mapped_subresource
.
RowPitch
=
0xabab
;
mapped_subresource
.
DepthPitch
=
0xcdcd
;
hr
=
ID3D11DeviceContext_Map
(
context
,
(
ID3D11Resource
*
)
buffer
,
1
,
D3D11_MAP_READ
,
0
,
&
mapped_subresource
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
mapped_subresource
.
pData
,
"Unexpected pointer %p.
\n
"
,
mapped_subresource
.
pData
);
ok
(
mapped_subresource
.
RowPitch
==
0xabab
,
"Unexpected row pitch value %u.
\n
"
,
mapped_subresource
.
RowPitch
);
ok
(
mapped_subresource
.
DepthPitch
==
0xcdcd
,
"Unexpected depth pitch value %u.
\n
"
,
mapped_subresource
.
DepthPitch
);
memset
(
&
mapped_subresource
,
0
,
sizeof
(
mapped_subresource
));
hr
=
ID3D11DeviceContext_Map
(
context
,
(
ID3D11Resource
*
)
buffer
,
0
,
D3D11_MAP_WRITE
,
0
,
&
mapped_subresource
);
...
...
@@ -14972,8 +14978,14 @@ static void test_resource_map(void)
hr
=
ID3D11Device_CreateTexture2D
(
device
,
&
texture2d_desc
,
NULL
,
&
texture2d
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
mapped_subresource
.
pData
=
(
void
*
)
0xdeadbeef
;
mapped_subresource
.
RowPitch
=
0xabab
;
mapped_subresource
.
DepthPitch
=
0xcdcd
;
hr
=
ID3D11DeviceContext_Map
(
context
,
(
ID3D11Resource
*
)
texture2d
,
1
,
D3D11_MAP_READ
,
0
,
&
mapped_subresource
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
mapped_subresource
.
pData
,
"Unexpected pointer %p.
\n
"
,
mapped_subresource
.
pData
);
ok
(
mapped_subresource
.
RowPitch
==
0xabab
,
"Unexpected row pitch value %u.
\n
"
,
mapped_subresource
.
RowPitch
);
ok
(
mapped_subresource
.
DepthPitch
==
0xcdcd
,
"Unexpected depth pitch value %u.
\n
"
,
mapped_subresource
.
DepthPitch
);
memset
(
&
mapped_subresource
,
0
,
sizeof
(
mapped_subresource
));
hr
=
ID3D11DeviceContext_Map
(
context
,
(
ID3D11Resource
*
)
texture2d
,
0
,
D3D11_MAP_WRITE
,
0
,
&
mapped_subresource
);
...
...
@@ -33285,8 +33297,14 @@ static void test_deferred_context_map(void)
hr
=
ID3D11Device_CreateBuffer
(
device
,
&
buffer_desc
,
&
resource_data
,
&
buffer2
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
map_desc
.
pData
=
(
void
*
)
0xdeadbeef
;
map_desc
.
RowPitch
=
0xabab
;
map_desc
.
DepthPitch
=
0xcdcd
;
hr
=
ID3D11DeviceContext_Map
(
deferred
,
(
ID3D11Resource
*
)
buffer
,
0
,
D3D11_MAP_READ
,
0
,
&
map_desc
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
map_desc
.
pData
,
"Unexpected pointer %p.
\n
"
,
map_desc
.
pData
);
ok
(
map_desc
.
RowPitch
==
0xabab
,
"Unexpected row pitch value %u.
\n
"
,
map_desc
.
RowPitch
);
ok
(
map_desc
.
DepthPitch
==
0xcdcd
,
"Unexpected depth pitch value %u.
\n
"
,
map_desc
.
DepthPitch
);
hr
=
ID3D11DeviceContext_Map
(
deferred
,
(
ID3D11Resource
*
)
buffer
,
0
,
D3D11_MAP_READ_WRITE
,
0
,
&
map_desc
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
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