summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/api_validate.c
diff options
context:
space:
mode:
authorLionel Landwerlin <[email protected]>2016-11-30 14:47:41 +0000
committerLionel Landwerlin <[email protected]>2016-12-07 11:02:16 +0000
commit039d836d6ea5621ede88ff3504be841a6dd865c6 (patch)
treeb3a34fad43bb1cb7b85b5641ce02fbcc6673a772 /src/mesa/main/api_validate.c
parent0ff74a8990d9fe37365beb35ed8abacfbf3ed567 (diff)
mesa: add support for GL_INTEL_conservative_rasterization
Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src/mesa/main/api_validate.c')
-rw-r--r--src/mesa/main/api_validate.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 071c16d1a1d..f68011ebbf9 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -555,6 +555,48 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
}
}
+ /* From GL_INTEL_conservative_rasterization spec:
+ *
+ * The conservative rasterization option applies only to polygons with
+ * PolygonMode state set to FILL. Draw requests for polygons with different
+ * PolygonMode setting or for other primitive types (points/lines) generate
+ * INVALID_OPERATION error.
+ */
+ if (ctx->IntelConservativeRasterization) {
+ GLboolean pass = GL_TRUE;
+
+ switch (mode) {
+ case GL_POINTS:
+ case GL_LINES:
+ case GL_LINE_LOOP:
+ case GL_LINE_STRIP:
+ case GL_LINES_ADJACENCY:
+ case GL_LINE_STRIP_ADJACENCY:
+ pass = GL_FALSE;
+ break;
+ case GL_TRIANGLES:
+ case GL_TRIANGLE_STRIP:
+ case GL_TRIANGLE_FAN:
+ case GL_QUADS:
+ case GL_QUAD_STRIP:
+ case GL_POLYGON:
+ case GL_TRIANGLES_ADJACENCY:
+ case GL_TRIANGLE_STRIP_ADJACENCY:
+ if (ctx->Polygon.FrontMode != GL_FILL ||
+ ctx->Polygon.BackMode != GL_FILL)
+ pass = GL_FALSE;
+ break;
+ default:
+ pass = GL_FALSE;
+ }
+ if (!pass) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "mode=%s invalid with GL_INTEL_conservative_rasterization",
+ _mesa_lookup_prim_by_nr(mode));
+ return GL_FALSE;
+ }
+ }
+
return GL_TRUE;
}