while trying to activate the 3rd TMU on radeon I discovered that "txr" states get emitted even in the yuvsqare (and multiarb) demo (which use only standard textures): (RADEON_DEBUG=state and yuvsqare demo:) .... radeonBindTexture( 0x8132dc8 ) unit=0 radeonEmitState radeonEmitState - lost context emit TEX/tex-0/9 emit CTX/context/14 skip state TXR/txr-2 skip state TXR/txr-1 skip state TEX/tex-2 skip state TEX/tex-1 emit ZBS/zbias/3 emit MSC/misc/2 emit VPT/viewport/7 emit TXR/txr-0/3 emit MSK/mask/4 emit LIN/line/5 emit SET/setup/5 .... I dont know if its bad, but I think it shouldnt happen.
I changed the CHECK in radeon_state_init.c for txr and
now it doesnt happen anymore, at least in yuvsquare.
radeon_state_init.c:CHECK( txr0, ctx->Texture.Unit[0]._ReallyEnabled & TEXTURE_RECT_BIT)
radeon_state_init.c:CHECK( txr1, ctx->Texture.Unit[1]._ReallyEnabled & TEXTURE_RECT_BIT)
btw. heres also a patch for mplayer vo_gl.c which uses GL_NV_texture_rectangle.
I sent a (sligtly) older version to mplayer-dev-eng, but unfortunately it
got caught by some filter/ wasnt released by the mailinglist moderator.
best regards, Andreas
Am 2003.06.10 17:40:05 +0200 schrieb(en) Keith Whitwell: [.......]
[...]
Here's a patch that mainly works. I've still seen the odd case of the texture apparently getting uploaded to the backbuffer.
Keith
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/radeon/radeon_state_init.c,v[...]
retrieving revision 1.10
diff -u -r1.10 radeon_state_init.c
--- radeon_state_init.c 30 Apr 2003 01:50:54
-0000 1.10
+++ radeon_state_init.c 10 Jun 2003 15:37:50 -0000
@@ -134,6 +134,9 @@
TCL_CHECK( tcl_ucp5, (ctx->Transform.ClipPlanesEnabled & 0x20) )
TCL_CHECK( tcl_eyespace_or_fog, ctx->_NeedEyeCoords ||
ctx->Fog.Enabled )
+CHECK( txr0, ctx->Texture.Unit[0]._ReallyEnabled ) +CHECK( txr1, ctx->Texture.Unit[1]._ReallyEnabled ) +
/* Initialize the context's hardware state. @@ -246,6 +249,8 @@ ALLOC_STATE( lit[5], tcl_lit5, LIT_STATE_SIZE, "LIT/light-5", 1 ); ALLOC_STATE( lit[6], tcl_lit6, LIT_STATE_SIZE, "LIT/light-6", 1 ); ALLOC_STATE( lit[7], tcl_lit7, LIT_STATE_SIZE, "LIT/light-7", 1 ); + ALLOC_STATE( txr[0], txr0, TXR_STATE_SIZE, "TXR/txr-0", 0 ); + ALLOC_STATE( txr[1], txr1, TXR_STATE_SIZE, "TXR/txr-1", 0 );
/* Fill in the packet headers: @@ -268,6 +273,8 @@ rmesa->hw.tcl.cmd[TCL_CMD_0] = cmdpkt(RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT); rmesa->hw.mtl.cmd[MTL_CMD_0] = cmdpkt(RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED); + rmesa->hw.txr[0].cmd[TXR_CMD_0] = cmdpkt(RADEON_EMIT_PP_TEX_SIZE_0); + rmesa->hw.txr[1].cmd[TXR_CMD_0] = cmdpkt(RADEON_EMIT_PP_TEX_SIZE_1); rmesa->hw.grd.cmd[GRD_CMD_0] = cmdscl( RADEON_SS_VERT_GUARD_CLIP_ADJ_ADDR, 1, 4 ); rmesa->hw.fog.cmd[FOG_CMD_0] =
--- main/libvo/vo_gl.c_orig Wed Jun 11 16:51:22 2003
+++ main/libvo/vo_gl.c Fri Jun 13 13:48:32 2003
@@ -42,6 +42,9 @@
GLX_DOUBLEBUFFER,
None };
+static GLfloat coord_x= 1.0;
+static GLfloat coord_y= 1.0;
+static GLenum texture_target= GL_TEXTURE_2D;
static uint32_t image_width;
static uint32_t image_height;
@@ -162,6 +165,28 @@
while(texture_width<image_width || texture_width<image_height) texture_width*=2;
texture_height=texture_width;
+#ifdef GL_NV_texture_rectangle
+ if( strstr( glGetString( GL_EXTENSIONS), "GL_NV_texture_rectangle")) /* FIXME: this
test includes substrings! but shouldn't matter in this case... */
+ {
+ GLint max_texture_size_rectangle= 0;
+ glGetIntegerv( GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, &max_texture_size_rectangle);
+ if(
(texture_width>max_texture_size_rectangle)||(texture_height>max_texture_size_rectangle))
+ {
+ printf("[gl] GL_MAX_RECTANGLE_TEXTURE_SIZE (%d) is too small\n",
max_texture_size_rectangle);
+ printf("[gl] fallback to standard textures\n");
+ }
+ else
+ {
+ printf("[gl] using GL_NV_texture_rectangle extension\n");
+ texture_width= image_width;
+ texture_height= image_height;
+ coord_x= image_width;
+ coord_y= image_height;
+ texture_target= GL_TEXTURE_RECTANGLE_NV;
+ }
+ }
+#endif
+
image_bytes=(IMGFMT_RGB_DEPTH(format)+7)/8;
if ( ImageData ) free( ImageData );
@@ -173,14 +198,14 @@
glDepthMask(GL_FALSE);
glDisable(GL_CULL_FACE);
- glEnable(GL_TEXTURE_2D);
+ glEnable( texture_target);
printf("[gl] Creating %dx%d texture...\n",texture_width,texture_height);
#if 1
-// glBindTexture(GL_TEXTURE_2D, texture_id);
- glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+// glBindTexture( texture_target, texture_id);
+ glTexParameterf( texture_target,GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameterf( texture_target,GL_TEXTURE_MIN_FILTER, GL_LINEAR);
/* Old OpenGL 1.0 used the third parameter (known as internalFormat) as an
integer, which indicated the bytes per pixel (bpp). Later in OpenGL 1.1
they switched to constants, like GL_RGB8. GL_RGB8 means 8 bits for each
@@ -190,9 +215,9 @@
about 10 years old too. -- alex
*/
#ifdef TEXTUREFORMAT_32BPP
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, texture_width, texture_height, 0,
+ glTexImage2D( texture_target, 0, GL_RGB8, texture_width, texture_height, 0,
#else
- glTexImage2D(GL_TEXTURE_2D, 0, image_bytes, texture_width, texture_height, 0,
+ glTexImage2D( texture_target, 0, image_bytes, texture_width, texture_height, 0,
#endif
(image_bytes==4)?GL_RGBA:GL_BGR, GL_UNSIGNED_BYTE, ImageData);
#endif
@@ -223,15 +248,15 @@
flip_page(void)
{
-// glEnable(GL_TEXTURE_2D);
-// glBindTexture(GL_TEXTURE_2D, texture_id);
+// glEnable( texture_target);
+// glBindTexture( texture_target, texture_id);
glColor3f(1,1,1);
glBegin(GL_QUADS);
glTexCoord2f(0,0);glVertex2i(0,0);
- glTexCoord2f(0,1);glVertex2i(0,texture_height);
- glTexCoord2f(1,1);glVertex2i(texture_width,texture_height);
- glTexCoord2f(1,0);glVertex2i(texture_width,0);
+ glTexCoord2f(0,coord_y);glVertex2i(0,texture_height);
+ glTexCoord2f(coord_x,coord_y);glVertex2i(texture_width,texture_height);
+ glTexCoord2f(coord_x,0);glVertex2i(texture_width,0);
glEnd();
// glFlush();
@@ -254,7 +279,7 @@
uint8_t *ImageData=src[0];
for(i=0;i<image_height;i+=slice_height){
- glTexSubImage2D( GL_TEXTURE_2D, // target
+ glTexSubImage2D( texture_target, // target
0, // level
0, // x offset
// image_height-1-i, // y offset
