Browse Source

shaderpipeline: Fix build with never glslang versions

rdb 2 years ago
parent
commit
48db2912b7
2 changed files with 5 additions and 112 deletions
  1. 3 2
      makepanda/makepanda.py
  2. 2 110
      panda/src/shaderpipeline/shaderCompilerGlslang.cxx

+ 3 - 2
makepanda/makepanda.py

@@ -914,8 +914,8 @@ if (COMPILER=="GCC"):
     SmartPkgEnable("OPUS",      "opusfile",  ("opusfile", "opus", "ogg"), ("ogg/ogg.h", "opus/opusfile.h", "opus"))
     SmartPkgEnable("JPEG",      "",          ("jpeg"), "jpeglib.h")
     SmartPkgEnable("PNG",       "libpng",    ("png"), "png.h", tool = "libpng-config")
-    SmartPkgEnable("GLSLANG",   "",          ("MachineIndependent", "GenericCodeGen", "SPIRV", "OSDependent", "OGLCompiler", "HLSL"), "glslang/Public/ShaderLang.h")
-    SmartPkgEnable("SPIRV-TOOLS", "",        ("SPIRV-Tools", "SPIRV-Tools-opt"), "spirv-tools/optimizer.hpp")
+    SmartPkgEnable("GLSLANG",   "",          ("MachineIndependent", "GenericCodeGen", "SPIRV", "OSDependent", "OGLCompiler", "HLSL", "glslang-default-resource-limits"), "glslang/Public/ShaderLang.h")
+    SmartPkgEnable("SPIRV-TOOLS", "",        ("SPIRV-Tools-opt", "SPIRV-Tools"), "spirv-tools/optimizer.hpp")
     SmartPkgEnable("SPIRV-CROSS-GLSL", "",   ("spirv-cross-core", "spirv-cross-glsl"), "spirv_cross/spirv_cross.hpp", thirdparty_dir="spirv-cross")
     SmartPkgEnable("SPIRV-CROSS-HLSL", "",   ("spirv-cross-core", "spirv-cross-hlsl"), "spirv_cross/spirv_cross.hpp", thirdparty_dir="spirv-cross")
     SmartPkgEnable("MIMALLOC",  "",          ("mimalloc"), "mimalloc.h")
@@ -1019,6 +1019,7 @@ if (COMPILER=="GCC"):
         LibName("GLSLANG", "-Wl,--exclude-libs,libOSDependent.a")
         LibName("GLSLANG", "-Wl,--exclude-libs,libOGLCompiler.a")
         LibName("GLSLANG", "-Wl,--exclude-libs,libHLSL.a")
+        LibName("GLSLANG", "-Wl,--exclude-libs,libglslang-default-resource-limits.a")
 
         LibName("SPIRV-TOOLS", "-Wl,--exclude-libs,libSPIRV-Tools.a")
         LibName("SPIRV-TOOLS", "-Wl,--exclude-libs,libSPIRV-Tools-opt.a")

+ 2 - 110
panda/src/shaderpipeline/shaderCompilerGlslang.cxx

@@ -18,119 +18,11 @@
 
 #ifndef CPPPARSER
 #include <glslang/Public/ShaderLang.h>
-#include <glslang/Include/ResourceLimits.h>
+#include <glslang/Public/ResourceLimits.h>
 #include <glslang/SPIRV/GlslangToSpv.h>
 
 #include <spirv-tools/optimizer.hpp>
 
