[virglrenderer-devel] [PATCH 13/16] vrend: Warn on unsupported point size

Jakob Bornecrantz jakob.bornecrantz at collabora.com
Fri Dec 22 18:57:53 UTC 2017


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 <jakob.bornecrantz at collabora.com>
---
 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 dc18fe8..2023a62 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -505,8 +505,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)
 {
@@ -3409,12 +3410,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) {
-- 
2.11.0



More information about the virglrenderer-devel mailing list