Add interface and abstract representation for shader models.

This commit is contained in:
aignacio_sf 2006-06-16 22:31:36 +00:00
parent bd4d95f48b
commit f15e24ed3e
3 changed files with 45 additions and 0 deletions

View File

@ -536,6 +536,30 @@ get_supports_two_sided_stencil() const {
return _supports_two_sided_stencil;
}
////////////////////////////////////////////////////////////////////
// Function: GraphicsStateGuardian::get_shader_model
// Access: Published
// Description: Returns the ShaderModel
////////////////////////////////////////////////////////////////////
INLINE int GraphicsStateGuardian::
get_shader_model() const {
return _shader_model;
}
////////////////////////////////////////////////////////////////////
// Function: GraphicsStateGuardian::set_shader_model
// Access: Published
// Description: Sets the ShaderModel. This will override the auto-
// detected shader model during GSG reset. Useful for
// testing lower-end shaders.
////////////////////////////////////////////////////////////////////
INLINE void GraphicsStateGuardian::
set_shader_model(int shader_model) {
if (shader_model <= _auto_detect_shader_model) {
_shader_model = shader_model;
}
}
////////////////////////////////////////////////////////////////////
// Function: GraphicsStateGuardian::get_color_scale_via_lighting
// Access: Published

View File

@ -164,6 +164,10 @@ GraphicsStateGuardian(CoordinateSystem internal_coordinate_system,
_color_scale_via_lighting = color_scale_via_lighting;
_stencil_render_states = 0;
// The default is no shader support.
_auto_detect_shader_model = SM_00;
_shader_model = SM_00;
}
////////////////////////////////////////////////////////////////////

View File

@ -72,6 +72,17 @@ public:
virtual ~GraphicsStateGuardian();
PUBLISHED:
enum ShaderModel
{
SM_00,
SM_11,
SM_20,
SM_2X,
SM_30,
SM_40,
};
INLINE void release_all();
INLINE int release_all_textures();
INLINE int release_all_geoms();
@ -122,6 +133,9 @@ PUBLISHED:
INLINE bool get_supports_basic_shaders() const;
INLINE bool get_supports_two_sided_stencil() const;
INLINE int get_shader_model() const;
INLINE void set_shader_model(int shader_model);
virtual int get_supported_geom_rendering() const;
INLINE bool get_color_scale_via_lighting() const;
@ -374,6 +388,9 @@ protected:
StencilRenderStates *_stencil_render_states;
int _auto_detect_shader_model;
int _shader_model;
public:
// Statistics
static PStatCollector _vertex_buffer_switch_pcollector;