[virglrenderer-devel] [PATCH 11/16] vrend: Warn on invalid stipple and polygon mode
Jakob Bornecrantz
jakob.bornecrantz at collabora.com
Fri Dec 22 18:57:51 UTC 2017
GLES is missing various bits that is also missing in core profile. The there is
warnings for those so copy those warnings and make them GLES specific.
Current batch is:
* GLES only supports GL_FILL polygon mode.
* GLES does not support line stipple.
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz at collabora.com>
---
src/vrend_renderer.c | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 9354533..3c3aec6 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -499,6 +499,21 @@ static void __report_core_warn(const char *fname, struct vrend_context *ctx, enu
fprintf(stderr,"%s: core profile violation reported %d \"%s\" %s %d\n", fname, ctx->ctx_id, ctx->debug_name, vrend_core_profile_warn_strings[error], value);
}
#define report_core_warn(ctx, error, value) __report_core_warn(__func__, ctx, error, value)
+
+
+#define GLES_WARN_NONE 0
+#define GLES_WARN_STIPPLE 1
+#define GLES_WARN_POLYGON_MODE 2
+
+static const char *vrend_gles_warn_strings[] = { "None", "Stipple", "Polygon Mode" };
+
+static void __report_gles_warn(const char *fname, struct vrend_context *ctx, enum virgl_ctx_errors error, uint32_t value)
+{
+ fprintf(stderr,"%s: gles violation reported %d \"%s\" %s %d\n", fname, ctx->ctx_id, ctx->debug_name, vrend_gles_warn_strings[error], value);
+}
+#define report_gles_warn(ctx, error, value) __report_gles_warn(__func__, ctx, error, value)
+
+
static inline bool should_invert_viewport(struct vrend_context *ctx)
{
/* if we have a negative viewport then gallium wanted to invert it,
@@ -3400,7 +3415,14 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx)
glDisable(GL_RASTERIZER_DISCARD);
}
- if (vrend_state.use_core_profile == false) {
+ if (vrend_state.use_gles == true) {
+ if (translate_fill(state->fill_front) != GL_FILL) {
+ report_gles_warn(ctx, GLES_WARN_POLYGON_MODE, 0);
+ }
+ if (translate_fill(state->fill_back) != GL_FILL) {
+ report_gles_warn(ctx, GLES_WARN_POLYGON_MODE, 0);
+ }
+ } else if (vrend_state.use_core_profile == false) {
glPolygonMode(GL_FRONT, translate_fill(state->fill_front));
glPolygonMode(GL_BACK, translate_fill(state->fill_back));
} else if (state->fill_front == state->fill_back) {
@@ -3504,8 +3526,12 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx)
glEnable(GL_LINE_STIPPLE);
else
glDisable(GL_LINE_STIPPLE);
- } else if (state->line_stipple_enable)
- report_core_warn(ctx, CORE_PROFILE_WARN_STIPPLE, 0);
+ } else if (state->line_stipple_enable) {
+ if (vrend_state.use_gles)
+ report_core_warn(ctx, GLES_WARN_STIPPLE, 0);
+ else
+ report_core_warn(ctx, CORE_PROFILE_WARN_STIPPLE, 0);
+ }
if (state->line_smooth)
glEnable(GL_LINE_SMOOTH);
--
2.11.0
More information about the virglrenderer-devel
mailing list