Browse Source

shaderpipeline: Move ShaderModule class to gobj

It can't be in shaderpipeline, because Shader is in gobj, and requires ShaderModule.
rdb 5 years ago
parent
commit
d79d56fe2b

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

@@ -49,6 +49,8 @@ set(P3GOBJ_HEADERS
   shader.I shader.h
   shader.I shader.h
   shaderBuffer.h shaderBuffer.I
   shaderBuffer.h shaderBuffer.I
   shaderContext.h shaderContext.I
   shaderContext.h shaderContext.I
+  shaderModule.h shaderModule.I
+  shaderType.h shaderType.I
   simpleAllocator.h simpleAllocator.I
   simpleAllocator.h simpleAllocator.I
   simpleLru.h simpleLru.I
   simpleLru.h simpleLru.I
   sliderTable.I sliderTable.h
   sliderTable.I sliderTable.h
@@ -129,6 +131,8 @@ set(P3GOBJ_SOURCES
   shader.cxx
   shader.cxx
   shaderBuffer.cxx
   shaderBuffer.cxx
   shaderContext.cxx
   shaderContext.cxx
+  shaderModule.cxx
+  shaderType.cxx
   simpleAllocator.cxx
   simpleAllocator.cxx
   simpleLru.cxx
   simpleLru.cxx
   sliderTable.cxx
   sliderTable.cxx

+ 3 - 1
panda/src/gobj/config_gobj.cxx

@@ -53,6 +53,7 @@
 #include "samplerState.h"
 #include "samplerState.h"
 #include "shader.h"
 #include "shader.h"
 #include "shaderContext.h"
 #include "shaderContext.h"
+#include "shaderModule.h"
 #include "shaderType.h"
 #include "shaderType.h"
 #include "transformBlend.h"
 #include "transformBlend.h"
 #include "transformBlendTable.h"
 #include "transformBlendTable.h"
@@ -586,8 +587,9 @@ ConfigureFn(config_gobj) {
   QueryContext::init_type();
   QueryContext::init_type();
   SamplerContext::init_type();
   SamplerContext::init_type();
   SamplerState::init_type();
   SamplerState::init_type();
-  ShaderContext::init_type();
   Shader::init_type();
   Shader::init_type();
+  ShaderContext::init_type();
+  ShaderModule::init_type();
   ShaderType::init_type();
   ShaderType::init_type();
   SliderTable::init_type();
   SliderTable::init_type();
   Texture::init_type();
   Texture::init_type();

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

@@ -5,9 +5,10 @@
 #include "samplerContext.cxx"
 #include "samplerContext.cxx"
 #include "samplerState.cxx"
 #include "samplerState.cxx"
 #include "savedContext.cxx"
 #include "savedContext.cxx"
+#include "shader.cxx"
 #include "shaderBuffer.cxx"
 #include "shaderBuffer.cxx"
 #include "shaderContext.cxx"
 #include "shaderContext.cxx"
-#include "shader.cxx"
+#include "shaderModule.cxx"
 #include "shaderType.cxx"
 #include "shaderType.cxx"
 #include "simpleAllocator.cxx"
 #include "simpleAllocator.cxx"
 #include "simpleLru.cxx"
 #include "simpleLru.cxx"

+ 0 - 0
panda/src/shaderpipeline/shaderModule.I → panda/src/gobj/shaderModule.I


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


+ 3 - 2
panda/src/shaderpipeline/shaderModule.h → panda/src/gobj/shaderModule.h

@@ -17,6 +17,7 @@
 #include "copyOnWriteObject.h"
 #include "copyOnWriteObject.h"
 #include "bamCacheRecord.h"
 #include "bamCacheRecord.h"
 #include "shaderType.h"
 #include "shaderType.h"
+#include "internalName.h"
 
 
 /**
 /**
  * Represents a single shader module in some intermediate representation for
  * Represents a single shader module in some intermediate representation for
@@ -27,7 +28,7 @@
  * shared between multiple Shader objects, with a unique copy automatically
  * shared between multiple Shader objects, with a unique copy automatically
  * being created if the Shader needs to manipulate the module.
  * being created if the Shader needs to manipulate the module.
  */
  */
-class EXPCL_PANDA_SHADERPIPELINE ShaderModule : public CopyOnWriteObject {
+class EXPCL_PANDA_GOBJ ShaderModule : public CopyOnWriteObject {
 PUBLISHED:
 PUBLISHED:
   enum class Stage {
   enum class Stage {
     vertex,
     vertex,
@@ -48,7 +49,7 @@ PUBLISHED:
 
 
   PUBLISHED:
   PUBLISHED:
     const ShaderType *type;
     const ShaderType *type;
-    CPT_InternalName name;
+    CPT(InternalName) name;
 
 
     MAKE_PROPERTY2(location, has_location, get_location);
     MAKE_PROPERTY2(location, has_location, get_location);
 
 

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

@@ -18,7 +18,6 @@
 #include "shaderCompilerGlslPreProc.h"
 #include "shaderCompilerGlslPreProc.h"
 #include "shaderCompilerCg.h"
 #include "shaderCompilerCg.h"
 
 
-#include "shaderModule.h"
 #include "shaderModuleGlsl.h"
 #include "shaderModuleGlsl.h"
 #include "shaderModuleSpirV.h"
 #include "shaderModuleSpirV.h"
 
 
@@ -47,7 +46,6 @@ init_libshaderpipeline() {
   initialized = true;
   initialized = true;
 
 
   ShaderCompilerGlslang::init_type();
   ShaderCompilerGlslang::init_type();
-  ShaderModule::init_type();
   ShaderModuleSpirV::init_type();
   ShaderModuleSpirV::init_type();
   ShaderModuleGlsl::init_type();
   ShaderModuleGlsl::init_type();
 
 

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

@@ -1,5 +1,4 @@
 #include "config_shaderpipeline.cxx"
 #include "config_shaderpipeline.cxx"
-#include "shaderModule.cxx"
 #include "shaderModuleGlsl.cxx"
 #include "shaderModuleGlsl.cxx"
 #include "shaderModuleSpirV.cxx"
 #include "shaderModuleSpirV.cxx"
 #include "shaderCompiler.cxx"
 #include "shaderCompiler.cxx"

+ 1 - 1
panda/src/shaderpipeline/shaderModuleSpirV.cxx

@@ -62,7 +62,7 @@ ShaderModuleSpirV(Stage stage, std::vector<uint32_t> words) :
     if (def._dtype == DT_variable && def._builtin == SpvBuiltInMax) {
     if (def._dtype == DT_variable && def._builtin == SpvBuiltInMax) {
       Variable var;
       Variable var;
       var.type = def._type;
       var.type = def._type;
-      var.name = def._name;
+      var.name = InternalName::make(def._name);
       var._location = def._location;
       var._location = def._location;
       //var._id = id;
       //var._id = id;