radv,aco: do not implicitly export the primitive ID for mesh shaders

From the Vulkan spec:

    "VUID-VkGraphicsPipelineCreateInfo-PrimitiveId-06264
     If the pipeline is being created with pre-rasterization shader
     state, it includes a mesh shader and the fragment shader code
     reads from an input variable that is decorated with PrimitiveId,
     then the mesh shader code must write to a matching output variable,
     decorated with PrimitiveId, in all execution paths"

So, if PS uses PrimitiveID, MS must export it (like GS).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16438>
This commit is contained in:
Samuel Pitoiset
2022-05-10 19:22:26 +02:00
committed by Marge Bot
parent b043cbc72b
commit 27f1da8215
6 changed files with 2 additions and 11 deletions

View File

@@ -10674,8 +10674,6 @@ create_primitive_exports(isel_context *ctx, Temp prim_ch1)
ctx->outputs.temps[VARYING_SLOT_LAYER * 4u] = bld.copy(bld.def(v1), Operand::c32(0));
if (outinfo->writes_viewport_index_per_primitive && !ctx->outputs.mask[VARYING_SLOT_VIEWPORT])
ctx->outputs.temps[VARYING_SLOT_VIEWPORT * 4u] = bld.copy(bld.def(v1), Operand::c32(0));
if (outinfo->export_prim_id_per_primitive && !ctx->outputs.mask[VARYING_SLOT_PRIMITIVE_ID])
ctx->outputs.temps[VARYING_SLOT_PRIMITIVE_ID * 4u] = bld.copy(bld.def(v1), Operand::c32(0));
/* When layer, viewport etc. are per-primitive, they need to be encoded in
* the primitive export instruction's second channel. The encoding is:

View File

@@ -73,7 +73,6 @@ struct aco_vp_output_info {
bool writes_primitive_shading_rate;
bool writes_primitive_shading_rate_per_primitive;
bool export_prim_id;
bool export_prim_id_per_primitive;
bool export_clip_dists;
};

View File

@@ -61,7 +61,6 @@ radv_aco_convert_shader_vp_info(struct aco_vp_output_info *aco_info,
ASSIGN_FIELD(writes_primitive_shading_rate);
ASSIGN_FIELD(writes_primitive_shading_rate_per_primitive);
ASSIGN_FIELD(export_prim_id);
ASSIGN_FIELD(export_prim_id_per_primitive);
ASSIGN_FIELD(export_clip_dists);
/* don't use export params */
}

View File

@@ -3337,10 +3337,8 @@ radv_fill_shader_info(struct radv_pipeline *pipeline,
assert(outinfo);
outinfo->export_clip_dists |= ps_clip_dists_in;
if (pipeline->graphics.last_vgt_api_stage == MESA_SHADER_MESH) {
outinfo->export_prim_id_per_primitive |= ps_prim_id_in;
} else if (pipeline->graphics.last_vgt_api_stage == MESA_SHADER_VERTEX ||
pipeline->graphics.last_vgt_api_stage == MESA_SHADER_TESS_EVAL) {
if (pipeline->graphics.last_vgt_api_stage == MESA_SHADER_VERTEX ||
pipeline->graphics.last_vgt_api_stage == MESA_SHADER_TESS_EVAL) {
outinfo->export_prim_id |= ps_prim_id_in;
}

View File

@@ -209,7 +209,6 @@ struct radv_vs_output_info {
bool writes_primitive_shading_rate;
bool writes_primitive_shading_rate_per_primitive;
bool export_prim_id;
bool export_prim_id_per_primitive;
bool export_clip_dists;
unsigned pos_exports;
};

View File

@@ -561,8 +561,6 @@ radv_nir_shader_info_pass(struct radv_device *device, const struct nir_shader *n
assign_outinfo_param(outinfo, VARYING_SLOT_LAYER, &total_param_exports);
if (outinfo->writes_viewport_index_per_primitive)
assign_outinfo_param(outinfo, VARYING_SLOT_VIEWPORT, &total_param_exports);
if (outinfo->export_prim_id_per_primitive)
assign_outinfo_param(outinfo, VARYING_SLOT_PRIMITIVE_ID, &total_param_exports);
outinfo->prim_param_exports = total_param_exports - outinfo->param_exports;
}