Browse Source

Don't require building with Cg Toolkit to use ShaderGenerator/Cg shaders

rdb 5 years ago
parent
commit
1b05663425

+ 0 - 2
panda/src/display/graphicsStateGuardian.cxx

@@ -3540,7 +3540,6 @@ make_shadow_buffer(LightLensNode *light, Texture *tex, GraphicsOutput *host) {
  */
 void GraphicsStateGuardian::
 ensure_generated_shader(const RenderState *state) {
-#ifdef HAVE_CG
   const ShaderAttrib *shader_attrib;
   state->get_attrib_def(shader_attrib);
 
@@ -3568,7 +3567,6 @@ ensure_generated_shader(const RenderState *state) {
       state->_generated_shader_seq = _generated_shader_seq;
     }
   }
-#endif
 }
 
 /**

+ 0 - 2
panda/src/display/standardMunger.cxx

@@ -45,9 +45,7 @@ StandardMunger(GraphicsStateGuardianBase *gsg, const RenderState *state,
 {
   const ShaderAttrib *shader_attrib;
   state->get_attrib_def(shader_attrib);
-#ifdef HAVE_CG
   _auto_shader = shader_attrib->auto_shader();
-#endif
   if (shader_attrib->get_flag(ShaderAttrib::F_hardware_skinning)) {
     _shader_skinning = true;
   }

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

@@ -3396,12 +3396,6 @@ make(string body, ShaderLanguage lang) {
       << "Shader::make() now requires an explicit shader language.  Assuming Cg.\n";
     lang = SL_Cg;
   }
-#ifndef HAVE_CG
-  if (lang == SL_Cg) {
-    shader_cat.error() << "Support for Cg shaders is not enabled.\n";
-    return nullptr;
-  }
-#endif
 
   ShaderFile sbody(move(body));
 
@@ -3451,12 +3445,6 @@ make(string body, ShaderLanguage lang) {
 PT(Shader) Shader::
 make(ShaderLanguage lang, string vertex, string fragment, string geometry,
      string tess_control, string tess_evaluation) {
-#ifndef HAVE_CG
-  if (lang == SL_Cg) {
-    shader_cat.error() << "Support for Cg shaders is not enabled.\n";
-    return nullptr;
-  }
-#endif
   if (lang == SL_none) {
     shader_cat.error()
       << "Shader::make() requires an explicit shader language.\n";

+ 0 - 2
panda/src/gsgbase/graphicsStateGuardianBase.h

@@ -234,9 +234,7 @@ public:
   virtual void ensure_generated_shader(const RenderState *state)=0;
 
   static void mark_rehash_generated_shaders() {
-#ifdef HAVE_CG
     ++_generated_shader_seq;
-#endif
   }
 
   virtual void push_group_marker(const std::string &marker) {}

+ 0 - 4
panda/src/pgraphnodes/shaderGenerator.cxx

@@ -51,8 +51,6 @@ using std::string;
 
 TypeHandle ShaderGenerator::_type_handle;
 
-#ifdef HAVE_CG
-
 #define UNPACK_COMBINE_SRC(from, n) (TextureStage::CombineSource)((from >> ((uint16_t)n * 5u)) & 7u)
 #define UNPACK_COMBINE_OP(from, n) (TextureStage::CombineOperand)(((from >> (((uint16_t)n * 5u) + 3u)) & 3u) + 1u)
 
@@ -2023,5 +2021,3 @@ operator == (const ShaderKey &other) const {
       && _num_clip_planes == other._num_clip_planes
       && _light_ramp == other._light_ramp;
 }
-
-#endif  // HAVE_CG

+ 0 - 26
panda/src/pgraphnodes/shaderGenerator.h

@@ -19,8 +19,6 @@
 #include "pandabase.h"
 #include "typedReferenceCount.h"
 
-#ifdef HAVE_CG
-
 #include "graphicsStateGuardianBase.h"
 #include "graphicsOutputBase.h"
 #include "nodePath.h"
@@ -192,30 +190,6 @@ private:
   static TypeHandle _type_handle;
 };
 
-#else
-
-// If we don't have Cg, let's replace this with a stub.
-class EXPCL_PANDA_PGRAPHNODES ShaderGenerator : public TypedReferenceCount {
-public:
-  static TypeHandle get_class_type() {
-    return _type_handle;
-  }
-  static void init_type() {
-    TypedReferenceCount::init_type();
-    register_type(_type_handle, "ShaderGenerator",
-                  TypedReferenceCount::get_class_type());
-  }
-  virtual TypeHandle get_type() const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
-
-private:
-  static TypeHandle _type_handle;
-};
-
 #include "shaderGenerator.I"
 
-#endif  // HAVE_CG
-
 #endif  // SHADERGENERATOR_H