1 /* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "default_limits.h" 17 18 #if GLSLANG_VERSION > GLSLANG_VERSION_11_0_0 19 #include <glslang/Public/ResourceLimits.h> 20 #else 21 #include <glslang/Include/ResourceLimits.h> 22 #endif 23 #include <glslang/Public/ShaderLang.h> 24 25 TBuiltInResource kGLSLangDefaultTResource = { 26 /*.maxLights = */ 8, // From OpenGL 3.0 table 6.46. 27 /*.maxClipPlanes = */ 6, // From OpenGL 3.0 table 6.46. 28 /*.maxTextureUnits = */ 2, // From OpenGL 3.0 table 6.50. 29 /*.maxTextureCoords = */ 8, // From OpenGL 3.0 table 6.50. 30 /*.maxVertexAttribs = */ 16, 31 /*.maxVertexUniformComponents = */ 4096, 32 /*.maxVaryingFloats = */ 60, // From OpenGLES 3.1 table 6.44. 33 /*.maxVertexTextureImageUnits = */ 16, 34 /*.maxCombinedTextureImageUnits = */ 80, 35 /*.maxTextureImageUnits = */ 16, 36 /*.maxFragmentUniformComponents = */ 1024, 37 38 // glslang has 32 maxDrawBuffers. 39 // Pixel phone Vulkan driver in Android N has 8 40 // maxFragmentOutputAttachments. 41 /*.maxDrawBuffers = */ 8, 42 43 /*.maxVertexUniformVectors = */ 256, 44 /*.maxVaryingVectors = */ 15, // From OpenGLES 3.1 table 6.44. 45 /*.maxFragmentUniformVectors = */ 256, 46 /*.maxVertexOutputVectors = */ 16, // maxVertexOutputComponents / 4 47 /*.maxFragmentInputVectors = */ 15, // maxFragmentInputComponents / 4 48 /*.minProgramTexelOffset = */ -8, 49 /*.maxProgramTexelOffset = */ 7, 50 /*.maxClipDistances = */ 8, 51 /*.maxComputeWorkGroupCountX = */ 65535, 52 /*.maxComputeWorkGroupCountY = */ 65535, 53 /*.maxComputeWorkGroupCountZ = */ 65535, 54 /*.maxComputeWorkGroupSizeX = */ 1024, 55 /*.maxComputeWorkGroupSizeX = */ 1024, 56 /*.maxComputeWorkGroupSizeZ = */ 64, 57 /*.maxComputeUniformComponents = */ 512, 58 /*.maxComputeTextureImageUnits = */ 16, 59 /*.maxComputeImageUniforms = */ 8, 60 /*.maxComputeAtomicCounters = */ 8, 61 /*.maxComputeAtomicCounterBuffers = */ 1, // From OpenGLES 3.1 Table 6.43 62 /*.maxVaryingComponents = */ 60, 63 /*.maxVertexOutputComponents = */ 64, 64 /*.maxGeometryInputComponents = */ 64, 65 /*.maxGeometryOutputComponents = */ 128, 66 /*.maxFragmentInputComponents = */ 128, 67 /*.maxImageUnits = */ 8, // This does not seem to be defined anywhere, 68 // set to ImageUnits. 69 /*.maxCombinedImageUnitsAndFragmentOutputs = */ 8, 70 /*.maxCombinedShaderOutputResources = */ 8, 71 /*.maxImageSamples = */ 0, 72 /*.maxVertexImageUniforms = */ 0, 73 /*.maxTessControlImageUniforms = */ 0, 74 /*.maxTessEvaluationImageUniforms = */ 0, 75 /*.maxGeometryImageUniforms = */ 0, 76 /*.maxFragmentImageUniforms = */ 8, 77 /*.maxCombinedImageUniforms = */ 8, 78 /*.maxGeometryTextureImageUnits = */ 16, 79 /*.maxGeometryOutputVertices = */ 256, 80 /*.maxGeometryTotalOutputComponents = */ 1024, 81 /*.maxGeometryUniformComponents = */ 512, 82 /*.maxGeometryVaryingComponents = */ 60, // Does not seem to be defined 83 // anywhere, set equal to 84 // maxVaryingComponents. 85 /*.maxTessControlInputComponents = */ 128, 86 /*.maxTessControlOutputComponents = */ 128, 87 /*.maxTessControlTextureImageUnits = */ 16, 88 /*.maxTessControlUniformComponents = */ 1024, 89 /*.maxTessControlTotalOutputComponents = */ 4096, 90 /*.maxTessEvaluationInputComponents = */ 128, 91 /*.maxTessEvaluationOutputComponents = */ 128, 92 /*.maxTessEvaluationTextureImageUnits = */ 16, 93 /*.maxTessEvaluationUniformComponents = */ 1024, 94 /*.maxTessPatchComponents = */ 120, 95 /*.maxPatchVertices = */ 32, 96 /*.maxTessGenLevel = */ 64, 97 /*.maxViewports = */ 16, 98 /*.maxVertexAtomicCounters = */ 0, 99 /*.maxTessControlAtomicCounters = */ 0, 100 /*.maxTessEvaluationAtomicCounters = */ 0, 101 /*.maxGeometryAtomicCounters = */ 0, 102 /*.maxFragmentAtomicCounters = */ 8, 103 /*.maxCombinedAtomicCounters = */ 8, 104 /*.maxAtomicCounterBindings = */ 1, 105 /*.maxVertexAtomicCounterBuffers = */ 0, // From OpenGLES 3.1 Table 6.41. 106 107 // ARB_shader_atomic_counters. 108 /*.maxTessControlAtomicCounterBuffers = */ 0, 109 /*.maxTessEvaluationAtomicCounterBuffers = */ 0, 110 /*.maxGeometryAtomicCounterBuffers = */ 0, 111 // /ARB_shader_atomic_counters. 112 113 /*.maxFragmentAtomicCounterBuffers = */ 0, // From OpenGLES 3.1 Table 6.43. 114 /*.maxCombinedAtomicCounterBuffers = */ 1, 115 /*.maxAtomicCounterBufferSize = */ 32, 116 /*.maxTransformFeedbackBuffers = */ 4, 117 /*.maxTransformFeedbackInterleavedComponents = */ 64, 118 /*.maxCullDistances = */ 8, // ARB_cull_distance. 119 /*.maxCombinedClipAndCullDistances = */ 8, // ARB_cull_distance. 120 /*.maxSamples = */ 4, 121 /* .maxMeshOutputVerticesNV = */ 256, 122 /* .maxMeshOutputPrimitivesNV = */ 512, 123 /* .maxMeshWorkGroupSizeX_NV = */ 32, 124 /* .maxMeshWorkGroupSizeY_NV = */ 1, 125 /* .maxMeshWorkGroupSizeZ_NV = */ 1, 126 /* .maxTaskWorkGroupSizeX_NV = */ 32, 127 /* .maxTaskWorkGroupSizeY_NV = */ 1, 128 /* .maxTaskWorkGroupSizeZ_NV = */ 1, 129 /* .maxMeshViewCountNV = */ 4, 130 #if GLSLANG_VERSION > 110000 131 /* .maxMeshOutputVerticesEXT = */ 256, 132 /* .maxMeshOutputPrimitivesEXT = */ 256, 133 /* .maxMeshWorkGroupSizeX_EXT = */ 128, 134 /* .maxMeshWorkGroupSizeY_EXT = */ 128, 135 /* .maxMeshWorkGroupSizeZ_EXT = */ 128, 136 /* .maxTaskWorkGroupSizeX_EXT = */ 128, 137 /* .maxTaskWorkGroupSizeY_EXT = */ 128, 138 /* .maxTaskWorkGroupSizeZ_EXT = */ 128, 139 /* .maxMeshViewCountEXT = */ 4, 140 #endif 141 /* .maxDualSourceDrawBuffersEXT = */ 1, 142 // This is the glslang TLimits structure. 143 // It defines whether or not the following features are enabled. 144 // We want them to all be enabled.z 145 /*.limits = */ 146 { 147 /*.nonInductiveForLoops = */ 1, 148 /*.whileLoops = */ 1, 149 /*.doWhileLoops = */ 1, 150 /*.generalUniformIndexing = */ 1, 151 /*.generalAttributeMatrixVectorIndexing = */ 1, 152 /*.generalVaryingIndexing = */ 1, 153 /*.generalSamplerIndexing = */ 1, 154 /*.generalVariableIndexing = */ 1, 155 /*.generalConstantMatrixVectorIndexing = */ 1, 156 } 157 };