summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_validate.c42
-rw-r--r--src/mesa/main/enable.c12
-rw-r--r--src/mesa/main/extensions_table.h1
-rw-r--r--src/mesa/main/mtypes.h3
-rw-r--r--src/mesa/main/shaderapi.c1
5 files changed, 59 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;
}
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index d1ab81e50ee..c9f10abb383 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -439,6 +439,14 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.IndexLogicOpEnabled = state;
break;
+ case GL_CONSERVATIVE_RASTERIZATION_INTEL:
+ if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
+ goto invalid_enum_error;
+ if (ctx->IntelConservativeRasterization == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POLYGON);
+ ctx->IntelConservativeRasterization = state;
+ break;
case GL_COLOR_LOGIC_OP:
if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
goto invalid_enum_error;
@@ -1631,6 +1639,10 @@ _mesa_IsEnabled( GLenum cap )
CHECK_EXTENSION(KHR_blend_equation_advanced_coherent);
return ctx->Color.BlendCoherent;
+ case GL_CONSERVATIVE_RASTERIZATION_INTEL:
+ CHECK_EXTENSION(INTEL_conservative_rasterization);
+ return ctx->IntelConservativeRasterization;
+
default:
goto invalid_enum_error;
}
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index f215e0a9715..9c3b7769672 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -290,6 +290,7 @@ EXT(IBM_texture_mirrored_repeat , dummy_true
EXT(INGR_blend_func_separate , EXT_blend_func_separate , GLL, x , x , x , 1999)
+EXT(INTEL_conservative_rasterization , INTEL_conservative_rasterization , x , 42, x , 32, 2013)
EXT(INTEL_performance_query , INTEL_performance_query , GLL, GLC, x , ES2, 2013)
EXT(KHR_blend_equation_advanced , KHR_blend_equation_advanced , GLL, GLC, x , ES2, 2014)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 0123def07eb..71bd89e510d 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2175,6 +2175,7 @@ struct gl_shader_info
bool uses_gl_fragcoord;
bool redeclares_gl_fragcoord;
bool PostDepthCoverage;
+ bool InnerCoverage;
bool ARB_fragment_coord_conventions_enable;
/**
@@ -3936,6 +3937,7 @@ struct gl_extensions
GLboolean ATI_fragment_shader;
GLboolean ATI_separate_stencil;
GLboolean GREMEDY_string_marker;
+ GLboolean INTEL_conservative_rasterization;
GLboolean INTEL_performance_query;
GLboolean KHR_blend_equation_advanced;
GLboolean KHR_blend_equation_advanced_coherent;
@@ -4619,6 +4621,7 @@ struct gl_context
GLboolean TextureFormatSupported[MESA_FORMAT_COUNT];
GLboolean RasterDiscard; /**< GL_RASTERIZER_DISCARD */
+ GLboolean IntelConservativeRasterization; /**< GL_INTEL_CONSERVATIVE_RASTERIZATION */
/**
* \name Hooks for module contexts.
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 064ec4e1ccb..10cee7b0220 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -2194,6 +2194,7 @@ _mesa_copy_linked_program_data(const struct gl_shader_program *src,
case MESA_SHADER_FRAGMENT: {
dst->info.fs.depth_layout = src->FragDepthLayout;
dst->info.fs.early_fragment_tests = dst_sh->info.EarlyFragmentTests;
+ dst->info.fs.inner_coverage = dst_sh->info.InnerCoverage;
dst->info.fs.post_depth_coverage = dst_sh->info.PostDepthCoverage;
break;
}