wined3d: Avoid calling removed/deprecated GL functions in SetupForBlit().

Eliminates possible GL errors when core contexts are used.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Józef Kucia 2017-12-08 10:41:21 +01:00 committed by Alexandre Julliard
parent 7453e93eeb
commit 9673a36727
1 changed files with 74 additions and 65 deletions

View File

@ -2323,10 +2323,13 @@ static void set_blit_dimension(const struct wined3d_gl_info *gl_info, UINT width
-1.0, -1.0, -1.0, 1.0,
};
if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
{
gl_info->gl_ops.gl.p_glMatrixMode(GL_PROJECTION);
checkGLcall("glMatrixMode(GL_PROJECTION)");
gl_info->gl_ops.gl.p_glLoadMatrixd(projection);
checkGLcall("glLoadMatrixd");
}
gl_info->gl_ops.gl.p_glViewport(0, 0, width, height);
checkGLcall("glViewport");
}
@ -2398,10 +2401,10 @@ void context_enable_clip_distances(struct wined3d_context *context, unsigned int
/* Context activation is done by the caller. */
static void SetupForBlit(const struct wined3d_device *device, struct wined3d_context *context)
{
int i;
const struct wined3d_gl_info *gl_info = context->gl_info;
DWORD sampler;
SIZE rt_size;
int i;
TRACE("Setting up context %p for blitting\n", context);
@ -2422,6 +2425,8 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
}
context->last_was_blit = TRUE;
if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
{
/* Disable all textures. The caller can then bind a texture it wants to blit
* from
*
@ -2458,12 +2463,8 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
context_invalidate_state(context, STATE_SAMPLER(sampler));
}
}
if (gl_info->supported[ARB_SAMPLER_OBJECTS])
GL_EXTCALL(glBindSampler(0, 0));
context_active_texture(context, gl_info, 0);
sampler = context->rev_tex_unit_map[0];
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
{
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
@ -2493,6 +2494,30 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
checkGLcall("glTexEnvf GL_TEXTURE_LOD_BIAS_EXT ...");
}
/* Setup transforms */
gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
checkGLcall("glMatrixMode(GL_MODELVIEW)");
gl_info->gl_ops.gl.p_glLoadIdentity();
checkGLcall("glLoadIdentity()");
context_invalidate_state(context, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0)));
/* Other misc states */
gl_info->gl_ops.gl.p_glDisable(GL_ALPHA_TEST);
checkGLcall("glDisable(GL_ALPHA_TEST)");
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ALPHATESTENABLE));
gl_info->gl_ops.gl.p_glDisable(GL_LIGHTING);
checkGLcall("glDisable GL_LIGHTING");
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_LIGHTING));
glDisableWINE(GL_FOG);
checkGLcall("glDisable GL_FOG");
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_FOGENABLE));
}
if (gl_info->supported[ARB_SAMPLER_OBJECTS])
GL_EXTCALL(glBindSampler(0, 0));
context_active_texture(context, gl_info, 0);
sampler = context->rev_tex_unit_map[0];
if (sampler != WINED3D_UNMAPPED_STAGE)
{
if (sampler < MAX_TEXTURES)
@ -2504,18 +2529,9 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
}
/* Other misc states */
gl_info->gl_ops.gl.p_glDisable(GL_ALPHA_TEST);
checkGLcall("glDisable(GL_ALPHA_TEST)");
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ALPHATESTENABLE));
gl_info->gl_ops.gl.p_glDisable(GL_LIGHTING);
checkGLcall("glDisable GL_LIGHTING");
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_LIGHTING));
gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_TEST);
checkGLcall("glDisable GL_DEPTH_TEST");
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ZENABLE));
glDisableWINE(GL_FOG);
checkGLcall("glDisable GL_FOG");
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_FOGENABLE));
gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
checkGLcall("glDisable GL_BLEND");
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE));
@ -2547,13 +2563,6 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
checkGLcall("glDisable(GL_COLOR_SUM_EXT)");
}
/* Setup transforms */
gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
checkGLcall("glMatrixMode(GL_MODELVIEW)");
gl_info->gl_ops.gl.p_glLoadIdentity();
checkGLcall("glLoadIdentity()");
context_invalidate_state(context, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0)));
context->last_was_rhw = TRUE;
context_invalidate_state(context, STATE_VDECL); /* because of last_was_rhw = TRUE */