2
0
Эх сурвалжийг харах

CMake: build shader pipeline

rdb 1 жил өмнө
parent
commit
fdcbb6641d

+ 56 - 0
cmake/modules/FindSPIRV-Cross.cmake

@@ -0,0 +1,56 @@
+# Filename: FindSPIRVCross.cmake
+# Authors: rdb (9 Nov, 2024)
+#
+# Usage:
+#   find_package(SPIRV-Cross [REQUIRED] [QUIET])
+#
+# Once done this will define:
+#   SPIRV_CROSS_FOUND        - system has SPIRV-Cross
+#   SPIRV_CROSS_INCLUDE_DIR  - the path to the location of the spirv_cross directory
+#   SPIRV_CROSS_LIBRARIES    - the libraries to link against for SPIRV-Cross
+#
+
+find_path(SPIRV_CROSS_INCLUDE_DIR
+  NAMES "spirv_cross/spirv_cross.hpp")
+
+find_library(SPIRV_CROSS_CORE_LIBRARY
+  NAMES "spirv-cross-core")
+
+find_library(SPIRV_CROSS_GLSL_LIBRARY
+  NAMES "spirv-cross-glsl")
+
+find_library(SPIRV_CROSS_HLSL_LIBRARY
+  NAMES "spirv-cross-hlsl")
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SPIRV-Cross DEFAULT_MSG SPIRV_CROSS_INCLUDE_DIR SPIRV_CROSS_LIBRARIES)
+
+mark_as_advanced(SPIRV_CROSS_INCLUDE_DIR SPIRV_CROSS_LIBRARIES)
+
+if(SPIRV_CROSS_CORE_LIBRARY)
+  set(SPIRV_CROSS_FOUND ON)
+
+  add_library(SPIRV-Cross::Core UNKNOWN IMPORTED)
+
+  set_target_properties(SPIRV-Cross::Core PROPERTIES
+    IMPORTED_LOCATION "${SPIRV_CROSS_CORE_LIBRARY}"
+    INTERFACE_INCLUDE_DIRECTORIES "${SPIRV_CROSS_INCLUDE_DIR}")
+endif()
+
+if(SPIRV_CROSS_GLSL_LIBRARY)
+  add_library(SPIRV-Cross::GLSL UNKNOWN IMPORTED)
+  target_link_libraries(SPIRV-Cross::GLSL INTERFACE SPIRV-Cross::Core)
+
+  set_target_properties(SPIRV-Cross::GLSL PROPERTIES
+    IMPORTED_LOCATION "${SPIRV_CROSS_GLSL_LIBRARY}"
+    INTERFACE_INCLUDE_DIRECTORIES "${SPIRV_CROSS_INCLUDE_DIR}")
+endif()
+
+if(SPIRV_CROSS_HLSL_LIBRARY)
+  add_library(SPIRV-Cross::HLSL UNKNOWN IMPORTED)
+  target_link_libraries(SPIRV-Cross::HLSL INTERFACE SPIRV-Cross::GLSL)
+
+  set_target_properties(SPIRV-Cross::HLSL PROPERTIES
+    IMPORTED_LOCATION "${SPIRV_CROSS_HLSL_LIBRARY}"
+    INTERFACE_INCLUDE_DIRECTORIES "${SPIRV_CROSS_INCLUDE_DIR}")
+endif()

+ 24 - 0
dtool/Package.cmake

@@ -893,3 +893,27 @@ package_option(VRPN
   are building Panda3D for a fixed VRPN-based VR installation.")
   are building Panda3D for a fixed VRPN-based VR installation.")
 
 
 package_status(VRPN "VRPN")
 package_status(VRPN "VRPN")
+
+
+#
+# ------------ Shader Pipeline ------------
+#
+
+find_package(glslang QUIET)
+
+package_option(glslang
+  DEFAULT ON
+  "Enables support for compiling GLSL and Cg shaders."
+  IMPORTED_AS glslang::glslang glslang::MachineIndependent glslang::glslang-default-resource-limits)
+
+package_status(glslang "glslang")
+
+
+find_package(SPIRV-Cross QUIET)
+
+package_option(SPIRV-Cross
+  DEFAULT ON
+  "Necessary to support shaders on older OpenGL drivers and DirectX 9."
+  FOUND_AS SPIRV_CROSS)
+
+package_status(SPIRV-Cross "spirv-cross")

+ 6 - 6
makepanda/makepanda.py

@@ -3920,10 +3920,10 @@ cg_preamble = WriteEmbeddedStringFile('cg_preamble', inputs=[
 ])
 ])
 TargetAdd('p3shaderpipeline_cg_preamble.obj', opts=OPTS, input=cg_preamble)
 TargetAdd('p3shaderpipeline_cg_preamble.obj', opts=OPTS, input=cg_preamble)
 
 
