llvmpipe/setup: add point size clamping

Fixes
dEQP-GLES2.functional.rasterization.limits.points
dEQP-VK.rasterization.primitive_size.points.point_size*

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4574>
This commit is contained in:
Dave Airlie
2020-04-16 17:15:28 +10:00
parent 1f071db43a
commit 65906d1331
5 changed files with 9 additions and 4 deletions
+4
View File
@@ -95,4 +95,8 @@
*/
#define LP_MAX_SETUP_VARIANTS 64
/*
* Max point size reported. Cap vertex shader point sizes to this.
*/
#define LP_MAX_POINT_WIDTH 255.0f
#endif /* LP_LIMITS_H */
+1 -1
View File
@@ -478,7 +478,7 @@ llvmpipe_get_paramf(struct pipe_screen *screen, enum pipe_capf param)
case PIPE_CAPF_MAX_POINT_WIDTH:
/* fall-through */
case PIPE_CAPF_MAX_POINT_WIDTH_AA:
return 255.0; /* arbitrary */
return LP_MAX_POINT_WIDTH; /* arbitrary */
case PIPE_CAPF_MAX_TEXTURE_ANISOTROPY:
return 16.0; /* not actually signficant at this time */
case PIPE_CAPF_MAX_TEXTURE_LOD_BIAS:
@@ -337,10 +337,13 @@ try_setup_point( struct lp_setup_context *setup,
/* x/y positions in fixed point */
const struct lp_setup_variant_key *key = &setup->setup.variant->key;
const int sizeAttr = setup->psize_slot;
const float size
float size
= (setup->point_size_per_vertex && sizeAttr > 0) ? v0[sizeAttr][0]
: setup->point_size;
if (size > LP_MAX_POINT_WIDTH)
size = LP_MAX_POINT_WIDTH;
/* Yes this is necessary to accurately calculate bounding boxes
* with the two fill-conventions we support. GL (normally) ends
* up needing a bottom-left fill convention, which requires