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 36 // glslang has 32 maxDrawBuffers. 37 // Pixel phone Vulkan driver in Android N has 8 38 // maxFragmentOutputAttachments. 39 /*.maxDrawBuffers = */ 8, 40 41 /*.maxVertexUniformVectors = */ 256, 42 /*.maxVaryingVectors = */ 15, // From OpenGLES 3.1 table 6.44. 43 /*.maxFragmentUniformVectors = */ 256, 44 /*.maxVertexOutputVectors = */ 16, // maxVertexOutputComponents / 4 45 /*.maxFragmentInputVectors = */ 15, // maxFragmentInputComponents / 4 46 /*.minProgramTexelOffset = */ -8, 47 /*.maxProgramTexelOffset = */ 7, 48 /*.maxClipDistances = */ 8, 49 /*.maxComputeWorkGroupCountX = */ 65535, 50 /*.maxComputeWorkGroupCountY = */ 65535, 51 /*.maxComputeWorkGroupCountZ = */ 65535, 52 /*.maxComputeWorkGroupSizeX = */ 1024, 53 /*.maxComputeWorkGroupSizeX = */ 1024, 54 /*.maxComputeWorkGroupSizeZ = */ 64, 55 /*.maxComputeUniformComponents = */ 512, 56 /*.maxComputeTextureImageUnits = */ 16, 57 /*.maxComputeImageUniforms = */ 8, 58 /*.maxComputeAtomicCounters = */ 8, 59 /*.maxComputeAtomicCounterBuffers = */ 1, // From OpenGLES 3.1 Table 6.43 60 /*.maxVaryingComponents = */ 60, 61 /*.maxVertexOutputComponents = */ 64, 62 /*.maxGeometryInputComponents = */ 64, 63 /*.maxGeometryOutputComponents = */ 128, 64 /*.maxFragmentInputComponents = */ 128, 65 /*.maxImageUnits = */ 8, // This does not seem to be defined anywhere, 66 // set to ImageUnits. 67 /*.maxCombinedImageUnitsAndFragmentOutputs = */ 8, 68 /*.maxCombinedShaderOutputResources = */ 8, 69 /*.maxImageSamples = */ 0, 70 /*.maxVertexImageUniforms = */ 0, 71 /*.maxTessControlImageUniforms = */ 0, 72 /*.maxTessEvaluationImageUniforms = */ 0, 73 /*.maxGeometryImageUniforms = */ 0, 74 /*.maxFragmentImageUniforms = */ 8, 75 /*.maxCombinedImageUniforms = */ 8, 76 /*.maxGeometryTextureImageUnits = */ 16, 77 /*.maxGeometryOutputVertices = */ 256, 78 /*.maxGeometryTotalOutputComponents = */ 1024, 79 /*.maxGeometryUniformComponents = */ 512, 80 /*.maxGeometryVaryingComponents = */ 60, // Does not seem to be defined 81 // anywhere, set equal to 82 // maxVaryingComponents. 83 /*.maxTessControlInputComponents = */ 128, 84 /*.maxTessControlOutputComponents = */ 128, 85 /*.maxTessControlTextureImageUnits = */ 16, 86 /*.maxTessControlUniformComponents = */ 1024, 87 /*.maxTessControlTotalOutputComponents = */ 4096, 88 /*.maxTessEvaluationInputComponents = */ 128, 89 /*.maxTessEvaluationOutputComponents = */ 128, 90 /*.maxTessEvaluationTextureImageUnits = */ 16, 91 /*.maxTessEvaluationUniformComponents = */ 1024, 92 /*.maxTessPatchComponents = */ 120, 93 /*.maxPatchVertices = */ 32, 94 /*.maxTessGenLevel = */ 64, 95 /*.maxViewports = */ 16, 96 /*.maxVertexAtomicCounters = */ 0, 97 /*.maxTessControlAtomicCounters = */ 0, 98 /*.maxTessEvaluationAtomicCounters = */ 0, 99 /*.maxGeometryAtomicCounters = */ 0, 100 /*.maxFragmentAtomicCounters = */ 8, 101 /*.maxCombinedAtomicCounters = */ 8, 102 /*.maxAtomicCounterBindings = */ 1, 103 /*.maxVertexAtomicCounterBuffers = */ 0, // From OpenGLES 3.1 Table 6.41. 104 105 // ARB_shader_atomic_counters. 106 /*.maxTessControlAtomicCounterBuffers = */ 0, 107 /*.maxTessEvaluationAtomicCounterBuffers = */ 0, 108 /*.maxGeometryAtomicCounterBuffers = */ 0, 109 // /ARB_shader_atomic_counters. 110 111 /*.maxFragmentAtomicCounterBuffers = */ 0, // From OpenGLES 3.1 Table 6.43. 112 /*.maxCombinedAtomicCounterBuffers = */ 1, 113 /*.maxAtomicCounterBufferSize = */ 32, 114 /*.maxTransformFeedbackBuffers = */ 4, 115 /*.maxTransformFeedbackInterleavedComponents = */ 64, 116 /*.maxCullDistances = */ 8, // ARB_cull_distance. 117 /*.maxCombinedClipAndCullDistances = */ 8, // ARB_cull_distance. 118 /*.maxSamples = */ 4, 119 // This is the glslang TLimits structure. 120 // It defines whether or not the following features are enabled. 121 // We want them to all be enabled. 122 /*.limits = */ { 123 /*.nonInductiveForLoops = */ 1, 124 /*.whileLoops = */ 1, 125 /*.doWhileLoops = */ 1, 126 /*.generalUniformIndexing = */ 1, 127 /*.generalAttributeMatrixVectorIndexing = */ 1, 128 /*.generalVaryingIndexing = */ 1, 129 /*.generalSamplerIndexing = */ 1, 130 /*.generalVariableIndexing = */ 1, 131 /*.generalConstantMatrixVectorIndexing = */ 1, 132 }}; 133 134 } // namespace shaderc_util 135