-OPTS=['DIR:panda/src/shaderpipeline', 'SPIRV-TOOLS']
-IGATEFILES=GetDirectoryContents('panda/src/shaderpipeline', ["*.h", "*_composite*.cxx"])
-TargetAdd('libp3shaderpipeline.in', opts=OPTS, input=IGATEFILES)
-TargetAdd('libp3shaderpipeline.in', opts=['IMOD:panda3d.core', 'ILIB:libp3shaderpipeline', 'SRCDIR:panda/src/shaderpipeline'])
+#OPTS=['DIR:panda/src/shaderpipeline', 'SPIRV-TOOLS']
+#IGATEFILES=GetDirectoryContents('panda/src/shaderpipeline', ["*.h", "*_composite*.cxx"])
+#TargetAdd('libp3shaderpipeline.in', opts=OPTS, input=IGATEFILES)
+#TargetAdd('libp3shaderpipeline.in', opts=['IMOD:panda3d.core', 'ILIB:libp3shaderpipeline', 'SRCDIR:panda/src/shaderpipeline'])
 
 
 #
 #
 # DIRECTORY: panda/src/chan/
 # DIRECTORY: panda/src/chan/
@@ -4182,7 +4182,7 @@ PyTargetAdd('core_module.obj', input='libp3recorder.in')
 PyTargetAdd('core_module.obj', input='libp3pgraphnodes.in')
 PyTargetAdd('core_module.obj', input='libp3pgraphnodes.in')
 PyTargetAdd('core_module.obj', input='libp3pgraph.in')
 PyTargetAdd('core_module.obj', input='libp3pgraph.in')
 PyTargetAdd('core_module.obj', input='libp3cull.in')
 PyTargetAdd('core_module.obj', input='libp3cull.in')
-PyTargetAdd('core_module.obj', input='libp3shaderpipeline.in')
+#PyTargetAdd('core_module.obj', input='libp3shaderpipeline.in')
 PyTargetAdd('core_module.obj', input='libp3grutil.in')
 PyTargetAdd('core_module.obj', input='libp3grutil.in')
 PyTargetAdd('core_module.obj', input='libp3chan.in')
 PyTargetAdd('core_module.obj', input='libp3chan.in')
 PyTargetAdd('core_module.obj', input='libp3pstatclient.in')
 PyTargetAdd('core_module.obj', input='libp3pstatclient.in')
@@ -4230,7 +4230,7 @@ PyTargetAdd('core.pyd', input='libp3recorder_igate.obj')
 PyTargetAdd('core.pyd', input='libp3pgraphnodes_igate.obj')
 PyTargetAdd('core.pyd', input='libp3pgraphnodes_igate.obj')
 PyTargetAdd('core.pyd', input='libp3pgraph_igate.obj')
 PyTargetAdd('core.pyd', input='libp3pgraph_igate.obj')
 PyTargetAdd('core.pyd', input='libp3movies_igate.obj')
 PyTargetAdd('core.pyd', input='libp3movies_igate.obj')
-PyTargetAdd('core.pyd', input='libp3shaderpipeline_igate.obj')
+#PyTargetAdd('core.pyd', input='libp3shaderpipeline_igate.obj')
 PyTargetAdd('core.pyd', input='libp3grutil_igate.obj')
 PyTargetAdd('core.pyd', input='libp3grutil_igate.obj')
 PyTargetAdd('core.pyd', input='libp3chan_igate.obj')
 PyTargetAdd('core.pyd', input='libp3chan_igate.obj')
 PyTargetAdd('core.pyd', input='libp3pstatclient_igate.obj')
 PyTargetAdd('core.pyd', input='libp3pstatclient_igate.obj')

