mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-01 11:50:09 +01:00
On asahi, we can still specialize based on the shader key and get everything folded. But this gives drivers the option to make it dynamic if they wish. Co-authored-by: Mary Guillemard <mary.guillemard@collabora.com> Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Reviewed-by: Mary Guillemard <mary@mary.zone> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38404>
38 lines
989 B
C
38 lines
989 B
C
/*
|
|
* Copyright 2023 Valve Corporation
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include "nir_builder.h"
|
|
#include "poly/cl/libpoly.h"
|
|
#include "poly/nir/poly_nir.h"
|
|
|
|
static bool
|
|
lower_sysvals_intr(nir_builder *b, nir_intrinsic_instr *intr, void *data)
|
|
{
|
|
switch (intr->intrinsic) {
|
|
case nir_intrinsic_load_index_size_poly: {
|
|
b->cursor = nir_before_instr(&intr->instr);
|
|
nir_def *vp = nir_load_vertex_param_buffer_poly(b);
|
|
nir_def_replace(&intr->def, poly_index_size(b, vp));
|
|
return true;
|
|
}
|
|
|
|
case nir_intrinsic_load_vs_outputs_poly: {
|
|
b->cursor = nir_before_instr(&intr->instr);
|
|
nir_def *vp = nir_load_vertex_param_buffer_poly(b);
|
|
nir_def_replace(&intr->def, poly_vertex_outputs(b, vp));
|
|
return true;
|
|
}
|
|
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
bool
|
|
poly_nir_lower_sysvals(struct nir_shader *nir)
|
|
{
|
|
return nir_shader_intrinsics_pass(nir, lower_sysvals_intr,
|
|
nir_metadata_control_flow, NULL);
|
|
}
|