-const TBuiltInResource resource_limits = {
-  /* .MaxLights = */ 32,
-  /* .MaxClipPlanes = */ 6,
-  /* .MaxTextureUnits = */ 32,
-  /* .MaxTextureCoords = */ 32,
-  /* .MaxVertexAttribs = */ 64,
-  /* .MaxVertexUniformComponents = */ 4096,
-  /* .MaxVaryingFloats = */ 64,
-  /* .MaxVertexTextureImageUnits = */ 32,
-  /* .MaxCombinedTextureImageUnits = */ 80,
-  /* .MaxTextureImageUnits = */ 32,
-  /* .MaxFragmentUniformComponents = */ 4096,
-  /* .MaxDrawBuffers = */ 32,
-  /* .MaxVertexUniformVectors = */ 128,
-  /* .MaxVaryingVectors = */ 8,
-  /* .MaxFragmentUniformVectors = */ 16,
-  /* .MaxVertexOutputVectors = */ 16,
-  /* .MaxFragmentInputVectors = */ 15,
-  /* .MinProgramTexelOffset = */ -8,
-  /* .MaxProgramTexelOffset = */ 7,
-  /* .MaxClipDistances = */ 8,
-  /* .MaxComputeWorkGroupCountX = */ 65535,
-  /* .MaxComputeWorkGroupCountY = */ 65535,
-  /* .MaxComputeWorkGroupCountZ = */ 65535,
-  /* .MaxComputeWorkGroupSizeX = */ 1024,
-  /* .MaxComputeWorkGroupSizeY = */ 1024,
-  /* .MaxComputeWorkGroupSizeZ = */ 64,
-  /* .MaxComputeUniformComponents = */ 1024,
-  /* .MaxComputeTextureImageUnits = */ 16,
-  /* .MaxComputeImageUniforms = */ 8,
-  /* .MaxComputeAtomicCounters = */ 8,
-  /* .MaxComputeAtomicCounterBuffers = */ 1,
-  /* .MaxVaryingComponents = */ 60,
-  /* .MaxVertexOutputComponents = */ 64,
-  /* .MaxGeometryInputComponents = */ 64,
-  /* .MaxGeometryOutputComponents = */ 128,
-  /* .MaxFragmentInputComponents = */ 128,
-  /* .MaxImageUnits = */ 8,
-  /* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
-  /* .MaxCombinedShaderOutputResources = */ 8,
-  /* .MaxImageSamples = */ 0,
-  /* .MaxVertexImageUniforms = */ 0,
-  /* .MaxTessControlImageUniforms = */ 0,
-  /* .MaxTessEvaluationImageUniforms = */ 0,
-  /* .MaxGeometryImageUniforms = */ 0,
-  /* .MaxFragmentImageUniforms = */ 8,
-  /* .MaxCombinedImageUniforms = */ 8,
-  /* .MaxGeometryTextureImageUnits = */ 16,
-  /* .MaxGeometryOutputVertices = */ 256,
-  /* .MaxGeometryTotalOutputComponents = */ 1024,
-  /* .MaxGeometryUniformComponents = */ 1024,
-  /* .MaxGeometryVaryingComponents = */ 64,
-  /* .MaxTessControlInputComponents = */ 128,
-  /* .MaxTessControlOutputComponents = */ 128,
-  /* .MaxTessControlTextureImageUnits = */ 16,
-  /* .MaxTessControlUniformComponents = */ 1024,
-  /* .MaxTessControlTotalOutputComponents = */ 4096,
-  /* .MaxTessEvaluationInputComponents = */ 128,
-  /* .MaxTessEvaluationOutputComponents = */ 128,
-  /* .MaxTessEvaluationTextureImageUnits = */ 16,
-  /* .MaxTessEvaluationUniformComponents = */ 1024,
-  /* .MaxTessPatchComponents = */ 120,
-  /* .MaxPatchVertices = */ 32,
-  /* .MaxTessGenLevel = */ 64,
-  /* .MaxViewports = */ 16,
-  /* .MaxVertexAtomicCounters = */ 0,
-  /* .MaxTessControlAtomicCounters = */ 0,
-  /* .MaxTessEvaluationAtomicCounters = */ 0,
-  /* .MaxGeometryAtomicCounters = */ 0,
-  /* .MaxFragmentAtomicCounters = */ 8,
-  /* .MaxCombinedAtomicCounters = */ 8,
-  /* .MaxAtomicCounterBindings = */ 1,
-  /* .MaxVertexAtomicCounterBuffers = */ 0,
-  /* .MaxTessControlAtomicCounterBuffers = */ 0,
-  /* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
-  /* .MaxGeometryAtomicCounterBuffers = */ 0,
-  /* .MaxFragmentAtomicCounterBuffers = */ 1,
-  /* .MaxCombinedAtomicCounterBuffers = */ 1,
-  /* .MaxAtomicCounterBufferSize = */ 16384,
-  /* .MaxTransformFeedbackBuffers = */ 4,
-  /* .MaxTransformFeedbackInterleavedComponents = */ 64,
-  /* .MaxCullDistances = */ 8,
-  /* .MaxCombinedClipAndCullDistances = */ 8,
-  /* .MaxSamples = */ 4,
-  /* .maxMeshOutputVerticesNV = */ 256,
-  /* .maxMeshOutputPrimitivesNV = */ 512,
-  /* .maxMeshWorkGroupSizeX_NV = */ 32,
-  /* .maxMeshWorkGroupSizeY_NV = */ 1,
-  /* .maxMeshWorkGroupSizeZ_NV = */ 1,
-  /* .maxTaskWorkGroupSizeX_NV = */ 32,
-  /* .maxTaskWorkGroupSizeY_NV = */ 1,
-  /* .maxTaskWorkGroupSizeZ_NV = */ 1,
-  /* .maxMeshViewCountNV = */ 4,
-  /* .maxDualSourceDrawBuffersEXT = */ 1,
-
-  /* .limits = */ {
-      /* .nonInductiveForLoops = */ 1,
-      /* .whileLoops = */ 1,
-      /* .doWhileLoops = */ 1,
-      /* .generalUniformIndexing = */ 1,
-      /* .generalAttributeMatrixVectorIndexing = */ 1,
-      /* .generalVaryingIndexing = */ 1,
-      /* .generalSamplerIndexing = */ 1,
-      /* .generalVariableIndexing = */ 1,
-      /* .generalConstantMatrixVectorIndexing = */ 1,
-  }
-};
-
 /**
  * Interface for processing includes via the VirtualFileSystem.
  */
@@ -417,7 +309,7 @@ compile_now(ShaderModule::Stage stage, std::istream &in,
   shader.setAutoMapLocations(true);
 
   Includer includer(record);
-  if (!shader.parse(&resource_limits, 110, false, messages, includer)) {
+  if (!shader.parse(GetDefaultResources(), 110, false, messages, includer)) {
     shader_cat.error()
       << "Failed to parse " << filename << ":\n"
       << shader.getInfoLog();