radv: handle exporting view index to fragment shader. (v1.1)
The fragment shader was trying to read this, but nothing
was exporting it from the vertex shader. This handles
it like the prim id export.
Fixes:
dEQP-VK.multiview.secondary_cmd_buffer.*
dEQP-VK.multiview.index.fragment_shader.*
v1.1: updated to use 0x1 (Samuel)
Fixes: e3265c10c8
(radv: Implement multiview draws.)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
dbc24835d7
commit
8f052a3e25
|
@ -2183,7 +2183,7 @@ radv_load_output(struct radv_shader_context *ctx, unsigned index, unsigned chan)
|
|||
|
||||
static void
|
||||
handle_vs_outputs_post(struct radv_shader_context *ctx,
|
||||
bool export_prim_id,
|
||||
bool export_prim_id, bool export_layer_id,
|
||||
struct radv_vs_output_info *outinfo)
|
||||
{
|
||||
uint32_t param_count = 0;
|
||||
|
@ -2363,6 +2363,18 @@ handle_vs_outputs_post(struct radv_shader_context *ctx,
|
|||
outinfo->export_prim_id = true;
|
||||
}
|
||||
|
||||
if (export_layer_id) {
|
||||
LLVMValueRef values[4];
|
||||
|
||||
values[0] = layer_value;
|
||||
for (unsigned j = 1; j < 4; j++)
|
||||
values[j] = ctx->ac.f32_0;
|
||||
|
||||
radv_export_param(ctx, param_count, values, 0x1);
|
||||
|
||||
outinfo->vs_output_param_offset[VARYING_SLOT_LAYER] = param_count++;
|
||||
}
|
||||
|
||||
outinfo->pos_exports = num_pos_exports;
|
||||
outinfo->param_exports = param_count;
|
||||
}
|
||||
|
@ -2825,6 +2837,7 @@ handle_shader_outputs_post(struct ac_shader_abi *abi, unsigned max_outputs,
|
|||
handle_es_outputs_post(ctx, &ctx->shader_info->vs.es_info);
|
||||
else
|
||||
handle_vs_outputs_post(ctx, ctx->options->key.vs.export_prim_id,
|
||||
ctx->options->key.vs.export_layer_id,
|
||||
&ctx->shader_info->vs.outinfo);
|
||||
break;
|
||||
case MESA_SHADER_FRAGMENT:
|
||||
|
@ -2841,6 +2854,7 @@ handle_shader_outputs_post(struct ac_shader_abi *abi, unsigned max_outputs,
|
|||
handle_es_outputs_post(ctx, &ctx->shader_info->tes.es_info);
|
||||
else
|
||||
handle_vs_outputs_post(ctx, ctx->options->key.tes.export_prim_id,
|
||||
ctx->options->key.tes.export_layer_id,
|
||||
&ctx->shader_info->tes.outinfo);
|
||||
break;
|
||||
default:
|
||||
|
@ -3439,7 +3453,7 @@ ac_gs_copy_shader_emit(struct radv_shader_context *ctx)
|
|||
}
|
||||
idx += slot_inc;
|
||||
}
|
||||
handle_vs_outputs_post(ctx, false, &ctx->shader_info->vs.outinfo);
|
||||
handle_vs_outputs_post(ctx, false, false, &ctx->shader_info->vs.outinfo);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1718,8 +1718,12 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
|
|||
/* TODO: These are no longer used as keys we should refactor this */
|
||||
keys[MESA_SHADER_VERTEX].vs.export_prim_id =
|
||||
pipeline->shaders[MESA_SHADER_FRAGMENT]->info.info.ps.prim_id_input;
|
||||
keys[MESA_SHADER_VERTEX].vs.export_layer_id =
|
||||
pipeline->shaders[MESA_SHADER_FRAGMENT]->info.info.ps.layer_input;
|
||||
keys[MESA_SHADER_TESS_EVAL].tes.export_prim_id =
|
||||
pipeline->shaders[MESA_SHADER_FRAGMENT]->info.info.ps.prim_id_input;
|
||||
keys[MESA_SHADER_TESS_EVAL].tes.export_layer_id =
|
||||
pipeline->shaders[MESA_SHADER_FRAGMENT]->info.info.ps.layer_input;
|
||||
}
|
||||
|
||||
if (device->physical_device->rad_info.chip_class >= GFX9 && modules[MESA_SHADER_TESS_CTRL]) {
|
||||
|
|
|
@ -58,11 +58,13 @@ struct radv_vs_variant_key {
|
|||
uint32_t as_es:1;
|
||||
uint32_t as_ls:1;
|
||||
uint32_t export_prim_id:1;
|
||||
uint32_t export_layer_id:1;
|
||||
};
|
||||
|
||||
struct radv_tes_variant_key {
|
||||
uint32_t as_es:1;
|
||||
uint32_t export_prim_id:1;
|
||||
uint32_t export_layer_id:1;
|
||||
uint8_t num_patches;
|
||||
uint8_t tcs_num_outputs;
|
||||
};
|
||||
|
|
|
@ -90,6 +90,8 @@ gather_intrinsic_info(const nir_shader *nir, const nir_intrinsic_instr *instr,
|
|||
break;
|
||||
case nir_intrinsic_load_view_index:
|
||||
info->needs_multiview_view_index = true;
|
||||
if (nir->info.stage == MESA_SHADER_FRAGMENT)
|
||||
info->ps.layer_input = true;
|
||||
break;
|
||||
case nir_intrinsic_load_invocation_id:
|
||||
info->uses_invocation_id = true;
|
||||
|
|
Loading…
Reference in New Issue