diff options
author | Eric Anholt <[email protected]> | 2017-11-02 12:49:46 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2017-11-07 09:40:25 -0800 |
commit | eeb9e80272cb0dd795c4197962f2af3398747dda (patch) | |
tree | 6cca15d9f7b2ad5772da3cc89f5af4dbc23f9880 /src/gallium/drivers/vc5 | |
parent | 521e1d0275e7b237ee676e0426be1b734f270944 (diff) |
broadcom/vc5: Shift the min/max lod fields by the BASE_LEVEL.
The lod clamping is what limits you between base and last level, and the
base level field is just there to help decide where the min/mag change
happens.
Fixes tex-miplevel-selection GL2:texture()
Diffstat (limited to 'src/gallium/drivers/vc5')
-rw-r--r-- | src/gallium/drivers/vc5/vc5_emit.c | 18 | ||||
-rw-r--r-- | src/gallium/drivers/vc5/vc5_state.c | 1 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/gallium/drivers/vc5/vc5_emit.c b/src/gallium/drivers/vc5/vc5_emit.c index 24682d90669..c0b5d541978 100644 --- a/src/gallium/drivers/vc5/vc5_emit.c +++ b/src/gallium/drivers/vc5/vc5_emit.c @@ -130,9 +130,21 @@ emit_one_texture(struct vc5_context *vc5, struct vc5_texture_stateobj *stage_tex .border_color_blue = swizzled_border_color(psampler, sview, 2), .border_color_alpha = swizzled_border_color(psampler, sview, 3), - /* XXX: Disable min/maxlod for txf */ - .max_level_of_detail = MIN2(MIN2(psampler->max_lod, - VC5_MAX_MIP_LEVELS), + /* In the normal texturing path, the LOD gets clamped between + * min/max, and the base_level field (set in the sampler view + * from first_level) only decides where the min/mag switch + * happens, so we need to use the LOD clamps to keep us + * between min and max. + * + * For txf, the LOD clamp is still used, despite GL not + * wanting that. We will need to have a separate + * TEXTURE_SHADER_STATE that ignores psview->min/max_lod to + * support txf properly. + */ + .min_level_of_detail = (psview->u.tex.first_level + + MAX2(psampler->min_lod, 0)), + .max_level_of_detail = MIN2(psview->u.tex.first_level + + psampler->max_lod, psview->u.tex.last_level), .texture_base_pointer = cl_address(rsc->bo, diff --git a/src/gallium/drivers/vc5/vc5_state.c b/src/gallium/drivers/vc5/vc5_state.c index d8855535491..dc0ee12260b 100644 --- a/src/gallium/drivers/vc5/vc5_state.c +++ b/src/gallium/drivers/vc5/vc5_state.c @@ -524,7 +524,6 @@ vc5_create_sampler_state(struct pipe_context *pctx, } v3dx_pack(&so->texture_shader_state, TEXTURE_SHADER_STATE, tex) { - tex.min_level_of_detail = MAX2(cso->min_lod, 0.0); tex.depth_compare_function = cso->compare_func; tex.fixed_bias = cso->lod_bias; } |