Lines Matching defs:unit

300  * Texture unit state management
303 static GLboolean r200UpdateTextureEnv( struct gl_context *ctx, int unit, int slot, GLuint replaceargs )
306 const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
315 /* texUnit->_Current can be NULL if and only if the texture unit is
322 fprintf( stderr, "%s( %p, %d )\n", __FUNCTION__, (void *)ctx, unit );
332 color_scale |= ((rmesa->state.texture.unit[unit].outputreg + 1) << R200_TXC_OUTPUT_REG_SHIFT) |
333 (unit << R200_TXC_TFACTOR_SEL_SHIFT) |
335 alpha_scale |= ((rmesa->state.texture.unit[unit].outputreg + 1) << R200_TXA_OUTPUT_REG_SHIFT) |
336 (unit << R200_TXA_TFACTOR_SEL_SHIFT) |
340 assert( unit == 0);
370 color_arg[i] = r200_register_color[op][unit];
379 if (replaceargs != unit) {
403 [rmesa->state.texture.unit[replaceargs - 1].outputreg];
428 [rmesa->state.texture.unit[unit - 1].outputreg];
457 alpha_arg[i] = r200_register_alpha[op][unit];
466 if (replaceargs != unit) {
485 [rmesa->state.texture.unit[replaceargs - 1].outputreg];
510 [rmesa->state.texture.unit[unit - 1].outputreg];
859 /* find highest used unit */
870 rmesa->state.texture.unit[j].outputreg = -1;
879 rmesa->state.texture.unit[j].outputreg = i;
883 if (rmesa->state.texture.unit[j].outputreg == -1) {
963 rmesa->state.texture.unit[i].unitneeded = ctx->Texture.Unit[i]._ReallyEnabled;
964 else rmesa->state.texture.unit[i].unitneeded = 0;
998 rmesa->state.texture.unit[0].outputreg = 0;
1040 int unit )
1044 rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] &= ~(7 << (unit * 3));
1047 rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~(R200_TEX_0_ENABLE << unit);
1048 if (rmesa->radeon.TclFallback & (R200_TCL_FALLBACK_TEXGEN_0<<unit)) {
1049 TCL_FALLBACK( rmesa->radeon.glCtx, (R200_TCL_FALLBACK_TEXGEN_0<<unit), GL_FALSE);
1059 rmesa->TexGenEnabled &= ~(R200_TEXGEN_TEXMAT_0_ENABLE<<unit);
1060 rmesa->TexGenEnabled &= ~(R200_TEXMAT_0_ENABLE<<unit);
1061 rmesa->TexGenNeedNormals[unit] = GL_FALSE;
1062 rmesa->TexGenCompSel &= ~(R200_OUTPUT_TEX_0 << unit);
1065 rmesa->recheck_texgen[unit] = GL_TRUE;
1071 int unit,
1075 GLuint *cmd = &rmesa->hw.tex[unit].cmd[TEX_CMD_0];
1077 R200_STATECHANGE( rmesa, tex[unit] );
1090 GLuint *cube_cmd = &rmesa->hw.cube[unit].cmd[CUBE_CMD_0];
1092 R200_STATECHANGE( rmesa, cube[unit] );
1102 GLuint unit,
1130 _math_matrix_loadf( &(rmesa->TexGenMatrix[unit]), m);
1131 _math_matrix_analyse( &(rmesa->TexGenMatrix[unit]) );
1132 rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE<<unit;
1180 static GLboolean r200_validate_texgen( struct gl_context *ctx, GLuint unit )
1183 const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
1184 GLuint inputshift = R200_TEXGEN_0_INPUT_SHIFT + unit*4;
1199 rmesa->TexGenCompSel &= ~(R200_OUTPUT_TEX_0 << unit);
1200 rmesa->TexGenEnabled &= ~(R200_TEXGEN_TEXMAT_0_ENABLE<<unit);
1201 rmesa->TexGenEnabled &= ~(R200_TEXMAT_0_ENABLE<<unit);
1202 rmesa->TexGenNeedNormals[unit] = GL_FALSE;
1206 (unit * 4));
1209 fprintf(stderr, "%s unit %d\n", __FUNCTION__, unit);
1214 tgcm |= R200_TEXGEN_COMP_S << (unit * 4);
1221 tgcm |= R200_TEXGEN_COMP_T << (unit * 4);
1227 tgcm |= R200_TEXGEN_COMP_R << (unit * 4);
1234 tgcm |= R200_TEXGEN_COMP_Q << (unit * 4);
1270 tgcm &= ~(R200_TEXGEN_COMP_R << (unit * 4));
1273 tgcm &= ~(R200_TEXGEN_COMP_Q << (unit * 4));
1277 set_texgen_matrix( rmesa, unit,
1298 tgcm &= ~(R200_TEXGEN_COMP_R << (unit * 4));
1301 tgcm &= ~(R200_TEXGEN_COMP_Q << (unit * 4));
1304 set_texgen_matrix( rmesa, unit,
1313 rmesa->TexGenNeedNormals[unit] = GL_TRUE;
1317 set_texgen_matrix( rmesa, unit,
1325 rmesa->TexGenNeedNormals[unit] = GL_TRUE;
1330 rmesa->TexGenNeedNormals[unit] = GL_TRUE;
1336 tgi |= unit << inputshift;
1348 rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit;
1349 rmesa->TexGenCompSel |= R200_OUTPUT_TEX_0 << unit;
1362 void set_re_cntl_d3d( struct gl_context *ctx, int unit, GLboolean use_d3d )
1368 re_cntl = rmesa->hw.set.cmd[SET_RE_CNTL] & ~(R200_VTX_STQ0_D3D << (2 * unit));
1370 re_cntl |= R200_VTX_STQ0_D3D << (2 * unit);
1498 static GLboolean r200_validate_texture(struct gl_context *ctx, struct gl_texture_object *texObj, int unit)
1503 if (!radeon_validate_texture_miptree(ctx, _mesa_get_samplerobj(ctx, unit), texObj))
1506 r200_validate_texgen(ctx, unit);
1514 set_re_cntl_d3d( ctx, unit, GL_FALSE );
1516 set_re_cntl_d3d( ctx, unit, GL_TRUE );
1518 rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_0_ENABLE << unit;
1521 rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] &= ~(7 << (unit * 3));
1522 rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] |= 4 << (unit * 3);
1524 rmesa->recheck_texgen[unit] = GL_TRUE;
1525 r200TexUpdateParameters(ctx, unit);
1526 import_tex_obj_state( rmesa, unit, t );
1528 if (rmesa->recheck_texgen[unit]) {
1529 GLboolean fallback = !r200_validate_texgen( ctx, unit );
1530 TCL_FALLBACK( ctx, (R200_TCL_FALLBACK_TEXGEN_0<<unit), fallback);
1531 rmesa->recheck_texgen[unit] = 0;
1542 static GLboolean r200UpdateTextureUnit(struct gl_context *ctx, int unit)
1545 GLuint unitneeded = rmesa->state.texture.unit[unit].unitneeded;
1548 /* disable the unit */
1549 disable_tex_obj_state(rmesa, unit);
1553 if (!r200_validate_texture(ctx, ctx->Texture.Unit[unit]._Current, unit)) {
1555 "failed to validate texture for unit %d.\n",
1556 unit);
1557 rmesa->state.texture.unit[unit].texobj = NULL;
1561 rmesa->state.texture.unit[unit].texobj = radeon_tex_obj(ctx->Texture.Unit[unit]._Current);
1572 /* NOTE: must not manipulate rmesa->state.texture.unit[].unitneeded or
1581 rmesa->state.texture.unit[i].unitneeded = ctx->Texture.Unit[i]._ReallyEnabled;