wined3d: Add multisampling support.

This commit is contained in:
Henri Verbeet 2011-08-25 21:05:03 +02:00 committed by Alexandre Julliard
parent bd5f948682
commit 641f52ef96
7 changed files with 234 additions and 56 deletions

View File

@ -169,6 +169,18 @@ static void context_attach_depth_stencil_fbo(struct wined3d_context *context,
}
break;
case SFLAG_INRB_MULTISAMPLE:
surface_prepare_rb(depth_stencil, gl_info, TRUE);
context_attach_depth_stencil_rb(gl_info, fbo_target,
format_flags, depth_stencil->rb_multisample);
break;
case SFLAG_INRB_RESOLVED:
surface_prepare_rb(depth_stencil, gl_info, FALSE);
context_attach_depth_stencil_rb(gl_info, fbo_target,
format_flags, depth_stencil->rb_resolved);
break;
default:
ERR("Unsupported location %s (%#x).\n", debug_surflocation(location), location);
break;
@ -218,13 +230,27 @@ static void context_attach_surface_fbo(struct wined3d_context *context,
gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_COLOR_ATTACHMENT0 + idx,
surface->texture_target, surface_get_texture_name(surface, gl_info, srgb),
surface->texture_level);
checkGLcall("glFramebufferTexture2D()");
break;
case SFLAG_INRB_MULTISAMPLE:
surface_prepare_rb(surface, gl_info, TRUE);
gl_info->fbo_ops.glFramebufferRenderbuffer(fbo_target, GL_COLOR_ATTACHMENT0 + idx,
GL_RENDERBUFFER, surface->rb_multisample);
checkGLcall("glFramebufferRenderbuffer()");
break;
case SFLAG_INRB_RESOLVED:
surface_prepare_rb(surface, gl_info, FALSE);
gl_info->fbo_ops.glFramebufferRenderbuffer(fbo_target, GL_COLOR_ATTACHMENT0 + idx,
GL_RENDERBUFFER, surface->rb_resolved);
checkGLcall("glFramebufferRenderbuffer()");
break;
default:
ERR("Unsupported location %s (%#x).\n", debug_surflocation(location), location);
break;
}
checkGLcall("glFramebufferTexture2D()");
}
else
{
@ -2049,7 +2075,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_d
context->blit_targets[i] = NULL;
++i;
}
context_apply_fbo_state(context, GL_FRAMEBUFFER, context->blit_targets, fb->depth_stencil, SFLAG_INTEXTURE);
context_apply_fbo_state(context, GL_FRAMEBUFFER, context->blit_targets, fb->depth_stencil,
rt_count ? rts[0]->draw_binding : SFLAG_INTEXTURE);
glReadBuffer(GL_NONE);
checkGLcall("glReadBuffer");
}
@ -2163,7 +2190,8 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat
}
else
{
context_apply_fbo_state(context, GL_FRAMEBUFFER, fb->render_targets, fb->depth_stencil, SFLAG_INTEXTURE);
context_apply_fbo_state(context, GL_FRAMEBUFFER, fb->render_targets, fb->depth_stencil,
fb->render_targets[0]->draw_binding);
glReadBuffer(GL_NONE);
checkGLcall("glReadBuffer");
}

View File

