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
ac7ca87a
Commit
ac7ca87a
authored
Aug 08, 2019
by
Henri Verbeet
Committed by
Alexandre Julliard
Aug 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Upload buffer ranges through buffer ops.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3ab6b829
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
26 deletions
+40
-26
buffer.c
dlls/wined3d/buffer.c
+33
-26
wined3d_private.h
dlls/wined3d/wined3d_private.h
+7
-0
No files found.
dlls/wined3d/buffer.c
View file @
ac7ca87a
...
...
@@ -535,25 +535,6 @@ ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer)
return
refcount
;
}
/* Context activation is done by the caller. */
static
void
wined3d_buffer_gl_upload_ranges
(
struct
wined3d_buffer_gl
*
buffer_gl
,
struct
wined3d_context
*
context
,
const
void
*
data
,
unsigned
int
data_offset
,
unsigned
int
range_count
,
const
struct
wined3d_map_range
*
ranges
)
{
struct
wined3d_context_gl
*
context_gl
=
wined3d_context_gl
(
context
);
const
struct
wined3d_gl_info
*
gl_info
=
context_gl
->
gl_info
;
const
struct
wined3d_map_range
*
range
;
wined3d_buffer_gl_bind
(
buffer_gl
,
context_gl
);
while
(
range_count
--
)
{
range
=
&
ranges
[
range_count
];
GL_EXTCALL
(
glBufferSubData
(
buffer_gl
->
buffer_type_hint
,
range
->
offset
,
range
->
size
,
(
BYTE
*
)
data
+
range
->
offset
-
data_offset
));
}
checkGLcall
(
"glBufferSubData"
);
}
static
void
buffer_conversion_upload
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
)
{
unsigned
int
i
,
j
,
range_idx
,
start
,
end
,
vertex_count
;
...
...
@@ -605,8 +586,8 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined
}
}
wined3d_buffer_gl_upload_ranges
(
wined3d_buffer_gl
(
buffer
)
,
context
,
data
,
0
,
buffer
->
modified_areas
,
buffer
->
maps
);
buffer
->
buffer_ops
->
buffer_upload_ranges
(
buffer
,
context
,
data
,
0
,
buffer
->
modified_areas
,
buffer
->
maps
);
heap_free
(
data
);
}
...
...
@@ -691,8 +672,8 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer,
case
WINED3D_LOCATION_BUFFER
:
if
(
!
buffer
->
conversion_map
)
wined3d_buffer_gl_upload_ranges
(
buffer_gl
,
context
,
buffer
->
resource
.
heap_memory
,
0
,
buffer
->
modified_areas
,
buffer
->
maps
);
buffer
->
buffer_ops
->
buffer_upload_ranges
(
buffer
,
context
,
buffer
->
resource
.
heap_memory
,
0
,
buffer
->
modified_areas
,
buffer
->
maps
);
else
buffer_conversion_upload
(
buffer
,
context
);
break
;
...
...
@@ -1250,7 +1231,7 @@ void wined3d_buffer_upload_data(struct wined3d_buffer *buffer, struct wined3d_co
range
.
size
=
buffer
->
resource
.
size
;
}
wined3d_buffer_gl_upload_ranges
(
wined3d_buffer_gl
(
buffer
)
,
context
,
data
,
range
.
offset
,
1
,
&
range
);
buffer
->
buffer_ops
->
buffer_upload_ranges
(
buffer
,
context
,
data
,
range
.
offset
,
1
,
&
range
);
}
static
void
wined3d_buffer_init_data
(
struct
wined3d_buffer
*
buffer
,
...
...
@@ -1366,7 +1347,7 @@ static GLenum buffer_type_hint_from_bind_flags(const struct wined3d_gl_info *gl_
static
HRESULT
wined3d_buffer_init
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_device
*
device
,
const
struct
wined3d_buffer_desc
*
desc
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
const
struct
wined3d_buffer_ops
*
buffer_ops
)
{
const
struct
wined3d_format
*
format
=
wined3d_get_format
(
device
->
adapter
,
WINED3DFMT_UNKNOWN
,
desc
->
bind_flags
);
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
...
...
@@ -1399,6 +1380,7 @@ static HRESULT wined3d_buffer_init(struct wined3d_buffer *buffer, struct wined3d
WARN
(
"Failed to initialize resource, hr %#x.
\n
"
,
hr
);
return
hr
;
}
buffer
->
buffer_ops
=
buffer_ops
;
buffer
->
structure_byte_stride
=
desc
->
structure_byte_stride
;
buffer
->
locations
=
data
?
WINED3D_LOCATION_DISCARDED
:
WINED3D_LOCATION_SYSMEM
;
...
...
@@ -1461,6 +1443,31 @@ static HRESULT wined3d_buffer_init(struct wined3d_buffer *buffer, struct wined3d
return
WINED3D_OK
;
}
/* Context activation is done by the caller. */
static
void
wined3d_buffer_gl_upload_ranges
(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
,
const
void
*
data
,
unsigned
int
data_offset
,
unsigned
int
range_count
,
const
struct
wined3d_map_range
*
ranges
)
{
struct
wined3d_context_gl
*
context_gl
=
wined3d_context_gl
(
context
);
struct
wined3d_buffer_gl
*
buffer_gl
=
wined3d_buffer_gl
(
buffer
);
const
struct
wined3d_gl_info
*
gl_info
=
context_gl
->
gl_info
;
const
struct
wined3d_map_range
*
range
;
wined3d_buffer_gl_bind
(
buffer_gl
,
context_gl
);
while
(
range_count
--
)
{
range
=
&
ranges
[
range_count
];
GL_EXTCALL
(
glBufferSubData
(
buffer_gl
->
buffer_type_hint
,
range
->
offset
,
range
->
size
,
(
BYTE
*
)
data
+
range
->
offset
-
data_offset
));
}
checkGLcall
(
"buffer upload"
);
}
static
const
struct
wined3d_buffer_ops
wined3d_buffer_gl_ops
=
{
wined3d_buffer_gl_upload_ranges
,
};
HRESULT
CDECL
wined3d_buffer_create
(
struct
wined3d_device
*
device
,
const
struct
wined3d_buffer_desc
*
desc
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
struct
wined3d_buffer
**
buffer
)
...
...
@@ -1480,7 +1487,7 @@ HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, const struct
object
->
buffer_type_hint
=
buffer_type_hint_from_bind_flags
(
gl_info
,
desc
->
bind_flags
);
if
(
FAILED
(
hr
=
wined3d_buffer_init
(
&
object
->
b
,
device
,
desc
,
data
,
parent
,
parent_ops
)))
if
(
FAILED
(
hr
=
wined3d_buffer_init
(
&
object
->
b
,
device
,
desc
,
data
,
parent
,
parent_ops
,
&
wined3d_buffer_gl_ops
)))
{
WARN
(
"Failed to initialize buffer, hr %#x.
\n
"
,
hr
);
heap_free
(
object
);
...
...
dlls/wined3d/wined3d_private.h
View file @
ac7ca87a
...
...
@@ -4043,9 +4043,16 @@ struct wined3d_map_range
UINT
size
;
};
struct
wined3d_buffer_ops
{
void
(
*
buffer_upload_ranges
)(
struct
wined3d_buffer
*
buffer
,
struct
wined3d_context
*
context
,
const
void
*
data
,
unsigned
int
data_offset
,
unsigned
int
range_count
,
const
struct
wined3d_map_range
*
ranges
);
};
struct
wined3d_buffer
{
struct
wined3d_resource
resource
;
const
struct
wined3d_buffer_ops
*
buffer_ops
;
unsigned
int
structure_byte_stride
;
DWORD
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