1 // Copyright 2015 The Shaderc Authors. All rights reserved. 2 // 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 #include "libshaderc_util/resources.h" 16 17 #include "glslang/Include/ResourceLimits.h" 18 19 namespace shaderc_util { 20 21 // These numbers come from the OpenGL 4.4 core profile specification Chapter 23 22 // unless otherwise specified. 23 const TBuiltInResource kDefaultTBuiltInResource = { 24 /*.maxLights = */ 8, // From OpenGL 3.0 table 6.46. 25 /*.maxClipPlanes = */ 6, // From OpenGL 3.0 table 6.46. 26 /*.maxTextureUnits = */ 2, // From OpenGL 3.0 table 6.50. 27 /*.maxTextureCoords = */ 8, // From OpenGL 3.0 table 6.50. 28 /*.maxVertexAttribs = */ 16, 29 /*.maxVertexUniformComponents = */ 4096, 30 /*.maxVaryingFloats = */ 60, // From OpenGLES 3.1 table 6.44. 31 /*.maxVertexTextureImageUnits = */ 16, 32 /*.maxCombinedTextureImageUnits = */ 80, 33 /*.maxTextureImageUnits = */ 16, 34 /*.maxFragmentUniformComponents = */ 1024, 35 /*.maxDrawBuffers = */ 2, 36 /*.maxVertexUniformVectors = */ 256, 37 /*.maxVaryingVectors = */ 15, // From OpenGLES 3.1 table 6.44. 38 /*.maxFragmentUniformVectors = */ 256, 39 /*.maxVertexOutputVectors = */ 16, // maxVertexOutputComponents / 4 40 /*.maxFragmentInputVectors = */ 15, // maxFragmentInputComponents / 4 41 /*.minProgramTexelOffset = */ -8, 42 /*.maxProgramTexelOffset = */ 7, 43 /*.maxClipDistances = */ 8, 44 /*.maxComputeWorkGroupCountX = */ 65535, 45 /*.maxComputeWorkGroupCountY = */ 65535, 46 /*.maxComputeWorkGroupCountZ = */ 65535, 47 /*.maxComputeWorkGroupSizeX = */ 1024, 48 /*.maxComputeWorkGroupSizeX = */ 1024, 49 /*.maxComputeWorkGroupSizeZ = */ 64, 50 /*.maxComputeUniformComponents = */ 512, 51 /*.maxComputeTextureImageUnits = */ 16, 52 /*.maxComputeImageUniforms = */ 8, 53 /*.maxComputeAtomicCounters = */ 8, 54 /*.maxComputeAtomicCounterBuffers = */ 1, // From OpenGLES 3.1 Table 6.43 55 /*.maxVaryingComponents = */ 60, 56 /*.maxVertexOutputComponents = */ 64, 57 /*.maxGeometryInputComponents = */ 64, 58 /*.maxGeometryOutputComponents = */ 128, 59 /*.maxFragmentInputComponents = */ 128, 60 /*.maxImageUnits = */ 8, // This does not seem to be defined anywhere, 61 // set to ImageUnits. 62 /*.maxCombinedImageUnitsAndFragmentOutputs = */ 8, 63 /*.maxCombinedShaderOutputResources = */ 8, 64 /*.maxImageSamples = */ 0, 65 /*.maxVertexImageUniforms = */ 0, 66 /*.maxTessControlImageUniforms = */ 0, 67 /*.maxTessEvaluationImageUniforms = */ 0, 68 /*.maxGeometryImageUniforms = */ 0, 69 /*.maxFragmentImageUniforms = */ 8, 70 /*.maxCombinedImageUniforms = */ 8, 71 /*.maxGeometryTextureImageUnits = */ 16, 72 /*.maxGeometryOutputVertices = */ 256, 73 /*.maxGeometryTotalOutputComponents = */ 1024, 74 /*.maxGeometryUniformComponents = */ 512, 75 /*.maxGeometryVaryingComponents = */ 60, // Does not seem to be defined 76 // anywhere, set equal to 77 // maxVaryingComponents. 78 /*.maxTessControlInputComponents = */ 128, 79 /*.maxTessControlOutputComponents = */ 128, 80 /*.maxTessControlTextureImageUnits = */ 16, 81 /*.maxTessControlUniformComponents = */ 1024, 82 /*.maxTessControlTotalOutputComponents = */ 4096, 83 /*.maxTessEvaluationInputComponents = */ 128, 84 /*.maxTessEvaluationOutputComponents = */ 128, 85 /*.maxTessEvaluationTextureImageUnits = */ 16, 86 /*.maxTessEvaluationUniformComponents = */ 1024, 87 /*.maxTessPatchComponents = */ 120, 88 /*.maxPatchVertices = */ 32, 89 /*.maxTessGenLevel = */ 64, 90 /*.maxViewports = */ 16, 91 /*.maxVertexAtomicCounters = */ 0, 92 /*.maxTessControlAtomicCounters = */ 0, 93 /*.maxTessEvaluationAtomicCounters = */ 0, 94 /*.maxGeometryAtomicCounters = */ 0, 95 /*.maxFragmentAtomicCounters = */ 8, 96 /*.maxCombinedAtomicCounters = */ 8, 97 /*.maxAtomicCounterBindings = */ 1, 98 /*.maxVertexAtomicCounterBuffers = */ 0, // From OpenGLES 3.1 Table 6.41. 99 100 // ARB_shader_atomic_counters. 101 /*.maxTessControlAtomicCounterBuffers = */ 0, 102 /*.maxTessEvaluationAtomicCounterBuffers = */ 0, 103 /*.maxGeometryAtomicCounterBuffers = */ 0, 104 // /ARB_shader_atomic_counters. 105 106 /*.maxFragmentAtomicCounterBuffers = */ 0, // From OpenGLES 3.1 Table 6.43. 107 /*.maxCombinedAtomicCounterBuffers = */ 1, 108 /*.maxAtomicCounterBufferSize = */ 32, 109 /*.maxTransformFeedbackBuffers = */ 4, 110 /*.maxTransformFeedbackInterleavedComponents = */ 64, 111 /*.maxCullDistances = */ 8, // ARB_cull_distance. 112 /*.maxCombinedClipAndCullDistances = */ 8, // ARB_cull_distance. 113 /*.maxSamples = */ 4, 114 // This is the glslang TLimits structure. 115 // It defines whether or not the following features are enabled. 116 // We want them to all be enabled. 117 /*.limits = */ { 118 /*.nonInductiveForLoops = */ 1, 119 /*.whileLoops = */ 1, 120 /*.doWhileLoops = */ 1, 121 /*.generalUniformIndexing = */ 1, 122 /*.generalAttributeMatrixVectorIndexing = */ 1, 123 /*.generalVaryingIndexing = */ 1, 124 /*.generalSamplerIndexing = */ 1, 125 /*.generalVariableIndexing = */ 1, 126 /*.generalConstantMatrixVectorIndexing = */ 1, 127 }}; 128 129 } // namespace shaderc_util 130