static void r300SetTexWrap(r300TexObjPtr t, GLenum swrap, GLenum twrap,
GLenum rwrap)
{
- GLboolean is_clamp = GL_FALSE;
unsigned long hw_swrap=0, hw_twrap=0, hw_qwrap=0;
t->filter &=
break;
case GL_CLAMP:
hw_swrap |= R300_TX_CLAMP;
- is_clamp = GL_TRUE;
break;
case GL_CLAMP_TO_EDGE:
hw_swrap |= R300_TX_CLAMP_TO_EDGE;
break;
case GL_MIRROR_CLAMP_EXT:
hw_swrap |= R300_TX_CLAMP | R300_TX_MIRRORED;
- is_clamp = GL_TRUE;
break;
case GL_MIRROR_CLAMP_TO_EDGE_EXT:
hw_swrap |= R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
break;
case GL_CLAMP:
hw_twrap |= R300_TX_CLAMP;
- is_clamp = GL_TRUE;
break;
case GL_CLAMP_TO_EDGE:
hw_twrap |= R300_TX_CLAMP_TO_EDGE;
break;
case GL_MIRROR_CLAMP_EXT:
hw_twrap |= R300_TX_CLAMP | R300_TX_MIRRORED;
- is_clamp = GL_TRUE;
break;
case GL_MIRROR_CLAMP_TO_EDGE_EXT:
hw_twrap |= R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
break;
case GL_CLAMP:
hw_qwrap |= R300_TX_CLAMP;
- is_clamp = GL_TRUE;
break;
case GL_CLAMP_TO_EDGE:
hw_qwrap |= R300_TX_CLAMP_TO_EDGE;
break;
case GL_MIRROR_CLAMP_EXT:
hw_qwrap |= R300_TX_CLAMP | R300_TX_MIRRORED;
- is_clamp = GL_TRUE;
break;
case GL_MIRROR_CLAMP_TO_EDGE_EXT:
hw_qwrap |= R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
t->filter |= R300_TX_MIN_FILTER_NEAREST_MIP_NEAREST;
break;
case GL_NEAREST_MIPMAP_LINEAR:
- t->filter |= R300_TX_MIN_FILTER_LINEAR_MIP_NEAREST;
+ t->filter |= R300_TX_MIN_FILTER_NEAREST_MIP_LINEAR;
break;
case GL_LINEAR_MIPMAP_NEAREST:
- t->filter |= R300_TX_MIN_FILTER_NEAREST_MIP_LINEAR;
+ t->filter |= R300_TX_MIN_FILTER_LINEAR_MIP_NEAREST;
break;
case GL_LINEAR_MIPMAP_LINEAR:
t->filter |= R300_TX_MIN_FILTER_LINEAR_MIP_LINEAR;
else
return &_mesa_texformat_ycbcr_rev;
+ case GL_RGB_S3TC:
+ case GL_RGB4_S3TC:
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ return &_mesa_texformat_rgb_dxt1;
+
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ return &_mesa_texformat_rgba_dxt1;
+
+ case GL_RGBA_S3TC:
+ case GL_RGBA4_S3TC:
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ return &_mesa_texformat_rgba_dxt3;
+
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ return &_mesa_texformat_rgba_dxt5;
+
default:
_mesa_problem(ctx,
"unexpected internalFormat 0x%x in r300ChooseTextureFormat",
t->dirty_images[face] |= (1 << level);
}
+static void r300CompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level,
+ GLint internalFormat,
+ GLint width, GLint height, GLint border,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage )
+{
+ driTextureObject * t = (driTextureObject *) texObj->DriverData;
+ GLuint face;
+
+ /* which cube face or ordinary 2D image */
+ switch (target) {
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+ ASSERT(face < 6);
+ break;
+ default:
+ face = 0;
+ }
+
+ if ( t != NULL ) {
+ driSwapOutTextureObject( t );
+ }
+ else {
+ t = (driTextureObject *) r300AllocTexObj( texObj );
+ if (!t) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
+ return;
+ }
+ }
+
+ texImage->IsClientData = GL_FALSE;
+/* can't call this, different parameters. Would never evaluate to true anyway currently
+ if (r300ValidateClientStorage( ctx, target,
+ internalFormat,
+ width, height,
+ format, type, pixels,
+ packing, texObj, texImage)) {
+ if (RADEON_DEBUG & DEBUG_TEXTURE)
+ fprintf(stderr, "%s: Using client storage\n", __FUNCTION__);
+ }
+ else */{
+ if (RADEON_DEBUG & DEBUG_TEXTURE)
+ fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__);
+
+ /* Normal path: copy (to cached memory) and eventually upload
+ * via another copy to GART memory and then a blit... Could
+ * eliminate one copy by going straight to (permanent) GART.
+ *
+ * Note, this will call r300ChooseTextureFormat.
+ */
+ _mesa_store_compressed_teximage2d(ctx, target, level, internalFormat, width,
+ height, border, imageSize, data, texObj, texImage);
+
+ t->dirty_images[face] |= (1 << level);
+ }
+}
+
+
+static void r300CompressedTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format,
+ GLsizei imageSize, const GLvoid *data,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage )
+{
+ driTextureObject * t = (driTextureObject *) texObj->DriverData;
+ GLuint face;
+
+
+ /* which cube face or ordinary 2D image */
+ switch (target) {
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+ ASSERT(face < 6);
+ break;
+ default:
+ face = 0;
+ }
+
+ assert( t ); /* this _should_ be true */
+ if ( t ) {
+ driSwapOutTextureObject( t );
+ }
+ else {
+ t = (driTextureObject *) r300AllocTexObj( texObj );
+ if (!t) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3D");
+ return;
+ }
+ }
+
+ _mesa_store_compressed_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
+ height, format, imageSize, data, texObj, texImage);
+
+ t->dirty_images[face] |= (1 << level);
+}
+
#if ENABLE_HW_3D_TEXTURE
static void r300TexImage3D(GLcontext * ctx, GLenum target, GLint level,
GLint internalFormat,
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
if (RADEON_DEBUG & DEBUG_STATE) {
fprintf(stderr, "%s( %s )\n",
*/
switch (pname) {
case GL_TEXTURE_ENV_COLOR:{
- fprintf(stderr, "%s:%s I am broken - Fixme !\n", __FILE__, __FUNCTION__);
+ WARN_ONCE("I am broken - Fixme !\n");
/*
GLubyte c[4];
GLuint envColor;
R200_STATECHANGE(rmesa, tf);
rmesa->hw.tf.cmd[TF_TFACTOR_0 + unit] =
envColor;
- }
+ }*/
break;
- */}
+ }
case GL_TEXTURE_LOD_BIAS_EXT:{
GLfloat bias, min;
_mesa_delete_texture_object(ctx, texObj);
}
-/* Need:
- * - Same GEN_MODE for all active bits
- * - Same EyePlane/ObjPlane for all active bits when using Eye/Obj
- * - STRQ presumably all supported (matrix means incoming R values
- * can end up in STQ, this has implications for vertex support,
- * presumably ok if maos is used, though?)
- *
- * Basically impossible to do this on the fly - just collect some
- * basic info & do the checks from ValidateState().
- */
-static void r300TexGen(GLcontext * ctx,
- GLenum coord, GLenum pname, const GLfloat * params)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- GLuint unit = ctx->Texture.CurrentUnit;
-#if 0 /* Disable this for now - looks like we will be recalculating everything
- anyway */
- rmesa->recheck_texgen[unit] = GL_TRUE;
-#endif
-}
-
/**
* Allocate a new texture object.
* Called via ctx->Driver.NewTextureObject.
functions->TexEnv = r300TexEnv;
functions->TexParameter = r300TexParameter;
- functions->TexGen = r300TexGen;
+
+ functions->CompressedTexImage2D = r300CompressedTexImage2D;
+ functions->CompressedTexSubImage2D = r300CompressedTexSubImage2D;
driInitTextureFormats();