246
246
radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
247
247
TNLcontext *tnl = TNL_CONTEXT(ctx);
249
GLuint se_coord_fmt = rmesa->hw.set.cmd[SET_SE_COORDFMT];
251
se_coord_fmt &= ~(RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
252
RADEON_VTX_Z_PRE_MULT_1_OVER_W0 |
253
RADEON_VTX_W0_IS_NOT_1_OVER_W0);
251
255
/* We must ensure that we don't do _tnl_need_projected_coords while in a
252
256
* rasterization fallback. As this function will be called again when we
263
267
!RENDERINPUTS_TEST( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 ))
264
268
|| (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
265
269
rmesa->swtcl.needproj = GL_TRUE;
266
se_coord_fmt = (RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
267
RADEON_VTX_Z_PRE_MULT_1_OVER_W0 |
268
RADEON_TEX1_W_ROUTING_USE_Q1);
270
se_coord_fmt |= (RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
271
RADEON_VTX_Z_PRE_MULT_1_OVER_W0);
271
274
rmesa->swtcl.needproj = GL_FALSE;
272
se_coord_fmt = (RADEON_VTX_W0_IS_NOT_1_OVER_W0 |
273
RADEON_TEX1_W_ROUTING_USE_Q1);
275
se_coord_fmt |= (RADEON_VTX_W0_IS_NOT_1_OVER_W0);
276
278
_tnl_need_projected_coords( ctx, rmesa->swtcl.needproj );
473
474
/**************************************************************************/
475
/* Radeon texture rectangle expects coords in 0..1 range, not 0..dimension
476
* as in the extension spec. Need to translate here.
478
* Note that swrast expects 0..dimension, so if a fallback is active,
479
* don't do anything. (Maybe need to configure swrast to match hw)
481
struct texrect_stage_data {
482
GLvector4f texcoord[MAX_TEXTURE_UNITS];
485
#define TEXRECT_STAGE_DATA(stage) ((struct texrect_stage_data *)stage->privatePtr)
488
static GLboolean run_texrect_stage( GLcontext *ctx,
489
struct tnl_pipeline_stage *stage )
491
struct texrect_stage_data *store = TEXRECT_STAGE_DATA(stage);
492
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
493
TNLcontext *tnl = TNL_CONTEXT(ctx);
494
struct vertex_buffer *VB = &tnl->vb;
500
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
501
if (ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_RECT_BIT) {
502
struct gl_texture_object *texObj = ctx->Texture.Unit[i].CurrentRect;
503
struct gl_texture_image *texImage = texObj->Image[0][texObj->BaseLevel];
504
const GLfloat iw = 1.0/texImage->Width;
505
const GLfloat ih = 1.0/texImage->Height;
506
GLfloat *in = (GLfloat *)VB->TexCoordPtr[i]->data;
507
GLint instride = VB->TexCoordPtr[i]->stride;
508
GLfloat (*out)[4] = store->texcoord[i].data;
511
store->texcoord[i].size = VB->TexCoordPtr[i]->size;
512
for (j = 0 ; j < VB->Count ; j++) {
513
switch (VB->TexCoordPtr[i]->size) {
521
out[j][0] = in[0] * iw;
522
out[j][1] = in[1] * ih;
524
in = (GLfloat *)((GLubyte *)in + instride);
527
VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] = &store->texcoord[i];
535
/* Called the first time stage->run() is invoked.
537
static GLboolean alloc_texrect_data( GLcontext *ctx,
538
struct tnl_pipeline_stage *stage )
540
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
541
struct texrect_stage_data *store;
544
stage->privatePtr = CALLOC(sizeof(*store));
545
store = TEXRECT_STAGE_DATA(stage);
549
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
550
_mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 );
555
static void free_texrect_data( struct tnl_pipeline_stage *stage )
557
struct texrect_stage_data *store = TEXRECT_STAGE_DATA(stage);
561
for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++)
562
if (store->texcoord[i].data)
563
_mesa_vector4f_free( &store->texcoord[i] );
565
stage->privatePtr = NULL;
569
const struct tnl_pipeline_stage _radeon_texrect_stage =
571
"radeon texrect stage", /* name */
580
/**************************************************************************/
583
477
static const GLuint reduced_hw_prim[GL_POLYGON+1] = {
584
478
RADEON_CP_VC_CNTL_PRIM_TYPE_POINT,