diff --git a/panda/src/display/graphicsStateGuardian.I b/panda/src/display/graphicsStateGuardian.I index 6b6f5fe370..11e091bf2c 100644 --- a/panda/src/display/graphicsStateGuardian.I +++ b/panda/src/display/graphicsStateGuardian.I @@ -447,6 +447,16 @@ get_supports_tex_non_pow2() const { return _supports_tex_non_pow2; } +//////////////////////////////////////////////////////////////////// +// Function: GraphicsStateGuardian::get_supports_texture_srgb +// Access: Published +// Description: Returns true if this GSG can handle sRGB textures. +//////////////////////////////////////////////////////////////////// +INLINE bool GraphicsStateGuardian:: +get_supports_texture_srgb() const { + return _supports_texture_srgb; +} + //////////////////////////////////////////////////////////////////// // Function: GraphicsStateGuardian::get_supports_compressed_texture // Access: Published diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index 2a76922425..1e8131e6b4 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -195,6 +195,7 @@ GraphicsStateGuardian(CoordinateSystem internal_coordinate_system, _supports_2d_texture_array = false; _supports_cube_map = false; _supports_tex_non_pow2 = false; + _supports_texture_srgb = false; _supports_compressed_texture = false; _compressed_texture_formats.clear(); _compressed_texture_formats.set_bit(Texture::CM_off); diff --git a/panda/src/display/graphicsStateGuardian.h b/panda/src/display/graphicsStateGuardian.h index 883a57c0c2..8484ee1be6 100644 --- a/panda/src/display/graphicsStateGuardian.h +++ b/panda/src/display/graphicsStateGuardian.h @@ -127,6 +127,7 @@ PUBLISHED: INLINE bool get_supports_2d_texture_array() const; INLINE bool get_supports_cube_map() const; INLINE bool get_supports_tex_non_pow2() const; + INLINE bool get_supports_texture_srgb() const; INLINE bool get_supports_compressed_texture() const; virtual INLINE bool get_supports_compressed_texture_format(int compression_mode) const; @@ -476,6 +477,7 @@ protected: bool _supports_2d_texture_array; bool _supports_cube_map; bool _supports_tex_non_pow2; + bool _supports_texture_srgb; bool _supports_compressed_texture; BitMask32 _compressed_texture_formats; diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 2ad5a127ec..7a95f02a66 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -828,6 +828,14 @@ reset() { } #endif + _supports_texture_srgb = false; + if (is_at_least_gl_version(2, 1) || has_extension("GL_EXT_texture_sRGB")) { + _supports_texture_srgb = true; + + } else if (has_extension("GL_EXT_sRGB")) { // GLES case. + _supports_texture_srgb = true; + } + _supports_compressed_texture = false; #ifdef OPENGLES diff --git a/panda/src/gsgbase/graphicsStateGuardianBase.h b/panda/src/gsgbase/graphicsStateGuardianBase.h index 32022ebe9a..7f8c13e0a7 100644 --- a/panda/src/gsgbase/graphicsStateGuardianBase.h +++ b/panda/src/gsgbase/graphicsStateGuardianBase.h @@ -124,6 +124,8 @@ PUBLISHED: virtual int get_supported_geom_rendering() const=0; virtual bool get_supports_shadow_filter() const=0; + virtual bool get_supports_texture_srgb() const=0; + public: // These are some general interface functions; they're defined here // mainly to make it easy to call these from code in some directory