xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/freedreno/a2xx/fd2_program.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2012-2013 Rob Clark <[email protected]>
3  * SPDX-License-Identifier: MIT
4  *
5  * Authors:
6  *    Rob Clark <[email protected]>
7  */
8 
9 #ifndef FD2_PROGRAM_H_
10 #define FD2_PROGRAM_H_
11 
12 #include "pipe/p_context.h"
13 
14 #include "freedreno_context.h"
15 
16 #include "disasm.h"
17 #include "ir2.h"
18 
19 struct fd2_shader_stateobj {
20    nir_shader *nir;
21    gl_shader_stage type;
22    bool is_a20x;
23 
24    /* note: using same set of immediates for all variants
25     * it doesn't matter, other than the slightly larger command stream
26     */
27    unsigned first_immediate; /* const reg # of first immediate */
28    unsigned num_immediates;
29    struct {
30       uint32_t val[4];
31       unsigned ncomp;
32    } immediates[64];
33 
34    bool writes_psize;
35    bool need_param;
36    bool has_kill;
37 
38    /* note:
39     * fragment shader only has one variant
40     * first vertex shader variant is always binning shader
41     * we should use a dynamic array but in normal case there is
42     * only 2 variants (and 3 sometimes with GALLIUM_HUD)
43     */
44    struct ir2_shader_variant variant[8];
45 };
46 
47 void fd2_program_emit(struct fd_context *ctx, struct fd_ringbuffer *ring,
48                       struct fd_program_stateobj *prog) assert_dt;
49 
50 void fd2_prog_init(struct pipe_context *pctx);
51 
52 #endif /* FD2_PROGRAM_H_ */
53