glsl2: Add and use new variable mode ir_var_temporary
[mesa/nouveau-pmpeg.git] / src / gallium / state_trackers / vega / st_inlines.h
blob7eaa67c76ae2faa4fa1529b60796ae0bf3981ae0
1 /**************************************************************************
2 *
3 * Copyright 2009 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:
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.
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.
26 **************************************************************************/
28 /**
29 * Functions for checking if buffers/textures are referenced when we need
30 * to read/write from/to them. Flush when needed.
33 #ifndef ST_INLINES_H
34 #define ST_INLINES_H
36 #include "vg_context.h"
38 #include "pipe/p_context.h"
39 #include "pipe/p_screen.h"
40 #include "pipe/p_defines.h"
41 #include "util/u_inlines.h"
42 #include "pipe/p_state.h"
44 static INLINE struct pipe_transfer *
45 st_cond_flush_get_transfer(struct vg_context *st,
46 struct pipe_resource *pt,
47 unsigned int face,
48 unsigned int level,
49 unsigned int zslice,
50 enum pipe_transfer_usage usage,
51 unsigned int x, unsigned int y,
52 unsigned int w, unsigned int h)
54 struct pipe_context *pipe = st->pipe;
56 return pipe_get_transfer(pipe, pt, face, level, zslice, usage,
57 x, y, w, h);
60 static INLINE struct pipe_transfer *
61 st_no_flush_get_transfer(struct vg_context *st,
62 struct pipe_resource *pt,
63 unsigned int face,
64 unsigned int level,
65 unsigned int zslice,
66 enum pipe_transfer_usage usage,
67 unsigned int x, unsigned int y,
68 unsigned int w, unsigned int h)
70 struct pipe_context *pipe = st->pipe;
72 return pipe_get_transfer(pipe, pt, face, level,
73 zslice, usage, x, y, w, h);
77 static INLINE void
78 st_cond_flush_pipe_buffer_write(struct vg_context *st,
79 struct pipe_resource *buf,
80 unsigned int offset,
81 unsigned int size,
82 const void * data)
84 struct pipe_context *pipe = st->pipe;
86 pipe_buffer_write(pipe, buf, offset, size, data);
89 static INLINE void
90 st_no_flush_pipe_buffer_write(struct vg_context *st,
91 struct pipe_resource *buf,
92 unsigned int offset,
93 unsigned int size,
94 const void * data)
96 pipe_buffer_write(st->pipe, buf, offset, size, data);
99 static INLINE void
100 st_cond_flush_pipe_buffer_read(struct vg_context *st,
101 struct pipe_resource *buf,
102 unsigned int offset,
103 unsigned int size,
104 void * data)
106 struct pipe_context *pipe = st->pipe;
108 pipe_buffer_read(pipe, buf, offset, size, data);
111 static INLINE void
112 st_no_flush_pipe_buffer_read(struct vg_context *st,
113 struct pipe_resource *buf,
114 unsigned int offset,
115 unsigned int size,
116 void * data)
118 pipe_buffer_read(st->pipe, buf, offset, size, data);
121 #endif