add max-texture-stages

This commit is contained in:
David Rose 2008-10-11 14:05:52 +00:00
parent a926c201af
commit c152dfa441
4 changed files with 18 additions and 2 deletions

View File

@ -132,6 +132,17 @@ ConfigVariableBool prefer_single_buffer
"false (since in that case the buffer can share a graphics context "
"with the window)."));
ConfigVariableInt max_texture_stages
("max-texture-stages", -1,
PRC_DESC("Set this to a positive integer to limit the number of "
"texture stages reported by the GSG. This can be used to limit "
"the amount of multitexturing Panda will attempt to use. "
"If this is zero or less, the GSG will report its honest number "
"of texture stages, allowing Panda the full use of the graphics "
"card; if it is 1 or more, then Panda will never allow more than "
"this number of texture stages simultaneously, regardless of "
"what the GSG says it can do."));
ConfigVariableBool support_render_texture
("support-render-texture", true,
PRC_DESC("Set this true allow use of the render-to-a-texture feature, if it "

View File

@ -49,6 +49,7 @@ extern EXPCL_PANDA_DISPLAY ConfigVariableBool prefer_texture_buffer;
extern EXPCL_PANDA_DISPLAY ConfigVariableBool prefer_parasite_buffer;
extern EXPCL_PANDA_DISPLAY ConfigVariableBool prefer_single_buffer;
extern EXPCL_PANDA_DISPLAY ConfigVariableInt max_texture_stages;
extern EXPCL_PANDA_DISPLAY ConfigVariableBool support_render_texture;
extern EXPCL_PANDA_DISPLAY ConfigVariableBool support_rescale_normal;
extern EXPCL_PANDA_DISPLAY ConfigVariableBool copy_texture_inverted;

View File

@ -277,6 +277,9 @@ get_max_vertices_per_primitive() const {
////////////////////////////////////////////////////////////////////
INLINE int GraphicsStateGuardian::
get_max_texture_stages() const {
if (max_texture_stages > 0) {
return min(_max_texture_stages, (int)max_texture_stages);
}
return _max_texture_stages;
}

View File

@ -2068,7 +2068,8 @@ void GraphicsStateGuardian::
determine_effective_texture() {
nassertv(_target._texture != (TextureAttrib *)NULL &&
_target._tex_gen != (TexGenAttrib *)NULL);
_effective_texture = _target._texture->filter_to_max(_max_texture_stages);
int max_texture_stages = get_max_texture_stages();
_effective_texture = _target._texture->filter_to_max(max_texture_stages);
_effective_tex_gen = _target._tex_gen;
if (_has_texture_alpha_scale) {
@ -2080,7 +2081,7 @@ determine_effective_texture() {
(stage, TexGenAttrib::M_constant, TexCoord3f(_current_color_scale[3], 0.0f, 0.0f)));
}
nassertv(_effective_texture->get_num_on_stages() <= _max_texture_stages);
nassertv(_effective_texture->get_num_on_stages() <= max_texture_stages);
}
////////////////////////////////////////////////////////////////////