From 10bb4a33d3f5758aa60b7004d18bfa37b7ef3e09 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 19 Dec 2020 11:14:16 +0100 Subject: [PATCH] ShaderGenerator: remove unnecessary member, define all stub methods --- panda/src/pgraphnodes/shaderGenerator.cxx | 24 +++++++++++++++++++++++ panda/src/pgraphnodes/shaderGenerator.h | 13 +++++------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/panda/src/pgraphnodes/shaderGenerator.cxx b/panda/src/pgraphnodes/shaderGenerator.cxx index f78dd4d561..22c37c8187 100644 --- a/panda/src/pgraphnodes/shaderGenerator.cxx +++ b/panda/src/pgraphnodes/shaderGenerator.cxx @@ -2032,4 +2032,28 @@ operator == (const ShaderKey &other) const { && _light_ramp == other._light_ramp; } +#else + +// Stubs for when building without Cg support. +ShaderGenerator:: +ShaderGenerator(const GraphicsStateGuardianBase *gsg) { +} + +ShaderGenerator:: +~ShaderGenerator() { +} + +void ShaderGenerator:: +rehash_generated_shaders() { +} + +void ShaderGenerator:: +clear_generated_shaders() { +} + +CPT(ShaderAttrib) ShaderGenerator:: +synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) { + return nullptr; +} + #endif // HAVE_CG diff --git a/panda/src/pgraphnodes/shaderGenerator.h b/panda/src/pgraphnodes/shaderGenerator.h index 429870c90a..fbaa561a10 100644 --- a/panda/src/pgraphnodes/shaderGenerator.h +++ b/panda/src/pgraphnodes/shaderGenerator.h @@ -89,7 +89,6 @@ protected: // RenderState analysis information. Created by analyze_renderstate: - CPT(RenderState) _state; struct ShaderKey { ShaderKey(); bool operator < (const ShaderKey &other) const; @@ -197,16 +196,14 @@ private: // If we don't have Cg, let's replace this with a stub. class EXPCL_PANDA_PGRAPHNODES ShaderGenerator : public TypedReferenceCount { PUBLISHED: - ShaderGenerator(const GraphicsStateGuardianBase *gsg) {} - virtual ~ShaderGenerator() {} + ShaderGenerator(const GraphicsStateGuardianBase *gsg); + virtual ~ShaderGenerator(); virtual CPT(ShaderAttrib) synthesize_shader(const RenderState *rs, - const GeomVertexAnimationSpec &anim) { - return nullptr; - } + const GeomVertexAnimationSpec &anim); - void rehash_generated_shaders() {} - void clear_generated_shaders() {} + void rehash_generated_shaders(); + void clear_generated_shaders(); public: static TypeHandle get_class_type() {