xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/freedreno/a4xx/fd4_context.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2014 Rob Clark <[email protected]>
3  * SPDX-License-Identifier: MIT
4  *
5  * Authors:
6  *    Rob Clark <[email protected]>
7  */
8 
9 #ifndef FD4_CONTEXT_H_
10 #define FD4_CONTEXT_H_
11 
12 #include "util/u_upload_mgr.h"
13 
14 #include "freedreno_context.h"
15 
16 #include "ir3/ir3_shader.h"
17 
18 struct fd4_context {
19    struct fd_context base;
20 
21    struct fd_bo *vs_pvt_mem, *fs_pvt_mem;
22 
23    /* This only needs to be 4 * num_of_pipes bytes (ie. 32 bytes).  We
24     * could combine it with another allocation.
25     *
26     * (upper area used as scratch bo.. see fd4_query)
27     */
28    struct fd_bo *vsc_size_mem;
29 
30    struct u_upload_mgr *border_color_uploader;
31    struct pipe_resource *border_color_buf;
32 
33    /* bitmask of samplers which need astc srgb workaround: */
34    uint16_t vastc_srgb, fastc_srgb, castc_srgb;
35 
36    /* samplers swizzles, needed for tg4 workaround: */
37    uint16_t vsampler_swizzles[16], fsampler_swizzles[16], csampler_swizzles[16];
38 
39    /* storage for ctx->last.key: */
40    struct ir3_shader_key last_key;
41 };
42 
43 static inline struct fd4_context *
fd4_context(struct fd_context * ctx)44 fd4_context(struct fd_context *ctx)
45 {
46    return (struct fd4_context *)ctx;
47 }
48 
49 struct pipe_context *fd4_context_create(struct pipe_screen *pscreen, void *priv,
50                                         unsigned flags);
51 
52 #endif /* FD4_CONTEXT_H_ */
53