pan/compiler: Remove mediump from collect_varyings
In preparation for future commits, we're builing better alternatives Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Acked-by: Eric R. Smith <eric.smith@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38681>
This commit is contained in:
parent
425458c598
commit
84dcdf87bf
4 changed files with 5 additions and 30 deletions
|
|
@ -7059,7 +7059,7 @@ bifrost_compile_shader_nir(nir_shader *nir,
|
|||
info->tls_size = nir->scratch_size;
|
||||
info->stage = nir->info.stage;
|
||||
|
||||
pan_nir_collect_varyings(nir, info, PAN_MEDIUMP_VARY_32BIT);
|
||||
pan_nir_collect_varyings(nir, info);
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_VERTEX && info->vs.idvs) {
|
||||
/* On 5th Gen, IDVS is only in one binary */
|
||||
|
|
|
|||
|
|
@ -2982,7 +2982,7 @@ midgard_compile_shader_nir(nir_shader *nir,
|
|||
|
||||
/* Collect varyings after lowering I/O */
|
||||
info->quirk_no_auto32 = (ctx->quirks & MIDGARD_NO_AUTO32);
|
||||
pan_nir_collect_varyings(nir, info, PAN_MEDIUMP_VARY_SMOOTH_16BIT);
|
||||
pan_nir_collect_varyings(nir, info);
|
||||
|
||||
/* Optimisation passes */
|
||||
optimise_nir(nir, ctx->quirks, inputs->is_blend);
|
||||
|
|
|
|||
|
|
@ -82,16 +82,6 @@ bool pan_nir_lower_fs_outputs(nir_shader *shader, bool skip_atest);
|
|||
|
||||
uint32_t pan_nir_collect_noperspective_varyings_fs(nir_shader *s);
|
||||
|
||||
/* Specify the mediump lowering behavior for pan_nir_collect_varyings */
|
||||
enum pan_mediump_vary {
|
||||
/* Always assign a 32-bit format to mediump varyings */
|
||||
PAN_MEDIUMP_VARY_32BIT,
|
||||
/* Assign a 16-bit format to varyings with smooth interpolation, and a
|
||||
* 32-bit format to varyings with flat interpolation */
|
||||
PAN_MEDIUMP_VARY_SMOOTH_16BIT,
|
||||
};
|
||||
|
||||
void pan_nir_collect_varyings(nir_shader *s, struct pan_shader_info *info,
|
||||
enum pan_mediump_vary mediump);
|
||||
void pan_nir_collect_varyings(nir_shader *s, struct pan_shader_info *info);
|
||||
|
||||
#endif /* __PAN_NIR_H__ */
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ struct slot_info {
|
|||
};
|
||||
|
||||
struct walk_varyings_data {
|
||||
enum pan_mediump_vary mediump;
|
||||
struct pan_shader_info *info;
|
||||
struct slot_info *slots;
|
||||
};
|
||||
|
|
@ -112,19 +111,6 @@ walk_varyings(UNUSED nir_builder *b, nir_instr *instr, void *data)
|
|||
bool auto32 = !info->quirk_no_auto32 && size == 32;
|
||||
nir_alu_type type = (flat && auto32) ? nir_type_uint : nir_type_float;
|
||||
|
||||
if (sem.medium_precision) {
|
||||
/* Demote interpolated float varyings to fp16 where possible. We do not
|
||||
* demote flat varyings, including integer varyings, due to various
|
||||
* issues with the Midgard hardware behaviour and TGSI shaders, as well
|
||||
* as having no demonstrable benefit in practice.
|
||||
*/
|
||||
if (wv_data->mediump == PAN_MEDIUMP_VARY_SMOOTH_16BIT)
|
||||
size = type == nir_type_float ? 16 : 32;
|
||||
|
||||
if (wv_data->mediump == PAN_MEDIUMP_VARY_32BIT)
|
||||
size = 32;
|
||||
}
|
||||
|
||||
assert(size == 32 || size == 16);
|
||||
type |= size;
|
||||
|
||||
|
|
@ -191,15 +177,14 @@ pan_nir_collect_noperspective_varyings_fs(nir_shader *s)
|
|||
}
|
||||
|
||||
void
|
||||
pan_nir_collect_varyings(nir_shader *s, struct pan_shader_info *info,
|
||||
enum pan_mediump_vary mediump)
|
||||
pan_nir_collect_varyings(nir_shader *s, struct pan_shader_info *info)
|
||||
{
|
||||
if (s->info.stage != MESA_SHADER_VERTEX &&
|
||||
s->info.stage != MESA_SHADER_FRAGMENT)
|
||||
return;
|
||||
|
||||
struct slot_info slots[64] = {0};
|
||||
struct walk_varyings_data wv_data = {mediump, info, slots};
|
||||
struct walk_varyings_data wv_data = {info, slots};
|
||||
nir_shader_instructions_pass(s, walk_varyings, nir_metadata_all, &wv_data);
|
||||
|
||||
struct pan_shader_varying *varyings = (s->info.stage == MESA_SHADER_VERTEX)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue