gallium: Mute arrays for several meta like callbacks.
[mesa.git] / src / mesa / state_tracker / st_atom.h
1 /**************************************************************************
2 *
3 * Copyright 2003 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 * Authors:
30 * Keith Whitwell <keithw@vmware.com>
31 */
32
33
34 #ifndef ST_ATOM_H
35 #define ST_ATOM_H
36
37 #include "main/glheader.h"
38
39 struct st_context;
40
41 /**
42 * Enumeration of state tracker pipelines.
43 */
44 enum st_pipeline {
45 ST_PIPELINE_RENDER,
46 ST_PIPELINE_CLEAR,
47 ST_PIPELINE_META,
48 ST_PIPELINE_UPDATE_FRAMEBUFFER,
49 ST_PIPELINE_COMPUTE,
50 };
51
52 void st_init_atoms( struct st_context *st );
53 void st_destroy_atoms( struct st_context *st );
54 void st_validate_state( struct st_context *st, enum st_pipeline pipeline );
55 GLuint st_compare_func_to_pipe(GLenum func);
56
57 enum pipe_format
58 st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
59 GLboolean normalized, GLboolean integer);
60
61
62 /* Define ST_NEW_xxx_INDEX */
63 enum {
64 #define ST_STATE(FLAG, st_update) FLAG##_INDEX,
65 #include "st_atom_list.h"
66 #undef ST_STATE
67 };
68
69 /* Define ST_NEW_xxx values as static const uint64_t values.
70 * We can't use an enum type because MSVC doesn't allow 64-bit enum values.
71 */
72 #define ST_STATE(FLAG, st_update) static const uint64_t FLAG = 1ull << FLAG##_INDEX;
73 #include "st_atom_list.h"
74 #undef ST_STATE
75
76 /* Declare function prototypes. */
77 #define ST_STATE(FLAG, st_update) void st_update(struct st_context *st);
78 #include "st_atom_list.h"
79 #undef ST_STATE
80
81 /* Combined state flags. */
82 #define ST_NEW_SAMPLERS (ST_NEW_VS_SAMPLERS | \
83 ST_NEW_TCS_SAMPLERS | \
84 ST_NEW_TES_SAMPLERS | \
85 ST_NEW_GS_SAMPLERS | \
86 ST_NEW_FS_SAMPLERS | \
87 ST_NEW_CS_SAMPLERS)
88
89 #define ST_NEW_FRAMEBUFFER (ST_NEW_FB_STATE | \
90 ST_NEW_SAMPLE_MASK | \
91 ST_NEW_SAMPLE_SHADING)
92
93 #define ST_NEW_VERTEX_PROGRAM(st, p) (p->affected_states | \
94 (st_user_clip_planes_enabled(st->ctx) ? \
95 ST_NEW_CLIP_STATE : 0))
96
97 #define ST_NEW_CONSTANTS (ST_NEW_VS_CONSTANTS | \
98 ST_NEW_TCS_CONSTANTS | \
99 ST_NEW_TES_CONSTANTS | \
100 ST_NEW_FS_CONSTANTS | \
101 ST_NEW_GS_CONSTANTS | \
102 ST_NEW_CS_CONSTANTS)
103
104 #define ST_NEW_UNIFORM_BUFFER (ST_NEW_VS_UBOS | \
105 ST_NEW_TCS_UBOS | \
106 ST_NEW_TES_UBOS | \
107 ST_NEW_FS_UBOS | \
108 ST_NEW_GS_UBOS | \
109 ST_NEW_CS_UBOS)
110
111 #define ST_NEW_SAMPLER_VIEWS (ST_NEW_VS_SAMPLER_VIEWS | \
112 ST_NEW_FS_SAMPLER_VIEWS | \
113 ST_NEW_GS_SAMPLER_VIEWS | \
114 ST_NEW_TCS_SAMPLER_VIEWS | \
115 ST_NEW_TES_SAMPLER_VIEWS | \
116 ST_NEW_CS_SAMPLER_VIEWS)
117
118 #define ST_NEW_ATOMIC_BUFFER (ST_NEW_VS_ATOMICS | \
119 ST_NEW_TCS_ATOMICS | \
120 ST_NEW_TES_ATOMICS | \
121 ST_NEW_FS_ATOMICS | \
122 ST_NEW_GS_ATOMICS | \
123 ST_NEW_CS_ATOMICS)
124
125 #define ST_NEW_STORAGE_BUFFER (ST_NEW_VS_SSBOS | \
126 ST_NEW_TCS_SSBOS | \
127 ST_NEW_TES_SSBOS | \
128 ST_NEW_FS_SSBOS | \
129 ST_NEW_GS_SSBOS | \
130 ST_NEW_CS_SSBOS)
131
132 #define ST_NEW_IMAGE_UNITS (ST_NEW_VS_IMAGES | \
133 ST_NEW_TCS_IMAGES | \
134 ST_NEW_TES_IMAGES | \
135 ST_NEW_GS_IMAGES | \
136 ST_NEW_FS_IMAGES | \
137 ST_NEW_CS_IMAGES)
138
139 #define ST_ALL_SHADER_RESOURCES (ST_NEW_SAMPLER_VIEWS | \
140 ST_NEW_SAMPLERS | \
141 ST_NEW_CONSTANTS | \
142 ST_NEW_UNIFORM_BUFFER | \
143 ST_NEW_ATOMIC_BUFFER | \
144 ST_NEW_STORAGE_BUFFER | \
145 ST_NEW_IMAGE_UNITS)
146
147 /* All state flags within each group: */
148 #define ST_PIPELINE_RENDER_STATE_MASK (ST_NEW_CS_STATE - 1)
149 #define ST_PIPELINE_COMPUTE_STATE_MASK (0xffull << ST_NEW_CS_STATE_INDEX)
150 #define ST_PIPELINE_CLEAR_STATE_MASK (ST_NEW_FB_STATE | \
151 ST_NEW_SCISSOR | \
152 ST_NEW_WINDOW_RECTANGLES)
153 #define ST_PIPELINE_META_STATE_MASK (ST_PIPELINE_RENDER_STATE_MASK & \
154 ~ST_NEW_VERTEX_ARRAYS)
155 /* For ReadPixels, ReadBuffer, GetSamplePosition: */
156 #define ST_PIPELINE_UPDATE_FB_STATE_MASK (ST_NEW_FB_STATE)
157
158 #define ST_ALL_STATES_MASK (ST_PIPELINE_RENDER_STATE_MASK | \
159 ST_PIPELINE_COMPUTE_STATE_MASK)
160
161 #endif