meta: Refactor configuration of renderbuffer sampling
Cc: "10.2" <mesa-stable@lists.freedesktop.org> Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
a2952315ac
commit
4dc9c314c8
|
@ -402,6 +402,11 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx,
|
|||
struct gl_texture_object **texObj,
|
||||
GLenum *target);
|
||||
|
||||
GLuint
|
||||
_mesa_meta_setup_sampler(struct gl_context *ctx,
|
||||
const struct gl_texture_object *texObj,
|
||||
GLenum target, GLenum filter, GLuint srcLevel);
|
||||
|
||||
extern void
|
||||
_mesa_meta_BlitFramebuffer(struct gl_context *ctx,
|
||||
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||
|
|
|
@ -454,25 +454,13 @@ blitframebuffer_texture(struct gl_context *ctx,
|
|||
2);
|
||||
}
|
||||
|
||||
_mesa_GenSamplers(1, &sampler);
|
||||
_mesa_BindSampler(ctx->Texture.CurrentUnit, sampler);
|
||||
|
||||
/*
|
||||
printf("Blit from texture!\n");
|
||||
printf(" srcAtt %p dstAtt %p\n", readAtt, drawAtt);
|
||||
printf(" srcTex %p dstText %p\n", texObj, drawAtt->Texture);
|
||||
*/
|
||||
|
||||
/* Prepare src texture state */
|
||||
_mesa_BindTexture(target, texObj->Name);
|
||||
_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_SamplerParameteri(sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
_mesa_SamplerParameteri(sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
sampler = _mesa_meta_setup_sampler(ctx, texObj, target, filter, srcLevel);
|
||||
|
||||
/* Always do our blits with no net sRGB decode or encode.
|
||||
*
|
||||
|
@ -613,6 +601,30 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx,
|
|||
return true;
|
||||
}
|
||||
|
||||
GLuint
|
||||
_mesa_meta_setup_sampler(struct gl_context *ctx,
|
||||
const struct gl_texture_object *texObj,
|
||||
GLenum target, GLenum filter, GLuint srcLevel)
|
||||
{
|
||||
GLuint sampler;
|
||||
|
||||
_mesa_GenSamplers(1, &sampler);
|
||||
_mesa_BindSampler(ctx->Texture.CurrentUnit, sampler);
|
||||
|
||||
/* Prepare src texture state */
|
||||
_mesa_BindTexture(target, texObj->Name);
|
||||
_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_SamplerParameteri(sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
_mesa_SamplerParameteri(sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
return sampler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta implementation of ctx->Driver.BlitFramebuffer() in terms
|
||||
* of texture mapping and polygon rendering.
|
||||
|
|
Loading…
Reference in New Issue