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
8232f371
Commit
8232f371
authored
Sep 01, 2016
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Sanitise resource map flags in wined3d_resource_map().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
66e54fd6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
37 deletions
+35
-37
buffer.c
dlls/wined3d/buffer.c
+0
-1
resource.c
dlls/wined3d/resource.c
+35
-33
texture.c
dlls/wined3d/texture.c
+0
-2
wined3d_private.h
dlls/wined3d/wined3d_private.h
+0
-1
No files found.
dlls/wined3d/buffer.c
View file @
8232f371
...
@@ -942,7 +942,6 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
...
@@ -942,7 +942,6 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
TRACE
(
"buffer %p, offset %u, size %u, data %p, flags %#x.
\n
"
,
buffer
,
offset
,
size
,
data
,
flags
);
TRACE
(
"buffer %p, offset %u, size %u, data %p, flags %#x.
\n
"
,
buffer
,
offset
,
size
,
data
,
flags
);
flags
=
wined3d_resource_sanitize_map_flags
(
&
buffer
->
resource
,
flags
);
/* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001 multitexture
/* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001 multitexture
* fill rate test seems to depend on this. When we map a buffer with
* fill rate test seems to depend on this. When we map a buffer with
* GL_MAP_INVALIDATE_BUFFER_BIT, the driver is free to discard the
* GL_MAP_INVALIDATE_BUFFER_BIT, the driver is free to discard the
...
...
dlls/wined3d/resource.c
View file @
8232f371
...
@@ -311,12 +311,47 @@ void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, st
...
@@ -311,12 +311,47 @@ void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, st
desc
->
size
=
resource
->
size
;
desc
->
size
=
resource
->
size
;
}
}
static
DWORD
wined3d_resource_sanitise_map_flags
(
const
struct
wined3d_resource
*
resource
,
DWORD
flags
)
{
/* Not all flags make sense together, but Windows never returns an error.
* Catch the cases that could cause issues. */
if
(
flags
&
WINED3D_MAP_READONLY
)
{
if
(
flags
&
WINED3D_MAP_DISCARD
)
{
WARN
(
"WINED3D_MAP_READONLY combined with WINED3D_MAP_DISCARD, ignoring flags.
\n
"
);
return
0
;
}
if
(
flags
&
WINED3D_MAP_NOOVERWRITE
)
{
WARN
(
"WINED3D_MAP_READONLY combined with WINED3D_MAP_NOOVERWRITE, ignoring flags.
\n
"
);
return
0
;
}
}
else
if
((
flags
&
(
WINED3D_MAP_DISCARD
|
WINED3D_MAP_NOOVERWRITE
))
==
(
WINED3D_MAP_DISCARD
|
WINED3D_MAP_NOOVERWRITE
))
{
WARN
(
"WINED3D_MAP_DISCARD and WINED3D_MAP_NOOVERWRITE used together, ignoring.
\n
"
);
return
0
;
}
else
if
(
flags
&
(
WINED3D_MAP_DISCARD
|
WINED3D_MAP_NOOVERWRITE
)
&&
!
(
resource
->
usage
&
WINED3DUSAGE_DYNAMIC
))
{
WARN
(
"DISCARD or NOOVERWRITE map on non-dynamic buffer, ignoring.
\n
"
);
return
0
;
}
return
flags
;
}
HRESULT
CDECL
wined3d_resource_map
(
struct
wined3d_resource
*
resource
,
unsigned
int
sub_resource_idx
,
HRESULT
CDECL
wined3d_resource_map
(
struct
wined3d_resource
*
resource
,
unsigned
int
sub_resource_idx
,
struct
wined3d_map_desc
*
map_desc
,
const
struct
wined3d_box
*
box
,
DWORD
flags
)
struct
wined3d_map_desc
*
map_desc
,
const
struct
wined3d_box
*
box
,
DWORD
flags
)
{
{
TRACE
(
"resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.
\n
"
,
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
);
resource
,
sub_resource_idx
,
map_desc
,
debug_box
(
box
),
flags
);
flags
=
wined3d_resource_sanitise_map_flags
(
resource
,
flags
);
return
wined3d_cs_map
(
resource
->
device
->
cs
,
resource
,
sub_resource_idx
,
map_desc
,
box
,
flags
);
return
wined3d_cs_map
(
resource
->
device
->
cs
,
resource
,
sub_resource_idx
,
map_desc
,
box
,
flags
);
}
}
...
@@ -360,39 +395,6 @@ void wined3d_resource_free_sysmem(struct wined3d_resource *resource)
...
@@ -360,39 +395,6 @@ void wined3d_resource_free_sysmem(struct wined3d_resource *resource)
resource
->
heap_memory
=
NULL
;
resource
->
heap_memory
=
NULL
;
}
}
DWORD
wined3d_resource_sanitize_map_flags
(
const
struct
wined3d_resource
*
resource
,
DWORD
flags
)
{
/* Not all flags make sense together, but Windows never returns an error.
* Catch the cases that could cause issues. */
if
(
flags
&
WINED3D_MAP_READONLY
)
{
if
(
flags
&
WINED3D_MAP_DISCARD
)
{
WARN
(
"WINED3D_MAP_READONLY combined with WINED3D_MAP_DISCARD, ignoring flags.
\n
"
);
return
0
;
}
if
(
flags
&
WINED3D_MAP_NOOVERWRITE
)
{
WARN
(
"WINED3D_MAP_READONLY combined with WINED3D_MAP_NOOVERWRITE, ignoring flags.
\n
"
);
return
0
;
}
}
else
if
((
flags
&
(
WINED3D_MAP_DISCARD
|
WINED3D_MAP_NOOVERWRITE
))
==
(
WINED3D_MAP_DISCARD
|
WINED3D_MAP_NOOVERWRITE
))
{
WARN
(
"WINED3D_MAP_DISCARD and WINED3D_MAP_NOOVERWRITE used together, ignoring.
\n
"
);
return
0
;
}
else
if
(
flags
&
(
WINED3D_MAP_DISCARD
|
WINED3D_MAP_NOOVERWRITE
)
&&
!
(
resource
->
usage
&
WINED3DUSAGE_DYNAMIC
))
{
WARN
(
"DISCARD or NOOVERWRITE map on non-dynamic buffer, ignoring.
\n
"
);
return
0
;
}
return
flags
;
}
GLbitfield
wined3d_resource_gl_map_flags
(
DWORD
d3d_flags
)
GLbitfield
wined3d_resource_gl_map_flags
(
DWORD
d3d_flags
)
{
{
GLbitfield
ret
=
0
;
GLbitfield
ret
=
0
;
...
...
dlls/wined3d/texture.c
View file @
8232f371
...
@@ -1700,8 +1700,6 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
...
@@ -1700,8 +1700,6 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
return
WINED3DERR_INVALIDCALL
;
return
WINED3DERR_INVALIDCALL
;
}
}
flags
=
wined3d_resource_sanitize_map_flags
(
resource
,
flags
);
if
(
device
->
d3d_initialized
)
if
(
device
->
d3d_initialized
)
{
{
context
=
context_acquire
(
device
,
NULL
);
context
=
context_acquire
(
device
,
NULL
);
...
...
dlls/wined3d/wined3d_private.h
View file @
8232f371
...
@@ -2605,7 +2605,6 @@ void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HI
...
@@ -2605,7 +2605,6 @@ void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HI
GLbitfield
wined3d_resource_gl_map_flags
(
DWORD
d3d_flags
)
DECLSPEC_HIDDEN
;
GLbitfield
wined3d_resource_gl_map_flags
(
DWORD
d3d_flags
)
DECLSPEC_HIDDEN
;
GLenum
wined3d_resource_gl_legacy_map_flags
(
DWORD
d3d_flags
)
DECLSPEC_HIDDEN
;
GLenum
wined3d_resource_gl_legacy_map_flags
(
DWORD
d3d_flags
)
DECLSPEC_HIDDEN
;
BOOL
wined3d_resource_is_offscreen
(
struct
wined3d_resource
*
resource
)
DECLSPEC_HIDDEN
;
BOOL
wined3d_resource_is_offscreen
(
struct
wined3d_resource
*
resource
)
DECLSPEC_HIDDEN
;
DWORD
wined3d_resource_sanitize_map_flags
(
const
struct
wined3d_resource
*
resource
,
DWORD
flags
)
DECLSPEC_HIDDEN
;
void
wined3d_resource_update_draw_binding
(
struct
wined3d_resource
*
resource
)
DECLSPEC_HIDDEN
;
void
wined3d_resource_update_draw_binding
(
struct
wined3d_resource
*
resource
)
DECLSPEC_HIDDEN
;
/* Tests show that the start address of resources is 32 byte aligned */
/* Tests show that the start address of resources is 32 byte aligned */
...
...
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