xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/freedreno/freedreno_texture.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2012 Rob Clark <[email protected]>
3  * SPDX-License-Identifier: MIT
4  *
5  * Authors:
6  *    Rob Clark <[email protected]>
7  */
8 
9 #ifndef FREEDRENO_TEXTURE_H_
10 #define FREEDRENO_TEXTURE_H_
11 
12 #include "pipe/p_context.h"
13 
14 BEGINC;
15 
16 void fd_sampler_states_bind(struct pipe_context *pctx,
17                             enum pipe_shader_type shader, unsigned start,
18                             unsigned nr, void **hwcso);
19 
20 void fd_set_sampler_views(struct pipe_context *pctx,
21                           enum pipe_shader_type shader, unsigned start,
22                           unsigned nr, unsigned unbind_num_trailing_slots,
23                           bool take_ownership,
24                           struct pipe_sampler_view **views);
25 
26 void fd_texture_init(struct pipe_context *pctx);
27 
28 struct fd_texture_stateobj;
29 
30 /* Both a3xx/a4xx share the same layout for the border-color buffer,
31  * which contains the pre-swizzled (based on texture format) border
32  * color value, with the following layout (per sampler):
33  *
34  *  offset | description
35  *  -------+-------------
36  *  0x00:  | fp16[0]   \
37  *         | fp16[1]   |___ swizzled fp16 channel values for "small float"
38  *         | fp16[2]   |    formats (<= 16 bits per component, !integer)
39  *         | fp16[3]   /
40  *  0x08:  | padding
41  *  0x10:  | int16[0]  \
42  *         | int16[1]  |___ swizzled int16 channels for "small integer"
43  *         | int16[2]  |    formats (<= 16 bits per component, integer)
44  *         | int16[3]  /
45  *  0x18:  | padding
46  *  0x20:  | fp32[0]   \
47  *         | fp32[1]   |___ swizzled fp32 channel values for "large float"
48  *         | fp32[2]   |    formats (> 16 bits per component, !integer)
49  *         | fp32[3]   /
50  *  0x30:  | int32[0]  \
51  *         | int32[1]  |___ swizzled int32 channel values for "large int"
52  *         | int32[2]  |    formats (> 16 bits per component, integer)
53  *         | int32[3]  /
54  */
55 #define BORDERCOLOR_SIZE 0x40
56 void fd_setup_border_colors(struct fd_texture_stateobj *tex, void *ptr,
57                             unsigned offset);
58 
59 ENDC;
60 
61 #endif /* FREEDRENO_TEXTURE_H_ */
62