mesa: clamp texture border color if ARB_texture_float is unsupported
authorMarek Olšák <maraeo@gmail.com>
Sat, 26 Mar 2011 12:06:22 +0000 (13:06 +0100)
committerMarek Olšák <maraeo@gmail.com>
Tue, 29 Mar 2011 10:50:27 +0000 (12:50 +0200)
ARB_texture_float disables clamping of the texture border color,
ARB_color_buffer_float only modifies clamping of the glGet query.

src/mesa/main/texparam.c

index adb6bcebfabf0ba614fa6f502c13945142384c8b..34b6addb9b0ea40fcf9d4a9a405c1bc94e40e8f6 100644 (file)
@@ -534,10 +534,18 @@ set_tex_parameterf(struct gl_context *ctx,
 
    case GL_TEXTURE_BORDER_COLOR:
       flush(ctx);
-      texObj->BorderColor.f[RCOMP] = params[0];
-      texObj->BorderColor.f[GCOMP] = params[1];
-      texObj->BorderColor.f[BCOMP] = params[2];
-      texObj->BorderColor.f[ACOMP] = params[3];
+      /* ARB_texture_float disables clamping */
+      if (ctx->Extensions.ARB_texture_float) {
+         texObj->BorderColor.f[RCOMP] = params[0];
+         texObj->BorderColor.f[GCOMP] = params[1];
+         texObj->BorderColor.f[BCOMP] = params[2];
+         texObj->BorderColor.f[ACOMP] = params[3];
+      } else {
+         texObj->BorderColor.f[RCOMP] = CLAMP(params[0], 0.0F, 1.0F);
+         texObj->BorderColor.f[GCOMP] = CLAMP(params[1], 0.0F, 1.0F);
+         texObj->BorderColor.f[BCOMP] = CLAMP(params[2], 0.0F, 1.0F);
+         texObj->BorderColor.f[ACOMP] = CLAMP(params[3], 0.0F, 1.0F);
+      }
       return GL_TRUE;
 
    default: