summaryrefslogtreecommitdiff
path: root/src/mesa/main/texstore.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-11-23 23:29:42 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-11-23 23:29:42 +0000
commit6b6c96bdeb580052cb9fa3831f1cd574f0e85728 (patch)
treefb0755df430e555e6ab30422bfb399ccc1266a0d /src/mesa/main/texstore.c
parentba6274126180368cf108b3afff2dbb0a0b34e8b5 (diff)
update _mesa_store_teximageXd() comments and minor code clean-up
Diffstat (limited to 'src/mesa/main/texstore.c')
-rw-r--r--src/mesa/main/texstore.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 36bb9578f9..ef0a14e578 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -1897,6 +1897,7 @@ unmap_teximage_pbo(GLcontext *ctx, const struct gl_pixelstore_attrib *unpack)
/*
* This is the software fallback for Driver.TexImage1D()
* and Driver.CopyTexImage1D().
+ * \sa _mesa_store_teximage2d()
*/
void
_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
@@ -1936,10 +1937,13 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
pixels = validate_pbo_teximage(ctx, 1, width, 1, 1, format, type, pixels,
packing, "glTexImage1D");
- if (!pixels)
+ if (!pixels) {
+ /* Note: we check for a NULL image pointer here, _after_ we allocated
+ * memory for the texture. That's what the GL spec calls for.
+ */
return;
-
- {
+ }
+ else {
const GLint dstRowStride = 0, dstImageStride = 0;
GLboolean success;
ASSERT(texImage->TexFormat->StoreImage);
@@ -1966,13 +1970,19 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
}
-/*
+/**
* This is the software fallback for Driver.TexImage2D()
* and Driver.CopyTexImage2D().
+ * We store the image in heap memory. We know nothing about on-board
+ * VRAM here. But since most DRI drivers rely on keeping a copy of all
+ * textures in main memory, this routine will typically be used by
+ * hardware drivers too.
+ *
* Reasons why a driver might override this function:
- * - Special memory allocation needs
- * - Unusual row/image strides
+ * - Special memory allocation needs (VRAM, AGP, etc)
+ * - Unusual row/image strides or padding
* - Special housekeeping
+ * - Using VRAM-based Pixel Buffer Objects
*/
void
_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
@@ -2015,10 +2025,13 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
pixels = validate_pbo_teximage(ctx, 2, width, height, 1, format, type,
pixels, packing, "glTexImage2D");
- if (!pixels)
+ if (!pixels) {
+ /* Note: we check for a NULL image pointer here, _after_ we allocated
+ * memory for the texture. That's what the GL spec calls for.
+ */
return;
-
- {
+ }
+ else {
GLint dstRowStride, dstImageStride = 0;
GLboolean success;
if (texImage->IsCompressed) {
@@ -2052,9 +2065,10 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
-/*
+/**
* This is the software fallback for Driver.TexImage3D()
* and Driver.CopyTexImage3D().
+ * \sa _mesa_store_teximage2d()
*/
void
_mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
@@ -2091,11 +2105,13 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
pixels = validate_pbo_teximage(ctx, 3, width, height, depth, format, type,
pixels, packing, "glTexImage3D");
- if (!pixels)
+ if (!pixels) {
+ /* Note: we check for a NULL image pointer here, _after_ we allocated
+ * memory for the texture. That's what the GL spec calls for.
+ */
return;
-
- /* unpack image, apply transfer ops and store in texImage->Data */
- {
+ }
+ else {
GLint dstRowStride, dstImageStride;
GLboolean success;
if (texImage->IsCompressed) {