/** * Print current vertex object/array info. For debug. */ void _mesa_print_arrays(struct gl_context *ctx) { struct gl_array_object *arrayObj = ctx->Array.ArrayObj; _mesa_update_array_object_max_element(ctx, arrayObj); printf("Array Object %u\n", arrayObj->Name); if (arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) print_array("Vertex", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_POS]); if (arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) print_array("Normal", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]); if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) print_array("Color", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]); if (arrayObj->VertexAttrib[VERT_ATTRIB_TEX].Enabled) print_array("TexCoord", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_TEX]); printf(" _MaxElement = %u\n", arrayObj->_MaxElement); }
/** * Print current vertex object/array info. For debug. */ void _mesa_print_arrays(struct gl_context *ctx) { struct gl_array_object *arrayObj = ctx->Array.ArrayObj; GLuint i; _mesa_update_array_object_max_element(ctx, arrayObj); printf("Array Object %u\n", arrayObj->Name); if (arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) print_array("Vertex", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_POS]); if (arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) print_array("Normal", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]); if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) print_array("Color", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]); for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) if (arrayObj->VertexAttrib[VERT_ATTRIB_TEX(i)].Enabled) print_array("TexCoord", i, &arrayObj->VertexAttrib[VERT_ATTRIB_TEX(i)]); for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) if (arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled) print_array("Attrib", i, &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)]); printf(" _MaxElement = %u\n", arrayObj->_MaxElement); }
/** * Compute derived GL state. * If __struct gl_contextRec::NewState is non-zero then this function \b must * be called before rendering anything. * * Calls dd_function_table::UpdateState to perform any internal state * management necessary. * * \sa _mesa_update_modelview_project(), _mesa_update_texture(), * _mesa_update_buffer_bounds(), * _mesa_update_lighting() and _mesa_update_tnl_spaces(). */ void _mesa_update_state_locked( struct gl_context *ctx ) { GLbitfield new_state = ctx->NewState; GLbitfield prog_flags = _NEW_PROGRAM; GLbitfield new_prog_state = 0x0; if (new_state == _NEW_CURRENT_ATTRIB) goto out; if (MESA_VERBOSE & VERBOSE_STATE) _mesa_print_state("_mesa_update_state", new_state); /* Determine which state flags effect vertex/fragment program state */ if (ctx->FragmentProgram._MaintainTexEnvProgram) { prog_flags |= (_NEW_BUFFERS | _NEW_TEXTURE | _NEW_FOG | _NEW_VARYING_VP_INPUTS | _NEW_LIGHT | _NEW_POINT | _NEW_RENDERMODE | _NEW_PROGRAM | _NEW_FRAG_CLAMP | _NEW_COLOR); } if (ctx->VertexProgram._MaintainTnlProgram) { prog_flags |= (_NEW_VARYING_VP_INPUTS | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX | _NEW_TRANSFORM | _NEW_POINT | _NEW_FOG | _NEW_LIGHT | _MESA_NEW_NEED_EYE_COORDS); } /* * Now update derived state info */ if (new_state & prog_flags) update_program_enables( ctx ); if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION)) _mesa_update_modelview_project( ctx, new_state ); if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX)) _mesa_update_texture( ctx, new_state ); if (new_state & _NEW_BUFFERS) _mesa_update_framebuffer(ctx); if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) _mesa_update_draw_buffer_bounds( ctx ); if (new_state & _NEW_POLYGON) update_polygon( ctx ); if (new_state & _NEW_LIGHT) _mesa_update_lighting( ctx ); if (new_state & (_NEW_LIGHT | _NEW_PROGRAM)) update_twoside( ctx ); if (new_state & (_NEW_LIGHT | _NEW_BUFFERS)) update_clamp_vertex_color(ctx); if (new_state & (_NEW_STENCIL | _NEW_BUFFERS)) _mesa_update_stencil( ctx ); if (new_state & _NEW_PIXEL) _mesa_update_pixel( ctx, new_state ); if (new_state & _MESA_NEW_SEPARATE_SPECULAR) update_separate_specular( ctx ); if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT)) update_viewport_matrix(ctx); if (new_state & (_NEW_MULTISAMPLE | _NEW_BUFFERS)) update_multisample( ctx ); if (new_state & (_NEW_COLOR | _NEW_BUFFERS)) update_clamp_read_color(ctx); if(new_state & (_NEW_FRAG_CLAMP | _NEW_BUFFERS)) update_clamp_fragment_color(ctx); #if 0 if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT | _NEW_STENCIL | _MESA_NEW_SEPARATE_SPECULAR)) update_tricaps( ctx, new_state ); #endif /* ctx->_NeedEyeCoords is now up to date. * * If the truth value of this variable has changed, update for the * new lighting space and recompute the positions of lights and the * normal transform. * * If the lighting space hasn't changed, may still need to recompute * light positions & normal transforms for other reasons. */ if (new_state & _MESA_NEW_NEED_EYE_COORDS) _mesa_update_tnl_spaces( ctx, new_state ); if (new_state & prog_flags) { /* When we generate programs from fixed-function vertex/fragment state * this call may generate/bind a new program. If so, we need to * propogate the _NEW_PROGRAM flag to the driver. */ new_prog_state |= update_program( ctx ); } if (new_state & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT)) _mesa_update_array_object_max_element(ctx, ctx->Array.ArrayObj); out: new_prog_state |= update_program_constants(ctx); /* * Give the driver a chance to act upon the new_state flags. * The driver might plug in different span functions, for example. * Also, this is where the driver can invalidate the state of any * active modules (such as swrast_setup, swrast, tnl, etc). * * Set ctx->NewState to zero to avoid recursion if * Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?) */ new_state = ctx->NewState | new_prog_state; ctx->NewState = 0; ctx->Driver.UpdateState(ctx, new_state); ctx->Array.ArrayObj->NewArrays = 0x0; }