mesa: Add support for GL_NV_fill_rectangle
[mesa.git] / src / mesa / main / api_validate.c
index 44d164ad3553aee0790d16fed17f02fb9cb3f1e7..af4f7cb4bf3d2035d063cfca78fde2cc5edd9793 100644 (file)
@@ -189,6 +189,19 @@ _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;
+   }
+
 #ifdef DEBUG
    if (ctx->_Shader->Flags & GLSL_LOG) {
       struct gl_program **prog = ctx->_Shader->CurrentProgram;