Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2016 Google, Inc. |
| 3 | // |
| 4 | // All rights reserved. |
| 5 | // |
| 6 | // Redistribution and use in source and binary forms, with or without |
| 7 | // modification, are permitted provided that the following conditions |
| 8 | // are met: |
| 9 | // |
| 10 | // Redistributions of source code must retain the above copyright |
| 11 | // notice, this list of conditions and the following disclaimer. |
| 12 | // |
| 13 | // Redistributions in binary form must reproduce the above |
| 14 | // copyright notice, this list of conditions and the following |
| 15 | // disclaimer in the documentation and/or other materials provided |
| 16 | // with the distribution. |
| 17 | // |
| 18 | // Neither the name of Google Inc. nor the names of its |
| 19 | // contributors may be used to endorse or promote products derived |
| 20 | // from this software without specific prior written permission. |
| 21 | // |
| 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| 32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 33 | // POSSIBILITY OF SUCH DAMAGE. |
| 34 | |
| 35 | #include <sstream> |
| 36 | |
| 37 | #include "DefaultResourceLimits.h" |
| 38 | |
| 39 | namespace glslang { |
| 40 | |
| 41 | const TBuiltInResource DefaultTBuiltInResource = { |
| 42 | /* .MaxLights = */ 32, |
| 43 | /* .MaxClipPlanes = */ 6, |
| 44 | /* .MaxTextureUnits = */ 32, |
| 45 | /* .MaxTextureCoords = */ 32, |
| 46 | /* .MaxVertexAttribs = */ 64, |
| 47 | /* .MaxVertexUniformComponents = */ 4096, |
| 48 | /* .MaxVaryingFloats = */ 64, |
| 49 | /* .MaxVertexTextureImageUnits = */ 32, |
| 50 | /* .MaxCombinedTextureImageUnits = */ 80, |
| 51 | /* .MaxTextureImageUnits = */ 32, |
| 52 | /* .MaxFragmentUniformComponents = */ 4096, |
| 53 | /* .MaxDrawBuffers = */ 32, |
| 54 | /* .MaxVertexUniformVectors = */ 128, |
| 55 | /* .MaxVaryingVectors = */ 8, |
| 56 | /* .MaxFragmentUniformVectors = */ 16, |
| 57 | /* .MaxVertexOutputVectors = */ 16, |
| 58 | /* .MaxFragmentInputVectors = */ 15, |
| 59 | /* .MinProgramTexelOffset = */ -8, |
| 60 | /* .MaxProgramTexelOffset = */ 7, |
| 61 | /* .MaxClipDistances = */ 8, |
| 62 | /* .MaxComputeWorkGroupCountX = */ 65535, |
| 63 | /* .MaxComputeWorkGroupCountY = */ 65535, |
| 64 | /* .MaxComputeWorkGroupCountZ = */ 65535, |
| 65 | /* .MaxComputeWorkGroupSizeX = */ 1024, |
| 66 | /* .MaxComputeWorkGroupSizeY = */ 1024, |
| 67 | /* .MaxComputeWorkGroupSizeZ = */ 64, |
| 68 | /* .MaxComputeUniformComponents = */ 1024, |
| 69 | /* .MaxComputeTextureImageUnits = */ 16, |
| 70 | /* .MaxComputeImageUniforms = */ 8, |
| 71 | /* .MaxComputeAtomicCounters = */ 8, |
| 72 | /* .MaxComputeAtomicCounterBuffers = */ 1, |
| 73 | /* .MaxVaryingComponents = */ 60, |
| 74 | /* .MaxVertexOutputComponents = */ 64, |
| 75 | /* .MaxGeometryInputComponents = */ 64, |
| 76 | /* .MaxGeometryOutputComponents = */ 128, |
| 77 | /* .MaxFragmentInputComponents = */ 128, |
| 78 | /* .MaxImageUnits = */ 8, |
| 79 | /* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8, |
| 80 | /* .MaxCombinedShaderOutputResources = */ 8, |
| 81 | /* .MaxImageSamples = */ 0, |
| 82 | /* .MaxVertexImageUniforms = */ 0, |
| 83 | /* .MaxTessControlImageUniforms = */ 0, |
| 84 | /* .MaxTessEvaluationImageUniforms = */ 0, |
| 85 | /* .MaxGeometryImageUniforms = */ 0, |
| 86 | /* .MaxFragmentImageUniforms = */ 8, |
| 87 | /* .MaxCombinedImageUniforms = */ 8, |
| 88 | /* .MaxGeometryTextureImageUnits = */ 16, |
| 89 | /* .MaxGeometryOutputVertices = */ 256, |
| 90 | /* .MaxGeometryTotalOutputComponents = */ 1024, |
| 91 | /* .MaxGeometryUniformComponents = */ 1024, |
| 92 | /* .MaxGeometryVaryingComponents = */ 64, |
| 93 | /* .MaxTessControlInputComponents = */ 128, |
| 94 | /* .MaxTessControlOutputComponents = */ 128, |
| 95 | /* .MaxTessControlTextureImageUnits = */ 16, |
| 96 | /* .MaxTessControlUniformComponents = */ 1024, |
| 97 | /* .MaxTessControlTotalOutputComponents = */ 4096, |
| 98 | /* .MaxTessEvaluationInputComponents = */ 128, |
| 99 | /* .MaxTessEvaluationOutputComponents = */ 128, |
| 100 | /* .MaxTessEvaluationTextureImageUnits = */ 16, |
| 101 | /* .MaxTessEvaluationUniformComponents = */ 1024, |
| 102 | /* .MaxTessPatchComponents = */ 120, |
| 103 | /* .MaxPatchVertices = */ 32, |
| 104 | /* .MaxTessGenLevel = */ 64, |
| 105 | /* .MaxViewports = */ 16, |
| 106 | /* .MaxVertexAtomicCounters = */ 0, |
| 107 | /* .MaxTessControlAtomicCounters = */ 0, |
| 108 | /* .MaxTessEvaluationAtomicCounters = */ 0, |
| 109 | /* .MaxGeometryAtomicCounters = */ 0, |
| 110 | /* .MaxFragmentAtomicCounters = */ 8, |
| 111 | /* .MaxCombinedAtomicCounters = */ 8, |
| 112 | /* .MaxAtomicCounterBindings = */ 1, |
| 113 | /* .MaxVertexAtomicCounterBuffers = */ 0, |
| 114 | /* .MaxTessControlAtomicCounterBuffers = */ 0, |
| 115 | /* .MaxTessEvaluationAtomicCounterBuffers = */ 0, |
| 116 | /* .MaxGeometryAtomicCounterBuffers = */ 0, |
| 117 | /* .MaxFragmentAtomicCounterBuffers = */ 1, |
| 118 | /* .MaxCombinedAtomicCounterBuffers = */ 1, |
| 119 | /* .MaxAtomicCounterBufferSize = */ 16384, |
| 120 | /* .MaxTransformFeedbackBuffers = */ 4, |
| 121 | /* .MaxTransformFeedbackInterleavedComponents = */ 64, |
| 122 | /* .MaxCullDistances = */ 8, |
| 123 | /* .MaxCombinedClipAndCullDistances = */ 8, |
| 124 | /* .MaxSamples = */ 4, |
| 125 | /* .limits = */ { |
| 126 | /* .nonInductiveForLoops = */ 1, |
| 127 | /* .whileLoops = */ 1, |
| 128 | /* .doWhileLoops = */ 1, |
| 129 | /* .generalUniformIndexing = */ 1, |
| 130 | /* .generalAttributeMatrixVectorIndexing = */ 1, |
| 131 | /* .generalVaryingIndexing = */ 1, |
| 132 | /* .generalSamplerIndexing = */ 1, |
| 133 | /* .generalVariableIndexing = */ 1, |
| 134 | /* .generalConstantMatrixVectorIndexing = */ 1, |
| 135 | }}; |
| 136 | |
| 137 | std::string GetDefaultTBuiltInResourceString() |
| 138 | { |
| 139 | std::ostringstream ostream; |
| 140 | |
| 141 | ostream << "MaxLights " << DefaultTBuiltInResource.maxLights << "\n" |
| 142 | << "MaxClipPlanes " << DefaultTBuiltInResource.maxClipPlanes << "\n" |
| 143 | << "MaxTextureUnits " << DefaultTBuiltInResource.maxTextureUnits << "\n" |
| 144 | << "MaxTextureCoords " << DefaultTBuiltInResource.maxTextureCoords << "\n" |
| 145 | << "MaxVertexAttribs " << DefaultTBuiltInResource.maxVertexAttribs << "\n" |
| 146 | << "MaxVertexUniformComponents " << DefaultTBuiltInResource.maxVertexUniformComponents << "\n" |
| 147 | << "MaxVaryingFloats " << DefaultTBuiltInResource.maxVaryingFloats << "\n" |
| 148 | << "MaxVertexTextureImageUnits " << DefaultTBuiltInResource.maxVertexTextureImageUnits << "\n" |
| 149 | << "MaxCombinedTextureImageUnits " << DefaultTBuiltInResource.maxCombinedTextureImageUnits << "\n" |
| 150 | << "MaxTextureImageUnits " << DefaultTBuiltInResource.maxTextureImageUnits << "\n" |
| 151 | << "MaxFragmentUniformComponents " << DefaultTBuiltInResource.maxFragmentUniformComponents << "\n" |
| 152 | << "MaxDrawBuffers " << DefaultTBuiltInResource.maxDrawBuffers << "\n" |
| 153 | << "MaxVertexUniformVectors " << DefaultTBuiltInResource.maxVertexUniformVectors << "\n" |
| 154 | << "MaxVaryingVectors " << DefaultTBuiltInResource.maxVaryingVectors << "\n" |
| 155 | << "MaxFragmentUniformVectors " << DefaultTBuiltInResource.maxFragmentUniformVectors << "\n" |
| 156 | << "MaxVertexOutputVectors " << DefaultTBuiltInResource.maxVertexOutputVectors << "\n" |
| 157 | << "MaxFragmentInputVectors " << DefaultTBuiltInResource.maxFragmentInputVectors << "\n" |
| 158 | << "MinProgramTexelOffset " << DefaultTBuiltInResource.minProgramTexelOffset << "\n" |
| 159 | << "MaxProgramTexelOffset " << DefaultTBuiltInResource.maxProgramTexelOffset << "\n" |
| 160 | << "MaxClipDistances " << DefaultTBuiltInResource.maxClipDistances << "\n" |
| 161 | << "MaxComputeWorkGroupCountX " << DefaultTBuiltInResource.maxComputeWorkGroupCountX << "\n" |
| 162 | << "MaxComputeWorkGroupCountY " << DefaultTBuiltInResource.maxComputeWorkGroupCountY << "\n" |
| 163 | << "MaxComputeWorkGroupCountZ " << DefaultTBuiltInResource.maxComputeWorkGroupCountZ << "\n" |
| 164 | << "MaxComputeWorkGroupSizeX " << DefaultTBuiltInResource.maxComputeWorkGroupSizeX << "\n" |
| 165 | << "MaxComputeWorkGroupSizeY " << DefaultTBuiltInResource.maxComputeWorkGroupSizeY << "\n" |
| 166 | << "MaxComputeWorkGroupSizeZ " << DefaultTBuiltInResource.maxComputeWorkGroupSizeZ << "\n" |
| 167 | << "MaxComputeUniformComponents " << DefaultTBuiltInResource.maxComputeUniformComponents << "\n" |
| 168 | << "MaxComputeTextureImageUnits " << DefaultTBuiltInResource.maxComputeTextureImageUnits << "\n" |
| 169 | << "MaxComputeImageUniforms " << DefaultTBuiltInResource.maxComputeImageUniforms << "\n" |
| 170 | << "MaxComputeAtomicCounters " << DefaultTBuiltInResource.maxComputeAtomicCounters << "\n" |
| 171 | << "MaxComputeAtomicCounterBuffers " << DefaultTBuiltInResource.maxComputeAtomicCounterBuffers << "\n" |
| 172 | << "MaxVaryingComponents " << DefaultTBuiltInResource.maxVaryingComponents << "\n" |
| 173 | << "MaxVertexOutputComponents " << DefaultTBuiltInResource.maxVertexOutputComponents << "\n" |
| 174 | << "MaxGeometryInputComponents " << DefaultTBuiltInResource.maxGeometryInputComponents << "\n" |
| 175 | << "MaxGeometryOutputComponents " << DefaultTBuiltInResource.maxGeometryOutputComponents << "\n" |
| 176 | << "MaxFragmentInputComponents " << DefaultTBuiltInResource.maxFragmentInputComponents << "\n" |
| 177 | << "MaxImageUnits " << DefaultTBuiltInResource.maxImageUnits << "\n" |
| 178 | << "MaxCombinedImageUnitsAndFragmentOutputs " << DefaultTBuiltInResource.maxCombinedImageUnitsAndFragmentOutputs << "\n" |
| 179 | << "MaxCombinedShaderOutputResources " << DefaultTBuiltInResource.maxCombinedShaderOutputResources << "\n" |
| 180 | << "MaxImageSamples " << DefaultTBuiltInResource.maxImageSamples << "\n" |
| 181 | << "MaxVertexImageUniforms " << DefaultTBuiltInResource.maxVertexImageUniforms << "\n" |
| 182 | << "MaxTessControlImageUniforms " << DefaultTBuiltInResource.maxTessControlImageUniforms << "\n" |
| 183 | << "MaxTessEvaluationImageUniforms " << DefaultTBuiltInResource.maxTessEvaluationImageUniforms << "\n" |
| 184 | << "MaxGeometryImageUniforms " << DefaultTBuiltInResource.maxGeometryImageUniforms << "\n" |
| 185 | << "MaxFragmentImageUniforms " << DefaultTBuiltInResource.maxFragmentImageUniforms << "\n" |
| 186 | << "MaxCombinedImageUniforms " << DefaultTBuiltInResource.maxCombinedImageUniforms << "\n" |
| 187 | << "MaxGeometryTextureImageUnits " << DefaultTBuiltInResource.maxGeometryTextureImageUnits << "\n" |
| 188 | << "MaxGeometryOutputVertices " << DefaultTBuiltInResource.maxGeometryOutputVertices << "\n" |
| 189 | << "MaxGeometryTotalOutputComponents " << DefaultTBuiltInResource.maxGeometryTotalOutputComponents << "\n" |
| 190 | << "MaxGeometryUniformComponents " << DefaultTBuiltInResource.maxGeometryUniformComponents << "\n" |
| 191 | << "MaxGeometryVaryingComponents " << DefaultTBuiltInResource.maxGeometryVaryingComponents << "\n" |
| 192 | << "MaxTessControlInputComponents " << DefaultTBuiltInResource.maxTessControlInputComponents << "\n" |
| 193 | << "MaxTessControlOutputComponents " << DefaultTBuiltInResource.maxTessControlOutputComponents << "\n" |
| 194 | << "MaxTessControlTextureImageUnits " << DefaultTBuiltInResource.maxTessControlTextureImageUnits << "\n" |
| 195 | << "MaxTessControlUniformComponents " << DefaultTBuiltInResource.maxTessControlUniformComponents << "\n" |
| 196 | << "MaxTessControlTotalOutputComponents " << DefaultTBuiltInResource.maxTessControlTotalOutputComponents << "\n" |
| 197 | << "MaxTessEvaluationInputComponents " << DefaultTBuiltInResource.maxTessEvaluationInputComponents << "\n" |
| 198 | << "MaxTessEvaluationOutputComponents " << DefaultTBuiltInResource.maxTessEvaluationOutputComponents << "\n" |
| 199 | << "MaxTessEvaluationTextureImageUnits " << DefaultTBuiltInResource.maxTessEvaluationTextureImageUnits << "\n" |
| 200 | << "MaxTessEvaluationUniformComponents " << DefaultTBuiltInResource.maxTessEvaluationUniformComponents << "\n" |
| 201 | << "MaxTessPatchComponents " << DefaultTBuiltInResource.maxTessPatchComponents << "\n" |
| 202 | << "MaxPatchVertices " << DefaultTBuiltInResource.maxPatchVertices << "\n" |
| 203 | << "MaxTessGenLevel " << DefaultTBuiltInResource.maxTessGenLevel << "\n" |
| 204 | << "MaxViewports " << DefaultTBuiltInResource.maxViewports << "\n" |
| 205 | << "MaxVertexAtomicCounters " << DefaultTBuiltInResource.maxVertexAtomicCounters << "\n" |
| 206 | << "MaxTessControlAtomicCounters " << DefaultTBuiltInResource.maxTessControlAtomicCounters << "\n" |
| 207 | << "MaxTessEvaluationAtomicCounters " << DefaultTBuiltInResource.maxTessEvaluationAtomicCounters << "\n" |
| 208 | << "MaxGeometryAtomicCounters " << DefaultTBuiltInResource.maxGeometryAtomicCounters << "\n" |
| 209 | << "MaxFragmentAtomicCounters " << DefaultTBuiltInResource.maxFragmentAtomicCounters << "\n" |
| 210 | << "MaxCombinedAtomicCounters " << DefaultTBuiltInResource.maxCombinedAtomicCounters << "\n" |
| 211 | << "MaxAtomicCounterBindings " << DefaultTBuiltInResource.maxAtomicCounterBindings << "\n" |
| 212 | << "MaxVertexAtomicCounterBuffers " << DefaultTBuiltInResource.maxVertexAtomicCounterBuffers << "\n" |
| 213 | << "MaxTessControlAtomicCounterBuffers " << DefaultTBuiltInResource.maxTessControlAtomicCounterBuffers << "\n" |
| 214 | << "MaxTessEvaluationAtomicCounterBuffers " << DefaultTBuiltInResource.maxTessEvaluationAtomicCounterBuffers << "\n" |
| 215 | << "MaxGeometryAtomicCounterBuffers " << DefaultTBuiltInResource.maxGeometryAtomicCounterBuffers << "\n" |
| 216 | << "MaxFragmentAtomicCounterBuffers " << DefaultTBuiltInResource.maxFragmentAtomicCounterBuffers << "\n" |
| 217 | << "MaxCombinedAtomicCounterBuffers " << DefaultTBuiltInResource.maxCombinedAtomicCounterBuffers << "\n" |
| 218 | << "MaxAtomicCounterBufferSize " << DefaultTBuiltInResource.maxAtomicCounterBufferSize << "\n" |
| 219 | << "MaxTransformFeedbackBuffers " << DefaultTBuiltInResource.maxTransformFeedbackBuffers << "\n" |
| 220 | << "MaxTransformFeedbackInterleavedComponents " << DefaultTBuiltInResource.maxTransformFeedbackInterleavedComponents << "\n" |
| 221 | << "MaxCullDistances " << DefaultTBuiltInResource.maxCullDistances << "\n" |
| 222 | << "MaxCombinedClipAndCullDistances " << DefaultTBuiltInResource.maxCombinedClipAndCullDistances << "\n" |
| 223 | << "MaxSamples " << DefaultTBuiltInResource.maxSamples << "\n" |
| 224 | |
| 225 | << "nonInductiveForLoops " << DefaultTBuiltInResource.limits.nonInductiveForLoops << "\n" |
| 226 | << "whileLoops " << DefaultTBuiltInResource.limits.whileLoops << "\n" |
| 227 | << "doWhileLoops " << DefaultTBuiltInResource.limits.doWhileLoops << "\n" |
| 228 | << "generalUniformIndexing " << DefaultTBuiltInResource.limits.generalUniformIndexing << "\n" |
| 229 | << "generalAttributeMatrixVectorIndexing " << DefaultTBuiltInResource.limits.generalAttributeMatrixVectorIndexing << "\n" |
| 230 | << "generalVaryingIndexing " << DefaultTBuiltInResource.limits.generalVaryingIndexing << "\n" |
| 231 | << "generalSamplerIndexing " << DefaultTBuiltInResource.limits.generalSamplerIndexing << "\n" |
| 232 | << "generalVariableIndexing " << DefaultTBuiltInResource.limits.generalVariableIndexing << "\n" |
| 233 | << "generalConstantMatrixVectorIndexing " << DefaultTBuiltInResource.limits.generalConstantMatrixVectorIndexing << "\n" |
| 234 | ; |
| 235 | |
| 236 | return ostream.str(); |
| 237 | } |
| 238 | |
| 239 | } // end namespace glslang |