Commit 94c0da18 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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
...@@ -534,19 +534,12 @@ static BOOL surface_need_pbo(const struct wined3d_surface *surface, const struct ...@@ -534,19 +534,12 @@ static BOOL surface_need_pbo(const struct wined3d_surface *surface, const struct
return TRUE; 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;
TRACE("surface %p.\n", surface);
if (!(surface->flags & SFLAG_PBO) && surface_need_pbo(surface, gl_info))
{
struct wined3d_context *context; struct wined3d_context *context;
GLenum error; GLenum error;
context = context_acquire(device, NULL); context = context_acquire(surface->resource.device, NULL);
ENTER_GL(); ENTER_GL();
GL_EXTCALL(glGenBuffersARB(1, &surface->pbo)); GL_EXTCALL(glGenBuffersARB(1, &surface->pbo));
...@@ -576,7 +569,16 @@ static void surface_prepare_system_memory(struct wined3d_surface *surface) ...@@ -576,7 +569,16 @@ static void surface_prepare_system_memory(struct wined3d_surface *surface)
surface->flags |= SFLAG_PBO; surface->flags |= SFLAG_PBO;
LEAVE_GL(); LEAVE_GL();
context_release(context); context_release(context);
} }
static void surface_prepare_system_memory(struct wined3d_surface *surface)
{
const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info;
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)) else if (!(surface->resource.allocatedMemory || surface->flags & SFLAG_PBO))
{ {
/* Whatever surface we have, make sure that there is memory allocated /* 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 ...@@ -6136,6 +6138,11 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location, c
if (surface->flags & location) if (surface->flags & location)
{ {
TRACE("Location already up to date.\n"); 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; return WINED3D_OK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment