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
944e92ba
Commit
944e92ba
authored
Oct 23, 2018
by
Henri Verbeet
Committed by
Alexandre Julliard
Oct 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Pass the wined3d_buffer_desc structure directly to buffer_init().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1ae45f47
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
buffer.c
dlls/wined3d/buffer.c
+15
-15
No files found.
dlls/wined3d/buffer.c
View file @
944e92ba
...
...
@@ -1341,25 +1341,25 @@ static GLenum buffer_type_hint_from_bind_flags(const struct wined3d_gl_info *gl_
return
GL_ARRAY_BUFFER
;
}
static
HRESULT
buffer_init
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_device
*
device
,
UINT
siz
e
,
DWORD
usage
,
unsigned
int
access
,
unsigned
int
bind_flags
,
const
struct
wined3d_sub_resource_data
*
data
,
static
HRESULT
wined3d_buffer_init
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_device
*
devic
e
,
const
struct
wined3d_buffer_desc
*
desc
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
{
const
struct
wined3d_format
*
format
=
wined3d_get_format
(
device
->
adapter
,
WINED3DFMT_UNKNOWN
,
usage
);
const
struct
wined3d_format
*
format
=
wined3d_get_format
(
device
->
adapter
,
WINED3DFMT_UNKNOWN
,
desc
->
usage
);
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
struct
wined3d_resource
*
resource
=
&
buffer
->
resource
;
BOOL
dynamic_buffer_ok
;
HRESULT
hr
;
if
(
!
size
)
if
(
!
desc
->
byte_width
)
{
WARN
(
"Size 0 requested, returning E_INVALIDARG.
\n
"
);
return
E_INVALIDARG
;
}
if
(
bind_flags
&
WINED3D_BIND_CONSTANT_BUFFER
&&
size
&
(
WINED3D_CONSTANT_BUFFER_ALIGNMENT
-
1
))
if
(
desc
->
bind_flags
&
WINED3D_BIND_CONSTANT_BUFFER
&&
desc
->
byte_width
&
(
WINED3D_CONSTANT_BUFFER_ALIGNMENT
-
1
))
{
WARN
(
"Size %#x is not suitably aligned for constant buffers.
\n
"
,
size
);
WARN
(
"Size %#x is not suitably aligned for constant buffers.
\n
"
,
desc
->
byte_width
);
return
E_INVALIDARG
;
}
...
...
@@ -1369,14 +1369,16 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
return
E_INVALIDARG
;
}
if
(
FAILED
(
hr
=
resource_init
(
resource
,
device
,
WINED3D_RTYPE_BUFFER
,
format
,
WINED3D_MULTISAMPLE_NONE
,
0
,
usage
,
access
,
size
,
1
,
1
,
size
,
parent
,
parent_ops
,
&
buffer_resource_ops
)))
if
(
FAILED
(
hr
=
resource_init
(
resource
,
device
,
WINED3D_RTYPE_BUFFER
,
format
,
WINED3D_MULTISAMPLE_NONE
,
0
,
desc
->
usage
,
desc
->
access
,
desc
->
byte_width
,
1
,
1
,
desc
->
byte_width
,
parent
,
parent_ops
,
&
buffer_resource_ops
)))
{
WARN
(
"Failed to initialize resource, hr %#x.
\n
"
,
hr
);
return
hr
;
}
buffer
->
buffer_type_hint
=
buffer_type_hint_from_bind_flags
(
gl_info
,
bind_flags
);
buffer
->
bind_flags
=
bind_flags
;
buffer
->
desc
=
*
desc
;
buffer
->
buffer_type_hint
=
buffer_type_hint_from_bind_flags
(
gl_info
,
desc
->
bind_flags
);
buffer
->
bind_flags
=
desc
->
bind_flags
;
buffer
->
locations
=
data
?
WINED3D_LOCATION_DISCARDED
:
WINED3D_LOCATION_SYSMEM
;
TRACE
(
"buffer %p, size %#x, usage %#x, format %s, memory @ %p.
\n
"
,
...
...
@@ -1384,7 +1386,7 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
debug_d3dformat
(
buffer
->
resource
.
format
->
id
),
buffer
->
resource
.
heap_memory
);
if
(
device
->
create_parms
.
flags
&
WINED3DCREATE_SOFTWARE_VERTEXPROCESSING
||
wined3d_resource_access_is_managed
(
access
))
||
wined3d_resource_access_is_managed
(
desc
->
access
))
{
/* SWvp and managed buffers always return the same pointer in buffer
* maps and retain data in DISCARD maps. Keep a system memory copy of
...
...
@@ -1403,7 +1405,7 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
{
TRACE
(
"Not creating a BO because GL_ARB_vertex_buffer is not supported.
\n
"
);
}
else
if
(
!
(
access
&
WINED3D_RESOURCE_ACCESS_GPU
))
else
if
(
!
(
desc
->
access
&
WINED3D_RESOURCE_ACCESS_GPU
))
{
TRACE
(
"Not creating a BO because the buffer is not GPU accessible.
\n
"
);
}
...
...
@@ -1454,14 +1456,12 @@ HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, const struct
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
buffer_init
(
object
,
device
,
desc
->
byte_width
,
desc
->
usage
,
desc
->
access
,
desc
->
bind_flags
,
data
,
parent
,
parent_ops
)))
if
(
FAILED
(
hr
=
wined3d_buffer_init
(
object
,
device
,
desc
,
data
,
parent
,
parent_ops
)))
{
WARN
(
"Failed to initialize buffer, hr %#x.
\n
"
,
hr
);
heap_free
(
object
);
return
hr
;
}
object
->
desc
=
*
desc
;
TRACE
(
"Created buffer %p.
\n
"
,
object
);
...
...
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