+ 1 - 0
panda/CMakeLists.txt

@@ -32,6 +32,7 @@ add_subdirectory(src/glgsg)
 add_subdirectory(src/glstuff)
 add_subdirectory(src/glstuff)
 add_subdirectory(src/glxdisplay)
 add_subdirectory(src/glxdisplay)
 add_subdirectory(src/gobj)
 add_subdirectory(src/gobj)
+add_subdirectory(src/shaderpipeline)
 add_subdirectory(src/grutil)
 add_subdirectory(src/grutil)
 add_subdirectory(src/gsgbase)
 add_subdirectory(src/gsgbase)
 add_subdirectory(src/linmath)
 add_subdirectory(src/linmath)

+ 1 - 1
panda/metalibs/panda/CMakeLists.txt

@@ -1,6 +1,6 @@
 set(PANDA_LINK_TARGETS
 set(PANDA_LINK_TARGETS
   p3chan p3char p3collide p3cull p3device p3dgraph p3display
   p3chan p3char p3collide p3cull p3device p3dgraph p3display
-  p3event p3gobj p3grutil p3gsgbase p3linmath p3mathutil
+  p3event p3gobj p3shaderpipeline p3grutil p3gsgbase p3linmath p3mathutil
   p3movies p3parametrics p3pgraph p3pgraphnodes p3pgui p3pipeline
   p3movies p3parametrics p3pgraph p3pgraphnodes p3pgui p3pipeline
   p3pnmimage p3pnmimagetypes p3pstatclient p3putil p3recorder p3text p3tform
   p3pnmimage p3pnmimagetypes p3pstatclient p3putil p3recorder p3text p3tform
 )
 )

+ 2 - 0
panda/src/display/CMakeLists.txt

