mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
nak,nvk: Plumb through tessellation info
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
parent
bd90031b5b
commit
b5cb508523
4 changed files with 71 additions and 0 deletions
|
|
@ -54,12 +54,14 @@ nak_bindings_rs = rust.bindgen(
|
|||
'--allowlist-type', 'gl_interp_mode',
|
||||
'--allowlist-type', 'gl_shader_stage',
|
||||
'--allowlist-type', 'gl_system_value',
|
||||
'--allowlist-type', 'gl_tess_spacing',
|
||||
'--allowlist-type', 'gl_varying_slot',
|
||||
'--allowlist-type', 'gl_vert_attrib',
|
||||
'--allowlist-type', 'nak_.*',
|
||||
'--allowlist-type', 'nir_.*',
|
||||
'--allowlist-type', 'mesa_scope',
|
||||
'--allowlist-type', 'mesa_prim',
|
||||
'--allowlist-type', 'tess_primitive_mode',
|
||||
'--allowlist-var', 'nir_.*_infos',
|
||||
'--allowlist-function', '_mesa_shader_stage_to_string',
|
||||
'--allowlist-function', 'nak_.*',
|
||||
|
|
|
|||
|
|
@ -44,6 +44,25 @@ struct nak_fs_key {
|
|||
void nak_postprocess_nir(nir_shader *nir, const struct nak_compiler *nak,
|
||||
const struct nak_fs_key *fs_key);
|
||||
|
||||
enum PACKED nak_ts_domain {
|
||||
NAK_TS_DOMAIN_ISOLINE = 0,
|
||||
NAK_TS_DOMAIN_TRIANGLE = 1,
|
||||
NAK_TS_DOMAIN_QUAD = 2,
|
||||
};
|
||||
|
||||
enum PACKED nak_ts_spacing {
|
||||
NAK_TS_SPACING_INTEGER = 0,
|
||||
NAK_TS_SPACING_FRACT_ODD = 1,
|
||||
NAK_TS_SPACING_FRACT_EVEN = 2,
|
||||
};
|
||||
|
||||
enum PACKED nak_ts_prims {
|
||||
NAK_TS_PRIMS_POINTS = 0,
|
||||
NAK_TS_PRIMS_LINES = 1,
|
||||
NAK_TS_PRIMS_TRIANGLES_CW = 2,
|
||||
NAK_TS_PRIMS_TRIANGLES_CCW = 3,
|
||||
};
|
||||
|
||||
struct nvk_xfb_info {
|
||||
uint32_t stride[4];
|
||||
uint8_t stream[4];
|
||||
|
|
@ -80,6 +99,12 @@ struct nak_shader_info {
|
|||
bool early_fragment_tests;
|
||||
} fs;
|
||||
|
||||
struct {
|
||||
enum nak_ts_domain domain;
|
||||
enum nak_ts_spacing spacing;
|
||||
enum nak_ts_prims prims;
|
||||
} ts;
|
||||
|
||||
/* Used to initialize the union for other stages */
|
||||
uint32_t dummy;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -309,6 +309,42 @@ pub extern "C" fn nak_compile_shader(
|
|||
},
|
||||
}
|
||||
}
|
||||
ShaderStageInfo::Tessellation => {
|
||||
let nir_ts_info = unsafe { &nir.info.__bindgen_anon_1.tess };
|
||||
nak_shader_info__bindgen_ty_1 {
|
||||
ts: nak_shader_info__bindgen_ty_1__bindgen_ty_3 {
|
||||
domain: match nir_ts_info._primitive_mode {
|
||||
TESS_PRIMITIVE_TRIANGLES => NAK_TS_DOMAIN_TRIANGLE,
|
||||
TESS_PRIMITIVE_QUADS => NAK_TS_DOMAIN_QUAD,
|
||||
TESS_PRIMITIVE_ISOLINES => NAK_TS_DOMAIN_ISOLINE,
|
||||
_ => panic!("Invalid tess_primitive_mode"),
|
||||
},
|
||||
|
||||
spacing: match nir_ts_info.spacing() {
|
||||
TESS_SPACING_EQUAL => NAK_TS_SPACING_INTEGER,
|
||||
TESS_SPACING_FRACTIONAL_ODD => {
|
||||
NAK_TS_SPACING_FRACT_ODD
|
||||
}
|
||||
TESS_SPACING_FRACTIONAL_EVEN => {
|
||||
NAK_TS_SPACING_FRACT_EVEN
|
||||
}
|
||||
_ => panic!("Invalid gl_tess_spacing"),
|
||||
},
|
||||
|
||||
prims: if nir_ts_info.point_mode() {
|
||||
NAK_TS_PRIMS_POINTS
|
||||
} else if nir_ts_info._primitive_mode
|
||||
== TESS_PRIMITIVE_ISOLINES
|
||||
{
|
||||
NAK_TS_PRIMS_LINES
|
||||
} else if nir_ts_info.ccw() {
|
||||
NAK_TS_PRIMS_TRIANGLES_CCW
|
||||
} else {
|
||||
NAK_TS_PRIMS_TRIANGLES_CW
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
_ => nak_shader_info__bindgen_ty_1 { dummy: 0 },
|
||||
},
|
||||
clip_enable: match &s.info.stage {
|
||||
|
|
|
|||
|
|
@ -1267,6 +1267,14 @@ nvk_compile_nir_with_nak(struct nvk_physical_device *pdev,
|
|||
shader->vs.clip_enable = bin->info.clip_enable;
|
||||
shader->vs.cull_enable = bin->info.cull_enable;
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_TESS_EVAL) {
|
||||
shader->tp.domain_type = bin->info.ts.domain;
|
||||
shader->tp.spacing = bin->info.ts.spacing;
|
||||
shader->tp.output_prims = bin->info.ts.prims;
|
||||
} else {
|
||||
shader->tp.domain_type = ~0;
|
||||
}
|
||||
|
||||
bool has_xfb = false;
|
||||
for (unsigned b = 0; b < 4; b++) {
|
||||
if (bin->info.xfb.attr_count[b] > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue