}
tObj = ctx->Texture.Unit[0]._Current;
- if (ctx->Texture.Unit[0]._ReallyEnabled != TEXTURE_2D_BIT ||
- tObj->Image[0][tObj->BaseLevel]->Border > 0) {
- /* 1D or 3D texturing enabled, or texture border - fallback */
+ if ((ctx->Texture.Unit[0]._ReallyEnabled & ~(TEXTURE_1D_BIT|TEXTURE_2D_BIT))
+ || tObj->Image[0][tObj->BaseLevel]->Border > 0) {
+ /* 3D texturing enabled, or texture border - fallback */
FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_TRUE);
return;
}
tObj = ctx->Texture.Unit[1]._Current;
- if (ctx->Texture.Unit[1]._ReallyEnabled != TEXTURE_2D_BIT ||
- tObj->Image[0][tObj->BaseLevel]->Border > 0) {
- /* 1D or 3D texturing enabled, or texture border - fallback */
+ if ((ctx->Texture.Unit[1]._ReallyEnabled & ~(TEXTURE_1D_BIT|TEXTURE_2D_BIT))
+ || tObj->Image[0][tObj->BaseLevel]->Border > 0) {
+ /* 3D texturing enabled, or texture border - fallback */
FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_TRUE);
return;
}
}
tObj = ctx->Texture.Unit[0]._Current;
- if (ctx->Texture.Unit[0]._ReallyEnabled != TEXTURE_2D_BIT ||
- tObj->Image[0][tObj->BaseLevel]->Border > 0) {
- /* 1D or 3D texturing enabled, or texture border - fallback */
+ if ((ctx->Texture.Unit[0]._ReallyEnabled & ~(TEXTURE_1D_BIT|TEXTURE_2D_BIT))
+ || tObj->Image[0][tObj->BaseLevel]->Border > 0) {
+ /* 3D texturing enabled, or texture border - fallback */
FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_TRUE);
return;
}
}
}
+static void savageTexImage1D( GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, 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 )
+{
+ savageTextureObjectPtr t = (savageTextureObjectPtr) texObj->DriverData;
+ if (t) {
+ savageSwapOutTexObj( SAVAGE_CONTEXT(ctx), t );
+ } else {
+ t = savageAllocTexObj(texObj);
+ if (!t) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
+ return;
+ }
+ }
+ _mesa_store_teximage1d( ctx, target, level, internalFormat,
+ width, border, format, type,
+ pixels, packing, texObj, texImage );
+ t->dirty_images |= (1 << level);
+ SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE;
+}
+
+static void savageTexSubImage1D( GLcontext *ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format, GLenum type,
+ const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage )
+{
+ savageTextureObjectPtr t = (savageTextureObjectPtr) texObj->DriverData;
+ assert( t ); /* this _should_ be true */
+ if (t) {
+ savageSwapOutTexObj( SAVAGE_CONTEXT(ctx), t );
+ } else {
+ t = savageAllocTexObj(texObj);
+ if (!t) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
+ return;
+ }
+ }
+ _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
+ format, type, pixels, packing, texObj,
+ texImage);
+ t->dirty_images |= (1 << level);
+ SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE;
+}
+
static void savageTexImage2D( GLcontext *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
} else {
t = savageAllocTexObj(texObj);
if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
return;
}
}
savageTextureObjectPtr t = (savageTextureObjectPtr) tObj->DriverData;
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
- if (!t || target != GL_TEXTURE_2D)
+ if (!t || (target != GL_TEXTURE_1D && target != GL_TEXTURE_2D))
return;
switch (pname) {
{
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
- assert( (target != GL_TEXTURE_2D) || (tObj->DriverData != NULL) );
+ assert( (target != GL_TEXTURE_1D && target != GL_TEXTURE_2D) ||
+ (tObj->DriverData != NULL) );
imesa->new_state |= SAVAGE_NEW_TEXTURE;
}
{
functions->TexEnv = savageTexEnv;
functions->ChooseTextureFormat = savageChooseTextureFormat;
+ functions->TexImage1D = savageTexImage1D;
+ functions->TexSubImage1D = savageTexSubImage1D;
functions->TexImage2D = savageTexImage2D;
functions->TexSubImage2D = savageTexSubImage2D;
functions->BindTexture = savageBindTexture;