1848b8605Smrg/**************************************************************************
2848b8605Smrg *
3848b8605Smrg * Copyright 2007 VMware, Inc.
4848b8605Smrg * All Rights Reserved.
5848b8605Smrg *
6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a
7848b8605Smrg * copy of this software and associated documentation files (the
8848b8605Smrg * "Software"), to deal in the Software without restriction, including
9848b8605Smrg * without limitation the rights to use, copy, modify, merge, publish,
10848b8605Smrg * distribute, sub license, and/or sell copies of the Software, and to
11848b8605Smrg * permit persons to whom the Software is furnished to do so, subject to
12848b8605Smrg * the following conditions:
13848b8605Smrg *
14848b8605Smrg * The above copyright notice and this permission notice (including the
15848b8605Smrg * next paragraph) shall be included in all copies or substantial portions
16848b8605Smrg * of the Software.
17848b8605Smrg *
18848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21848b8605Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22848b8605Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23848b8605Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24848b8605Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25848b8605Smrg *
26848b8605Smrg **************************************************************************/
27848b8605Smrg
28848b8605Smrg#ifndef PIPE_CONTEXT_H
29848b8605Smrg#define PIPE_CONTEXT_H
30848b8605Smrg
31848b8605Smrg#include "p_compiler.h"
32848b8605Smrg#include "p_format.h"
33848b8605Smrg#include "p_video_enums.h"
34848b8605Smrg#include "p_defines.h"
35b8e80941Smrg#include <stdio.h>
36848b8605Smrg
37848b8605Smrg#ifdef __cplusplus
38848b8605Smrgextern "C" {
39848b8605Smrg#endif
40848b8605Smrg
41848b8605Smrg
42848b8605Smrgstruct pipe_blend_color;
43848b8605Smrgstruct pipe_blend_state;
44848b8605Smrgstruct pipe_blit_info;
45848b8605Smrgstruct pipe_box;
46848b8605Smrgstruct pipe_clip_state;
47848b8605Smrgstruct pipe_constant_buffer;
48b8e80941Smrgstruct pipe_debug_callback;
49848b8605Smrgstruct pipe_depth_stencil_alpha_state;
50b8e80941Smrgstruct pipe_device_reset_callback;
51848b8605Smrgstruct pipe_draw_info;
52b8e80941Smrgstruct pipe_grid_info;
53848b8605Smrgstruct pipe_fence_handle;
54848b8605Smrgstruct pipe_framebuffer_state;
55b8e80941Smrgstruct pipe_image_view;
56848b8605Smrgstruct pipe_query;
57848b8605Smrgstruct pipe_poly_stipple;
58848b8605Smrgstruct pipe_rasterizer_state;
59848b8605Smrgstruct pipe_resolve_info;
60848b8605Smrgstruct pipe_resource;
61848b8605Smrgstruct pipe_sampler_state;
62848b8605Smrgstruct pipe_sampler_view;
63848b8605Smrgstruct pipe_scissor_state;
64b8e80941Smrgstruct pipe_shader_buffer;
65848b8605Smrgstruct pipe_shader_state;
66848b8605Smrgstruct pipe_stencil_ref;
67848b8605Smrgstruct pipe_stream_output_target;
68848b8605Smrgstruct pipe_surface;
69848b8605Smrgstruct pipe_transfer;
70848b8605Smrgstruct pipe_vertex_buffer;
71848b8605Smrgstruct pipe_vertex_element;
72848b8605Smrgstruct pipe_video_buffer;
73848b8605Smrgstruct pipe_video_codec;
74848b8605Smrgstruct pipe_viewport_state;
75848b8605Smrgstruct pipe_compute_state;
76848b8605Smrgunion pipe_color_union;
77848b8605Smrgunion pipe_query_result;
78b8e80941Smrgstruct u_log_context;
79b8e80941Smrgstruct u_upload_mgr;
80848b8605Smrg
81848b8605Smrg/**
82848b8605Smrg * Gallium rendering context.  Basically:
83848b8605Smrg *  - state setting functions
84848b8605Smrg *  - VBO drawing functions
85848b8605Smrg *  - surface functions
86848b8605Smrg */
87848b8605Smrgstruct pipe_context {
88848b8605Smrg   struct pipe_screen *screen;
89848b8605Smrg
90848b8605Smrg   void *priv;  /**< context private data (for DRI for example) */
91848b8605Smrg   void *draw;  /**< private, for draw module (temporary?) */
92848b8605Smrg
93b8e80941Smrg   /**
94b8e80941Smrg    * Stream uploaders created by the driver. All drivers, state trackers, and
95b8e80941Smrg    * modules should use them.
96b8e80941Smrg    *
97b8e80941Smrg    * Use u_upload_alloc or u_upload_data as many times as you want.
98b8e80941Smrg    * Once you are done, use u_upload_unmap.
99b8e80941Smrg    */
100b8e80941Smrg   struct u_upload_mgr *stream_uploader; /* everything but shader constants */
101b8e80941Smrg   struct u_upload_mgr *const_uploader;  /* shader constants only */
102b8e80941Smrg
103848b8605Smrg   void (*destroy)( struct pipe_context * );
104848b8605Smrg
105848b8605Smrg   /**
106848b8605Smrg    * VBO drawing
107848b8605Smrg    */
108848b8605Smrg   /*@{*/
109848b8605Smrg   void (*draw_vbo)( struct pipe_context *pipe,
110848b8605Smrg                     const struct pipe_draw_info *info );
111848b8605Smrg   /*@}*/
112848b8605Smrg
113848b8605Smrg   /**
114848b8605Smrg    * Predicate subsequent rendering on occlusion query result
115848b8605Smrg    * \param query  the query predicate, or NULL if no predicate
116848b8605Smrg    * \param condition whether to skip on FALSE or TRUE query results
117848b8605Smrg    * \param mode  one of PIPE_RENDER_COND_x
118848b8605Smrg    */
119848b8605Smrg   void (*render_condition)( struct pipe_context *pipe,
120848b8605Smrg                             struct pipe_query *query,
121848b8605Smrg                             boolean condition,
122b8e80941Smrg                             enum pipe_render_cond_flag mode );
123848b8605Smrg
124848b8605Smrg   /**
125848b8605Smrg    * Query objects
126848b8605Smrg    */
127848b8605Smrg   /*@{*/
128848b8605Smrg   struct pipe_query *(*create_query)( struct pipe_context *pipe,
129848b8605Smrg                                       unsigned query_type,
130848b8605Smrg                                       unsigned index );
131848b8605Smrg
132b8e80941Smrg   /**
133b8e80941Smrg    * Create a query object that queries all given query types simultaneously.
134b8e80941Smrg    *
135b8e80941Smrg    * This can only be used for those query types for which
136b8e80941Smrg    * get_driver_query_info indicates that it must be used. Only one batch
137b8e80941Smrg    * query object may be active at a time.
138b8e80941Smrg    *
139b8e80941Smrg    * There may be additional constraints on which query types can be used
140b8e80941Smrg    * together, in particular those that are implied by
141b8e80941Smrg    * get_driver_query_group_info.
142b8e80941Smrg    *
143b8e80941Smrg    * \param num_queries the number of query types
144b8e80941Smrg    * \param query_types array of \p num_queries query types
145b8e80941Smrg    * \return a query object, or NULL on error.
146b8e80941Smrg    */
147b8e80941Smrg   struct pipe_query *(*create_batch_query)( struct pipe_context *pipe,
148b8e80941Smrg                                             unsigned num_queries,
149b8e80941Smrg                                             unsigned *query_types );
150b8e80941Smrg
151848b8605Smrg   void (*destroy_query)(struct pipe_context *pipe,
152848b8605Smrg                         struct pipe_query *q);
153848b8605Smrg
154b8e80941Smrg   boolean (*begin_query)(struct pipe_context *pipe, struct pipe_query *q);
155b8e80941Smrg   bool (*end_query)(struct pipe_context *pipe, struct pipe_query *q);
156848b8605Smrg
157848b8605Smrg   /**
158848b8605Smrg    * Get results of a query.
159848b8605Smrg    * \param wait  if true, this query will block until the result is ready
160848b8605Smrg    * \return TRUE if results are ready, FALSE otherwise
161848b8605Smrg    */
162848b8605Smrg   boolean (*get_query_result)(struct pipe_context *pipe,
163848b8605Smrg                               struct pipe_query *q,
164848b8605Smrg                               boolean wait,
165848b8605Smrg                               union pipe_query_result *result);
166b8e80941Smrg
167b8e80941Smrg   /**
168b8e80941Smrg    * Get results of a query, storing into resource. Note that this may not
169b8e80941Smrg    * be used with batch queries.
170b8e80941Smrg    *
171b8e80941Smrg    * \param wait  if true, this query will block until the result is ready
172b8e80941Smrg    * \param result_type  the type of the value being stored:
173b8e80941Smrg    * \param index  for queries that return multiple pieces of data, which
174b8e80941Smrg    *               item of that data to store (e.g. for
175b8e80941Smrg    *               PIPE_QUERY_PIPELINE_STATISTICS).
176b8e80941Smrg    *               When the index is -1, instead of the value of the query
177b8e80941Smrg    *               the driver should instead write a 1 or 0 to the appropriate
178b8e80941Smrg    *               location with 1 meaning that the query result is available.
179b8e80941Smrg    */
180b8e80941Smrg   void (*get_query_result_resource)(struct pipe_context *pipe,
181b8e80941Smrg                                     struct pipe_query *q,
182b8e80941Smrg                                     boolean wait,
183b8e80941Smrg                                     enum pipe_query_value_type result_type,
184b8e80941Smrg                                     int index,
185b8e80941Smrg                                     struct pipe_resource *resource,
186b8e80941Smrg                                     unsigned offset);
187b8e80941Smrg
188b8e80941Smrg   /**
189b8e80941Smrg    * Set whether all current non-driver queries except TIME_ELAPSED are
190b8e80941Smrg    * active or paused.
191b8e80941Smrg    */
192b8e80941Smrg   void (*set_active_query_state)(struct pipe_context *pipe, boolean enable);
193b8e80941Smrg
194848b8605Smrg   /*@}*/
195848b8605Smrg
196848b8605Smrg   /**
197848b8605Smrg    * State functions (create/bind/destroy state objects)
198848b8605Smrg    */
199848b8605Smrg   /*@{*/
200848b8605Smrg   void * (*create_blend_state)(struct pipe_context *,
201848b8605Smrg                                const struct pipe_blend_state *);
202848b8605Smrg   void   (*bind_blend_state)(struct pipe_context *, void *);
203848b8605Smrg   void   (*delete_blend_state)(struct pipe_context *, void  *);
204848b8605Smrg
205848b8605Smrg   void * (*create_sampler_state)(struct pipe_context *,
206848b8605Smrg                                  const struct pipe_sampler_state *);
207848b8605Smrg   void   (*bind_sampler_states)(struct pipe_context *,
208b8e80941Smrg                                 enum pipe_shader_type shader,
209b8e80941Smrg                                 unsigned start_slot, unsigned num_samplers,
210b8e80941Smrg                                 void **samplers);
211848b8605Smrg   void   (*delete_sampler_state)(struct pipe_context *, void *);
212848b8605Smrg
213848b8605Smrg   void * (*create_rasterizer_state)(struct pipe_context *,
214848b8605Smrg                                     const struct pipe_rasterizer_state *);
215848b8605Smrg   void   (*bind_rasterizer_state)(struct pipe_context *, void *);
216848b8605Smrg   void   (*delete_rasterizer_state)(struct pipe_context *, void *);
217848b8605Smrg
218848b8605Smrg   void * (*create_depth_stencil_alpha_state)(struct pipe_context *,
219848b8605Smrg                                        const struct pipe_depth_stencil_alpha_state *);
220848b8605Smrg   void   (*bind_depth_stencil_alpha_state)(struct pipe_context *, void *);
221848b8605Smrg   void   (*delete_depth_stencil_alpha_state)(struct pipe_context *, void *);
222848b8605Smrg
223848b8605Smrg   void * (*create_fs_state)(struct pipe_context *,
224848b8605Smrg                             const struct pipe_shader_state *);
225848b8605Smrg   void   (*bind_fs_state)(struct pipe_context *, void *);
226848b8605Smrg   void   (*delete_fs_state)(struct pipe_context *, void *);
227848b8605Smrg
228848b8605Smrg   void * (*create_vs_state)(struct pipe_context *,
229848b8605Smrg                             const struct pipe_shader_state *);
230848b8605Smrg   void   (*bind_vs_state)(struct pipe_context *, void *);
231848b8605Smrg   void   (*delete_vs_state)(struct pipe_context *, void *);
232848b8605Smrg
233848b8605Smrg   void * (*create_gs_state)(struct pipe_context *,
234848b8605Smrg                             const struct pipe_shader_state *);
235848b8605Smrg   void   (*bind_gs_state)(struct pipe_context *, void *);
236848b8605Smrg   void   (*delete_gs_state)(struct pipe_context *, void *);
237848b8605Smrg
238b8e80941Smrg   void * (*create_tcs_state)(struct pipe_context *,
239b8e80941Smrg                              const struct pipe_shader_state *);
240b8e80941Smrg   void   (*bind_tcs_state)(struct pipe_context *, void *);
241b8e80941Smrg   void   (*delete_tcs_state)(struct pipe_context *, void *);
242b8e80941Smrg
243b8e80941Smrg   void * (*create_tes_state)(struct pipe_context *,
244b8e80941Smrg                              const struct pipe_shader_state *);
245b8e80941Smrg   void   (*bind_tes_state)(struct pipe_context *, void *);
246b8e80941Smrg   void   (*delete_tes_state)(struct pipe_context *, void *);
247b8e80941Smrg
248848b8605Smrg   void * (*create_vertex_elements_state)(struct pipe_context *,
249848b8605Smrg                                          unsigned num_elements,
250848b8605Smrg                                          const struct pipe_vertex_element *);
251848b8605Smrg   void   (*bind_vertex_elements_state)(struct pipe_context *, void *);
252848b8605Smrg   void   (*delete_vertex_elements_state)(struct pipe_context *, void *);
253848b8605Smrg
254848b8605Smrg   /*@}*/
255848b8605Smrg
256848b8605Smrg   /**
257848b8605Smrg    * Parameter-like state (or properties)
258848b8605Smrg    */
259848b8605Smrg   /*@{*/
260848b8605Smrg   void (*set_blend_color)( struct pipe_context *,
261848b8605Smrg                            const struct pipe_blend_color * );
262848b8605Smrg
263848b8605Smrg   void (*set_stencil_ref)( struct pipe_context *,
264848b8605Smrg                            const struct pipe_stencil_ref * );
265848b8605Smrg
266848b8605Smrg   void (*set_sample_mask)( struct pipe_context *,
267848b8605Smrg                            unsigned sample_mask );
268848b8605Smrg
269848b8605Smrg   void (*set_min_samples)( struct pipe_context *,
270848b8605Smrg                            unsigned min_samples );
271848b8605Smrg
272848b8605Smrg   void (*set_clip_state)( struct pipe_context *,
273848b8605Smrg                            const struct pipe_clip_state * );
274848b8605Smrg
275848b8605Smrg   void (*set_constant_buffer)( struct pipe_context *,
276b8e80941Smrg                                enum pipe_shader_type shader, uint index,
277b8e80941Smrg                                const struct pipe_constant_buffer *buf );
278848b8605Smrg
279848b8605Smrg   void (*set_framebuffer_state)( struct pipe_context *,
280848b8605Smrg                                  const struct pipe_framebuffer_state * );
281848b8605Smrg
282b8e80941Smrg   /**
283b8e80941Smrg    * Set the sample locations used during rasterization. When NULL or sized
284b8e80941Smrg    * zero, the default locations are used.
285b8e80941Smrg    *
286b8e80941Smrg    * Note that get_sample_position() still returns the default locations.
287b8e80941Smrg    *
288b8e80941Smrg    * The samples are accessed with
289b8e80941Smrg    * locations[(pixel_y*grid_w+pixel_x)*ms+i],
290b8e80941Smrg    * where:
291b8e80941Smrg    * ms      = the sample count
292b8e80941Smrg    * grid_w  = the pixel grid width for the sample count
293b8e80941Smrg    * grid_w  = the pixel grid height for the sample count
294b8e80941Smrg    * pixel_x = the window x coordinate modulo grid_w
295b8e80941Smrg    * pixel_y = the window y coordinate modulo grid_w
296b8e80941Smrg    * i       = the sample index
297b8e80941Smrg    * This gives a result with the x coordinate as the low 4 bits and the y
298b8e80941Smrg    * coordinate as the high 4 bits. For each coordinate 0 is the left or top
299b8e80941Smrg    * edge of the pixel's rectangle and 16 (not 15) is the right or bottom edge.
300b8e80941Smrg    *
301b8e80941Smrg    * Out of bounds accesses are return undefined values.
302b8e80941Smrg    *
303b8e80941Smrg    * The pixel grid is used to vary sample locations across pixels and its
304b8e80941Smrg    * size can be queried with get_sample_pixel_grid().
305b8e80941Smrg    */
306b8e80941Smrg   void (*set_sample_locations)( struct pipe_context *,
307b8e80941Smrg                                 size_t size, const uint8_t *locations );
308b8e80941Smrg
309848b8605Smrg   void (*set_polygon_stipple)( struct pipe_context *,
310b8e80941Smrg                                const struct pipe_poly_stipple * );
311848b8605Smrg
312848b8605Smrg   void (*set_scissor_states)( struct pipe_context *,
313848b8605Smrg                               unsigned start_slot,
314848b8605Smrg                               unsigned num_scissors,
315848b8605Smrg                               const struct pipe_scissor_state * );
316848b8605Smrg
317b8e80941Smrg   void (*set_window_rectangles)( struct pipe_context *,
318b8e80941Smrg                                  boolean include,
319b8e80941Smrg                                  unsigned num_rectangles,
320b8e80941Smrg                                  const struct pipe_scissor_state * );
321b8e80941Smrg
322848b8605Smrg   void (*set_viewport_states)( struct pipe_context *,
323848b8605Smrg                                unsigned start_slot,
324848b8605Smrg                                unsigned num_viewports,
325848b8605Smrg                                const struct pipe_viewport_state *);
326848b8605Smrg
327b8e80941Smrg   void (*set_sampler_views)(struct pipe_context *,
328b8e80941Smrg                             enum pipe_shader_type shader,
329848b8605Smrg                             unsigned start_slot, unsigned num_views,
330b8e80941Smrg                             struct pipe_sampler_view **views);
331b8e80941Smrg
332b8e80941Smrg   void (*set_tess_state)(struct pipe_context *,
333b8e80941Smrg                          const float default_outer_level[4],
334b8e80941Smrg                          const float default_inner_level[2]);
335848b8605Smrg
336848b8605Smrg   /**
337b8e80941Smrg    * Sets the debug callback. If the pointer is null, then no callback is
338b8e80941Smrg    * set, otherwise a copy of the data should be made.
339b8e80941Smrg    */
340b8e80941Smrg   void (*set_debug_callback)(struct pipe_context *,
341b8e80941Smrg                              const struct pipe_debug_callback *);
342b8e80941Smrg
343b8e80941Smrg   /**
344b8e80941Smrg    * Bind an array of shader buffers that will be used by a shader.
345b8e80941Smrg    * Any buffers that were previously bound to the specified range
346b8e80941Smrg    * will be unbound.
347848b8605Smrg    *
348b8e80941Smrg    * \param shader     selects shader stage
349b8e80941Smrg    * \param start_slot first buffer slot to bind.
350b8e80941Smrg    * \param count      number of consecutive buffers to bind.
351b8e80941Smrg    * \param buffers    array of pointers to the buffers to bind, it
352848b8605Smrg    *                   should contain at least \a count elements
353b8e80941Smrg    *                   unless it's NULL, in which case no buffers will
354b8e80941Smrg    *                   be bound.
355b8e80941Smrg    * \param writable_bitmask  If bit i is not set, buffers[i] will only be
356b8e80941Smrg    *                          used with loads. If unsure, set to ~0.
357b8e80941Smrg    */
358b8e80941Smrg   void (*set_shader_buffers)(struct pipe_context *,
359b8e80941Smrg                              enum pipe_shader_type shader,
360b8e80941Smrg                              unsigned start_slot, unsigned count,
361b8e80941Smrg                              const struct pipe_shader_buffer *buffers,
362b8e80941Smrg                              unsigned writable_bitmask);
363b8e80941Smrg
364b8e80941Smrg   /**
365b8e80941Smrg    * Bind an array of hw atomic buffers for use by all shaders.
366b8e80941Smrg    * And buffers that were previously bound to the specified range
367b8e80941Smrg    * will be unbound.
368b8e80941Smrg    *
369b8e80941Smrg    * \param start_slot first buffer slot to bind.
370b8e80941Smrg    * \param count      number of consecutive buffers to bind.
371b8e80941Smrg    * \param buffers    array of pointers to the buffers to bind, it
372b8e80941Smrg    *                   should contain at least \a count elements
373b8e80941Smrg    *                   unless it's NULL, in which case no buffers will
374b8e80941Smrg    *                   be bound.
375848b8605Smrg    */
376b8e80941Smrg   void (*set_hw_atomic_buffers)(struct pipe_context *,
377b8e80941Smrg                                 unsigned start_slot, unsigned count,
378b8e80941Smrg                                 const struct pipe_shader_buffer *buffers);
379b8e80941Smrg
380b8e80941Smrg   /**
381b8e80941Smrg    * Bind an array of images that will be used by a shader.
382b8e80941Smrg    * Any images that were previously bound to the specified range
383b8e80941Smrg    * will be unbound.
384b8e80941Smrg    *
385b8e80941Smrg    * \param shader     selects shader stage
386b8e80941Smrg    * \param start_slot first image slot to bind.
387b8e80941Smrg    * \param count      number of consecutive images to bind.
388b8e80941Smrg    * \param buffers    array of the images to bind, it
389b8e80941Smrg    *                   should contain at least \a count elements
390b8e80941Smrg    *                   unless it's NULL, in which case no images will
391b8e80941Smrg    *                   be bound.
392b8e80941Smrg    */
393b8e80941Smrg   void (*set_shader_images)(struct pipe_context *,
394b8e80941Smrg                             enum pipe_shader_type shader,
395b8e80941Smrg                             unsigned start_slot, unsigned count,
396b8e80941Smrg                             const struct pipe_image_view *images);
397848b8605Smrg
398848b8605Smrg   void (*set_vertex_buffers)( struct pipe_context *,
399848b8605Smrg                               unsigned start_slot,
400848b8605Smrg                               unsigned num_buffers,
401848b8605Smrg                               const struct pipe_vertex_buffer * );
402848b8605Smrg
403848b8605Smrg   /*@}*/
404848b8605Smrg
405848b8605Smrg   /**
406848b8605Smrg    * Stream output functions.
407848b8605Smrg    */
408848b8605Smrg   /*@{*/
409848b8605Smrg
410848b8605Smrg   struct pipe_stream_output_target *(*create_stream_output_target)(
411848b8605Smrg                        struct pipe_context *,
412848b8605Smrg                        struct pipe_resource *,
413848b8605Smrg                        unsigned buffer_offset,
414848b8605Smrg                        unsigned buffer_size);
415848b8605Smrg
416848b8605Smrg   void (*stream_output_target_destroy)(struct pipe_context *,
417848b8605Smrg                                        struct pipe_stream_output_target *);
418848b8605Smrg
419848b8605Smrg   void (*set_stream_output_targets)(struct pipe_context *,
420848b8605Smrg                              unsigned num_targets,
421848b8605Smrg                              struct pipe_stream_output_target **targets,
422848b8605Smrg                              const unsigned *offsets);
423848b8605Smrg
424848b8605Smrg   /*@}*/
425848b8605Smrg
426848b8605Smrg
427848b8605Smrg   /**
428848b8605Smrg    * Resource functions for blit-like functionality
429848b8605Smrg    *
430848b8605Smrg    * If a driver supports multisampling, blit must implement color resolve.
431848b8605Smrg    */
432848b8605Smrg   /*@{*/
433848b8605Smrg
434848b8605Smrg   /**
435848b8605Smrg    * Copy a block of pixels from one resource to another.
436848b8605Smrg    * The resource must be of the same format.
437848b8605Smrg    * Resources with nr_samples > 1 are not allowed.
438848b8605Smrg    */
439848b8605Smrg   void (*resource_copy_region)(struct pipe_context *pipe,
440848b8605Smrg                                struct pipe_resource *dst,
441848b8605Smrg                                unsigned dst_level,
442848b8605Smrg                                unsigned dstx, unsigned dsty, unsigned dstz,
443848b8605Smrg                                struct pipe_resource *src,
444848b8605Smrg                                unsigned src_level,
445848b8605Smrg                                const struct pipe_box *src_box);
446848b8605Smrg
447848b8605Smrg   /* Optimal hardware path for blitting pixels.
448848b8605Smrg    * Scaling, format conversion, up- and downsampling (resolve) are allowed.
449848b8605Smrg    */
450848b8605Smrg   void (*blit)(struct pipe_context *pipe,
451848b8605Smrg                const struct pipe_blit_info *info);
452848b8605Smrg
453848b8605Smrg   /*@}*/
454848b8605Smrg
455848b8605Smrg   /**
456848b8605Smrg    * Clear the specified set of currently bound buffers to specified values.
457848b8605Smrg    * The entire buffers are cleared (no scissor, no colormask, etc).
458848b8605Smrg    *
459848b8605Smrg    * \param buffers  bitfield of PIPE_CLEAR_* values.
460848b8605Smrg    * \param color  pointer to a union of fiu array for each of r, g, b, a.
461848b8605Smrg    * \param depth  depth clear value in [0,1].
462848b8605Smrg    * \param stencil  stencil clear value
463848b8605Smrg    */
464848b8605Smrg   void (*clear)(struct pipe_context *pipe,
465848b8605Smrg                 unsigned buffers,
466848b8605Smrg                 const union pipe_color_union *color,
467848b8605Smrg                 double depth,
468848b8605Smrg                 unsigned stencil);
469848b8605Smrg
470848b8605Smrg   /**
471848b8605Smrg    * Clear a color rendertarget surface.
472848b8605Smrg    * \param color  pointer to an union of fiu array for each of r, g, b, a.
473848b8605Smrg    */
474848b8605Smrg   void (*clear_render_target)(struct pipe_context *pipe,
475848b8605Smrg                               struct pipe_surface *dst,
476848b8605Smrg                               const union pipe_color_union *color,
477848b8605Smrg                               unsigned dstx, unsigned dsty,
478b8e80941Smrg                               unsigned width, unsigned height,
479b8e80941Smrg                               bool render_condition_enabled);
480848b8605Smrg
481848b8605Smrg   /**
482848b8605Smrg    * Clear a depth-stencil surface.
483848b8605Smrg    * \param clear_flags  bitfield of PIPE_CLEAR_DEPTH/STENCIL values.
484848b8605Smrg    * \param depth  depth clear value in [0,1].
485848b8605Smrg    * \param stencil  stencil clear value
486848b8605Smrg    */
487848b8605Smrg   void (*clear_depth_stencil)(struct pipe_context *pipe,
488848b8605Smrg                               struct pipe_surface *dst,
489848b8605Smrg                               unsigned clear_flags,
490848b8605Smrg                               double depth,
491848b8605Smrg                               unsigned stencil,
492848b8605Smrg                               unsigned dstx, unsigned dsty,
493b8e80941Smrg                               unsigned width, unsigned height,
494b8e80941Smrg                               bool render_condition_enabled);
495b8e80941Smrg
496b8e80941Smrg   /**
497b8e80941Smrg    * Clear the texture with the specified texel. Not guaranteed to be a
498b8e80941Smrg    * renderable format. Data provided in the resource's format.
499b8e80941Smrg    */
500b8e80941Smrg   void (*clear_texture)(struct pipe_context *pipe,
501b8e80941Smrg                         struct pipe_resource *res,
502b8e80941Smrg                         unsigned level,
503b8e80941Smrg                         const struct pipe_box *box,
504b8e80941Smrg                         const void *data);
505848b8605Smrg
506848b8605Smrg   /**
507848b8605Smrg    * Clear a buffer. Runs a memset over the specified region with the element
508848b8605Smrg    * value passed in through clear_value of size clear_value_size.
509848b8605Smrg    */
510848b8605Smrg   void (*clear_buffer)(struct pipe_context *pipe,
511848b8605Smrg                        struct pipe_resource *res,
512848b8605Smrg                        unsigned offset,
513848b8605Smrg                        unsigned size,
514848b8605Smrg                        const void *clear_value,
515848b8605Smrg                        int clear_value_size);
516848b8605Smrg
517b8e80941Smrg   /**
518b8e80941Smrg    * If a depth buffer is rendered with different sample location state than
519b8e80941Smrg    * what is current at the time of reading, the values may differ because
520b8e80941Smrg    * depth buffer compression can depend the sample locations.
521848b8605Smrg    *
522b8e80941Smrg    * This function is a hint to decompress the current depth buffer to avoid
523b8e80941Smrg    * such problems.
524b8e80941Smrg    */
525b8e80941Smrg   void (*evaluate_depth_buffer)(struct pipe_context *pipe);
526b8e80941Smrg
527b8e80941Smrg   /**
528b8e80941Smrg    * Flush draw commands.
529b8e80941Smrg    *
530b8e80941Smrg    * This guarantees that the new fence (if any) will finish in finite time,
531b8e80941Smrg    * unless PIPE_FLUSH_DEFERRED is used.
532b8e80941Smrg    *
533b8e80941Smrg    * Subsequent operations on other contexts of the same screen are guaranteed
534b8e80941Smrg    * to execute after the flushed commands, unless PIPE_FLUSH_ASYNC is used.
535b8e80941Smrg    *
536b8e80941Smrg    * NOTE: use screen->fence_reference() (or equivalent) to transfer
537b8e80941Smrg    * new fence ref to **fence, to ensure that previous fence is unref'd
538b8e80941Smrg    *
539b8e80941Smrg    * \param fence  if not NULL, an old fence to unref and transfer a
540b8e80941Smrg    *    new fence reference to
541848b8605Smrg    * \param flags  bitfield of enum pipe_flush_flags values.
542848b8605Smrg    */
543848b8605Smrg   void (*flush)(struct pipe_context *pipe,
544848b8605Smrg                 struct pipe_fence_handle **fence,
545848b8605Smrg                 unsigned flags);
546848b8605Smrg
547b8e80941Smrg   /**
548b8e80941Smrg    * Create a fence from a fd.
549b8e80941Smrg    *
550b8e80941Smrg    * This is used for importing a foreign/external fence fd.
551b8e80941Smrg    *
552b8e80941Smrg    * \param fence  if not NULL, an old fence to unref and transfer a
553b8e80941Smrg    *    new fence reference to
554b8e80941Smrg    * \param fd     fd representing the fence object
555b8e80941Smrg    * \param type   indicates which fence types backs fd
556b8e80941Smrg    */
557b8e80941Smrg   void (*create_fence_fd)(struct pipe_context *pipe,
558b8e80941Smrg                           struct pipe_fence_handle **fence,
559b8e80941Smrg                           int fd,
560b8e80941Smrg                           enum pipe_fd_type type);
561b8e80941Smrg
562b8e80941Smrg   /**
563b8e80941Smrg    * Insert commands to have GPU wait for fence to be signaled.
564b8e80941Smrg    */
565b8e80941Smrg   void (*fence_server_sync)(struct pipe_context *pipe,
566b8e80941Smrg                             struct pipe_fence_handle *fence);
567b8e80941Smrg
568b8e80941Smrg   /**
569b8e80941Smrg    * Insert commands to have the GPU signal a fence.
570b8e80941Smrg    */
571b8e80941Smrg   void (*fence_server_signal)(struct pipe_context *pipe,
572b8e80941Smrg                               struct pipe_fence_handle *fence);
573b8e80941Smrg
574848b8605Smrg   /**
575848b8605Smrg    * Create a view on a texture to be used by a shader stage.
576848b8605Smrg    */
577848b8605Smrg   struct pipe_sampler_view * (*create_sampler_view)(struct pipe_context *ctx,
578848b8605Smrg                                                     struct pipe_resource *texture,
579848b8605Smrg                                                     const struct pipe_sampler_view *templat);
580848b8605Smrg
581b8e80941Smrg   /**
582b8e80941Smrg    * Destroy a view on a texture.
583b8e80941Smrg    *
584b8e80941Smrg    * \param ctx the current context
585b8e80941Smrg    * \param view the view to be destroyed
586b8e80941Smrg    *
587b8e80941Smrg    * \note The current context may not be the context in which the view was
588b8e80941Smrg    *       created (view->context). However, the caller must guarantee that
589b8e80941Smrg    *       the context which created the view is still alive.
590b8e80941Smrg    */
591848b8605Smrg   void (*sampler_view_destroy)(struct pipe_context *ctx,
592848b8605Smrg                                struct pipe_sampler_view *view);
593848b8605Smrg
594848b8605Smrg
595848b8605Smrg   /**
596848b8605Smrg    * Get a surface which is a "view" into a resource, used by
597848b8605Smrg    * render target / depth stencil stages.
598848b8605Smrg    */
599848b8605Smrg   struct pipe_surface *(*create_surface)(struct pipe_context *ctx,
600848b8605Smrg                                          struct pipe_resource *resource,
601848b8605Smrg                                          const struct pipe_surface *templat);
602848b8605Smrg
603848b8605Smrg   void (*surface_destroy)(struct pipe_context *ctx,
604848b8605Smrg                           struct pipe_surface *);
605848b8605Smrg
606b8e80941Smrg
607848b8605Smrg   /**
608848b8605Smrg    * Map a resource.
609848b8605Smrg    *
610848b8605Smrg    * Transfers are (by default) context-private and allow uploads to be
611848b8605Smrg    * interleaved with rendering.
612848b8605Smrg    *
613848b8605Smrg    * out_transfer will contain the transfer object that must be passed
614848b8605Smrg    * to all the other transfer functions. It also contains useful
615848b8605Smrg    * information (like texture strides).
616848b8605Smrg    */
617848b8605Smrg   void *(*transfer_map)(struct pipe_context *,
618848b8605Smrg                         struct pipe_resource *resource,
619848b8605Smrg                         unsigned level,
620848b8605Smrg                         unsigned usage,  /* a combination of PIPE_TRANSFER_x */
621848b8605Smrg                         const struct pipe_box *,
622848b8605Smrg                         struct pipe_transfer **out_transfer);
623848b8605Smrg
624848b8605Smrg   /* If transfer was created with WRITE|FLUSH_EXPLICIT, only the
625848b8605Smrg    * regions specified with this call are guaranteed to be written to
626848b8605Smrg    * the resource.
627848b8605Smrg    */
628848b8605Smrg   void (*transfer_flush_region)( struct pipe_context *,
629848b8605Smrg				  struct pipe_transfer *transfer,
630848b8605Smrg				  const struct pipe_box *);
631848b8605Smrg
632848b8605Smrg   void (*transfer_unmap)(struct pipe_context *,
633848b8605Smrg                          struct pipe_transfer *transfer);
634848b8605Smrg
635848b8605Smrg   /* One-shot transfer operation with data supplied in a user
636b8e80941Smrg    * pointer.
637b8e80941Smrg    */
638b8e80941Smrg   void (*buffer_subdata)(struct pipe_context *,
639b8e80941Smrg                          struct pipe_resource *,
640b8e80941Smrg                          unsigned usage, /* a combination of PIPE_TRANSFER_x */
641b8e80941Smrg                          unsigned offset,
642b8e80941Smrg                          unsigned size,
643b8e80941Smrg                          const void *data);
644b8e80941Smrg
645b8e80941Smrg   void (*texture_subdata)(struct pipe_context *,
646b8e80941Smrg                           struct pipe_resource *,
647b8e80941Smrg                           unsigned level,
648b8e80941Smrg                           unsigned usage, /* a combination of PIPE_TRANSFER_x */
649b8e80941Smrg                           const struct pipe_box *,
650b8e80941Smrg                           const void *data,
651b8e80941Smrg                           unsigned stride,
652b8e80941Smrg                           unsigned layer_stride);
653848b8605Smrg
654848b8605Smrg   /**
655848b8605Smrg    * Flush any pending framebuffer writes and invalidate texture caches.
656848b8605Smrg    */
657b8e80941Smrg   void (*texture_barrier)(struct pipe_context *, unsigned flags);
658848b8605Smrg
659848b8605Smrg   /**
660848b8605Smrg    * Flush caches according to flags.
661848b8605Smrg    */
662848b8605Smrg   void (*memory_barrier)(struct pipe_context *, unsigned flags);
663848b8605Smrg
664b8e80941Smrg   /**
665b8e80941Smrg    * Change the commitment status of a part of the given resource, which must
666b8e80941Smrg    * have been created with the PIPE_RESOURCE_FLAG_SPARSE bit.
667b8e80941Smrg    *
668b8e80941Smrg    * \param level The texture level whose commitment should be changed.
669b8e80941Smrg    * \param box The region of the resource whose commitment should be changed.
670b8e80941Smrg    * \param commit Whether memory should be committed or un-committed.
671b8e80941Smrg    *
672b8e80941Smrg    * \return false if out of memory, true on success.
673b8e80941Smrg    */
674b8e80941Smrg   bool (*resource_commit)(struct pipe_context *, struct pipe_resource *,
675b8e80941Smrg                           unsigned level, struct pipe_box *box, bool commit);
676b8e80941Smrg
677848b8605Smrg   /**
678848b8605Smrg    * Creates a video codec for a specific video format/profile
679848b8605Smrg    */
680848b8605Smrg   struct pipe_video_codec *(*create_video_codec)( struct pipe_context *context,
681848b8605Smrg                                                   const struct pipe_video_codec *templat );
682848b8605Smrg
683848b8605Smrg   /**
684848b8605Smrg    * Creates a video buffer as decoding target
685848b8605Smrg    */
686848b8605Smrg   struct pipe_video_buffer *(*create_video_buffer)( struct pipe_context *context,
687848b8605Smrg                                                     const struct pipe_video_buffer *templat );
688848b8605Smrg
689848b8605Smrg   /**
690848b8605Smrg    * Compute kernel execution
691848b8605Smrg    */
692848b8605Smrg   /*@{*/
693848b8605Smrg   /**
694848b8605Smrg    * Define the compute program and parameters to be used by
695848b8605Smrg    * pipe_context::launch_grid.
696848b8605Smrg    */
697848b8605Smrg   void *(*create_compute_state)(struct pipe_context *context,
698848b8605Smrg				 const struct pipe_compute_state *);
699848b8605Smrg   void (*bind_compute_state)(struct pipe_context *, void *);
700848b8605Smrg   void (*delete_compute_state)(struct pipe_context *, void *);
701848b8605Smrg
702848b8605Smrg   /**
703848b8605Smrg    * Bind an array of shader resources that will be used by the
704848b8605Smrg    * compute program.  Any resources that were previously bound to
705848b8605Smrg    * the specified range will be unbound after this call.
706848b8605Smrg    *
707848b8605Smrg    * \param start      first resource to bind.
708848b8605Smrg    * \param count      number of consecutive resources to bind.
709848b8605Smrg    * \param resources  array of pointers to the resources to bind, it
710848b8605Smrg    *                   should contain at least \a count elements
711848b8605Smrg    *                   unless it's NULL, in which case no new
712848b8605Smrg    *                   resources will be bound.
713848b8605Smrg    */
714848b8605Smrg   void (*set_compute_resources)(struct pipe_context *,
715848b8605Smrg                                 unsigned start, unsigned count,
716848b8605Smrg                                 struct pipe_surface **resources);
717848b8605Smrg
718848b8605Smrg   /**
719848b8605Smrg    * Bind an array of buffers to be mapped into the address space of
720848b8605Smrg    * the GLOBAL resource.  Any buffers that were previously bound
721848b8605Smrg    * between [first, first + count - 1] are unbound after this call.
722848b8605Smrg    *
723848b8605Smrg    * \param first      first buffer to map.
724848b8605Smrg    * \param count      number of consecutive buffers to map.
725848b8605Smrg    * \param resources  array of pointers to the buffers to map, it
726848b8605Smrg    *                   should contain at least \a count elements
727848b8605Smrg    *                   unless it's NULL, in which case no new
728848b8605Smrg    *                   resources will be bound.
729848b8605Smrg    * \param handles    array of pointers to the memory locations that
730848b8605Smrg    *                   will be updated with the address each buffer
731848b8605Smrg    *                   will be mapped to.  The base memory address of
732848b8605Smrg    *                   each of the buffers will be added to the value
733848b8605Smrg    *                   pointed to by its corresponding handle to form
734848b8605Smrg    *                   the final address argument.  It should contain
735848b8605Smrg    *                   at least \a count elements, unless \a
736848b8605Smrg    *                   resources is NULL in which case \a handles
737848b8605Smrg    *                   should be NULL as well.
738848b8605Smrg    *
739848b8605Smrg    * Note that the driver isn't required to make any guarantees about
740848b8605Smrg    * the contents of the \a handles array being valid anytime except
741848b8605Smrg    * during the subsequent calls to pipe_context::launch_grid.  This
742848b8605Smrg    * means that the only sensible location handles[i] may point to is
743848b8605Smrg    * somewhere within the INPUT buffer itself.  This is so to
744848b8605Smrg    * accommodate implementations that lack virtual memory but
745848b8605Smrg    * nevertheless migrate buffers on the fly, leading to resource
746848b8605Smrg    * base addresses that change on each kernel invocation or are
747848b8605Smrg    * unknown to the pipe driver.
748848b8605Smrg    */
749848b8605Smrg   void (*set_global_binding)(struct pipe_context *context,
750848b8605Smrg                              unsigned first, unsigned count,
751848b8605Smrg                              struct pipe_resource **resources,
752848b8605Smrg                              uint32_t **handles);
753848b8605Smrg
754848b8605Smrg   /**
755848b8605Smrg    * Launch the compute kernel starting from instruction \a pc of the
756848b8605Smrg    * currently bound compute program.
757848b8605Smrg    */
758848b8605Smrg   void (*launch_grid)(struct pipe_context *context,
759b8e80941Smrg                       const struct pipe_grid_info *info);
760848b8605Smrg   /*@}*/
761848b8605Smrg
762848b8605Smrg   /**
763b8e80941Smrg    * Get the default sample position for an individual sample point.
764848b8605Smrg    *
765848b8605Smrg    * \param sample_count - total number of samples
766848b8605Smrg    * \param sample_index - sample to get the position values for
767848b8605Smrg    * \param out_value - return value of 2 floats for x and y position for
768848b8605Smrg    *                    requested sample.
769848b8605Smrg    */
770848b8605Smrg   void (*get_sample_position)(struct pipe_context *context,
771848b8605Smrg                               unsigned sample_count,
772848b8605Smrg                               unsigned sample_index,
773848b8605Smrg                               float *out_value);
774848b8605Smrg
775b8e80941Smrg   /**
776b8e80941Smrg    * Query a timestamp in nanoseconds.  This is completely equivalent to
777b8e80941Smrg    * pipe_screen::get_timestamp() but takes a context handle for drivers
778b8e80941Smrg    * that require a context.
779b8e80941Smrg    */
780b8e80941Smrg   uint64_t (*get_timestamp)(struct pipe_context *);
781b8e80941Smrg
782848b8605Smrg   /**
783848b8605Smrg    * Flush the resource cache, so that the resource can be used
784848b8605Smrg    * by an external client. Possible usage:
785848b8605Smrg    * - flushing a resource before presenting it on the screen
786848b8605Smrg    * - flushing a resource if some other process or device wants to use it
787848b8605Smrg    * This shouldn't be used to flush caches if the resource is only managed
788848b8605Smrg    * by a single pipe_screen and is not shared with another process.
789848b8605Smrg    * (i.e. you shouldn't use it to flush caches explicitly if you want to e.g.
790848b8605Smrg    * use the resource for texturing)
791848b8605Smrg    */
792848b8605Smrg   void (*flush_resource)(struct pipe_context *ctx,
793848b8605Smrg                          struct pipe_resource *resource);
794b8e80941Smrg
795b8e80941Smrg   /**
796b8e80941Smrg    * Invalidate the contents of the resource. This is used to
797b8e80941Smrg    *
798b8e80941Smrg    * (1) implement EGL's semantic of undefined depth/stencil
799b8e80941Smrg    * contents after a swapbuffers.  This allows a tiled renderer (for
800b8e80941Smrg    * example) to not store the depth buffer.
801b8e80941Smrg    *
802b8e80941Smrg    * (2) implement GL's InvalidateBufferData. For backwards compatibility,
803b8e80941Smrg    * you must only rely on the usability for this purpose when
804b8e80941Smrg    * PIPE_CAP_INVALIDATE_BUFFER is enabled.
805b8e80941Smrg    */
806b8e80941Smrg   void (*invalidate_resource)(struct pipe_context *ctx,
807b8e80941Smrg                               struct pipe_resource *resource);
808b8e80941Smrg
809b8e80941Smrg   /**
810b8e80941Smrg    * Return information about unexpected device resets.
811b8e80941Smrg    */
812b8e80941Smrg   enum pipe_reset_status (*get_device_reset_status)(struct pipe_context *ctx);
813b8e80941Smrg
814b8e80941Smrg   /**
815b8e80941Smrg    * Sets the reset status callback. If the pointer is null, then no callback
816b8e80941Smrg    * is set, otherwise a copy of the data should be made.
817b8e80941Smrg    */
818b8e80941Smrg   void (*set_device_reset_callback)(struct pipe_context *ctx,
819b8e80941Smrg                                     const struct pipe_device_reset_callback *cb);
820b8e80941Smrg
821b8e80941Smrg   /**
822b8e80941Smrg    * Dump driver-specific debug information into a stream. This is
823b8e80941Smrg    * used by debugging tools.
824b8e80941Smrg    *
825b8e80941Smrg    * \param ctx        pipe context
826b8e80941Smrg    * \param stream     where the output should be written to
827b8e80941Smrg    * \param flags      a mask of PIPE_DUMP_* flags
828b8e80941Smrg    */
829b8e80941Smrg   void (*dump_debug_state)(struct pipe_context *ctx, FILE *stream,
830b8e80941Smrg                            unsigned flags);
831b8e80941Smrg
832b8e80941Smrg   /**
833b8e80941Smrg    * Set the log context to which the driver should write internal debug logs
834b8e80941Smrg    * (internal states, command streams).
835b8e80941Smrg    *
836b8e80941Smrg    * The caller must ensure that the log context is destroyed and reset to
837b8e80941Smrg    * NULL before the pipe context is destroyed, and that log context functions
838b8e80941Smrg    * are only called from the driver thread.
839b8e80941Smrg    *
840b8e80941Smrg    * \param ctx pipe context
841b8e80941Smrg    * \param log logging context
842b8e80941Smrg    */
843b8e80941Smrg   void (*set_log_context)(struct pipe_context *ctx, struct u_log_context *log);
844b8e80941Smrg
845b8e80941Smrg   /**
846b8e80941Smrg    * Emit string marker in cmdstream
847b8e80941Smrg    */
848b8e80941Smrg   void (*emit_string_marker)(struct pipe_context *ctx,
849b8e80941Smrg                              const char *string,
850b8e80941Smrg                              int len);
851b8e80941Smrg
852b8e80941Smrg   /**
853b8e80941Smrg    * Generate mipmap.
854b8e80941Smrg    * \return TRUE if mipmap generation succeeds, FALSE otherwise
855b8e80941Smrg    */
856b8e80941Smrg   boolean (*generate_mipmap)(struct pipe_context *ctx,
857b8e80941Smrg                              struct pipe_resource *resource,
858b8e80941Smrg                              enum pipe_format format,
859b8e80941Smrg                              unsigned base_level,
860b8e80941Smrg                              unsigned last_level,
861b8e80941Smrg                              unsigned first_layer,
862b8e80941Smrg                              unsigned last_layer);
863b8e80941Smrg
864b8e80941Smrg   /**
865b8e80941Smrg    * Create a 64-bit texture handle.
866b8e80941Smrg    *
867b8e80941Smrg    * \param ctx        pipe context
868b8e80941Smrg    * \param view       pipe sampler view object
869b8e80941Smrg    * \param state      pipe sampler state template
870b8e80941Smrg    * \return           a 64-bit texture handle if success, 0 otherwise
871b8e80941Smrg    */
872b8e80941Smrg   uint64_t (*create_texture_handle)(struct pipe_context *ctx,
873b8e80941Smrg                                     struct pipe_sampler_view *view,
874b8e80941Smrg                                     const struct pipe_sampler_state *state);
875b8e80941Smrg
876b8e80941Smrg   /**
877b8e80941Smrg    * Delete a texture handle.
878b8e80941Smrg    *
879b8e80941Smrg    * \param ctx        pipe context
880b8e80941Smrg    * \param handle     64-bit texture handle
881b8e80941Smrg    */
882b8e80941Smrg   void (*delete_texture_handle)(struct pipe_context *ctx, uint64_t handle);
883b8e80941Smrg
884b8e80941Smrg   /**
885b8e80941Smrg    * Make a texture handle resident.
886b8e80941Smrg    *
887b8e80941Smrg    * \param ctx        pipe context
888b8e80941Smrg    * \param handle     64-bit texture handle
889b8e80941Smrg    * \param resident   TRUE for resident, FALSE otherwise
890b8e80941Smrg    */
891b8e80941Smrg   void (*make_texture_handle_resident)(struct pipe_context *ctx,
892b8e80941Smrg                                        uint64_t handle, bool resident);
893b8e80941Smrg
894b8e80941Smrg   /**
895b8e80941Smrg    * Create a 64-bit image handle.
896b8e80941Smrg    *
897b8e80941Smrg    * \param ctx        pipe context
898b8e80941Smrg    * \param image      pipe image view template
899b8e80941Smrg    * \return           a 64-bit image handle if success, 0 otherwise
900b8e80941Smrg    */
901b8e80941Smrg   uint64_t (*create_image_handle)(struct pipe_context *ctx,
902b8e80941Smrg                                   const struct pipe_image_view *image);
903b8e80941Smrg
904b8e80941Smrg   /**
905b8e80941Smrg    * Delete an image handle.
906b8e80941Smrg    *
907b8e80941Smrg    * \param ctx        pipe context
908b8e80941Smrg    * \param handle     64-bit image handle
909b8e80941Smrg    */
910b8e80941Smrg   void (*delete_image_handle)(struct pipe_context *ctx, uint64_t handle);
911b8e80941Smrg
912b8e80941Smrg   /**
913b8e80941Smrg    * Make an image handle resident.
914b8e80941Smrg    *
915b8e80941Smrg    * \param ctx        pipe context
916b8e80941Smrg    * \param handle     64-bit image handle
917b8e80941Smrg    * \param access     GL_READ_ONLY, GL_WRITE_ONLY or GL_READ_WRITE
918b8e80941Smrg    * \param resident   TRUE for resident, FALSE otherwise
919b8e80941Smrg    */
920b8e80941Smrg   void (*make_image_handle_resident)(struct pipe_context *ctx, uint64_t handle,
921b8e80941Smrg                                      unsigned access, bool resident);
922b8e80941Smrg
923b8e80941Smrg   /**
924b8e80941Smrg    * Call the given function from the driver thread.
925b8e80941Smrg    *
926b8e80941Smrg    * This is set by threaded contexts for use by debugging wrappers.
927b8e80941Smrg    *
928b8e80941Smrg    * \param asap if true, run the callback immediately if there are no pending
929b8e80941Smrg    *             commands to be processed by the driver thread
930b8e80941Smrg    */
931b8e80941Smrg   void (*callback)(struct pipe_context *ctx, void (*fn)(void *), void *data,
932b8e80941Smrg                    bool asap);
933b8e80941Smrg
934b8e80941Smrg   /**
935b8e80941Smrg    * Set a context parameter See enum pipe_context_param for more details.
936b8e80941Smrg    */
937b8e80941Smrg   void (*set_context_param)(struct pipe_context *ctx,
938b8e80941Smrg                             enum pipe_context_param param,
939b8e80941Smrg                             unsigned value);
940848b8605Smrg};
941848b8605Smrg
942848b8605Smrg
943848b8605Smrg#ifdef __cplusplus
944848b8605Smrg}
945848b8605Smrg#endif
946848b8605Smrg
947848b8605Smrg#endif /* PIPE_CONTEXT_H */
948