From: Iago Toral Quiroga Date: Wed, 31 Jul 2019 07:50:34 +0000 (+0200) Subject: v3d: clamp gl_PointSize to a minimum of 1.0 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3539bd63dd04209317fb158b270033f32f75dcc4;p=mesa.git v3d: clamp gl_PointSize to a minimum of 1.0 The OpenGL ES spec requires that the value of gl_PointSize is clamped to an implementation-dependent range matching what is advertised by GL_ALIASED_POINT_SIZE_RANGE. For V3D this is [1.0, 512.0], but the hardware won't clamp to the minimum side of the range and won't render points with a size strictly smaller than 1.0 either, so we need to clamp manually. For points larger than the maximum size of the range the hardware clamps automatically. Fixes piglit test: spec/!opengl 2.0/vs-point_size-zero Reviewed-by: Eric Anholt --- diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c index eed3fc18b12..78362a2949c 100644 --- a/src/broadcom/compiler/vir.c +++ b/src/broadcom/compiler/vir.c @@ -758,6 +758,11 @@ v3d_nir_lower_vs_early(struct v3d_compile *c) NIR_PASS_V(c->s, nir_lower_global_vars_to_local); v3d_optimize_nir(c->s); NIR_PASS_V(c->s, nir_remove_dead_variables, nir_var_shader_in); + + /* This must go before nir_lower_io */ + if (c->vs_key->per_vertex_point_size) + NIR_PASS_V(c->s, nir_lower_point_size, 1.0f, 0.0f); + NIR_PASS_V(c->s, nir_lower_io, nir_var_shader_in | nir_var_shader_out, type_size_vec4, (nir_lower_io_options)0);