xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/r300/r300_texture.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 2008 Corbin Simpson <[email protected]>
3  * SPDX-License-Identifier: MIT
4  */
5 
6 #ifndef R300_TEXTURE_H
7 #define R300_TEXTURE_H
8 
9 #include "util/compiler.h"
10 #include "util/format/u_formats.h"
11 #include "pipe/p_screen.h"
12 
13 struct pipe_screen;
14 struct pipe_context;
15 struct pipe_resource;
16 struct winsys_handle;
17 struct r300_texture_format_state;
18 struct r300_texture_desc;
19 struct r300_resource;
20 struct r300_screen;
21 
22 unsigned r300_get_swizzle_combined(const unsigned char *swizzle_format,
23                                    const unsigned char *swizzle_view,
24                                    bool dxtc_swizzle);
25 
26 uint32_t r300_translate_texformat(enum pipe_format format,
27                                   const unsigned char *swizzle_view,
28                                   bool is_r500,
29                                   bool dxtc_swizzle);
30 
31 uint32_t r500_tx_format_msb_bit(enum pipe_format format);
32 
33 bool r300_is_colorbuffer_format_supported(enum pipe_format format);
34 
35 bool r300_is_zs_format_supported(enum pipe_format format);
36 
37 bool r300_is_sampler_format_supported(enum pipe_format format);
38 
39 void r300_texture_setup_format_state(struct r300_screen *screen,
40                                      struct r300_resource *tex,
41                                      enum pipe_format format,
42                                      unsigned level,
43                                      unsigned width0_override,
44                                      unsigned height0_override,
45                                      struct r300_texture_format_state *out);
46 
47 bool r300_resource_get_handle(struct pipe_screen* screen,
48                               struct pipe_context *ctx,
49                               struct pipe_resource *texture,
50                               struct winsys_handle *whandle,
51                               unsigned usage);
52 
53 struct pipe_resource*
54 r300_texture_from_handle(struct pipe_screen* screen,
55 			 const struct pipe_resource* base,
56 			 struct winsys_handle *whandle,
57                          unsigned usage);
58 
59 struct pipe_resource*
60 r300_texture_create(struct pipe_screen* screen,
61 		    const struct pipe_resource* templ);
62 
63 struct pipe_surface* r300_create_surface_custom(struct pipe_context * ctx,
64                                          struct pipe_resource* texture,
65                                          const struct pipe_surface *surf_tmpl,
66                                          unsigned width0_override,
67 					 unsigned height0_override);
68 
69 struct pipe_surface* r300_create_surface(struct pipe_context *ctx,
70                                          struct pipe_resource* texture,
71                                          const struct pipe_surface *surf_tmpl);
72 
73 void r300_surface_destroy(struct pipe_context *ctx, struct pipe_surface* s);
74 
75 #endif /* R300_TEXTURE_H */
76