mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
Compile out things irrelevant for target build, like ShaderGenerator when !HAVE_CG
This commit is contained in:
parent
3d2d1d9c23
commit
adb02a8f45
@ -2001,9 +2001,11 @@ setup_scene(GraphicsStateGuardian *gsg, DisplayRegionPipelineReader *dr) {
|
||||
// to use. We have to do this here because the ShaderGenerator
|
||||
// needs a host window pointer. Hopefully we'll be able to
|
||||
// eliminate that requirement in the future.
|
||||
#ifdef HAVE_CG
|
||||
if (gsg->get_shader_generator() == NULL) {
|
||||
gsg->set_shader_generator(new ShaderGenerator(gsg, window));
|
||||
}
|
||||
#endif
|
||||
|
||||
return scene_setup;
|
||||
}
|
||||
|
@ -365,6 +365,7 @@ munge_state_impl(const RenderState *state) {
|
||||
munged_state = munged_state->remove_attrib(ColorScaleAttrib::get_class_slot());
|
||||
}
|
||||
|
||||
#ifdef HAVE_CG
|
||||
if (_auto_shader) {
|
||||
CPT(RenderState) shader_state = munged_state->get_auto_shader_state();
|
||||
ShaderGenerator *shader_generator = get_gsg()->get_shader_generator();
|
||||
@ -379,6 +380,7 @@ munge_state_impl(const RenderState *state) {
|
||||
}
|
||||
munged_state = munged_state->set_attrib(shader_state->_generated_shader);
|
||||
}
|
||||
#endif
|
||||
|
||||
return munged_state;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "shaderGenerator.h"
|
||||
|
||||
#include "renderState.h"
|
||||
#include "shaderAttrib.h"
|
||||
#include "auxBitplaneAttrib.h"
|
||||
@ -44,6 +45,8 @@
|
||||
|
||||
TypeHandle ShaderGenerator::_type_handle;
|
||||
|
||||
#ifdef HAVE_CG
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ShaderGenerator::Constructor
|
||||
// Access: Published
|
||||
@ -1636,3 +1639,5 @@ texture_type_as_string(Texture::TextureType ttype) {
|
||||
return "2D";
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAVE_CG
|
||||
|
@ -17,6 +17,10 @@
|
||||
#define SHADERGENERATOR_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "typedReferenceCount.h"
|
||||
|
||||
#ifdef HAVE_CG
|
||||
|
||||
#include "graphicsStateGuardianBase.h"
|
||||
#include "graphicsOutputBase.h"
|
||||
#include "nodePath.h"
|
||||
@ -169,10 +173,34 @@ public:
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
|
||||
private:
|
||||
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() {
|
||||
TypedObject::init_type();
|
||||
register_type(_type_handle, "ShaderGenerator",
|
||||
TypedObject::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
|
||||
|
@ -162,12 +162,4 @@ has_sse2_sRGB_encode() {
|
||||
return has_support;
|
||||
}
|
||||
|
||||
#else
|
||||
// Other architectures don't support SSE2 at all.
|
||||
|
||||
bool
|
||||
has_sse2_sRGB_encode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // __SSE2__
|
||||
|
@ -45,6 +45,7 @@ EXPCL_PANDA_PNMIMAGE INLINE void encode_sRGB_uchar(const LColorf &from,
|
||||
|
||||
// Use these functions if you know that SSE2 support is available.
|
||||
// Otherwise, they will crash!
|
||||
#if defined(__SSE2__) || defined(__i386__) || defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)
|
||||
EXPCL_PANDA_PNMIMAGE unsigned char encode_sRGB_uchar_sse2(float val);
|
||||
EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar_sse2(const LColorf &from,
|
||||
xel &into);
|
||||
@ -53,6 +54,11 @@ EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar_sse2(const LColorf &from,
|
||||
|
||||
// Use the following to find out if you can call either of the above.
|
||||
EXPCL_PANDA_PNMIMAGE bool has_sse2_sRGB_encode();
|
||||
#else
|
||||
// The target architecture can't support the SSE2 extension at all.
|
||||
#define encode_sRGB_uchar_sse2 encode_sRGB_uchar
|
||||
#define has_sse2_sRGB_encode() (false)
|
||||
#endif
|
||||
|
||||
#include "convert_srgb.I"
|
||||
|
||||
|
@ -127,10 +127,11 @@ encode_sRGB_uchar_sse2(const LColorf &color, xel &into, xelval &into_alpha) {
|
||||
into_alpha = _mm_extract_epi16(vals, 6);
|
||||
}
|
||||
|
||||
#else
|
||||
// Somehow we're still compiling this without SSE2 support. We'll
|
||||
// still have to define these functions, but emit a warning that the
|
||||
// build system isn't configured properly.
|
||||
#elif defined(__i386__) || defined(_M_IX86)
|
||||
// Somehow we're still compiling this without SSE2 support, even though the
|
||||
// target architecture could (in theory) support SSE2. We still have to
|
||||
// define these functions, but emit a warning that the build system isn't
|
||||
// configured properly.
|
||||
#warning convert_srgb_sse2.cxx is being compiled without SSE2 support!
|
||||
|
||||
unsigned char
|
||||
|
@ -862,10 +862,8 @@ generate_hash(ChecksumHashGenerator &hashgen) const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class WType, int nbits>
|
||||
void BitMask<WType, nbits>::
|
||||
init_type() {
|
||||
ostringstream str;
|
||||
str << "BitMask" << num_bits;
|
||||
register_type(_type_handle, str.str());
|
||||
init_type(const string &name) {
|
||||
register_type(_type_handle, name);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -144,7 +144,7 @@ public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type();
|
||||
static void init_type(const string &name);
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
|
@ -181,9 +181,9 @@ init_libputil() {
|
||||
BamReaderAuxData::init_type();
|
||||
BamReaderParam::init_type();
|
||||
BitArray::init_type();
|
||||
BitMask16::init_type();
|
||||
BitMask32::init_type();
|
||||
BitMask64::init_type();
|
||||
BitMask16::init_type("BitMask16");
|
||||
BitMask32::init_type("BitMask32");
|
||||
BitMask64::init_type("BitMask64");
|
||||
ButtonHandle::init_type();
|
||||
ButtonMap::init_type();
|
||||
CPointerCallbackObject::init_type();
|
||||
|
Loading…
x
Reference in New Issue
Block a user