nak: Plumb more FS info through to the C API
These are needed for state setup, not the shader header so we have to plumb them all the way through to the driver. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
committed by
Marge Bot
parent
0ec283083c
commit
34cc225070
@@ -58,6 +58,14 @@ struct nak_shader_info {
|
||||
uint16_t smem_size;
|
||||
} cs;
|
||||
|
||||
struct {
|
||||
bool writes_depth;
|
||||
bool reads_sample_mask;
|
||||
bool post_depth_coverage;
|
||||
bool uses_sample_shading;
|
||||
bool early_fragment_tests;
|
||||
} fs;
|
||||
|
||||
/* Used to initialize the union for other stages */
|
||||
uint32_t dummy;
|
||||
};
|
||||
|
||||
@@ -509,9 +509,19 @@ pub extern "C" fn nak_compile_shader(
|
||||
},
|
||||
}
|
||||
}
|
||||
_ => nak_shader_info__bindgen_ty_1 {
|
||||
dummy: 0,
|
||||
},
|
||||
ShaderStageInfo::Fragment(fs_info) => {
|
||||
let nir_fs_info = unsafe { &nir.info.__bindgen_anon_1.fs };
|
||||
nak_shader_info__bindgen_ty_1 {
|
||||
fs: nak_shader_info__bindgen_ty_1__bindgen_ty_2 {
|
||||
writes_depth: fs_info.writes_depth,
|
||||
reads_sample_mask: fs_info.reads_sample_mask,
|
||||
post_depth_coverage: nir_fs_info.post_depth_coverage(),
|
||||
uses_sample_shading: nir_fs_info.uses_sample_shading(),
|
||||
early_fragment_tests: nir_fs_info
|
||||
.early_fragment_tests(),
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
hdr: encode_hdr_for_nir(nir, &s.info, fs_key),
|
||||
};
|
||||
|
||||
@@ -1300,6 +1300,12 @@ impl<'a> ShaderFromNir<'a> {
|
||||
self.set_dst(&intrin.def, dst);
|
||||
}
|
||||
nir_intrinsic_load_sample_mask_in => {
|
||||
if let ShaderStageInfo::Fragment(info) = &mut self.info.stage {
|
||||
info.reads_sample_mask = true;
|
||||
} else {
|
||||
panic!("sample_mask_in is only available in fragment shaders");
|
||||
}
|
||||
|
||||
let dst = b.alloc_ssa(RegFile::GPR, 1);
|
||||
b.push_op(OpPixLd {
|
||||
dst: dst.into(),
|
||||
|
||||
@@ -4338,6 +4338,7 @@ pub struct ComputeShaderInfo {
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct FragmentShaderInfo {
|
||||
pub reads_sample_mask: bool,
|
||||
pub writes_color: u32,
|
||||
pub writes_sample_mask: bool,
|
||||
pub writes_depth: bool,
|
||||
|
||||
Reference in New Issue
Block a user