diff options
author | Brian Paul <[email protected]> | 2009-10-12 18:11:31 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-10-12 18:12:01 -0600 |
commit | 3f928b355275c0e76ead6febe471a552ece8b0a8 (patch) | |
tree | d09c3c30d1fac764b3248ae32cd87b9ddf1af4c6 /src/mesa/drivers | |
parent | b5d6a8e88fb970bce596adc10a8b22f6758591f0 (diff) |
mesa: save/set/restore texture base/wrap state in blitframebuffer_texture()
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 02e771c8d83..9cba3a7600c 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1048,8 +1048,13 @@ blitframebuffer_texture(GLcontext *ctx, if (readAtt && readAtt->Texture) { const struct gl_texture_object *texObj = readAtt->Texture; + const GLuint srcLevel = readAtt->TextureLevel; const GLenum minFilterSave = texObj->MinFilter; const GLenum magFilterSave = texObj->MagFilter; + const GLint baseLevelSave = texObj->BaseLevel; + const GLint maxLevelSave = texObj->MaxLevel; + const GLenum wrapSSave = texObj->WrapS; + const GLenum wrapTSave = texObj->WrapT; const GLenum target = texObj->Target; if (drawAtt->Texture == readAtt->Texture) { @@ -1075,8 +1080,11 @@ blitframebuffer_texture(GLcontext *ctx, _mesa_BindTexture(target, texObj->Name); _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, filter); _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, filter); + _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, srcLevel); + _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - /*_mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE);*/ _mesa_set_enable(ctx, target, GL_TRUE); /* Prepare vertex data (the VBO was previously created and bound) */ @@ -1089,8 +1097,7 @@ blitframebuffer_texture(GLcontext *ctx, if (target == GL_TEXTURE_2D) { const struct gl_texture_image *texImage - = _mesa_select_tex_image(ctx, texObj, target, - readAtt->TextureLevel); + = _mesa_select_tex_image(ctx, texObj, target, srcLevel); s0 = srcX0 / (float) texImage->Width; s1 = srcX1 / (float) texImage->Width; t0 = srcY0 / (float) texImage->Height; @@ -1127,11 +1134,15 @@ blitframebuffer_texture(GLcontext *ctx, _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); - /* Restore texture's filter state, the texture binding will + /* Restore texture object state, the texture binding will * be restored by _mesa_meta_end(). */ _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilterSave); _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilterSave); + _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave); + _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, wrapSSave); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, wrapTSave); /* Done with color buffer */ mask &= ~GL_COLOR_BUFFER_BIT; |