etnaviv: Extend shader structs with etna_core_info

Prep step to drop halti from etna_specs.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30394>
This commit is contained in:
Christian Gmeiner 2024-07-30 17:19:03 +02:00 committed by Marge Bot
parent 6d673a3ac7
commit 6e0a28db2e
6 changed files with 12 additions and 6 deletions

View file

@ -241,7 +241,7 @@ static hw_src
const_src(struct etna_compile *c, nir_const_value *value, unsigned num_components)
{
/* use inline immediates if possible */
if (c->specs->halti >= 2 && num_components == 1 &&
if (c->info->halti >= 2 && num_components == 1 &&
value[0].u64 >> 32 == ETNA_UNIFORM_CONSTANT) {
uint32_t bits = value[0].u32;
@ -966,7 +966,7 @@ emit_shader(struct etna_compile *c, unsigned *num_temps, unsigned *num_consts)
unsigned base = nir_intrinsic_base(intr);
/* pre halti2 uniform offset will be float */
if (c->specs->halti < 2)
if (c->info->halti < 2)
base += (unsigned) off[0].f32;
else
base += off[0].u32;
@ -1113,6 +1113,7 @@ etna_compile_shader(struct etna_shader_variant *v)
return false;
c->variant = v;
c->info = v->shader->info;
c->specs = v->shader->specs;
c->nir = nir_shader_clone(NULL, v->shader->nir);
@ -1173,7 +1174,7 @@ etna_compile_shader(struct etna_shader_variant *v)
NIR_PASS_V(s, etna_nir_lower_texture, &v->key);
NIR_PASS_V(s, nir_lower_alu_to_scalar, etna_alu_to_scalar_filter_cb, specs);
if (c->specs->halti >= 2) {
if (c->info->halti >= 2) {
nir_lower_idiv_options idiv_options = {
.allow_fp16 = true,
};
@ -1195,7 +1196,7 @@ etna_compile_shader(struct etna_shader_variant *v)
NIR_PASS_V(s, nir_lower_clip_halfz);
/* lower pre-halti2 to float (halti0 has integers, but only scalar..) */
if (c->specs->halti < 2) {
if (c->info->halti < 2) {
/* use opt_algebraic between int_to_float and boot_to_float because
* int_to_float emits ftrunc, and ftrunc lowering generates bool ops
*/

View file

@ -28,6 +28,7 @@
#define H_ETNAVIV_COMPILER_NIR
#include "compiler/nir/nir.h"
#include "etna_core_info.h"
#include "etnaviv_asm.h"
#include "etnaviv_compiler.h"
#include "util/compiler.h"
@ -38,6 +39,7 @@ struct etna_compile {
nir_shader *nir;
nir_function_impl *impl;
#define is_fs(c) ((c)->nir->info.stage == MESA_SHADER_FRAGMENT)
const struct etna_core_info *info;
const struct etna_specs *specs;
struct etna_shader_variant *variant;

View file

@ -254,7 +254,7 @@ etna_emit_discard(struct etna_compile *c, struct etna_inst_src condition)
struct etna_inst inst = {
.opcode = ISA_OPC_TEXKILL,
.cond = ISA_COND_NZ,
.type = (c->specs->halti < 2) ? ISA_TYPE_F32 : ISA_TYPE_U32,
.type = (c->info->halti < 2) ? ISA_TYPE_F32 : ISA_TYPE_U32,
.src[0] = condition,
};
inst.src[0].swiz = INST_SWIZ_BROADCAST(inst.src[0].swiz & 3);

View file

@ -119,7 +119,7 @@ etna_lower_io(nir_shader *shader, struct etna_shader_variant *v)
/* pre HALTI5 needs texture sources in a single source */
if (!src1 || v->shader->specs->halti >= 5)
if (!src1 || v->shader->info->halti >= 5)
continue;
assert(coord && src1 && tex->coord_components < 4);

View file

@ -489,6 +489,7 @@ etna_create_shader_state(struct pipe_context *pctx,
return NULL;
shader->id = p_atomic_inc_return(&compiler->shader_count);
shader->info = screen->info;
shader->specs = &screen->specs;
shader->compiler = screen->compiler;
util_queue_fence_init(&shader->ready);

View file

@ -28,6 +28,7 @@
#define H_ETNAVIV_SHADER
#include "mesa/main/config.h"
#include "etna_core_info.h"
#include "nir.h"
#include "pipe/p_state.h"
#include "util/disk_cache.h"
@ -80,6 +81,7 @@ struct etna_shader {
uint32_t variant_count;
struct nir_shader *nir;
const struct etna_core_info *info;
const struct etna_specs *specs;
struct etna_compiler *compiler;