diff --git a/src/asahi/compiler/agx_nir_opt_preamble.c b/src/asahi/compiler/agx_nir_opt_preamble.c index 7fc70a62063..a81fa85810d 100644 --- a/src/asahi/compiler/agx_nir_opt_preamble.c +++ b/src/asahi/compiler/agx_nir_opt_preamble.c @@ -229,7 +229,6 @@ instr_cost(nir_instr *instr, const void *data) case nir_intrinsic_load_global_constant: case nir_intrinsic_load_constant_agx: case nir_intrinsic_load_ubo: - case nir_intrinsic_bindless_image_agx: return 10.0; case nir_intrinsic_ddx: case nir_intrinsic_ddx_fine: @@ -238,6 +237,12 @@ instr_cost(nir_instr *instr, const void *data) case nir_intrinsic_ddy_fine: case nir_intrinsic_ddy_coarse: return 1.0; + case nir_intrinsic_bindless_image_agx: + /* It's worth promoting even with a constant source, but it doesn't + * turn into instructions so should be less than any other normal + * instruction... But just enough to get over the image rewrite_cost. + */ + return 2.5; default: /* Assume it's a sysval or something */ return 0.0; diff --git a/src/asahi/vulkan/hk_cmd_dispatch.c b/src/asahi/vulkan/hk_cmd_dispatch.c index 99096d4aa7f..ee8d4ee2124 100644 --- a/src/asahi/vulkan/hk_cmd_dispatch.c +++ b/src/asahi/vulkan/hk_cmd_dispatch.c @@ -75,7 +75,7 @@ hk_dispatch_with_usc(struct hk_device *dev, struct hk_cs *cs, { struct agx_cdm_launch_word_0_packed launch; agx_pack(&launch, CDM_LAUNCH_WORD_0, cfg) { - cfg.texture_state_register_count = 0; + cfg.texture_state_register_count = info->texture_state_count; cfg.sampler_state_register_count = 1; cfg.uniform_register_count = info->push_count; cfg.preshader_register_count = info->nr_preamble_gprs; diff --git a/src/asahi/vulkan/hk_shader.c b/src/asahi/vulkan/hk_shader.c index 0ac77147f70..4237c5b0e51 100644 --- a/src/asahi/vulkan/hk_shader.c +++ b/src/asahi/vulkan/hk_shader.c @@ -916,7 +916,7 @@ hk_upload_shader(struct hk_device *dev, struct hk_shader *shader) cfg.preshader_register_count = shader->b.info.nr_preamble_gprs; cfg.sampler_state_register_count = agx_translate_sampler_state_count( shader->b.info.uses_txf ? 1 : 0, false); - cfg.texture_state_register_count = 0; + cfg.texture_state_register_count = shader->b.info.texture_state_count; } } @@ -1121,6 +1121,7 @@ hk_compile_nir(struct hk_device *dev, const VkAllocationCallbacks *pAllocator, .no_stop = nir->info.stage == MESA_SHADER_FRAGMENT, .has_scratch = !nir->info.internal, .promote_constants = true, + .promote_textures = true, }; /* For now, sample shading is always dynamic. Indicate that. */ @@ -1671,7 +1672,7 @@ hk_fast_link(struct hk_device *dev, bool fragment, struct hk_shader *main, cfg.cf_binding_count = s->b.cf.nr_bindings; cfg.uniform_register_count = main->b.info.push_count; cfg.preshader_register_count = main->b.info.nr_preamble_gprs; - cfg.texture_state_register_count = 0; + cfg.texture_state_register_count = main->b.info.texture_state_count; cfg.sampler_state_register_count = agx_translate_sampler_state_count(s->b.uses_txf ? 1 : 0, false); }