summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2011-12-20 16:18:39 -0800
committerPaul Berry <stereotype441@gmail.com>2011-12-21 13:33:31 -0800
commitaee96806f049c17384a8edc11acce76257d98a57 (patch)
tree59c1eda366888295e188e18858b146097035c17f
parent636f2fc46c83d471b60b96bca1ced0c78b3415b5 (diff)
mesa: Move RasterDiscard to toplevel of gl_context.
Previously we were storing the RasterDiscard flag (for GL_RASTERIZER_DISCARD) in gl_context::TransformFeedback. This was confusing, because we use the _NEW_TRANSFORM flag (not _NEW_TRANSFORM_FEEDBACK) to track state updates to it, and because rasterizer discard has effects even when transform feedback is not in use. This patch makes RasterDiscard a toplevel element in gl_context rather than a subfield of gl_context::TransformFeedback. Note: We can't put RasterDiscard inside gl_context::Transform, since all items inside gl_context::Transform need to be pieces of state that are saved and restored using PushAttrib and PopAttrib. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Marek Olšák <maraeo@gmail.com>
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs.c2
-rw-r--r--src/mesa/main/accum.c2
-rw-r--r--src/mesa/main/clear.c14
-rw-r--r--src/mesa/main/drawpix.c6
-rw-r--r--src/mesa/main/enable.c6
-rw-r--r--src/mesa/main/get.c2
-rw-r--r--src/mesa/main/mtypes.h4
-rw-r--r--src/mesa/state_tracker/st_atom_rasterizer.c2
8 files changed, 19 insertions, 19 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index ee3f94ca61..2495ad5fe0 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -210,7 +210,7 @@ static void populate_key( struct brw_context *brw,
}
/* On Gen6, GS is also used for rasterizer discard. */
/* _NEW_TRANSFORM_FEEDBACK */
- if (ctx->TransformFeedback.RasterDiscard) {
+ if (ctx->RasterDiscard) {
key->need_gs_prog = true;
key->rasterizer_discard = true;
}
diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c
index eb06bbb6e8..a8c30c2239 100644
--- a/src/mesa/main/accum.c
+++ b/src/mesa/main/accum.c
@@ -100,7 +100,7 @@ _mesa_Accum( GLenum op, GLfloat value )
return;
}
- if (ctx->TransformFeedback.RasterDiscard)
+ if (ctx->RasterDiscard)
return;
if (ctx->RenderMode == GL_RENDER) {
diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index 2e27c951bb..bd5c012245 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -200,7 +200,7 @@ _mesa_Clear( GLbitfield mask )
ctx->DrawBuffer->_Ymin >= ctx->DrawBuffer->_Ymax)
return;
- if (ctx->TransformFeedback.RasterDiscard)
+ if (ctx->RasterDiscard)
return;
if (ctx->RenderMode == GL_RENDER) {
@@ -338,7 +338,7 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
drawbuffer);
return;
}
- else if (!ctx->TransformFeedback.RasterDiscard) {
+ else if (!ctx->RasterDiscard) {
/* Save current stencil clear value, set to 'value', do the
* stencil clear and restore the clear value.
* XXX in the future we may have a new ctx->Driver.ClearBuffer()
@@ -362,7 +362,7 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
drawbuffer);
return;
}
- else if (mask && !ctx->TransformFeedback.RasterDiscard) {
+ else if (mask && !ctx->RasterDiscard) {
union gl_color_union clearSave;
/* save color */
@@ -432,7 +432,7 @@ _mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
drawbuffer);
return;
}
- else if (mask && !ctx->TransformFeedback.RasterDiscard) {
+ else if (mask && !ctx->RasterDiscard) {
union gl_color_union clearSave;
/* save color */
@@ -513,7 +513,7 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
drawbuffer);
return;
}
- else if (!ctx->TransformFeedback.RasterDiscard) {
+ else if (!ctx->RasterDiscard) {
/* Save current depth clear value, set to 'value', do the
* depth clear and restore the clear value.
* XXX in the future we may have a new ctx->Driver.ClearBuffer()
@@ -538,7 +538,7 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
drawbuffer);
return;
}
- else if (mask && !ctx->TransformFeedback.RasterDiscard) {
+ else if (mask && !ctx->RasterDiscard) {
union gl_color_union clearSave;
/* save color */
@@ -615,7 +615,7 @@ _mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer,
return;
}
- if (ctx->TransformFeedback.RasterDiscard)
+ if (ctx->RasterDiscard)
return;
if (ctx->NewState) {
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index c9e714b210..9f5b0b36eb 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -98,7 +98,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
goto end; /* the error code was recorded */
}
- if (ctx->TransformFeedback.RasterDiscard) {
+ if (ctx->RasterDiscard) {
goto end;
}
@@ -210,7 +210,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
goto end;
}
- if (ctx->TransformFeedback.RasterDiscard) {
+ if (ctx->RasterDiscard) {
goto end;
}
@@ -268,7 +268,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
return;
}
- if (ctx->TransformFeedback.RasterDiscard)
+ if (ctx->RasterDiscard)
return;
if (ctx->RenderMode == GL_RENDER) {
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 6461ac1b3c..749ae98f5e 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -889,9 +889,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
#if FEATURE_EXT_transform_feedback
case GL_RASTERIZER_DISCARD:
CHECK_EXTENSION(EXT_transform_feedback, cap);
- if (ctx->TransformFeedback.RasterDiscard != state) {
+ if (ctx->RasterDiscard != state) {
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
- ctx->TransformFeedback.RasterDiscard = state;
+ ctx->RasterDiscard = state;
}
break;
#endif
@@ -1403,7 +1403,7 @@ _mesa_IsEnabled( GLenum cap )
#if FEATURE_EXT_transform_feedback
case GL_RASTERIZER_DISCARD:
CHECK_EXTENSION(EXT_transform_feedback);
- return ctx->TransformFeedback.RasterDiscard;
+ return ctx->RasterDiscard;
#endif
/* GL_NV_primitive_restart */
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 4df6afe360..0c9d6b391d 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1204,7 +1204,7 @@ static const struct value_desc values[] = {
/* GL_EXT_transform_feedback */
{ GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, LOC_CUSTOM, TYPE_INT, 0,
extra_EXT_transform_feedback },
- { GL_RASTERIZER_DISCARD, CONTEXT_BOOL(TransformFeedback.RasterDiscard),
+ { GL_RASTERIZER_DISCARD, CONTEXT_BOOL(RasterDiscard),
extra_EXT_transform_feedback },
{ GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS,
CONTEXT_INT(Const.MaxTransformFeedbackInterleavedComponents),
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 93bf04ec09..ff97ea91af 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2386,8 +2386,6 @@ struct gl_transform_feedback
{
GLenum Mode; /**< GL_POINTS, GL_LINES or GL_TRIANGLES */
- GLboolean RasterDiscard; /**< GL_RASTERIZER_DISCARD */
-
/** The general binding point (GL_TRANSFORM_FEEDBACK_BUFFER) */
struct gl_buffer_object *CurrentBuffer;
@@ -3407,6 +3405,8 @@ struct gl_context
*/
GLboolean mvp_with_dp4;
+ GLboolean RasterDiscard; /**< GL_RASTERIZER_DISCARD */
+
/**
* \name Hooks for module contexts.
*
diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
index 4aa0b4e2aa..7ebc872816 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -259,7 +259,7 @@ static void update_raster_state( struct st_context *st )
raster->gl_rasterization_rules = 1;
/* _NEW_TRANSFORM */
- raster->rasterizer_discard = ctx->TransformFeedback.RasterDiscard;
+ raster->rasterizer_discard = ctx->RasterDiscard;
cso_set_rasterizer(st->cso_context, raster);
}