From 93deede760e5a1309f1b948d91eae3d27f59ed97 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Jun 2008 10:28:00 -0600 Subject: gallium: check if sampler->max_lod < sampler->min_lod --- src/mesa/state_tracker/st_atom_sampler.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 10283d31a19..9abd0b3531d 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -153,6 +153,15 @@ update_samplers(struct st_context *st) sampler->min_lod = MAX2(0.0f, texobj->MinLod); sampler->max_lod = MIN2(texobj->MaxLevel - texobj->BaseLevel, texobj->MaxLod); + if (sampler->max_lod < sampler->min_lod) { + /* The GL spec doesn't seem to specify what to do in this case. + * Swap the values. + */ + float tmp = sampler->max_lod; + sampler->max_lod = sampler->min_lod; + sampler->min_lod = tmp; + assert(sampler->min_lod <= sampler->max_lod); + } sampler->border_color[0] = texobj->BorderColor[RCOMP]; sampler->border_color[1] = texobj->BorderColor[GCOMP]; -- cgit v1.2.3