gl2: Disable mipmapping by default.

Despite Ren'Py supporting it, scaling images down (except when the
window is scaled) is somewhat rare. So instead of generating a lot of
mipmaps that will not be used, we only opt in automatically if the
window itself is scaled down, and otherwise leave the decision to
the creator.
This commit is contained in:
Tom Rothamel
2025-02-13 22:46:19 -05:00
parent 74cadd2b03
commit cc2486fa82
8 changed files with 50 additions and 5 deletions
+1
View File
@@ -326,6 +326,7 @@ init -1100 python:
if version <= (8, 3, 99):
config.old_show_expression = True
config.mipmap = True
# The version of Ren'Py this script is intended for, or
+3
View File
@@ -1133,6 +1133,9 @@ controller_blocklist = [
"030000006d0400000000", # Razer Xbox 360 Controller (#4622)
]
# Should other textures be mipmapped by default?
mipmap = "auto"
# Should dissolve transitions be mipmapped by default?
mipmap_dissolves = False
+2
View File
@@ -58,6 +58,8 @@ cdef class GL2Draw:
cdef public Matrix virt_to_draw
cdef public Matrix draw_to_virt
cdef public bint auto_mipmap
# The matrix that goes from drawable space to the window. This isn't used
# directly, it's used to determine if something is being drawn in a wa
# that it should be lined up with pixels.
+5
View File
@@ -137,6 +137,9 @@ cdef class GL2Draw:
# The old value of fullscreen.
self.old_fullscreen = False
# Should mipmaps be generated when mipmap == "auto"?
self.auto_mipmap = False
def get_texture_size(self):
"""
Returns the amount of memory locked up in textures.
@@ -611,6 +614,8 @@ cdef class GL2Draw:
self.init_fbo()
self.texture_loader.init()
self.auto_mipmap = self.draw_per_virt < 0.75
def resize(self):
"""
Documented in renderer.
+9 -4
View File
@@ -307,7 +307,12 @@ cdef class GLTexture(GL2Model):
when it's loaded).
"""
return self.properties.get("mipmap", True)
rv = self.properties.get("mipmap", renpy.config.mipmap)
if rv == "auto":
rv = renpy.display.draw.auto_mipmap
return rv
def get_number(GLTexture self):
return self.number if renpy.emscripten else None
@@ -333,7 +338,7 @@ cdef class GLTexture(GL2Model):
"""
self.properties = {
"mipmap" : properties.get("mipmap", True),
"mipmap" : properties.get("mipmap", renpy.config.mipmap),
"pixel_perfect" : properties.get("pixel_perfect", False),
}
@@ -585,7 +590,7 @@ cdef class GLTexture(GL2Model):
max_level = renpy.config.max_mipmap_level
if not properties.get("mipmap", True):
if not self.has_mipmaps():
max_level = 0
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, max_level)
@@ -630,7 +635,7 @@ cdef class GLTexture(GL2Model):
cdef GLuint level = renpy.config.max_mipmap_level
if not properties.get("mipmap", True):
if not self.has_mipmaps():
level = 0
glBindTexture(GL_TEXTURE_2D, tex)
+4
View File
@@ -87,6 +87,10 @@ inside for translation.
Other Changes
-------------
By default, Ren'Py now only creates mipmaps for textures if the display is scaled down to less than .75 of virtual
window size. This is suitable for games that do not scale down images. To enable mipmapping again, set
:var:`config.mipmap` to True.
Ren'Py no longer triggers and autoreload when a file that had not existed comes into existence. This behavior
had been inconsistent, working in some places but not others, required Ren'Py to spent time scanning for files
that do not exist.
+20
View File
@@ -755,10 +755,30 @@ Media (Music, Sound, and Video)
A list of channels that are stopped when entering or returning to the
main menu.
.. var:: config.mipmap = "auto"
This controls if Ren'Py generates mipmaps for image. If True, mipmaps are always generated. If "auto", mipmaps
are generated only if the window is smaller than 75% of the virtual screen size. If False, mipmaps are never
generated.
.. var:: config.mipmap_dissolves = False
If True, mipmaps are generated for dissolve transitions.
This takes the same values as :var:`config.mipmap`.
.. var:: config.mipmap_movies = False
The default value of the mipmap argument to :func:`Movie`.
This takes the same values as :var:`config.mipmap`.
.. var:: config.mipmap_text = False
If True, mipmaps are generated for text.
This takes the same values as :var:`config.mipmap`.
.. var:: config.movie_mixer = "music"
The mixer that is used when a :func:`Movie` automatically defines
+5
View File
@@ -17,6 +17,11 @@ such changes only take effect when the GUI is regenerated.
8.4.0
-----
**Mipmaps** By default, Ren'Py now only creates mipmaps for textures if the display is scaled down to
less than .75 of virtual window size. This is suitable for games that do not scale down images. To enable
mipmapping again, set :var:`config.mipmap` to True.
**Show expression.** The ``show expression`` statement has been changed so that::
show expression "bg washington"