#endif
+#include "errors.h"
#include "glheader.h"
-#include "colormac.h"
#include "enums.h"
#include "image.h"
#include "imports.h"
break;
default:
- _mesa_problem(NULL, "bad srcType in extract_uint_indexes");
- return;
+ unreachable("bad srcType in extract_uint_indexes");
}
}
-static inline GLuint
-clamp_float_to_uint(GLfloat f)
-{
- return f < 0.0F ? 0 : F_TO_I(f);
-}
-
-
-static inline GLuint
-clamp_half_to_uint(GLhalfARB h)
-{
- GLfloat f = _mesa_half_to_float(h);
- return f < 0.0F ? 0 : F_TO_I(f);
-}
-
-
/*
* Unpack a row of stencil data from a client buffer according to
* the pixel unpacking parameters.
}
break;
default:
- _mesa_problem(ctx, "bad dstType in _mesa_unpack_stencil_span");
+ unreachable("bad dstType in _mesa_unpack_stencil_span");
}
free(indexes);
}
break;
default:
- _mesa_problem(ctx, "bad type in _mesa_pack_index_span");
+ unreachable("bad type in _mesa_pack_index_span");
}
free(stencil);
* back to an int type can introduce errors that will show up as
* artifacts in things like depth peeling which uses glCopyTexImage.
*/
- if (ctx->Pixel.DepthScale == 1.0 && ctx->Pixel.DepthBias == 0.0) {
+ if (ctx->Pixel.DepthScale == 1.0F && ctx->Pixel.DepthBias == 0.0F) {
if (srcType == GL_UNSIGNED_INT && dstType == GL_UNSIGNED_SHORT) {
const GLuint *src = (const GLuint *) source;
GLushort *dst = (GLushort *) dest;
case GL_UNSIGNED_INT_24_8_EXT: /* GL_EXT_packed_depth_stencil */
if (dstType == GL_UNSIGNED_INT_24_8_EXT &&
depthMax == 0xffffff &&
- ctx->Pixel.DepthScale == 1.0 &&
- ctx->Pixel.DepthBias == 0.0) {
+ ctx->Pixel.DepthScale == 1.0F &&
+ ctx->Pixel.DepthBias == 0.0F) {
const GLuint *src = (const GLuint *) source;
GLuint *zValues = (GLuint *) dest;
GLuint i;
{
const GLfloat scale = ctx->Pixel.DepthScale;
const GLfloat bias = ctx->Pixel.DepthBias;
- if (scale != 1.0 || bias != 0.0) {
+ if (scale != 1.0F || bias != 0.0F) {
GLuint i;
for (i = 0; i < n; i++) {
depthValues[i] = depthValues[i] * scale + bias;
if (needClamp) {
GLuint i;
for (i = 0; i < n; i++) {
- depthValues[i] = (GLfloat)CLAMP(depthValues[i], 0.0, 1.0);
+ depthValues[i] = CLAMP(depthValues[i], 0.0F, 1.0F);
}
}
return;
}
- if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) {
+ if (ctx->Pixel.DepthScale != 1.0F || ctx->Pixel.DepthBias != 0.0F) {
memcpy(depthCopy, depthSpan, n * sizeof(GLfloat));
_mesa_scale_and_bias_depth(ctx, n, depthCopy);
depthSpan = depthCopy;
}
}
break;
+ case GL_UNSIGNED_INT_24_8:
+ {
+ const GLdouble scale = (GLdouble) 0xffffff;
+ GLuint *dst = (GLuint *) dest;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLuint z = (GLuint) (depthSpan[i] * scale);
+ assert(z <= 0xffffff);
+ dst[i] = (z << 8);
+ }
+ if (dstPacking->SwapBytes) {
+ _mesa_swap4( (GLuint *) dst, n );
+ }
+ break;
+ }
case GL_UNSIGNED_INT:
{
GLuint *dst = (GLuint *) dest;
}
break;
default:
- _mesa_problem(ctx, "bad type in _mesa_pack_depth_span");
+ unreachable("bad type in _mesa_pack_depth_span()");
}
free(depthCopy);
return;
}
- if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) {
+ if (ctx->Pixel.DepthScale != 1.0F || ctx->Pixel.DepthBias != 0.0F) {
memcpy(depthCopy, depthVals, n * sizeof(GLfloat));
_mesa_scale_and_bias_depth(ctx, n, depthCopy);
depthVals = depthCopy;