1 /**************************************************************************
3 * Copyright 2003 VMware, Inc.
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
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 **************************************************************************/
30 * Keith Whitwell <keithw@vmware.com>
37 #include "main/glheader.h"
40 struct st_vertex_program
;
41 struct st_common_variant
;
42 struct pipe_vertex_buffer
;
43 struct pipe_vertex_element
;
44 struct cso_velems_state
;
47 * Enumeration of state tracker pipelines.
53 ST_PIPELINE_UPDATE_FRAMEBUFFER
,
57 void st_init_atoms( struct st_context
*st
);
58 void st_destroy_atoms( struct st_context
*st
);
59 void st_validate_state( struct st_context
*st
, enum st_pipeline pipeline
);
60 GLuint
st_compare_func_to_pipe(GLenum func
);
63 st_setup_arrays(struct st_context
*st
,
64 const struct st_vertex_program
*vp
,
65 const struct st_common_variant
*vp_variant
,
66 struct cso_velems_state
*velements
,
67 struct pipe_vertex_buffer
*vbuffer
, unsigned *num_vbuffers
,
68 bool *has_user_vertex_buffers
);
71 st_setup_current_user(struct st_context
*st
,
72 const struct st_vertex_program
*vp
,
73 const struct st_common_variant
*vp_variant
,
74 struct cso_velems_state
*velements
,
75 struct pipe_vertex_buffer
*vbuffer
, unsigned *num_vbuffers
);
77 /* Define ST_NEW_xxx_INDEX */
79 #define ST_STATE(FLAG, st_update) FLAG##_INDEX,
80 #include "st_atom_list.h"
84 /* Define ST_NEW_xxx values as static const uint64_t values.
85 * We can't use an enum type because MSVC doesn't allow 64-bit enum values.
87 #define ST_STATE(FLAG, st_update) static const uint64_t FLAG = 1ull << FLAG##_INDEX;
88 #include "st_atom_list.h"
91 /* Declare function prototypes. */
92 #define ST_STATE(FLAG, st_update) void st_update(struct st_context *st);
93 #include "st_atom_list.h"
96 /* Combined state flags. */
97 #define ST_NEW_SAMPLERS (ST_NEW_VS_SAMPLERS | \
98 ST_NEW_TCS_SAMPLERS | \
99 ST_NEW_TES_SAMPLERS | \
100 ST_NEW_GS_SAMPLERS | \
101 ST_NEW_FS_SAMPLERS | \
104 #define ST_NEW_FRAMEBUFFER (ST_NEW_FB_STATE | \
105 ST_NEW_SAMPLE_STATE | \
106 ST_NEW_SAMPLE_SHADING)
108 #define ST_NEW_VERTEX_PROGRAM(st, p) ((p)->affected_states | \
109 (st_user_clip_planes_enabled(st->ctx) ? \
110 ST_NEW_CLIP_STATE : 0))
112 #define ST_NEW_CONSTANTS (ST_NEW_VS_CONSTANTS | \
113 ST_NEW_TCS_CONSTANTS | \
114 ST_NEW_TES_CONSTANTS | \
115 ST_NEW_FS_CONSTANTS | \
116 ST_NEW_GS_CONSTANTS | \
119 #define ST_NEW_UNIFORM_BUFFER (ST_NEW_VS_UBOS | \
126 #define ST_NEW_SAMPLER_VIEWS (ST_NEW_VS_SAMPLER_VIEWS | \
127 ST_NEW_FS_SAMPLER_VIEWS | \
128 ST_NEW_GS_SAMPLER_VIEWS | \
129 ST_NEW_TCS_SAMPLER_VIEWS | \
130 ST_NEW_TES_SAMPLER_VIEWS | \
131 ST_NEW_CS_SAMPLER_VIEWS)
133 #define ST_NEW_ATOMIC_BUFFER (ST_NEW_VS_ATOMICS | \
134 ST_NEW_TCS_ATOMICS | \
135 ST_NEW_TES_ATOMICS | \
136 ST_NEW_FS_ATOMICS | \
137 ST_NEW_GS_ATOMICS | \
140 #define ST_NEW_STORAGE_BUFFER (ST_NEW_VS_SSBOS | \
147 #define ST_NEW_IMAGE_UNITS (ST_NEW_VS_IMAGES | \
148 ST_NEW_TCS_IMAGES | \
149 ST_NEW_TES_IMAGES | \
154 #define ST_ALL_SHADER_RESOURCES (ST_NEW_SAMPLER_VIEWS | \
157 ST_NEW_UNIFORM_BUFFER | \
158 ST_NEW_ATOMIC_BUFFER | \
159 ST_NEW_STORAGE_BUFFER | \
162 /* All state flags within each group: */
163 #define ST_PIPELINE_RENDER_STATE_MASK (ST_NEW_CS_STATE - 1)
164 #define ST_PIPELINE_COMPUTE_STATE_MASK (0xffull << ST_NEW_CS_STATE_INDEX)
165 #define ST_PIPELINE_CLEAR_STATE_MASK (ST_NEW_FB_STATE | \
167 ST_NEW_WINDOW_RECTANGLES)
168 #define ST_PIPELINE_META_STATE_MASK (ST_PIPELINE_RENDER_STATE_MASK & \
169 ~ST_NEW_VERTEX_ARRAYS)
170 /* For ReadPixels, ReadBuffer, GetSamplePosition: */
171 #define ST_PIPELINE_UPDATE_FB_STATE_MASK (ST_NEW_FB_STATE)
173 #define ST_ALL_STATES_MASK (ST_PIPELINE_RENDER_STATE_MASK | \
174 ST_PIPELINE_COMPUTE_STATE_MASK)