From dc8c0959bd2b0fb9927f365d3e75e6a9e3c9cf14 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 11 Feb 2010 22:48:31 +0100 Subject: nv40: adapt to stencil ref changes --- src/gallium/drivers/nv40/nv40_context.h | 6 +++++- src/gallium/drivers/nv40/nv40_state.c | 21 ++++++++++++++++----- src/gallium/drivers/nv40/nv40_state_emit.c | 2 ++ src/gallium/drivers/nv40/nv40_state_zsa.c | 24 ++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 6 deletions(-) (limited to 'src/gallium/drivers/nv40') diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h index 958a48f2a4..4861924dac 100644 --- a/src/gallium/drivers/nv40/nv40_context.h +++ b/src/gallium/drivers/nv40/nv40_context.h @@ -61,7 +61,8 @@ enum nv40_state_index { NV40_STATE_VTXBUF = 31, NV40_STATE_VTXFMT = 32, NV40_STATE_VTXATTR = 33, - NV40_STATE_MAX = 34 + NV40_STATE_SR = 34, + NV40_STATE_MAX = 35 }; #include "nv40_screen.h" @@ -79,6 +80,7 @@ enum nv40_state_index { #define NV40_NEW_FRAGPROG (1 << 10) #define NV40_NEW_ARRAYS (1 << 11) #define NV40_NEW_UCP (1 << 12) +#define NV40_NEW_SR (1 << 13) struct nv40_rasterizer_state { struct pipe_rasterizer_state pipe; @@ -144,6 +146,7 @@ struct nv40_context { struct nv40_zsa_state *zsa; struct nv40_blend_state *blend; struct pipe_blend_color blend_colour; + struct pipe_stencil_ref stencil_ref; struct pipe_viewport_state viewport; struct pipe_framebuffer_state framebuffer; struct pipe_buffer *idxbuf; @@ -215,6 +218,7 @@ extern struct nv40_state_entry nv40_state_framebuffer; extern struct nv40_state_entry nv40_state_fragtex; extern struct nv40_state_entry nv40_state_vbo; extern struct nv40_state_entry nv40_state_vtxfmt; +extern struct nv40_state_entry nv40_state_sr; /* nv40_vbo.c */ extern void nv40_draw_arrays(struct pipe_context *, unsigned mode, diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c index 51b40e51e4..d068be6243 100644 --- a/src/gallium/drivers/nv40/nv40_state.c +++ b/src/gallium/drivers/nv40/nv40_state.c @@ -445,7 +445,7 @@ nv40_depth_stencil_alpha_state_create(struct pipe_context *pipe, { struct nv40_context *nv40 = nv40_context(pipe); struct nv40_zsa_state *zsaso = CALLOC(1, sizeof(*zsaso)); - struct nouveau_stateobj *so = so_new(4, 21, 0); + struct nouveau_stateobj *so = so_new(6, 20, 0); struct nouveau_grobj *curie = nv40->screen->curie; so_method(so, curie, NV40TCL_DEPTH_FUNC, 3); @@ -459,11 +459,11 @@ nv40_depth_stencil_alpha_state_create(struct pipe_context *pipe, so_data (so, float_to_ubyte(cso->alpha.ref_value)); if (cso->stencil[0].enabled) { - so_method(so, curie, NV40TCL_STENCIL_FRONT_ENABLE, 8); + so_method(so, curie, NV40TCL_STENCIL_FRONT_ENABLE, 3); so_data (so, cso->stencil[0].enabled ? 1 : 0); so_data (so, cso->stencil[0].writemask); so_data (so, nvgl_comparison_op(cso->stencil[0].func)); - so_data (so, cso->stencil[0].ref_value); + so_method(so, curie, NV40TCL_STENCIL_FRONT_FUNC_MASK, 4); so_data (so, cso->stencil[0].valuemask); so_data (so, nvgl_stencil_op(cso->stencil[0].fail_op)); so_data (so, nvgl_stencil_op(cso->stencil[0].zfail_op)); @@ -474,11 +474,11 @@ nv40_depth_stencil_alpha_state_create(struct pipe_context *pipe, } if (cso->stencil[1].enabled) { - so_method(so, curie, NV40TCL_STENCIL_BACK_ENABLE, 8); + so_method(so, curie, NV40TCL_STENCIL_BACK_ENABLE, 3); so_data (so, cso->stencil[1].enabled ? 1 : 0); so_data (so, cso->stencil[1].writemask); so_data (so, nvgl_comparison_op(cso->stencil[1].func)); - so_data (so, cso->stencil[1].ref_value); + so_method(so, curie, NV40TCL_STENCIL_BACK_FUNC_MASK, 4); so_data (so, cso->stencil[1].valuemask); so_data (so, nvgl_stencil_op(cso->stencil[1].fail_op)); so_data (so, nvgl_stencil_op(cso->stencil[1].zfail_op)); @@ -592,6 +592,16 @@ nv40_set_blend_color(struct pipe_context *pipe, nv40->dirty |= NV40_NEW_BCOL; } + static void +nv40_set_stencil_ref(struct pipe_context *pipe, + const struct pipe_stencil_ref *sr) +{ + struct nv40_context *nv40 = nv40_context(pipe); + + nv40->stencil_ref = *sr; + nv40->dirty |= NV40_NEW_SR; +} + static void nv40_set_clip_state(struct pipe_context *pipe, const struct pipe_clip_state *clip) @@ -719,6 +729,7 @@ nv40_init_state_functions(struct nv40_context *nv40) nv40->pipe.delete_fs_state = nv40_fp_state_delete; nv40->pipe.set_blend_color = nv40_set_blend_color; + nv40->pipe.set_stencil_ref = nv40_set_stencil_ref; nv40->pipe.set_clip_state = nv40_set_clip_state; nv40->pipe.set_constant_buffer = nv40_set_constant_buffer; nv40->pipe.set_framebuffer_state = nv40_set_framebuffer_state; diff --git a/src/gallium/drivers/nv40/nv40_state_emit.c b/src/gallium/drivers/nv40/nv40_state_emit.c index 1c4007a129..8990f303ce 100644 --- a/src/gallium/drivers/nv40/nv40_state_emit.c +++ b/src/gallium/drivers/nv40/nv40_state_emit.c @@ -13,6 +13,7 @@ static struct nv40_state_entry *render_states[] = { &nv40_state_blend, &nv40_state_blend_colour, &nv40_state_zsa, + &nv40_state_sr, &nv40_state_viewport, &nv40_state_vbo, NULL @@ -29,6 +30,7 @@ static struct nv40_state_entry *swtnl_states[] = { &nv40_state_blend, &nv40_state_blend_colour, &nv40_state_zsa, + &nv40_state_sr, &nv40_state_viewport, &nv40_state_vtxfmt, NULL diff --git a/src/gallium/drivers/nv40/nv40_state_zsa.c b/src/gallium/drivers/nv40/nv40_state_zsa.c index fb760677c8..4c734f4864 100644 --- a/src/gallium/drivers/nv40/nv40_state_zsa.c +++ b/src/gallium/drivers/nv40/nv40_state_zsa.c @@ -15,3 +15,27 @@ struct nv40_state_entry nv40_state_zsa = { .hw = NV40_STATE_ZSA } }; + +static boolean +nv40_state_sr_validate(struct nv40_context *nv40) +{ + struct nouveau_stateobj *so = so_new(2, 2, 0); + struct pipe_stencil_ref *sr = &nv40->stencil_ref; + + so_method(so, nv40->screen->rankine, NV40TCL_STENCIL_FRONT_FUNC_REF, 1); + so_data (so, sr->ref_value[0]; + so_method(so, nv40->screen->rankine, NV40TCL_STENCIL_BACK_FUNC_REF, 1); + so_data (so, sr->ref_value[1]; + + so_ref(so, &nv40->state.hw[NV40_STATE_SR]); + so_ref(NULL, &so); + return TRUE; +} + +struct nv40_state_entry nv40_state_sr = { + .validate = nv40_state_sr_validate, + .dirty = { + .pipe = NV40_NEW_SR, + .hw = NV40_STATE_SR + } +}; -- cgit v1.2.3 From 16d520f6d69edb112887d8db1e014a521a34f532 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 11 Feb 2010 23:11:03 +0100 Subject: nouveau: fix compile errors... --- src/gallium/drivers/nv30/nv30_state_zsa.c | 4 ++-- src/gallium/drivers/nv40/nv40_state_zsa.c | 8 ++++---- src/gallium/drivers/nv50/nv50_state_validate.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/gallium/drivers/nv40') diff --git a/src/gallium/drivers/nv30/nv30_state_zsa.c b/src/gallium/drivers/nv30/nv30_state_zsa.c index 6c0baa8be7..88cd74f180 100644 --- a/src/gallium/drivers/nv30/nv30_state_zsa.c +++ b/src/gallium/drivers/nv30/nv30_state_zsa.c @@ -23,9 +23,9 @@ nv30_state_sr_validate(struct nv30_context *nv30) struct pipe_stencil_ref *sr = &nv30->stencil_ref; so_method(so, nv30->screen->rankine, NV34TCL_STENCIL_FRONT_FUNC_REF, 1); - so_data (so, sr->ref_value[0]; + so_data (so, sr->ref_value[0]); so_method(so, nv30->screen->rankine, NV34TCL_STENCIL_BACK_FUNC_REF, 1); - so_data (so, sr->ref_value[1]; + so_data (so, sr->ref_value[1]); so_ref(so, &nv30->state.hw[NV30_STATE_SR]); so_ref(NULL, &so); diff --git a/src/gallium/drivers/nv40/nv40_state_zsa.c b/src/gallium/drivers/nv40/nv40_state_zsa.c index 4c734f4864..9cbe7da6db 100644 --- a/src/gallium/drivers/nv40/nv40_state_zsa.c +++ b/src/gallium/drivers/nv40/nv40_state_zsa.c @@ -22,10 +22,10 @@ nv40_state_sr_validate(struct nv40_context *nv40) struct nouveau_stateobj *so = so_new(2, 2, 0); struct pipe_stencil_ref *sr = &nv40->stencil_ref; - so_method(so, nv40->screen->rankine, NV40TCL_STENCIL_FRONT_FUNC_REF, 1); - so_data (so, sr->ref_value[0]; - so_method(so, nv40->screen->rankine, NV40TCL_STENCIL_BACK_FUNC_REF, 1); - so_data (so, sr->ref_value[1]; + so_method(so, nv40->screen->curie, NV40TCL_STENCIL_FRONT_FUNC_REF, 1); + so_data (so, sr->ref_value[0]); + so_method(so, nv40->screen->curie, NV40TCL_STENCIL_BACK_FUNC_REF, 1); + so_data (so, sr->ref_value[1]); so_ref(so, &nv40->state.hw[NV40_STATE_SR]); so_ref(NULL, &so); diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 3afeb2b241..0be6abbb17 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -332,9 +332,9 @@ nv50_state_validate(struct nv50_context *nv50) if (nv50->dirty & NV50_NEW_STENCIL_REF) { so = so_new(2, 2, 0); so_method(so, tesla, NV50TCL_STENCIL_FRONT_FUNC_REF, 1); - so_data (so, nv50->stencil_ref.ref_value[0]; + so_data (so, nv50->stencil_ref.ref_value[0]); so_method(so, tesla, NV50TCL_STENCIL_BACK_FUNC_REF, 1); - so_data (so, nv50->stencil_ref.ref_value[1]; + so_data (so, nv50->stencil_ref.ref_value[1]); so_ref(so, &nv50->state.stencil_ref); so_ref(NULL, &so); } -- cgit v1.2.3 From ebe12d50064370e4ddec21a1e087b24295940319 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 12 Feb 2010 00:43:38 +0100 Subject: gallium: make max_anisotropy a unsigned bitfield member saves us a dword in sampler state, hw can't do non-integer aniso degree anyway. To allow aniso 1x (which seems of dubious value but some hardware (radeons) have such a mode, and even d3d allows specifiying it) redefine anisotropic filtering as disabled only if max_anistropy is 0. --- src/gallium/docs/source/cso/sampler.rst | 4 +++- src/gallium/drivers/i915/i915_state.c | 4 ++-- src/gallium/drivers/i965/brw_pipe_sampler.c | 8 +++----- src/gallium/drivers/nv30/nv30_state.c | 6 +++--- src/gallium/drivers/nv40/nv40_state.c | 14 +++++++------- src/gallium/drivers/nv50/nv50_state.c | 10 +++++----- src/gallium/drivers/r300/r300_state.c | 2 +- src/gallium/drivers/r300/r300_state_inlines.h | 10 +++++----- src/gallium/drivers/svga/svga_pipe_sampler.c | 4 ++-- src/gallium/drivers/trace/tr_dump_state.c | 2 +- src/gallium/include/pipe/p_state.h | 2 +- src/mesa/state_tracker/st_atom_sampler.c | 2 +- 12 files changed, 34 insertions(+), 34 deletions(-) (limited to 'src/gallium/drivers/nv40') diff --git a/src/gallium/docs/source/cso/sampler.rst b/src/gallium/docs/source/cso/sampler.rst index 044ffffcb4..77979fc44d 100644 --- a/src/gallium/docs/source/cso/sampler.rst +++ b/src/gallium/docs/source/cso/sampler.rst @@ -45,4 +45,6 @@ border_color RGBA color used for out-of-bounds coordinates. max_anisotropy Maximum filtering to apply anisotropically to textures. Setting this to - 1.0 effectively disables anisotropic filtering. + 0 disables anisotropic filtering. Any other setting enables anisotropic + filtering, however it's not unexpected some drivers only will change their + filtering with a setting of 2 and higher. diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 14a9314dab..62169918e2 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -228,10 +228,10 @@ i915_create_sampler_state(struct pipe_context *pipe, minFilt = translate_img_filter( sampler->min_img_filter ); magFilt = translate_img_filter( sampler->mag_img_filter ); - if (sampler->max_anisotropy > 1.0) + if (sampler->max_anisotropy > 1) minFilt = magFilt = FILTER_ANISOTROPIC; - if (sampler->max_anisotropy > 2.0) { + if (sampler->max_anisotropy > 2) { cso->state[0] |= SS2_MAX_ANISO_4; } diff --git a/src/gallium/drivers/i965/brw_pipe_sampler.c b/src/gallium/drivers/i965/brw_pipe_sampler.c index 6aab561004..c7c0e2ae95 100644 --- a/src/gallium/drivers/i965/brw_pipe_sampler.c +++ b/src/gallium/drivers/i965/brw_pipe_sampler.c @@ -114,14 +114,12 @@ brw_create_sampler_state( struct pipe_context *pipe, /* XXX: anisotropy logic slightly changed: */ - if (template->max_anisotropy > 1.0) { + if (template->max_anisotropy > 1) { sampler->ss0.min_filter = BRW_MAPFILTER_ANISOTROPIC; sampler->ss0.mag_filter = BRW_MAPFILTER_ANISOTROPIC; - if (template->max_anisotropy > 2.0) { - sampler->ss3.max_aniso = MIN2((template->max_anisotropy - 2) / 2, - BRW_ANISORATIO_16); - } + sampler->ss3.max_aniso = MIN2((template->max_anisotropy - 2) / 2, + BRW_ANISORATIO_16); } sampler->ss1.r_wrap_mode = translate_wrap_mode(template->wrap_r); diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c index 8fc6856ee5..d911c80707 100644 --- a/src/gallium/drivers/nv30/nv30_state.c +++ b/src/gallium/drivers/nv30/nv30_state.c @@ -139,13 +139,13 @@ nv30_sampler_state_create(struct pipe_context *pipe, ps->en = 0; - if (cso->max_anisotropy >= 8.0) { + if (cso->max_anisotropy >= 8) { ps->en |= NV34TCL_TX_ENABLE_ANISO_8X; } else - if (cso->max_anisotropy >= 4.0) { + if (cso->max_anisotropy >= 4) { ps->en |= NV34TCL_TX_ENABLE_ANISO_4X; } else - if (cso->max_anisotropy >= 2.0) { + if (cso->max_anisotropy >= 2) { ps->en |= NV34TCL_TX_ENABLE_ANISO_2X; } diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c index d068be6243..2073bf0735 100644 --- a/src/gallium/drivers/nv40/nv40_state.c +++ b/src/gallium/drivers/nv40/nv40_state.c @@ -132,26 +132,26 @@ nv40_sampler_state_create(struct pipe_context *pipe, (wrap_mode(cso->wrap_r) << NV40TCL_TEX_WRAP_R_SHIFT)); ps->en = 0; - if (cso->max_anisotropy >= 2.0) { + if (cso->max_anisotropy >= 2) { /* no idea, binary driver sets it, works without it.. meh.. */ ps->wrap |= (1 << 5); - if (cso->max_anisotropy >= 16.0) { + if (cso->max_anisotropy >= 16) { ps->en |= NV40TCL_TEX_ENABLE_ANISO_16X; } else - if (cso->max_anisotropy >= 12.0) { + if (cso->max_anisotropy >= 12) { ps->en |= NV40TCL_TEX_ENABLE_ANISO_12X; } else - if (cso->max_anisotropy >= 10.0) { + if (cso->max_anisotropy >= 10) { ps->en |= NV40TCL_TEX_ENABLE_ANISO_10X; } else - if (cso->max_anisotropy >= 8.0) { + if (cso->max_anisotropy >= 8) { ps->en |= NV40TCL_TEX_ENABLE_ANISO_8X; } else - if (cso->max_anisotropy >= 6.0) { + if (cso->max_anisotropy >= 6) { ps->en |= NV40TCL_TEX_ENABLE_ANISO_6X; } else - if (cso->max_anisotropy >= 4.0) { + if (cso->max_anisotropy >= 4) { ps->en |= NV40TCL_TEX_ENABLE_ANISO_4X; } else { ps->en |= NV40TCL_TEX_ENABLE_ANISO_2X; diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index 05d519a2f9..7d304907b6 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -202,18 +202,18 @@ nv50_sampler_state_create(struct pipe_context *pipe, break; } - if (cso->max_anisotropy >= 16.0) + if (cso->max_anisotropy >= 16) tsc[0] |= (7 << 20); else - if (cso->max_anisotropy >= 12.0) + if (cso->max_anisotropy >= 12) tsc[0] |= (6 << 20); else { - tsc[0] |= (int)(cso->max_anisotropy * 0.5f) << 20; + tsc[0] |= (cso->max_anisotropy >> 1) << 20; - if (cso->max_anisotropy >= 4.0) + if (cso->max_anisotropy >= 4) tsc[1] |= NV50TSC_1_1_UNKN_ANISO_35; else - if (cso->max_anisotropy >= 2.0) + if (cso->max_anisotropy >= 2) tsc[1] |= NV50TSC_1_1_UNKN_ANISO_15; } diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index a6a4f99d73..8d68aa230b 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -777,7 +777,7 @@ static void* sampler->filter0 |= r300_translate_tex_filters(state->min_img_filter, state->mag_img_filter, state->min_mip_filter, - state->max_anisotropy > 1.0); + state->max_anisotropy > 0); /* Unfortunately, r300-r500 don't support floating-point mipmap lods. */ /* We must pass these to the emit function to clamp them properly. */ diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 5df6815221..779ba2c7be 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -312,15 +312,15 @@ static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip, return retval; } -static INLINE uint32_t r300_anisotropy(float max_aniso) +static INLINE uint32_t r300_anisotropy(unsigned max_aniso) { - if (max_aniso >= 16.0f) { + if (max_aniso >= 16) { return R300_TX_MAX_ANISO_16_TO_1; - } else if (max_aniso >= 8.0f) { + } else if (max_aniso >= 8) { return R300_TX_MAX_ANISO_8_TO_1; - } else if (max_aniso >= 4.0f) { + } else if (max_aniso >= 4) { return R300_TX_MAX_ANISO_4_TO_1; - } else if (max_aniso >= 2.0f) { + } else if (max_aniso >= 2) { return R300_TX_MAX_ANISO_2_TO_1; } else { return R300_TX_MAX_ANISO_1_TO_1; diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c index b70081343d..2a9adfbb06 100644 --- a/src/gallium/drivers/svga/svga_pipe_sampler.c +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -102,8 +102,8 @@ svga_create_sampler_state(struct pipe_context *pipe, cso->mipfilter = translate_mip_filter(sampler->min_mip_filter); cso->magfilter = translate_img_filter( sampler->mag_img_filter ); cso->minfilter = translate_img_filter( sampler->min_img_filter ); - cso->aniso_level = MAX2( (unsigned) sampler->max_anisotropy, 1 ); - if(cso->aniso_level != 1) + cso->aniso_level = MAX2( sampler->max_anisotropy, 1 ); + if(sampler->max_anisotropy) cso->magfilter = cso->minfilter = SVGA3D_TEX_FILTER_ANISOTROPIC; cso->lod_bias = sampler->lod_bias; cso->addressu = translate_wrap_mode(sampler->wrap_s); diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c index 62fa09accf..a4c7255126 100644 --- a/src/gallium/drivers/trace/tr_dump_state.c +++ b/src/gallium/drivers/trace/tr_dump_state.c @@ -435,11 +435,11 @@ void trace_dump_sampler_state(const struct pipe_sampler_state *state) trace_dump_member(uint, state, compare_mode); trace_dump_member(uint, state, compare_func); trace_dump_member(bool, state, normalized_coords); + trace_dump_member(uint, state, max_anisotropy); trace_dump_member(float, state, lod_bias); trace_dump_member(float, state, min_lod); trace_dump_member(float, state, max_lod); trace_dump_member_array(float, state, border_color); - trace_dump_member(float, state, max_anisotropy); trace_dump_struct_end(); } diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 23748acbdc..5ac5c87813 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -281,10 +281,10 @@ struct pipe_sampler_state unsigned compare_mode:1; /**< PIPE_TEX_COMPARE_x */ unsigned compare_func:3; /**< PIPE_FUNC_x */ unsigned normalized_coords:1; /**< Are coords normalized to [0,1]? */ + unsigned max_anisotropy:6; float lod_bias; /**< LOD/lambda bias */ float min_lod, max_lod; /**< LOD clamp range, after bias */ float border_color[4]; - float max_anisotropy; }; diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 9d63f1c6ab..a8262a5e1a 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -211,7 +211,7 @@ update_samplers(struct st_context *st) teximg ? teximg->_BaseFormat : GL_RGBA, sampler->border_color); - sampler->max_anisotropy = texobj->MaxAnisotropy; + sampler->max_anisotropy = (texobj->MaxAnisotropy == 1.0 ? 0 : (GLuint)texobj->MaxAnisotropy); /* only care about ARB_shadow, not SGI shadow */ if (texobj->CompareMode == GL_COMPARE_R_TO_TEXTURE) { -- cgit v1.2.3