1 // 2 //Copyright (C) 2002-2005 3Dlabs Inc. Ltd. 3 //Copyright (C) 2012-2013 LunarG, Inc. 4 // 5 //All rights reserved. 6 // 7 //Redistribution and use in source and binary forms, with or without 8 //modification, are permitted provided that the following conditions 9 //are met: 10 // 11 // Redistributions of source code must retain the above copyright 12 // notice, this list of conditions and the following disclaimer. 13 // 14 // Redistributions in binary form must reproduce the above 15 // copyright notice, this list of conditions and the following 16 // disclaimer in the documentation and/or other materials provided 17 // with the distribution. 18 // 19 // Neither the name of 3Dlabs Inc. Ltd. nor the names of its 20 // contributors may be used to endorse or promote products derived 21 // from this software without specific prior written permission. 22 // 23 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 //"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 //LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 //FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27 //COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 //INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 //BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 //CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 //LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33 //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 //POSSIBILITY OF SUCH DAMAGE. 35 // 36 #ifndef _VERSIONS_INCLUDED_ 37 #define _VERSIONS_INCLUDED_ 38 39 // 40 // Help manage multiple profiles, versions, extensions etc. 41 // 42 43 // 44 // Profiles are set up for masking operations, so queries can be done on multiple 45 // profiles at the same time. 46 // 47 // Don't maintain an ordinal set of enums (0,1,2,3...) to avoid all possible 48 // defects from mixing the two different forms. 49 // 50 typedef enum { 51 EBadProfile = 0, 52 ENoProfile = (1 << 0), // only for desktop, before profiles showed up 53 ECoreProfile = (1 << 1), 54 ECompatibilityProfile = (1 << 2), 55 EEsProfile = (1 << 3) 56 } EProfile; 57 58 namespace glslang { 59 60 // 61 // Map from profile enum to externally readable text name. 62 // 63 inline const char* ProfileName(EProfile profile) 64 { 65 switch (profile) { 66 case ENoProfile: return "none"; 67 case ECoreProfile: return "core"; 68 case ECompatibilityProfile: return "compatibility"; 69 case EEsProfile: return "es"; 70 default: return "unknown profile"; 71 } 72 } 73 74 // 75 // SPIR-V has versions for multiple things; tie them together. 76 // 0 means a target or rule set is not enabled. 77 // 78 struct SpvVersion { 79 SpvVersion() : spv(0), vulkan(0), openGl(0) {} 80 unsigned int spv; // the version of the targeted SPIR-V, as defined by SPIR-V in word 1 of the SPIR-V binary header 81 int vulkan; // the version of semantics for Vulkan; e.g., for GLSL from KHR_vulkan_glsl "#define VULKAN" 82 int openGl; // the version of semantics for OpenGL; e.g., for GLSL from KHR_vulkan_glsl "#define GL_SPIRV" 83 }; 84 85 // 86 // The behaviors from the GLSL "#extension extension_name : behavior" 87 // 88 typedef enum { 89 EBhMissing = 0, 90 EBhRequire, 91 EBhEnable, 92 EBhWarn, 93 EBhDisable, 94 EBhDisablePartial // use as initial state of an extension that is only partially implemented 95 } TExtensionBehavior; 96 97 // 98 // Symbolic names for extensions. Strings may be directly used when calling the 99 // functions, but better to have the compiler do spelling checks. 100 // 101 const char* const E_GL_OES_texture_3D = "GL_OES_texture_3D"; 102 const char* const E_GL_OES_standard_derivatives = "GL_OES_standard_derivatives"; 103 const char* const E_GL_EXT_frag_depth = "GL_EXT_frag_depth"; 104 const char* const E_GL_OES_EGL_image_external = "GL_OES_EGL_image_external"; 105 const char* const E_GL_EXT_shader_texture_lod = "GL_EXT_shader_texture_lod"; 106 107 const char* const E_GL_ARB_texture_rectangle = "GL_ARB_texture_rectangle"; 108 const char* const E_GL_3DL_array_objects = "GL_3DL_array_objects"; 109 const char* const E_GL_ARB_shading_language_420pack = "GL_ARB_shading_language_420pack"; 110 const char* const E_GL_ARB_texture_gather = "GL_ARB_texture_gather"; 111 const char* const E_GL_ARB_gpu_shader5 = "GL_ARB_gpu_shader5"; 112 const char* const E_GL_ARB_separate_shader_objects = "GL_ARB_separate_shader_objects"; 113 const char* const E_GL_ARB_compute_shader = "GL_ARB_compute_shader"; 114 const char* const E_GL_ARB_tessellation_shader = "GL_ARB_tessellation_shader"; 115 const char* const E_GL_ARB_enhanced_layouts = "GL_ARB_enhanced_layouts"; 116 const char* const E_GL_ARB_texture_cube_map_array = "GL_ARB_texture_cube_map_array"; 117 const char* const E_GL_ARB_shader_texture_lod = "GL_ARB_shader_texture_lod"; 118 const char* const E_GL_ARB_explicit_attrib_location = "GL_ARB_explicit_attrib_location"; 119 const char* const E_GL_ARB_shader_image_load_store = "GL_ARB_shader_image_load_store"; 120 const char* const E_GL_ARB_shader_atomic_counters = "GL_ARB_shader_atomic_counters"; 121 const char* const E_GL_ARB_shader_draw_parameters = "GL_ARB_shader_draw_parameters"; 122 const char* const E_GL_ARB_shader_group_vote = "GL_ARB_shader_group_vote"; 123 const char* const E_GL_ARB_derivative_control = "GL_ARB_derivative_control"; 124 const char* const E_GL_ARB_shader_texture_image_samples = "GL_ARB_shader_texture_image_samples"; 125 const char* const E_GL_ARB_viewport_array = "GL_ARB_viewport_array"; 126 const char* const E_GL_ARB_gpu_shader_int64 = "GL_ARB_gpu_shader_int64"; 127 const char* const E_GL_ARB_shader_ballot = "GL_ARB_shader_ballot"; 128 const char* const E_GL_ARB_sparse_texture2 = "GL_ARB_sparse_texture2"; 129 const char* const E_GL_ARB_sparse_texture_clamp = "GL_ARB_sparse_texture_clamp"; 130 //const char* const E_GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members 131 132 const char* const E_GL_EXT_shader_non_constant_global_initializers = "GL_EXT_shader_non_constant_global_initializers"; 133 134 // #line and #include 135 const char* const E_GL_GOOGLE_cpp_style_line_directive = "GL_GOOGLE_cpp_style_line_directive"; 136 const char* const E_GL_GOOGLE_include_directive = "GL_GOOGLE_include_directive"; 137 138 // AEP 139 const char* const E_GL_ANDROID_extension_pack_es31a = "GL_ANDROID_extension_pack_es31a"; 140 const char* const E_GL_KHR_blend_equation_advanced = "GL_KHR_blend_equation_advanced"; 141 const char* const E_GL_OES_sample_variables = "GL_OES_sample_variables"; 142 const char* const E_GL_OES_shader_image_atomic = "GL_OES_shader_image_atomic"; 143 const char* const E_GL_OES_shader_multisample_interpolation = "GL_OES_shader_multisample_interpolation"; 144 const char* const E_GL_OES_texture_storage_multisample_2d_array = "GL_OES_texture_storage_multisample_2d_array"; 145 const char* const E_GL_EXT_geometry_shader = "GL_EXT_geometry_shader"; 146 const char* const E_GL_EXT_geometry_point_size = "GL_EXT_geometry_point_size"; 147 const char* const E_GL_EXT_gpu_shader5 = "GL_EXT_gpu_shader5"; 148 const char* const E_GL_EXT_primitive_bounding_box = "GL_EXT_primitive_bounding_box"; 149 const char* const E_GL_EXT_shader_io_blocks = "GL_EXT_shader_io_blocks"; 150 const char* const E_GL_EXT_tessellation_shader = "GL_EXT_tessellation_shader"; 151 const char* const E_GL_EXT_tessellation_point_size = "GL_EXT_tessellation_point_size"; 152 const char* const E_GL_EXT_texture_buffer = "GL_EXT_texture_buffer"; 153 const char* const E_GL_EXT_texture_cube_map_array = "GL_EXT_texture_cube_map_array"; 154 155 // OES matching AEP 156 const char* const E_GL_OES_geometry_shader = "GL_OES_geometry_shader"; 157 const char* const E_GL_OES_geometry_point_size = "GL_OES_geometry_point_size"; 158 const char* const E_GL_OES_gpu_shader5 = "GL_OES_gpu_shader5"; 159 const char* const E_GL_OES_primitive_bounding_box = "GL_OES_primitive_bounding_box"; 160 const char* const E_GL_OES_shader_io_blocks = "GL_OES_shader_io_blocks"; 161 const char* const E_GL_OES_tessellation_shader = "GL_OES_tessellation_shader"; 162 const char* const E_GL_OES_tessellation_point_size = "GL_OES_tessellation_point_size"; 163 const char* const E_GL_OES_texture_buffer = "GL_OES_texture_buffer"; 164 const char* const E_GL_OES_texture_cube_map_array = "GL_OES_texture_cube_map_array"; 165 166 // Arrays of extensions for the above AEP duplications 167 168 const char* const AEP_geometry_shader[] = { E_GL_EXT_geometry_shader, E_GL_OES_geometry_shader }; 169 const int Num_AEP_geometry_shader = sizeof(AEP_geometry_shader)/sizeof(AEP_geometry_shader[0]); 170 171 const char* const AEP_geometry_point_size[] = { E_GL_EXT_geometry_point_size, E_GL_OES_geometry_point_size }; 172 const int Num_AEP_geometry_point_size = sizeof(AEP_geometry_point_size)/sizeof(AEP_geometry_point_size[0]); 173 174 const char* const AEP_gpu_shader5[] = { E_GL_EXT_gpu_shader5, E_GL_OES_gpu_shader5 }; 175 const int Num_AEP_gpu_shader5 = sizeof(AEP_gpu_shader5)/sizeof(AEP_gpu_shader5[0]); 176 177 const char* const AEP_primitive_bounding_box[] = { E_GL_EXT_primitive_bounding_box, E_GL_OES_primitive_bounding_box }; 178 const int Num_AEP_primitive_bounding_box = sizeof(AEP_primitive_bounding_box)/sizeof(AEP_primitive_bounding_box[0]); 179 180 const char* const AEP_shader_io_blocks[] = { E_GL_EXT_shader_io_blocks, E_GL_OES_shader_io_blocks }; 181 const int Num_AEP_shader_io_blocks = sizeof(AEP_shader_io_blocks)/sizeof(AEP_shader_io_blocks[0]); 182 183 const char* const AEP_tessellation_shader[] = { E_GL_EXT_tessellation_shader, E_GL_OES_tessellation_shader }; 184 const int Num_AEP_tessellation_shader = sizeof(AEP_tessellation_shader)/sizeof(AEP_tessellation_shader[0]); 185 186 const char* const AEP_tessellation_point_size[] = { E_GL_EXT_tessellation_point_size, E_GL_OES_tessellation_point_size }; 187 const int Num_AEP_tessellation_point_size = sizeof(AEP_tessellation_point_size)/sizeof(AEP_tessellation_point_size[0]); 188 189 const char* const AEP_texture_buffer[] = { E_GL_EXT_texture_buffer, E_GL_OES_texture_buffer }; 190 const int Num_AEP_texture_buffer = sizeof(AEP_texture_buffer)/sizeof(AEP_texture_buffer[0]); 191 192 const char* const AEP_texture_cube_map_array[] = { E_GL_EXT_texture_cube_map_array, E_GL_OES_texture_cube_map_array }; 193 const int Num_AEP_texture_cube_map_array = sizeof(AEP_texture_cube_map_array)/sizeof(AEP_texture_cube_map_array[0]); 194 195 } // end namespace glslang 196 197 #endif // _VERSIONS_INCLUDED_ 198