summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/common
diff options
context:
space:
mode:
authorTopi Pohjolainen <[email protected]>2014-05-21 11:43:56 +0300
committerTopi Pohjolainen <[email protected]>2014-05-27 09:31:07 +0300
commitc246828c4d59025bf4e1d5d9de5d9bc5517b3a7b (patch)
treed13022e059b8426124afc3cda7ba6d1d78c03309 /src/mesa/drivers/common
parent328e7e77424e9019b7c978fdc78da723fe079102 (diff)
meta/blit: Add stencil texturing mode save and restore
v2 (Ken): Only restore the mode if it has changed. Signed-off-by: Topi Pohjolainen <[email protected]> Cc: "10.2" <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/common')
-rw-r--r--src/mesa/drivers/common/meta.h4
-rw-r--r--src/mesa/drivers/common/meta_blit.c13
2 files changed, 14 insertions, 3 deletions
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 007f1040bdb..765f8dfe4a2 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -270,7 +270,7 @@ struct blit_state
struct fb_tex_blit_state
{
GLint baseLevelSave, maxLevelSave;
- GLuint sampler, samplerSave;
+ GLuint sampler, samplerSave, stencilSamplingSave;
GLuint tempTex;
};
@@ -407,7 +407,7 @@ _mesa_meta_fb_tex_blit_begin(const struct gl_context *ctx,
struct fb_tex_blit_state *blit);
extern void
-_mesa_meta_fb_tex_blit_end(const struct gl_context *ctx, GLenum target,
+_mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target,
struct fb_tex_blit_state *blit);
extern GLboolean
diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index 707269dd687..84594d1d72b 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -446,6 +446,7 @@ blitframebuffer_texture(struct gl_context *ctx,
fb_tex_blit.baseLevelSave = texObj->BaseLevel;
fb_tex_blit.maxLevelSave = texObj->MaxLevel;
+ fb_tex_blit.stencilSamplingSave = texObj->StencilSampling;
if (glsl_version) {
setup_glsl_blit_framebuffer(ctx, blit, rb, target);
@@ -576,7 +577,7 @@ _mesa_meta_fb_tex_blit_begin(const struct gl_context *ctx,
}
void
-_mesa_meta_fb_tex_blit_end(const struct gl_context *ctx, GLenum target,
+_mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target,
struct fb_tex_blit_state *blit)
{
/* Restore texture object state, the texture binding will
@@ -585,6 +586,16 @@ _mesa_meta_fb_tex_blit_end(const struct gl_context *ctx, GLenum target,
if (target != GL_TEXTURE_RECTANGLE_ARB) {
_mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, blit->baseLevelSave);
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, blit->maxLevelSave);
+
+ if (ctx->Extensions.ARB_stencil_texturing) {
+ const struct gl_texture_object *texObj =
+ _mesa_get_current_tex_object(ctx, target);
+
+ if (texObj->StencilSampling != blit->stencilSamplingSave)
+ _mesa_TexParameteri(target, GL_DEPTH_STENCIL_TEXTURE_MODE,
+ blit->stencilSamplingSave ?
+ GL_STENCIL_INDEX : GL_DEPTH_COMPONENT);
+ }
}
_mesa_BindSampler(ctx->Texture.CurrentUnit, blit->samplerSave);