1bf215546Sopenharmony_ci/**********************************************************
2bf215546Sopenharmony_ci * Copyright 2022 VMware, Inc.  All rights reserved.
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person
5bf215546Sopenharmony_ci * obtaining a copy of this software and associated documentation
6bf215546Sopenharmony_ci * files (the "Software"), to deal in the Software without
7bf215546Sopenharmony_ci * restriction, including without limitation the rights to use, copy,
8bf215546Sopenharmony_ci * modify, merge, publish, distribute, sublicense, and/or sell copies
9bf215546Sopenharmony_ci * of the Software, and to permit persons to whom the Software is
10bf215546Sopenharmony_ci * furnished to do so, subject to the following conditions:
11bf215546Sopenharmony_ci *
12bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be
13bf215546Sopenharmony_ci * included in all copies or substantial portions of the Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16bf215546Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18bf215546Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19bf215546Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20bf215546Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21bf215546Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22bf215546Sopenharmony_ci * SOFTWARE.
23bf215546Sopenharmony_ci *
24bf215546Sopenharmony_ci **********************************************************/
25bf215546Sopenharmony_ci
26bf215546Sopenharmony_ci#ifndef SVGA_SHADER_BUFFER_H
27bf215546Sopenharmony_ci#define SVGA_SHADER_BUFFER_H
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_cistruct svga_shader_buffer {
30bf215546Sopenharmony_ci   struct pipe_shader_buffer desc;
31bf215546Sopenharmony_ci   struct pipe_resource *resource;
32bf215546Sopenharmony_ci   unsigned uav_index;
33bf215546Sopenharmony_ci   struct svga_winsys_surface *handle;
34bf215546Sopenharmony_ci};
35bf215546Sopenharmony_ci
36bf215546Sopenharmony_civoid
37bf215546Sopenharmony_cisvga_init_shader_buffer_functions(struct svga_context *svga);
38bf215546Sopenharmony_ci
39bf215546Sopenharmony_civoid
40bf215546Sopenharmony_cisvga_cleanup_shader_buffer_state(struct svga_context *svga);
41bf215546Sopenharmony_ci
42bf215546Sopenharmony_cienum pipe_error
43bf215546Sopenharmony_cisvga_validate_shader_buffer_resources(struct svga_context *svga,
44bf215546Sopenharmony_ci                                      unsigned count,
45bf215546Sopenharmony_ci                                      struct svga_shader_buffer *buffers,
46bf215546Sopenharmony_ci                                      bool rebind);
47bf215546Sopenharmony_ci
48bf215546Sopenharmony_ciSVGA3dUAViewId
49bf215546Sopenharmony_cisvga_create_uav_buffer(struct svga_context *svga,
50bf215546Sopenharmony_ci                       const struct pipe_shader_buffer *buf,
51bf215546Sopenharmony_ci                       SVGA3dSurfaceFormat format,
52bf215546Sopenharmony_ci                       SVGA3dUABufferFlags bufFlag);
53bf215546Sopenharmony_ci
54bf215546Sopenharmony_civoid
55bf215546Sopenharmony_cisvga_uav_cache_purge_buffers(struct svga_context *svga);
56bf215546Sopenharmony_ci
57bf215546Sopenharmony_ci
58bf215546Sopenharmony_ci#endif /* SVGA_SHADER_BUFFER_H */
59