@@ -28,6 +28,7 @@ set(P3DISPLAY_HEADERS
   windowProperties.I windowProperties.h
   windowProperties.I windowProperties.h
   renderBuffer.h
   renderBuffer.h
   screenshotRequest.I screenshotRequest.h
   screenshotRequest.I screenshotRequest.h
+  shaderInputBinding_impls.I shaderInputBinding_impls.h
   stereoDisplayRegion.I stereoDisplayRegion.h
   stereoDisplayRegion.I stereoDisplayRegion.h
   displaySearchParameters.h
   displaySearchParameters.h
   displayInformation.h
   displayInformation.h
@@ -63,6 +64,7 @@ set(P3DISPLAY_SOURCES
   windowHandle.cxx
   windowHandle.cxx
   windowProperties.cxx
   windowProperties.cxx
   screenshotRequest.cxx
   screenshotRequest.cxx
+  shaderInputBinding_impls.cxx
   stereoDisplayRegion.cxx
   stereoDisplayRegion.cxx
   subprocessWindow.cxx
   subprocessWindow.cxx
   touchInfo.cxx
   touchInfo.cxx

+ 1 - 1
panda/src/dxgsg9/CMakeLists.txt

@@ -42,7 +42,7 @@ composite_sources(p3dxgsg9 P3DXGSG9_SOURCES)
 add_component_library(p3dxgsg9 SYMBOL BUILDING_PANDADX
 add_component_library(p3dxgsg9 SYMBOL BUILDING_PANDADX
   ${P3DXGSG9_HEADERS} ${P3DXGSG9_SOURCES})
   ${P3DXGSG9_HEADERS} ${P3DXGSG9_SOURCES})
 target_link_libraries(p3dxgsg9 p3windisplay panda
 target_link_libraries(p3dxgsg9 p3windisplay panda
-  PKG::DX9)
+  PKG::DX9 SPIRV-Cross::HLSL)
 target_compile_definitions(p3dxgsg9 PUBLIC USE_GENERIC_DXERR_LIBRARY) # FIXME
 target_compile_definitions(p3dxgsg9 PUBLIC USE_GENERIC_DXERR_LIBRARY) # FIXME
 
 
 if(NOT BUILD_METALIBS)
 if(NOT BUILD_METALIBS)

+ 1 - 1
panda/src/glstuff/CMakeLists.txt

@@ -35,7 +35,7 @@ set(P3GLSTUFF_SOURCES
 
 
 composite_sources(p3glstuff P3GLSTUFF_SOURCES)
 composite_sources(p3glstuff P3GLSTUFF_SOURCES)
 add_component_library(p3glstuff NOINIT ${P3GLSTUFF_HEADERS} ${P3GLSTUFF_SOURCES})
 add_component_library(p3glstuff NOINIT ${P3GLSTUFF_HEADERS} ${P3GLSTUFF_SOURCES})
-target_link_libraries(p3glstuff panda)
+target_link_libraries(p3glstuff panda SPIRV-Cross::GLSL)
 
 
 if(APPLE)
 if(APPLE)
   # We acknowledge Apple's hostility to open standards so that the SDK won't
   # We acknowledge Apple's hostility to open standards so that the SDK won't

+ 8 - 0
panda/src/gobj/CMakeLists.txt

@@ -48,7 +48,11 @@ set(P3GOBJ_HEADERS
   savedContext.I savedContext.h
   savedContext.I savedContext.h
   shader.I shader.h
   shader.I shader.h
   shaderBuffer.h shaderBuffer.I
   shaderBuffer.h shaderBuffer.I
+  shaderCompiler.h
+  shaderCompilerRegistry.h
   shaderContext.h shaderContext.I
   shaderContext.h shaderContext.I
+  shaderEnums.h
+  shaderInputBinding.h shaderInputBinding.I
   shaderModule.h shaderModule.I
   shaderModule.h shaderModule.I
   shaderType.h shaderType.I
   shaderType.h shaderType.I
   simpleAllocator.h simpleAllocator.I
   simpleAllocator.h simpleAllocator.I
@@ -129,7 +133,11 @@ set(P3GOBJ_SOURCES
   savedContext.cxx
   savedContext.cxx
   shader.cxx
   shader.cxx
   shaderBuffer.cxx
   shaderBuffer.cxx
+  shaderCompiler.cxx
+  shaderCompilerRegistry.cxx
   shaderContext.cxx
   shaderContext.cxx
+  shaderEnums.cxx
+  shaderInputBinding.cxx
   shaderModule.cxx
   shaderModule.cxx
   shaderType.cxx
   shaderType.cxx
   simpleAllocator.cxx
   simpleAllocator.cxx

+ 2 - 0
panda/src/gobj/p3gobj_composite2.cxx

@@ -7,6 +7,8 @@
 #include "savedContext.cxx"
 #include "savedContext.cxx"
 #include "shader.cxx"
 #include "shader.cxx"
 #include "shaderBuffer.cxx"
 #include "shaderBuffer.cxx"
+#include "shaderCompiler.cxx"
+#include "shaderCompilerRegistry.cxx"
 #include "shaderContext.cxx"
 #include "shaderContext.cxx"
 #include "shaderEnums.cxx"
 #include "shaderEnums.cxx"
 #include "shaderInputBinding.cxx"
 #include "shaderInputBinding.cxx"

+ 0 - 1
panda/src/gobj/shader.cxx

@@ -22,7 +22,6 @@
 #include "config_putil.h"
 #include "config_putil.h"
 #include "bamCache.h"
 #include "bamCache.h"
 #include "string_utils.h"
 #include "string_utils.h"
-#include "shaderModuleGlsl.h"
 #include "shaderCompilerRegistry.h"
 #include "shaderCompilerRegistry.h"
 #include "shaderCompiler.h"
 #include "shaderCompiler.h"
 #include "shaderInputBinding.h"
 #include "shaderInputBinding.h"

+ 0 - 1
panda/src/gobj/shader.h

@@ -40,7 +40,6 @@
 #include "shaderInputBinding.h"
 #include "shaderInputBinding.h"
 
 
 class BamCacheRecord;
 class BamCacheRecord;
-class ShaderModuleGlsl;
 class ShaderCompiler;
 class ShaderCompiler;
 class ShaderInputBinding;
 class ShaderInputBinding;
 
 

+ 0 - 0
panda/src/shaderpipeline/shaderCompiler.cxx → panda/src/gobj/shaderCompiler.cxx


+ 1 - 1
panda/src/shaderpipeline/shaderCompiler.h → panda/src/gobj/shaderCompiler.h

@@ -26,7 +26,7 @@ typedef pvector<Shader::Shader::ShaderLanguage> ShaderLanguages;
 /**
 /**
  * This is the base class for objects to compile various types of shader code.
  * This is the base class for objects to compile various types of shader code.
  */
  */
-class EXPCL_PANDA_SHADERPIPELINE ShaderCompiler : public TypedObject, public ShaderEnums {
+class EXPCL_PANDA_GOBJ ShaderCompiler : public TypedObject, public ShaderEnums {
 protected:
 protected:
   ShaderCompiler();
   ShaderCompiler();
 
 

+ 15 - 15
panda/src/shaderpipeline/shaderCompilerRegistry.cxx → panda/src/gobj/shaderCompilerRegistry.cxx

@@ -13,7 +13,7 @@
 
 
 #include "shaderCompilerRegistry.h"
 #include "shaderCompilerRegistry.h"
 #include "shaderCompiler.h"
 #include "shaderCompiler.h"
-#include "config_shaderpipeline.h"
+#include "config_gobj.h"
 #include "config_putil.h"
 #include "config_putil.h"
 
 
 #include "load_dso.h"
 #include "load_dso.h"
@@ -47,8 +47,8 @@ void ShaderCompilerRegistry::
 register_compiler(ShaderCompiler *compiler) {
 register_compiler(ShaderCompiler *compiler) {
   // Make sure we haven't already registered this compiler.
   // Make sure we haven't already registered this compiler.
   if (find(_compilers.begin(), _compilers.end(), compiler) != _compilers.end()) {
   if (find(_compilers.begin(), _compilers.end(), compiler) != _compilers.end()) {
-    if (shaderpipeline_cat->is_debug()) {
-      shaderpipeline_cat->debug()
+    if (shader_cat->is_debug()) {
+      shader_cat.debug()
         << "Attempt to register ShaderCompiler " << compiler->get_name()
         << "Attempt to register ShaderCompiler " << compiler->get_name()
         << " (" << compiler->get_type() << ") more than once.\n";
         << " (" << compiler->get_type() << ") more than once.\n";
     }
     }
@@ -76,8 +76,8 @@ register_deferred_compiler(Shader::ShaderLanguage language, const string &librar
   if (li != _languages.end()) {
   if (li != _languages.end()) {
     // We already have a loader for this compiler; no need to register another
     // We already have a loader for this compiler; no need to register another
     // one.
     // one.
-    if (shaderpipeline_cat->is_debug()) {
-      shaderpipeline_cat->debug()
+    if (shader_cat->is_debug()) {
+      shader_cat.debug()
         << "Attempt to register loader library " << library
         << "Attempt to register loader library " << library
         << " (" << language << ") when language is already known.\n";
         << " (" << language << ") when language is already known.\n";
     }
     }
@@ -88,15 +88,15 @@ register_deferred_compiler(Shader::ShaderLanguage language, const string &librar
   di = _deferred_compilers.find(language);
   di = _deferred_compilers.find(language);
   if (di != _deferred_compilers.end()) {
   if (di != _deferred_compilers.end()) {
     if ((*di).second == library) {
     if ((*di).second == library) {
-      if (shaderpipeline_cat->is_debug()) {
-        shaderpipeline_cat->debug()
+      if (shader_cat->is_debug()) {
+        shader_cat.debug()
           << "Attempt to register loader library " << library
           << "Attempt to register loader library " << library
           << " (" << language << ") more than once.\n";
           << " (" << language << ") more than once.\n";
       }
       }
       return;
       return;
     } else {
     } else {
-      if (shaderpipeline_cat->is_debug()) {
-        shaderpipeline_cat->debug()
+      if (shader_cat->is_debug()) {
+        shader_cat.debug()
           << "Multiple libraries registered that use the language "
           << "Multiple libraries registered that use the language "
           << language << "\n";
           << language << "\n";
       }
       }
@@ -144,16 +144,16 @@ get_compiler_from_language(Shader::ShaderLanguage language) {
       Filename dlname = Filename::dso_filename("lib" + name + ".so");
       Filename dlname = Filename::dso_filename("lib" + name + ".so");
       _deferred_compilers.erase(di);
       _deferred_compilers.erase(di);
 
 
-      shaderpipeline_cat->info()
+      shader_cat->info()
         << "loading file compiler module: " << name << std::endl;
         << "loading file compiler module: " << name << std::endl;
       void *tmp = load_dso(get_plugin_path().get_value(), dlname);
       void *tmp = load_dso(get_plugin_path().get_value(), dlname);
       if (tmp == nullptr) {
       if (tmp == nullptr) {
-        shaderpipeline_cat->warning()
+        shader_cat->warning()
           << "Unable to load " << dlname.to_os_specific() << ": "
           << "Unable to load " << dlname.to_os_specific() << ": "
           << load_dso_error() << std::endl;
           << load_dso_error() << std::endl;
         return nullptr;
         return nullptr;
-      } else if (shaderpipeline_cat.is_debug()) {
-        shaderpipeline_cat.debug()
+      } else if (shader_cat.is_debug()) {
+        shader_cat.debug()
           << "done loading file compiler module: " << name << std::endl;
           << "done loading file compiler module: " << name << std::endl;
       }
       }
 
 
@@ -231,8 +231,8 @@ record_language(Shader::ShaderLanguage language, ShaderCompiler *compiler) {
   Languages::const_iterator li;
   Languages::const_iterator li;
   li = _languages.find(language);
   li = _languages.find(language);
   if (li != _languages.end()) {
   if (li != _languages.end()) {
-    if (shaderpipeline_cat->is_debug()) {
-      shaderpipeline_cat->debug()
+    if (shader_cat->is_debug()) {
+      shader_cat.debug()
         << "Multiple ShaderCompilers registered that use the language "
         << "Multiple ShaderCompilers registered that use the language "
         << language << "\n";
         << language << "\n";
     }
     }

+ 1 - 1
panda/src/shaderpipeline/shaderCompilerRegistry.h → panda/src/gobj/shaderCompilerRegistry.h

@@ -25,7 +25,7 @@ class ShaderCompiler;
 /**
 /**
  * This class maintains the set of all known ShaderCompilers in the universe.
  * This class maintains the set of all known ShaderCompilers in the universe.
  */
  */
-class EXPCL_PANDA_SHADERPIPELINE ShaderCompilerRegistry {
+class EXPCL_PANDA_GOBJ ShaderCompilerRegistry {
 protected:
 protected:
   ShaderCompilerRegistry();
   ShaderCompilerRegistry();
 
 

+ 67 - 0
panda/src/shaderpipeline/CMakeLists.txt

@@ -0,0 +1,67 @@
+set(P3SHADERPIPELINE_HEADERS
+  config_shaderpipeline.h
+  shaderCompilerGlslang.h
+  shaderCompilerGlslPreProc.h
+  shaderModuleGlsl.h
+  shaderModuleSpirV.h shaderModuleSpirV.I
+  spirVFlattenStructPass.h
+  spirVHoistStructResourcesPass.h
+  spirVMakeBlockPass.h
+  spirVRemoveUnusedVariablesPass.h
+  spirVReplaceVariableTypePass.h
+  spirVResultDatabase.h spirVResultDatabase.I
+  spirVTransformer.h spirVTransformer.I
+  spirVTransformPass.h spirVTransformPass.I
+)
+
+set(P3SHADERPIPELINE_SOURCES
+  config_shaderpipeline.cxx
+  shaderCompilerGlslang.cxx
+  shaderCompilerGlslPreProc.cxx
+  shaderModuleGlsl.cxx
+  shaderModuleSpirV.cxx
+  spirVFlattenStructPass.cxx
+  spirVHoistStructResourcesPass.cxx
+  spirVMakeBlockPass.cxx
+  spirVRemoveUnusedVariablesPass.cxx
+  spirVReplaceVariableTypePass.cxx
+  spirVResultDatabase.cxx
+  spirVTransformer.cxx
+  spirVTransformPass.cxx
+)
+
+add_custom_command(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cg_preamble.cxx
+  COMMAND ${CMAKE_COMMAND}
+    -D OUTPUT_FILE="${CMAKE_CURRENT_BINARY_DIR}/cg_preamble.cxx"
+    -D INPUT_FILES="${CMAKE_CURRENT_SOURCE_DIR}/cg_preamble.hlsl"
+    -D SYMBOL_NAME="cg_preamble"
+    -P ${PROJECT_SOURCE_DIR}/cmake/scripts/ConcatenateToCXX.cmake
+  DEPENDS cg_preamble.hlsl
+  WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
+
+composite_sources(p3shaderpipeline P3SHADERPIPELINE_SOURCES)
+add_component_library(p3shaderpipeline NOINIT SYMBOL BUILDING_PANDA_SHADERPIPELINE
+  ${P3SHADERPIPELINE_HEADERS} ${P3SHADERPIPELINE_SOURCES}
+  ${CMAKE_CURRENT_BINARY_DIR}/cg_preamble.cxx)
+target_link_libraries(p3shaderpipeline p3gobj PKG::GLSLANG)
+
+if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang)$")
+  # Keep symbols from glslang internal.
+  target_link_options(p3shaderpipeline PRIVATE "LINKER:--exclude-libs,libglslang.a")
+  target_link_options(p3shaderpipeline PRIVATE "LINKER:--exclude-libs,libSPIRV.a")
+  target_link_options(p3shaderpipeline PRIVATE "LINKER:--exclude-libs,libOSDependent.a")
+  target_link_options(p3shaderpipeline PRIVATE "LINKER:--exclude-libs,libOGLCompiler.a")
+  target_link_options(p3shaderpipeline PRIVATE "LINKER:--exclude-libs,libHLSL.a")
+  target_link_options(p3shaderpipeline PRIVATE "LINKER:--exclude-libs,libglslang-default-resource-limits.a")
+endif()
+
+if(NOT BUILD_METALIBS)
+  install(TARGETS p3shaderpipeline
+    EXPORT Core COMPONENT Core
+    DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+    INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/panda3d
+    ARCHIVE COMPONENT CoreDevel)
+endif()
+install(FILES ${P3SHADERPIPELINE_HEADERS} COMPONENT CoreDevel DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/panda3d)

+ 0 - 2
panda/src/shaderpipeline/p3shaderpipeline_composite1.cxx

@@ -1,7 +1,5 @@
 #include "config_shaderpipeline.cxx"
 #include "config_shaderpipeline.cxx"
 #include "shaderModuleGlsl.cxx"
 #include "shaderModuleGlsl.cxx"
 #include "shaderModuleSpirV.cxx"
 #include "shaderModuleSpirV.cxx"
-#include "shaderCompiler.cxx"
 #include "shaderCompilerGlslang.cxx"
 #include "shaderCompilerGlslang.cxx"
 #include "shaderCompilerGlslPreProc.cxx"
 #include "shaderCompilerGlslPreProc.cxx"
-#include "shaderCompilerRegistry.cxx"

+ 3 - 1
panda/src/shaderpipeline/shaderCompilerGlslang.cxx

@@ -12,9 +12,11 @@
  */
  */
 
 
 #include "shaderCompilerGlslang.h"
 #include "shaderCompilerGlslang.h"
+#include "config_putil.h"
 #include "config_shaderpipeline.h"
 #include "config_shaderpipeline.h"
-#include "virtualFile.h"
 #include "shaderCompilerGlslPreProc.h"
 #include "shaderCompilerGlslPreProc.h"
+#include "virtualFile.h"
+#include "virtualFileSystem.h"
 
 
 #ifndef CPPPARSER
 #ifndef CPPPARSER
 #include <glslang/Public/ShaderLang.h>
 #include <glslang/Public/ShaderLang.h>