const struct brw_tracked_state **atoms;
int num_atoms;
+ STATIC_ASSERT(ARRAY_SIZE(gen4_atoms) <= ARRAY_SIZE(brw->atoms));
+ STATIC_ASSERT(ARRAY_SIZE(gen6_atoms) <= ARRAY_SIZE(brw->atoms));
+ STATIC_ASSERT(ARRAY_SIZE(gen7_atoms) <= ARRAY_SIZE(brw->atoms));
+ STATIC_ASSERT(ARRAY_SIZE(gen8_atoms) <= ARRAY_SIZE(brw->atoms));
+
brw_init_caches(brw);
if (brw->gen >= 8) {
num_atoms = ARRAY_SIZE(gen4_atoms);
}
- brw->atoms = atoms;
brw->num_atoms = num_atoms;
+ /* This is to work around brw_context::atoms being declared const. We want
+ * it to be const, but it needs to be initialized somehow!
+ */
+ struct brw_tracked_state *context_atoms =
+ (struct brw_tracked_state *) &brw->atoms[0];
+
+ for (int i = 0; i < num_atoms; i++)
+ context_atoms[i] = *atoms[i];
+
while (num_atoms--) {
assert((*atoms)->dirty.mesa | (*atoms)->dirty.brw);
assert((*atoms)->emit);
prev = *state;
for (i = 0; i < brw->num_atoms; i++) {
- const struct brw_tracked_state *atom = brw->atoms[i];
+ const struct brw_tracked_state *atom = &brw->atoms[i];
struct brw_state_flags generated;
if (check_state(state, &atom->dirty)) {
}
else {
for (i = 0; i < brw->num_atoms; i++) {
- const struct brw_tracked_state *atom = brw->atoms[i];
+ const struct brw_tracked_state *atom = &brw->atoms[i];
if (check_state(state, &atom->dirty)) {
atom->emit(brw);