}
i = 0;
+ bool flushed = false;
do {
struct gl_uniform_storage *uni = p->sh.SubroutineUniformRemapTable[i];
if (uni == NULL) {
continue;
}
+ if (!flushed) {
+ _mesa_flush_vertices_for_uniforms(ctx, uni);
+ flushed = true;
+ }
+
int uni_count = uni->array_elements ? uni->array_elements : 1;
int j, k, f;
}
i += uni_count;
} while(i < count);
-
- FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
}
return uni;
}
+void
+_mesa_flush_vertices_for_uniforms(struct gl_context *ctx,
+ const struct gl_uniform_storage *uni)
+{
+ uint64_t new_driver_state = 0;
+ unsigned mask = uni->active_shader_mask;
+
+ while (mask) {
+ unsigned index = u_bit_scan(&mask);
+
+ assert(index < MESA_SHADER_STAGES);
+ new_driver_state |= ctx->DriverFlags.NewShaderConstants[index];
+ }
+
+ FLUSH_VERTICES(ctx, new_driver_state ? 0 : _NEW_PROGRAM_CONSTANTS);
+ ctx->NewDriverState |= new_driver_state;
+}
/**
* Called via glUniform*() functions.
count = MIN2(count, (int) (uni->array_elements - offset));
}
- FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
+ _mesa_flush_vertices_for_uniforms(ctx, uni);
/* Store the data in the "actual type" backing storage for the uniform.
*/
count = MIN2(count, (int) (uni->array_elements - offset));
}
- FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
+ _mesa_flush_vertices_for_uniforms(ctx, uni);
/* Store the data in the "actual type" backing storage for the uniform.
*/
count = MIN2(count, (int) (uni->array_elements - offset));
}
- FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
+ _mesa_flush_vertices_for_uniforms(ctx, uni);
/* Store the data in the "actual type" backing storage for the uniform.
*/
extern bool
_mesa_sampler_uniforms_pipeline_are_valid(struct gl_pipeline_object *);
+extern void
+_mesa_flush_vertices_for_uniforms(struct gl_context *ctx,
+ const struct gl_uniform_storage *uni);
+
struct gl_builtin_uniform_element {
const char *field;
int tokens[STATE_LENGTH];