aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texstate.c
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2020-04-20 14:17:53 +0200
committerPierre-Eric Pelloux-Prayer <[email protected]>2020-05-05 09:40:29 +0200
commit12fb7d700861fb0af639fa21c1e3b65981ee81e4 (patch)
treed5de2c24411787ee79efd3b19e7a612936ef9c46 /src/mesa/main/texstate.c
parent90d9f9a37ed6a84292a96a247f70ffeb88a2ccde (diff)
mesa: add gl_coontext::ForceIntegerTexNearest
Some applications incorrectly use GL_LINEAR* values for integers texture. copyimage.c already implemented a tolerance for such app in prepare_target_err. This commit adds a boolean that will treat GL_LINEAR* filters as GL_NEAREST for integer textures. CC: 20.1 <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4647>
Diffstat (limited to 'src/mesa/main/texstate.c')
-rw-r--r--src/mesa/main/texstate.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index dfcfc4e8015..f21f83edba5 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -670,11 +670,13 @@ update_single_program_texture(struct gl_context *ctx, struct gl_program *prog,
texUnit->Sampler : &texObj->Sampler;
if (likely(texObj)) {
- if (_mesa_is_texture_complete(texObj, sampler))
+ if (_mesa_is_texture_complete(texObj, sampler,
+ ctx->Const.ForceIntegerTexNearest))
return texObj;
_mesa_test_texobj_completeness(ctx, texObj);
- if (_mesa_is_texture_complete(texObj, sampler))
+ if (_mesa_is_texture_complete(texObj, sampler,
+ ctx->Const.ForceIntegerTexNearest))
return texObj;
}
@@ -816,10 +818,12 @@ update_ff_texture_state(struct gl_context *ctx,
struct gl_sampler_object *sampler = texUnit->Sampler ?
texUnit->Sampler : &texObj->Sampler;
- if (!_mesa_is_texture_complete(texObj, sampler)) {
+ if (!_mesa_is_texture_complete(texObj, sampler,
+ ctx->Const.ForceIntegerTexNearest)) {
_mesa_test_texobj_completeness(ctx, texObj);
}
- if (_mesa_is_texture_complete(texObj, sampler)) {
+ if (_mesa_is_texture_complete(texObj, sampler,
+ ctx->Const.ForceIntegerTexNearest)) {
_mesa_reference_texobj(&texUnit->_Current, texObj);
complete = true;
break;