Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2016 Intel Corporation |
| 3 | * |
| 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: |
| 10 | * |
| 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 |
| 13 | * Software. |
| 14 | * |
| 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 |
| 21 | * IN THE SOFTWARE. |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #ifndef SHADER_INFO_H |
| 26 | #define SHADER_INFO_H |
| 27 | |
Timothy Arceri | 29ade71 | 2016-11-16 14:02:11 +1100 | [diff] [blame] | 28 | #include "shader_enums.h" |
Jordan Justen | ebd9e78 | 2017-10-27 01:04:53 -0700 | [diff] [blame] | 29 | #include <stdint.h> |
Timothy Arceri | 29ade71 | 2016-11-16 14:02:11 +1100 | [diff] [blame] | 30 | |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 31 | #ifdef __cplusplus |
| 32 | extern "C" { |
| 33 | #endif |
| 34 | |
Marek Olšák | 3f1b35a | 2020-09-29 17:34:28 -0400 | [diff] [blame] | 35 | #define MAX_INLINABLE_UNIFORMS 4 |
| 36 | |
Alejandro Piñeiro | 25e56b2 | 2017-12-07 09:38:41 +0100 | [diff] [blame] | 37 | struct spirv_supported_capabilities { |
Rob Clark | fa73704 | 2018-02-26 18:01:02 -0500 | [diff] [blame] | 38 | bool address; |
Jason Ekstrand | 05d72d6 | 2019-01-07 10:28:23 -0600 | [diff] [blame] | 39 | bool atomic_storage; |
Caio Marcelo de Oliveira Filho | 1a83c9a | 2019-06-07 23:08:04 -0700 | [diff] [blame] | 40 | bool demote_to_helper_invocation; |
Caio Marcelo de Oliveira Filho | bd73531 | 2019-03-28 10:23:02 -0700 | [diff] [blame] | 41 | bool derivative_group; |
Jason Ekstrand | 05d72d6 | 2019-01-07 10:28:23 -0600 | [diff] [blame] | 42 | bool descriptor_array_dynamic_indexing; |
Juan A. Suarez Romero | bbbe00a | 2019-04-29 17:02:45 +0200 | [diff] [blame] | 43 | bool descriptor_array_non_uniform_indexing; |
| 44 | bool descriptor_indexing; |
Jason Ekstrand | ff9db1a | 2017-09-21 15:51:55 -0700 | [diff] [blame] | 45 | bool device_group; |
Alejandro Piñeiro | 25e56b2 | 2017-12-07 09:38:41 +0100 | [diff] [blame] | 46 | bool draw_parameters; |
Jason Ekstrand | 84086b6 | 2020-05-19 10:19:55 -0500 | [diff] [blame] | 47 | bool float32_atomic_add; |
Jason Ekstrand | 05d72d6 | 2019-01-07 10:28:23 -0600 | [diff] [blame] | 48 | bool float64; |
Jason Ekstrand | 84086b6 | 2020-05-19 10:19:55 -0500 | [diff] [blame] | 49 | bool float64_atomic_add; |
Jason Ekstrand | 5176805 | 2019-05-17 11:32:10 -0500 | [diff] [blame] | 50 | bool fragment_shader_sample_interlock; |
| 51 | bool fragment_shader_pixel_interlock; |
Jason Ekstrand | 05d72d6 | 2019-01-07 10:28:23 -0600 | [diff] [blame] | 52 | bool geometry_streams; |
Jason Ekstrand | 05d72d6 | 2019-01-07 10:28:23 -0600 | [diff] [blame] | 53 | bool image_ms_array; |
Alejandro Piñeiro | 25e56b2 | 2017-12-07 09:38:41 +0100 | [diff] [blame] | 54 | bool image_read_without_format; |
| 55 | bool image_write_without_format; |
Rob Clark | fa73704 | 2018-02-26 18:01:02 -0500 | [diff] [blame] | 56 | bool int8; |
Jason Ekstrand | 05d72d6 | 2019-01-07 10:28:23 -0600 | [diff] [blame] | 57 | bool int16; |
Alejandro Piñeiro | 25e56b2 | 2017-12-07 09:38:41 +0100 | [diff] [blame] | 58 | bool int64; |
Jason Ekstrand | 05d72d6 | 2019-01-07 10:28:23 -0600 | [diff] [blame] | 59 | bool int64_atomics; |
Ian Romanick | 4fcddb5 | 2018-09-24 06:46:48 -0700 | [diff] [blame] | 60 | bool integer_functions2; |
Rob Clark | fa73704 | 2018-02-26 18:01:02 -0500 | [diff] [blame] | 61 | bool kernel; |
Jesse Natalie | de36b5b | 2020-04-13 08:05:13 -0700 | [diff] [blame] | 62 | bool kernel_image; |
Jesse Natalie | b778e7b | 2020-05-01 10:47:58 -0700 | [diff] [blame] | 63 | bool literal_sampler; |
Jason Ekstrand | caeffe7 | 2018-10-02 21:15:47 -0500 | [diff] [blame] | 64 | bool min_lod; |
Alejandro Piñeiro | 25e56b2 | 2017-12-07 09:38:41 +0100 | [diff] [blame] | 65 | bool multiview; |
Jason Ekstrand | 86e5f76 | 2019-01-19 10:23:28 -0600 | [diff] [blame] | 66 | bool physical_storage_buffer_address; |
Jason Ekstrand | 05d72d6 | 2019-01-07 10:28:23 -0600 | [diff] [blame] | 67 | bool post_depth_coverage; |
| 68 | bool runtime_descriptor_array; |
Samuel Iglesias Gonsálvez | 420ad0a | 2018-05-31 11:50:54 +0200 | [diff] [blame] | 69 | bool float_controls; |
Caio Marcelo de Oliveira Filho | f20cea0 | 2019-04-19 12:15:16 -0700 | [diff] [blame] | 70 | bool shader_clock; |
Caio Marcelo de Oliveira Filho | c178085 | 2018-03-05 13:58:11 -0800 | [diff] [blame] | 71 | bool shader_viewport_index_layer; |
Jason Ekstrand | 05d72d6 | 2019-01-07 10:28:23 -0600 | [diff] [blame] | 72 | bool stencil_export; |
| 73 | bool storage_8bit; |
| 74 | bool storage_16bit; |
| 75 | bool storage_image_ms; |
Jason Ekstrand | 57bff0a | 2017-08-29 20:10:35 -0700 | [diff] [blame] | 76 | bool subgroup_arithmetic; |
Jason Ekstrand | 9812fce | 2017-08-22 16:53:05 -0700 | [diff] [blame] | 77 | bool subgroup_ballot; |
Jason Ekstrand | adc0777 | 2017-04-28 04:45:50 -0700 | [diff] [blame] | 78 | bool subgroup_basic; |
Jason Ekstrand | b3a5b0f | 2017-08-29 10:21:31 -0700 | [diff] [blame] | 79 | bool subgroup_quad; |
Jason Ekstrand | 8256ee3 | 2017-08-29 09:44:44 -0700 | [diff] [blame] | 80 | bool subgroup_shuffle; |
Jason Ekstrand | d792f3d | 2017-08-24 11:01:22 -0700 | [diff] [blame] | 81 | bool subgroup_vote; |
Jason Ekstrand | 05d72d6 | 2019-01-07 10:28:23 -0600 | [diff] [blame] | 82 | bool tessellation; |
Alejandro Piñeiro | d690275 | 2018-07-13 13:34:08 +0200 | [diff] [blame] | 83 | bool transform_feedback; |
Jason Ekstrand | 05d72d6 | 2019-01-07 10:28:23 -0600 | [diff] [blame] | 84 | bool variable_pointers; |
Caio Marcelo de Oliveira Filho | c022043 | 2019-09-10 12:38:00 -0700 | [diff] [blame] | 85 | bool vk_memory_model; |
| 86 | bool vk_memory_model_device_scope; |
Samuel Pitoiset | bbe8feb | 2019-04-12 08:53:35 +0200 | [diff] [blame] | 87 | bool float16; |
Samuel Pitoiset | dea29b3 | 2019-05-16 12:25:40 +0200 | [diff] [blame] | 88 | bool amd_fragment_mask; |
Daniel Schürmann | 7a858f2 | 2018-05-09 20:41:23 +0200 | [diff] [blame] | 89 | bool amd_gcn_shader; |
| 90 | bool amd_shader_ballot; |
| 91 | bool amd_trinary_minmax; |
Samuel Pitoiset | 37bfd85 | 2020-01-03 11:49:24 +0100 | [diff] [blame] | 92 | bool amd_image_read_write_lod; |
Samuel Pitoiset | 531a26d | 2020-01-24 10:55:55 +0100 | [diff] [blame] | 93 | bool amd_shader_explicit_vertex_parameter; |
Samuel Pitoiset | dd39bf5 | 2020-05-19 14:50:57 +0200 | [diff] [blame] | 94 | bool amd_image_gather_bias_lod; |
Daniel Schürmann | 68a6a3b | 2018-02-23 13:54:59 +0100 | [diff] [blame] | 95 | }; |
| 96 | |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 97 | typedef struct shader_info { |
| 98 | const char *name; |
| 99 | |
| 100 | /* Descriptive name provided by the client; may be NULL */ |
| 101 | const char *label; |
| 102 | |
Jesse Natalie | 93db59e | 2020-08-26 14:22:07 -0700 | [diff] [blame] | 103 | /* Shader is internal, and should be ignored by things like NIR_PRINT */ |
| 104 | bool internal; |
| 105 | |
Timothy Arceri | 3ea3f75 | 2017-08-23 09:10:27 +1000 | [diff] [blame] | 106 | /** The shader stage, such as MESA_SHADER_VERTEX. */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 107 | gl_shader_stage stage:8; |
Timothy Arceri | 3ea3f75 | 2017-08-23 09:10:27 +1000 | [diff] [blame] | 108 | |
Timothy Arceri | 2ca5d95 | 2018-02-26 20:40:38 +1100 | [diff] [blame] | 109 | /** The shader stage in a non SSO linked program that follows this stage, |
| 110 | * such as MESA_SHADER_FRAGMENT. |
| 111 | */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 112 | gl_shader_stage next_stage:8; |
Timothy Arceri | 2ca5d95 | 2018-02-26 20:40:38 +1100 | [diff] [blame] | 113 | |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 114 | /* Number of textures used by this shader */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 115 | uint8_t num_textures; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 116 | /* Number of uniform buffers used by this shader */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 117 | uint8_t num_ubos; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 118 | /* Number of atomic buffers used by this shader */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 119 | uint8_t num_abos; |
Eric Anholt | 7558b5d | 2019-12-30 12:01:25 -0800 | [diff] [blame] | 120 | /* Number of shader storage buffers (max .driver_location + 1) used by this |
| 121 | * shader. In the case of nir_lower_atomics_to_ssbo being used, this will |
| 122 | * be the number of actual SSBOs in gl_program->info, and the lowered SSBOs |
| 123 | * and atomic counters in nir_shader->info. |
| 124 | */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 125 | uint8_t num_ssbos; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 126 | /* Number of images used by this shader */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 127 | uint8_t num_images; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 128 | |
| 129 | /* Which inputs are actually read */ |
| 130 | uint64_t inputs_read; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 131 | /* Which outputs are actually written */ |
| 132 | uint64_t outputs_written; |
| 133 | /* Which outputs are actually read */ |
| 134 | uint64_t outputs_read; |
| 135 | /* Which system values are actually read */ |
| 136 | uint64_t system_values_read; |
| 137 | |
| 138 | /* Which patch inputs are actually read */ |
| 139 | uint32_t patch_inputs_read; |
| 140 | /* Which patch outputs are actually written */ |
| 141 | uint32_t patch_outputs_written; |
Dave Airlie | 33dca36 | 2017-11-14 15:10:44 +1000 | [diff] [blame] | 142 | /* Which patch outputs are read */ |
| 143 | uint32_t patch_outputs_read; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 144 | |
Timur Kristóf | f1dd81a | 2020-03-13 10:14:37 +0100 | [diff] [blame] | 145 | /* Which inputs are read indirectly (subset of inputs_read) */ |
| 146 | uint64_t inputs_read_indirectly; |
| 147 | /* Which outputs are read or written indirectly */ |
| 148 | uint64_t outputs_accessed_indirectly; |
| 149 | /* Which patch inputs are read indirectly (subset of patch_inputs_read) */ |
| 150 | uint64_t patch_inputs_read_indirectly; |
| 151 | /* Which patch outputs are read or written indirectly */ |
| 152 | uint64_t patch_outputs_accessed_indirectly; |
| 153 | |
Kenneth Graunke | f5c7df4 | 2019-01-13 10:39:41 -0800 | [diff] [blame] | 154 | /** Bitfield of which textures are used */ |
| 155 | uint32_t textures_used; |
| 156 | |
Kenneth Graunke | fbf4c29 | 2017-09-09 00:19:57 -0700 | [diff] [blame] | 157 | /** Bitfield of which textures are used by texelFetch() */ |
| 158 | uint32_t textures_used_by_txf; |
| 159 | |
Tapani Pälli | 5910c93 | 2020-02-19 08:33:04 +0200 | [diff] [blame] | 160 | /** Bitfield of which images are used */ |
| 161 | uint32_t images_used; |
Marek Olšák | 6503e4b | 2020-05-21 05:13:01 -0400 | [diff] [blame] | 162 | /** Bitfield of which images are buffers. */ |
| 163 | uint32_t image_buffers; |
Marek Olšák | cac24be | 2020-05-24 15:52:26 -0400 | [diff] [blame] | 164 | /** Bitfield of which images are MSAA. */ |
| 165 | uint32_t msaa_images; |
Tapani Pälli | 5910c93 | 2020-02-19 08:33:04 +0200 | [diff] [blame] | 166 | |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 167 | /* SPV_KHR_float_controls: execution mode for floating point ops */ |
| 168 | uint16_t float_controls_execution_mode; |
| 169 | |
Marek Olšák | 3f1b35a | 2020-09-29 17:34:28 -0400 | [diff] [blame] | 170 | uint16_t inlinable_uniform_dw_offsets[MAX_INLINABLE_UNIFORMS]; |
| 171 | uint8_t num_inlinable_uniforms:4; |
| 172 | |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 173 | /* The size of the gl_ClipDistance[] array, if declared. */ |
| 174 | uint8_t clip_distance_array_size:4; |
| 175 | |
| 176 | /* The size of the gl_CullDistance[] array, if declared. */ |
| 177 | uint8_t cull_distance_array_size:4; |
| 178 | |
| 179 | /* Whether or not this shader ever uses textureGather() */ |
| 180 | bool uses_texture_gather:1; |
| 181 | |
Kenneth Graunke | 86c68bb | 2017-10-26 15:19:25 -0700 | [diff] [blame] | 182 | /** |
| 183 | * True if this shader uses the fddx/fddy opcodes. |
| 184 | * |
| 185 | * Note that this does not include the "fine" and "coarse" variants. |
| 186 | */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 187 | bool uses_fddx_fddy:1; |
Kenneth Graunke | 86c68bb | 2017-10-26 15:19:25 -0700 | [diff] [blame] | 188 | |
Matt Turner | ecb115e | 2018-12-10 11:01:39 -0800 | [diff] [blame] | 189 | /** |
| 190 | * True if this shader uses 64-bit ALU operations |
| 191 | */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 192 | bool uses_64bit:1; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 193 | |
Marek Olšák | a0b711d | 2019-10-18 19:49:44 -0400 | [diff] [blame] | 194 | /* Whether the first UBO is the default uniform buffer, i.e. uniforms. */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 195 | bool first_ubo_is_default_ubo:1; |
Marek Olšák | a0b711d | 2019-10-18 19:49:44 -0400 | [diff] [blame] | 196 | |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 197 | /* Whether or not separate shader objects were used */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 198 | bool separate_shader:1; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 199 | |
| 200 | /** Was this shader linked with any transform feedback varyings? */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 201 | bool has_transform_feedback_varyings:1; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 202 | |
Marek Olšák | 4b4b383 | 2019-10-25 00:15:37 -0400 | [diff] [blame] | 203 | /* Whether flrp has been lowered. */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 204 | bool flrp_lowered:1; |
Samuel Iglesias Gonsálvez | 84781e1 | 2018-05-31 12:20:30 +0200 | [diff] [blame] | 205 | |
Marek Olšák | 4d36dce | 2020-08-14 19:13:52 -0400 | [diff] [blame] | 206 | /* Whether nir_lower_io has been called to lower derefs. |
| 207 | * nir_variables for inputs and outputs might not be present in the IR. |
| 208 | */ |
| 209 | bool io_lowered:1; |
| 210 | |
Marek Olšák | 85a7239 | 2020-03-10 23:27:35 -0400 | [diff] [blame] | 211 | /* Whether the shader writes memory, including transform feedback. */ |
| 212 | bool writes_memory:1; |
| 213 | |
Ilia Mirkin | cc6661b | 2020-04-10 16:02:09 -0400 | [diff] [blame] | 214 | /* Whether gl_Layer is viewport-relative */ |
| 215 | bool layer_viewport_relative:1; |
| 216 | |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 217 | union { |
| 218 | struct { |
Timothy Arceri | f63e05a | 2017-12-16 14:06:23 +1100 | [diff] [blame] | 219 | /* Which inputs are doubles */ |
| 220 | uint64_t double_inputs; |
Timur Kristóf | 317f10b | 2019-02-05 18:08:24 +0100 | [diff] [blame] | 221 | |
Marek Olšák | 028dbd3 | 2019-07-31 16:55:33 -0400 | [diff] [blame] | 222 | /* For AMD-specific driver-internal shaders. It replaces vertex |
| 223 | * buffer loads with code generating VS inputs from scalar registers. |
| 224 | * |
| 225 | * Valid values: SI_VS_BLIT_SGPRS_POS_* |
| 226 | */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 227 | uint8_t blit_sgprs_amd:4; |
Marek Olšák | 028dbd3 | 2019-07-31 16:55:33 -0400 | [diff] [blame] | 228 | |
Timur Kristóf | 317f10b | 2019-02-05 18:08:24 +0100 | [diff] [blame] | 229 | /* True if the shader writes position in window space coordinates pre-transform */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 230 | bool window_space_position:1; |
Timothy Arceri | f63e05a | 2017-12-16 14:06:23 +1100 | [diff] [blame] | 231 | } vs; |
| 232 | |
| 233 | struct { |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 234 | /** The output primitive type (GL enum value) */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 235 | uint16_t output_primitive; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 236 | |
Timothy Arceri | b99ecaf | 2016-10-13 15:16:49 +1100 | [diff] [blame] | 237 | /** The input primitive type (GL enum value) */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 238 | uint16_t input_primitive; |
Timothy Arceri | b99ecaf | 2016-10-13 15:16:49 +1100 | [diff] [blame] | 239 | |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 240 | /** The maximum number of vertices the geometry shader might write. */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 241 | uint16_t vertices_out; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 242 | |
| 243 | /** 1 .. MAX_GEOMETRY_SHADER_INVOCATIONS */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 244 | uint8_t invocations; |
| 245 | |
| 246 | /** The number of vertices recieves per input primitive (max. 6) */ |
| 247 | uint8_t vertices_in:3; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 248 | |
| 249 | /** Whether or not this shader uses EndPrimitive */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 250 | bool uses_end_primitive:1; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 251 | |
Louis-Francis Ratté-Boulianne | 7dcb1d2 | 2020-03-19 04:59:27 -0400 | [diff] [blame] | 252 | /** The streams used in this shaders (max. 4) */ |
| 253 | uint8_t active_stream_mask:4; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 254 | } gs; |
| 255 | |
| 256 | struct { |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 257 | bool uses_discard:1; |
Daniel Schürmann | 5adcfa6 | 2020-03-04 16:43:15 +0100 | [diff] [blame] | 258 | bool uses_demote:1; |
Marek Olšák | ea77958 | 2020-09-17 20:25:22 -0400 | [diff] [blame] | 259 | bool uses_fbfetch_output:1; |
| 260 | bool color_is_dual_source:1; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 261 | |
| 262 | /** |
Jason Ekstrand | ae392d7 | 2019-06-07 18:07:46 -0500 | [diff] [blame] | 263 | * True if this fragment shader requires helper invocations. This |
| 264 | * can be caused by the use of ALU derivative ops, texture |
| 265 | * instructions which do implicit derivatives, and the use of quad |
| 266 | * subgroup operations. |
| 267 | */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 268 | bool needs_helper_invocations:1; |
Jason Ekstrand | ae392d7 | 2019-06-07 18:07:46 -0500 | [diff] [blame] | 269 | |
| 270 | /** |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 271 | * Whether any inputs are declared with the "sample" qualifier. |
| 272 | */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 273 | bool uses_sample_qualifier:1; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 274 | |
| 275 | /** |
| 276 | * Whether early fragment tests are enabled as defined by |
| 277 | * ARB_shader_image_load_store. |
| 278 | */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 279 | bool early_fragment_tests:1; |
Lionel Landwerlin | 039d836 | 2016-11-30 14:47:41 +0000 | [diff] [blame] | 280 | |
| 281 | /** |
| 282 | * Defined by INTEL_conservative_rasterization. |
| 283 | */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 284 | bool inner_coverage:1; |
Lionel Landwerlin | 039d836 | 2016-11-30 14:47:41 +0000 | [diff] [blame] | 285 | |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 286 | bool post_depth_coverage:1; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 287 | |
Alejandro Piñeiro | 0629b2a | 2019-02-07 18:43:58 +0100 | [diff] [blame] | 288 | /** |
| 289 | * \name ARB_fragment_coord_conventions |
| 290 | * @{ |
| 291 | */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 292 | bool pixel_center_integer:1; |
| 293 | bool origin_upper_left:1; |
Alejandro Piñeiro | 0629b2a | 2019-02-07 18:43:58 +0100 | [diff] [blame] | 294 | /*@}*/ |
Timothy Arceri | 347038b | 2018-02-16 16:10:58 +1100 | [diff] [blame] | 295 | |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 296 | bool pixel_interlock_ordered:1; |
| 297 | bool pixel_interlock_unordered:1; |
| 298 | bool sample_interlock_ordered:1; |
| 299 | bool sample_interlock_unordered:1; |
Plamena Manolova | 60e843c | 2018-04-27 14:12:30 +0100 | [diff] [blame] | 300 | |
Eric Anholt | aaef127 | 2019-02-05 10:22:30 -0800 | [diff] [blame] | 301 | /** |
| 302 | * Flags whether NIR's base types on the FS color outputs should be |
| 303 | * ignored. |
| 304 | * |
| 305 | * GLSL requires that fragment shader output base types match the |
| 306 | * render target's base types for the behavior to be defined. From |
| 307 | * the GL 4.6 spec: |
| 308 | * |
| 309 | * "If the values written by the fragment shader do not match the |
| 310 | * format(s) of the corresponding color buffer(s), the result is |
| 311 | * undefined." |
| 312 | * |
| 313 | * However, for NIR shaders translated from TGSI, we don't have the |
| 314 | * output types any more, so the driver will need to do whatever |
| 315 | * fixups are necessary to handle effectively untyped data being |
| 316 | * output from the FS. |
| 317 | */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 318 | bool untyped_color_outputs:1; |
Eric Anholt | aaef127 | 2019-02-05 10:22:30 -0800 | [diff] [blame] | 319 | |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 320 | /** gl_FragDepth layout for ARB_conservative_depth. */ |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 321 | enum gl_frag_depth_layout depth_layout:3; |
Marek Olšák | 7980f3e | 2020-08-13 15:14:19 -0400 | [diff] [blame] | 322 | |
| 323 | /** |
| 324 | * Interpolation qualifiers for drivers that lowers color inputs |
| 325 | * to system values. |
| 326 | */ |
| 327 | unsigned color0_interp:3; /* glsl_interp_mode */ |
| 328 | bool color0_sample:1; |
| 329 | bool color0_centroid:1; |
| 330 | unsigned color1_interp:3; /* glsl_interp_mode */ |
| 331 | bool color1_sample:1; |
| 332 | bool color1_centroid:1; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 333 | } fs; |
| 334 | |
| 335 | struct { |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 336 | uint16_t local_size[3]; |
Timothy Arceri | 54095ed | 2016-10-13 15:18:53 +1100 | [diff] [blame] | 337 | |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 338 | bool local_size_variable:1; |
| 339 | uint8_t user_data_components_amd:3; |
| 340 | |
| 341 | /* |
| 342 | * Arrangement of invocations used to calculate derivatives in a compute |
| 343 | * shader. From NV_compute_shader_derivatives. |
| 344 | */ |
| 345 | enum gl_derivative_group derivative_group:2; |
Timothy Arceri | 8a69ae5 | 2016-10-31 22:06:37 +1100 | [diff] [blame] | 346 | |
Timothy Arceri | 54095ed | 2016-10-13 15:18:53 +1100 | [diff] [blame] | 347 | /** |
| 348 | * Size of shared variables accessed by the compute shader. |
| 349 | */ |
| 350 | unsigned shared_size; |
Karol Herbst | 5f8257f | 2018-07-19 13:04:14 +0200 | [diff] [blame] | 351 | |
Karol Herbst | 5f8257f | 2018-07-19 13:04:14 +0200 | [diff] [blame] | 352 | /** |
| 353 | * pointer size is: |
| 354 | * AddressingModelLogical: 0 (default) |
| 355 | * AddressingModelPhysical32: 32 |
| 356 | * AddressingModelPhysical64: 64 |
| 357 | */ |
| 358 | unsigned ptr_size; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 359 | } cs; |
| 360 | |
Kenneth Graunke | 5edc338 | 2017-01-09 11:37:21 -0800 | [diff] [blame] | 361 | /* Applies to both TCS and TES. */ |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 362 | struct { |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 363 | uint16_t primitive_mode; /* GL_TRIANGLES, GL_QUADS or GL_ISOLINES */ |
Timothy Arceri | 088c25b | 2016-10-13 15:11:47 +1100 | [diff] [blame] | 364 | |
Marek Olšák | 84a1a25 | 2019-11-05 19:10:09 -0500 | [diff] [blame] | 365 | /** The number of vertices in the TCS output patch. */ |
| 366 | uint8_t tcs_vertices_out; |
| 367 | enum gl_tess_spacing spacing:2; |
| 368 | |
Mark Janes | c07bbdb | 2020-03-31 16:41:28 -0700 | [diff] [blame] | 369 | /** Is the vertex order counterclockwise? */ |
| 370 | bool ccw:1; |
| 371 | bool point_mode:1; |
| 372 | |
Timur Kristóf | f1dd81a | 2020-03-13 10:14:37 +0100 | [diff] [blame] | 373 | /* Bit mask of TCS per-vertex inputs (VS outputs) that are used |
| 374 | * with a vertex index that is NOT the invocation id |
| 375 | */ |
| 376 | uint64_t tcs_cross_invocation_inputs_read; |
| 377 | |
| 378 | /* Bit mask of TCS per-vertex outputs that are used |
| 379 | * with a vertex index that is NOT the invocation id |
| 380 | */ |
| 381 | uint64_t tcs_cross_invocation_outputs_read; |
Kenneth Graunke | 5edc338 | 2017-01-09 11:37:21 -0800 | [diff] [blame] | 382 | } tess; |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 383 | }; |
| 384 | } shader_info; |
| 385 | |
Timothy Arceri | 094fe3a | 2016-10-13 10:46:11 +1100 | [diff] [blame] | 386 | #ifdef __cplusplus |
| 387 | } |
| 388 | #endif |
| 389 | |
| 390 | #endif /* SHADER_INFO_H */ |