wined3d: Fetch currently active texture unit from the wined3d_context.

This commit is contained in:
Matteo Bruni 2011-07-26 23:01:26 +02:00 committed by Alexandre Julliard
parent f47f9f7c74
commit d485e04576
2 changed files with 4 additions and 24 deletions

View file

@ -594,7 +594,6 @@ static void surface_bind_and_dirtify(struct wined3d_surface *surface,
{
struct wined3d_device *device = surface->resource.device;
DWORD active_sampler;
GLint active_texture;
/* We don't need a specific texture unit, but after binding the texture
* the current unit is dirty. Read the unit back instead of switching to
@ -604,15 +603,8 @@ static void surface_bind_and_dirtify(struct wined3d_surface *surface,
* To be more specific, this is tricky because we can implicitly be
* called from sampler() in state.c. This means we can't touch anything
* other than whatever happens to be the currently active texture, or we
* would risk marking already applied sampler states dirty again.
*
* TODO: Track the current active texture per GL context instead of using
* glGet(). */
ENTER_GL();
glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture);
LEAVE_GL();
active_sampler = device->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB];
* would risk marking already applied sampler states dirty again. */
active_sampler = device->rev_tex_unit_map[context->active_texture];
if (active_sampler != WINED3D_UNMAPPED_STAGE)
device_invalidate_state(device, STATE_SAMPLER(active_sampler));

View file

@ -37,20 +37,8 @@ static void volume_bind_and_dirtify(const struct wined3d_volume *volume, struct
* To be more specific, this is tricky because we can implicitly be called
* from sampler() in state.c. This means we can't touch anything other than
* whatever happens to be the currently active texture, or we would risk
* marking already applied sampler states dirty again.
*
* TODO: Track the current active texture per GL context instead of using glGet
*/
if (context->gl_info->supported[ARB_MULTITEXTURE])
{
GLint active_texture;
ENTER_GL();
glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture);
LEAVE_GL();
active_sampler = volume->resource.device->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB];
} else {
active_sampler = 0;
}
* marking already applied sampler states dirty again. */
active_sampler = volume->resource.device->rev_tex_unit_map[context->active_texture];
if (active_sampler != WINED3D_UNMAPPED_STAGE)
device_invalidate_state(volume->resource.device, STATE_SAMPLER(active_sampler));