xref: /aosp_15_r20/external/mesa3d/src/asahi/lib/agx_nir_passes.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 2024 Alyssa Rosenzweig
3  * SPDX-License-Identifier: MIT
4  */
5 
6 #pragma once
7 
8 #include <stdbool.h>
9 #include <stdint.h>
10 #include "agx_pack.h"
11 #include "shader_enums.h"
12 
13 struct nir_shader;
14 struct nir_instr;
15 
16 /* Texture backend flags */
17 #define AGX_TEXTURE_FLAG_NO_CLAMP (1 << 0)
18 
19 /* Indicates that the sampler should be overriden to clamp to 0 instead of 1 */
20 #define AGX_TEXTURE_FLAG_CLAMP_TO_0 (1 << 1)
21 
22 /* Texel buffers lowered to (at most) 16384x16384 2D textures */
23 #define AGX_TEXTURE_BUFFER_WIDTH      16384
24 #define AGX_TEXTURE_BUFFER_MAX_HEIGHT 16384
25 #define AGX_TEXTURE_BUFFER_MAX_SIZE                                            \
26    (AGX_TEXTURE_BUFFER_WIDTH * AGX_TEXTURE_BUFFER_MAX_HEIGHT)
27 
28 bool agx_nir_lower_texture_early(struct nir_shader *s, bool support_lod_bias);
29 bool agx_nir_lower_texture(struct nir_shader *s);
30 bool agx_nir_lower_multisampled_image_store(struct nir_shader *s);
31 bool agx_nir_needs_texture_crawl(struct nir_instr *instr);
32