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>tags/mesa-8.0-rc1
@@ -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; | |||
} |
@@ -100,7 +100,7 @@ _mesa_Accum( GLenum op, GLfloat value ) | |||
return; | |||
} | |||
if (ctx->TransformFeedback.RasterDiscard) | |||
if (ctx->RasterDiscard) | |||
return; | |||
if (ctx->RenderMode == GL_RENDER) { |
@@ -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) { |
@@ -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) { |
@@ -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 */ |
@@ -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), |
@@ -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. | |||
* |
@@ -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); | |||
} |