_NEW_TRANSFORM_FEEDBACK is not used by core Mesa, so it can be removed.
Instead, an new private flag is added to i965 to serve the same purpose.
If you're new to this:
* When creating a context. you can set private dirty flags
in gl_context::DriverFlags, eg.:
ctx->DriverFlags.NewStateX = BRW_NEW_STATE_X;
* When StateX is changed, core Mesa does:
ctx->NewDriverState |= ctx->DriverFlags.NewStateX;
* When you have to draw, read and clear ctx->NewDriverState.
* Pros: not touching NewState, the driver decides the mapping between
GL states and hw state groups, unlimited number of flags in core Mesa
(still limited number of flags in the driver though)
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
if (tnl)
tnl->Driver.RunPipeline = _tnl_run_pipeline;
+ ctx->DriverFlags.NewTransformFeedback = BRW_NEW_TRANSFORM_FEEDBACK;
+
ctx->Const.MaxDualSourceDrawBuffers = 1;
ctx->Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS;
ctx->Const.MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
BRW_STATE_STATE_BASE_ADDRESS,
BRW_STATE_SOL_INDICES,
BRW_STATE_VUE_MAP_GEOM_OUT,
+ BRW_STATE_TRANSFORM_FEEDBACK,
};
#define BRW_NEW_URB_FENCE (1 << BRW_STATE_URB_FENCE)
#define BRW_NEW_STATE_BASE_ADDRESS (1 << BRW_STATE_STATE_BASE_ADDRESS)
#define BRW_NEW_SOL_INDICES (1 << BRW_STATE_SOL_INDICES)
#define BRW_NEW_VUE_MAP_GEOM_OUT (1 << BRW_STATE_VUE_MAP_GEOM_OUT)
+#define BRW_NEW_TRANSFORM_FEEDBACK (1 << BRW_STATE_TRANSFORM_FEEDBACK)
struct brw_state_flags {
/** State update flags signalled by mesa internals */
key->need_gs_prog = false;
} else if (intel->gen == 6) {
/* On Gen6, GS is used for transform feedback. */
- /* _NEW_TRANSFORM_FEEDBACK */
+ /* BRW_NEW_TRANSFORM_FEEDBACK */
if (_mesa_is_xfb_active_and_unpaused(ctx)) {
const struct gl_shader_program *shaderprog =
ctx->Shader.CurrentVertexProgram;
const struct brw_tracked_state brw_gs_prog = {
.dirty = {
.mesa = (_NEW_LIGHT |
- _NEW_TRANSFORM_FEEDBACK |
_NEW_RASTERIZER_DISCARD),
- .brw = BRW_NEW_PRIMITIVE,
+ .brw = (BRW_NEW_PRIMITIVE |
+ BRW_NEW_TRANSFORM_FEEDBACK),
.cache = CACHE_NEW_VS_PROG
},
.emit = brw_upload_gs_prog
DEFINE_BIT(_NEW_PROGRAM_CONSTANTS),
DEFINE_BIT(_NEW_BUFFER_OBJECT),
DEFINE_BIT(_NEW_FRAG_CLAMP),
- DEFINE_BIT(_NEW_TRANSFORM_FEEDBACK),
DEFINE_BIT(_NEW_VARYING_VP_INPUTS),
{0, 0, 0}
};
DEFINE_BIT(BRW_NEW_STATE_BASE_ADDRESS),
DEFINE_BIT(BRW_NEW_SOL_INDICES),
DEFINE_BIT(BRW_NEW_VUE_MAP_GEOM_OUT),
+ DEFINE_BIT(BRW_NEW_TRANSFORM_FEEDBACK),
{0, 0, 0}
};
state->mesa |= brw->intel.NewGLState;
brw->intel.NewGLState = 0;
+ state->brw |= ctx->NewDriverState;
+ ctx->NewDriverState = 0;
+
if (brw->emit_state_always) {
state->mesa |= ~0;
state->brw |= ~0;
gen6_update_sol_surfaces(struct brw_context *brw)
{
struct gl_context *ctx = &brw->intel.ctx;
- /* _NEW_TRANSFORM_FEEDBACK */
+ /* BRW_NEW_TRANSFORM_FEEDBACK */
struct gl_transform_feedback_object *xfb_obj =
ctx->TransformFeedback.CurrentObject;
/* BRW_NEW_VERTEX_PROGRAM */
const struct brw_tracked_state gen6_sol_surface = {
.dirty = {
- .mesa = _NEW_TRANSFORM_FEEDBACK,
+ .mesa = 0,
.brw = (BRW_NEW_BATCH |
- BRW_NEW_VERTEX_PROGRAM),
+ BRW_NEW_VERTEX_PROGRAM |
+ BRW_NEW_TRANSFORM_FEEDBACK),
.cache = 0
},
.emit = gen6_update_sol_surfaces,
ctx->Shader.CurrentVertexProgram;
const struct gl_transform_feedback_info *linked_xfb_info =
&vs_prog->LinkedTransformFeedback;
- /* _NEW_TRANSFORM_FEEDBACK */
+ /* BRW_NEW_TRANSFORM_FEEDBACK */
struct gl_transform_feedback_object *xfb_obj =
ctx->TransformFeedback.CurrentObject;
int i;
/* BRW_NEW_VERTEX_PROGRAM */
const struct gl_shader_program *vs_prog =
ctx->Shader.CurrentVertexProgram;
- /* _NEW_TRANSFORM_FEEDBACK */
+ /* BRW_NEW_TRANSFORM_FEEDBACK */
const struct gl_transform_feedback_info *linked_xfb_info =
&vs_prog->LinkedTransformFeedback;
int i;
{
struct intel_context *intel = &brw->intel;
struct gl_context *ctx = &intel->ctx;
- /* _NEW_TRANSFORM_FEEDBACK */
+ /* BRW_NEW_TRANSFORM_FEEDBACK */
struct gl_transform_feedback_object *xfb_obj =
ctx->TransformFeedback.CurrentObject;
uint32_t dw1 = 0, dw2 = 0;
{
struct intel_context *intel = &brw->intel;
struct gl_context *ctx = &intel->ctx;
- /* _NEW_TRANSFORM_FEEDBACK */
+ /* BRW_NEW_TRANSFORM_FEEDBACK */
bool active = _mesa_is_xfb_active_and_unpaused(ctx);
if (active) {
const struct brw_tracked_state gen7_sol_state = {
.dirty = {
.mesa = (_NEW_RASTERIZER_DISCARD |
- _NEW_LIGHT |
- _NEW_TRANSFORM_FEEDBACK),
+ _NEW_LIGHT),
.brw = (BRW_NEW_BATCH |
BRW_NEW_VERTEX_PROGRAM |
- BRW_NEW_VUE_MAP_GEOM_OUT)
+ BRW_NEW_VUE_MAP_GEOM_OUT |
+ BRW_NEW_TRANSFORM_FEEDBACK)
},
.emit = upload_sol_state,
};
#define _NEW_PROGRAM_CONSTANTS (1 << 27)
#define _NEW_BUFFER_OBJECT (1 << 28)
#define _NEW_FRAG_CLAMP (1 << 29)
-#define _NEW_TRANSFORM_FEEDBACK (1 << 30) /**< gl_context::TransformFeedback */
+/* gap, re-use for core Mesa state only; use ctx->DriverFlags otherwise */
#define _NEW_VARYING_VP_INPUTS (1 << 31) /**< gl_context::varying_vp_inputs */
#define _NEW_ALL ~0
*/
struct gl_driver_flags
{
- GLbitfield NewArray; /**< Vertex array state */
+ /** gl_context::Array::_DrawArrays (vertex array state) */
+ GLbitfield NewArray;
+
+ /** gl_context::TransformFeedback::CurrentObject */
+ GLbitfield NewTransformFeedback;
};
struct gl_uniform_buffer_binding
}
}
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback;
+
obj->Active = GL_TRUE;
ctx->TransformFeedback.Mode = mode;
return;
}
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback;
+
ctx->TransformFeedback.CurrentObject->Active = GL_FALSE;
ctx->TransformFeedback.CurrentObject->Paused = GL_FALSE;
ctx->TransformFeedback.CurrentObject->EndedAnytime = GL_TRUE;
struct gl_transform_feedback_object *obj =
ctx->TransformFeedback.CurrentObject;
- /* Note: no need to FLUSH_VERTICES or flag _NEW_TRANSFORM_FEEDBACK, because
+ /* Note: no need to FLUSH_VERTICES or flag NewTransformFeedback, because
* transform feedback buffers can't be changed while transform feedback is
* active.
*/
shProg->TransformFeedback.BufferMode = bufferMode;
- /* No need to set _NEW_TRANSFORM_FEEDBACK (or invoke FLUSH_VERTICES) since
+ /* No need to invoke FLUSH_VERTICES or flag NewTransformFeedback since
* the varyings won't be used until shader link time.
*/
}
return;
}
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback;
+
obj->Paused = GL_TRUE;
assert(ctx->Driver.PauseTransformFeedback);
return;
}
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback;
+
obj->Paused = GL_FALSE;
assert(ctx->Driver.ResumeTransformFeedback);