summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Borca <[email protected]>2004-04-26 14:23:33 +0000
committerDaniel Borca <[email protected]>2004-04-26 14:23:33 +0000
commit5be4c27b28e141506578008a176f41bc1a15fa75 (patch)
tree1119ae4d966fe5e3918167869167bdd24863b390 /src
parent18514500c47ce8f30bb9cc93ab48bf55ccdb9873 (diff)
accomodate newtexstore
fixed wgl interface for fxMesa
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/glide/fxddtex.c40
-rw-r--r--src/mesa/drivers/glide/fxsetup.c142
-rw-r--r--src/mesa/drivers/glide/fxwgl.c2
-rw-r--r--src/mesa/main/texutil.c4
4 files changed, 114 insertions, 74 deletions
diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c
index b8e5d814058..6f7c9252f34 100644
--- a/src/mesa/drivers/glide/fxddtex.c
+++ b/src/mesa/drivers/glide/fxddtex.c
@@ -1320,6 +1320,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
return;
}
/* unpack image, apply transfer ops and store in tempImage */
+#if !NEWTEXSTORE
_mesa_transfer_teximage(ctx, 2, texImage->Format,
_final_texImage_TexFormat,
tempImage,
@@ -1327,6 +1328,15 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
width * texelBytes, /* dstRowStride */
0, /* dstImageStride */
format, type, pixels, packing);
+#else
+ texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
+ _final_texImage_TexFormat, tempImage,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ width * texelBytes, /* dstRowStride */
+ 0, /* dstImageStride */
+ width, height, 1,
+ format, type, pixels, packing);
+#endif
_mesa_rescale_teximage2d(texelBytes,
mml->width * texelBytes, /* dst stride */
width, height, /* src */
@@ -1337,12 +1347,22 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
else {
/* no rescaling needed */
/* unpack image, apply transfer ops and store in texImage->Data */
+#if !NEWTEXSTORE
_mesa_transfer_teximage(ctx, 2, texImage->Format,
_final_texImage_TexFormat, _final_texImage_Data,
width, height, 1, 0, 0, 0,
mml->width * texelBytes,
0, /* dstImageStride */
format, type, pixels, packing);
+#else
+ texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
+ _final_texImage_TexFormat, _final_texImage_Data,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ mml->width * texelBytes, /* dstRowStride */
+ 0, /* dstImageStride */
+ width, height, 1,
+ format, type, pixels, packing);
+#endif
}
/* now compress */
@@ -1431,6 +1451,7 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
return;
}
+#if !NEWTEXSTORE
_mesa_transfer_teximage(ctx, 2, texImage->Format,/* Tex int format */
texImage->TexFormat, /* dest format */
(GLubyte *) tempImage, /* dest */
@@ -1439,6 +1460,15 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
width * texelBytes, /* dest row stride */
0, /* dst image stride */
format, type, pixels, packing);
+#else
+ texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
+ texImage->TexFormat, tempImage,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ width * texelBytes, /* dstRowStride */
+ 0, /* dstImageStride */
+ width, height, 1,
+ format, type, pixels, packing);
+#endif
/* now rescale */
/* compute address of dest subimage within the overal tex image */
@@ -1456,6 +1486,7 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
}
else {
/* no rescaling needed */
+#if !NEWTEXSTORE
_mesa_transfer_teximage(ctx, 2, texImage->Format, /* Tex int format */
texImage->TexFormat, /* dest format */
(GLubyte *) texImage->Data,/* dest */
@@ -1464,6 +1495,15 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
mml->width * texelBytes, /* dest row stride */
0, /* dst image stride */
format, type, pixels, packing);
+#else
+ texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
+ texImage->TexFormat, (GLubyte *) texImage->Data,
+ xoffset, yoffset, 0, /* dstX/Y/Zoffset */
+ mml->width * texelBytes, /* dstRowStride */
+ 0, /* dstImageStride */
+ width, height, 1,
+ format, type, pixels, packing);
+#endif
}
/* [dBorca]
diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c
index 12a525a1e8e..da4dc2c83c6 100644
--- a/src/mesa/drivers/glide/fxsetup.c
+++ b/src/mesa/drivers/glide/fxsetup.c
@@ -67,77 +67,77 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj)
#if FX_RESCALE_BIG_TEXURES_HACK
{
- extern void _mesa_rescale_teximage2d( GLuint bytesPerPixel,
- GLuint dstRowStride,
- GLint srcWidth, GLint srcHeight,
- GLint dstWidth, GLint dstHeight,
- const GLvoid *srcImage, GLvoid *dstImage );
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- /* [dBorca]
- * Ooooooook! Here's a(nother) long story.
- * We get here because we need to handle a texture larger
- * than hardware can support. Two cases:
- * 1) we have mipmaps. Then we just push up to the first supported
- * LOD. A possible drawback is that Mesa will ignore the skipped
- * LODs on further texture handling.
- * Will this interfere with GL_TEXTURE_[MIN|BASE]_LEVEL? How?
- * 2) we don't have mipmaps. We need to rescale the big LOD in place.
- * The above approach is somehow dumb! we might have rescaled
- * once in TexImage2D to accomodate aspect ratio, and now we
- * are rescaling again. The thing is, in TexImage2D we don't
- * know whether we'll hit 1) or 2) by the time of validation.
- * NB: we could handle mml->[wh]Scale nicely, using (biased) shifts.
- *
- * Which brings me to another issue. How can we handle NPOT textures?
- * - rescaling NPOT to the next bigger POT (mml->[wh]Scale can't shift)
- * - upping the max LOD to the next power-of-two, in fxTexGetInfo; then
- * choosing non-power-of-two values for ti->[st]Scale... Anyhow, we
- * still need to align mipmaps correctly in texture memory!
- */
- if ((tObj->MinFilter == GL_NEAREST) || (tObj->MinFilter == GL_LINEAR)) {
- /* no mipmaps! */
- struct gl_texture_image *texImage = tObj->Image[0][minl];
- tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
- GLint _w, _h, maxSize = 1 << fxMesa->textureMaxLod;
- if ((mml->width > maxSize) || (mml->height > maxSize)) {
- /* need to rescale */
- GLint texelBytes = texImage->TexFormat->TexelBytes;
- GLvoid *texImage_Data = texImage->Data;
- _w = MIN2(texImage->Width, maxSize);
- _h = MIN2(texImage->Height, maxSize);
- if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "fxTexValidate: rescaling %d x %d -> %d x %d\n",
- texImage->Width, texImage->Height, _w, _h);
- }
- /* we should leave these as is and... (!) */
- texImage->Width = _w;
- texImage->Height = _h;
- fxTexGetInfo(_w, _h, NULL, NULL, NULL, NULL,
- &(mml->wScale), &(mml->hScale));
- _w *= mml->wScale;
- _h *= mml->hScale;
- texImage->Data = MESA_PBUFFER_ALLOC(_w * _h * texelBytes);
- _mesa_rescale_teximage2d(texelBytes,
- _w * texelBytes, /* dst stride */
- mml->width, mml->height, /* src */
- _w, _h, /* dst */
- texImage_Data /*src*/, texImage->Data /*dst*/ );
- MESA_PBUFFER_FREE(texImage_Data);
- mml->width = _w;
- mml->height = _h;
- /* (!) ... and set mml->wScale = _w / texImage->Width */
- }
- } else {
- /* mipmapping */
- if (maxl - minl > fxMesa->textureMaxLod) {
- /* skip a certain number of LODs */
- minl += maxl - fxMesa->textureMaxLod;
- if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "fxTexValidate: skipping %d LODs\n", minl - ti->minLevel);
- }
- ti->minLevel = tObj->BaseLevel = minl;
- }
- }
+ extern void _mesa_rescale_teximage2d( GLuint bytesPerPixel,
+ GLuint dstRowStride,
+ GLint srcWidth, GLint srcHeight,
+ GLint dstWidth, GLint dstHeight,
+ const GLvoid *srcImage, GLvoid *dstImage );
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ /* [dBorca]
+ * Ooooooook! Here's a(nother) long story.
+ * We get here because we need to handle a texture larger
+ * than hardware can support. Two cases:
+ * 1) we have mipmaps. Then we just push up to the first supported
+ * LOD. A possible drawback is that Mesa will ignore the skipped
+ * LODs on further texture handling.
+ * Will this interfere with GL_TEXTURE_[MIN|BASE]_LEVEL? How?
+ * 2) we don't have mipmaps. We need to rescale the big LOD in place.
+ * The above approach is somehow dumb! we might have rescaled
+ * once in TexImage2D to accomodate aspect ratio, and now we
+ * are rescaling again. The thing is, in TexImage2D we don't
+ * know whether we'll hit 1) or 2) by the time of validation.
+ * NB: we could handle mml->[wh]Scale nicely, using (biased) shifts.
+ *
+ * Which brings me to another issue. How can we handle NPOT textures?
+ * - rescaling NPOT to the next bigger POT (mml->[wh]Scale can't shift)
+ * - upping the max LOD to the next power-of-two, in fxTexGetInfo; then
+ * choosing non-power-of-two values for ti->[st]Scale... Anyhow, we
+ * still need to align mipmaps correctly in texture memory!
+ */
+ if ((tObj->MinFilter == GL_NEAREST) || (tObj->MinFilter == GL_LINEAR)) {
+ /* no mipmaps! */
+ struct gl_texture_image *texImage = tObj->Image[0][minl];
+ tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
+ GLint _w, _h, maxSize = 1 << fxMesa->textureMaxLod;
+ if ((mml->width > maxSize) || (mml->height > maxSize)) {
+ /* need to rescale */
+ GLint texelBytes = texImage->TexFormat->TexelBytes;
+ GLvoid *texImage_Data = texImage->Data;
+ _w = MIN2(texImage->Width, maxSize);
+ _h = MIN2(texImage->Height, maxSize);
+ if (TDFX_DEBUG & VERBOSE_TEXTURE) {
+ fprintf(stderr, "fxTexValidate: rescaling %d x %d -> %d x %d\n",
+ texImage->Width, texImage->Height, _w, _h);
+ }
+ /* we should leave these as is and... (!) */
+ texImage->Width = _w;
+ texImage->Height = _h;
+ fxTexGetInfo(_w, _h, NULL, NULL, NULL, NULL,
+ &(mml->wScale), &(mml->hScale));
+ _w *= mml->wScale;
+ _h *= mml->hScale;
+ texImage->Data = MESA_PBUFFER_ALLOC(_w * _h * texelBytes);
+ _mesa_rescale_teximage2d(texelBytes,
+ _w * texelBytes, /* dst stride */
+ mml->width, mml->height, /* src */
+ _w, _h, /* dst */
+ texImage_Data /*src*/, texImage->Data /*dst*/ );
+ MESA_PBUFFER_FREE(texImage_Data);
+ mml->width = _w;
+ mml->height = _h;
+ /* (!) ... and set mml->wScale = _w / texImage->Width */
+ }
+ } else {
+ /* mipmapping */
+ if (maxl - minl > fxMesa->textureMaxLod) {
+ /* skip a certain number of LODs */
+ minl += maxl - fxMesa->textureMaxLod;
+ if (TDFX_DEBUG & VERBOSE_TEXTURE) {
+ fprintf(stderr, "fxTexValidate: skipping %d LODs\n", minl - ti->minLevel);
+ }
+ ti->minLevel = tObj->BaseLevel = minl;
+ }
+ }
}
#endif
diff --git a/src/mesa/drivers/glide/fxwgl.c b/src/mesa/drivers/glide/fxwgl.c
index 3a581ef66a2..b87f60282ce 100644
--- a/src/mesa/drivers/glide/fxwgl.c
+++ b/src/mesa/drivers/glide/fxwgl.c
@@ -815,7 +815,7 @@ wglDescribePixelFormat(HDC hdc, int iPixelFormat, UINT nBytes,
if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix ||
((nBytes != sizeof(PIXELFORMATDESCRIPTOR)) && (nBytes != 0))) {
SetLastError(0);
- return (0);
+ return (qt_valid_pix);
}
if (nBytes != 0)
diff --git a/src/mesa/main/texutil.c b/src/mesa/main/texutil.c
index 7bb46481e05..0871c9ec243 100644
--- a/src/mesa/main/texutil.c
+++ b/src/mesa/main/texutil.c
@@ -968,6 +968,8 @@ _mesa_convert_texsubimage3d( GLint mesaFormat, /* dest */
return convert_texsubimage3d_tab[mesaFormat]( &convert );
}
+#endif
+
/* Nearest filtering only (for broken hardware that can't support
@@ -1036,5 +1038,3 @@ do { \
_mesa_problem(NULL,"unexpected bytes/pixel in _mesa_rescale_teximage2d");
}
}
-
-#endif