}
+extern void GLAPIENTRY
+_mesa_ClampColorARB(GLenum target, GLenum clamp)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (clamp != GL_TRUE && clamp != GL_FALSE && clamp != GL_FIXED_ONLY_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glClampColorARB(clamp)");
+ return;
+ }
+
+ switch (target) {
+ case GL_CLAMP_VERTEX_COLOR_ARB:
+ ctx->Light.ClampVertexColor = clamp;
+ break;
+ case GL_CLAMP_FRAGMENT_COLOR_ARB:
+ ctx->Color.ClampFragmentColor = clamp;
+ break;
+ case GL_CLAMP_READ_COLOR_ARB:
+ ctx->Color.ClampReadColor = clamp;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glClampColorARB(target)");
+ return;
+ }
+}
+
+
+
+
/**********************************************************************/
/** \name Initialization */
/*@{*/
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 6.5.2
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
_mesa_ColorMask( GLboolean red, GLboolean green,
GLboolean blue, GLboolean alpha );
+
+extern void GLAPIENTRY
+_mesa_ClampColorARB(GLenum target, GLenum clamp);
+
+
extern void
_mesa_init_color( GLcontext * ctx );
NULL );
ctx->Light.ColorMaterialEnabled = GL_FALSE;
+ ctx->Light.ClampVertexColor = GL_TRUE;
/* Lighting miscellaneous */
ctx->_ShineTabList = MALLOC_STRUCT( gl_shine_tab );
GLenum ColorMaterialMode; /**< GL_AMBIENT, GL_DIFFUSE, etc */
GLbitfield ColorMaterialBitmask; /**< bitmask formed from Face and Mode */
GLboolean ColorMaterialEnabled;
+ GLenum ClampVertexColor;
struct gl_light EnabledList; /**< List sentinel */
GLsizei width, GLsizei height,
GLenum format, GLenum type,
GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing )
+ const struct gl_pixelstore_attrib *packing,
+ GLbitfield transferOps)
{
struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
ASSERT(y + height <= rb->Height);
/* check for things we can't handle here */
- if (ctx->_ImageTransferState ||
+ if (transferOps ||
packing->SwapBytes ||
packing->LsbFirst) {
return GL_FALSE;
const struct gl_pixelstore_attrib *packing )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const GLbitfield transferOps = ctx->_ImageTransferState;
+ GLbitfield transferOps = ctx->_ImageTransferState;
struct gl_framebuffer *fb = ctx->ReadBuffer;
struct gl_renderbuffer *rb = fb->_ColorReadBuffer;
ASSERT(rb);
+ if (type == GL_FLOAT && ((ctx->Color.ClampReadColor == GL_TRUE) ||
+ (ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB &&
+ rb->DataType != GL_FLOAT)))
+ transferOps |= IMAGE_CLAMP_BIT;
+
/* Try optimized path first */
if (fast_read_rgba_pixels(ctx, x, y, width, height,
- format, type, pixels, packing)) {
+ format, type, pixels, packing, transferOps)) {
return; /* done! */
}
/* pack the row of RGBA pixels into user's buffer */
_mesa_pack_rgba_span_float(ctx, width, rgba, format, type, dst,
- packing, ctx->_ImageTransferState);
+ packing, transferOps);
dst += dstStride;
}
}
/* Clamp color/alpha values over the range [0.0, 1.0] before storage */
- if (ctx->Color.ClampFragmentColor &&
+ if (ctx->Color.ClampFragmentColor == GL_TRUE &&
span->array->ChanType == GL_FLOAT) {
clamp_colors(span);
}