#include "glheader.h"
#include "context.h"
+#include "pipe/p_defines.h"
#include "st_context.h"
#include "st_atom.h"
+#include "st_program.h"
static const struct st_tracked_state *atoms[] =
{
&st_update_framebuffer,
+ &st_update_depth_stencil_alpha,
&st_update_clip,
- &st_update_fs,
- &st_update_point,
- &st_update_setup,
+
+ &st_update_shader,
+
+ &st_update_rasterizer,
+ &st_update_polygon_stipple,
&st_update_viewport,
&st_update_scissor,
&st_update_blend,
- &st_update_stencil,
- /* will be patched out at runtime */
-/* &st_update_constants */
+ &st_update_sampler,
+ &st_update_texture,
+ &st_update_vs_constants,
+ &st_update_fs_constants,
+ &st_update_pixel_transfer
};
/* Patch in a pointer to the dynamic state atom:
*/
- for (i = 0; i < st->nr_atoms; i++)
- if (st->atoms[i] == &st_update_constants)
- st->atoms[i] = &st->constants.tracked_state;
+ for (i = 0; i < st->nr_atoms; i++) {
+ if (st->atoms[i] == &st_update_vs_constants) {
+ st->atoms[i] = &st->constants.tracked_state[PIPE_SHADER_VERTEX];
+ st->atoms[i][0] = st_update_vs_constants;
+ }
- memcpy(&st->constants.tracked_state,
- &st_update_constants,
- sizeof(st_update_constants));
+ if (st->atoms[i] == &st_update_fs_constants) {
+ st->atoms[i] = &st->constants.tracked_state[PIPE_SHADER_FRAGMENT];
+ st->atoms[i][0] = st_update_fs_constants;
+ }
+ }
}
}
+/* Too complex to figure out, just check every time:
+ */
+static void check_program_state( struct st_context *st )
+{
+ GLcontext *ctx = st->ctx;
+
+ if (ctx->VertexProgram._Current != &st->vp->Base)
+ st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
+
+ if (ctx->FragmentProgram._Current != &st->fp->Base)
+ st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
+
+}
+
+
/***********************************************************************
* Update all derived state:
*/
struct st_state_flags *state = &st->dirty;
GLuint i;
+ check_program_state( st );
+
if (state->st == 0)
return;
+// _mesa_printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);
+
if (1) {
/* Debug version which enforces various sanity checks on the
* state flags which are generated and checked to help ensure
for (i = 0; i < st->nr_atoms; i++) {
const struct st_tracked_state *atom = st->atoms[i];
struct st_state_flags generated;
+
+// _mesa_printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st);
- assert(atom->dirty.mesa ||
- atom->dirty.st);
- assert(atom->update);
+ if (!(atom->dirty.mesa || atom->dirty.st) ||
+ !atom->update) {
+ _mesa_printf("malformed atom %s\n", atom->name);
+ assert(0);
+ }
if (check_state(state, &atom->dirty)) {
st->atoms[i]->update( st );
+// _mesa_printf("after: %x\n", atom->dirty.mesa);
}
accumulate_state(&examined, &atom->dirty);
assert(!check_state(&examined, &generated));
prev = *state;
}
+// _mesa_printf("\n");
+
}
else {
const GLuint nr = st->nr_atoms;