nir: unvendor lod_bias(_agx)
this will be useful for other backends. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34507>
This commit is contained in:
committed by
Marge Bot
parent
09896ee79e
commit
2e15b42eec
@@ -367,7 +367,7 @@ lower_regular_texture(nir_builder *b, nir_instr *instr, UNUSED void *data)
|
||||
static nir_def *
|
||||
bias_for_tex(nir_builder *b, nir_tex_instr *tex)
|
||||
{
|
||||
return nir_build_texture_query(b, tex, nir_texop_lod_bias_agx, 1,
|
||||
return nir_build_texture_query(b, tex, nir_texop_lod_bias, 1,
|
||||
nir_type_float16, false, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -598,7 +598,7 @@ lower_tex(nir_builder *b, nir_tex_instr *tex,
|
||||
* the sampler descriptor. There's no spot in the hardware descriptor,
|
||||
* plus this saves on precious sampler heap spots.
|
||||
*/
|
||||
if (tex->op == nir_texop_lod_bias_agx) {
|
||||
if (tex->op == nir_texop_lod_bias) {
|
||||
unsigned offs =
|
||||
offsetof(struct hk_sampled_image_descriptor, lod_bias_fp16);
|
||||
|
||||
|
||||
@@ -710,7 +710,7 @@ hk_lower_nir(struct hk_device *dev, nir_shader *nir,
|
||||
NIR_PASS(_, nir, nir_lower_robust_access, should_lower_robust, NULL);
|
||||
|
||||
/* We must do early lowering before hk_nir_lower_descriptors, since this will
|
||||
* create lod_bias_agx instructions.
|
||||
* create lod_bias instructions.
|
||||
*/
|
||||
NIR_PASS(_, nir, agx_nir_lower_texture_early, true /* support_lod_bias */);
|
||||
|
||||
|
||||
@@ -3206,8 +3206,8 @@ nir_tex_instr_result_size(const nir_tex_instr *instr)
|
||||
case nir_texop_texture_samples:
|
||||
case nir_texop_query_levels:
|
||||
case nir_texop_samples_identical:
|
||||
case nir_texop_lod_bias:
|
||||
case nir_texop_fragment_mask_fetch_amd:
|
||||
case nir_texop_lod_bias_agx:
|
||||
case nir_texop_image_min_lod_agx:
|
||||
case nir_texop_has_custom_border_color_agx:
|
||||
return 1;
|
||||
@@ -3241,9 +3241,9 @@ nir_tex_instr_is_query(const nir_tex_instr *instr)
|
||||
case nir_texop_lod:
|
||||
case nir_texop_texture_samples:
|
||||
case nir_texop_query_levels:
|
||||
case nir_texop_lod_bias:
|
||||
case nir_texop_descriptor_amd:
|
||||
case nir_texop_sampler_descriptor_amd:
|
||||
case nir_texop_lod_bias_agx:
|
||||
case nir_texop_image_min_lod_agx:
|
||||
case nir_texop_custom_border_color_agx:
|
||||
case nir_texop_has_custom_border_color_agx:
|
||||
|
||||
@@ -2309,6 +2309,8 @@ typedef enum nir_texop {
|
||||
nir_texop_samples_identical,
|
||||
/** Regular texture look-up, eligible for pre-dispatch */
|
||||
nir_texop_tex_prefetch,
|
||||
/** Returns the sampler's LOD bias (if sampler LOD bias is lowered) */
|
||||
nir_texop_lod_bias,
|
||||
/** Multisample fragment color texture fetch */
|
||||
nir_texop_fragment_fetch_amd,
|
||||
/** Multisample fragment mask texture fetch */
|
||||
@@ -2317,8 +2319,6 @@ typedef enum nir_texop {
|
||||
nir_texop_descriptor_amd,
|
||||
/** Returns a sampler descriptor. */
|
||||
nir_texop_sampler_descriptor_amd,
|
||||
/** Returns the sampler's LOD bias */
|
||||
nir_texop_lod_bias_agx,
|
||||
/** Returns the image view's min LOD */
|
||||
nir_texop_image_min_lod_agx,
|
||||
/** Returns a bool indicating that the sampler uses a custom border colour */
|
||||
|
||||
@@ -1759,6 +1759,9 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
|
||||
case nir_texop_tex_prefetch:
|
||||
fprintf(fp, "tex (pre-dispatchable) ");
|
||||
break;
|
||||
case nir_texop_lod_bias:
|
||||
fprintf(fp, "lod_bias ");
|
||||
break;
|
||||
case nir_texop_fragment_fetch_amd:
|
||||
fprintf(fp, "fragment_fetch_amd ");
|
||||
break;
|
||||
@@ -1771,9 +1774,6 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
|
||||
case nir_texop_sampler_descriptor_amd:
|
||||
fprintf(fp, "sampler_descriptor_amd ");
|
||||
break;
|
||||
case nir_texop_lod_bias_agx:
|
||||
fprintf(fp, "lod_bias_agx ");
|
||||
break;
|
||||
case nir_texop_image_min_lod_agx:
|
||||
fprintf(fp, "image_min_lod_agx ");
|
||||
break;
|
||||
|
||||
@@ -825,7 +825,7 @@ validate_tex_src_texture_deref(nir_tex_instr *instr, validate_state *state,
|
||||
case nir_texop_custom_border_color_agx:
|
||||
break;
|
||||
case nir_texop_lod:
|
||||
case nir_texop_lod_bias_agx:
|
||||
case nir_texop_lod_bias:
|
||||
validate_assert(state, nir_alu_type_get_base_type(instr->dest_type) == nir_type_float);
|
||||
break;
|
||||
case nir_texop_image_min_lod_agx:
|
||||
|
||||
@@ -3382,11 +3382,13 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
|
||||
case nir_texop_tex_prefetch:
|
||||
vtn_fail("unexpected nir_texop_tex_prefetch");
|
||||
break;
|
||||
case nir_texop_lod_bias:
|
||||
vtn_fail("unexpected nir_texop_lod_bias");
|
||||
break;
|
||||
case nir_texop_descriptor_amd:
|
||||
case nir_texop_sampler_descriptor_amd:
|
||||
vtn_fail("unexpected nir_texop_*descriptor_amd");
|
||||
break;
|
||||
case nir_texop_lod_bias_agx:
|
||||
case nir_texop_image_min_lod_agx:
|
||||
case nir_texop_custom_border_color_agx:
|
||||
case nir_texop_has_custom_border_color_agx:
|
||||
|
||||
@@ -253,7 +253,7 @@ lower_sysvals(nir_builder *b, nir_instr *instr, void *data)
|
||||
nir_tex_instr *tex = nir_instr_as_tex(instr);
|
||||
old = &tex->def;
|
||||
|
||||
if (tex->op != nir_texop_lod_bias_agx)
|
||||
if (tex->op != nir_texop_lod_bias)
|
||||
return false;
|
||||
|
||||
struct agx_stage_uniforms *s = NULL;
|
||||
|
||||
Reference in New Issue
Block a user