st/mesa: fix integer texture border color for some formats (v2)

And the clear color too, though that may be an issue only with GL_RGB if it's
actually RGBA in the driver.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>

v2: The types of st_translate_color parameters were changed to gl_color_union
    and pipe_color_union as per Brian's comment.
This commit is contained in:
Marek Olšák
2012-10-15 03:55:23 +02:00
parent 1ec12c53ba
commit 2bbd307fa6
4 changed files with 112 additions and 48 deletions

View File

@@ -34,6 +34,7 @@
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/glformats.h"
#include "main/samplerobj.h"
#include "main/texobj.h"
@@ -172,12 +173,17 @@ convert_sampler(struct st_context *st,
msamp->BorderColor.ui[2] ||
msamp->BorderColor.ui[3]) {
struct gl_texture_image *teximg;
GLboolean is_integer = GL_FALSE;
teximg = texobj->Image[0][texobj->BaseLevel];
st_translate_color(msamp->BorderColor.f,
teximg ? teximg->_BaseFormat : GL_RGBA,
sampler->border_color.f);
if (teximg) {
is_integer = _mesa_is_enum_format_integer(teximg->InternalFormat);
}
st_translate_color(&msamp->BorderColor,
&sampler->border_color,
teximg ? teximg->_BaseFormat : GL_RGBA, is_integer);
}
sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ?