projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dri/nouveau: nv04: Use rules-ng-ng headers
[mesa.git]
/
src
/
mesa
/
drivers
/
dri
/
r200
/
r200_tex.c
diff --git
a/src/mesa/drivers/dri/r200/r200_tex.c
b/src/mesa/drivers/dri/r200/r200_tex.c
index a4177215537ae4149e0674d2bed63dd04753a36d..064324731b5e27a1db5eff2e379f59a623638e0e 100644
(file)
--- a/
src/mesa/drivers/dri/r200/r200_tex.c
+++ b/
src/mesa/drivers/dri/r200/r200_tex.c
@@
-44,9
+44,7
@@
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_mipmap_tree.h"
#include "r200_context.h"
#include "radeon_mipmap_tree.h"
#include "r200_context.h"
-#include "r200_state.h"
#include "r200_ioctl.h"
#include "r200_ioctl.h"
-#include "r200_swtcl.h"
#include "r200_tex.h"
#include "xmlpool.h"
#include "r200_tex.h"
#include "xmlpool.h"
@@
-67,6
+65,13
@@
static void r200SetTexWrap( radeonTexObjPtr t, GLenum swrap, GLenum twrap, GLenu
GLboolean is_clamp_to_border = GL_FALSE;
struct gl_texture_object *tObj = &t->base;
GLboolean is_clamp_to_border = GL_FALSE;
struct gl_texture_object *tObj = &t->base;
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(tex %p) sw %s, tw %s, rw %s\n",
+ __func__, t,
+ _mesa_lookup_enum_by_nr(swrap),
+ _mesa_lookup_enum_by_nr(twrap),
+ _mesa_lookup_enum_by_nr(rwrap));
+
t->pp_txfilter &= ~(R200_CLAMP_S_MASK | R200_CLAMP_T_MASK | R200_BORDER_MODE_D3D);
switch ( swrap ) {
t->pp_txfilter &= ~(R200_CLAMP_S_MASK | R200_CLAMP_T_MASK | R200_BORDER_MODE_D3D);
switch ( swrap ) {
@@
-182,6
+187,9
@@
static void r200SetTexWrap( radeonTexObjPtr t, GLenum swrap, GLenum twrap, GLenu
static void r200SetTexMaxAnisotropy( radeonTexObjPtr t, GLfloat max )
{
t->pp_txfilter &= ~R200_MAX_ANISO_MASK;
static void r200SetTexMaxAnisotropy( radeonTexObjPtr t, GLfloat max )
{
t->pp_txfilter &= ~R200_MAX_ANISO_MASK;
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(tex %p) max %f.\n",
+ __func__, t, max);
if ( max <= 1.0 ) {
t->pp_txfilter |= R200_MAX_ANISO_1_TO_1;
if ( max <= 1.0 ) {
t->pp_txfilter |= R200_MAX_ANISO_1_TO_1;
@@
-214,6
+222,13
@@
static void r200SetTexFilter( radeonTexObjPtr t, GLenum minf, GLenum magf )
t->pp_txfilter &= ~(R200_MIN_FILTER_MASK | R200_MAG_FILTER_MASK);
t->pp_txformat_x &= ~R200_VOLUME_FILTER_MASK;
t->pp_txfilter &= ~(R200_MIN_FILTER_MASK | R200_MAG_FILTER_MASK);
t->pp_txformat_x &= ~R200_VOLUME_FILTER_MASK;
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s(tex %p) minf %s, maxf %s, anisotropy %d.\n",
+ __func__, t,
+ _mesa_lookup_enum_by_nr(minf),
+ _mesa_lookup_enum_by_nr(magf),
+ anisotropy);
+
if ( anisotropy == R200_MAX_ANISO_1_TO_1 ) {
switch ( minf ) {
case GL_NEAREST:
if ( anisotropy == R200_MAX_ANISO_1_TO_1 ) {
switch ( minf ) {
case GL_NEAREST:
@@
-279,17
+294,15
@@
static void r200SetTexBorderColor( radeonTexObjPtr t, const GLfloat color[4] )
t->pp_border_color = radeonPackColor( 4, c[0], c[1], c[2], c[3] );
}
t->pp_border_color = radeonPackColor( 4, c[0], c[1], c[2], c[3] );
}
-static void r200TexEnv(
GL
context *ctx, GLenum target,
+static void r200TexEnv(
struct gl_
context *ctx, GLenum target,
GLenum pname, const GLfloat *param )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint unit = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
GLenum pname, const GLfloat *param )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint unit = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- if ( R200_DEBUG & RADEON_STATE ) {
- fprintf( stderr, "%s( %s )\n",
+ radeon_print(RADEON_TEXTURE | RADEON_STATE, RADEON_VERBOSE, "%s( %s )\n",
__FUNCTION__, _mesa_lookup_enum_by_nr( pname ) );
__FUNCTION__, _mesa_lookup_enum_by_nr( pname ) );
- }
/* This is incorrect: Need to maintain this data for each of
* GL_TEXTURE_{123}D, GL_TEXTURE_RECTANGLE_NV, etc, and switch
/* This is incorrect: Need to maintain this data for each of
* GL_TEXTURE_{123}D, GL_TEXTURE_RECTANGLE_NV, etc, and switch
@@
-311,18
+324,19
@@
static void r200TexEnv( GLcontext *ctx, GLenum target,
case GL_TEXTURE_LOD_BIAS_EXT: {
GLfloat bias, min;
GLuint b;
case GL_TEXTURE_LOD_BIAS_EXT: {
GLfloat bias, min;
GLuint b;
- const int fixed_one =
0x8000000
;
+ const int fixed_one =
R200_LOD_BIAS_FIXED_ONE
;
/* The R200's LOD bias is a signed 2's complement value with a
* range of -16.0 <= bias < 16.0.
*
* NOTE: Add a small bias to the bias for conform mipsel.c test.
*/
/* The R200's LOD bias is a signed 2's complement value with a
* range of -16.0 <= bias < 16.0.
*
* NOTE: Add a small bias to the bias for conform mipsel.c test.
*/
- bias = *param
+ .01
;
+ bias = *param;
min = driQueryOptionb (&rmesa->radeon.optionCache, "no_neg_lod_bias") ?
0.0 : -16.0;
bias = CLAMP( bias, min, 16.0 );
min = driQueryOptionb (&rmesa->radeon.optionCache, "no_neg_lod_bias") ?
0.0 : -16.0;
bias = CLAMP( bias, min, 16.0 );
- b = (int)(bias * fixed_one) & R200_LOD_BIAS_MASK;
+ b = ((int)(bias * fixed_one)
+ + R200_LOD_BIAS_CORRECTION) & R200_LOD_BIAS_MASK;
if ( (rmesa->hw.tex[unit].cmd[TEX_PP_TXFORMAT_X] & R200_LOD_BIAS_MASK) != b ) {
R200_STATECHANGE( rmesa, tex[unit] );
if ( (rmesa->hw.tex[unit].cmd[TEX_PP_TXFORMAT_X] & R200_LOD_BIAS_MASK) != b ) {
R200_STATECHANGE( rmesa, tex[unit] );
@@
-352,16
+366,17
@@
static void r200TexEnv( GLcontext *ctx, GLenum target,
* next UpdateTextureState
*/
* next UpdateTextureState
*/
-static void r200TexParameter(
GL
context *ctx, GLenum target,
+static void r200TexParameter(
struct gl_
context *ctx, GLenum target,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat *params )
{
radeonTexObj* t = radeon_tex_obj(texObj);
struct gl_texture_object *texObj,
GLenum pname, const GLfloat *params )
{
radeonTexObj* t = radeon_tex_obj(texObj);
- if ( R200_DEBUG & (RADEON_STATE|RADEON_TEXTURE) ) {
- fprintf( stderr, "%s( %s )\n", __FUNCTION__,
+ radeon_print(RADEON_TEXTURE | RADEON_STATE, RADEON_VERBOSE,
+ "%s(%p, tex %p) target %s, pname %s\n",
+ __FUNCTION__, ctx, texObj,
+ _mesa_lookup_enum_by_nr( target ),
_mesa_lookup_enum_by_nr( pname ) );
_mesa_lookup_enum_by_nr( pname ) );
- }
switch ( pname ) {
case GL_TEXTURE_MIN_FILTER:
switch ( pname ) {
case GL_TEXTURE_MIN_FILTER:
@@
-378,7
+393,7
@@
static void r200TexParameter( GLcontext *ctx, GLenum target,
break;
case GL_TEXTURE_BORDER_COLOR:
break;
case GL_TEXTURE_BORDER_COLOR:
- r200SetTexBorderColor( t, texObj->BorderColor );
+ r200SetTexBorderColor( t, texObj->BorderColor
.f
);
break;
case GL_TEXTURE_BASE_LEVEL:
break;
case GL_TEXTURE_BASE_LEVEL:
@@
-394,16
+409,15
@@
static void r200TexParameter( GLcontext *ctx, GLenum target,
}
}
-static void r200DeleteTexture(
GL
context * ctx, struct gl_texture_object *texObj)
+static void r200DeleteTexture(
struct gl_
context * ctx, struct gl_texture_object *texObj)
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
radeonTexObj* t = radeon_tex_obj(texObj);
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
radeonTexObj* t = radeon_tex_obj(texObj);
- if (RADEON_DEBUG & (RADEON_STATE | RADEON_TEXTURE)) {
- fprintf(stderr, "%s( %p (target = %s) )\n", __FUNCTION__,
- (void *)texObj,
- _mesa_lookup_enum_by_nr(texObj->Target));
- }
+ radeon_print(RADEON_TEXTURE | RADEON_STATE, RADEON_NORMAL,
+ "%s( %p (target = %s) )\n", __FUNCTION__,
+ (void *)texObj,
+ _mesa_lookup_enum_by_nr(texObj->Target));
if (rmesa) {
int i;
if (rmesa) {
int i;
@@
-432,7
+446,7
@@
static void r200DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj)
* Basically impossible to do this on the fly - just collect some
* basic info & do the checks from ValidateState().
*/
* Basically impossible to do this on the fly - just collect some
* basic info & do the checks from ValidateState().
*/
-static void r200TexGen(
GL
context *ctx,
+static void r200TexGen(
struct gl_
context *ctx,
GLenum coord,
GLenum pname,
const GLfloat *params )
GLenum coord,
GLenum pname,
const GLfloat *params )
@@
-450,7
+464,7
@@
static void r200TexGen( GLcontext *ctx,
* allocate the default texture objects.
* Fixup MaxAnisotropy according to user preference.
*/
* allocate the default texture objects.
* Fixup MaxAnisotropy according to user preference.
*/
-static struct gl_texture_object *r200NewTextureObject(
GL
context * ctx,
+static struct gl_texture_object *r200NewTextureObject(
struct gl_
context * ctx,
GLuint name,
GLenum target)
{
GLuint name,
GLenum target)
{
@@
-458,10
+472,10
@@
static struct gl_texture_object *r200NewTextureObject(GLcontext * ctx,
radeonTexObj* t = CALLOC_STRUCT(radeon_tex_obj);
radeonTexObj* t = CALLOC_STRUCT(radeon_tex_obj);
- if (RADEON_DEBUG & (RADEON_STATE | RADEON_TEXTURE)) {
-
fprintf(stderr, "%s( %p (target = %s) )\n", __FUNCTION__
,
- t, _mesa_lookup_enum_by_nr(target));
- }
+ radeon_print(RADEON_STATE | RADEON_TEXTURE, RADEON_NORMAL,
+
"%s(%p) target %s, new texture %p.\n"
,
+ __FUNCTION__, ctx,
+ _mesa_lookup_enum_by_nr(target), t);
_mesa_initialize_texture_object(&t->base, name, target);
t->base.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy;
_mesa_initialize_texture_object(&t->base, name, target);
t->base.MaxAnisotropy = rmesa->radeon.initialMaxAnisotropy;
@@
-470,14
+484,14
@@
static struct gl_texture_object *r200NewTextureObject(GLcontext * ctx,
r200SetTexWrap( t, t->base.WrapS, t->base.WrapT, t->base.WrapR );
r200SetTexMaxAnisotropy( t, t->base.MaxAnisotropy );
r200SetTexFilter(t, t->base.MinFilter, t->base.MagFilter);
r200SetTexWrap( t, t->base.WrapS, t->base.WrapT, t->base.WrapR );
r200SetTexMaxAnisotropy( t, t->base.MaxAnisotropy );
r200SetTexFilter(t, t->base.MinFilter, t->base.MagFilter);
- r200SetTexBorderColor(t, t->base.BorderColor);
+ r200SetTexBorderColor(t, t->base.BorderColor
.f
);
return &t->base;
}
return &t->base;
}
-void r200InitTextureFuncs( struct dd_function_table *functions )
+void r200InitTextureFuncs(
radeonContextPtr radeon,
struct dd_function_table *functions )
{
/* Note: we only plug in the functions we implement in the driver
* since _mesa_init_driver_functions() was already called.
{
/* Note: we only plug in the functions we implement in the driver
* since _mesa_init_driver_functions() was already called.
@@
-511,6
+525,11
@@
void r200InitTextureFuncs( struct dd_function_table *functions )
functions->CompressedTexImage2D = radeonCompressedTexImage2D;
functions->CompressedTexSubImage2D = radeonCompressedTexSubImage2D;
functions->CompressedTexImage2D = radeonCompressedTexImage2D;
functions->CompressedTexSubImage2D = radeonCompressedTexSubImage2D;
+ if (radeon->radeonScreen->kernel_mm) {
+ functions->CopyTexImage2D = radeonCopyTexImage2D;
+ functions->CopyTexSubImage2D = radeonCopyTexSubImage2D;
+ }
+
functions->GenerateMipmap = radeonGenerateMipmap;
functions->NewTextureImage = radeonNewTextureImage;
functions->GenerateMipmap = radeonGenerateMipmap;
functions->NewTextureImage = radeonNewTextureImage;
@@
-518,6
+537,10
@@
void r200InitTextureFuncs( struct dd_function_table *functions )
functions->MapTexture = radeonMapTexture;
functions->UnmapTexture = radeonUnmapTexture;
functions->MapTexture = radeonMapTexture;
functions->UnmapTexture = radeonUnmapTexture;
+#if FEATURE_OES_EGL_image
+ functions->EGLImageTargetTexture2D = radeon_image_target_texture_2d;
+#endif
+
driInitTextureFormats();
}
driInitTextureFormats();
}