diff --git a/src/mesa/main/draw_validate.c b/src/mesa/main/draw_validate.c index 4436c793ab1..7f73d49d343 100644 --- a/src/mesa/main/draw_validate.c +++ b/src/mesa/main/draw_validate.c @@ -133,19 +133,6 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where) return GL_FALSE; } - /* From the GL_NV_fill_rectangle spec: - * - * "An INVALID_OPERATION error is generated by Begin or any Draw command if - * only one of the front and back polygon mode is FILL_RECTANGLE_NV." - */ - if ((ctx->Polygon.FrontMode == GL_FILL_RECTANGLE_NV) != - (ctx->Polygon.BackMode == GL_FILL_RECTANGLE_NV)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "GL_FILL_RECTANGLE_NV must be used as both front/back " - "polygon mode or neither"); - return GL_FALSE; - } - return GL_TRUE; } @@ -297,6 +284,15 @@ _mesa_update_valid_to_render_state(struct gl_context *ctx) unreachable("Invalid API value in _mesa_update_valid_to_render_state"); } + /* From the GL_NV_fill_rectangle spec: + * + * "An INVALID_OPERATION error is generated by Begin or any Draw command if + * only one of the front and back polygon mode is FILL_RECTANGLE_NV." + */ + if ((ctx->Polygon.FrontMode == GL_FILL_RECTANGLE_NV) != + (ctx->Polygon.BackMode == GL_FILL_RECTANGLE_NV)) + return; + /* From GL_INTEL_conservative_rasterization spec: * * The conservative rasterization option applies only to polygons with diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index 3bb416d360c..bbba607ebe4 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -160,6 +160,10 @@ _mesa_FrontFace(GLenum mode) static ALWAYS_INLINE void polygon_mode(struct gl_context *ctx, GLenum face, GLenum mode, bool no_error) { + bool old_mode_has_fill_rectangle = + ctx->Polygon.FrontMode == GL_FILL_RECTANGLE_NV || + ctx->Polygon.BackMode == GL_FILL_RECTANGLE_NV; + if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glPolygonMode %s %s\n", _mesa_enum_to_string(face), @@ -224,7 +228,8 @@ polygon_mode(struct gl_context *ctx, GLenum face, GLenum mode, bool no_error) if (ctx->Driver.PolygonMode) ctx->Driver.PolygonMode(ctx, face, mode); - if (ctx->Extensions.INTEL_conservative_rasterization) + if (ctx->Extensions.INTEL_conservative_rasterization || + (mode == GL_FILL_RECTANGLE_NV || old_mode_has_fill_rectangle)) _mesa_update_valid_to_render_state(ctx); }