nak: Add a writes_layer bit to nak_shader_info::vtg

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26197>
This commit is contained in:
Faith Ekstrand 2023-11-14 16:40:52 -06:00 committed by Marge Bot
parent a232050204
commit d8551cd328
2 changed files with 4 additions and 0 deletions

View file

@ -110,6 +110,7 @@ struct nak_shader_info {
};
struct {
bool writes_layer;
uint8_t clip_enable;
uint8_t cull_enable;

View file

@ -355,11 +355,14 @@ pub extern "C" fn nak_compile_shader(
ShaderStageInfo::Geometry(_)
| ShaderStageInfo::Tessellation
| ShaderStageInfo::Vertex => {
let writes_layer =
nir.info.outputs_written & (1 << VARYING_SLOT_LAYER) != 0;
let num_clip = nir.info.clip_distance_array_size();
let num_cull = nir.info.cull_distance_array_size();
let clip_enable = (1_u32 << num_clip) - 1;
let cull_enable = ((1_u32 << num_cull) - 1) << num_clip;
nak_shader_info__bindgen_ty_2 {
writes_layer: writes_layer,
clip_enable: clip_enable.try_into().unwrap(),
cull_enable: cull_enable.try_into().unwrap(),
xfb: unsafe { nak_xfb_from_nir(nir.xfb_info) },