v3dv: only flag 'shader writes point size' if the shader actually writes it
If the shader writes point size, then the compiler needs to ensure it writes it in the appropriate vpm output slot and also clamp its value to expected limits. This is why we have the per_vertex_point_size in the shader key, so it doesn't really make sense to set this if the shader doesn't write point size. If the shader record flags that the shader writes point size then the hardware will use the shader written value to override point size state (set with the POINT_SIZE packet), so again, we really only want to set this in the shader state record if the shader actually writes its value. While we could also limit this to point primitives, since these are the only primitives where point size has an effect, this is not really required, and skipping this allows us to use the same shader with any primitive type (otherwise we would have to compile 2 different shaders). Finally, this change makes the vertex shader setup for point size match the one we had been doing for geometry shaders, so it makes both stages behave consistently regarding point size behavior. Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29413>
This commit is contained in:

committed by
Marge Bot

parent
c30833f233
commit
7e0616ecc5
@@ -1299,16 +1299,8 @@ pipeline_populate_v3d_vs_key(struct v3d_vs_key *key,
|
||||
|
||||
struct v3dv_pipeline *pipeline = p_stage->pipeline;
|
||||
|
||||
/* Vulkan specifies a point size per vertex, so true for if the prim are
|
||||
* points, like on ES2)
|
||||
*/
|
||||
const VkPipelineInputAssemblyStateCreateInfo *ia_info =
|
||||
pCreateInfo->pInputAssemblyState;
|
||||
uint8_t topology = vk_to_mesa_prim[ia_info->topology];
|
||||
|
||||
/* FIXME: PRIM_POINTS is not enough, in gallium the full check is
|
||||
* MESA_PRIM_POINTS && v3d->rasterizer->base.point_size_per_vertex */
|
||||
key->per_vertex_point_size = (topology == MESA_PRIM_POINTS);
|
||||
key->per_vertex_point_size =
|
||||
p_stage->nir->info.outputs_written & (1ull << VARYING_SLOT_PSIZ);
|
||||
|
||||
key->is_coord = broadcom_shader_stage_is_binning(p_stage->stage);
|
||||
|
||||
|
@@ -375,7 +375,9 @@ pack_shader_state_record(struct v3dv_pipeline *pipeline)
|
||||
|
||||
bool point_size_in_shaded_vertex_data;
|
||||
if (!pipeline->has_gs) {
|
||||
point_size_in_shaded_vertex_data = pipeline->topology == MESA_PRIM_POINTS;
|
||||
struct v3d_vs_prog_data *prog_data_vs =
|
||||
pipeline->shared_data->variants[BROADCOM_SHADER_VERTEX]->prog_data.vs;
|
||||
point_size_in_shaded_vertex_data = prog_data_vs->writes_psiz;
|
||||
} else {
|
||||
struct v3d_gs_prog_data *prog_data_gs =
|
||||
pipeline->shared_data->variants[BROADCOM_SHADER_GEOMETRY]->prog_data.gs;
|
||||
|
Reference in New Issue
Block a user