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
94c0da18
Commit
94c0da18
authored
Dec 01, 2011
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 01, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Create a PBO in surface_load_location() even if SFLAG_INSYSMEM is already set.
In the longer term, sysmem and pbo should be separate resource locations.
parent
39ebb992
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
33 deletions
+40
-33
surface.c
dlls/wined3d/surface.c
+40
-33
No files found.
dlls/wined3d/surface.c
View file @
94c0da18
...
...
@@ -534,49 +534,51 @@ static BOOL surface_need_pbo(const struct wined3d_surface *surface, const struct
return
TRUE
;
}
static
void
surface_
prepare_system_memory
(
struct
wined3d_surface
*
surface
)
static
void
surface_
load_pbo
(
struct
wined3d_surface
*
surface
,
const
struct
wined3d_gl_info
*
gl_info
)
{
struct
wined3d_
device
*
device
=
surface
->
resource
.
device
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
struct
wined3d_
context
*
context
;
GLenum
error
;
TRACE
(
"surface %p.
\n
"
,
surface
);
context
=
context_acquire
(
surface
->
resource
.
device
,
NULL
);
ENTER_GL
();
if
(
!
(
surface
->
flags
&
SFLAG_PBO
)
&&
surface_need_pbo
(
surface
,
gl_info
))
{
struct
wined3d_context
*
context
;
GLenum
error
;
GL_EXTCALL
(
glGenBuffersARB
(
1
,
&
surface
->
pbo
));
error
=
glGetError
();
if
(
!
surface
->
pbo
||
error
!=
GL_NO_ERROR
)
ERR
(
"Failed to create a PBO with error %s (%#x).
\n
"
,
debug_glerror
(
error
),
error
)
;
context
=
context_acquire
(
device
,
NULL
);
ENTER_GL
();
TRACE
(
"Binding PBO %u.
\n
"
,
surface
->
pbo
);
GL_EXTCALL
(
glGenBuffersARB
(
1
,
&
surface
->
pbo
));
error
=
glGetError
();
if
(
!
surface
->
pbo
||
error
!=
GL_NO_ERROR
)
ERR
(
"Failed to create a PBO with error %s (%#x).
\n
"
,
debug_glerror
(
error
),
error
);
GL_EXTCALL
(
glBindBufferARB
(
GL_PIXEL_UNPACK_BUFFER_ARB
,
surface
->
pbo
));
checkGLcall
(
"glBindBufferARB"
);
TRACE
(
"Binding PBO %u.
\n
"
,
surface
->
pbo
);
GL_EXTCALL
(
glBufferDataARB
(
GL_PIXEL_UNPACK_BUFFER_ARB
,
surface
->
resource
.
size
+
4
,
surface
->
resource
.
allocatedMemory
,
GL_STREAM_DRAW_ARB
));
checkGLcall
(
"glBufferDataARB"
);
GL_EXTCALL
(
glBindBufferARB
(
GL_PIXEL_UNPACK_BUFFER_ARB
,
surface
->
pbo
));
checkGLcall
(
"glBindBufferARB"
);
GL_EXTCALL
(
glBindBufferARB
(
GL_PIXEL_UNPACK_BUFFER_ARB
,
0
));
checkGLcall
(
"glBindBufferARB"
);
GL_EXTCALL
(
glBufferDataARB
(
GL_PIXEL_UNPACK_BUFFER_ARB
,
surface
->
resource
.
size
+
4
,
surface
->
resource
.
allocatedMemory
,
GL_STREAM_DRAW_ARB
));
checkGLcall
(
"glBufferDataARB"
);
/* We don't need the system memory anymore and we can't even use it for PBOs. */
if
(
!
(
surface
->
flags
&
SFLAG_CLIENT
))
{
HeapFree
(
GetProcessHeap
(),
0
,
surface
->
resource
.
heapMemory
);
surface
->
resource
.
heapMemory
=
NULL
;
}
surface
->
resource
.
allocatedMemory
=
NULL
;
surface
->
flags
|=
SFLAG_PBO
;
LEAVE_GL
();
context_release
(
context
);
}
GL_EXTCALL
(
glBindBufferARB
(
GL_PIXEL_UNPACK_BUFFER_ARB
,
0
));
checkGLcall
(
"glBindBufferARB"
);
static
void
surface_prepare_system_memory
(
struct
wined3d_surface
*
surface
)
{
const
struct
wined3d_gl_info
*
gl_info
=
&
surface
->
resource
.
device
->
adapter
->
gl_info
;
/* We don't need the system memory anymore and we can't even use it for PBOs. */
if
(
!
(
surface
->
flags
&
SFLAG_CLIENT
))
{
HeapFree
(
GetProcessHeap
(),
0
,
surface
->
resource
.
heapMemory
);
surface
->
resource
.
heapMemory
=
NULL
;
}
surface
->
resource
.
allocatedMemory
=
NULL
;
surface
->
flags
|=
SFLAG_PBO
;
LEAVE_GL
();
context_release
(
context
);
}
TRACE
(
"surface %p.
\n
"
,
surface
);
if
(
!
(
surface
->
flags
&
SFLAG_PBO
)
&&
surface_need_pbo
(
surface
,
gl_info
))
surface_load_pbo
(
surface
,
gl_info
);
else
if
(
!
(
surface
->
resource
.
allocatedMemory
||
surface
->
flags
&
SFLAG_PBO
))
{
/* Whatever surface we have, make sure that there is memory allocated
...
...
@@ -6136,6 +6138,11 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location, c
if
(
surface
->
flags
&
location
)
{
TRACE
(
"Location already up to date.
\n
"
);
if
(
location
==
SFLAG_INSYSMEM
&&
!
(
surface
->
flags
&
SFLAG_PBO
)
&&
surface_need_pbo
(
surface
,
gl_info
))
surface_load_pbo
(
surface
,
gl_info
);
return
WINED3D_OK
;
}
...
...
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