Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: gl_scaleskytextures 1 does not scale external 24-bit images #606

Closed
hemostx opened this issue Nov 13, 2021 · 1 comment · Fixed by #607
Closed

BUG: gl_scaleskytextures 1 does not scale external 24-bit images #606

hemostx opened this issue Nov 13, 2021 · 1 comment · Fixed by #607

Comments

@hemostx
Copy link
Contributor

hemostx commented Nov 13, 2021

ezQuake version:
3.6 with gl_scaleskytextures (is this new from 3.5?)

OS/device including version:
W10 20H2 GTX 1070 472.12
Should be irrelevant, quirk in texmode logic found

Describe the bug
With gl_scaleskytextures 1 gl_picmip/max_size only applies to 8-bit sky textures. 24-bit textures do not get scaled.

I noticed this while playing around with the gl_scale* cvars for documentation and could compare between i.e. dm3, which features skies that ezquake provides 24-bit external textures for, and skull which only has an 8-bit sky

To Reproduce
Steps to reproduce the behavior:
requires ezquake's 24-bit skies, ie with ezquake/base.pk3

  1. gl_picmip 5;gl_scaleturbtextures 1;gl_scaleskytextures 1
  2. start dm3 (has skies and turbs easily comparable in the same rooms), go to pent or LG
  3. water gets scaled down, sky does not
  4. gl_no24bit 1;vid_restart
  5. water and sky get scaled down

Expected behavior
I would expect the 24-bit skies to get scaled down with gl_scaleskytextures 1, just like the 8bit versions, and as per gl_scaleturbtextures/gl_scalemodeltextures, which already existed in 3.2, for consistency.

Screenshots
With 8-bit textures

  • gl_scaleskytextures 0
    36picmip_8bitskies_scalesky0
  • gl_scaleskytextures 1
    36picmip_8bitskies_scalesky1

With 24-bit textures

  • gl_scaleskytextures 0
    36picmip_24bitskies_scalesky0
  • gl_scaleskytextures 1
    36picmip_24bitskies_scalesky1

Extra context

For an 8-bit texture, R_LoadBrushModelTextures calls R_InitSky, and this eventually calls R_Upload32 which does the downscaling of the texture.

For an external texture, R_LoadBrushModelTextures calls Mod_LoadExternalSkyTexturewhich always passes 0 instead of the texmode flags parameter for the solid texture (alpha texture gets the flag), but of course just changing it to pass flags to R_LoadTextureImageisn't enough. :)

It looks like Mod_LoadExternalSkyTexture always just sets a TEX_NOSCALE flag.

@hemostx
Copy link
Contributor Author

hemostx commented Nov 13, 2021

I think I found what went wrong while comparing the slightly different paths taken through R_LoadBrushModelTextures for sky/turb/model textures.

I mentioned Mod_LoadExternalSkyTexture always just sets a TEX_NOSCALE flag.

  • For gl_scaleturbtextures 0 flags are 34 (TEX_MIPMAP + TEX_NOSCALE)
  • For gl_scaleturbtextures 1 flags are 2(TEX_MIPMAP)
  • For gl_scaleskytextures 0 flags are 32 (TEX_NOSCALE)
  • For gl_scaleskytextures 1 flags are 0 (nothing, which appears to behave like TEX_NOSCALE)

So I eventually changed Mod_LoadExternalSkyTexture to calculate flags as seen for turb/sky.

It also always passed 0 to R_LoadTextureImage for the solidskytexture flags, which I found out to behave like TEX_NOSCALE, while the alphatexture did get the flags passed to it, so I changed that as well.

That applied the scaling with gl_picmip.

After this I went to look for behaviour with gl_max_size and this was fine as well.

I saw R_LoadBrushModelTextures does special work for gl_miptextevel, so I was expecting more work to be needed on this patch. But it turns out in the next couple of lines, the general "miptexlevel does not apply to 24 bit textures" takes care of that, so all seems well on that front and no downscaling occurs as expected.

