diff options
author | Paul Berry <[email protected]> | 2011-12-20 16:18:39 -0800 |
---|---|---|
committer | Paul Berry <[email protected]> | 2011-12-21 13:33:31 -0800 |
commit | aee96806f049c17384a8edc11acce76257d98a57 (patch) | |
tree | 59c1eda366888295e188e18858b146097035c17f /src | |
parent | 636f2fc46c83d471b60b96bca1ced0c78b3415b5 (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 <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_gs.c | 2 | ||||
-rw-r--r-- | src/mesa/main/accum.c | 2 | ||||
-rw-r--r-- | src/mesa/main/clear.c | 14 | ||||
-rw-r--r-- | src/mesa/main/drawpix.c | 6 | ||||
-rw-r--r-- | src/mesa/main/enable.c | 6 | ||||
-rw-r--r-- | src/mesa/main/get.c | 2 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 4 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_rasterizer.c | 2 |
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 ee3f94ca613..2495ad5fe0b 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 eb06bbb6e89..a8c30c22399 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 2e27c951bbb..bd5c012245a 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 c9e714b210a..9f5b0b36eb7 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 6461ac1b3c9..749ae98f5ec 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 4df6afe360f..0c9d6b391d4 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 93bf04ec097..ff97ea91af2 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 4aa0b4e2aa6..7ebc8728166 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); } |