X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fslider_picmip.c;h=ddedc4bab2901e2cd077a60c475aef525f223e80;hb=a5a231fcdc55eaf683187a78b0cc5f0142c3c02a;hp=e906242fe44fc90c3cdcc80bad6afa213e8c9317;hpb=52092d7c275129d71f57b14bbba6ab3920d858fe;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/slider_picmip.c b/qcsrc/menu/xonotic/slider_picmip.c index e906242fe..ddedc4bab 100644 --- a/qcsrc/menu/xonotic/slider_picmip.c +++ b/qcsrc/menu/xonotic/slider_picmip.c @@ -3,6 +3,7 @@ CLASS(XonoticPicmipSlider) EXTENDS(XonoticTextSlider) METHOD(XonoticPicmipSlider, configureXonoticPicmipSlider, void(entity)) METHOD(XonoticPicmipSlider, draw, void(entity)) METHOD(XonoticPicmipSlider, autofix, void(entity)) + ATTRIB(XonoticPicmipSlider, have_s3tc, float, 0) ENDCLASS(XonoticPicmipSlider) entity makeXonoticPicmipSlider(); // note: you still need to call addValue and configureXonoticTextSliderValues! #endif @@ -19,23 +20,26 @@ void XonoticPicmipSlider_configureXonoticPicmipSlider(entity me) { me.configureXonoticTextSlider(me, "gl_picmip"); me.autofix(me); + me.have_s3tc = GL_Have_TextureCompression(); } -float texmemsize() +float texmemsize(float s3tc) { return ( - 2500 * pow(0.5, max(0, cvar("gl_picmip") + cvar("gl_picmip_other"))) - + 1500 * pow(0.5, max(0, cvar("gl_picmip") + cvar("gl_picmip_world"))) - ) * ((cvar("r_texture_dds_load") || cvar("gl_texturecompression")) ? 0.4 : 1.0); // TC: normalmaps 50%, other 25%, few incompressible, guessing 40% as conservative average + 2500 * pow(0.25, max(0, cvar("gl_picmip") + cvar("gl_picmip_other"))) + + 1500 * pow(0.25, max(0, cvar("gl_picmip") + cvar("gl_picmip_world"))) + ) * ((s3tc && (cvar("r_texture_dds_load") || cvar("gl_texturecompression"))) ? 0.2 : 1.0); // TC: normalmaps 50%, other 25%, few incompressible, guessing 40% as conservative average } void XonoticPicmipSlider_autofix(entity me) { float max_hard, max_soft; + if(cvar("menu_picmip_bypass")) + return; max_hard = cvar("sys_memsize_virtual"); max_soft = cvar("sys_memsize_physical"); if(max_hard > 0) { - while(me.value > 0 && texmemsize() > max_hard) + while(me.value > 0 && texmemsize(me.have_s3tc) > max_hard) me.setValue(me, me.value - 1); } // TODO also check the soft limit!