{
struct intel_context intel;
- GLuint last_index;
+ DECLARE_RENDERINPUTS(last_index_bitset);
struct i830_hw_state meta, initial, state, *current;
};
i830ContextPtr i830 = I830_CONTEXT(intel);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
+ DECLARE_RENDERINPUTS(index_bitset);
GLuint v0 = _3DSTATE_VFT0_CMD;
GLuint v2 = _3DSTATE_VFT1_CMD;
GLuint mcsb1 = 0;
+ RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
+
/* Important:
*/
VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
/* EMIT_ATTR's must be in order as they tell t_vertex.c how to
* build up a hardware vertex.
*/
- if (index & _TNL_BITS_TEX_ANY) {
+ if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, VFT0_XYZW );
intel->coloroffset = 4;
}
intel->coloroffset = 3;
}
- if (index & _TNL_BIT_POINTSIZE) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE )) {
EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, VFT0_POINT_WIDTH );
}
EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, VFT0_DIFFUSE );
intel->specoffset = 0;
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
- if (index & _TNL_BIT_COLOR1) {
- intel->specoffset = intel->coloroffset + 1;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, VFT0_SPEC );
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 ) ||
+ RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
+ intel->specoffset = intel->coloroffset + 1;
+ EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, VFT0_SPEC );
}
- else
- EMIT_PAD( 3 );
-
- if (index & _TNL_BIT_FOG)
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, VFT0_SPEC );
else
- EMIT_PAD( 1 );
+ EMIT_PAD( 3 );
+
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG ))
+ EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, VFT0_SPEC );
+ else
+ EMIT_PAD( 1 );
}
- if (index & _TNL_BITS_TEX_ANY) {
+ if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
int i, count = 0;
for (i = 0; i < I830_TEX_UNITS; i++) {
- if (index & _TNL_BIT_TEX(i)) {
- GLuint sz = VB->TexCoordPtr[i]->size;
- GLuint emit;
- GLuint mcs = (i830->state.Tex[i][I830_TEXREG_MCS] &
- ~TEXCOORDTYPE_MASK);
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) {
+ GLuint sz = VB->TexCoordPtr[i]->size;
+ GLuint emit;
+ GLuint mcs = (i830->state.Tex[i][I830_TEXREG_MCS] &
+ ~TEXCOORDTYPE_MASK);
switch (sz) {
case 1:
if (v0 != i830->state.Ctx[I830_CTXREG_VF] ||
v2 != i830->state.Ctx[I830_CTXREG_VF2] ||
mcsb1 != i830->state.Ctx[I830_CTXREG_MCSB1] ||
- index != i830->last_index) {
+ !RENDERINPUTS_EQUAL( index_bitset, i830->last_index_bitset )) {
I830_STATECHANGE( i830, I830_UPLOAD_CTX );
i830->state.Ctx[I830_CTXREG_VF] = v0;
i830->state.Ctx[I830_CTXREG_VF2] = v2;
i830->state.Ctx[I830_CTXREG_MCSB1] = mcsb1;
- i830->last_index = index;
+ RENDERINPUTS_COPY( i830->last_index_bitset, index_bitset );
assert(i830_check_vertex_size( intel, intel->vertex_size ));
}
GLcontext *ctx = &intel->ctx;
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
+ DECLARE_RENDERINPUTS(index_bitset);
int i, offset;
GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK;
GLuint s2 = S2_TEXCOORD_NONE;
+ RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
+
/* Important:
*/
VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
if (i915->vertex_fog == I915_FOG_PIXEL) {
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, S4_VFMT_XYZW, 16 );
- index &= ~_TNL_BIT_FOG;
+ RENDERINPUTS_CLEAR( index_bitset, _TNL_ATTRIB_FOG );
}
- else if (index & _TNL_BITS_TEX_ANY) {
+ else if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, S4_VFMT_XYZW, 16 );
}
else {
}
/* How undefined is undefined? */
- if (index & _TNL_BIT_POINTSIZE) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE )) {
EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, S4_VFMT_POINT_WIDTH, 4 );
}
intel->coloroffset = offset / 4;
EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, S4_VFMT_COLOR, 4 );
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
- if (index & _TNL_BIT_COLOR1) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 ) ||
+ RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
intel->specoffset = offset / 4;
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, S4_VFMT_SPEC_FOG, 3 );
} else
EMIT_PAD( 3 );
- if (index & _TNL_BIT_FOG)
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG ))
EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, S4_VFMT_SPEC_FOG, 1 );
else
EMIT_PAD( 1 );
}
- if (index & _TNL_BITS_TEX_ANY) {
+ if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
for (i = 0; i < 8; i++) {
- if (index & _TNL_BIT_TEX(i)) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) {
int sz = VB->TexCoordPtr[i]->size;
s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK);
rmesa->RenderIndex = -1; /* Impossible value */
rmesa->vert_buf = NULL;
rmesa->num_verts = 0;
- rmesa->tnl_state = ~0;
+ RENDERINPUTS_ONES( rmesa->tnl_state_bitset );
/* Set the maximum texture size small enough that we can guarentee that
* all texture units can bind a maximal texture and have them both in
char *verts; /* points to tnl->clipspace.vertex_buf */
GLuint num_verts;
int coloroffset, specoffset;
- int tnl_state; /* tnl->render_inputs for this _tnl_install_attrs */
+ DECLARE_RENDERINPUTS(tnl_state_bitset); /* tnl->render_inputs for this _tnl_install_attrs */
GLuint NewGLState;
GLuint Fallback;
driUpdateFramebufferSize(rmesa->glCtx, dPriv);
rmesa->lastStamp = dPriv->lastStamp;
rmesa->new_state |= R128_NEW_CLIP;
- rmesa->tnl_state = ~0;
+ RENDERINPUTS_ONES( rmesa->tnl_state_bitset );
}
rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_CLIPRECTS;
r128ContextPtr rmesa = R128_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
+ DECLARE_RENDERINPUTS(index_bitset);
GLuint vc_frmt = 0;
GLboolean fallback_projtex = GL_FALSE;
GLuint offset = 0;
+ RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
+
/* Important: */
VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
rmesa->vertex_attr_count = 0;
/* EMIT_ATTR's must be in order as they tell t_vertex.c how to
* build up a hardware vertex.
*/
- if ( index & _TNL_BITS_TEX_ANY )
+ if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX ))
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, R128_CCE_VC_FRMT_RHW, 16 );
else
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT, 0, 12 );
R128_CCE_VC_FRMT_DIFFUSE_ARGB, 4 );
#endif
- if ( index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG) ) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 ) ||
+ RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
#if MESA_LITTLE_ENDIAN
- if ( index & _TNL_BIT_COLOR1) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
rmesa->specoffset = offset;
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR,
R128_CCE_VC_FRMT_SPEC_FRGB, 3 );
} else
EMIT_PAD( 3 );
- if (index & _TNL_BIT_FOG)
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG ))
EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, R128_CCE_VC_FRMT_SPEC_FRGB,
1 );
else
EMIT_PAD( 1 );
#else
- if (index & _TNL_BIT_FOG)
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG ))
EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, R128_CCE_VC_FRMT_SPEC_FRGB,
1 );
else
EMIT_PAD( 1 );
- if ( index & _TNL_BIT_COLOR1) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
rmesa->specoffset = offset;
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_RGB,
R128_CCE_VC_FRMT_SPEC_FRGB, 3 );
#endif
}
- if ( index & _TNL_BIT_TEX(rmesa->tmu_source[0]) ) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(rmesa->tmu_source[0]) )) {
if ( VB->TexCoordPtr[rmesa->tmu_source[0]]->size > 2 )
fallback_projtex = GL_TRUE;
EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_2F, R128_CCE_VC_FRMT_S_T, 8 );
}
- if ( index & _TNL_BIT_TEX(rmesa->tmu_source[1]) ) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(rmesa->tmu_source[1]) )) {
if ( VB->TexCoordPtr[rmesa->tmu_source[1]]->size > 2 )
fallback_projtex = GL_TRUE;
EMIT_ATTR( _TNL_ATTRIB_TEX1, EMIT_2F, R128_CCE_VC_FRMT_S2_T2, 8 );
/* Only need to change the vertex emit code if there has been a
* statechange to a TNL index.
*/
- if ( index != rmesa->tnl_state ) {
+ if (!RENDERINPUTS_EQUAL( index_bitset, rmesa->tnl_state_bitset )) {
FLUSH_BATCH( rmesa );
rmesa->dirty |= R128_UPLOAD_CONTEXT;
_tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
(6 + 2 * ctx->Const.MaxTextureUnits) * sizeof(GLfloat) );
rmesa->verts = (char *)tnl->clipspace.vertex_buf;
- rmesa->tnl_state = -1;
+ RENDERINPUTS_ONES( rmesa->tnl_state_bitset );
rmesa->NewGLState |= _R128_NEW_RENDER_STATE;
}
GLuint TclFallback;
GLuint Fallback;
GLuint NewGLState;
- GLuint tnl_index; /* index of bits for last tnl_install_attrs */
+ DECLARE_RENDERINPUTS(tnl_index_bitset); /* index of bits for last tnl_install_attrs */
/* Vertex buffers
*/
r200ContextPtr rmesa = R200_CONTEXT( ctx );
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
+ DECLARE_RENDERINPUTS(index_bitset);
int fmt_0 = 0;
int fmt_1 = 0;
int offset = 0;
+ RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
/* Important:
*/
/* EMIT_ATTR's must be in order as they tell t_vertex.c how to
* build up a hardware vertex.
*/
- if ( !rmesa->swtcl.needproj || (index & _TNL_BITS_TEX_ANY)) { /* need w coord for projected textures */
+ if ( !rmesa->swtcl.needproj ||
+ RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) { /* need w coord for projected textures */
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F, R200_VTX_XY | R200_VTX_Z0 | R200_VTX_W0 );
offset = 4;
}
offset += 1;
rmesa->swtcl.specoffset = 0;
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 ) ||
+ RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
#if MESA_LITTLE_ENDIAN
- if (index & _TNL_BIT_COLOR1) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
rmesa->swtcl.specoffset = offset;
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_RGB, (R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT) );
}
EMIT_PAD( 3 );
}
- if (index & _TNL_BIT_FOG) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, (R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT) );
}
else {
EMIT_PAD( 1 );
}
#else
- if (index & _TNL_BIT_FOG) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, (R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT) );
}
else {
EMIT_PAD( 1 );
}
- if (index & _TNL_BIT_COLOR1) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
rmesa->swtcl.specoffset = offset;
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, (R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT) );
}
#endif
}
- if (index & _TNL_BITS_TEX_ANY) {
+ if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
int i;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
- if (index & _TNL_BIT_TEX(i)) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) {
GLuint sz = VB->TexCoordPtr[i]->size;
fmt_1 |= sz << (3 * i);
rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] |= R200_FOG_USE_SPEC_ALPHA;
}
- if ( rmesa->tnl_index != index ||
+ if (!RENDERINPUTS_EQUAL( rmesa->tnl_index_bitset, index_bitset ) ||
(rmesa->hw.vtx.cmd[VTX_VTXFMT_0] != fmt_0) ||
(rmesa->hw.vtx.cmd[VTX_VTXFMT_1] != fmt_1) ) {
R200_NEWPRIM(rmesa);
rmesa->swtcl.vertex_attr_count,
NULL, 0 );
rmesa->swtcl.vertex_size /= 4;
- rmesa->tnl_index = index;
+ RENDERINPUTS_COPY( rmesa->tnl_index_bitset, index_bitset );
}
}
/* HW perspective divide is a win, but tiny vertex formats are a
* bigger one.
*/
- if ( ((tnl->render_inputs & _TNL_BITS_TEX_ANY) == 0)
+ if (!RENDERINPUTS_TEST_RANGE( tnl->render_inputs_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )
|| (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
rmesa->swtcl.needproj = GL_TRUE;
vte |= R200_VTX_XY_FMT | R200_VTX_Z_FMT;
vte &= ~R200_VTX_W0_FMT;
- if (tnl->render_inputs & _TNL_BITS_TEX_ANY) {
+ if (RENDERINPUTS_TEST_RANGE( tnl->render_inputs_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
vap &= ~R200_VAP_FORCE_W_TO_ONE;
}
else {
*/
_tnl_invalidate_vertex_state( ctx, ~0 );
_tnl_invalidate_vertices( ctx, ~0 );
- rmesa->tnl_index = 0;
+ RENDERINPUTS_ZERO( rmesa->tnl_index_bitset );
r200ChooseVertexState( ctx );
r200ChooseRenderState( ctx );
}
GLuint *Elts;
struct r300_dma_region elt_dma;
- GLuint render_inputs; /* actual render inputs that R300 was configured for.
+ DECLARE_RENDERINPUTS(render_inputs_bitset); /* actual render inputs that R300 was configured for.
They are the same as tnl->render_inputs for fixed pipeline */
struct {
GLuint vic_1 = 0; /* R300_VAP_INPUT_CNTL_1 */
GLuint aa_vap_reg = 0; /* VAP register assignment */
GLuint i;
- GLuint inputs = 0;
-
+ DECLARE_RENDERINPUTS(inputs_bitset);
+
+ RENDERINPUTS_ZERO( inputs_bitset );
+
#define CONFIGURE_AOS(r, f, v, sz, cn) { \
if (RADEON_DEBUG & DEBUG_STATE) \
fprintf(stderr, "Enabling "#v "\n"); \
GLuint InputsRead = CURRENT_VERTEX_SHADER(ctx)->Base.InputsRead;
struct r300_vertex_program *prog=(struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx);
if (InputsRead & (1<<VERT_ATTRIB_POS)) {
- inputs |= _TNL_BIT_POS;
+ RENDERINPUTS_SET( inputs_bitset, _TNL_ATTRIB_POS );
rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_POS];
}
if (InputsRead & (1<<VERT_ATTRIB_NORMAL)) {
- inputs |= _TNL_BIT_NORMAL;
+ RENDERINPUTS_SET( inputs_bitset, _TNL_ATTRIB_NORMAL );
rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_NORMAL];
}
if (InputsRead & (1<<VERT_ATTRIB_COLOR0)) {
- inputs |= _TNL_BIT_COLOR0;
+ RENDERINPUTS_SET( inputs_bitset, _TNL_ATTRIB_COLOR0 );
rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_COLOR0];
}
if (InputsRead & (1<<VERT_ATTRIB_COLOR1)) {
- inputs |= _TNL_BIT_COLOR1;
+ RENDERINPUTS_SET( inputs_bitset, _TNL_ATTRIB_COLOR1 );
rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_COLOR1];
}
if (InputsRead & (1<<VERT_ATTRIB_FOG)) {
- inputs |= _TNL_BIT_FOG;
+ RENDERINPUTS_SET( inputs_bitset, _TNL_ATTRIB_FOG );
rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_FOG];
}
if(ctx->Const.MaxTextureUnits > 8) { /* Not sure if this can even happen... */
}
for (i=0;i<ctx->Const.MaxTextureUnits;i++) {
if (InputsRead & (1<<(VERT_ATTRIB_TEX0+i))) {
- inputs |= _TNL_BIT_TEX0<<i;
+ RENDERINPUTS_SET( inputs_bitset, _TNL_ATTRIB_TEX(i) );
rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_TEX0+i];
}
}
nr = 0;
} else {
- inputs = TNL_CONTEXT(ctx)->render_inputs;
+ RENDERINPUTS_COPY( inputs_bitset, TNL_CONTEXT(ctx)->render_inputs_bitset );
}
- rmesa->state.render_inputs = inputs;
+ RENDERINPUTS_COPY( rmesa->state.render_inputs_bitset, inputs_bitset );
- if (inputs & _TNL_BIT_POS) {
+ if (RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_POS )) {
CONFIGURE_AOS(i_coords, AOS_FORMAT_FLOAT,
VB->AttribPtr[VERT_ATTRIB_POS],
immd ? 4 : VB->AttribPtr[VERT_ATTRIB_POS].size,
vic_1 |= R300_INPUT_CNTL_POS;
}
- if (inputs & _TNL_BIT_NORMAL) {
+ if (RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_NORMAL )) {
CONFIGURE_AOS(i_normal, AOS_FORMAT_FLOAT,
VB->AttribPtr[VERT_ATTRIB_NORMAL],
immd ? 4 : VB->AttribPtr[VERT_ATTRIB_NORMAL].size,
vic_1 |= R300_INPUT_CNTL_NORMAL;
}
- if (inputs & _TNL_BIT_COLOR0) {
+ if (RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_COLOR0 )) {
int emitsize=4;
if (!immd) {
vic_1 |= R300_INPUT_CNTL_COLOR;
}
- if (inputs & _TNL_BIT_COLOR1) {
+ if (RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_COLOR1 )) {
int emitsize=4;
if (!immd) {
}
#if 0
- if (inputs & _TNL_BIT_FOG) {
+ if (RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_FOG )) {
CONFIGURE_AOS( AOS_FORMAT_FLOAT,
VB->FogCoordPtr,
immd ? 4 : VB->FogCoordPtr->size,
r300->state.texture.tc_count = 0;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
- if (inputs & (_TNL_BIT_TEX0 << i)) {
+ if (RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_TEX(i) )) {
CONFIGURE_AOS(i_tex[i], AOS_FORMAT_FLOAT,
VB->AttribPtr[VERT_ATTRIB_TEX0+i],
immd ? 4 : VB->AttribPtr[VERT_ATTRIB_TEX0+i].size,
#if 0
r300->hw.vic.cmd[R300_VIC_CNTL_1]=0;
- if(r300->state.render_inputs & _TNL_BIT_POS)
+ if(RENDERINPUTS_TEST( r300->state.render_inputs_bitset, _TNL_ATTRIB_POS ))
r300->hw.vic.cmd[R300_VIC_CNTL_1]|=R300_INPUT_CNTL_POS;
- if(r300->state.render_inputs & _TNL_BIT_NORMAL)
+ if(RENDERINPUTS_TEST( r300->state.render_inputs_bitset, _TNL_ATTRIB_NORMAL ))
r300->hw.vic.cmd[R300_VIC_CNTL_1]|=R300_INPUT_CNTL_NORMAL;
- if(r300->state.render_inputs & _TNL_BIT_COLOR0)
+ if(RENDERINPUTS_TEST( r300->state.render_inputs_bitset, _TNL_ATTRIB_COLOR0 ))
r300->hw.vic.cmd[R300_VIC_CNTL_1]|=R300_INPUT_CNTL_COLOR;
for(i=0;i < ctx->Const.MaxTextureUnits;i++)
- if(r300->state.render_inputs & (_TNL_BIT_TEX0<<i))
+ if(RENDERINPUTS_TEST( r300->state.render_inputs_bitset, _TNL_ATTRIB_TEX(i) ))
r300->hw.vic.cmd[R300_VIC_CNTL_1]|=(R300_INPUT_CNTL_TC0<<i);
#endif
if(OutputsWritten & (1<<(VERT_RESULT_TEX0+i)))
r300->hw.vof.cmd[R300_VOF_CNTL_1] |= (4<<(3*i));
} else {
- if(inputs & _TNL_BIT_POS)
+ if(RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_POS ))
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
- if(inputs & _TNL_BIT_COLOR0)
+ if(RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_COLOR0 ))
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
- if(inputs & _TNL_BIT_COLOR1)
+ if(RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_COLOR1 ))
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT;
for(i=0;i < ctx->Const.MaxTextureUnits;i++)
- if(inputs & (_TNL_BIT_TEX0<<i))
+ if(RENDERINPUTS_TEST( inputs_bitset, _TNL_ATTRIB_TEX(i) ))
r300->hw.vof.cmd[R300_VOF_CNTL_1]|=(4<<(3*i));
}
fprintf(stderr, "TX_ENABLE: %08x last_hw_tmu=%d\n", r300->hw.txe.cmd[R300_TXE_ENABLE], last_hw_tmu);
}
+union r300_outputs_written {
+ GLuint vp_outputs; /* hw_tcl_on */
+ DECLARE_RENDERINPUTS(index_bitset); /* !hw_tcl_on */
+};
+
+static GLboolean r300_outputs_written_test (r300_outputs_written *ow, GLuint vp_result,
+ GLuint tnl_attrib)
+{
+ if (hw_tcl_on)
+ return ow->vp_outputs & (1 << vp_result);
+ return RENDERINPUTS_TEST( ow->index_bitset, tnl_attrib );
+}
+
void r300_setup_rs_unit(GLcontext *ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
0x00,
0x00
};
- GLuint OutputsWritten;
+ union r300_outputs_written OutputsWritten;
GLuint InputsRead;
int fp_reg, high_rr;
int in_texcoords, col_interp_nr;
int i;
if(hw_tcl_on)
- OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->Base.OutputsWritten;
+ OutputsWritten.vp_outputs = CURRENT_VERTEX_SHADER(ctx)->Base.OutputsWritten;
else
- OutputsWritten = r300->state.render_inputs;
+ RENDERINPUTS_COPY( OutputsWritten.index_bitset, r300->state.render_inputs_bitset );
if (ctx->FragmentProgram._Current)
InputsRead = ctx->FragmentProgram._Current->Base.InputsRead;
| (fp_reg << R300_RS_ROUTE_DEST_SHIFT);
high_rr = fp_reg;
- if (!(OutputsWritten & (hw_tcl_on ? (1 << (VERT_RESULT_TEX0+i)) : (_TNL_BIT_TEX0<<i)))) {
+ if (!r300_outputs_written_test( &OutputsWritten, VERT_RESULT_TEX0+i, _TNL_ATTRIB_TEX(i) )) {
/* Passing invalid data here can lock the GPU. */
WARN_ONCE("fragprog wants coords for tex%d, vp doesn't provide them!\n", i);
//_mesa_print_program(&CURRENT_VERTEX_SHADER(ctx)->Base);
fp_reg++;
}
/* Need to count all coords enabled at vof */
- if (OutputsWritten & (hw_tcl_on ? (1 << (VERT_RESULT_TEX0+i)) : (_TNL_BIT_TEX0<<i)))
+ if (r300_outputs_written_test( &OutputsWritten, VERT_RESULT_TEX0+i, _TNL_ATTRIB_TEX(i) ))
in_texcoords++;
}
if (InputsRead & FRAG_BIT_COL0) {
- if (!(OutputsWritten & (hw_tcl_on ? (1<<VERT_RESULT_COL0) : _TNL_BIT_COLOR0))) {
+ if (!r300_outputs_written_test( &OutputsWritten, VERT_RESULT_COL0, _TNL_ATTRIB_COLOR0 )) {
WARN_ONCE("fragprog wants col0, vp doesn't provide it\n");
goto out; /* FIXME */
//_mesa_print_program(&CURRENT_VERTEX_SHADER(ctx)->Base);
out:
if (InputsRead & FRAG_BIT_COL1) {
- if (!(OutputsWritten & (hw_tcl_on ? (1<<VERT_RESULT_COL1) : _TNL_BIT_COLOR1))) {
+ if (!r300_outputs_written_test( &OutputsWritten, VERT_RESULT_COL1, _TNL_ATTRIB_COLOR1 )) {
WARN_ONCE("fragprog wants col1, vp doesn't provide it\n");
//exit(-1);
}
)
o_reg += 2;
- if (r300->state.render_inputs & _TNL_BIT_COLOR1) {
+ if (RENDERINPUTS_TEST( r300->state.render_inputs_bitset, _TNL_ATTRIB_COLOR1 )) {
WRITE_OP(
EASY_VSF_OP(MUL, o_reg++, ALL, RESULT),
VSF_REG(r300->state.vap_reg.i_color[1]),
/* Pass through texture coordinates, if any */
for(i=0;i < r300->radeon.glCtx->Const.MaxTextureUnits;i++)
- if(r300->state.render_inputs & (_TNL_BIT_TEX0<<i)){
+ if (RENDERINPUTS_TEST( r300->state.render_inputs_bitset, _TNL_ATTRIB_TEX(i) )){
// fprintf(stderr, "i_tex[%d]=%d\n", i, r300->state.vap_reg.i_tex[i]);
WRITE_OP(
EASY_VSF_OP(MUL, o_reg++ /* 2+i */, ALL, RESULT),
GLuint TclFallback;
GLuint Fallback;
GLuint NewGLState;
- GLuint tnl_index; /* index of bits for last tnl_install_attrs */
+ DECLARE_RENDERINPUTS(tnl_index_bitset); /* index of bits for last tnl_install_attrs */
/* Vertex buffers
*/
radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
+ DECLARE_RENDERINPUTS(index_bitset);
int fmt_0 = 0;
int offset = 0;
+ RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
/* Important:
*/
* build up a hardware vertex.
*/
if ( !rmesa->swtcl.needproj ||
- (index & _TNL_BITS_TEX_ANY)) { /* for projtex */
+ RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) { /* for projtex */
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F,
RADEON_CP_VC_FRMT_XY | RADEON_CP_VC_FRMT_Z | RADEON_CP_VC_FRMT_W0 );
offset = 4;
offset += 1;
rmesa->swtcl.specoffset = 0;
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 ) ||
+ RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
#if MESA_LITTLE_ENDIAN
- if (index & _TNL_BIT_COLOR1) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
rmesa->swtcl.specoffset = offset;
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_RGB,
RADEON_CP_VC_FRMT_PKSPEC );
EMIT_PAD( 3 );
}
- if (index & _TNL_BIT_FOG) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F,
RADEON_CP_VC_FRMT_PKSPEC );
}
EMIT_PAD( 1 );
}
#else
- if (index & _TNL_BIT_FOG) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F,
RADEON_CP_VC_FRMT_PKSPEC );
}
EMIT_PAD( 1 );
}
- if (index & _TNL_BIT_COLOR1) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
rmesa->swtcl.specoffset = offset;
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR,
RADEON_CP_VC_FRMT_PKSPEC );
#endif
}
- if (index & _TNL_BITS_TEX_ANY) {
+ if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
int i;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
- if (index & _TNL_BIT_TEX(i)) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) {
GLuint sz = VB->TexCoordPtr[i]->size;
switch (sz) {
}
}
- if ( rmesa->tnl_index != index ||
+ if (!RENDERINPUTS_EQUAL( rmesa->tnl_index_bitset, index_bitset ) ||
fmt_0 != rmesa->swtcl.vertex_format) {
RADEON_NEWPRIM(rmesa);
rmesa->swtcl.vertex_format = fmt_0;
rmesa->swtcl.vertex_attr_count,
NULL, 0 );
rmesa->swtcl.vertex_size /= 4;
- rmesa->tnl_index = index;
+ RENDERINPUTS_COPY( rmesa->tnl_index_bitset, index_bitset );
if (RADEON_DEBUG & DEBUG_VERTS)
fprintf( stderr, "%s: vertex_size= %d floats\n",
__FUNCTION__, rmesa->swtcl.vertex_size);
* bigger one.
*/
- if ( ((tnl->render_inputs & (_TNL_BITS_TEX_ANY|_TNL_BIT_COLOR1) ) == 0)
- || (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
+ if ((!RENDERINPUTS_TEST_RANGE( tnl->render_inputs_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX ) &&
+ !RENDERINPUTS_TEST( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 ))
+ || (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
rmesa->swtcl.needproj = GL_TRUE;
se_coord_fmt = (RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
RADEON_VTX_Z_PRE_MULT_1_OVER_W0 |
*/
_tnl_invalidate_vertex_state( ctx, ~0 );
_tnl_invalidate_vertices( ctx, ~0 );
- rmesa->tnl_index = 0;
+ RENDERINPUTS_ZERO( rmesa->tnl_index_bitset );
radeonChooseVertexState( ctx );
radeonChooseRenderState( ctx );
}
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
+ DECLARE_RENDERINPUTS(index_bitset);
- if (index & _TNL_BIT_TEX(0) && VB->TexCoordPtr[0]->size == 4) {
- if ((index & _TNL_BITS_TEX_ANY) == _TNL_BIT_TEX(0))
+ RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
+
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 ) && VB->TexCoordPtr[0]->size == 4) {
+ if (!RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_ATTRIB_TEX1, _TNL_LAST_TEX ))
return GL_TRUE; /* apply ptex hack */
else
FALLBACK(ctx, SAVAGE_FALLBACK_PROJ_TEXTURE, GL_TRUE);
}
- if ((index & _TNL_BIT_TEX(1)) && VB->TexCoordPtr[1]->size == 4)
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 ) && VB->TexCoordPtr[1]->size == 4)
FALLBACK(ctx, SAVAGE_FALLBACK_PROJ_TEXTURE, GL_TRUE);
return GL_FALSE; /* don't apply ptex hack */
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
+ DECLARE_RENDERINPUTS(index_bitset);
GLuint setupIndex = SAVAGE_EMIT_XYZ;
GLubyte skip;
+ RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
imesa->vertex_attr_count = 0;
skip = SAVAGE_SKIP_ALL_S3D;
/* EMIT_ATTR's must be in order as they tell t_vertex.c how to
* build up a hardware vertex.
*/
- if ((index & _TNL_BITS_TEX_ANY) || !(ctx->_TriangleCaps & DD_FLATSHADE))
+ if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX ) || !(ctx->_TriangleCaps & DD_FLATSHADE))
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, SAVAGE_EMIT_W, SAVAGE_SKIP_W );
else {
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT, 0, 0 );
/* t_context.c always includes a diffuse color */
EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, SAVAGE_EMIT_C0, SAVAGE_SKIP_C0 );
- if ((index & _TNL_BIT_COLOR1))
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 ))
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, SAVAGE_EMIT_C1, SAVAGE_SKIP_C1 );
else
EMIT_PAD( 3 );
- if ((index & _TNL_BIT_FOG))
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG ))
EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, SAVAGE_EMIT_FOG, SAVAGE_SKIP_C1 );
else
EMIT_PAD( 1 );
skip &= ~SAVAGE_SKIP_C1;
- if (index & _TNL_BIT_TEX(0)) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 )) {
if (imesa->ptexHack)
EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_3F_XYW, SAVAGE_EMIT_STQ0, SAVAGE_SKIP_ST0);
else if (VB->TexCoordPtr[0]->size == 4)
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
+ DECLARE_RENDERINPUTS(index_bitset);
GLuint setupIndex = SAVAGE_EMIT_XYZ;
GLubyte skip;
GLuint size, mask;
+ RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
skip = SAVAGE_SKIP_ALL_S4;
skip &= ~SAVAGE_SKIP_Z; /* all mesa vertices have a z coordinate */
- if ((index & _TNL_BITS_TEX_ANY) || !(ctx->_TriangleCaps & DD_FLATSHADE))
+ if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX ) || !(ctx->_TriangleCaps & DD_FLATSHADE))
NEED_ATTR( SAVAGE_EMIT_W, SAVAGE_SKIP_W );
/* t_context.c always includes a diffuse color */
NEED_ATTR( SAVAGE_EMIT_C0, SAVAGE_SKIP_C0 );
-
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
- if ((index & _TNL_BIT_COLOR1))
- NEED_ATTR( SAVAGE_EMIT_C1, SAVAGE_SKIP_C1 );
- if ((index & _TNL_BIT_FOG))
- NEED_ATTR( SAVAGE_EMIT_FOG, SAVAGE_SKIP_C1 );
- }
- if (index & _TNL_BIT_TEX(0)) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 ))
+ NEED_ATTR( SAVAGE_EMIT_C1, SAVAGE_SKIP_C1 );
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG ))
+ NEED_ATTR( SAVAGE_EMIT_FOG, SAVAGE_SKIP_C1 );
+
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 )) {
if (imesa->ptexHack)
NEED_ATTR( SAVAGE_EMIT_STQ0, SAVAGE_SKIP_ST0);
else if (VB->TexCoordPtr[0]->size == 4)
else
NEED_ATTR( SAVAGE_EMIT_S0, SAVAGE_SKIP_S0 );
}
- if (index & _TNL_BIT_TEX(1)) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 )) {
if (VB->TexCoordPtr[1]->size == 4)
/* projective textures are not supported by the hardware */
assert (0); /* should be caught by savageCheckPTexHack */
GLint drawableID;
GLint GlobalFlag;
- GLuint last_tcl_state;
+ DECLARE_RENDERINPUTS(last_tcl_state_bitset);
/* Stereo */
GLboolean useStereo;
TNLcontext *tnl = TNL_CONTEXT(ctx);
sisContextPtr smesa = SIS_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
+ DECLARE_RENDERINPUTS(index_bitset);
GLuint AGPParseSet = smesa->AGPParseSet;
GLboolean tex_fallback = GL_FALSE;
+ RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
+
if (ctx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT &&
smesa->driDrawable->numClipRects != 0)
{
AGPParseSet &= ~(MASK_VertexDWSize | MASK_VertexDataFormat);
AGPParseSet |= SiS_PS_HAS_XYZ | SiS_PS_HAS_DIFFUSE;
- if (index & _TNL_BITS_TEX_ANY) {
+ if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
EMIT_ATTR(_TNL_ATTRIB_POS, EMIT_4F_VIEWPORT);
AGPParseSet |= SiS_PS_HAS_W;
smesa->coloroffset = 4;
EMIT_ATTR(_TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA);
smesa->specoffset = 0;
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 ) ||
+ RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
AGPParseSet |= SiS_PS_HAS_SPECULAR;
- if (index & _TNL_BIT_COLOR1) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
EMIT_ATTR(_TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR);
smesa->specoffset = smesa->coloroffset + 1;
} else {
EMIT_PAD(3);
}
- if (index & _TNL_BIT_FOG) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
EMIT_ATTR(_TNL_ATTRIB_FOG, EMIT_1UB_1F);
} else {
EMIT_PAD(1);
}
/* projective textures are not supported by the hardware */
- if (index & _TNL_BIT_TEX(0)) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 )) {
if (VB->TexCoordPtr[0]->size > 2)
tex_fallback = GL_TRUE;
EMIT_ATTR(_TNL_ATTRIB_TEX0, EMIT_2F);
AGPParseSet |= SiS_PS_HAS_UV0;
}
/* Will only hit tex1 on SiS300 */
- if (index & _TNL_BIT_TEX(1)) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 )) {
if (VB->TexCoordPtr[1]->size > 2)
tex_fallback = GL_TRUE;
EMIT_ATTR(_TNL_ATTRIB_TEX1, EMIT_2F);
}
FALLBACK(smesa, SIS_FALLBACK_TEXTURE, tex_fallback);
- if (smesa->last_tcl_state != index) {
+ if (!RENDERINPUTS_EQUAL( smesa->last_tcl_state_bitset, index_bitset )) {
smesa->AGPParseSet = AGPParseSet;
smesa->vertex_size = _tnl_install_attrs( ctx, smesa->vertex_attrs,
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint index = tnl->render_inputs;
+ DECLARE_RENDERINPUTS(index_bitset);
GLuint regCmdB = HC_HVPMSK_X | HC_HVPMSK_Y | HC_HVPMSK_Z;
GLuint setupIndex = 0;
+ RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
vmesa->vertex_attr_count = 0;
/* EMIT_ATTR's must be in order as they tell t_vertex.c how to
* build up a hardware vertex.
*/
- if (index & (_TNL_BITS_TEX_ANY|_TNL_BIT_FOG)) {
+ if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX ) ||
+ RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, VIA_EMIT_W, HC_HVPMSK_W );
vmesa->coloroffset = 4;
}
HC_HVPMSK_Cd );
vmesa->specoffset = 0;
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
- if ((index & _TNL_BIT_COLOR1)) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 ) ||
+ RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
vmesa->specoffset = vmesa->coloroffset + 1;
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, VIA_EMIT_SPEC,
HC_HVPMSK_Cs );
else
EMIT_PAD( 3 );
- if ((index & _TNL_BIT_FOG))
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG ))
EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, VIA_EMIT_FOG, HC_HVPMSK_Cs );
else
EMIT_PAD( 1 );
}
- if (index & _TNL_BIT_TEX(0)) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 )) {
if (vmesa->ptexHack)
EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_3F_XYW, VIA_EMIT_PTEX0,
(HC_HVPMSK_S | HC_HVPMSK_T) );
(HC_HVPMSK_S | HC_HVPMSK_T) );
}
- if (index & _TNL_BIT_TEX(1)) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 )) {
EMIT_ATTR( _TNL_ATTRIB_TEX1, EMIT_2F, VIA_EMIT_TEX1,
(HC_HVPMSK_S | HC_HVPMSK_T) );
}
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
+ DECLARE_RENDERINPUTS(index_bitset);
GLboolean fallback = GL_FALSE;
GLboolean ptexHack = GL_FALSE;
- if (index & _TNL_BIT_TEX(0) && VB->TexCoordPtr[0]->size == 4) {
- if ((index & _TNL_BITS_TEX_ANY) == _TNL_BIT_TEX(0))
+ RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
+
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 ) && VB->TexCoordPtr[0]->size == 4) {
+ if (!RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_ATTRIB_TEX1, _TNL_LAST_TEX ))
ptexHack = GL_TRUE;
else
fallback = GL_TRUE;
}
- if ((index & _TNL_BIT_TEX(1)) && VB->TexCoordPtr[1]->size == 4)
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 ) && VB->TexCoordPtr[1]->size == 4)
fallback = GL_TRUE;
FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_PROJ_TEXTURE, fallback);
* Mesa 3-D graphics library
* Version: 6.5
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS) {
ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1);
}
else
void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS) {
ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1);
}
else
void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS) {
ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1);
}
else
void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS) {
ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1);
}
else
GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS) {
ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1);
}
else
void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS) {
ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1);
}
else
GLfloat y, GLfloat z, GLfloat w )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS) {
ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w);
}
else
void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS) {
ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]);
}
else
}
-/*
- * XXX Un-alias attribs here
- */
void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, 0, 0, 1);
}
else
_mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fARB" );
void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], 0, 0, 1);
}
else
_mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fvARB" );
void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, 0, 1);
}
else
_mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fARB" );
void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], 0, 1);
}
else
_mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fvARB" );
GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, z, 1);
}
else
_mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fARB" );
void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], v[2], 1);
}
else
_mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fvARB" );
GLfloat y, GLfloat z, GLfloat w )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, z, w);
}
else
_mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fARB" );
void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- if (index < VERT_ATTRIB_MAX) {
- ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]);
+ if (index < MAX_VERTEX_ATTRIBS) {
+ ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], v[2], v[3]);
}
else
_mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fvARB" );
-/*\r
- * Mesa 3-D graphics library\r
- * Version: 6.5\r
- *\r
- * Copyright (C) 2006 Brian Paul All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a\r
- * copy of this software and associated documentation files (the "Software"),\r
- * to deal in the Software without restriction, including without limitation\r
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
- * and/or sell copies of the Software, and to permit persons to whom the\r
- * Software is furnished to do so, subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included\r
- * in all copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- */\r
-\r
-/**\r
- * \file bitset.h\r
- * \brief Bitset of arbitrary size definitions.\r
- * \author Michal Krol\r
- */\r
-\r
-#define BITSET_WORD GLuint\r
-#define BITSET_WORDBITS (sizeof (BITSET_WORD) * 8)\r
-\r
-/* bitset declarations\r
- */\r
-#define BITSET_DECLARE(name, size) \\r
- BITSET_WORD name[((size) + BITSET_WORDBITS - 1) / BITSET_WORDBITS]\r
-\r
-/* bitset operations\r
- */\r
-#define BITSET_COPY(x, y) _mesa_memcpy( (x), (y), sizeof (x) )\r
-#define BITSET_EQUAL(x, y) (_mesa_memcmp( (x), (y), sizeof (x) ) == 0)\r
-#define BITSET_ZERO(x) _mesa_memset( (x), 0, sizeof (x) )\r
-#define BITSET_ONES(x) _mesa_memset( (x), 0xff, sizeof (x) )\r
-\r
-#define BITSET_BITWORD(b) ((b) / BITSET_WORDBITS)\r
-#define BITSET_BIT(b) (1 << ((b) % BITSET_WORDBITS))\r
-\r
-/* single bit operations\r
- */\r
-#define BITSET_TEST(x, b) ((x)[BITSET_BITWORD(b)] & BITSET_BIT(b))\r
-#define BITSET_SET(x, b) ((x)[BITSET_BITWORD(b)] |= BITSET_BIT(b))\r
-#define BITSET_CLEAR(x, b) ((x)[BITSET_BITWORD(b)] &= ~BITSET_BIT(b))\r
-\r
-#define BITSET_MASK(b) ((b) == BITSET_WORDBITS ? ~0 : BITSET_BIT(b) - 1)\r
-#define BITSET_RANGE(b, e) (BITSET_MASK((e) + 1) & ~BITSET_MASK(b))\r
-\r
-/* bit range operations\r
- */\r
-#define BITSET_TEST_RANGE(x, b, e) \\r
- (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \\r
- ((x)[BITSET_BITWORD(b)] & BITSET_RANGE(b, e)) : \\r
- (assert (!"BITSET_TEST_RANGE: bit range crosses word boundary"), 0))\r
-#define BITSET_SET_RANGE(x, b, e) \\r
- (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \\r
- ((x)[BITSET_BITWORD(b)] |= BITSET_RANGE(b, e)) : \\r
- (assert (!"BITSET_SET_RANGE: bit range crosses word boundary"), 0))\r
-#define BITSET_CLEAR_RANGE(x, b, e) \\r
- (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \\r
- ((x)[BITSET_BITWORD(b)] &= ~BITSET_RANGE(b, e)) : \\r
- (assert (!"BITSET_CLEAR_RANGE: bit range crosses word boundary"), 0))\r
-\r
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ *
+ * Copyright (C) 2006 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file bitset.h
+ * \brief Bitset of arbitrary size definitions.
+ * \author Michal Krol
+ */
+
+/****************************************************************************
+ * generic bitset implementation
+ */
+
+#define BITSET_WORD GLuint
+#define BITSET_WORDBITS (sizeof (BITSET_WORD) * 8)
+
+/* bitset declarations
+ */
+#define BITSET_DECLARE(name, size) \
+ BITSET_WORD name[((size) + BITSET_WORDBITS - 1) / BITSET_WORDBITS]
+
+/* bitset operations
+ */
+#define BITSET_COPY(x, y) _mesa_memcpy( (x), (y), sizeof (x) )
+#define BITSET_EQUAL(x, y) (_mesa_memcmp( (x), (y), sizeof (x) ) == 0)
+#define BITSET_ZERO(x) _mesa_memset( (x), 0, sizeof (x) )
+#define BITSET_ONES(x) _mesa_memset( (x), 0xff, sizeof (x) )
+
+#define BITSET_BITWORD(b) ((b) / BITSET_WORDBITS)
+#define BITSET_BIT(b) (1 << ((b) % BITSET_WORDBITS))
+
+/* single bit operations
+ */
+#define BITSET_TEST(x, b) ((x)[BITSET_BITWORD(b)] & BITSET_BIT(b))
+#define BITSET_SET(x, b) ((x)[BITSET_BITWORD(b)] |= BITSET_BIT(b))
+#define BITSET_CLEAR(x, b) ((x)[BITSET_BITWORD(b)] &= ~BITSET_BIT(b))
+
+#define BITSET_MASK(b) ((b) == BITSET_WORDBITS ? ~0 : BITSET_BIT(b) - 1)
+#define BITSET_RANGE(b, e) (BITSET_MASK((e) + 1) & ~BITSET_MASK(b))
+
+/* bit range operations
+ */
+#define BITSET_TEST_RANGE(x, b, e) \
+ (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
+ ((x)[BITSET_BITWORD(b)] & BITSET_RANGE(b, e)) : \
+ (assert (!"BITSET_TEST_RANGE: bit range crosses word boundary"), 0))
+#define BITSET_SET_RANGE(x, b, e) \
+ (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
+ ((x)[BITSET_BITWORD(b)] |= BITSET_RANGE(b, e)) : \
+ (assert (!"BITSET_SET_RANGE: bit range crosses word boundary"), 0))
+#define BITSET_CLEAR_RANGE(x, b, e) \
+ (BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
+ ((x)[BITSET_BITWORD(b)] &= ~BITSET_RANGE(b, e)) : \
+ (assert (!"BITSET_CLEAR_RANGE: bit range crosses word boundary"), 0))
+
+/****************************************************************************
+ * 64-bit bitset implementation
+ */
+
+#define BITSET64_WORD GLuint
+#define BITSET64_WORDBITS (sizeof (BITSET64_WORD) * 8)
+
+/* bitset declarations
+ */
+#define BITSET64_DECLARE(name, size) \
+ GLuint name[2]
+
+/* bitset operations
+ */
+#define BITSET64_COPY(x, y) do { (x)[0] = (y)[0]; (x)[1] = (y)[1]; } while (0)
+#define BITSET64_EQUAL(x, y) ( (x)[0] == (y)[0] && (x)[1] == (y)[1] )
+#define BITSET64_ZERO(x) do { (x)[0] = 0; (x)[1] = 0; } while (0)
+#define BITSET64_ONES(x) do { (x)[0] = 0xFF; (x)[1] = 0xFF; } while (0)
+
+#define BITSET64_BITWORD(b) ((b) / BITSET64_WORDBITS)
+#define BITSET64_BIT(b) (1 << ((b) % BITSET64_WORDBITS))
+
+/* single bit operations
+ */
+#define BITSET64_TEST(x, b) ((x)[BITSET64_BITWORD(b)] & BITSET64_BIT(b))
+#define BITSET64_SET(x, b) ((x)[BITSET64_BITWORD(b)] |= BITSET64_BIT(b))
+#define BITSET64_CLEAR(x, b) ((x)[BITSET64_BITWORD(b)] &= ~BITSET64_BIT(b))
+
+#define BITSET64_MASK(b) ((b) == BITSET64_WORDBITS ? ~0 : BITSET64_BIT(b) - 1)
+#define BITSET64_RANGE(b, e) (BITSET64_MASK((e) + 1) & ~BITSET64_MASK(b))
+
+/* bit range operations
+ */
+#define BITSET64_TEST_RANGE(x, b, e) \
+ (BITSET64_BITWORD(b) == BITSET64_BITWORD(e) ? \
+ ((x)[BITSET64_BITWORD(b)] & BITSET64_RANGE(b, e)) : \
+ (assert (!"BITSET64_TEST_RANGE: bit range crosses word boundary"), 0))
+#define BITSET64_SET_RANGE(x, b, e) \
+ (BITSET64_BITWORD(b) == BITSET64_BITWORD(e) ? \
+ ((x)[BITSET64_BITWORD(b)] |= BITSET64_RANGE(b, e)) : \
+ (assert (!"BITSET64_SET_RANGE: bit range crosses word boundary"), 0))
+#define BITSET64_CLEAR_RANGE(x, b, e) \
+ (BITSET64_BITWORD(b) == BITSET64_BITWORD(e) ? \
+ ((x)[BITSET64_BITWORD(b)] &= ~BITSET64_RANGE(b, e)) : \
+ (assert (!"BITSET64_CLEAR_RANGE: bit range crosses word boundary"), 0))
+
n[2].f = x;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 1;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
n[3].f = y;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 2;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
n[4].f = z;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 3;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
n[5].f = w;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 4;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
n[2].f = x;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 1;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
n[3].f = y;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 2;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
n[4].f = z;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 3;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
n[5].f = w;
}
- ASSERT(attr < VERT_ATTRIB_MAX);
+ ASSERT(attr < MAX_VERTEX_ATTRIBS);
ctx->ListState.ActiveAttribSize[attr] = 4;
ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
static void GLAPIENTRY
save_VertexAttrib1fNV(GLuint index, GLfloat x)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr1fNV(index, x);
else
index_error();
static void GLAPIENTRY
save_VertexAttrib1fvNV(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr1fNV(index, v[0]);
else
index_error();
static void GLAPIENTRY
save_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr2fNV(index, x, y);
else
index_error();
static void GLAPIENTRY
save_VertexAttrib2fvNV(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr2fNV(index, v[0], v[1]);
else
index_error();
static void GLAPIENTRY
save_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr3fNV(index, x, y, z);
else
index_error();
static void GLAPIENTRY
save_VertexAttrib3fvNV(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr3fNV(index, v[0], v[1], v[2]);
else
index_error();
save_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y,
GLfloat z, GLfloat w)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr4fNV(index, x, y, z, w);
else
index_error();
static void GLAPIENTRY
save_VertexAttrib4fvNV(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
save_Attr4fNV(index, v[0], v[1], v[2], v[3]);
else
index_error();
static void GLAPIENTRY
save_VertexAttrib1fARB(GLuint index, GLfloat x)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr1fARB(index, x);
else
index_error();
static void GLAPIENTRY
save_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr1fARB(index, v[0]);
else
index_error();
static void GLAPIENTRY
save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr2fARB(index, x, y);
else
index_error();
static void GLAPIENTRY
save_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr2fARB(index, v[0], v[1]);
else
index_error();
static void GLAPIENTRY
save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr3fARB(index, x, y, z);
else
index_error();
static void GLAPIENTRY
save_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr3fARB(index, v[0], v[1], v[2]);
else
index_error();
save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
GLfloat w)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr4fARB(index, x, y, z, w);
else
index_error();
static void GLAPIENTRY
save_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
save_Attr4fARB(index, v[0], v[1], v[2], v[3]);
else
index_error();
#include "glapitable.h"
#include "glthread.h"
#include "math/m_matrix.h" /* GLmatrix */
+#include "bitset.h"
/**
VERT_ATTRIB_GENERIC1 = 17,
VERT_ATTRIB_GENERIC2 = 18,
VERT_ATTRIB_GENERIC3 = 19,
- VERT_ATTRIB_MAX = 16 /* XXX not counting generic attribs yet */
+ VERT_ATTRIB_GENERIC4 = 20,
+ VERT_ATTRIB_GENERIC5 = 21,
+ VERT_ATTRIB_GENERIC6 = 22,
+ VERT_ATTRIB_GENERIC7 = 23,
+ VERT_ATTRIB_GENERIC8 = 24,
+ VERT_ATTRIB_GENERIC9 = 25,
+ VERT_ATTRIB_GENERIC10 = 26,
+ VERT_ATTRIB_GENERIC11 = 27,
+ VERT_ATTRIB_GENERIC12 = 28,
+ VERT_ATTRIB_GENERIC13 = 29,
+ VERT_ATTRIB_GENERIC14 = 30,
+ VERT_ATTRIB_GENERIC15 = 31,
+ VERT_ATTRIB_MAX = 32
};
/**
#define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1)
#define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2)
#define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3)
+#define VERT_BIT_GENERIC4 (1 << VERT_ATTRIB_GENERIC4)
+#define VERT_BIT_GENERIC5 (1 << VERT_ATTRIB_GENERIC5)
+#define VERT_BIT_GENERIC6 (1 << VERT_ATTRIB_GENERIC6)
+#define VERT_BIT_GENERIC7 (1 << VERT_ATTRIB_GENERIC7)
+#define VERT_BIT_GENERIC8 (1 << VERT_ATTRIB_GENERIC8)
+#define VERT_BIT_GENERIC9 (1 << VERT_ATTRIB_GENERIC9)
+#define VERT_BIT_GENERIC10 (1 << VERT_ATTRIB_GENERIC10)
+#define VERT_BIT_GENERIC11 (1 << VERT_ATTRIB_GENERIC11)
+#define VERT_BIT_GENERIC12 (1 << VERT_ATTRIB_GENERIC12)
+#define VERT_BIT_GENERIC13 (1 << VERT_ATTRIB_GENERIC13)
+#define VERT_BIT_GENERIC14 (1 << VERT_ATTRIB_GENERIC14)
+#define VERT_BIT_GENERIC15 (1 << VERT_ATTRIB_GENERIC15)
#define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u)))
#define VERT_BIT_GENERIC(g) (1 << (VERT_ATTRIB_GENERIC0 + (g)))
/*@}*/
+/**
+ * GLSL allows shader writers to allocate vertex result attributes (varyings) in
+ * single float component granularity. This is in contrast to vertex / fragment
+ * programs, where result attributes (actually texcoords) were allocated
+ * in 4-component vectors of floats granularity.
+ * For performance reasons, it would be optimal to stick with this scheme on a scalar
+ * processor. Varyings will likely be allocated as 3-component vectors, so statistically
+ * we win 2 floats.
+ * The constant VARYINGS_PER_VECTOR tells us how much of float components we pack into
+ * one result vector. For scalar processor it would be 1, for vector processor - 4.
+ *
+ * NOTE: Currently we pack varyings into vertex attributes.
+ */
+#define VARYINGS_PER_VECTOR 2
+#define VARYING_EMIT_STYLE EMIT_2F
+#define MAX_VARYING_VECTORS ((MAX_VARYING_FLOATS + VARYINGS_PER_VECTOR - 1) / VARYINGS_PER_VECTOR)
+
/**
* Indexes for vertex program result attributes
*/
/* find min of _MaxElement values for all enabled arrays */
/* 0 */
- if (ctx->VertexProgram._Enabled
+ if (ctx->ShaderObjects._VertexShaderPresent
+ && ctx->Array.VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled) {
+ min = ctx->Array.VertexAttrib[VERT_ATTRIB_GENERIC0]._MaxElement;
+ }
+ else if (ctx->VertexProgram._Enabled
&& ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled) {
min = ctx->Array.VertexAttrib[VERT_ATTRIB_POS]._MaxElement;
}
}
/* 8..15 */
- for (i = VERT_ATTRIB_TEX0; i < VERT_ATTRIB_MAX; i++) {
+ for (i = VERT_ATTRIB_TEX0; i <= VERT_ATTRIB_TEX7; i++) {
if (ctx->VertexProgram._Enabled
&& ctx->Array.VertexAttrib[i].Enabled) {
min = MIN2(min, ctx->Array.VertexAttrib[i]._MaxElement);
}
}
+ /* 16..31 */
+ if (ctx->ShaderObjects._VertexShaderPresent) {
+ for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) {
+ if (ctx->Array.VertexAttrib[i].Enabled) {
+ min = MIN2(min, ctx->Array.VertexAttrib[i]._MaxElement);
+ }
+ }
+ }
+
if (ctx->Array.Index.Enabled) {
min = MIN2(min, ctx->Array.Index._MaxElement);
}
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.5
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (index >= VERT_ATTRIB_MAX) {
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) {
_mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(index)");
return;
}
* Mesa 3-D graphics library
* Version: 6.5
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
{
GLint i = parse_integer(inst, Program);
- if ((i < 0) || (i > MAX_VERTEX_PROGRAM_ATTRIBS))
+ if ((i < 0) || (i >= MAX_VERTEX_PROGRAM_ATTRIBS))
{
_mesa_set_program_error (ctx, Program->Position,
"Invalid generic vertex attribute index");
* Mesa 3-D graphics library
* Version: 6.5
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
params[0] = ctx->Array.VertexAttrib[index].Normalized;
break;
case GL_CURRENT_VERTEX_ATTRIB_ARB:
- FLUSH_CURRENT(ctx, 0);
- /* XXX should read:
- COPY_4V(params, ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]);
- */
- COPY_4V(params, ctx->Current.Attrib[index]);
+ FLUSH_CURRENT(ctx, 0);
+ COPY_4V(params, ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]);
break;
case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
if (!ctx->Extensions.ARB_vertex_buffer_object) {
* Mesa 3-D graphics library
* Version: 6.5
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
{
/* Input registers get initialized from the current vertex attribs */
MEMCPY(ctx->VertexProgram.Inputs, ctx->Current.Attrib,
- VERT_ATTRIB_MAX * 4 * sizeof(GLfloat));
+ MAX_VERTEX_PROGRAM_ATTRIBS * 4 * sizeof(GLfloat));
if (ctx->VertexProgram.Current->IsNVProgram) {
GLuint i;
-/*\r
- * Mesa 3-D graphics library\r
- * Version: 6.5\r
- *\r
- * Copyright (C) 2006 Brian Paul All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a\r
- * copy of this software and associated documentation files (the "Software"),\r
- * to deal in the Software without restriction, including without limitation\r
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
- * and/or sell copies of the Software, and to permit persons to whom the\r
- * Software is furnished to do so, subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included\r
- * in all copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * Authors:\r
- * Michal Krol\r
- */\r
-\r
-#include "glheader.h"\r
-#include "context.h"\r
-#include "colormac.h"\r
-#include "s_arbshader.h"\r
-#include "s_context.h"\r
-#include "shaderobjects.h"\r
-#include "shaderobjects_3dlabs.h"\r
-#include "slang_utility.h"\r
-#include "slang_link.h"\r
-\r
-void _swrast_exec_arbshader (GLcontext *ctx, struct sw_span *span)\r
-{\r
- struct gl2_program_intf **pro;\r
- GLuint i;\r
-\r
- if (!ctx->ShaderObjects._FragmentShaderPresent)\r
- return;\r
- pro = ctx->ShaderObjects.CurrentProgram;\r
- if (!ctx->ShaderObjects._VertexShaderPresent)\r
- (**pro).UpdateFixedUniforms (pro);\r
-\r
- for (i = span->start; i < span->end; i++)\r
- {\r
- /* only run shader on active fragments */\r
- if (span->array->mask[i]) {\r
- GLfloat vec[4];\r
- GLuint j;\r
- GLboolean discard;\r
-\r
- vec[0] = (GLfloat) span->x + i;\r
- vec[1] = (GLfloat) span->y;\r
- vec[2] = (GLfloat) span->array->z[i] / ctx->DrawBuffer->_DepthMaxF;\r
- vec[3] = span->w + span->dwdx * i;\r
- (**pro).UpdateFixedVarying (pro, SLANG_FRAGMENT_FIXED_FRAGCOORD, vec, 0,\r
- 4 * sizeof (GLfloat), GL_TRUE);\r
- vec[0] = CHAN_TO_FLOAT(span->array->rgba[i][RCOMP]);\r
- vec[1] = CHAN_TO_FLOAT(span->array->rgba[i][GCOMP]);\r
- vec[2] = CHAN_TO_FLOAT(span->array->rgba[i][BCOMP]);\r
- vec[3] = CHAN_TO_FLOAT(span->array->rgba[i][ACOMP]);\r
- (**pro).UpdateFixedVarying (pro, SLANG_FRAGMENT_FIXED_COLOR, vec, 0, 4 * sizeof (GLfloat),\r
- GL_TRUE);\r
- for (j = 0; j < ctx->Const.MaxTextureCoordUnits; j++)\r
- {\r
- vec[0] = span->array->texcoords[j][i][0];\r
- vec[1] = span->array->texcoords[j][i][1];\r
- vec[2] = span->array->texcoords[j][i][2];\r
- vec[3] = span->array->texcoords[j][i][3];\r
- (**pro).UpdateFixedVarying (pro, SLANG_FRAGMENT_FIXED_TEXCOORD, vec, j,\r
- 4 * sizeof (GLfloat), GL_TRUE);\r
- }\r
-\r
- _slang_exec_fragment_shader (pro);\r
-\r
- _slang_fetch_discard (pro, &discard);\r
- if (discard)\r
- {\r
- span->array->mask[i] = GL_FALSE;\r
- span->writeAll = GL_FALSE;\r
- }\r
- else\r
- {\r
- (**pro).UpdateFixedVarying (pro, SLANG_FRAGMENT_FIXED_FRAGCOLOR, vec, 0,\r
- 4 * sizeof (GLfloat), GL_FALSE);\r
- UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][RCOMP], vec[0]);\r
- UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][GCOMP], vec[1]);\r
- UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][BCOMP], vec[2]);\r
- UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][ACOMP], vec[3]);\r
- }\r
- }\r
- }\r
-}\r
-\r
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ *
+ * Copyright (C) 2006 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Michal Krol
+ */
+
+#include "glheader.h"
+#include "context.h"
+#include "colormac.h"
+#include "s_arbshader.h"
+#include "s_context.h"
+#include "shaderobjects.h"
+#include "shaderobjects_3dlabs.h"
+#include "slang_utility.h"
+#include "slang_link.h"
+
+void _swrast_exec_arbshader (GLcontext *ctx, struct sw_span *span)
+{
+ struct gl2_program_intf **pro;
+ GLuint i;
+
+ if (!ctx->ShaderObjects._FragmentShaderPresent)
+ return;
+ pro = ctx->ShaderObjects.CurrentProgram;
+ if (!ctx->ShaderObjects._VertexShaderPresent)
+ (**pro).UpdateFixedUniforms (pro);
+
+ for (i = span->start; i < span->end; i++)
+ {
+ /* only run shader on active fragments */
+ if (span->array->mask[i]) {
+ GLfloat vec[4];
+ GLuint j;
+ GLboolean discard;
+
+ vec[0] = (GLfloat) span->x + i;
+ vec[1] = (GLfloat) span->y;
+ vec[2] = (GLfloat) span->array->z[i] / ctx->DrawBuffer->_DepthMaxF;
+ vec[3] = span->w + span->dwdx * i;
+ (**pro).UpdateFixedVarying (pro, SLANG_FRAGMENT_FIXED_FRAGCOORD, vec, 0,
+ 4 * sizeof (GLfloat), GL_TRUE);
+ vec[0] = CHAN_TO_FLOAT(span->array->rgba[i][RCOMP]);
+ vec[1] = CHAN_TO_FLOAT(span->array->rgba[i][GCOMP]);
+ vec[2] = CHAN_TO_FLOAT(span->array->rgba[i][BCOMP]);
+ vec[3] = CHAN_TO_FLOAT(span->array->rgba[i][ACOMP]);
+ (**pro).UpdateFixedVarying (pro, SLANG_FRAGMENT_FIXED_COLOR, vec, 0, 4 * sizeof (GLfloat),
+ GL_TRUE);
+ for (j = 0; j < ctx->Const.MaxTextureCoordUnits; j++)
+ {
+ vec[0] = span->array->texcoords[j][i][0];
+ vec[1] = span->array->texcoords[j][i][1];
+ vec[2] = span->array->texcoords[j][i][2];
+ vec[3] = span->array->texcoords[j][i][3];
+ (**pro).UpdateFixedVarying (pro, SLANG_FRAGMENT_FIXED_TEXCOORD, vec, j,
+ 4 * sizeof (GLfloat), GL_TRUE);
+ }
+ for (j = 0; j < MAX_VARYING_VECTORS; j++)
+ {
+ GLuint k;
+
+ for (k = 0; k < VARYINGS_PER_VECTOR; k++)
+ {
+ (**pro).UpdateVarying (pro, j * VARYINGS_PER_VECTOR + k,
+ &span->array->varying[i][j][k], GL_FALSE);
+ }
+ }
+
+ _slang_exec_fragment_shader (pro);
+
+ _slang_fetch_discard (pro, &discard);
+ if (discard)
+ {
+ span->array->mask[i] = GL_FALSE;
+ span->writeAll = GL_FALSE;
+ }
+ else
+ {
+ (**pro).UpdateFixedVarying (pro, SLANG_FRAGMENT_FIXED_FRAGCOLOR, vec, 0,
+ 4 * sizeof (GLfloat), GL_FALSE);
+ UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][RCOMP], vec[0]);
+ UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][GCOMP], vec[1]);
+ UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][BCOMP], vec[2]);
+ UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][ACOMP], vec[3]);
+ }
+ }
+ }
+}
+
* Mesa 3-D graphics library
* Version: 6.5
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#define SPAN_FLAT 0x400 /**< flat shading? */
#define SPAN_XY 0x800
#define SPAN_MASK 0x1000
+#define SPAN_VARYING 0x2000
/*@}*/
GLfloat texcoords[MAX_TEXTURE_COORD_UNITS][MAX_WIDTH][4];
GLfloat lambda[MAX_TEXTURE_COORD_UNITS][MAX_WIDTH];
GLfloat coverage[MAX_WIDTH];
+ GLfloat varying[MAX_WIDTH][MAX_VARYING_VECTORS][VARYINGS_PER_VECTOR];
/** This mask indicates which fragments are alive or culled */
GLubyte mask[MAX_WIDTH];
GLfloat texStepX[MAX_TEXTURE_COORD_UNITS][4];
GLfloat texStepY[MAX_TEXTURE_COORD_UNITS][4];
GLfixed intTex[2], intTexStep[2]; /* s, t only */
+ GLfloat var[MAX_VARYING_VECTORS][VARYINGS_PER_VECTOR];
+ GLfloat varStepX[MAX_VARYING_VECTORS][VARYINGS_PER_VECTOR];
+ GLfloat varStepY[MAX_VARYING_VECTORS][VARYINGS_PER_VECTOR];
/* partial derivatives wrt X and Y. */
GLfloat dzdx, dzdy;
#include "imports.h"
#include "s_atifragshader.h"
-#include "s_alpha.h"\r
+#include "s_alpha.h"
#include "s_arbshader.h"
#include "s_blend.h"
#include "s_context.h"
GLfloat r = span->tex[u][2];
GLfloat q = span->tex[u][3];
GLuint i;
- if (ctx->FragmentProgram._Active || ctx->ATIFragmentShader._Enabled) {
+ if (ctx->FragmentProgram._Active || ctx->ATIFragmentShader._Enabled ||
+ ctx->ShaderObjects._FragmentShaderPresent) {
/* do perspective correction but don't divide s, t, r by q */
const GLfloat dwdx = span->dwdx;
GLfloat w = span->w;
GLfloat r = span->tex[u][2];
GLfloat q = span->tex[u][3];
GLuint i;
- if (ctx->FragmentProgram._Active || ctx->ATIFragmentShader._Enabled) {
+ if (ctx->FragmentProgram._Active || ctx->ATIFragmentShader._Enabled ||
+ ctx->ShaderObjects._FragmentShaderPresent) {
/* do perspective correction but don't divide s, t, r by q */
const GLfloat dwdx = span->dwdx;
GLfloat w = span->w;
GLfloat r = span->tex[0][2];
GLfloat q = span->tex[0][3];
GLuint i;
- if (ctx->FragmentProgram._Active || ctx->ATIFragmentShader._Enabled) {
+ if (ctx->FragmentProgram._Active || ctx->ATIFragmentShader._Enabled ||
+ ctx->ShaderObjects._FragmentShaderPresent) {
/* do perspective correction but don't divide s, t, r by q */
const GLfloat dwdx = span->dwdx;
GLfloat w = span->w;
GLfloat r = span->tex[0][2];
GLfloat q = span->tex[0][3];
GLuint i;
- if (ctx->FragmentProgram._Active || ctx->ATIFragmentShader._Enabled) {
+ if (ctx->FragmentProgram._Active || ctx->ATIFragmentShader._Enabled ||
+ ctx->ShaderObjects._FragmentShaderPresent) {
/* do perspective correction but don't divide s, t, r by q */
const GLfloat dwdx = span->dwdx;
GLfloat w = span->w;
}
+/**
+ * Fill in the span.varying array from the interpolation values.
+ */
+static void
+interpolate_varying(GLcontext *ctx, struct sw_span *span)
+{
+ GLuint i, j;
+
+ ASSERT(span->interpMask & SPAN_VARYING);
+ ASSERT(!(span->arrayMask & SPAN_VARYING));
+
+ span->arrayMask |= SPAN_VARYING;
+
+ for (i = 0; i < MAX_VARYING_VECTORS; i++) {
+ for (j = 0; j < VARYINGS_PER_VECTOR; j++) {
+ const GLfloat dvdx = span->varStepX[i][j];
+ GLfloat v = span->var[i][j];
+ const GLfloat dwdx = span->dwdx;
+ GLfloat w = span->w;
+ GLuint k;
+
+ for (k = 0; k < span->end; k++) {
+ GLfloat invW = 1.0f / w;
+ span->array->varying[k][i][j] = v * invW;
+ v += dvdx;
+ w += dwdx;
+ }
+ }
+ }
+}
+
+
/**
* Apply the current polygon stipple pattern to a span of pixels.
*/
interpolate_texcoords(ctx, span);
}
+ if (ctx->ShaderObjects._FragmentShaderPresent) {
+ interpolate_varying(ctx, span);
+ }
+
/* This is the normal place to compute the resulting fragment color/Z.
* As an optimization, we try to defer this until after Z/stencil
* testing in order to try to avoid computing colors that we won't
if (span->interpMask & SPAN_FOG)
interpolate_fog(ctx, span);
- /* Compute fragment colors with fragment program or texture lookups */\r
- if (ctx->ShaderObjects._FragmentShaderPresent) {\r
- if (span->interpMask & SPAN_Z)\r
- _swrast_span_interpolate_z (ctx, span);\r
- _swrast_exec_arbshader (ctx, span);\r
+ /* Compute fragment colors with fragment program or texture lookups */
+ if (ctx->ShaderObjects._FragmentShaderPresent) {
+ if (span->interpMask & SPAN_Z)
+ _swrast_span_interpolate_z (ctx, span);
+ _swrast_exec_arbshader (ctx, span);
}
else if (ctx->FragmentProgram._Active) {
/* frag prog may need Z values */
if (span->interpMask & SPAN_FOG)
interpolate_fog(ctx, span);
- if (ctx->ShaderObjects._FragmentShaderPresent) {\r
- if (span->interpMask & SPAN_Z)\r
- _swrast_span_interpolate_z (ctx, span);\r
- _swrast_exec_arbshader (ctx, span);\r
- }\r
+ if (ctx->ShaderObjects._FragmentShaderPresent) {
+ if (span->interpMask & SPAN_Z)
+ _swrast_span_interpolate_z (ctx, span);
+ _swrast_exec_arbshader (ctx, span);
+ }
else if (ctx->FragmentProgram._Active)
_swrast_exec_fragment_program( ctx, span );
else if (ctx->ATIFragmentShader._Enabled)
* This file is #include'd to generate custom triangle rasterizers.
*
* The following macros may be defined to indicate what auxillary information
- * must be interplated across the triangle:
+ * must be interpolated across the triangle:
* INTERP_Z - if defined, interpolate vertex Z values
* INTERP_W - if defined, interpolate vertex W values
* INTERP_FOG - if defined, interpolate fog values
* INTERP_TEX - if defined, interpolate set 0 float STRQ texcoords
* NOTE: OpenGL STRQ = Mesa STUV (R was taken for red)
* INTERP_MULTITEX - if defined, interpolate N units of STRQ texcoords
+ * INTERP_VARYING - if defined, interpolate M floats of GLSL varyings
*
* When one can directly address pixels in the color buffer the following
* macros can be defined and used to compute pixel addresses during
+#ifdef INTERP_VARYING
+#define VARYING_LOOP(CODE)\
+ {\
+ GLuint iv, ic;\
+ for (iv = 0; iv < MAX_VARYING_VECTORS; iv++) {\
+ for (ic = 0; ic < VARYINGS_PER_VECTOR; ic++) {\
+ CODE\
+ }\
+ }\
+ }
+#endif
+
+
+
/*
* Some code we unfortunately need to prevent negative interpolated colors.
*/
)
}
#endif
+#ifdef INTERP_VARYING
+ span.interpMask |= SPAN_VARYING;
+ {
+ /* win[3] is 1/W */
+ const GLfloat wMax = vMax->win[3], wMin = vMin->win[3], wMid = vMid->win[3];
+ VARYING_LOOP(
+ GLfloat eMaj_dvar = vMax->attribute[iv][ic] * wMax - vMin->attribute[iv][ic] * wMin;
+ GLfloat eBot_dvar = vMid->attribute[iv][ic] * wMid - vMin->attribute[iv][ic] * wMin;
+ span.varStepX[iv][ic] = oneOverArea * (eMaj_dvar * eBot.dy - eMaj.dy * eBot_dvar);
+ span.varStepY[iv][ic] = oneOverArea * (eMaj.dx * eBot_dvar - eMaj_dvar * eBot.dx);
+ )
+ }
+#endif
/*
* We always sample at pixel centers. However, we avoid
GLfloat duOuter[MAX_TEXTURE_COORD_UNITS], duInner[MAX_TEXTURE_COORD_UNITS];
GLfloat dvOuter[MAX_TEXTURE_COORD_UNITS], dvInner[MAX_TEXTURE_COORD_UNITS];
#endif
+#ifdef INTERP_VARYING
+ GLfloat varLeft[MAX_VARYING_VECTORS][VARYINGS_PER_VECTOR];
+ GLfloat dvarOuter[MAX_VARYING_VECTORS][VARYINGS_PER_VECTOR];
+ GLfloat dvarInner[MAX_VARYING_VECTORS][VARYINGS_PER_VECTOR];
+#endif
for (subTriangle=0; subTriangle<=1; subTriangle++) {
EdgeT *eLeft, *eRight;
duOuter[u] = span.texStepY[u][2] + dxOuter * span.texStepX[u][2];
dvOuter[u] = span.texStepY[u][3] + dxOuter * span.texStepX[u][3];
)
+#endif
+#ifdef INTERP_VARYING
+ VARYING_LOOP(
+ const GLfloat invW = vLower->win[3];
+ const GLfloat var0 = vLower->attribute[iv][ic] * invW;
+ varLeft[iv][ic] = var0 + (span.varStepX[iv][ic] * adjx +
+ span.varStepY[iv][ic] * adjy) * (1.0f / FIXED_SCALE);
+ dvarOuter[iv][ic] = span.varStepY[iv][ic] + dxOuter * span.varStepX[iv][ic];
+ )
#endif
} /*if setupLeft*/
dvInner[u] = dvOuter[u] + span.texStepX[u][3];
)
#endif
+#ifdef INTERP_VARYING
+ VARYING_LOOP(
+ dvarInner[iv][ic] = dvarOuter[iv][ic] + span.varStepX[iv][ic];
+ )
+#endif
while (lines > 0) {
/* initialize the span interpolants to the leftmost value */
span.tex[u][3] = vLeft[u];
)
#endif
+#ifdef INTERP_VARYING
+ VARYING_LOOP(
+ span.var[iv][ic] = varLeft[iv][ic];
+ )
+#endif
/* This is where we actually generate fragments */
/* XXX the test for span.y > 0 _shouldn't_ be needed but
uLeft[u] += duOuter[u];
vLeft[u] += dvOuter[u];
)
+#endif
+#ifdef INTERP_VARYING
+ VARYING_LOOP(
+ varLeft[iv][ic] += dvarOuter[iv][ic];
+ )
#endif
}
else {
uLeft[u] += duInner[u];
vLeft[u] += dvInner[u];
)
+#endif
+#ifdef INTERP_VARYING
+ VARYING_LOOP(
+ varLeft[iv][ic] += dvarInner[iv][ic];
+ )
#endif
}
} /*while lines>0*/
#undef INTERP_INT_TEX
#undef INTERP_TEX
#undef INTERP_MULTITEX
+#undef INTERP_VARYING
#undef TEX_UNIT_LOOP
+#undef VARYING_LOOP
#undef S_SCALE
#undef T_SCALE
* Mesa 3-D graphics library
* Version: 6.5
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
GLfloat fog;
GLfloat index;
GLfloat pointSize;
+ GLfloat attribute[MAX_VERTEX_ATTRIBS][4];
} SWvertex;
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.5
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
e++; \
} while (0)
-
/*
* We patch this function into tnl->Driver.Render.Start.
* It's called when we start rendering a vertex buffer.
VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
- if (tnl->render_inputs != swsetup->last_index) {
- GLuint index = tnl->render_inputs;
+ if (!RENDERINPUTS_EQUAL(tnl->render_inputs_bitset, swsetup->last_index_bitset)) {
+ DECLARE_RENDERINPUTS(index_bitset);
struct tnl_attr_map map[_TNL_ATTRIB_MAX];
int i, e = 0;
+ RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
+
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, win );
-
- if (index & _TNL_BIT_COLOR0)
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4CHAN_4F_RGBA, color );
-
- if (index & _TNL_BIT_COLOR1)
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4CHAN_4F_RGBA, specular);
-
- if (index & _TNL_BIT_FOG)
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F, fog);
-
- if (index & _TNL_BITS_TEX_ANY) {
- for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
- if (index & _TNL_BIT_TEX(i)) {
- EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_4F, texcoord[i] );
- }
- }
+
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR0 ))
+ EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4CHAN_4F_RGBA, color );
+
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 ))
+ EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4CHAN_4F_RGBA, specular);
+
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG ))
+ EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F, fog);
+
+ if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
+ for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) {
+ EMIT_ATTR( _TNL_ATTRIB_TEX(i), EMIT_4F, texcoord[i] );
+ }
+ }
}
-
- if (index & _TNL_BIT_INDEX)
- EMIT_ATTR( _TNL_ATTRIB_INDEX, EMIT_1F, index );
-
- if (index & _TNL_BIT_POINTSIZE)
- EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, pointSize );
-
+
+ if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_ATTRIBUTE, _TNL_LAST_ATTRIBUTE )) {
+ for (i = 0; i < MAX_VERTEX_ATTRIBS; i++) {
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_ATTRIBUTE(i) )) {
+ EMIT_ATTR( _TNL_ATTRIB_ATTRIBUTE(i), VARYING_EMIT_STYLE, attribute[i] );
+ }
+ }
+ }
+
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_INDEX ))
+ EMIT_ATTR( _TNL_ATTRIB_INDEX, EMIT_1F, index );
+
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE ))
+ EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, pointSize );
+
_tnl_install_attrs( ctx, map, e,
- ctx->Viewport._WindowMap.m,
- sizeof(SWvertex) );
-
- swsetup->last_index = index;
- }
+ ctx->Viewport._WindowMap.m,
+ sizeof(SWvertex) );
+ RENDERINPUTS_COPY( swsetup->last_index_bitset, index_bitset );
+ }
}
/*
_swsetup_InvalidateState( ctx, ~0 );
swsetup->verts = (SWvertex *)tnl->clipspace.vertex_buf;
- swsetup->last_index = 0;
+ RENDERINPUTS_ZERO( swsetup->last_index_bitset );
}
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 6.5
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#include "mtypes.h"
#include "swrast/swrast.h"
#include "swrast_setup.h"
+#include "tnl/t_context.h"
typedef struct {
GLuint NewState;
GLenum render_prim;
- GLuint last_index;
+ DECLARE_RENDERINPUTS(last_index_bitset);
SWvertex *verts;
} SScontext;
* Mesa 3-D graphics library
* Version: 6.5
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
/* Calculate tnl->render_inputs:
*/
if (ctx->Visual.rgbMode) {
- tnl->render_inputs = (_TNL_BIT_POS|
- _TNL_BIT_COLOR0|
- (ctx->Texture._EnabledCoordUnits << _TNL_ATTRIB_TEX0));
+ GLuint i;
+
+ RENDERINPUTS_ZERO( tnl->render_inputs_bitset );
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR0 );
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
+ if (ctx->Texture._EnabledCoordUnits & (1 << i)) {
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) );
+ }
+ }
if (NEED_SECONDARY_COLOR(ctx))
- tnl->render_inputs |= _TNL_BIT_COLOR1;
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 );
}
else {
- tnl->render_inputs |= (_TNL_BIT_POS|_TNL_BIT_INDEX);
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_INDEX );
}
-
+
if (ctx->Fog.Enabled ||
(ctx->FragmentProgram._Active &&
- ctx->FragmentProgram._Current->FogOption != GL_NONE))
- tnl->render_inputs |= _TNL_BIT_FOG;
+ ctx->FragmentProgram._Current->FogOption != GL_NONE))
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
if (ctx->Polygon.FrontMode != GL_FILL ||
ctx->Polygon.BackMode != GL_FILL)
- tnl->render_inputs |= _TNL_BIT_EDGEFLAG;
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_EDGEFLAG );
if (ctx->RenderMode == GL_FEEDBACK)
- tnl->render_inputs |= _TNL_BIT_TEX0;
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX0 );
if (ctx->Point._Attenuated ||
(ctx->VertexProgram._Enabled && ctx->VertexProgram.PointSizeEnabled))
- tnl->render_inputs |= _TNL_BIT_POINTSIZE;
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POINTSIZE );
+
+ if (ctx->ShaderObjects._VertexShaderPresent || ctx->ShaderObjects._FragmentShaderPresent)
+ RENDERINPUTS_SET_RANGE( tnl->render_inputs_bitset, _TNL_FIRST_ATTRIBUTE, _TNL_LAST_ATTRIBUTE );
}
* mesa 3-D graphics library
* Version: 6.5
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* number of bits allocated for these numbers in places like vertex
* program instruction formats and register layouts.
*/
+/* The bit space exhaustion is a fact now, done by _TNL_ATTRIB_ATTRIBUTE* for
+ * GLSL vertex shader which cannot be aliased with conventional vertex attribs.
+ * Compacting _TNL_ATTRIB_MAT_* attribs would not work, they would not give
+ * as many free bits (11 plus already 1 free bit) as _TNL_ATTRIB_ATTRIBUTE*
+ * attribs want (16).
+ */
enum {
_TNL_ATTRIB_POS = 0,
_TNL_ATTRIB_WEIGHT = 1,
_TNL_ATTRIB_TEX5 = 13,
_TNL_ATTRIB_TEX6 = 14,
_TNL_ATTRIB_TEX7 = 15,
- _TNL_ATTRIB_MAT_FRONT_AMBIENT = 16,
- _TNL_ATTRIB_MAT_BACK_AMBIENT = 17,
- _TNL_ATTRIB_MAT_FRONT_DIFFUSE = 18,
- _TNL_ATTRIB_MAT_BACK_DIFFUSE = 19,
- _TNL_ATTRIB_MAT_FRONT_SPECULAR = 20,
- _TNL_ATTRIB_MAT_BACK_SPECULAR = 21,
- _TNL_ATTRIB_MAT_FRONT_EMISSION = 22,
- _TNL_ATTRIB_MAT_BACK_EMISSION = 23,
- _TNL_ATTRIB_MAT_FRONT_SHININESS = 24,
- _TNL_ATTRIB_MAT_BACK_SHININESS = 25,
- _TNL_ATTRIB_MAT_FRONT_INDEXES = 26,
- _TNL_ATTRIB_MAT_BACK_INDEXES = 27,
- _TNL_ATTRIB_INDEX = 28,
- _TNL_ATTRIB_EDGEFLAG = 29,
- _TNL_ATTRIB_POINTSIZE = 30,
- _TNL_ATTRIB_MAX = 31
+ _TNL_ATTRIB_ATTRIBUTE0 = 16,
+ _TNL_ATTRIB_ATTRIBUTE1 = 17,
+ _TNL_ATTRIB_ATTRIBUTE2 = 18,
+ _TNL_ATTRIB_ATTRIBUTE3 = 19,
+ _TNL_ATTRIB_ATTRIBUTE4 = 20,
+ _TNL_ATTRIB_ATTRIBUTE5 = 21,
+ _TNL_ATTRIB_ATTRIBUTE6 = 22,
+ _TNL_ATTRIB_ATTRIBUTE7 = 23,
+ _TNL_ATTRIB_ATTRIBUTE8 = 24,
+ _TNL_ATTRIB_ATTRIBUTE9 = 25,
+ _TNL_ATTRIB_ATTRIBUTE10 = 26,
+ _TNL_ATTRIB_ATTRIBUTE11 = 27,
+ _TNL_ATTRIB_ATTRIBUTE12 = 28,
+ _TNL_ATTRIB_ATTRIBUTE13 = 29,
+ _TNL_ATTRIB_ATTRIBUTE14 = 30,
+ _TNL_ATTRIB_ATTRIBUTE15 = 31,
+ _TNL_ATTRIB_MAT_FRONT_AMBIENT = 32,
+ _TNL_ATTRIB_MAT_BACK_AMBIENT = 33,
+ _TNL_ATTRIB_MAT_FRONT_DIFFUSE = 34,
+ _TNL_ATTRIB_MAT_BACK_DIFFUSE = 35,
+ _TNL_ATTRIB_MAT_FRONT_SPECULAR = 36,
+ _TNL_ATTRIB_MAT_BACK_SPECULAR = 37,
+ _TNL_ATTRIB_MAT_FRONT_EMISSION = 38,
+ _TNL_ATTRIB_MAT_BACK_EMISSION = 39,
+ _TNL_ATTRIB_MAT_FRONT_SHININESS = 40,
+ _TNL_ATTRIB_MAT_BACK_SHININESS = 41,
+ _TNL_ATTRIB_MAT_FRONT_INDEXES = 42,
+ _TNL_ATTRIB_MAT_BACK_INDEXES = 43,
+ _TNL_ATTRIB_INDEX = 44,
+ _TNL_ATTRIB_EDGEFLAG = 45,
+ _TNL_ATTRIB_POINTSIZE = 46,
+ _TNL_ATTRIB_MAX = 47
} ;
-/* Will probably have to revise this scheme fairly shortly, eg. by
- * compacting all the MAT flags down to one bit, or by using two
- * dwords to store the flags.
+#define _TNL_ATTRIB_TEX(u) (_TNL_ATTRIB_TEX0 + (u))
+#define _TNL_ATTRIB_ATTRIBUTE(n) (_TNL_ATTRIB_ATTRIBUTE0 + (n))
+
+/* Define bit ranges instead of bit masks.
*/
-#define _TNL_BIT_POS (1<<0)
-#define _TNL_BIT_WEIGHT (1<<1)
-#define _TNL_BIT_NORMAL (1<<2)
-#define _TNL_BIT_COLOR0 (1<<3)
-#define _TNL_BIT_COLOR1 (1<<4)
-#define _TNL_BIT_FOG (1<<5)
-#define _TNL_BIT_SIX (1<<6)
-#define _TNL_BIT_SEVEN (1<<7)
-#define _TNL_BIT_TEX0 (1<<8)
-#define _TNL_BIT_TEX1 (1<<9)
-#define _TNL_BIT_TEX2 (1<<10)
-#define _TNL_BIT_TEX3 (1<<11)
-#define _TNL_BIT_TEX4 (1<<12)
-#define _TNL_BIT_TEX5 (1<<13)
-#define _TNL_BIT_TEX6 (1<<14)
-#define _TNL_BIT_TEX7 (1<<15)
-#define _TNL_BIT_MAT_FRONT_AMBIENT (1<<16)
-#define _TNL_BIT_MAT_BACK_AMBIENT (1<<17)
-#define _TNL_BIT_MAT_FRONT_DIFFUSE (1<<18)
-#define _TNL_BIT_MAT_BACK_DIFFUSE (1<<19)
-#define _TNL_BIT_MAT_FRONT_SPECULAR (1<<20)
-#define _TNL_BIT_MAT_BACK_SPECULAR (1<<21)
-#define _TNL_BIT_MAT_FRONT_EMISSION (1<<22)
-#define _TNL_BIT_MAT_BACK_EMISSION (1<<23)
-#define _TNL_BIT_MAT_FRONT_SHININESS (1<<24)
-#define _TNL_BIT_MAT_BACK_SHININESS (1<<25)
-#define _TNL_BIT_MAT_FRONT_INDEXES (1<<26)
-#define _TNL_BIT_MAT_BACK_INDEXES (1<<27)
-#define _TNL_BIT_INDEX (1<<28)
-#define _TNL_BIT_EDGEFLAG (1<<29)
-#define _TNL_BIT_POINTSIZE (1<<30)
-
-#define _TNL_BIT_TEX(u) (1 << (_TNL_ATTRIB_TEX0 + (u)))
-
-
-
-#define _TNL_BITS_MAT_ANY (_TNL_BIT_MAT_FRONT_AMBIENT | \
- _TNL_BIT_MAT_BACK_AMBIENT | \
- _TNL_BIT_MAT_FRONT_DIFFUSE | \
- _TNL_BIT_MAT_BACK_DIFFUSE | \
- _TNL_BIT_MAT_FRONT_SPECULAR | \
- _TNL_BIT_MAT_BACK_SPECULAR | \
- _TNL_BIT_MAT_FRONT_EMISSION | \
- _TNL_BIT_MAT_BACK_EMISSION | \
- _TNL_BIT_MAT_FRONT_SHININESS | \
- _TNL_BIT_MAT_BACK_SHININESS | \
- _TNL_BIT_MAT_FRONT_INDEXES | \
- _TNL_BIT_MAT_BACK_INDEXES)
-
-
-#define _TNL_BITS_TEX_ANY (_TNL_BIT_TEX0 | \
- _TNL_BIT_TEX1 | \
- _TNL_BIT_TEX2 | \
- _TNL_BIT_TEX3 | \
- _TNL_BIT_TEX4 | \
- _TNL_BIT_TEX5 | \
- _TNL_BIT_TEX6 | \
- _TNL_BIT_TEX7)
-
-
-#define _TNL_BITS_PROG_ANY (_TNL_BIT_POS | \
- _TNL_BIT_WEIGHT | \
- _TNL_BIT_NORMAL | \
- _TNL_BIT_COLOR0 | \
- _TNL_BIT_COLOR1 | \
- _TNL_BIT_FOG | \
- _TNL_BIT_SIX | \
- _TNL_BIT_SEVEN | \
- _TNL_BITS_TEX_ANY)
+#define _TNL_FIRST_PROG _TNL_ATTRIB_WEIGHT
+#define _TNL_LAST_PROG _TNL_ATTRIB_TEX7
+
+#define _TNL_FIRST_TEX _TNL_ATTRIB_TEX0
+#define _TNL_LAST_TEX _TNL_ATTRIB_TEX7
+
+#define _TNL_FIRST_ATTRIBUTE _TNL_ATTRIB_ATTRIBUTE0
+#define _TNL_LAST_ATTRIBUTE _TNL_ATTRIB_ATTRIBUTE15
+#define _TNL_FIRST_MAT _TNL_ATTRIB_MAT_FRONT_AMBIENT
+#define _TNL_LAST_MAT _TNL_ATTRIB_MAT_BACK_INDEXES
#define PRIM_BEGIN 0x10
GLvector4f *SecondaryColorPtr[2]; /* _TNL_BIT_COLOR1 */
GLvector4f *PointSizePtr; /* _TNL_BIT_POS */
GLvector4f *FogCoordPtr; /* _TNL_BIT_FOG */
+ GLvector4f *VaryingPtr[MAX_VARYING_VECTORS];
struct tnl_prim *Primitive;
GLuint PrimitiveCount;
*/
} Render;
};
-
+
+
+#define DECLARE_RENDERINPUTS(name) BITSET64_DECLARE(name, _TNL_ATTRIB_MAX)
+#define RENDERINPUTS_COPY BITSET64_COPY
+#define RENDERINPUTS_EQUAL BITSET64_EQUAL
+#define RENDERINPUTS_ZERO BITSET64_ZERO
+#define RENDERINPUTS_ONES BITSET64_ONES
+#define RENDERINPUTS_TEST BITSET64_TEST
+#define RENDERINPUTS_SET BITSET64_SET
+#define RENDERINPUTS_CLEAR BITSET64_CLEAR
+#define RENDERINPUTS_TEST_RANGE BITSET64_TEST_RANGE
+#define RENDERINPUTS_SET_RANGE BITSET64_SET_RANGE
+#define RENDERINPUTS_CLEAR_RANGE BITSET64_CLEAR_RANGE
+
/**
* Context state for T&L context.
*/
GLboolean DiscardPrimitive;
- GLuint render_inputs;
+ DECLARE_RENDERINPUTS(render_inputs_bitset);
GLvertexformat exec_vtxfmt;
GLvertexformat save_vtxfmt;
static void GLAPIENTRY _save_VertexAttrib1fNV( GLuint index, GLfloat x )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR1F( index, x );
else
enum_error();
static void GLAPIENTRY _save_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR1FV( index, v );
else
enum_error();
static void GLAPIENTRY _save_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR2F( index, x, y );
else
enum_error();
static void GLAPIENTRY _save_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR2FV( index, v );
else
enum_error();
static void GLAPIENTRY _save_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y,
GLfloat z )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR3F( index, x, y, z );
else
enum_error();
static void GLAPIENTRY _save_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR3FV( index, v );
else
enum_error();
static void GLAPIENTRY _save_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y,
GLfloat z, GLfloat w )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR4F( index, x, y, z, w );
else
enum_error();
static void GLAPIENTRY _save_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
DISPATCH_ATTR4FV( index, v );
else
enum_error();
static void GLAPIENTRY
_save_VertexAttrib1fARB( GLuint index, GLfloat x )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR1F( index, x );
else
enum_error();
static void GLAPIENTRY
_save_VertexAttrib1fvARB( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR1FV( index, v );
else
enum_error();
static void GLAPIENTRY
_save_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR2F( index, x, y );
else
enum_error();
static void GLAPIENTRY
_save_VertexAttrib2fvARB( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR2FV( index, v );
else
enum_error();
static void GLAPIENTRY
_save_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR3F( index, x, y, z );
else
enum_error();
static void GLAPIENTRY
_save_VertexAttrib3fvARB( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR3FV( index, v );
else
enum_error();
static void GLAPIENTRY
_save_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR4F( index, x, y, z, w );
else
enum_error();
static void GLAPIENTRY
_save_VertexAttrib4fvARB( GLuint index, const GLfloat *v )
{
- if (index < VERT_ATTRIB_MAX)
+ if (index < MAX_VERTEX_ATTRIBS)
DISPATCH_ATTR4FV( index, v );
else
enum_error();
typedef struct\r
{\r
GLvector4f outputs[VERT_RESULT_MAX];\r
+ GLvector4f varyings[MAX_VARYING_VECTORS];\r
GLvector4f ndc_coords;\r
GLubyte *clipmask;\r
GLubyte ormask;\r
_mesa_vector4f_alloc (&store->outputs[i], 0, size, 32);\r
store->outputs[i].size = 4;\r
}\r
+ for (i = 0; i < MAX_VARYING_VECTORS; i++)\r
+ {\r
+ _mesa_vector4f_alloc (&store->varyings[i], 0, size, 32);\r
+ store->varyings[i].size = 4;\r
+ }\r
_mesa_vector4f_alloc (&store->ndc_coords, 0, size, 32);\r
store->clipmask = (GLubyte *) ALIGN_MALLOC (size, 32);\r
\r
\r
for (i = 0; i < VERT_RESULT_MAX; i++)\r
_mesa_vector4f_free (&store->outputs[i]);\r
+ for (i = 0; i < MAX_VARYING_VECTORS; i++)\r
+ _mesa_vector4f_free (&store->varyings[i]);\r
_mesa_vector4f_free (&store->ndc_coords);\r
ALIGN_FREE (store->clipmask);\r
\r
fetch_output_vec4 (pro, SLANG_VERTEX_FIXED_BACKCOLOR, VERT_RESULT_BFC0, i, 0, store);\r
fetch_output_vec4 (pro, SLANG_VERTEX_FIXED_BACKSECONDARYCOLOR, VERT_RESULT_BFC1, i, 0, store);\r
/* XXX: fetch output SLANG_VERTEX_FIXED_CLIPVERTEX */\r
+\r
+ for (j = 0; j < MAX_VARYING_VECTORS; j++)\r
+ {\r
+ GLuint k;\r
+\r
+ for (k = 0; k < VARYINGS_PER_VECTOR; k++)\r
+ {\r
+ (**pro).UpdateVarying (pro, j * VARYINGS_PER_VECTOR + k,\r
+ &store->varyings[j].data[i][k], GL_TRUE);\r
+ }\r
+ }\r
}\r
\r
vb->ClipPtr = &store->outputs[VERT_RESULT_HPOS];\r
vb->SecondaryColorPtr[1] = &store->outputs[VERT_RESULT_BFC1];\r
vb->FogCoordPtr = &store->outputs[VERT_RESULT_FOGC];\r
vb->PointSizePtr = &store->outputs[VERT_RESULT_PSIZ];\r
+ for (i = 0; i < MAX_VARYING_VECTORS; i++)\r
+ vb->VaryingPtr[i] = &store->varyings[i];\r
\r
vb->AttribPtr[VERT_ATTRIB_COLOR0] = vb->ColorPtr[0];\r
vb->AttribPtr[VERT_ATTRIB_COLOR1] = vb->SecondaryColorPtr[0];\r
for (i = 0; i < ctx->Const.MaxTextureUnits; i++)\r
vb->AttribPtr[VERT_ATTRIB_TEX0 + i] = vb->TexCoordPtr[i];\r
vb->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->outputs[VERT_RESULT_PSIZ];\r
+ for (i = 0; i < MAX_VARYING_VECTORS; i++)\r
+ vb->AttribPtr[_TNL_ATTRIB_ATTRIBUTE0 + i] = vb->VaryingPtr[i];\r
\r
store->ormask = 0;\r
store->andmask = CLIP_FRUSTUM_BITS;\r
static void GLAPIENTRY _tnl_VertexAttrib1fNV( GLuint index, GLfloat x )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR1F( index, x );
}
static void GLAPIENTRY _tnl_VertexAttrib1fvNV( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR1FV( index, v );
}
static void GLAPIENTRY _tnl_VertexAttrib2fNV( GLuint index, GLfloat x,
GLfloat y )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR2F( index, x, y );
}
static void GLAPIENTRY _tnl_VertexAttrib2fvNV( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR2FV( index, v );
}
static void GLAPIENTRY _tnl_VertexAttrib3fNV( GLuint index, GLfloat x,
GLfloat y, GLfloat z )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR3F( index, x, y, z );
}
static void GLAPIENTRY _tnl_VertexAttrib3fvNV( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR3FV( index, v );
}
GLfloat y, GLfloat z,
GLfloat w )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR4F( index, x, y, z, w );
}
static void GLAPIENTRY _tnl_VertexAttrib4fvNV( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) index = ERROR_ATTRIB;
DISPATCH_ATTR4FV( index, v );
}
-
-/*
- * XXX adjust index
- */
-
static void GLAPIENTRY _tnl_VertexAttrib1fARB( GLuint index, GLfloat x )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR1F( index, x );
}
static void GLAPIENTRY _tnl_VertexAttrib1fvARB( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR1FV( index, v );
}
static void GLAPIENTRY _tnl_VertexAttrib2fARB( GLuint index, GLfloat x,
GLfloat y )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR2F( index, x, y );
}
static void GLAPIENTRY _tnl_VertexAttrib2fvARB( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR2FV( index, v );
}
static void GLAPIENTRY _tnl_VertexAttrib3fARB( GLuint index, GLfloat x,
GLfloat y, GLfloat z )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR3F( index, x, y, z );
}
static void GLAPIENTRY _tnl_VertexAttrib3fvARB( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR3FV( index, v );
}
GLfloat y, GLfloat z,
GLfloat w )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR4F( index, x, y, z, w );
}
static void GLAPIENTRY _tnl_VertexAttrib4fvARB( GLuint index,
const GLfloat *v )
{
- if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ if (index >= MAX_VERTEX_ATTRIBS)
+ index = ERROR_ATTRIB;
+ else
+ index += VERT_ATTRIB_GENERIC0;
DISPATCH_ATTR4FV( index, v );
}