Commit 42870549 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of GL_APPLE_client_storage support.

Once upon a time this extention helped reduce address space usage on MacOS, although at the cost of obscure driver bugs. These days it just seems to make things worse. Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent e6e0c227
......@@ -101,7 +101,6 @@ struct wined3d_extension_map
static const struct wined3d_extension_map gl_extension_map[] =
{
/* APPLE */
{"GL_APPLE_client_storage", APPLE_CLIENT_STORAGE },
{"GL_APPLE_fence", APPLE_FENCE },
{"GL_APPLE_float_pixels", APPLE_FLOAT_PIXELS },
{"GL_APPLE_flush_buffer_range", APPLE_FLUSH_BUFFER_RANGE },
......@@ -1599,7 +1598,6 @@ static enum wined3d_gl_vendor wined3d_guess_gl_vendor(const struct wined3d_gl_in
* the chance that other implementations support them is rather small since Win32 QuickTime uses
* DirectDraw, not OpenGL. */
if (gl_info->supported[APPLE_FENCE]
&& gl_info->supported[APPLE_CLIENT_STORAGE]
&& gl_info->supported[APPLE_YCBCR_422])
return GL_VENDOR_APPLE;
......
......@@ -589,39 +589,15 @@ static void surface_evict_sysmem(struct wined3d_surface *surface)
{
/* In some conditions the surface memory must not be freed:
* WINED3D_TEXTURE_CONVERTED: Converting the data back would take too long
* WINED3D_TEXTURE_DYNAMIC_MAP: Avoid freeing the data for performance
* SFLAG_CLIENT: OpenGL uses our memory as backup */
if (surface->resource.map_count || surface->flags & SFLAG_CLIENT
|| surface->container->flags & (WINED3D_TEXTURE_CONVERTED | WINED3D_TEXTURE_PIN_SYSMEM
| WINED3D_TEXTURE_DYNAMIC_MAP))
* WINED3D_TEXTURE_DYNAMIC_MAP: Avoid freeing the data for performance */
if (surface->resource.map_count || surface->container->flags & (WINED3D_TEXTURE_CONVERTED
| WINED3D_TEXTURE_PIN_SYSMEM | WINED3D_TEXTURE_DYNAMIC_MAP))
return;
wined3d_resource_free_sysmem(&surface->resource);
surface_invalidate_location(surface, WINED3D_LOCATION_SYSMEM);
}
static void surface_release_client_storage(struct wined3d_surface *surface)
{
struct wined3d_context *context = context_acquire(surface->resource.device, NULL);
const struct wined3d_gl_info *gl_info = context->gl_info;
if (surface->container->texture_rgb.name)
{
wined3d_texture_bind_and_dirtify(surface->container, context, FALSE);
gl_info->gl_ops.gl.p_glTexImage2D(surface->texture_target, surface->texture_level,
GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
}
if (surface->container->texture_srgb.name)
{
wined3d_texture_bind_and_dirtify(surface->container, context, TRUE);
gl_info->gl_ops.gl.p_glTexImage2D(surface->texture_target, surface->texture_level,
GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
}
wined3d_texture_force_reload(surface->container);
context_release(context);
}
static BOOL surface_use_pbo(const struct wined3d_surface *surface)
{
const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info;
......@@ -2643,13 +2619,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
/* Create a DIB section if there isn't a dc yet. */
if (!surface->hDC)
{
if (surface->flags & SFLAG_CLIENT)
{
surface_load_location(surface, context, WINED3D_LOCATION_SYSMEM);
surface_release_client_storage(surface);
}
hr = surface_create_dib_section(surface);
if (FAILED(hr))
if (FAILED(hr = surface_create_dib_section(surface)))
{
if (context)
context_release(context);
......
......@@ -863,7 +863,6 @@ static void texture2d_prepare_texture(struct wined3d_texture *texture, struct wi
struct wined3d_surface *surface = surface_from_resource(texture->sub_resources[i]);
GLsizei height = surface->pow2Height;
GLsizei width = surface->pow2Width;
const BYTE *mem = NULL;
if (texture->resource.format_flags & WINED3DFMT_FLAG_HEIGHT_SCALE)
{
......@@ -874,48 +873,9 @@ static void texture2d_prepare_texture(struct wined3d_texture *texture, struct wi
TRACE("surface %p, target %#x, level %d, width %d, height %d.\n",
surface, surface->texture_target, surface->texture_level, width, height);
if (gl_info->supported[APPLE_CLIENT_STORAGE])
{
if (surface->flags & (SFLAG_NONPOW2 | SFLAG_DIBSECTION)
|| texture->flags & WINED3D_TEXTURE_CONVERTED
|| !surface->resource.heap_memory)
{
/* In some cases we want to disable client storage.
* SFLAG_NONPOW2 has a bigger opengl texture than the client memory, and different pitches
* SFLAG_DIBSECTION: Dibsections may have read / write protections on the memory. Avoid issues...
* WINED3D_TEXTURE_CONVERTED: The conversion destination memory is freed after loading the surface
* heap_memory == NULL: Not defined in the extension. Seems to disable client storage effectively
*/
surface->flags &= ~SFLAG_CLIENT;
}
else
{
surface->flags |= SFLAG_CLIENT;
mem = surface->resource.heap_memory;
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
}
}
if (texture->resource.format_flags & WINED3DFMT_FLAG_COMPRESSED && mem)
{
GL_EXTCALL(glCompressedTexImage2D(surface->texture_target, surface->texture_level,
internal, width, height, 0, surface->resource.size, mem));
checkGLcall("glCompressedTexImage2D");
}
else
{
gl_info->gl_ops.gl.p_glTexImage2D(surface->texture_target, surface->texture_level,
internal, width, height, 0, format->glFormat, format->glType, mem);
checkGLcall("glTexImage2D");
}
if (mem)
{
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
}
gl_info->gl_ops.gl.p_glTexImage2D(surface->texture_target, surface->texture_level,
internal, width, height, 0, format->glFormat, format->glType, NULL);
checkGLcall("glTexImage2D");
}
}
......@@ -1291,29 +1251,12 @@ static void texture3d_prepare_texture(struct wined3d_texture *texture, struct wi
for (i = 0; i < sub_count; ++i)
{
struct wined3d_volume *volume = volume_from_resource(texture->sub_resources[i]);
void *mem = NULL;
if (gl_info->supported[APPLE_CLIENT_STORAGE] && !format->convert
&& volume_prepare_system_memory(volume))
{
TRACE("Enabling GL_UNPACK_CLIENT_STORAGE_APPLE for volume %p\n", volume);
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
mem = volume->resource.heap_memory;
volume->flags |= WINED3D_VFLAG_CLIENT_STORAGE;
}
GL_EXTCALL(glTexImage3D(GL_TEXTURE_3D, volume->texture_level,
srgb ? format->glGammaInternal : format->glInternal,
volume->resource.width, volume->resource.height, volume->resource.depth,
0, format->glFormat, format->glType, mem));
0, format->glFormat, format->glType, NULL));
checkGLcall("glTexImage3D");
if (mem)
{
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
}
}
}
......
......@@ -230,8 +230,6 @@ static BOOL wined3d_volume_can_evict(const struct wined3d_volume *volume)
return FALSE;
if (volume->resource.format->convert)
return FALSE;
if (volume->flags & WINED3D_VFLAG_CLIENT_STORAGE)
return FALSE;
return TRUE;
}
......@@ -455,7 +453,6 @@ static void volume_unload(struct wined3d_resource *resource)
}
/* The texture name is managed by the container. */
volume->flags &= ~WINED3D_VFLAG_CLIENT_STORAGE;
resource_unload(resource);
}
......
......@@ -38,7 +38,6 @@ enum wined3d_gl_extension
WINED3D_GL_EXT_NONE,
/* APPLE */
APPLE_CLIENT_STORAGE,
APPLE_FENCE,
APPLE_FLOAT_PIXELS,
APPLE_FLUSH_BUFFER_RANGE,
......
......@@ -2337,14 +2337,12 @@ void wined3d_texture_set_swapchain(struct wined3d_texture *texture,
const char *wined3d_debug_location(DWORD location) DECLSPEC_HIDDEN;
#define WINED3D_VFLAG_CLIENT_STORAGE 0x00000001
struct wined3d_volume
{
struct wined3d_resource resource;
struct wined3d_texture *container;
DWORD flags, locations;
DWORD locations;
GLint texture_level;
DWORD download_count;
GLuint pbo;
......@@ -2497,7 +2495,6 @@ void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3
#define SFLAG_DIBSECTION 0x00000001 /* Has a DIB section attached for GetDC. */
#define SFLAG_DISCARD 0x00000002 /* ??? */
#define SFLAG_NONPOW2 0x00000004 /* Surface sizes are not a power of 2 */
#define SFLAG_CLIENT 0x00000010 /* GL_APPLE_client_storage is used with this surface. */
#define SFLAG_DCINUSE 0x00000020 /* Set between GetDC and ReleaseDC calls. */
struct wined3d_sampler
......
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