mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
shader: don't use GENERIC profile to compile Cg shaders
Instead, make an educated guess of what the GSG we are going to be compiling this shader for wants to use as profile.
This commit is contained in:
parent
9382e09b7c
commit
83374de0ff
@ -478,15 +478,6 @@ ConfigVariableBool sync_video
|
||||
"cheesy estimate of scene complexity. Some drivers may ignore "
|
||||
"this request."));
|
||||
|
||||
ConfigVariableBool basic_shaders_only
|
||||
("basic-shaders-only", false,
|
||||
PRC_DESC("Set this to true if you aren't interested in shader model three "
|
||||
"and beyond. Setting this flag will cause panda to disable "
|
||||
"bleeding-edge shader functionality which tends to be unreliable "
|
||||
"or broken. At some point, when functionality that is currently "
|
||||
"flaky becomes reliable, we may expand the definition of what "
|
||||
"constitutes 'basic' shaders."));
|
||||
|
||||
/**
|
||||
* Initializes the library. This must be called at least once before any of
|
||||
* the functions or classes in this library can be used. Normally it will be
|
||||
|
@ -108,7 +108,6 @@ extern EXPCL_PANDA_DISPLAY ConfigVariableDouble pixel_zoom;
|
||||
|
||||
extern EXPCL_PANDA_DISPLAY ConfigVariableColor background_color;
|
||||
extern EXPCL_PANDA_DISPLAY ConfigVariableBool sync_video;
|
||||
extern EXPCL_PANDA_DISPLAY ConfigVariableBool basic_shaders_only;
|
||||
|
||||
extern EXPCL_PANDA_DISPLAY void init_libdisplay();
|
||||
|
||||
|
@ -1684,6 +1684,8 @@ reset() {
|
||||
}
|
||||
}
|
||||
|
||||
Shader::set_default_caps(_shader_caps);
|
||||
|
||||
} else if (_supports_glsl) {
|
||||
// No, but we do support GLSL...
|
||||
_shader_caps._active_vprofile = (int)CG_PROFILE_GLSLV;
|
||||
|
@ -511,6 +511,15 @@ ConfigVariableBool stereo_lens_old_convergence
|
||||
"old, incorrect behavior, this may be set to 'true' to switch "
|
||||
"back to the old calculation."));
|
||||
|
||||
ConfigVariableBool basic_shaders_only
|
||||
("basic-shaders-only", false,
|
||||
PRC_DESC("Set this to true if you aren't interested in shader model three "
|
||||
"and beyond. Setting this flag will cause panda to disable "
|
||||
"bleeding-edge shader functionality which tends to be unreliable "
|
||||
"or broken. At some point, when functionality that is currently "
|
||||
"flaky becomes reliable, we may expand the definition of what "
|
||||
"constitutes 'basic' shaders."));
|
||||
|
||||
ConfigVariableString cg_glsl_version
|
||||
("cg-glsl-version", "",
|
||||
PRC_DESC("If this is set, it forces the Cg compiler to generate GLSL "
|
||||
|
@ -87,6 +87,7 @@ extern EXPCL_PANDA_GOBJ ConfigVariableDouble async_load_delay;
|
||||
extern EXPCL_PANDA_GOBJ ConfigVariableInt lens_geom_segments;
|
||||
extern EXPCL_PANDA_GOBJ ConfigVariableBool stereo_lens_old_convergence;
|
||||
|
||||
extern EXPCL_PANDA_GOBJ ConfigVariableBool basic_shaders_only;
|
||||
extern EXPCL_PANDA_GOBJ ConfigVariableString cg_glsl_version;
|
||||
extern EXPCL_PANDA_GOBJ ConfigVariableBool glsl_preprocess;
|
||||
extern EXPCL_PANDA_GOBJ ConfigVariableInt glsl_include_recursion_limit;
|
||||
|
@ -1589,6 +1589,15 @@ get_compiled(unsigned int &format, string &binary) const {
|
||||
return !binary.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the graphics back-end to specify the caps with which we will
|
||||
* likely want to be compiling our shaders.
|
||||
*/
|
||||
void Shader::
|
||||
set_default_caps(const ShaderCaps &caps) {
|
||||
_default_caps = caps;
|
||||
}
|
||||
|
||||
#ifdef HAVE_CG
|
||||
/**
|
||||
*
|
||||
@ -2364,9 +2373,15 @@ Shader(ShaderLanguage lang) :
|
||||
_cg_fprofile = CG_PROFILE_UNKNOWN;
|
||||
_cg_gprofile = CG_PROFILE_UNKNOWN;
|
||||
if (_default_caps._ultimate_vprofile == 0 || _default_caps._ultimate_vprofile == CG_PROFILE_UNKNOWN) {
|
||||
_default_caps._active_vprofile = CG_PROFILE_GENERIC;
|
||||
_default_caps._active_fprofile = CG_PROFILE_GENERIC;
|
||||
_default_caps._active_gprofile = CG_PROFILE_GENERIC;
|
||||
if (basic_shaders_only) {
|
||||
_default_caps._active_vprofile = CG_PROFILE_ARBVP1;
|
||||
_default_caps._active_fprofile = CG_PROFILE_ARBFP1;
|
||||
_default_caps._active_gprofile = CG_PROFILE_UNKNOWN;
|
||||
} else {
|
||||
_default_caps._active_vprofile = CG_PROFILE_UNKNOWN;
|
||||
_default_caps._active_fprofile = CG_PROFILE_UNKNOWN;
|
||||
_default_caps._active_gprofile = CG_PROFILE_UNKNOWN;
|
||||
}
|
||||
_default_caps._ultimate_vprofile = cgGetProfile("glslv");
|
||||
_default_caps._ultimate_fprofile = cgGetProfile("glslf");
|
||||
_default_caps._ultimate_gprofile = cgGetProfile("glslg");
|
||||
|
@ -527,6 +527,8 @@ public:
|
||||
void set_compiled(unsigned int format, const char *data, size_t length);
|
||||
bool get_compiled(unsigned int &format, std::string &binary) const;
|
||||
|
||||
static void set_default_caps(const ShaderCaps &caps);
|
||||
|
||||
private:
|
||||
#ifdef HAVE_CG
|
||||
ShaderArgClass cg_parameter_class(CGparameter p);
|
||||
|
Loading…
x
Reference in New Issue
Block a user