From 595d8dff552cf0eb625a2370747d17808f29bc9f Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 22 Dec 2017 18:57:53 +0000 Subject: [PATCH] vrend: Warn on unsupported point size The size of 1.0 is supported since it is the default, while the size of 0.0f is invalid so we don't have to warn about it. Signed-off-by: Jakob Bornecrantz Signed-off-by: Dave Airlie --- src/vrend_renderer.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 4095831..66fed3b 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -501,8 +501,9 @@ static void __report_core_warn(const char *fname, struct vrend_context *ctx, enu #define GLES_WARN_STIPPLE 1 #define GLES_WARN_POLYGON_MODE 2 #define GLES_WARN_DEPTH_RANGE 3 +#define GLES_WARN_POINT_SIZE 4 -static const char *vrend_gles_warn_strings[] = { "None", "Stipple", "Polygon Mode", "Depth Range" }; +static const char *vrend_gles_warn_strings[] = { "None", "Stipple", "Polygon Mode", "Depth Range", "Point Size" }; static void __report_gles_warn(const char *fname, struct vrend_context *ctx, enum virgl_ctx_errors error, uint32_t value) { @@ -3391,12 +3392,20 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx) glEnable(GL_DEPTH_CLAMP); } - if (state->point_size_per_vertex) { + if (vrend_state.use_gles) { + /* guest send invalid glPointSize parameter */ + if (!state->point_size_per_vertex && + state->point_size != 1.0f && + state->point_size != 0.0f) { + report_gles_warn(ctx, GLES_WARN_POINT_SIZE, 0); + } + } else if (state->point_size_per_vertex) { glEnable(GL_PROGRAM_POINT_SIZE); } else { glDisable(GL_PROGRAM_POINT_SIZE); - if (state->point_size) + if (state->point_size) { glPointSize(state->point_size); + } } if (state->rasterizer_discard != ctx->sub->hw_rs_state.rasterizer_discard) {