summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/glide
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2001-02-06 21:42:48 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2001-02-06 21:42:48 +0000
commit8e39ad2cd67d49be40ff0822f3269affdf83d601 (patch)
tree5797d44b4e687d7c891fd1899fe4cc875919b544 /src/mesa/drivers/glide
parent16461f7c53f3bd88ec20458edfc247df14cde721 (diff)
Overhaul of texture image handling.
1. gl_texture_image struct's Data pointer points to images in driver's format. 2. Added FetchTexel() function pointer to struct gl_texture_image. 3. Changed Driver Tex[Sub]Image functions, return void now. 4. Texture storage/fetch code in new texstore.c file. 5. Removed texture.[ch] - functions moved to state.c Note: FX driver updates not finished yet.
Diffstat (limited to 'src/mesa/drivers/glide')
-rw-r--r--src/mesa/drivers/glide/fxdd.c11
-rw-r--r--src/mesa/drivers/glide/fxddtex.c65
-rw-r--r--src/mesa/drivers/glide/fxdrv.h20
3 files changed, 43 insertions, 53 deletions
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index 175077833c..d6ba79b22b 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -1108,12 +1108,11 @@ void fxSetupDDPointers(GLcontext *ctx)
ctx->Driver.TexImage2D = fxDDTexImage2D;
ctx->Driver.TexSubImage2D = fxDDTexSubImage2D;
- ctx->Driver.GetTexImage = fxDDGetTexImage;
- ctx->Driver.TexEnv=fxDDTexEnv;
- ctx->Driver.TexParameter=fxDDTexParam;
- ctx->Driver.BindTexture=fxDDTexBind;
- ctx->Driver.DeleteTexture=fxDDTexDel;
- ctx->Driver.UpdateTexturePalette=fxDDTexPalette;
+ ctx->Driver.TexEnv = fxDDTexEnv;
+ ctx->Driver.TexParameter = fxDDTexParam;
+ ctx->Driver.BindTexture = fxDDTexBind;
+ ctx->Driver.DeleteTexture = fxDDTexDel;
+ ctx->Driver.UpdateTexturePalette = fxDDTexPalette;
ctx->Driver.AlphaFunc=fxDDAlphaFunc;
ctx->Driver.BlendFunc=fxDDBlendFunc;
diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c
index 7c101e823d..bc89917050 100644
--- a/src/mesa/drivers/glide/fxddtex.c
+++ b/src/mesa/drivers/glide/fxddtex.c
@@ -836,31 +836,29 @@ static void PrintTexture(int w, int h, int c, const GLubyte *data)
}
-GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage,
- GLboolean *retainInternalCopy)
+void
+fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat, GLint width, GLint height, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
{
fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
- if (target != GL_TEXTURE_2D)
- return GL_FALSE;
-
if (!texObj->DriverData)
texObj->DriverData = fxAllocTexObjData(fxMesa);
- if (fxIsTexSupported(target, texImage->IntFormat, texImage)) {
+ if (fxIsTexSupported(target, internalFormat, texImage)) {
GrTextureFormat_t gldformat;
tfxTexInfo *ti = fxTMGetTexInfo(texObj);
tfxMipMapLevel *mml = &ti->mipmapLevel[level];
GLint dstWidth, dstHeight, wScale, hScale, texelSize, dstStride;
MesaIntTexFormat intFormat;
- fxTexGetFormat(texImage->IntFormat, &gldformat, NULL);
+ fxTexGetFormat(internalFormat, &gldformat, NULL);
- fxTexGetInfo(texImage->Width, texImage->Height, NULL,NULL,NULL,NULL,
+ fxTexGetInfo(width, height, NULL,NULL,NULL,NULL,
NULL,NULL, &wScale, &hScale);
dstWidth = texImage->Width * wScale;
@@ -942,7 +940,7 @@ GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
break;
default:
gl_problem(NULL, "tdfx driver: texbuildimagemap() bad format");
- return GL_FALSE;
+ return;
}
_mesa_set_teximage_component_sizes(intFormat, texImage);
@@ -955,7 +953,7 @@ GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
FREE(mml->data);
mml->data = MALLOC(dstWidth * dstHeight * texelSize);
if (!mml->data)
- return GL_FALSE;
+ return;
mml->glideFormat = gldformat;
mml->width = dstWidth;
mml->height = dstHeight;
@@ -967,9 +965,9 @@ GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
/* store the texture image */
if (!_mesa_convert_teximage(intFormat, dstWidth, dstHeight, mml->data,
dstStride,
- texImage->Width, texImage->Height,
+ width, height,
format, type, pixels, packing)) {
- return GL_FALSE;
+ return;
}
@@ -981,24 +979,21 @@ GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
/*printf("invalidate2\n");*/
fxTexInvalidate(ctx,texObj);
}
-
- *retainInternalCopy = GL_FALSE;
- return GL_TRUE;
}
else {
gl_problem(NULL, "fx Driver: unsupported texture in fxDDTexImg()\n");
- return GL_FALSE;
}
}
-GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
+void
+fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
{
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
tfxTexInfo *ti;
@@ -1006,11 +1001,10 @@ GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
tfxMipMapLevel *mml;
GLboolean result;
- if (target != GL_TEXTURE_2D)
- return GL_FALSE;
-
- if (!texObj->DriverData)
- return GL_FALSE;
+ if (!texObj->DriverData) {
+ gl_problem(ctx, "problem in fxDDTexSubImage2D");
+ return;
+ }
ti = fxTMGetTexInfo(texObj);
mml = &ti->mipmapLevel[level];
@@ -1083,7 +1077,7 @@ GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
}
if (!result) {
- return GL_FALSE;
+ return;
}
if (ti->validated && ti->isInTM)
@@ -1091,11 +1085,10 @@ GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
else
fxTexInvalidate(ctx, texObj);
- return GL_TRUE;
}
-
+#if 000
GLvoid *fxDDGetTexImage(GLcontext *ctx, GLenum target, GLint level,
const struct gl_texture_object *texObj,
GLenum *formatOut, GLenum *typeOut,
@@ -1174,6 +1167,8 @@ GLvoid *fxDDGetTexImage(GLcontext *ctx, GLenum target, GLint level,
return NULL;
}
}
+#endif
+
#else
diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h
index 6861160c1a..c8876f7433 100644
--- a/src/mesa/drivers/glide/fxdrv.h
+++ b/src/mesa/drivers/glide/fxdrv.h
@@ -60,7 +60,6 @@
#include "macros.h"
#include "matrix.h"
#include "mem.h"
-#include "texture.h"
#include "mtypes.h"
#include "GL/fxmesa.h"
@@ -541,23 +540,20 @@ extern void fxUpdateDDSpanPointers(GLcontext *);
extern void fxSetupDDSpanPointers(GLcontext *);
extern void fxPrintTextureData(tfxTexInfo *ti);
-extern GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage,
- GLboolean *retainInternalCopy);
-extern GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
+extern void fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat, GLint width, GLint height, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage);
+
+extern void fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
-extern GLvoid *fxDDGetTexImage(GLcontext *ctx, GLenum target, GLint level,
- const struct gl_texture_object *texObj,
- GLenum *formatOut, GLenum *typeOut,
- GLboolean *freeImageOut );
extern void fxDDTexEnv(GLcontext *, GLenum, GLenum, const GLfloat *);
extern void fxDDTexParam(GLcontext *, GLenum, struct gl_texture_object *,
GLenum, const GLfloat *);