From 31f9d1994e9c2f7964dfebe1eb1c3d4ba5417f5f Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 15 Jan 2009 00:08:10 +0000 Subject: [PATCH] driver-compress-textures --- panda/src/gobj/config_gobj.cxx | 22 ++++++++++++---------- panda/src/gobj/config_gobj.h | 2 +- panda/src/gobj/texture.cxx | 14 ++++++-------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/panda/src/gobj/config_gobj.cxx b/panda/src/gobj/config_gobj.cxx index 1672ea2c78..dbc0092ba6 100644 --- a/panda/src/gobj/config_gobj.cxx +++ b/panda/src/gobj/config_gobj.cxx @@ -112,16 +112,18 @@ ConfigVariableBool compressed_textures "changes the meaning of set_compression(Texture::CM_default) to " "Texture::CM_on.")); -ConfigVariableBool cpu_compress_textures -("cpu-compress-textures", false, - PRC_DESC("Set this true to use the squish library to compress textures on " - "the CPU, as they are loaded, rather than to hand them off to " - "the graphics driver to compress them. This will be done " - "only if the graphics window is already open and is the default " - "graphics context, and it claims to support DXT1/3/5 " - "compression. If any of this is not true, the texture will " - "not be automatically compressed via squish, but it may still " - "be compressed by the graphics driver.")); +ConfigVariableBool driver_compress_textures +("driver-compress-textures", false, + PRC_DESC("Set this true to ask the graphics driver to compress textures, " + "rather than compressing them in-memory first. Depending on " + "your graphics driver, you may or may not get better performance " + "or results by setting this true. Setting it true may also " + "allow you to take advantage of some exotic compression algorithm " + "other than DXT1/3/5 that your graphics driver supports, but " + "which is unknown to Panda. If the libsquish library is not " + "compiled into Panda, textures cannot be compressed in-memory, " + "and will always be handed to the graphics driver, regardless " + "of this setting.")); ConfigVariableBool vertex_buffers ("vertex-buffers", true, diff --git a/panda/src/gobj/config_gobj.h b/panda/src/gobj/config_gobj.h index 1be20e619c..9539973941 100644 --- a/panda/src/gobj/config_gobj.h +++ b/panda/src/gobj/config_gobj.h @@ -55,7 +55,7 @@ extern EXPCL_PANDA_GOBJ ConfigVariableList exclude_texture_scale; extern EXPCL_PANDA_GOBJ ConfigVariableBool keep_texture_ram; extern EXPCL_PANDA_GOBJ ConfigVariableBool compressed_textures; -extern EXPCL_PANDA_GOBJ ConfigVariableBool cpu_compress_textures; +extern EXPCL_PANDA_GOBJ ConfigVariableBool driver_compress_textures; extern EXPCL_PANDA_GOBJ ConfigVariableBool vertex_buffers; extern EXPCL_PANDA_GOBJ ConfigVariableBool vertex_arrays; extern EXPCL_PANDA_GOBJ ConfigVariableBool display_lists; diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index 1230ce771b..bf2d404f28 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -3162,7 +3162,7 @@ do_make_ram_mipmap_image(int n) { //////////////////////////////////////////////////////////////////// bool Texture:: consider_auto_compress_ram_image() { - if (cpu_compress_textures) { + if (!driver_compress_textures) { CompressionMode compression = _compression; if (compression == CM_default) { if (!compressed_textures) { @@ -3172,13 +3172,11 @@ consider_auto_compress_ram_image() { } if (compression != CM_off && _ram_image_compression == CM_off) { GraphicsStateGuardianBase *gsg = GraphicsStateGuardianBase::get_default_gsg(); - if (gsg != (GraphicsStateGuardianBase *)NULL) { - if (do_compress_ram_image(compression, QL_default, gsg)) { - gobj_cat.info() - << "Compressed " << get_name() << " with " - << _ram_image_compression << "\n"; - return true; - } + if (do_compress_ram_image(compression, QL_default, gsg)) { + gobj_cat.info() + << "Compressed " << get_name() << " with " + << _ram_image_compression << "\n"; + return true; } } }