@ -5452,6 +5452,9 @@ static HRESULT updateSurfaceDesc(struct wined3d_surface *surface,
while (surface->pow2Height < pPresentationParameters->BackBufferHeight) surface->pow2Height <<= 1;
}
surface->resource.multisample_type = pPresentationParameters->MultiSampleType;
surface->resource.multisample_quality = pPresentationParameters->MultiSampleQuality;
surface->resource.resource_ops->resource_unload(&surface->resource);
if (surface->pow2Width != pPresentationParameters->BackBufferWidth
@ -5627,6 +5630,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
struct wined3d_resource *resource, *cursor;
struct wined3d_swapchain *swapchain;
BOOL DisplayModeChanged = FALSE;
BOOL update_desc = FALSE;
WINED3DDISPLAYMODE mode;
unsigned int i;
HRESULT hr;
@ -5771,15 +5775,27 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
&& (present_parameters->BackBufferWidth != swapchain->presentParms.BackBufferWidth
|| present_parameters->BackBufferHeight != swapchain->presentParms.BackBufferHeight))
{
UINT i;
if (!present_parameters->Windowed)
DisplayModeChanged = TRUE;
swapchain->presentParms.BackBufferWidth = present_parameters->BackBufferWidth;
swapchain->presentParms.BackBufferHeight = present_parameters->BackBufferHeight;
update_desc = TRUE;
}
hr = updateSurfaceDesc(swapchain->front_buffer, present_parameters);
if (present_parameters->MultiSampleType != swapchain->presentParms.MultiSampleType
|| present_parameters->MultiSampleQuality != swapchain->presentParms.MultiSampleQuality)
{
swapchain->presentParms.MultiSampleType = present_parameters->MultiSampleType;
swapchain->presentParms.MultiSampleQuality = present_parameters->MultiSampleQuality;
update_desc = TRUE;
}
if (update_desc)
{
UINT i;
hr = updateSurfaceDesc(swapchain->front_buffer, &swapchain->presentParms);
if (FAILED(hr))
{
wined3d_swapchain_decref(swapchain);
@ -5788,7 +5804,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
for (i = 0; i < swapchain->presentParms.BackBufferCount; ++i)
{
hr = updateSurfaceDesc(swapchain->back_buffers[i], present_parameters);
hr = updateSurfaceDesc(swapchain->back_buffers[i], &swapchain->presentParms);
if (FAILED(hr))
{
wined3d_swapchain_decref(swapchain);
@ -5797,7 +5813,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
}
if (device->auto_depth_stencil)
{
hr = updateSurfaceDesc(device->auto_depth_stencil, present_parameters);
hr = updateSurfaceDesc(device->auto_depth_stencil, &swapchain->presentParms);
if (FAILED(hr))
{
wined3d_swapchain_decref(swapchain);

View File

@ -4,7 +4,7 @@
* Copyright 2004 Christian Costa
* Copyright 2005 Oliver Stieber
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers
* Copyright 2009-2010 Henri Verbeet for CodeWeavers
* Copyright 2009-2011 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -2631,6 +2631,11 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
gl_info->fbo_ops.glGetFramebufferAttachmentParameteriv = gl_info->glGetFramebufferAttachmentParameteriv;
gl_info->fbo_ops.glBlitFramebuffer = gl_info->glBlitFramebuffer;
gl_info->fbo_ops.glGenerateMipmap = gl_info->glGenerateMipmap;
if (wined3d_settings.allow_multisampling)
{
glGetIntegerv(GL_MAX_SAMPLES, &gl_max);
gl_info->limits.samples = gl_max;
}
}
else
{
@ -2666,6 +2671,11 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
if (gl_info->supported[EXT_FRAMEBUFFER_MULTISAMPLE])
{
gl_info->fbo_ops.glRenderbufferStorageMultisample = gl_info->glRenderbufferStorageMultisampleEXT;
if (wined3d_settings.allow_multisampling)
{
glGetIntegerv(GL_MAX_SAMPLES, &gl_max);
gl_info->limits.samples = gl_max;
}
}
}
@ -3127,6 +3137,8 @@ HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3
WINED3DDEVTYPE device_type, enum wined3d_format_id surface_format_id, BOOL windowed,
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD *quality_levels)
{
const struct wined3d_gl_info *gl_info;
TRACE_(d3d_caps)("wined3d %p, adapter_idx %u, device_type %s, surface_format %s,\n"
"windowed %#x, multisample_type %#x, quality_levels %p.\n",
wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(surface_format_id),
@ -3135,13 +3147,27 @@ HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3
if (adapter_idx >= wined3d->adapter_count)
return WINED3DERR_INVALIDCALL;
if (WINED3DMULTISAMPLE_NONE == multisample_type)
gl_info = &wined3d->adapters[adapter_idx].gl_info;
if (multisample_type > gl_info->limits.samples)
{
if (quality_levels) *quality_levels = 1;
return WINED3D_OK;
TRACE("Returning not supported.\n");
if (quality_levels)
*quality_levels = 0;
return WINED3DERR_NOTAVAILABLE;
}
return WINED3DERR_NOTAVAILABLE;
if (quality_levels)
{
if (multisample_type == WINED3DMULTISAMPLE_NONMASKABLE)
/* FIXME: This is probably wrong. */
*quality_levels = gl_info->limits.samples;
else
*quality_levels = 1;
}
return WINED3D_OK;
}
/* Check if we support bumpmapping for a format */

View File

@ -44,7 +44,9 @@ static void surface_cleanup(struct wined3d_surface *surface)
{
TRACE("surface %p.\n", surface);
if (surface->texture_name || (surface->flags & SFLAG_PBO) || !list_empty(&surface->renderbuffers))
if (surface->texture_name || (surface->flags & SFLAG_PBO)
|| surface->rb_multisample || surface->rb_resolved
|| !list_empty(&surface->renderbuffers))
{
struct wined3d_renderbuffer_entry *entry, *entry2;
const struct wined3d_gl_info *gl_info;
@ -67,6 +69,18 @@ static void surface_cleanup(struct wined3d_surface *surface)
GL_EXTCALL(glDeleteBuffersARB(1, &surface->pbo));
}
if (surface->rb_multisample)
{
TRACE("Deleting multisample renderbuffer %u.\n", surface->rb_multisample);
gl_info->fbo_ops.glDeleteRenderbuffers(1, &surface->rb_multisample);
}
if (surface->rb_resolved)
{
TRACE("Deleting resolved renderbuffer %u.\n", surface->rb_resolved);
gl_info->fbo_ops.glDeleteRenderbuffers(1, &surface->rb_resolved);
}
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &surface->renderbuffers, struct wined3d_renderbuffer_entry, entry)
{
TRACE("Deleting renderbuffer %u.\n", entry->id);
@ -104,6 +118,8 @@ void surface_update_draw_binding(struct wined3d_surface *surface)
{
if (!surface_is_offscreen(surface) || wined3d_settings.offscreen_rendering_mode != ORM_FBO)
surface->draw_binding = SFLAG_INDRAWABLE;
else if (surface->resource.multisample_type)
surface->draw_binding = SFLAG_INRB_MULTISAMPLE;
else
surface->draw_binding = SFLAG_INTEXTURE;
}
@ -1207,6 +1223,13 @@ static void surface_blt_fbo(struct wined3d_device *device, const WINED3DTEXTUREF
break;
}
/* Resolve the source surface first if needed. */
if (src_location == SFLAG_INRB_MULTISAMPLE
&& (src_surface->resource.format->id != dst_surface->resource.format->id
|| abs(src_rect.bottom - src_rect.top) != abs(dst_rect.bottom - dst_rect.top)
|| abs(src_rect.right - src_rect.left) != abs(dst_rect.right - dst_rect.left)))
src_location = SFLAG_INRB_RESOLVED;
/* Make sure the locations are up-to-date. Loading the destination
* surface isn't required if the entire surface is overwritten. (And is
* in fact harmful if we're being called by surface_load_location() with
@ -1881,17 +1904,29 @@ static void surface_unload(struct wined3d_resource *resource)
list_init(&surface->renderbuffers);
surface->current_renderbuffer = NULL;
ENTER_GL();
/* If we're in a texture, the texture name belongs to the texture.
* Otherwise, destroy it. */
if (surface->container.type != WINED3D_CONTAINER_TEXTURE)
{
ENTER_GL();
glDeleteTextures(1, &surface->texture_name);
surface->texture_name = 0;
glDeleteTextures(1, &surface->texture_name_srgb);
surface->texture_name_srgb = 0;
LEAVE_GL();
}
if (surface->rb_multisample)
{
gl_info->fbo_ops.glDeleteRenderbuffers(1, &surface->rb_multisample);
surface->rb_multisample = 0;
}
if (surface->rb_resolved)
{
gl_info->fbo_ops.glDeleteRenderbuffers(1, &surface->rb_resolved);
surface->rb_resolved = 0;
}
LEAVE_GL();
context_release(context);
@ -4250,6 +4285,32 @@ void surface_prepare_texture(struct wined3d_surface *surface, struct wined3d_con
surface_prepare_texture_internal(surface, context, srgb);
}
void surface_prepare_rb(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL multisample)
{
if (multisample)
{
if (surface->rb_multisample)
return;
gl_info->fbo_ops.glGenRenderbuffers(1, &surface->rb_multisample);
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, surface->rb_multisample);
gl_info->fbo_ops.glRenderbufferStorageMultisample(GL_RENDERBUFFER, surface->resource.multisample_type,
surface->resource.format->glInternal, surface->pow2Width, surface->pow2Height);
TRACE("Created multisample rb %u.\n", surface->rb_multisample);
}
else
{
if (surface->rb_resolved)
return;
gl_info->fbo_ops.glGenRenderbuffers(1, &surface->rb_resolved);
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, surface->rb_resolved);
gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, surface->resource.format->glInternal,
surface->pow2Width, surface->pow2Height);
TRACE("Created resolved rb %u.\n", surface->rb_resolved);
}
}
static void flush_to_framebuffer_drawpixels(struct wined3d_surface *surface,
const RECT *rect, GLenum fmt, GLenum type, UINT bpp, const BYTE *mem)
{
@ -4759,6 +4820,14 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back)
back->texture_name_srgb = front->texture_name_srgb;
front->texture_name_srgb = tmp;
tmp = back->rb_multisample;
back->rb_multisample = front->rb_multisample;
front->rb_multisample = tmp;
tmp = back->rb_resolved;
back->rb_resolved = front->rb_resolved;
front->rb_resolved = tmp;
resource_unload(&back->resource);
resource_unload(&front->resource);
}
@ -5848,6 +5917,8 @@ static DWORD resource_access_from_location(DWORD location)
case SFLAG_INDRAWABLE:
case SFLAG_INSRGBTEX:
case SFLAG_INTEXTURE:
case SFLAG_INRB_MULTISAMPLE:
case SFLAG_INRB_RESOLVED:
return WINED3D_RESOURCE_ACCESS_GPU;
default:
@ -6126,6 +6197,17 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
return WINED3D_OK;
}
static void surface_multisample_resolve(struct wined3d_surface *surface)
{
RECT rect = {0, 0, surface->resource.width, surface->resource.height};
if (!(surface->flags & SFLAG_INRB_MULTISAMPLE))
ERR("Trying to resolve multisampled surface %p, but location SFLAG_INRB_MULTISAMPLE not current.\n", surface);
surface_blt_fbo(surface->resource.device, WINED3DTEXF_POINT,
surface, SFLAG_INRB_MULTISAMPLE, &rect, surface, SFLAG_INRB_RESOLVED, &rect);
}
HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location, const RECT *rect)
{
struct wined3d_device *device = surface->resource.device;
@ -6185,6 +6267,10 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location, c
return hr;
break;
case SFLAG_INRB_RESOLVED:
surface_multisample_resolve(surface);
break;
case SFLAG_INTEXTURE:
case SFLAG_INSRGBTEX:
if (FAILED(hr = surface_load_texture(surface, gl_info, rect, location == SFLAG_INSRGBTEX)))

View File

@ -301,8 +301,16 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
if (gl_info->fbo_ops.glBlitFramebuffer && is_identity_fixup(backbuffer->resource.format->color_fixup))
{
DWORD location = SFLAG_INTEXTURE;
if (backbuffer->resource.multisample_type)
{
location = SFLAG_INRB_RESOLVED;
surface_load_location(backbuffer, location, NULL);
}
ENTER_GL();
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, backbuffer, NULL, SFLAG_INTEXTURE);
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, backbuffer, NULL, location);
glReadBuffer(GL_COLOR_ATTACHMENT0);
context_check_fbo_status(context, GL_READ_FRAMEBUFFER);
@ -824,8 +832,11 @@ void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain)
swapchain->presentParms.BackBufferWidth,
swapchain->presentParms.BackBufferHeight,
client_rect.right, client_rect.bottom);
TRACE("Multisample type %#x, quality %#x.\n",
swapchain->presentParms.MultiSampleType,
swapchain->presentParms.MultiSampleQuality);
if (!wined3d_settings.always_offscreen
if (!wined3d_settings.always_offscreen && !swapchain->presentParms.MultiSampleType
&& swapchain->presentParms.BackBufferWidth == client_rect.right
&& swapchain->presentParms.BackBufferHeight == client_rect.bottom)
{

View File

@ -2382,10 +2382,12 @@ const char *debug_surflocation(DWORD flag) {
char buf[128];
buf[0] = 0;
if(flag & SFLAG_INSYSMEM) strcat(buf, " | SFLAG_INSYSMEM");
if(flag & SFLAG_INDRAWABLE) strcat(buf, " | SFLAG_INDRAWABLE");
if(flag & SFLAG_INTEXTURE) strcat(buf, " | SFLAG_INTEXTURE");
if(flag & SFLAG_INSRGBTEX) strcat(buf, " | SFLAG_INSRGBTEX");
if (flag & SFLAG_INSYSMEM) strcat(buf, " | SFLAG_INSYSMEM"); /* 17 */
if (flag & SFLAG_INDRAWABLE) strcat(buf, " | SFLAG_INDRAWABLE"); /* 19 */
if (flag & SFLAG_INTEXTURE) strcat(buf, " | SFLAG_INTEXTURE"); /* 18 */
if (flag & SFLAG_INSRGBTEX) strcat(buf, " | SFLAG_INSRGBTEX"); /* 18 */
if (flag & SFLAG_INRB_MULTISAMPLE) strcat(buf, " | SFLAG_INRB_MULTISAMPLE"); /* 25 */
if (flag & SFLAG_INRB_RESOLVED) strcat(buf, " | SFLAG_INRB_RESOLVED"); /* 22 */
return wine_dbg_sprintf("%s", buf[0] ? buf + 3 : "0");
}

View File

@ -1453,6 +1453,7 @@ struct wined3d_gl_limits
UINT blends;
UINT anisotropy;
float shininess;
UINT samples;
UINT glsl_varyings;
UINT glsl_vs_float_constants;
@ -2012,6 +2013,8 @@ struct wined3d_surface
/* PBO */
GLuint pbo;
GLuint rb_multisample;
GLuint rb_resolved;
GLuint texture_name;
GLuint texture_name_srgb;
GLint texture_level;
@ -2075,6 +2078,8 @@ void surface_load_ds_location(struct wined3d_surface *surface,
HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location, const RECT *rect) DECLSPEC_HIDDEN;
void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN;
void surface_modify_location(struct wined3d_surface *surface, DWORD location, BOOL persistent) DECLSPEC_HIDDEN;
void surface_prepare_rb(struct wined3d_surface *surface,
const struct wined3d_gl_info *gl_info, BOOL multisample) DECLSPEC_HIDDEN;
void surface_prepare_texture(struct wined3d_surface *surface,
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
void surface_set_compatible_renderbuffer(struct wined3d_surface *surface,
@ -2098,29 +2103,31 @@ void draw_textured_quad(const struct wined3d_surface *src_surface, const RECT *s
void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) DECLSPEC_HIDDEN;
/* Surface flags: */
#define SFLAG_CONVERTED 0x00000002 /* Converted for color keying or Palettized */
#define SFLAG_DIBSECTION 0x00000004 /* Has a DIB section attached for GetDC */
#define SFLAG_LOCKABLE 0x00000008 /* Surface can be locked */
#define SFLAG_DISCARD 0x00000010 /* ??? */
#define SFLAG_LOCKED 0x00000020 /* Surface is locked atm */
#define SFLAG_INTEXTURE 0x00000040 /* The GL texture contains the newest surface content */
#define SFLAG_INSRGBTEX 0x00000080 /* The GL srgb texture contains the newest surface content */
#define SFLAG_INDRAWABLE 0x00000100 /* The gl drawable contains the most up to date data */
#define SFLAG_INSYSMEM 0x00000200 /* The system memory copy is most up to date */
#define SFLAG_NONPOW2 0x00000400 /* Surface sizes are not a power of 2 */
#define SFLAG_DYNLOCK 0x00000800 /* Surface is often locked by the app */
#define SFLAG_DCINUSE 0x00001000 /* Set between GetDC and ReleaseDC calls */
#define SFLAG_LOST 0x00002000 /* Surface lost flag for DDraw */
#define SFLAG_USERPTR 0x00004000 /* The application allocated the memory for this surface */
#define SFLAG_GLCKEY 0x00008000 /* The gl texture was created with a color key */
#define SFLAG_CLIENT 0x00010000 /* GL_APPLE_client_storage is used on that texture */
#define SFLAG_ALLOCATED 0x00020000 /* A gl texture is allocated for this surface */
#define SFLAG_SRGBALLOCATED 0x00040000 /* A srgb gl texture is allocated for this surface */
#define SFLAG_PBO 0x00080000 /* Has a PBO attached for speeding up data transfers for dynamically locked surfaces */
#define SFLAG_NORMCOORD 0x00100000 /* Set if the GL texture coords are normalized(non-texture rectangle) */
#define SFLAG_DS_ONSCREEN 0x00200000 /* Is a depth stencil, last modified onscreen */
#define SFLAG_DS_OFFSCREEN 0x00400000 /* Is a depth stencil, last modified offscreen */
#define SFLAG_INOVERLAYDRAW 0x00800000 /* Overlay drawing is in progress. Recursion prevention */
#define SFLAG_CONVERTED 0x00000001 /* Converted for color keying or palettized. */
#define SFLAG_DISCARD 0x00000002 /* ??? */
#define SFLAG_NONPOW2 0x00000004 /* Surface sizes are not a power of 2 */
#define SFLAG_NORMCOORD 0x00000008 /* Set if GL texture coordinates are normalized (non-texture rectangle). */
#define SFLAG_LOCKABLE 0x00000010 /* Surface can be locked. */
#define SFLAG_DYNLOCK 0x00000020 /* Surface is often locked by the application. */
#define SFLAG_LOCKED 0x00000040 /* Surface is currently locked. */
#define SFLAG_DCINUSE 0x00000080 /* Set between GetDC and ReleaseDC calls. */
#define SFLAG_LOST 0x00000100 /* Surface lost flag for ddraw. */
#define SFLAG_GLCKEY 0x00000200 /* The GL texture was created with a color key. */
#define SFLAG_CLIENT 0x00000400 /* GL_APPLE_client_storage is used with this surface. */
#define SFLAG_INOVERLAYDRAW 0x00000800 /* Overlay drawing is in progress. Recursion prevention. */
#define SFLAG_DIBSECTION 0x00001000 /* Has a DIB section attached for GetDC. */
#define SFLAG_USERPTR 0x00002000 /* The application allocated the memory for this surface. */
#define SFLAG_ALLOCATED 0x00004000 /* A GL texture is allocated for this surface. */
#define SFLAG_SRGBALLOCATED 0x00008000 /* A sRGB GL texture is allocated for this surface. */
#define SFLAG_PBO 0x00010000 /* The surface has a PBO. */
#define SFLAG_INSYSMEM 0x00020000 /* The system memory copy is current. */
#define SFLAG_INTEXTURE 0x00040000 /* The GL texture is current. */
#define SFLAG_INSRGBTEX 0x00080000 /* The GL sRGB texture is current. */
#define SFLAG_INDRAWABLE 0x00100000 /* The GL drawable is current. */
#define SFLAG_INRB_MULTISAMPLE 0x00200000 /* The multisample renderbuffer is current. */
#define SFLAG_INRB_RESOLVED 0x00400000 /* The resolved renderbuffer is current. */
#define SFLAG_DS_ONSCREEN 0x00800000 /* This is a depth / stencil surface, last modified onscreen. */
#define SFLAG_DS_OFFSCREEN 0x01000000 /* This is a depth / stencil surface, last modified offscreen. */
/* In some conditions the surface memory must not be freed:
* SFLAG_CONVERTED: Converting the data back would take too long
@ -2130,18 +2137,20 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) D
* 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_DIBSECTION | \
SFLAG_LOCKED | \
SFLAG_DYNLOCK | \
SFLAG_USERPTR | \
SFLAG_PBO | \
SFLAG_CLIENT)
#define SFLAG_DONOTFREE (SFLAG_CONVERTED | \
SFLAG_DYNLOCK | \
SFLAG_LOCKED | \
SFLAG_CLIENT | \
SFLAG_DIBSECTION | \
SFLAG_USERPTR | \
SFLAG_PBO)
#define SFLAG_LOCATIONS (SFLAG_INSYSMEM | \
SFLAG_INTEXTURE | \
SFLAG_INDRAWABLE | \
SFLAG_INSRGBTEX)
#define SFLAG_LOCATIONS (SFLAG_INSYSMEM | \
SFLAG_INTEXTURE | \
SFLAG_INSRGBTEX | \
SFLAG_INDRAWABLE | \
SFLAG_INRB_MULTISAMPLE | \
SFLAG_INRB_RESOLVED)
#define SFLAG_DS_LOCATIONS (SFLAG_DS_ONSCREEN | \
SFLAG_DS_OFFSCREEN)