summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-04-15 00:50:20 +0200
committerMarek Olšák <[email protected]>2013-04-24 03:23:23 +0200
commitb95cbe5e800e95d888d148e20e6a4e34c8857a9e (patch)
treeae6f5de49fd974c8ab83116a331b4325f623fe9b /src/mesa/main
parentef39bc4f2ee09ee020b52fff9a9c8dc680fc252e (diff)
mesa,i965: use NewDriverState to communicate TFB state changes with the driver
_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 <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/mtypes.h8
-rw-r--r--src/mesa/main/transformfeedback.c20
2 files changed, 20 insertions, 8 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 6108a35fd80..8d8622e9e1b 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3148,7 +3148,7 @@ struct gl_matrix_stack
#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
@@ -3333,7 +3333,11 @@ typedef enum
*/
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
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index d0118c5f7c7..9967fbf6c8f 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -384,7 +384,9 @@ _mesa_BeginTransformFeedback(GLenum mode)
}
}
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback;
+
obj->Active = GL_TRUE;
ctx->TransformFeedback.Mode = mode;
@@ -421,7 +423,9 @@ _mesa_EndTransformFeedback(void)
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;
@@ -442,7 +446,7 @@ bind_buffer_range(struct gl_context *ctx, GLuint index,
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.
*/
@@ -686,7 +690,7 @@ _mesa_TransformFeedbackVaryings(GLuint program, GLsizei count,
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.
*/
}
@@ -897,7 +901,9 @@ _mesa_PauseTransformFeedback(void)
return;
}
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback;
+
obj->Paused = GL_TRUE;
assert(ctx->Driver.PauseTransformFeedback);
@@ -923,7 +929,9 @@ _mesa_ResumeTransformFeedback(void)
return;
}
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback;
+
obj->Paused = GL_FALSE;
assert(ctx->Driver.ResumeTransformFeedback);