2 * Copyright © 2016 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
28 #include "shader_enums.h"
35 struct spirv_supported_capabilities
{
38 bool derivative_group
;
39 bool descriptor_array_dynamic_indexing
;
40 bool descriptor_array_non_uniform_indexing
;
41 bool descriptor_indexing
;
45 bool fragment_shader_sample_interlock
;
46 bool fragment_shader_pixel_interlock
;
47 bool geometry_streams
;
49 bool image_read_without_format
;
50 bool image_write_without_format
;
58 bool physical_storage_buffer_address
;
59 bool post_depth_coverage
;
60 bool runtime_descriptor_array
;
61 bool shader_viewport_index_layer
;
65 bool storage_image_ms
;
66 bool subgroup_arithmetic
;
70 bool subgroup_shuffle
;
73 bool transform_feedback
;
74 bool variable_pointers
;
77 bool amd_shader_ballot
;
78 bool amd_trinary_minmax
;
81 typedef struct shader_info
{
84 /* Descriptive name provided by the client; may be NULL */
87 /** The shader stage, such as MESA_SHADER_VERTEX. */
88 gl_shader_stage stage
;
90 /** The shader stage in a non SSO linked program that follows this stage,
91 * such as MESA_SHADER_FRAGMENT.
93 gl_shader_stage next_stage
;
95 /* Number of textures used by this shader */
96 unsigned num_textures
;
97 /* Number of uniform buffers used by this shader */
99 /* Number of atomic buffers used by this shader */
101 /* Number of shader storage buffers used by this shader */
103 /* Number of images used by this shader */
106 /* Which inputs are actually read */
107 uint64_t inputs_read
;
108 /* Which outputs are actually written */
109 uint64_t outputs_written
;
110 /* Which outputs are actually read */
111 uint64_t outputs_read
;
112 /* Which system values are actually read */
113 uint64_t system_values_read
;
115 /* Which patch inputs are actually read */
116 uint32_t patch_inputs_read
;
117 /* Which patch outputs are actually written */
118 uint32_t patch_outputs_written
;
119 /* Which patch outputs are read */
120 uint32_t patch_outputs_read
;
122 /* Whether or not this shader ever uses textureGather() */
123 bool uses_texture_gather
;
125 /** Bitfield of which textures are used */
126 uint32_t textures_used
;
128 /** Bitfield of which textures are used by texelFetch() */
129 uint32_t textures_used_by_txf
;
132 * True if this shader uses the fddx/fddy opcodes.
134 * Note that this does not include the "fine" and "coarse" variants.
139 * True if this shader uses 64-bit ALU operations
143 /* The size of the gl_ClipDistance[] array, if declared. */
144 unsigned clip_distance_array_size
;
146 /* The size of the gl_CullDistance[] array, if declared. */
147 unsigned cull_distance_array_size
;
149 /* Whether or not separate shader objects were used */
150 bool separate_shader
;
152 /** Was this shader linked with any transform feedback varyings? */
153 bool has_transform_feedback_varyings
;
157 /* Which inputs are doubles */
158 uint64_t double_inputs
;
160 /* True if the shader writes position in window space coordinates pre-transform */
161 bool window_space_position
;
165 /** The number of vertices recieves per input primitive */
166 unsigned vertices_in
;
168 /** The output primitive type (GL enum value) */
169 unsigned output_primitive
;
171 /** The input primitive type (GL enum value) */
172 unsigned input_primitive
;
174 /** The maximum number of vertices the geometry shader might write. */
175 unsigned vertices_out
;
177 /** 1 .. MAX_GEOMETRY_SHADER_INVOCATIONS */
178 unsigned invocations
;
180 /** Whether or not this shader uses EndPrimitive */
181 bool uses_end_primitive
;
183 /** Whether or not this shader uses non-zero streams */
191 * Whether any inputs are declared with the "sample" qualifier.
193 bool uses_sample_qualifier
;
196 * Whether early fragment tests are enabled as defined by
197 * ARB_shader_image_load_store.
199 bool early_fragment_tests
;
202 * Defined by INTEL_conservative_rasterization.
206 bool post_depth_coverage
;
209 * \name ARB_fragment_coord_conventions
212 bool pixel_center_integer
;
213 bool origin_upper_left
;
216 bool pixel_interlock_ordered
;
217 bool pixel_interlock_unordered
;
218 bool sample_interlock_ordered
;
219 bool sample_interlock_unordered
;
222 * Flags whether NIR's base types on the FS color outputs should be
225 * GLSL requires that fragment shader output base types match the
226 * render target's base types for the behavior to be defined. From
229 * "If the values written by the fragment shader do not match the
230 * format(s) of the corresponding color buffer(s), the result is
233 * However, for NIR shaders translated from TGSI, we don't have the
234 * output types any more, so the driver will need to do whatever
235 * fixups are necessary to handle effectively untyped data being
236 * output from the FS.
238 bool untyped_color_outputs
;
240 /** gl_FragDepth layout for ARB_conservative_depth. */
241 enum gl_frag_depth_layout depth_layout
;
245 unsigned local_size
[3];
247 bool local_size_variable
;
250 * Size of shared variables accessed by the compute shader.
252 unsigned shared_size
;
257 * AddressingModelLogical: 0 (default)
258 * AddressingModelPhysical32: 32
259 * AddressingModelPhysical64: 64
264 * Arrangement of invocations used to calculate derivatives in a compute
265 * shader. From NV_compute_shader_derivatives.
267 enum gl_derivative_group derivative_group
;
270 /* Applies to both TCS and TES. */
272 /** The number of vertices in the TCS output patch. */
273 unsigned tcs_vertices_out
;
275 uint32_t primitive_mode
; /* GL_TRIANGLES, GL_QUADS or GL_ISOLINES */
276 enum gl_tess_spacing spacing
;
277 /** Is the vertex order counterclockwise? */
288 #endif /* SHADER_INFO_H */