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
1691a6d7
Commit
1691a6d7
authored
Mar 11, 2010
by
Stefan Dösinger
Committed by
Alexandre Julliard
Mar 16, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Use glMapBuffer for 1:1 uploads in PreLoad.
This is needed to take advantage of asynchronous uploads with double buffered buffers
parent
04752991
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
12 deletions
+54
-12
buffer.c
dlls/wined3d/buffer.c
+54
-12
No files found.
dlls/wined3d/buffer.c
View file @
1691a6d7
...
...
@@ -766,6 +766,59 @@ static DWORD STDMETHODCALLTYPE buffer_GetPriority(IWineD3DBuffer *iface)
return
resource_get_priority
((
IWineD3DResource
*
)
iface
);
}
/* The caller provides a GL context */
static
void
buffer_direct_upload
(
struct
wined3d_buffer
*
This
,
const
struct
wined3d_gl_info
*
gl_info
)
{
BYTE
*
map
;
UINT
start
=
0
,
len
=
0
;
ENTER_GL
();
GL_EXTCALL
(
glBindBufferARB
(
This
->
buffer_type_hint
,
This
->
buffer_object
));
checkGLcall
(
"glBindBufferARB"
);
if
(
gl_info
->
supported
[
ARB_MAP_BUFFER_RANGE
])
{
GLbitfield
mapflags
;
mapflags
=
GL_MAP_WRITE_BIT
|
GL_MAP_FLUSH_EXPLICIT_BIT
;
map
=
GL_EXTCALL
(
glMapBufferRange
(
This
->
buffer_type_hint
,
0
,
This
->
resource
.
size
,
mapflags
));
checkGLcall
(
"glMapBufferRange"
);
}
else
{
map
=
GL_EXTCALL
(
glMapBufferARB
(
This
->
buffer_type_hint
,
GL_WRITE_ONLY_ARB
));
checkGLcall
(
"glMapBufferARB"
);
}
if
(
!
map
)
{
LEAVE_GL
();
ERR
(
"Failed to map opengl buffer
\n
"
);
return
;
}
while
(
This
->
modified_areas
)
{
This
->
modified_areas
--
;
start
=
This
->
maps
[
This
->
modified_areas
].
offset
;
len
=
This
->
maps
[
This
->
modified_areas
].
size
;
memcpy
(
map
+
start
,
This
->
resource
.
allocatedMemory
+
start
,
len
);
if
(
gl_info
->
supported
[
ARB_MAP_BUFFER_RANGE
])
{
GL_EXTCALL
(
glFlushMappedBufferRange
(
This
->
buffer_type_hint
,
start
,
len
));
checkGLcall
(
"glFlushMappedBufferRange"
);
}
else
if
(
This
->
flags
&
WINED3D_BUFFER_FLUSH
)
{
GL_EXTCALL
(
glFlushMappedBufferRangeAPPLE
(
This
->
buffer_type_hint
,
start
,
len
));
checkGLcall
(
"glFlushMappedBufferRangeAPPLE"
);
}
}
GL_EXTCALL
(
glUnmapBufferARB
(
This
->
buffer_type_hint
));
checkGLcall
(
"glUnmapBufferARB"
);
LEAVE_GL
();
}
static
void
STDMETHODCALLTYPE
buffer_PreLoad
(
IWineD3DBuffer
*
iface
)
{
struct
wined3d_buffer
*
This
=
(
struct
wined3d_buffer
*
)
iface
;
...
...
@@ -896,18 +949,7 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
return
;
}
ENTER_GL
();
GL_EXTCALL
(
glBindBufferARB
(
This
->
buffer_type_hint
,
This
->
buffer_object
));
checkGLcall
(
"glBindBufferARB"
);
while
(
This
->
modified_areas
)
{
This
->
modified_areas
--
;
start
=
This
->
maps
[
This
->
modified_areas
].
offset
;
len
=
This
->
maps
[
This
->
modified_areas
].
size
;
GL_EXTCALL
(
glBufferSubDataARB
(
This
->
buffer_type_hint
,
start
,
len
,
This
->
resource
.
allocatedMemory
+
start
));
checkGLcall
(
"glBufferSubDataARB"
);
}
LEAVE_GL
();
buffer_direct_upload
(
This
,
context
->
gl_info
);
context_release
(
context
);
return
;
...
...
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