st_atom.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void st_init_atoms (struct st_context *st)
void st_destroy_atoms (struct st_context *st)
void st_validate_state (struct st_context *st)
uint st_compare_func_to_pipe (GLenum func)
 Convert an OpenGL compare mode to a pipe tokens.

Variables

struct st_tracked_state st_update_framebuffer
struct st_tracked_state st_update_clip
struct st_tracked_state st_update_depth_stencil_alpha
struct st_tracked_state st_update_shader
struct st_tracked_state st_update_rasterizer
struct st_tracked_state st_update_polygon_stipple
struct st_tracked_state st_update_viewport
struct st_tracked_state st_update_scissor
struct st_tracked_state st_update_blend
struct st_tracked_state st_update_sampler
struct st_tracked_state st_update_texture
struct st_tracked_state st_finalize_textures
struct st_tracked_state st_update_fs_constants
struct st_tracked_state st_update_vs_constants
struct st_tracked_state st_update_pixel_transfer


Function Documentation

uint st_compare_func_to_pipe ( GLenum  func  ) 

Convert an OpenGL compare mode to a pipe tokens.

Definition at line 47 of file st_atom_depth.c.

References assert, PIPE_FUNC_ALWAYS, PIPE_FUNC_EQUAL, PIPE_FUNC_GEQUAL, PIPE_FUNC_GREATER, PIPE_FUNC_LEQUAL, PIPE_FUNC_LESS, PIPE_FUNC_NEVER, and PIPE_FUNC_NOTEQUAL.

00048 {
00049    /* Same values, just biased */
00050    assert(PIPE_FUNC_NEVER == GL_NEVER - GL_NEVER);
00051    assert(PIPE_FUNC_LESS == GL_LESS - GL_NEVER);
00052    assert(PIPE_FUNC_EQUAL == GL_EQUAL - GL_NEVER);
00053    assert(PIPE_FUNC_LEQUAL == GL_LEQUAL - GL_NEVER);
00054    assert(PIPE_FUNC_GREATER == GL_GREATER - GL_NEVER);
00055    assert(PIPE_FUNC_NOTEQUAL == GL_NOTEQUAL - GL_NEVER);
00056    assert(PIPE_FUNC_GEQUAL == GL_GEQUAL - GL_NEVER);
00057    assert(PIPE_FUNC_ALWAYS == GL_ALWAYS - GL_NEVER);
00058    assert(func >= GL_NEVER);
00059    assert(func <= GL_ALWAYS);
00060    return func - GL_NEVER;
00061 }

void st_destroy_atoms ( struct st_context st  ) 

Definition at line 92 of file st_atom.c.

References st_context::atoms.

00093 {
00094    if (st->atoms) {
00095       free(st->atoms);
00096       st->atoms = NULL;
00097    }
00098 }

void st_init_atoms ( struct st_context st  ) 

Definition at line 68 of file st_atom.c.

References st_context::atoms, st_context::constants, st_context::nr_atoms, PIPE_SHADER_FRAGMENT, PIPE_SHADER_VERTEX, st_update_fs_constants, and st_update_vs_constants.

00069 {
00070    GLuint i;
00071 
00072    st->atoms = malloc(sizeof(atoms));
00073    st->nr_atoms = sizeof(atoms)/sizeof(*atoms);
00074    memcpy(st->atoms, atoms, sizeof(atoms));
00075 
00076    /* Patch in a pointer to the dynamic state atom:
00077     */
00078    for (i = 0; i < st->nr_atoms; i++) {
00079       if (st->atoms[i] == &st_update_vs_constants) {
00080          st->atoms[i] = &st->constants.tracked_state[PIPE_SHADER_VERTEX];
00081          st->atoms[i][0] = st_update_vs_constants;
00082       }
00083 
00084       if (st->atoms[i] == &st_update_fs_constants) {
00085          st->atoms[i] = &st->constants.tracked_state[PIPE_SHADER_FRAGMENT];
00086          st->atoms[i][0] = st_update_fs_constants;
00087       }
00088    }
00089 }

void st_validate_state ( struct st_context st  ) 

Definition at line 147 of file st_atom.c.

