aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-03 08:16:19 +0200
committermarha <marha@users.sourceforge.net>2012-08-03 09:35:02 +0200
commit18e75aa6ae27a6e44d93babd96afbbe0cd6077c8 (patch)
treea6124cc965bba51de50907418ce63ab4540f582d /mesalib/src/mesa/drivers
parent49838240b7d4cff1ffed1bd91e495f6919061f90 (diff)
downloadvcxsrv-18e75aa6ae27a6e44d93babd96afbbe0cd6077c8.tar.gz
vcxsrv-18e75aa6ae27a6e44d93babd96afbbe0cd6077c8.tar.bz2
vcxsrv-18e75aa6ae27a6e44d93babd96afbbe0cd6077c8.zip
pixman mesa git update 3 Aug 2012
Diffstat (limited to 'mesalib/src/mesa/drivers')
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c75
1 files changed, 38 insertions, 37 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 6846bbc60..af89d8180 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -287,7 +287,7 @@ struct gen_mipmap_state
struct decompress_state
{
GLuint ArrayObj;
- GLuint VBO, FBO, RBO;
+ GLuint VBO, FBO, RBO, Sampler;
GLint Width, Height;
};
@@ -1350,15 +1350,13 @@ blitframebuffer_texture(struct gl_context *ctx,
if (readAtt && readAtt->Texture) {
const struct gl_texture_object *texObj = readAtt->Texture;
const GLuint srcLevel = readAtt->TextureLevel;
- const GLenum minFilterSave = texObj->Sampler.MinFilter;
- const GLenum magFilterSave = texObj->Sampler.MagFilter;
const GLint baseLevelSave = texObj->BaseLevel;
const GLint maxLevelSave = texObj->MaxLevel;
- const GLenum wrapSSave = texObj->Sampler.WrapS;
- const GLenum wrapTSave = texObj->Sampler.WrapT;
- const GLenum srgbSave = texObj->Sampler.sRGBDecode;
const GLenum fbo_srgb_save = ctx->Color.sRGBEnabled;
const GLenum target = texObj->Target;
+ GLuint sampler, samplerSave =
+ ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ?
+ ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler->Name : 0;
if (drawAtt->Texture == readAtt->Texture) {
/* Can't use same texture as both the source and dest. We need
@@ -1373,6 +1371,9 @@ blitframebuffer_texture(struct gl_context *ctx,
return mask;
}
+ _mesa_GenSamplers(1, &sampler);
+ _mesa_BindSampler(ctx->Texture.CurrentUnit, sampler);
+
/*
printf("Blit from texture!\n");
printf(" srcAtt %p dstAtt %p\n", readAtt, drawAtt);
@@ -1381,18 +1382,18 @@ blitframebuffer_texture(struct gl_context *ctx,
/* Prepare src texture state */
_mesa_BindTexture(target, texObj->Name);
- _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, filter);
- _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, filter);
+ _mesa_SamplerParameteri(sampler, GL_TEXTURE_MIN_FILTER, filter);
+ _mesa_SamplerParameteri(sampler, GL_TEXTURE_MAG_FILTER, filter);
if (target != GL_TEXTURE_RECTANGLE_ARB) {
_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_SamplerParameteri(sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ _mesa_SamplerParameteri(sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
/* Always do our blits with no sRGB decode or encode.*/
if (ctx->Extensions.EXT_texture_sRGB_decode) {
- _mesa_TexParameteri(target, GL_TEXTURE_SRGB_DECODE_EXT,
+ _mesa_SamplerParameteri(sampler, GL_TEXTURE_SRGB_DECODE_EXT,
GL_SKIP_DECODE_EXT);
}
if (ctx->Extensions.EXT_framebuffer_sRGB) {
@@ -1452,21 +1453,17 @@ blitframebuffer_texture(struct gl_context *ctx,
/* 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);
if (target != GL_TEXTURE_RECTANGLE_ARB) {
_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);
- if (ctx->Extensions.EXT_texture_sRGB_decode) {
- _mesa_TexParameteri(target, GL_TEXTURE_SRGB_DECODE_EXT, srgbSave);
- }
if (ctx->Extensions.EXT_framebuffer_sRGB && fbo_srgb_save) {
_mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_TRUE);
}
+ _mesa_BindSampler(ctx->Texture.CurrentUnit, samplerSave);
+ _mesa_DeleteSamplers(1, &sampler);
+
/* Done with color buffer */
mask &= ~GL_COLOR_BUFFER_BIT;
}
@@ -3295,6 +3292,7 @@ decompress_texture_image(struct gl_context *ctx,
struct vertex verts[4];
GLuint fboDrawSave, fboReadSave;
GLuint rbSave;
+ GLuint samplerSave;
if (slice > 0) {
assert(target == GL_TEXTURE_3D ||
@@ -3315,6 +3313,9 @@ decompress_texture_image(struct gl_context *ctx,
_mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_PIXEL_STORE);
+ samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ?
+ ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler->Name : 0;
+
/* Create/bind FBO/renderbuffer */
if (decompress->FBO == 0) {
_mesa_GenFramebuffersEXT(1, &decompress->FBO);
@@ -3362,6 +3363,22 @@ decompress_texture_image(struct gl_context *ctx,
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, decompress->VBO);
}
+ if (!decompress->Sampler) {
+ _mesa_GenSamplers(1, &decompress->Sampler);
+ _mesa_BindSampler(ctx->Texture.CurrentUnit, decompress->Sampler);
+ /* nearest filtering */
+ _mesa_SamplerParameteri(decompress->Sampler, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ _mesa_SamplerParameteri(decompress->Sampler, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ /* No sRGB decode or encode.*/
+ if (ctx->Extensions.EXT_texture_sRGB_decode) {
+ _mesa_SamplerParameteri(decompress->Sampler, GL_TEXTURE_SRGB_DECODE_EXT,
+ GL_SKIP_DECODE_EXT);
+ }
+
+ } else {
+ _mesa_BindSampler(ctx->Texture.CurrentUnit, decompress->Sampler);
+ }
+
setup_texture_coords(faceTarget, slice, width, height,
verts[0].tex,
verts[1].tex,
@@ -3387,26 +3404,14 @@ decompress_texture_image(struct gl_context *ctx,
{
/* save texture object state */
- const GLenum minFilterSave = texObj->Sampler.MinFilter;
- const GLenum magFilterSave = texObj->Sampler.MagFilter;
const GLint baseLevelSave = texObj->BaseLevel;
const GLint maxLevelSave = texObj->MaxLevel;
- const GLenum wrapSSave = texObj->Sampler.WrapS;
- const GLenum wrapTSave = texObj->Sampler.WrapT;
- const GLenum srgbSave = texObj->Sampler.sRGBDecode;
/* restrict sampling to the texture level of interest */
_mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, texImage->Level);
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, texImage->Level);
- /* nearest filtering */
- _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
/* No sRGB decode or encode.*/
- if (ctx->Extensions.EXT_texture_sRGB_decode) {
- _mesa_TexParameteri(target, GL_TEXTURE_SRGB_DECODE_EXT,
- GL_SKIP_DECODE_EXT);
- }
if (ctx->Extensions.EXT_framebuffer_sRGB) {
_mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
}
@@ -3417,17 +3422,11 @@ decompress_texture_image(struct gl_context *ctx,
/* 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);
if (target != GL_TEXTURE_RECTANGLE_ARB) {
_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);
- if (ctx->Extensions.EXT_texture_sRGB_decode) {
- _mesa_TexParameteri(target, GL_TEXTURE_SRGB_DECODE_EXT, srgbSave);
- }
+
}
/* read pixels from renderbuffer */
@@ -3455,6 +3454,8 @@ decompress_texture_image(struct gl_context *ctx,
/* disable texture unit */
_mesa_set_enable(ctx, target, GL_FALSE);
+ _mesa_BindSampler(ctx->Texture.CurrentUnit, samplerSave);
+
_mesa_meta_end(ctx);
/* restore fbo bindings */