wined3d: Surfaces always have a container in surface_bind().

This commit is contained in:
Henri Verbeet 2013-11-18 10:46:19 +01:00 committed by Alexandre Julliard
parent 96fbf9fed3
commit 32fb4e45eb
1 changed files with 4 additions and 40 deletions

View File

@ -604,48 +604,12 @@ static void surface_evict_sysmem(struct wined3d_surface *surface)
/* Context activation is done by the caller. */
static void surface_bind(struct wined3d_surface *surface, struct wined3d_context *context, BOOL srgb)
{
struct wined3d_texture *texture = surface->container;
TRACE("surface %p, context %p, srgb %#x.\n", surface, context, srgb);
if (surface->container)
{
struct wined3d_texture *texture = surface->container;
TRACE("Passing to container (%p).\n", texture);
texture->texture_ops->texture_bind(texture, context, srgb);
}
else
{
const struct wined3d_gl_info *gl_info = context->gl_info;
if (surface->texture_level)
{
ERR("Standalone surface %p is non-zero texture level %u.\n",
surface, surface->texture_level);
}
if (srgb)
ERR("Trying to bind standalone surface %p as sRGB.\n", surface);
if (!surface->texture_name)
{
gl_info->gl_ops.gl.p_glGenTextures(1, &surface->texture_name);
checkGLcall("glGenTextures");
TRACE("Surface %p given name %u.\n", surface, surface->texture_name);
context_bind_texture(context, surface->texture_target, surface->texture_name);
gl_info->gl_ops.gl.p_glTexParameteri(surface->texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
gl_info->gl_ops.gl.p_glTexParameteri(surface->texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
gl_info->gl_ops.gl.p_glTexParameteri(surface->texture_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
gl_info->gl_ops.gl.p_glTexParameteri(surface->texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
gl_info->gl_ops.gl.p_glTexParameteri(surface->texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
checkGLcall("glTexParameteri");
}
else
{
context_bind_texture(context, surface->texture_target, surface->texture_name);
}
}
TRACE("Passing to container (%p).\n", texture);
texture->texture_ops->texture_bind(texture, context, srgb);
}
/* Context activation is done by the caller. */