References accumulate_state(), assert, st_context::atoms, check_program_state(), check_state(), st_tracked_state::dirty, st_context::dirty, st_state_flags::mesa, st_tracked_state::name, st_context::nr_atoms, st_state_flags::st, st_flush_bitmap_cache(), st_tracked_state::update, and xor_states().

00148 {
00149    struct st_state_flags *state = &st->dirty;
00150    GLuint i;
00151 
00152    /* The bitmap cache is immune to pixel unpack changes.
00153     * Note that GLUT makes several calls to glPixelStore for each
00154     * bitmap char it draws so this is an important check.
00155     */
00156    if (state->mesa & ~_NEW_PACKUNPACK)
00157       st_flush_bitmap_cache(st);
00158 
00159    check_program_state( st );
00160 
00161    if (state->st == 0)
00162       return;
00163 
00164 //   _mesa_printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);
00165 
00166    if (1) {
00167       /* Debug version which enforces various sanity checks on the
00168        * state flags which are generated and checked to help ensure
00169        * state atoms are ordered correctly in the list.
00170        */
00171       struct st_state_flags examined, prev;      
00172       memset(&examined, 0, sizeof(examined));
00173       prev = *state;
00174 
00175       for (i = 0; i < st->nr_atoms; i++) {       
00176          const struct st_tracked_state *atom = st->atoms[i];
00177          struct st_state_flags generated;
00178          
00179 //       _mesa_printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st);
00180 
00181          if (!(atom->dirty.mesa || atom->dirty.st) ||
00182              !atom->update) {
00183             _mesa_printf("malformed atom %s\n", atom->name);
00184             assert(0);
00185          }
00186 
00187          if (check_state(state, &atom->dirty)) {
00188             st->atoms[i]->update( st );
00189 //          _mesa_printf("after: %x\n", atom->dirty.mesa);
00190          }
00191 
00192          accumulate_state(&examined, &atom->dirty);
00193 
00194          /* generated = (prev ^ state)
00195           * if (examined & generated)
00196           *     fail;
00197           */
00198          xor_states(&generated, &prev, state);
00199          assert(!check_state(&examined, &generated));
00200          prev = *state;
00201       }
00202 //      _mesa_printf("\n");
00203 
00204    }
00205    else {
00206       const GLuint nr = st->nr_atoms;
00207 
00208       for (i = 0; i < nr; i++) {         
00209          if (check_state(state, &st->atoms[i]->dirty))
00210             st->atoms[i]->update( st );
00211       }
00212    }
00213 
00214    memset(state, 0, sizeof(*state));
00215 }


Variable Documentation

struct st_tracked_state st_finalize_textures

Definition at line 147 of file st_atom_texture.c.

struct st_tracked_state st_update_blend

Definition at line 225 of file st_atom_blend.c.

struct st_tracked_state st_update_clip

Definition at line 64 of file st_atom_clip.c.

struct st_tracked_state st_update_depth_stencil_alpha

Definition at line 144 of file st_atom_depth.c.

struct st_tracked_state st_update_framebuffer

Definition at line 159 of file st_atom_framebuffer.c.

struct st_tracked_state st_update_fs_constants

Definition at line 134 of file st_atom_constbuf.c.

struct st_tracked_state st_update_pixel_transfer

Definition at line 467 of file st_atom_pixeltransfer.c.

struct st_tracked_state st_update_polygon_stipple

Definition at line 56 of file st_atom_stipple.c.

struct st_tracked_state st_update_rasterizer

Definition at line 275 of file st_atom_rasterizer.c.

struct st_tracked_state st_update_sampler

Definition at line 204 of file st_atom_sampler.c.

struct st_tracked_state st_update_scissor

Definition at line 85 of file st_atom_scissor.c.

struct st_tracked_state st_update_shader

Definition at line 362 of file st_atom_shader.c.

struct st_tracked_state st_update_texture

Definition at line 98 of file st_atom_texture.c.

struct st_tracked_state st_update_viewport

Definition at line 84 of file st_atom_viewport.c.

struct st_tracked_state st_update_vs_constants

Definition at line 115 of file st_atom_constbuf.c.


Generated on Tue Sep 29 06:25:51 2009 for Gallium3D by  doxygen 1.5.4