18bf80f4bSopenharmony_ci/*
28bf80f4bSopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd.
38bf80f4bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
48bf80f4bSopenharmony_ci * you may not use this file except in compliance with the License.
58bf80f4bSopenharmony_ci * You may obtain a copy of the License at
68bf80f4bSopenharmony_ci *
78bf80f4bSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
88bf80f4bSopenharmony_ci *
98bf80f4bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
108bf80f4bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
118bf80f4bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128bf80f4bSopenharmony_ci * See the License for the specific language governing permissions and
138bf80f4bSopenharmony_ci * limitations under the License.
148bf80f4bSopenharmony_ci */
158bf80f4bSopenharmony_ci
168bf80f4bSopenharmony_ci#include "default_limits.h"
178bf80f4bSopenharmony_ci
188bf80f4bSopenharmony_ci#if GLSLANG_VERSION > GLSLANG_VERSION_11_0_0
198bf80f4bSopenharmony_ci#include <glslang/Public/ResourceLimits.h>
208bf80f4bSopenharmony_ci#else
218bf80f4bSopenharmony_ci#include <glslang/Include/ResourceLimits.h>
228bf80f4bSopenharmony_ci#endif
238bf80f4bSopenharmony_ci#include <glslang/Public/ShaderLang.h>
248bf80f4bSopenharmony_ci
258bf80f4bSopenharmony_ciTBuiltInResource kGLSLangDefaultTResource = {
268bf80f4bSopenharmony_ci    /*.maxLights = */ 8,        // From OpenGL 3.0 table 6.46.
278bf80f4bSopenharmony_ci    /*.maxClipPlanes = */ 6,    // From OpenGL 3.0 table 6.46.
288bf80f4bSopenharmony_ci    /*.maxTextureUnits = */ 2,  // From OpenGL 3.0 table 6.50.
298bf80f4bSopenharmony_ci    /*.maxTextureCoords = */ 8, // From OpenGL 3.0 table 6.50.
308bf80f4bSopenharmony_ci    /*.maxVertexAttribs = */ 16,
318bf80f4bSopenharmony_ci    /*.maxVertexUniformComponents = */ 4096,
328bf80f4bSopenharmony_ci    /*.maxVaryingFloats = */ 60, // From OpenGLES 3.1 table 6.44.
338bf80f4bSopenharmony_ci    /*.maxVertexTextureImageUnits = */ 16,
348bf80f4bSopenharmony_ci    /*.maxCombinedTextureImageUnits = */ 80,
358bf80f4bSopenharmony_ci    /*.maxTextureImageUnits = */ 16,
368bf80f4bSopenharmony_ci    /*.maxFragmentUniformComponents = */ 1024,
378bf80f4bSopenharmony_ci
388bf80f4bSopenharmony_ci    // glslang has 32 maxDrawBuffers.
398bf80f4bSopenharmony_ci    // Pixel phone Vulkan driver in Android N has 8
408bf80f4bSopenharmony_ci    // maxFragmentOutputAttachments.
418bf80f4bSopenharmony_ci    /*.maxDrawBuffers = */ 8,
428bf80f4bSopenharmony_ci
438bf80f4bSopenharmony_ci    /*.maxVertexUniformVectors = */ 256,
448bf80f4bSopenharmony_ci    /*.maxVaryingVectors = */ 15,       // From OpenGLES 3.1 table 6.44.
458bf80f4bSopenharmony_ci    /*.maxFragmentUniformVectors = */ 256,
468bf80f4bSopenharmony_ci    /*.maxVertexOutputVectors = */ 16,  // maxVertexOutputComponents / 4
478bf80f4bSopenharmony_ci    /*.maxFragmentInputVectors = */ 15, // maxFragmentInputComponents / 4
488bf80f4bSopenharmony_ci    /*.minProgramTexelOffset = */ -8,
498bf80f4bSopenharmony_ci    /*.maxProgramTexelOffset = */ 7,
508bf80f4bSopenharmony_ci    /*.maxClipDistances = */ 8,
518bf80f4bSopenharmony_ci    /*.maxComputeWorkGroupCountX = */ 65535,
528bf80f4bSopenharmony_ci    /*.maxComputeWorkGroupCountY = */ 65535,
538bf80f4bSopenharmony_ci    /*.maxComputeWorkGroupCountZ = */ 65535,
548bf80f4bSopenharmony_ci    /*.maxComputeWorkGroupSizeX = */ 1024,
558bf80f4bSopenharmony_ci    /*.maxComputeWorkGroupSizeX = */ 1024,
568bf80f4bSopenharmony_ci    /*.maxComputeWorkGroupSizeZ = */ 64,
578bf80f4bSopenharmony_ci    /*.maxComputeUniformComponents = */ 512,
588bf80f4bSopenharmony_ci    /*.maxComputeTextureImageUnits = */ 16,
598bf80f4bSopenharmony_ci    /*.maxComputeImageUniforms = */ 8,
608bf80f4bSopenharmony_ci    /*.maxComputeAtomicCounters = */ 8,
618bf80f4bSopenharmony_ci    /*.maxComputeAtomicCounterBuffers = */ 1, // From OpenGLES 3.1 Table 6.43
628bf80f4bSopenharmony_ci    /*.maxVaryingComponents = */ 60,
638bf80f4bSopenharmony_ci    /*.maxVertexOutputComponents = */ 64,
648bf80f4bSopenharmony_ci    /*.maxGeometryInputComponents = */ 64,
658bf80f4bSopenharmony_ci    /*.maxGeometryOutputComponents = */ 128,
668bf80f4bSopenharmony_ci    /*.maxFragmentInputComponents = */ 128,
678bf80f4bSopenharmony_ci    /*.maxImageUnits = */ 8, // This does not seem to be defined anywhere,
688bf80f4bSopenharmony_ci                             // set to ImageUnits.
698bf80f4bSopenharmony_ci    /*.maxCombinedImageUnitsAndFragmentOutputs = */ 8,
708bf80f4bSopenharmony_ci    /*.maxCombinedShaderOutputResources = */ 8,
718bf80f4bSopenharmony_ci    /*.maxImageSamples = */ 0,
728bf80f4bSopenharmony_ci    /*.maxVertexImageUniforms = */ 0,
738bf80f4bSopenharmony_ci    /*.maxTessControlImageUniforms = */ 0,
748bf80f4bSopenharmony_ci    /*.maxTessEvaluationImageUniforms = */ 0,
758bf80f4bSopenharmony_ci    /*.maxGeometryImageUniforms = */ 0,
768bf80f4bSopenharmony_ci    /*.maxFragmentImageUniforms = */ 8,
778bf80f4bSopenharmony_ci    /*.maxCombinedImageUniforms = */ 8,
788bf80f4bSopenharmony_ci    /*.maxGeometryTextureImageUnits = */ 16,
798bf80f4bSopenharmony_ci    /*.maxGeometryOutputVertices = */ 256,
808bf80f4bSopenharmony_ci    /*.maxGeometryTotalOutputComponents = */ 1024,
818bf80f4bSopenharmony_ci    /*.maxGeometryUniformComponents = */ 512,
828bf80f4bSopenharmony_ci    /*.maxGeometryVaryingComponents = */ 60, // Does not seem to be defined
838bf80f4bSopenharmony_ci                                             // anywhere, set equal to
848bf80f4bSopenharmony_ci                                             // maxVaryingComponents.
858bf80f4bSopenharmony_ci    /*.maxTessControlInputComponents = */ 128,
868bf80f4bSopenharmony_ci    /*.maxTessControlOutputComponents = */ 128,
878bf80f4bSopenharmony_ci    /*.maxTessControlTextureImageUnits = */ 16,
888bf80f4bSopenharmony_ci    /*.maxTessControlUniformComponents = */ 1024,
898bf80f4bSopenharmony_ci    /*.maxTessControlTotalOutputComponents = */ 4096,
908bf80f4bSopenharmony_ci    /*.maxTessEvaluationInputComponents = */ 128,
918bf80f4bSopenharmony_ci    /*.maxTessEvaluationOutputComponents = */ 128,
928bf80f4bSopenharmony_ci    /*.maxTessEvaluationTextureImageUnits = */ 16,
938bf80f4bSopenharmony_ci    /*.maxTessEvaluationUniformComponents = */ 1024,
948bf80f4bSopenharmony_ci    /*.maxTessPatchComponents = */ 120,
958bf80f4bSopenharmony_ci    /*.maxPatchVertices = */ 32,
968bf80f4bSopenharmony_ci    /*.maxTessGenLevel = */ 64,
978bf80f4bSopenharmony_ci    /*.maxViewports = */ 16,
988bf80f4bSopenharmony_ci    /*.maxVertexAtomicCounters = */ 0,
998bf80f4bSopenharmony_ci    /*.maxTessControlAtomicCounters = */ 0,
1008bf80f4bSopenharmony_ci    /*.maxTessEvaluationAtomicCounters = */ 0,
1018bf80f4bSopenharmony_ci    /*.maxGeometryAtomicCounters = */ 0,
1028bf80f4bSopenharmony_ci    /*.maxFragmentAtomicCounters = */ 8,
1038bf80f4bSopenharmony_ci    /*.maxCombinedAtomicCounters = */ 8,
1048bf80f4bSopenharmony_ci    /*.maxAtomicCounterBindings = */ 1,
1058bf80f4bSopenharmony_ci    /*.maxVertexAtomicCounterBuffers = */ 0, // From OpenGLES 3.1 Table 6.41.
1068bf80f4bSopenharmony_ci
1078bf80f4bSopenharmony_ci                                             // ARB_shader_atomic_counters.
1088bf80f4bSopenharmony_ci    /*.maxTessControlAtomicCounterBuffers = */ 0,
1098bf80f4bSopenharmony_ci    /*.maxTessEvaluationAtomicCounterBuffers = */ 0,
1108bf80f4bSopenharmony_ci    /*.maxGeometryAtomicCounterBuffers = */ 0,
1118bf80f4bSopenharmony_ci    // /ARB_shader_atomic_counters.
1128bf80f4bSopenharmony_ci
1138bf80f4bSopenharmony_ci    /*.maxFragmentAtomicCounterBuffers = */ 0, // From OpenGLES 3.1 Table 6.43.
1148bf80f4bSopenharmony_ci    /*.maxCombinedAtomicCounterBuffers = */ 1,
1158bf80f4bSopenharmony_ci    /*.maxAtomicCounterBufferSize = */ 32,
1168bf80f4bSopenharmony_ci    /*.maxTransformFeedbackBuffers = */ 4,
1178bf80f4bSopenharmony_ci    /*.maxTransformFeedbackInterleavedComponents = */ 64,
1188bf80f4bSopenharmony_ci    /*.maxCullDistances = */ 8,                // ARB_cull_distance.
1198bf80f4bSopenharmony_ci    /*.maxCombinedClipAndCullDistances = */ 8, // ARB_cull_distance.
1208bf80f4bSopenharmony_ci    /*.maxSamples = */ 4,
1218bf80f4bSopenharmony_ci    /* .maxMeshOutputVerticesNV = */ 256,
1228bf80f4bSopenharmony_ci    /* .maxMeshOutputPrimitivesNV = */ 512,
1238bf80f4bSopenharmony_ci    /* .maxMeshWorkGroupSizeX_NV = */ 32,
1248bf80f4bSopenharmony_ci    /* .maxMeshWorkGroupSizeY_NV = */ 1,
1258bf80f4bSopenharmony_ci    /* .maxMeshWorkGroupSizeZ_NV = */ 1,
1268bf80f4bSopenharmony_ci    /* .maxTaskWorkGroupSizeX_NV = */ 32,
1278bf80f4bSopenharmony_ci    /* .maxTaskWorkGroupSizeY_NV = */ 1,
1288bf80f4bSopenharmony_ci    /* .maxTaskWorkGroupSizeZ_NV = */ 1,
1298bf80f4bSopenharmony_ci    /* .maxMeshViewCountNV = */ 4,
1308bf80f4bSopenharmony_ci#if GLSLANG_VERSION > 110000
1318bf80f4bSopenharmony_ci    /* .maxMeshOutputVerticesEXT = */ 256,
1328bf80f4bSopenharmony_ci    /* .maxMeshOutputPrimitivesEXT = */ 256,
1338bf80f4bSopenharmony_ci    /* .maxMeshWorkGroupSizeX_EXT = */ 128,
1348bf80f4bSopenharmony_ci    /* .maxMeshWorkGroupSizeY_EXT = */ 128,
1358bf80f4bSopenharmony_ci    /* .maxMeshWorkGroupSizeZ_EXT = */ 128,
1368bf80f4bSopenharmony_ci    /* .maxTaskWorkGroupSizeX_EXT = */ 128,
1378bf80f4bSopenharmony_ci    /* .maxTaskWorkGroupSizeY_EXT = */ 128,
1388bf80f4bSopenharmony_ci    /* .maxTaskWorkGroupSizeZ_EXT = */ 128,
1398bf80f4bSopenharmony_ci    /* .maxMeshViewCountEXT = */ 4,
1408bf80f4bSopenharmony_ci#endif
1418bf80f4bSopenharmony_ci    /* .maxDualSourceDrawBuffersEXT = */ 1,
1428bf80f4bSopenharmony_ci    // This is the glslang TLimits structure.
1438bf80f4bSopenharmony_ci    // It defines whether or not the following features are enabled.
1448bf80f4bSopenharmony_ci    // We want them to all be enabled.z
1458bf80f4bSopenharmony_ci    /*.limits = */
1468bf80f4bSopenharmony_ci    {
1478bf80f4bSopenharmony_ci        /*.nonInductiveForLoops = */ 1,
1488bf80f4bSopenharmony_ci        /*.whileLoops = */ 1,
1498bf80f4bSopenharmony_ci        /*.doWhileLoops = */ 1,
1508bf80f4bSopenharmony_ci        /*.generalUniformIndexing = */ 1,
1518bf80f4bSopenharmony_ci        /*.generalAttributeMatrixVectorIndexing = */ 1,
1528bf80f4bSopenharmony_ci        /*.generalVaryingIndexing = */ 1,
1538bf80f4bSopenharmony_ci        /*.generalSamplerIndexing = */ 1,
1548bf80f4bSopenharmony_ci        /*.generalVariableIndexing = */ 1,
1558bf80f4bSopenharmony_ci        /*.generalConstantMatrixVectorIndexing = */ 1,
1568bf80f4bSopenharmony_ci    }
1578bf80f4bSopenharmony_ci};