summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-04-06 04:23:58 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-04-06 04:23:58 +0000
commita9bcf751030895494fc098f8d0ff56b2496bd993 (patch)
treed737cac7b38fa8cdc805d44aea838eae67bd7307 /src/mesa/main
parent762c3618f52ef5033844092074c63eee545500fa (diff)
Replace MESA_FORMAT_DEPTH_COMPONENT_FLOAT32 with 32-bit integer format.
This allows render to depth texture (we don't support floating pt. Z buffers). Rename MESA_FORMAT_DEPTH_COMPONENT16/32 as MESA_FORMAT_Z16/32. Software fallback for glCopyTexImage now uses integer temporary image instead of float, eliminates a lot of float/int conversions.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/texcompress_fxt1.c2
-rw-r--r--src/mesa/main/texcompress_s3tc.c4
-rw-r--r--src/mesa/main/texformat.c108
-rw-r--r--src/mesa/main/texformat.h22
-rw-r--r--src/mesa/main/texformat_tmp.h44
-rw-r--r--src/mesa/main/texrender.c77
-rw-r--r--src/mesa/main/texstore.c34
-rw-r--r--src/mesa/main/texstore.h8
8 files changed, 192 insertions, 107 deletions
diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
index 44b450fd56..a3d5db93fc 100644
--- a/src/mesa/main/texcompress_fxt1.c
+++ b/src/mesa/main/texcompress_fxt1.c
@@ -243,6 +243,7 @@ const struct gl_texture_format _mesa_texformat_rgb_fxt1 = {
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgb_fxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
+ NULL /* StoreTexel */
};
const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
@@ -266,6 +267,7 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgba_fxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
+ NULL /* StoreTexel */
};
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
index 881da83b0f..5a6685e0f3 100644
--- a/src/mesa/main/texcompress_s3tc.c
+++ b/src/mesa/main/texcompress_s3tc.c
@@ -491,6 +491,7 @@ const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
+ NULL /* StoreTexel */
};
const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
@@ -514,6 +515,7 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
+ NULL /* StoreTexel */
};
const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
@@ -537,6 +539,7 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
+ NULL /* StoreTexel */
};
const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
@@ -560,4 +563,5 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
+ NULL /* StoreTexel */
};
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 5ef9e46df2..792bfbc1e4 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2005 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"),
@@ -79,6 +79,11 @@ static void fetch_null_texelf( const struct gl_texture_image *texImage,
static void store_null_texel(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
+ (void) texImage;
+ (void) i;
+ (void) j;
+ (void) k;
+ (void) texel;
/* no-op */
}
@@ -245,53 +250,6 @@ const struct gl_texture_format _mesa_texformat_intensity = {
store_texel_intensity /* StoreTexel */
};
-const struct gl_texture_format _mesa_texformat_depth_component_float32 = {
- MESA_FORMAT_DEPTH_COMPONENT_FLOAT32, /* MesaFormat */
- GL_DEPTH_COMPONENT, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 0, /* RedBits */
- 0, /* GreenBits */
- 0, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- sizeof(GLfloat) * 8, /* DepthBits */
- sizeof(GLfloat) * 8, /* StencilBits */
- sizeof(GLfloat), /* TexelBytes */
- _mesa_texstore_depth_component_float32,/* StoreTexImageFunc */
- NULL, /* FetchTexel1D */
- NULL, /* FetchTexel1D */
- NULL, /* FetchTexel1D */
- fetch_texel_1d_f_depth_component_f32,/* FetchTexel1Df */
- fetch_texel_2d_f_depth_component_f32,/* FetchTexel2Df */
- fetch_texel_3d_f_depth_component_f32,/* FetchTexel3Df */
- store_texel_depth_component_f32 /* StoreTexel */
-};
-
-const struct gl_texture_format _mesa_texformat_depth_component16 = {
- MESA_FORMAT_DEPTH_COMPONENT16, /* MesaFormat */
- GL_DEPTH_COMPONENT, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 0, /* RedBits */
- 0, /* GreenBits */
- 0, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- sizeof(GLushort) * 8, /* DepthBits */
- sizeof(GLushort) * 8, /* StencilBits */
- sizeof(GLushort), /* TexelBytes */
- _mesa_texstore_depth_component16, /* StoreTexImageFunc */
- NULL, /* FetchTexel1D */
- NULL, /* FetchTexel1D */
- NULL, /* FetchTexel1D */
- fetch_texel_1d_f_depth_component16, /* FetchTexel1Df */
- fetch_texel_2d_f_depth_component16, /* FetchTexel2Df */
- fetch_texel_3d_f_depth_component16, /* FetchTexel3Df */
- store_texel_depth_component16 /* StoreTexel */
-};
const struct gl_texture_format _mesa_texformat_rgba_float32 = {
MESA_FORMAT_RGBA_FLOAT32, /* MesaFormat */
@@ -1117,6 +1075,54 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = {
store_texel_z24_s8 /* StoreTexel */
};
+const struct gl_texture_format _mesa_texformat_z16 = {
+ MESA_FORMAT_Z16, /* MesaFormat */
+ GL_DEPTH_COMPONENT, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ sizeof(GLushort) * 8, /* DepthBits */
+ 0, /* StencilBits */
+ sizeof(GLushort), /* TexelBytes */
+ _mesa_texstore_z16, /* StoreTexImageFunc */
+ NULL, /* FetchTexel1D */
+ NULL, /* FetchTexel1D */
+ NULL, /* FetchTexel1D */
+ fetch_texel_1d_f_z16, /* FetchTexel1Df */
+ fetch_texel_2d_f_z16, /* FetchTexel2Df */
+ fetch_texel_3d_f_z16, /* FetchTexel3Df */
+ store_texel_z16 /* StoreTexel */
+};
+
+const struct gl_texture_format _mesa_texformat_z32 = {
+ MESA_FORMAT_Z32, /* MesaFormat */
+ GL_DEPTH_COMPONENT, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ sizeof(GLuint) * 8, /* DepthBits */
+ 0, /* StencilBits */
+ sizeof(GLuint), /* TexelBytes */
+ _mesa_texstore_z32, /* StoreTexImageFunc */
+ NULL, /* FetchTexel1D */
+ NULL, /* FetchTexel1D */
+ NULL, /* FetchTexel1D */
+ fetch_texel_1d_f_z32, /* FetchTexel1Df */
+ fetch_texel_2d_f_z32, /* FetchTexel2Df */
+ fetch_texel_3d_f_z32, /* FetchTexel3Df */
+ store_texel_z32 /* StoreTexel */
+};
+
/*@}*/
@@ -1264,9 +1270,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT24_SGIX:
case GL_DEPTH_COMPONENT32_SGIX:
- return &_mesa_texformat_depth_component_float32;
+ return &_mesa_texformat_z32;
case GL_DEPTH_COMPONENT16_SGIX:
- return &_mesa_texformat_depth_component16;
+ return &_mesa_texformat_z16;
default:
; /* fallthrough */
}
diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h
index 63f524bbe1..b7e5fc27dc 100644
--- a/src/mesa/main/texformat.h
+++ b/src/mesa/main/texformat.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2004 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"),
@@ -84,6 +84,8 @@ enum _format {
MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */
MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */
MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
+ MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */
+ MESA_FORMAT_Z32, /*ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
/*@}*/
/**
@@ -118,14 +120,6 @@ enum _format {
/*@}*/
/**
- * Depth textures
- */
- /*@{*/
- MESA_FORMAT_DEPTH_COMPONENT_FLOAT32,
- MESA_FORMAT_DEPTH_COMPONENT16,
- /*@}*/
-
- /**
* \name Floating point texture formats.
*/
/*@{*/
@@ -155,12 +149,6 @@ extern const struct gl_texture_format _mesa_texformat_luminance_alpha;
extern const struct gl_texture_format _mesa_texformat_intensity;
/*@}*/
-/** Depth textures */
-/*@{*/
-extern const struct gl_texture_format _mesa_texformat_depth_component_float32;
-extern const struct gl_texture_format _mesa_texformat_depth_component16;
-/*@}*/
-
/** Floating point texture formats */
/*@{*/
extern const struct gl_texture_format _mesa_texformat_rgba_float32;
@@ -199,6 +187,8 @@ extern const struct gl_texture_format _mesa_texformat_l8;
extern const struct gl_texture_format _mesa_texformat_i8;
extern const struct gl_texture_format _mesa_texformat_ci8;
extern const struct gl_texture_format _mesa_texformat_z24_s8;
+extern const struct gl_texture_format _mesa_texformat_z16;
+extern const struct gl_texture_format _mesa_texformat_z32;
/*@}*/
/** \name YCbCr formats */
diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h
index cc6ed1cc93..1c41278059 100644
--- a/src/mesa/main/texformat_tmp.h
+++ b/src/mesa/main/texformat_tmp.h
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
@@ -234,46 +234,46 @@ static void store_texel_intensity(struct gl_texture_image *texImage,
#endif
-/* MESA_FORMAT_DEPTH_COMPONENT_F32 *******************************************/
+/* MESA_FORMAT_Z32 ***********************************************************/
-/* Fetch depth texel from 1D, 2D or 3D float32 DEPTH texture,
+/* Fetch depth texel from 1D, 2D or 3D 32-bit depth texture,
* returning 1 GLfloat.
* Note: no GLchan version of this function.
*/
-static void FETCH(f_depth_component_f32)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void FETCH(f_z32)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
{
- const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
- texel[0] = src[0];
+ const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ texel[0] = src[0] * (1.0F / 0xffffffff);
}
#if DIM == 3
-static void store_texel_depth_component_f32(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
+static void store_texel_z32(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
{
- const GLfloat *depth = (const GLfloat *) texel;
- GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
+ const GLuint *depth = (const GLuint *) texel;
+ GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
dst[0] = *depth;
}
#endif
-/* MESA_FORMAT_DEPTH_COMPONENT16 *********************************************/
+/* MESA_FORMAT_Z16 ***********************************************************/
-/* Fetch depth texel from 1D, 2D or 3D float32 DEPTH texture,
+/* Fetch depth texel from 1D, 2D or 3D 16-bit depth texture,
* returning 1 GLfloat.
* Note: no GLchan version of this function.
*/
-static void FETCH(f_depth_component16)(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void FETCH(f_z16)(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[0] = src[0] * (1.0F / 65535.0F);
}
#if DIM == 3
-static void store_texel_depth_component16(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
+static void store_texel_z16(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
{
const GLushort *depth = (const GLushort *) texel;
GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -1211,6 +1211,11 @@ static void FETCH(ycbcr)( const struct gl_texture_image *texImage,
static void store_texel_ycbcr(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
+ (void) texImage;
+ (void) i;
+ (void) j;
+ (void) k;
+ (void) texel;
/* XXX to do */
}
#endif
@@ -1253,6 +1258,11 @@ static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage,
static void store_texel_ycbcr_rev(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
+ (void) texImage;
+ (void) i;
+ (void) j;
+ (void) k;
+ (void) texel;
/* XXX to do */
}
#endif
diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c
index db720cef6e..32e7b575f0 100644
--- a/src/mesa/main/texrender.c
+++ b/src/mesa/main/texrender.c
@@ -1,6 +1,7 @@
#include "context.h"
#include "fbobject.h"
+#include "texformat.h"
#include "texrender.h"
#include "renderbuffer.h"
@@ -43,6 +44,23 @@ texture_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
trb->TexImage->FetchTexelc(trb->TexImage, x + i, y, z, rgbaOut + 4 * i);
}
}
+ else if (rb->DataType == GL_UNSIGNED_INT) {
+ GLuint *zValues = (GLuint *) values;
+ /*
+ const GLdouble scale = (GLdouble) 0xffffffff;
+ */
+ for (i = 0; i < count; i++) {
+ GLfloat flt;
+ trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
+#if 0
+ /* this should work, but doesn't (overflow due to low precision) */
+ zValues[i] = (GLuint) (flt * scale);
+#else
+ /* temporary hack */
+ zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
+#endif
+ }
+ }
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
@@ -73,6 +91,18 @@ texture_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
rgbaOut + 4 * i);
}
}
+ else if (rb->DataType == GL_UNSIGNED_INT) {
+ GLuint *zValues = (GLuint *) values;
+ for (i = 0; i < count; i++) {
+ GLfloat flt;
+ trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i], z, &flt);
+#if 0
+ zValues[i] = (GLuint) (flt * 0xffffffff);
+#else
+ zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
+#endif
+ }
+ }
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
@@ -108,6 +138,14 @@ texture_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
rgba += 4;
}
}
+ else if (rb->DataType == GL_UNSIGNED_INT) {
+ const GLuint *zValues = (const GLuint *) values;
+ for (i = 0; i < count; i++) {
+ if (!mask || mask[i]) {
+ trb->Store(trb->TexImage, x + i, y, z, zValues + i);
+ }
+ }
+ }
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
const GLuint *zValues = (const GLuint *) values;
for (i = 0; i < count; i++) {
@@ -140,6 +178,14 @@ texture_put_mono_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
}
}
}
+ else if (rb->DataType == GL_UNSIGNED_INT) {
+ const GLuint zValue = *((const GLuint *) value);
+ for (i = 0; i < count; i++) {
+ if (!mask || mask[i]) {
+ trb->Store(trb->TexImage, x + i, y, z, &zValue);
+ }
+ }
+ }
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
const GLuint zValue = *((const GLuint *) value);
const GLfloat flt = (zValue >> 8) * (1.0 / 0xffffff);
@@ -174,6 +220,14 @@ texture_put_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
rgba += 4;
}
}
+ else if (rb->DataType == GL_UNSIGNED_INT) {
+ const GLuint *zValues = (const GLuint *) values;
+ for (i = 0; i < count; i++) {
+ if (!mask || mask[i]) {
+ trb->Store(trb->TexImage, x[i], y[i], z, zValues + i);
+ }
+ }
+ }
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
const GLuint *zValues = (const GLuint *) values;
for (i = 0; i < count; i++) {
@@ -207,6 +261,14 @@ texture_put_mono_values(GLcontext *ctx, struct gl_renderbuffer *rb,
}
}
}
+ else if (rb->DataType == GL_UNSIGNED_INT) {
+ const GLuint zValue = *((const GLuint *) value);
+ for (i = 0; i < count; i++) {
+ if (!mask || mask[i]) {
+ trb->Store(trb->TexImage, x[i], y[i], z, &zValue);
+ }
+ }
+ }
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
const GLuint zValue = *((const GLuint *) value);
const GLfloat flt = (zValue >> 8) * (1.0 / 0xffffff);
@@ -279,6 +341,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att)
struct texture_renderbuffer *trb
= (struct texture_renderbuffer *) att->Renderbuffer;
+ (void) ctx;
ASSERT(trb);
trb->TexImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
@@ -293,13 +356,17 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att)
trb->Base.Height = trb->TexImage->Height;
trb->Base.InternalFormat = trb->TexImage->InternalFormat;
/* XXX may need more special cases here */
- if (trb->TexImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) {
+ if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z24_S8) {
trb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
}
- else if (trb->TexImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT) {
+ else if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z16) {
trb->Base._ActualFormat = GL_DEPTH_COMPONENT;
- trb->Base.DataType = GL_FLOAT;
+ trb->Base.DataType = GL_UNSIGNED_SHORT;
+ }
+ else if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z32) {
+ trb->Base._ActualFormat = GL_DEPTH_COMPONENT;
+ trb->Base.DataType = GL_UNSIGNED_INT;
}
else {
trb->Base._ActualFormat = trb->TexImage->InternalFormat;
@@ -345,6 +412,8 @@ _mesa_render_texture(GLcontext *ctx,
struct gl_framebuffer *fb,
struct gl_renderbuffer_attachment *att)
{
+ (void) fb;
+
if (!att->Renderbuffer) {
wrap_texture(ctx, att);
}
@@ -360,4 +429,6 @@ _mesa_finish_render_texture(GLcontext *ctx,
/* The renderbuffer texture wrapper will get deleted by the
* normal mechanism for deleting renderbuffers.
*/
+ (void) ctx;
+ (void) att;
}
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 717551d716..fab0fad3b4 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
@@ -848,20 +848,21 @@ _mesa_texstore_rgba(GLcontext *ctx, GLuint dims,
/**
- * Store a floating point depth component texture image.
+ * Store a 32-bit integer depth component texture image.
*/
GLboolean
-_mesa_texstore_depth_component_float32(STORE_PARAMS)
+_mesa_texstore_z32(STORE_PARAMS)
{
+ const GLfloat depthScale = (GLfloat) 0xffffffff;
(void) dims;
- ASSERT(dstFormat == &_mesa_texformat_depth_component_float32);
- ASSERT(dstFormat->TexelBytes == sizeof(GLfloat));
+ ASSERT(dstFormat == &_mesa_texformat_z32);
+ ASSERT(dstFormat->TexelBytes == sizeof(GLuint));
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
baseInternalFormat == GL_DEPTH_COMPONENT &&
srcFormat == GL_DEPTH_COMPONENT &&
- srcType == GL_FLOAT) {
+ srcType == GL_UNSIGNED_INT) {
/* simple memcpy path */
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
@@ -882,8 +883,8 @@ _mesa_texstore_depth_component_float32(STORE_PARAMS)
const GLvoid *src = _mesa_image_address(dims, srcPacking,
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
_mesa_unpack_depth_span(ctx, srcWidth,
- GL_FLOAT, (GLfloat *) dstRow, 1.0F,
- srcType, src, srcPacking);
+ GL_UNSIGNED_INT, (GLuint *) dstRow,
+ depthScale, srcType, src, srcPacking);
dstRow += dstRowStride;
}
dstImage += dstImageStride;
@@ -897,10 +898,11 @@ _mesa_texstore_depth_component_float32(STORE_PARAMS)
* Store a 16-bit integer depth component texture image.
*/
GLboolean
-_mesa_texstore_depth_component16(STORE_PARAMS)
+_mesa_texstore_z16(STORE_PARAMS)
{
+ const GLfloat depthScale = 65535.0f;
(void) dims;
- ASSERT(dstFormat == &_mesa_texformat_depth_component16);
+ ASSERT(dstFormat == &_mesa_texformat_z16);
ASSERT(dstFormat->TexelBytes == sizeof(GLushort));
if (!ctx->_ImageTransferState &&
@@ -929,7 +931,7 @@ _mesa_texstore_depth_component16(STORE_PARAMS)
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
GLushort *dst16 = (GLushort *) dstRow;
_mesa_unpack_depth_span(ctx, srcWidth,
- GL_UNSIGNED_SHORT, dst16, 65535.0F,
+ GL_UNSIGNED_SHORT, dst16, depthScale,
srcType, src, srcPacking);
dstRow += dstRowStride;
}
@@ -3068,19 +3070,19 @@ do_row(const struct gl_texture_format *format, GLint srcWidth,
}
}
return;
- case MESA_FORMAT_DEPTH_COMPONENT_FLOAT32:
+ case MESA_FORMAT_Z32:
{
GLuint i, j, k;
- const GLfloat *rowA = (const GLfloat *) srcRowA;
- const GLfloat *rowB = (const GLfloat *) srcRowB;
+ const GLuint *rowA = (const GLuint *) srcRowA;
+ const GLuint *rowB = (const GLuint *) srcRowB;
GLfloat *dst = (GLfloat *) dstRow;
for (i = j = 0, k = k0; i < (GLuint) dstWidth;
i++, j += colStride, k += colStride) {
- dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F;
+ dst[i] = rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4;
}
}
return;
- case MESA_FORMAT_DEPTH_COMPONENT16:
+ case MESA_FORMAT_Z16:
{
GLuint i, j, k;
const GLushort *rowA = (const GLushort *) srcRowA;
diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h
index b71bae24eb..7fef20d7b8 100644
--- a/src/mesa/main/texstore.h
+++ b/src/mesa/main/texstore.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
- * Copyright (C) 1999-2005 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"),
@@ -53,8 +53,6 @@
extern GLboolean _mesa_texstore_rgba(STORE_PARAMS);
extern GLboolean _mesa_texstore_color_index(STORE_PARAMS);
-extern GLboolean _mesa_texstore_depth_component16(STORE_PARAMS);
-extern GLboolean _mesa_texstore_depth_component_float32(STORE_PARAMS);
extern GLboolean _mesa_texstore_rgba8888(STORE_PARAMS);
extern GLboolean _mesa_texstore_argb8888(STORE_PARAMS);
extern GLboolean _mesa_texstore_rgb888(STORE_PARAMS);
@@ -72,6 +70,8 @@ extern GLboolean _mesa_texstore_a8(STORE_PARAMS);
extern GLboolean _mesa_texstore_ci8(STORE_PARAMS);
extern GLboolean _mesa_texstore_ycbcr(STORE_PARAMS);
extern GLboolean _mesa_texstore_z24_s8(STORE_PARAMS);
+extern GLboolean _mesa_texstore_z16(STORE_PARAMS);
+extern GLboolean _mesa_texstore_z32(STORE_PARAMS);
extern GLboolean _mesa_texstore_rgba_float32(STORE_PARAMS);
extern GLboolean _mesa_texstore_rgba_float16(STORE_PARAMS);
extern GLboolean _mesa_texstore_rgb_fxt1(STORE_PARAMS);