From: Brian Paul Date: Tue, 17 Jun 2008 16:28:00 +0000 (-0600) Subject: gallium: check if sampler->max_lod < sampler->min_lod X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=93deede760e5a1309f1b948d91eae3d27f59ed97;p=mesa.git gallium: check if sampler->max_lod < sampler->min_lod --- 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];