Path: blob/main/libshaderc_util/src/resources.cc
1560 views
// Copyright 2015 The Shaderc Authors. All rights reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314#include "libshaderc_util/resources.h"1516#include "glslang/Include/ResourceLimits.h"1718namespace shaderc_util {1920// These numbers come from the OpenGL 4.4 core profile specification Chapter 2321// unless otherwise specified.22const TBuiltInResource kDefaultTBuiltInResource = {23/*.maxLights = */ 8, // From OpenGL 3.0 table 6.46.24/*.maxClipPlanes = */ 6, // From OpenGL 3.0 table 6.46.25/*.maxTextureUnits = */ 2, // From OpenGL 3.0 table 6.50.26/*.maxTextureCoords = */ 8, // From OpenGL 3.0 table 6.50.27/*.maxVertexAttribs = */ 16,28/*.maxVertexUniformComponents = */ 4096,29/*.maxVaryingFloats = */ 60, // From OpenGLES 3.1 table 6.44.30/*.maxVertexTextureImageUnits = */ 16,31/*.maxCombinedTextureImageUnits = */ 80,32/*.maxTextureImageUnits = */ 16,33/*.maxFragmentUniformComponents = */ 1024,3435// glslang has 32 maxDrawBuffers.36// Pixel phone Vulkan driver in Android N has 837// maxFragmentOutputAttachments.38/*.maxDrawBuffers = */ 8,3940/*.maxVertexUniformVectors = */ 256,41/*.maxVaryingVectors = */ 15, // From OpenGLES 3.1 table 6.44.42/*.maxFragmentUniformVectors = */ 256,43/*.maxVertexOutputVectors = */ 16, // maxVertexOutputComponents / 444/*.maxFragmentInputVectors = */ 15, // maxFragmentInputComponents / 445/*.minProgramTexelOffset = */ -8,46/*.maxProgramTexelOffset = */ 7,47/*.maxClipDistances = */ 8,48/*.maxComputeWorkGroupCountX = */ 65535,49/*.maxComputeWorkGroupCountY = */ 65535,50/*.maxComputeWorkGroupCountZ = */ 65535,51/*.maxComputeWorkGroupSizeX = */ 1024,52/*.maxComputeWorkGroupSizeX = */ 1024,53/*.maxComputeWorkGroupSizeZ = */ 64,54/*.maxComputeUniformComponents = */ 512,55/*.maxComputeTextureImageUnits = */ 16,56/*.maxComputeImageUniforms = */ 8,57/*.maxComputeAtomicCounters = */ 8,58/*.maxComputeAtomicCounterBuffers = */ 1, // From OpenGLES 3.1 Table 6.4359/*.maxVaryingComponents = */ 60,60/*.maxVertexOutputComponents = */ 64,61/*.maxGeometryInputComponents = */ 64,62/*.maxGeometryOutputComponents = */ 128,63/*.maxFragmentInputComponents = */ 128,64/*.maxImageUnits = */ 8, // This does not seem to be defined anywhere,65// set to ImageUnits.66/*.maxCombinedImageUnitsAndFragmentOutputs = */ 8,67/*.maxCombinedShaderOutputResources = */ 8,68/*.maxImageSamples = */ 0,69/*.maxVertexImageUniforms = */ 0,70/*.maxTessControlImageUniforms = */ 0,71/*.maxTessEvaluationImageUniforms = */ 0,72/*.maxGeometryImageUniforms = */ 0,73/*.maxFragmentImageUniforms = */ 8,74/*.maxCombinedImageUniforms = */ 8,75/*.maxGeometryTextureImageUnits = */ 16,76/*.maxGeometryOutputVertices = */ 256,77/*.maxGeometryTotalOutputComponents = */ 1024,78/*.maxGeometryUniformComponents = */ 512,79/*.maxGeometryVaryingComponents = */ 60, // Does not seem to be defined80// anywhere, set equal to81// maxVaryingComponents.82/*.maxTessControlInputComponents = */ 128,83/*.maxTessControlOutputComponents = */ 128,84/*.maxTessControlTextureImageUnits = */ 16,85/*.maxTessControlUniformComponents = */ 1024,86/*.maxTessControlTotalOutputComponents = */ 4096,87/*.maxTessEvaluationInputComponents = */ 128,88/*.maxTessEvaluationOutputComponents = */ 128,89/*.maxTessEvaluationTextureImageUnits = */ 16,90/*.maxTessEvaluationUniformComponents = */ 1024,91/*.maxTessPatchComponents = */ 120,92/*.maxPatchVertices = */ 32,93/*.maxTessGenLevel = */ 64,94/*.maxViewports = */ 16,95/*.maxVertexAtomicCounters = */ 0,96/*.maxTessControlAtomicCounters = */ 0,97/*.maxTessEvaluationAtomicCounters = */ 0,98/*.maxGeometryAtomicCounters = */ 0,99/*.maxFragmentAtomicCounters = */ 8,100/*.maxCombinedAtomicCounters = */ 8,101/*.maxAtomicCounterBindings = */ 1,102/*.maxVertexAtomicCounterBuffers = */ 0, // From OpenGLES 3.1 Table 6.41.103104// ARB_shader_atomic_counters.105/*.maxTessControlAtomicCounterBuffers = */ 0,106/*.maxTessEvaluationAtomicCounterBuffers = */ 0,107/*.maxGeometryAtomicCounterBuffers = */ 0,108// /ARB_shader_atomic_counters.109110/*.maxFragmentAtomicCounterBuffers = */ 0, // From OpenGLES 3.1 Table 6.43.111/*.maxCombinedAtomicCounterBuffers = */ 1,112/*.maxAtomicCounterBufferSize = */ 32,113/*.maxTransformFeedbackBuffers = */ 4,114/*.maxTransformFeedbackInterleavedComponents = */ 64,115/*.maxCullDistances = */ 8, // ARB_cull_distance.116/*.maxCombinedClipAndCullDistances = */ 8, // ARB_cull_distance.117/*.maxSamples = */ 4,118/* .maxMeshOutputVerticesNV = */ 256,119/* .maxMeshOutputPrimitivesNV = */ 512,120/* .maxMeshWorkGroupSizeX_NV = */ 32,121/* .maxMeshWorkGroupSizeY_NV = */ 1,122/* .maxMeshWorkGroupSizeZ_NV = */ 1,123/* .maxTaskWorkGroupSizeX_NV = */ 32,124/* .maxTaskWorkGroupSizeY_NV = */ 1,125/* .maxTaskWorkGroupSizeZ_NV = */ 1,126/* .maxMeshViewCountNV = */ 4,127/* .maxMeshOutputVerticesEXT = */ 256,128/* .maxMeshOutputPrimitivesEXT = */ 256,129/* .maxMeshWorkGroupSizeX_EXT = */ 128,130/* .maxMeshWorkGroupSizeY_EXT = */ 128,131/* .maxMeshWorkGroupSizeZ_EXT = */ 128,132/* .maxTaskWorkGroupSizeX_EXT = */ 128,133/* .maxTaskWorkGroupSizeY_EXT = */ 128,134/* .maxTaskWorkGroupSizeZ_EXT = */ 128,135/* .maxMeshViewCountEXT = */ 4,136/* .maxDualSourceDrawBuffersEXT = */ 1,137// This is the glslang TLimits structure.138// It defines whether or not the following features are enabled.139// We want them to all be enabled.140/*.limits = */ {141/*.nonInductiveForLoops = */ 1,142/*.whileLoops = */ 1,143/*.doWhileLoops = */ 1,144/*.generalUniformIndexing = */ 1,145/*.generalAttributeMatrixVectorIndexing = */ 1,146/*.generalVaryingIndexing = */ 1,147/*.generalSamplerIndexing = */ 1,148/*.generalVariableIndexing = */ 1,149/*.generalConstantMatrixVectorIndexing = */ 1,150}};151152} // namespace shaderc_util153154155