xref: /aosp_15_r20/external/mesa3d/src/gallium/auxiliary/util/u_simple_shaders.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1  /**************************************************************************
2   *
3   * Copyright 2008 VMware, Inc.
4   * All Rights Reserved.
5   *
6   * Permission is hereby granted, free of charge, to any person obtaining a
7   * copy of this software and associated documentation files (the
8   * "Software"), to deal in the Software without restriction, including
9   * without limitation the rights to use, copy, modify, merge, publish,
10   * distribute, sub license, and/or sell copies of the Software, and to
11   * permit persons to whom the Software is furnished to do so, subject to
12   * the following conditions:
13   *
14   * The above copyright notice and this permission notice (including the
15   * next paragraph) shall be included in all copies or substantial portions
16   * of the Software.
17   *
18   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19   * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21   * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22   * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23   * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24   * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25   *
26   **************************************************************************/
27  
28  
29  #ifndef U_SIMPLE_SHADERS_H
30  #define U_SIMPLE_SHADERS_H
31  
32  
33  #include "util/compiler.h"
34  #include "pipe/p_shader_tokens.h"
35  
36  
37  struct pipe_context;
38  struct pipe_shader_state;
39  struct pipe_stream_output_info;
40  
41  
42  #ifdef __cplusplus
43  extern "C" {
44  #endif
45  
46  
47  extern void *
48  util_make_vertex_passthrough_shader(struct pipe_context *pipe,
49                                      unsigned num_attribs,
50                                      const enum tgsi_semantic *semantic_names,
51                                      const unsigned *semantic_indexes,
52                                      bool window_space);
53  
54  extern void *
55  util_make_vertex_passthrough_shader_with_so(struct pipe_context *pipe,
56                                      unsigned num_attribs,
57                                      const enum tgsi_semantic *semantic_names,
58                                      const unsigned *semantic_indexes,
59                                      bool window_space, bool layered,
60                                      const struct pipe_stream_output_info *so);
61  
62  extern void *
63  util_make_layered_clear_vertex_shader(struct pipe_context *pipe);
64  
65  extern void *
66  util_make_layered_clear_helper_vertex_shader(struct pipe_context *pipe);
67  
68  extern void *
69  util_make_layered_clear_geometry_shader(struct pipe_context *pipe);
70  
71  extern void *
72  util_make_fragment_tex_shader(struct pipe_context *pipe,
73                                enum tgsi_texture_type tex_target,
74                                enum tgsi_return_type stype,
75                                enum tgsi_return_type dtype,
76                                bool load_level_zero,
77                                bool use_txf);
78  
79  extern void *
80  util_make_fs_blit_zs(struct pipe_context *pipe, unsigned zs_mask,
81                       enum tgsi_texture_type tex_target,
82                       bool load_level_zero, bool use_txf);
83  
84  extern void *
85  util_make_fragment_passthrough_shader(struct pipe_context *pipe,
86                                        int input_semantic,
87                                        int input_interpolate,
88                                        bool write_all_cbufs);
89  
90  
91  extern void *
92  util_make_empty_fragment_shader(struct pipe_context *pipe);
93  
94  
95  extern void *
96  util_make_fragment_cloneinput_shader(struct pipe_context *pipe, int num_cbufs,
97                                       int input_semantic,
98                                       int input_interpolate);
99  
100  
101  extern void *
102  util_make_fs_blit_msaa_color(struct pipe_context *pipe,
103                               enum tgsi_texture_type tgsi_tex,
104                               enum tgsi_return_type stype,
105                               enum tgsi_return_type dtype,
106                               bool sample_shading, bool has_txq);
107  
108  
109  extern void *
110  util_make_fs_blit_msaa_depth(struct pipe_context *pipe,
111                               enum tgsi_texture_type tgsi_tex,
112                               bool sample_shading, bool has_txq);
113  
114  
115  extern void *
116  util_make_fs_blit_msaa_depthstencil(struct pipe_context *pipe,
117                                      enum tgsi_texture_type tgsi_tex,
118                                      bool sample_shading, bool has_txq);
119  
120  
121  void *
122  util_make_fs_blit_msaa_stencil(struct pipe_context *pipe,
123                                 enum tgsi_texture_type tgsi_tex,
124                                 bool sample_shading, bool has_txq);
125  
126  
127  void *
128  util_make_fs_msaa_resolve(struct pipe_context *pipe,
129                            enum tgsi_texture_type tgsi_tex, unsigned nr_samples,
130                            bool has_txq);
131  
132  
133  void *
134  util_make_fs_msaa_resolve_bilinear(struct pipe_context *pipe,
135                                     enum tgsi_texture_type tgsi_tex,
136                                     unsigned nr_samples, bool has_txq);
137  
138  extern void *
139  util_make_geometry_passthrough_shader(struct pipe_context *pipe,
140                                        unsigned num_attribs,
141                                        const uint8_t *semantic_names,
142                                        const uint8_t *semantic_indexes);
143  
144  void *
145  util_make_fs_pack_color_zs(struct pipe_context *pipe,
146                             enum tgsi_texture_type tex_target,
147                             enum pipe_format zs_format,
148                             bool dst_is_color);
149  
150  extern void *
151  util_make_tess_ctrl_passthrough_shader(struct pipe_context *pipe,
152                                         unsigned num_vs_outputs,
153                                         unsigned num_tes_inputs,
154                                         const uint8_t *vs_semantic_names,
155                                         const uint8_t *vs_semantic_indexes,
156                                         const uint8_t *tes_semantic_names,
157                                         const uint8_t *tes_semantic_indexes,
158                                         const unsigned vertices_per_patch);
159  
160  void *
161  util_make_fs_stencil_blit(struct pipe_context *pipe, bool msaa_src, bool has_txq);
162  
163  void *
164  util_make_fs_clear_all_cbufs(struct pipe_context *pipe);
165  
166  #ifdef __cplusplus
167  }
168  #endif
169  
170  
171  #endif
172