wined3d: Remove SFLAG_PBO.
This commit is contained in:
parent
035012d5aa
commit
7c052171d6
|
@ -45,7 +45,7 @@ static void surface_cleanup(struct wined3d_surface *surface)
|
|||
|
||||
TRACE("surface %p.\n", surface);
|
||||
|
||||
if ((surface->flags & SFLAG_PBO) || surface->rb_multisample
|
||||
if (surface->pbo || surface->rb_multisample
|
||||
|| surface->rb_resolved || !list_empty(&surface->renderbuffers))
|
||||
{
|
||||
struct wined3d_renderbuffer_entry *entry, *entry2;
|
||||
|
@ -55,7 +55,7 @@ static void surface_cleanup(struct wined3d_surface *surface)
|
|||
context = context_acquire(surface->resource.device, NULL);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
if (surface->flags & SFLAG_PBO)
|
||||
if (surface->pbo)
|
||||
{
|
||||
TRACE("Deleting PBO %u.\n", surface->pbo);
|
||||
GL_EXTCALL(glDeleteBuffersARB(1, &surface->pbo));
|
||||
|
@ -522,7 +522,7 @@ static void surface_get_memory(const struct wined3d_surface *surface, struct win
|
|||
}
|
||||
if (location & SFLAG_INSYSMEM)
|
||||
{
|
||||
if (surface->flags & SFLAG_PBO)
|
||||
if (surface->pbo)
|
||||
{
|
||||
data->addr = NULL;
|
||||
data->buffer_object = surface->pbo;
|
||||
|
@ -581,7 +581,6 @@ static void surface_create_pbo(struct wined3d_surface *surface, const struct win
|
|||
/* We don't need the system memory anymore and we can't even use it for PBOs. */
|
||||
if (!(surface->flags & SFLAG_CLIENT))
|
||||
wined3d_resource_free_sysmem(&surface->resource);
|
||||
surface->flags |= SFLAG_PBO;
|
||||
surface->map_binding = SFLAG_INSYSMEM;
|
||||
context_release(context);
|
||||
}
|
||||
|
@ -592,9 +591,9 @@ static void surface_prepare_system_memory(struct wined3d_surface *surface)
|
|||
|
||||
TRACE("surface %p.\n", surface);
|
||||
|
||||
if (!(surface->flags & SFLAG_PBO) && surface_need_pbo(surface, gl_info))
|
||||
if (!surface->pbo && surface_need_pbo(surface, gl_info))
|
||||
surface_create_pbo(surface, gl_info);
|
||||
else if (!(surface->resource.heap_memory || surface->flags & SFLAG_PBO))
|
||||
else if (!(surface->resource.heap_memory || surface->pbo))
|
||||
{
|
||||
/* Whatever surface we have, make sure that there is memory allocated
|
||||
* for the downloaded copy, or a PBO to map. */
|
||||
|
@ -631,7 +630,7 @@ void surface_prepare_map_memory(struct wined3d_surface *surface)
|
|||
static void surface_evict_sysmem(struct wined3d_surface *surface)
|
||||
{
|
||||
if (surface->resource.map_count || (surface->flags & SFLAG_DONOTFREE)
|
||||
|| surface->user_memory)
|
||||
|| surface->user_memory || surface->pbo)
|
||||
return;
|
||||
|
||||
wined3d_resource_free_sysmem(&surface->resource);
|
||||
|
@ -828,7 +827,7 @@ static BYTE *surface_map(struct wined3d_surface *surface, const RECT *rect, DWOR
|
|||
return surface->dib.bitmap_data;
|
||||
|
||||
case SFLAG_INSYSMEM:
|
||||
if (surface->flags & SFLAG_PBO)
|
||||
if (surface->pbo)
|
||||
{
|
||||
BYTE *ret;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
|
@ -877,7 +876,7 @@ static void surface_unmap(struct wined3d_surface *surface)
|
|||
break;
|
||||
|
||||
case SFLAG_INSYSMEM:
|
||||
if (surface->flags & SFLAG_PBO)
|
||||
if (surface->pbo)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_context *context;
|
||||
|
@ -1339,7 +1338,6 @@ static void surface_remove_pbo(struct wined3d_surface *surface, const struct win
|
|||
checkGLcall("glDeleteBuffersARB");
|
||||
|
||||
surface->pbo = 0;
|
||||
surface->flags &= ~SFLAG_PBO;
|
||||
}
|
||||
|
||||
static BOOL surface_init_sysmem(struct wined3d_surface *surface)
|
||||
|
@ -1382,7 +1380,7 @@ static void surface_unload(struct wined3d_resource *resource)
|
|||
* or the depth stencil into an FBO the texture or render buffer will be removed
|
||||
* and all flags get lost
|
||||
*/
|
||||
if (!(surface->flags & SFLAG_PBO))
|
||||
if (!surface->pbo)
|
||||
{
|
||||
surface_init_sysmem(surface);
|
||||
surface_validate_location(surface, surface->map_binding);
|
||||
|
@ -1405,7 +1403,7 @@ static void surface_unload(struct wined3d_resource *resource)
|
|||
gl_info = context->gl_info;
|
||||
|
||||
/* Destroy PBOs, but load them into real sysmem before */
|
||||
if (surface->flags & SFLAG_PBO)
|
||||
if (surface->pbo)
|
||||
surface_remove_pbo(surface, gl_info);
|
||||
|
||||
/* Destroy fbo render buffers. This is needed for implicit render targets, for
|
||||
|
@ -3274,7 +3272,8 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
|
|||
if (FAILED(hr))
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
if (!(surface->map_binding == SFLAG_INUSERMEM
|
||||
|| surface->flags & (SFLAG_PBO | SFLAG_PIN_SYSMEM)))
|
||||
|| surface->flags & SFLAG_PIN_SYSMEM
|
||||
|| surface->pbo))
|
||||
surface->map_binding = SFLAG_INDIB;
|
||||
}
|
||||
|
||||
|
@ -5106,7 +5105,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
|
|||
/* Don't use PBOs for converted surfaces. During PBO conversion we look at
|
||||
* SFLAG_CONVERTED but it isn't set (yet) in all cases it is getting
|
||||
* called. */
|
||||
if ((convert != WINED3D_CT_NONE || format.convert) && (surface->flags & SFLAG_PBO))
|
||||
if ((convert != WINED3D_CT_NONE || format.convert) && surface->pbo)
|
||||
{
|
||||
TRACE("Removing the pbo attached to surface %p.\n", surface);
|
||||
surface_remove_pbo(surface, gl_info);
|
||||
|
@ -5210,7 +5209,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location)
|
|||
{
|
||||
TRACE("Location already up to date.\n");
|
||||
|
||||
if (location == SFLAG_INSYSMEM && !(surface->flags & SFLAG_PBO)
|
||||
if (location == SFLAG_INSYSMEM && !surface->pbo
|
||||
&& surface_need_pbo(surface, gl_info))
|
||||
surface_create_pbo(surface, gl_info);
|
||||
|
||||
|
|
|
@ -2296,27 +2296,24 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) D
|
|||
#define SFLAG_DIBSECTION 0x00000400 /* Has a DIB section attached for GetDC. */
|
||||
#define SFLAG_ALLOCATED 0x00000800 /* A GL texture is allocated for this surface. */
|
||||
#define SFLAG_SRGBALLOCATED 0x00001000 /* A sRGB GL texture is allocated for this surface. */
|
||||
#define SFLAG_PBO 0x00002000 /* The surface has a PBO. */
|
||||
#define SFLAG_INSYSMEM 0x00004000 /* The system memory copy is current. */
|
||||
#define SFLAG_INUSERMEM 0x00008000 /* The user memory copy is current. */
|
||||
#define SFLAG_INDIB 0x00010000 /* The DIB copy is current. */
|
||||
#define SFLAG_INTEXTURE 0x00020000 /* The GL texture is current. */
|
||||
#define SFLAG_INSRGBTEX 0x00040000 /* The GL sRGB texture is current. */
|
||||
#define SFLAG_INDRAWABLE 0x00080000 /* The GL drawable is current. */
|
||||
#define SFLAG_INRB_MULTISAMPLE 0x00100000 /* The multisample renderbuffer is current. */
|
||||
#define SFLAG_INRB_RESOLVED 0x00200000 /* The resolved renderbuffer is current. */
|
||||
#define SFLAG_DISCARDED 0x00400000 /* Surface was discarded, allocating new location is enough. */
|
||||
#define SFLAG_INSYSMEM 0x00002000 /* The system memory copy is current. */
|
||||
#define SFLAG_INUSERMEM 0x00004000 /* The user memory copy is current. */
|
||||
#define SFLAG_INDIB 0x00008000 /* The DIB copy is current. */
|
||||
#define SFLAG_INTEXTURE 0x00010000 /* The GL texture is current. */
|
||||
#define SFLAG_INSRGBTEX 0x00020000 /* The GL sRGB texture is current. */
|
||||
#define SFLAG_INDRAWABLE 0x00040000 /* The GL drawable is current. */
|
||||
#define SFLAG_INRB_MULTISAMPLE 0x00080000 /* The multisample renderbuffer is current. */
|
||||
#define SFLAG_INRB_RESOLVED 0x00100000 /* The resolved renderbuffer is current. */
|
||||
#define SFLAG_DISCARDED 0x00200000 /* Surface was discarded, allocating new location is enough. */
|
||||
|
||||
/* In some conditions the surface memory must not be freed:
|
||||
* SFLAG_CONVERTED: Converting the data back would take too long
|
||||
* SFLAG_DYNLOCK: Avoid freeing the data for performance
|
||||
* SFLAG_PBO: PBOs don't use 'normal' memory. It is either allocated by the driver or must be NULL.
|
||||
* SFLAG_CLIENT: OpenGL uses our memory as backup
|
||||
*/
|
||||
#define SFLAG_DONOTFREE (SFLAG_CONVERTED | \
|
||||
SFLAG_DYNLOCK | \
|
||||
SFLAG_CLIENT | \
|
||||
SFLAG_PBO | \
|
||||
SFLAG_PIN_SYSMEM)
|
||||
|
||||
#define SFLAG_LOCATIONS (SFLAG_INSYSMEM | \
|
||||
|
|
Loading…
Reference in New Issue