Page MenuHomeWildfire Games

[WIP] Allow anisotropic filtering for textures
AbandonedPublic

Authored by Stan on Sep 29 2020, 9:13 AM.

Details

Summary

Fixes a todo in GameSetup.cpp. Currently level 6 of quality is the same as level 5

Test Plan

Enable the option by setting the quality to 6. Check that it works when it's not supported by the platform (aka doesn't crash) make sure it's the proper way to do it tell me where to put the MAX_TEXTURE_MAX_ANISOTROPY_EXT flag. Needs D3020

Event Timeline

Stan created this revision.Sep 29 2020, 9:13 AM

Successful build - Chance fights ever on the side of the prudent.

builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libengine.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(dbghelp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(file_stats.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(vfs_path.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1608/display/redirect

Stan requested review of this revision.Sep 29 2020, 9:20 AM
Stan updated this revision to Diff 13801.Nov 8 2020, 10:18 PM

Add anisotropic

Successful build - Chance fights ever on the side of the prudent.

builderr-debug-macos.txt
../../../source/ps/GameSetup/GameSetup.cpp:161:7: warning: variable 'q_flags' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
        case 6:
             ^
../../../source/ps/GameSetup/GameSetup.cpp:174:23: note: uninitialized use occurs here
        ogl_tex_set_defaults(q_flags, filter);
                             ^~~~~~~
../../../source/ps/GameSetup/GameSetup.cpp:123:13: note: initialize the variable 'q_flags' to silence this warning
        int q_flags;
                   ^
                    = 0
1 warning generated.
builderr-release-macos.txt
../../../source/ps/GameSetup/GameSetup.cpp:161:7: warning: variable 'q_flags' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
        case 6:
             ^
../../../source/ps/GameSetup/GameSetup.cpp:174:23: note: uninitialized use occurs here
        ogl_tex_set_defaults(q_flags, filter);
                             ^~~~~~~
../../../source/ps/GameSetup/GameSetup.cpp:123:13: note: initialize the variable 'q_flags' to silence this warning
        int q_flags;
                   ^
                    = 0
1 warning generated.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libengine.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(dbghelp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(file_stats.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(vfs_path.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1793/display/redirect

Successful build - Chance fights ever on the side of the prudent.

builderr-release-gcc6.txt
../../../source/ps/GameSetup/GameSetup.cpp: In function 'void InitGraphics(const CmdLineArgs&, int, const std::vector<CStr8>&)':
../../../source/ps/GameSetup/GameSetup.cpp:174:39: warning: 'q_flags' may be used uninitialized in this function [-Wmaybe-uninitialized]
  ogl_tex_set_defaults(q_flags, filter);
                                       ^
../../../source/ps/GameSetup/GameSetup.cpp:123:6: note: 'q_flags' was declared here
  int q_flags;
      ^~~~~~~

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/3445/display/redirect

Stan updated this revision to Diff 13802.Nov 8 2020, 10:36 PM

Fix typo

Successful build - Chance fights ever on the side of the prudent.

builderr-debug-macos.txt
../../../source/ps/GameSetup/GameSetup.cpp:161:7: warning: variable 'q_flags' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
        case 6:
             ^
../../../source/ps/GameSetup/GameSetup.cpp:174:23: note: uninitialized use occurs here
        ogl_tex_set_defaults(q_flags, filter);
                             ^~~~~~~
../../../source/ps/GameSetup/GameSetup.cpp:123:13: note: initialize the variable 'q_flags' to silence this warning
        int q_flags;
                   ^
                    = 0
1 warning generated.
builderr-release-macos.txt
../../../source/ps/GameSetup/GameSetup.cpp:161:7: warning: variable 'q_flags' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
        case 6:
             ^
../../../source/ps/GameSetup/GameSetup.cpp:174:23: note: uninitialized use occurs here
        ogl_tex_set_defaults(q_flags, filter);
                             ^~~~~~~
../../../source/ps/GameSetup/GameSetup.cpp:123:13: note: initialize the variable 'q_flags' to silence this warning
        int q_flags;
                   ^
                    = 0
1 warning generated.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libengine.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(dbghelp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(file_stats.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(vfs_path.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1794/display/redirect

Successful build - Chance fights ever on the side of the prudent.

builderr-release-gcc6.txt
../../../source/ps/GameSetup/GameSetup.cpp: In function 'void InitGraphics(const CmdLineArgs&, int, const std::vector<CStr8>&)':
../../../source/ps/GameSetup/GameSetup.cpp:174:39: warning: 'q_flags' may be used uninitialized in this function [-Wmaybe-uninitialized]
  ogl_tex_set_defaults(q_flags, filter);
                                       ^
../../../source/ps/GameSetup/GameSetup.cpp:123:6: note: 'q_flags' was declared here
  int q_flags;
      ^~~~~~~

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/3446/display/redirect

wraitii requested changes to this revision.Nov 9 2020, 12:48 PM
wraitii added a subscriber: wraitii.

It's funny how apparently innocuous code can be terribly broken.

This doesn't work: it's g_AtlasGameLoop->running (your test never passes), and you need to call ogl_tex_upload before have_anistropy (which is typo-ed lol) or things crash.

I also don't think it's a great default, as trilinear filtering is probably fine enough for 0 A.D. You probably should hook in the general quality settings too, but you probably want D2293 for that.

This revision now requires changes to proceed.Nov 9 2020, 12:48 PM
Stan updated this revision to Diff 13815.Nov 9 2020, 1:19 PM

Fix notes

Vulcan added a comment.Nov 9 2020, 1:39 PM

Build failure - The Moirai have given mortals hearts that can endure.

builderr-debug-gcc6.txt
In file included from ../../../source/lib/debug.h:44:0,
                 from ../../../source/lib/precompiled.h:74,
                 from ../../../source/pch/lowlevel/precompiled.h:18:
../../../source/lib/res/graphics/ogl_tex.cpp: In function 'void OglTex_init(OglTex*, __va_list_tag*)':
../../../source/lib/res/graphics/ogl_tex.cpp:433:29: error: 'detect_gl_upload_caps' was not declared in this scope
  ONCE(detect_gl_upload_caps());
                             ^
../../../source/lib/code_generation.h:41:32: note: in definition of macro 'STMT'
 #define STMT(STMT_code__) do { STMT_code__; } while(false)
                                ^~~~~~~~~~~
../../../source/lib/res/graphics/ogl_tex.cpp:433:2: note: in expansion of macro 'ONCE'
  ONCE(detect_gl_upload_caps());
  ^
../../../source/lib/res/graphics/ogl_tex.cpp: At global scope:
../../../source/lib/res/graphics/ogl_tex.cpp:739:13: warning: 'void detect_gl_upload_caps()' defined but not used [-Wunused-function]
 static void detect_gl_upload_caps()
             ^~~~~~~~~~~~~~~~~~~~~
make[1]: *** [obj/lowlevel_Debug/ogl_tex.o] Error 1
make: *** [lowlevel] Error 2

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/3456/display/redirect

Vulcan added a comment.Nov 9 2020, 1:52 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/2903/display/redirect

Vulcan added a comment.Nov 9 2020, 2:19 PM

Build failure - The Moirai have given mortals hearts that can endure.

builderr-debug-macos.txt
../../../source/lib/res/graphics/ogl_tex.cpp:433:7: error: use of undeclared identifier 'detect_gl_upload_caps'
        ONCE(detect_gl_upload_caps());
             ^
1 error generated.
make[1]: *** [obj/lowlevel_Debug/ogl_tex.o] Error 1
make: *** [lowlevel] Error 2

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1804/display/redirect

Stan abandoned this revision.Dec 12 2021, 9:01 PM

Superseeded by D3726

Anisotropic filtering option was added in rP26365.