@meag meag closed this as completed in #607 Nov 14, 2021
meag added a commit to meag/ezquake-source that referenced this issue Nov 14, 2021
### Changes from alpha8=>alpha9 (July 13th => November 14th, 2021)

- Fixed/worked around some classic renderer bugs on version x.y.13399 AMD drivers (QW-Group#416)
- Fixed bug causing off-by-one error when drawing rectangle outlines (3.5 bug, reported by Matrix, QW-Group#536)
- Fixed `/in_raw 0` behaviour on MacOS (QW-Group#489)
- Fixed `/r_drawflat 1`, `/r_drawflat_mode 0` affecting ammo boxes etc in classic renderer
- Fixed match logging not working when using competitive rulesets
- Fixed incomplete rendering when gibbed or dead in shallow water (reported by Matrix, QW-Group#568)
- Fixed tab key not switching tabs on serverinfo popup (reported by Hangtime, QW-Group#555)
- Fixed `/demo_jump_mark` not working if `/demo_jump_rewind` not set
- Fixed coping with 1x1 ibar.png (reported by Matrix, QW-Group#571)
- Fixed powerupshells when using `/r_viewmodelsize` (reported by timbergeron, QW-Group#573)
- Fixed crouch adjustment staying disabled after teleport/respawn when `/cl_nopred` enabled (reported by Matrix, QW-Group#572)
- Added `/gl_smoothmodels` back in (modern renderer only), (requested by Repast via [quakeworld.nu](https://www.quakeworld.nu/forum/topic/7508/why-is-the-command-glsmoothmodels-r))
- Added `/demo_jump_skip_messages` to determine if messages should be printed to console during demo jump
- Added `/demo_jump_end` to jump to next intermission point or end of demo (requested by Hangtime, QW-Group#564)
- Added `/sb_info_filter` to allow filtering of servers in server-browser based on serverinfo (requested by Matrix, QW-Group#537)
- On startup (after `autoexec.cfg` executed), a `vid_restart`/`s_restart` will be issued if any latched variables were changed (reported by Dusty, QW-Group#458)
- Multiview will be disabled when watching a solo demo and no powerup cams are active (requested by mmavova, QW-Group#126)
- MacOS: sets SDL flag to stop touch events being translated into mouse events (might help with QW-Group#354)
- `/status` command will be ignored if an alias with the same name is found, use `/sv_status` instead (fixes QW-Group#532)
- qw:// urls in command line will be opened even if not preceded by `+qwurl` (thanks to ciscon)
- Linux: register_qwurl_protocol will register protocol with xdg (thanks to ciscon)
- Added `/v_dlightcolor` to control if being inside flashblend light affects palette by color of light
- Added `/v_dlightcshiftpercent` to control strength of palette shift effect when inside flashblend light
- Changed `/v_dlightcshift` to be enum of when being inside flashblend light affects palette (requested by HangTime, QW-Group#542)
- Added `/vid_framebuffer_multisample` to control multi-sampling level of the framebuffer (reported by Matrix, QW-Group#367)
- Translucent models are first drawn with a z-pass, to stop overdraw affecting level of translucency
- Fixed explosion effects on md3 viewmodels (additive blending was being lost)
- Removed server-side weapon switching 'support' in client
- Removed debugging messages when using `+fire_ar`
- Commands that search by regular expression (`/cvarlist_re` etc) are now case-insensitive (reported by HangTime, QW-Group#599)
- Added `/fs_savegame_home` to control if games are saved to home directory (default) or game directory (reported by githubtefo, QW-Group#586)
- Fixed `/gl_no24bit` not taking effect after `/vid_restart` (reported by hemostx, QW-Group#601)
- Fixed `/gl_no24bit` not disabling loading external textures (3.5 bug, kind of reported by hemostx, QW-Group#601)
- Fixed bug causing `/gl_scaleskytextures` to not affect external textures (reported & fixed by hemostx, QW-Group#606)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant