09:01 q4a: Looks like I don't understand something about oDepth and how it should affect to fog? oDepth replaces depth value which used when we have few objects and want to get this result
09:01 q4a: https://learnopengl.com/img/advanced/depth_testing_func_less.png instead of https://learnopengl.com/img/advanced/depth_testing_func_always.png
09:02 q4a: Anyway, if I don't understand how oDepth will affect does not mean that it will not affect at all. So I added oDepth to pixel_shader_code2:
09:02 q4a: https://github.com/q4a/sdl_triangle/blob/d545153e0bdd2f6ba1647bf8fb44ad188ec295c7/d3d9_square/src/d3d9_square.cpp#L194
09:03 q4a: But I got exact same colors.
09:04 q4a: Docs says that: Writing to the oDepth register replaces the interpolated depth value (and ignores any depth bias/slopescale renderstates). If no depth buffer has been created or attached to the device, then write to oDepth is ignored.
09:05 q4a: I checked and here is how to create depth buffer: https://learn.microsoft.com/en-us/windows/win32/direct3d9/creating-a-depth-buffer
09:05 q4a: And looks like it was created..
09:06 q4a: Now I'm reading and testing examples from Introduction to Different Fog Effects page 151: https://www.realtimerendering.com/resources/shaderx/Introductions_and_Tutorials_with_DirectX_9.pdf
09:10 adavy: q4a: hi
09:10 q4a: But fog calculation was made it vertex shader:... (full message at <https://matrix.org/_matrix/media/v3/download/matrix.org/KNGfqDPAwUbebyvCTcEuwGEh>)
09:10 q4a: Hi)
09:11 adavy: well one the states of r300/r500 cards suggests it is possible to use that depth for fog, but it's not sure it does indeed do
09:11 adavy: also maybe you need to enable depth writes ?
09:11 adavy: ZENABLE
09:11 adavy: stuff like that
09:13 q4a: adavy: I already tried with this diff - same colors. https://pastebin.ubuntu.com/p/vqmKdzhPbV/
09:15 adavy: D3DFMT_A8R8G8B8 is not a valid depth buffer
09:15 adavy: you need D3DFMT_D24X8
09:15 adavy: this is the most common
09:17 q4a: you mean I should set present_parameters.BackBufferFormat = D3DFMT_D24X8; ?
09:17 q4a: present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8; - already seted
09:17 adavy: I mean your IDirect3DDevice9_CreateTexture
09:18 q4a: That was commented out
09:18 adavy: ah ok
09:18 adavy: also not sure you can create such a texture
09:18 adavy: you need to create a surface directly
09:18 adavy: but yes the BackBufferFormat thing with AutoDepthStencil should be enough
09:18 q4a: Anyway I wanted to ad - should I create surface and IDirect3DDevice9_SetDepthStencilSurface ?
09:19 q4a: s/ad/ask/, s/IDirect3DDevice9_SetDepthStencilSurface/IDirect3DDevice9\_SetDepthStencilSurface/
09:19 adavy: if it is created for you at the start it is fine
09:19 adavy: as long as you clear the depth buffer between each rendering
09:22 adavy: D3DRS_ZWRITEENABLE is true by default so shoudl be fine
09:23 adavy: q4a: which configurations did you test ?
09:23 q4a: uncommenting `IDirect3DDevice9_CreateTexture(device, 640, 480, 1, D3DUSAGE_DEPTHSTENCIL, D3DFMT_D24S8, D3DPOOL_DEFAULT, &texture, NULL);`
09:23 q4a: did not change anything
09:23 adavy: I expect the difference might only be with the last projection matrix
09:23 q4a: AMD A6-5200 with integrated Radeon HD 8400
09:24 adavy: q4a: was IDirect3DDevice9_SetDepthStencilSurface commented too ?
09:24 q4a: yes)
09:25 q4a: May be something wrong with pixel shader?
09:26 adavy: yes, are you sure it is used ?
09:26 adavy: and it's not using the previous one somehow
09:27 adavy: if you clear the depth buffer to 0.4, it shouldn't draw, but if you clear to 0.6 it should
09:27 adavy: you need ZENABLE
09:27 q4a: I tried 2 variants: directly mov oDepth, c0.x and mov r0.w, c0.x mov oDepth, r0.w - same result
09:32 q4a: adavy: should I enable ZENABLE to all tests or only for oDepth?
09:32 adavy: only odepth
09:32 adavy: just make sure the odepth works
09:32 adavy: the test I described should ensure you indeed change the depth
09:37 q4a: ah.. looks like oDepth works. I got different results with clear depth = 0.4f> Diff: https://pastebin.ubuntu.com/p/jg44GMg7GR/
09:37 q4a: s/>/./
09:38 q4a: and same colors when clear 0.6f
09:38 adavy: well in that case it means despite the hw having states for it, in practice the odepth is not used for fog
09:38 adavy: which is good to know and easier to implement
09:39 adavy: since you're at it
09:39 adavy: you could try if depthbias impacts the fog
09:40 q4a: Should I keep odepth test with same colors?
09:41 q4a: And should I try it on Intel HD Graphics?
09:41 q4a: *test
09:41 adavy: yes, it's better to confirm with different gpus
09:42 adavy: and yes I think it's ok to keep same colors
09:42 adavy: and the odepth test
09:50 adavy: q4a: do you have an example of issues with feature request like you asked ? I get the impression it's mainly for bug reports
09:50 adavy: for the depthbias test I suspect it should impact fog with the last matrix
09:51 q4a: "it's better to confirm with different gpus" - looks like I got different result on Intel HD Graphics =(
09:52 q4a: I want to do clean build on AMD GPU
09:54 adavy: this is ok and interesting to have different results
09:55 adavy: wine tests can support having several possible outputs
09:55 adavy: If you give me an exe that runs on old win xp I can try on old nvidia
09:55 q4a: adavy: here is some exaples of "issues":... (full message at <https://matrix.org/_matrix/media/v3/download/matrix.org/gOyZatFeWDiMNjtNZcOCirYP>)
09:56 adavy: ok
09:57 adavy: Having different results highlights a lot what kind of freedom implementations can have
09:57 adavy: though I would say that intel results are less reliable at that
09:57 adavy: because for old games people didn't have intel gpus
09:57 adavy: at the time
09:57 q4a: `wine tests can support having several possible outputs` - do you have example od such tests?
09:57 q4a: `exe that runs on old win xp` - I'll add my test to my fork of nine tests and give you exe
09:57 adavy: so less need for them to work reliable
09:59 adavy: ok(color_match(color, 0x0000ff00, 1) || color_match(color, 0x000000ff, 1),
09:59 adavy: they test different values
09:59 adavy: you can add a column in your test table for secondary acceptable result
10:00 q4a: thanks!
10:07 q4a: btw, I got fails on test_table_fog_zw when use HD Graphics Ivy Bridge GT1: https://pastebin.ubuntu.com/p/f5WzkxSNsW/
10:07 q4a: same test on Radeon HD8400 has no fails: https://pastebin.ubuntu.com/p/Txg4StQ3TP/
10:08 q4a: and Wine has only 1 result for this test
10:09 adavy: what do you mean by 1 result
10:10 q4a: https://github.com/wine-mirror/wine/blob/master/dlls/d3d9/tests/visual.c - line 20900
10:11 q4a:  {0.7f, 0.0f, D3DZB_TRUE, 0x004cb200}, - only one color
10:11 adavy: well ok
10:11 adavy: again intel might not be a reference for fog
10:12 adavy: because by the time they went into the market of light gaming, games with fog were old
10:12 q4a: Ok, I'll add 2 values to my tests anyway.
11:11 q4a: adavy: your Windows XP is 32-bit?
11:21 adavy: yes
11:21 adavy: q4a: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8845
11:25 adavy: the laptop is 18 years old
11:25 q4a: what gpu it has?
11:25 adavy: an old nvidia gpu
11:26 adavy: GeforeGO 7300
11:28 adavy: my god 64MB of gpu memory
11:28 q4a: nice)
11:29 adavy: the laptop is really almost dead, so I don't power it up unless I have a test fully ready to run it only once
11:30 adavy: if you need me to copy test results, makes sure you don't print useless stuff before it might not be easy to copy with the win xp console
12:11 q4a: adavy: ok I have 32bit exe that builded with xp capability. I don't have XP now, but I tested on Windows 7 and it works. Would you like to test it now or after depthbias tests?
12:41 adavy: i can test it now if you like
12:42 q4a: https://drive.google.com/file/d/17p0kiTVGYqNg4xpT3p8SzIDfeCiEjRH_/view?usp=share_link
12:43 q4a: I have exe and you are ready.. so test it, please
12:45 q4a: I reduced output and it has only color checking: https://pastebin.ubuntu.com/p/wy44XY73PN/
12:45 q4a: run 2 tests, please:
12:45 q4a: NineTests.exe test_table_fog_zw
12:45 q4a: NineTests.exe test_table_shader_fog
12:45 q4a: * run from command line 2 tests, please:
12:45 q4a: NineTests.exe test_table_fog_zw
12:45 q4a: NineTests.exe test_table_shader_fog
13:20 adavy: sorry for the delay I have trouble getting a usb hdd that works
13:21 q4a: that's ok. Old HW is capricious
13:22 adavy: it complains it need vcruntime140.dll
13:23 adavy: if you can make me a new exe with no dependencies...
13:25 adavy: I copied my wine local dll but it doesn't work
13:25 q4a: m.. vcruntime140.dll is standard Microsoft Visual C++ Redistributable
13:25 q4a: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
13:25 adavy: I'll try
13:25 adavy: but it is very risky
13:25 adavy: the hdd doesn't like any installation and can crash on write
13:25 q4a: I can find that dll in my Windows 7
13:26 q4a: but I'm not sure how to build exe with no dependencies
13:26 q4a: if it's possible for XP
13:27 adavy: the link won't install it wants windows 7 or more
13:28 adavy: I'll try older version
13:30 adavy: 2008 version installs but it doesn't help
13:36 adavy: I installed up to 2012 included
13:36 adavy: 2013 doesn't work
13:36 adavy: how do you compile ?
13:38 q4a: try this libs from win7: https://drive.google.com/file/d/1_g3_0_d9-oEvnRI2Uhowby4Li1aALp5Q/view?usp=sharing
13:40 q4a: I used Visual Studio toolset: "Visual Studio 2017 - Windows XP (v141_xp)"
13:41 adavy: now it wants other libs lke api-ms-win someting
13:44 q4a: that's good - it's in same folder. I packed all folder here: https://drive.google.com/file/d/1_g3_0_d9-oEvnRI2Uhowby4Li1aALp5Q/view?usp=sharing
13:45 adavy: I don't see that lib
13:46 q4a: sorry. I posted same link. Here is correct one: https://drive.google.com/file/d/1tu-AOYr-Un12tUPL9RAm0PeUTdkMhyzl/view?usp=sharing
13:49 adavy: it runs
13:49 q4a: cool)
13:52 adavy: all are succs
13:52 adavy: but not exact colors sometimes
13:53 q4a: cool, can you save and post results?
13:53 adavy: https://pastebin.com/DtdPt5uT
13:53 adavy: I managed even to save who NineTests
13:53 adavy: *whole
13:55 adavy: there are lots of fails actually on other tests
13:55 q4a: wow.. I'll check, but it was x64 debug version of NineTests chashed on my Windows 10
13:56 adavy: I cannot paste the whole the paste site complains
13:57 q4a: test_table_fog_zw and test_table_shader_fog is enough for me for now)
13:58 adavy: well at least it confirms we got things right
13:59 q4a: =) Do you think that we need to add depth bias test here?
14:01 q4a: I'm reading `test_depthbias` from Wine and it has interesting thinks like:... (full message at <https://matrix.org/_matrix/media/v3/download/matrix.org/tgLUefbplwvHznSHMZKJygno>)
14:02 q4a: small typos in output messages x=62
14:03 q4a: and more interesting comment like The broken results are for the WARP driver on the testbot...
14:10 q4a: May be you or David Heidelberg can find some time to do full review review of my D3D9 headers changes: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22159
14:11 DavidHeidelberg[m]: LGTM, I guess no-one except us will not review, Ack on merge adavy ?
14:33 adavy: yes depthbias is an interesting one
14:40 q4a: adavy: ok, I should create similar colored stripes as in `test_depthbias` and what options are interesting - ff or programming shader ps/vs shader, with or without oDepth?
14:49 adavy: well I think your current tests are interesting already
14:49 adavy: just add a depth bias of 0.2 for some test and show that it changes or not the result
14:49 adavy: in d3d9 the depth bias is a float constant added to depth
17:28 q4a: adavy: I added depth bias=0.2 to cases 44-53. Looks like color changed in cases that has vertex shader:
17:28 q4a: https://github.com/q4a/nine-tests/commit/7b94815ac55ff4d4ed1605f1c60b3ac4822214db
17:29 q4a: tested on both gpu
18:28 adavy: q4a: makes sense
18:28 adavy: it changes without vertex shader too, right ?
18:29 q4a: no)
18:30 q4a: look at comment \\depth bias did not change color
18:30 q4a: s/\\/`///, s//`/
18:31 adavy: this is weird
18:32 adavy: is it same behaviour on intel ?
18:32 q4a: yes
18:33 adavy: actually looking at your tests it makes sense because the tests that change all use zfog
18:33 adavy: the other ones wfog because they have the other projection matrix
18:34 adavy: my initial bet was depth bias would only affect zfog
18:36 adavy: it's nice these tests enable to once and for all fix zfog/wfog
18:37 adavy: My bet is nine passes all with the wfog patch
18:41 q4a: ok - I made simple test - add depth bias=0.2 to all tests. If they changed color I should get fail: https://pastebin.ubuntu.com/p/jTpsdPRZYv/
18:42 q4a: 72 tests - 18 fails
18:44 q4a: adavy: We are ready for testing and merging https://gitlab.freedesktop.org/axeldavy/mesa/-/commits/fixes_for_merge ?
18:44 adavy: almost
19:02 q4a: So, what is next?
19:09 adavy: You need to add comments about the behaviours (AMD and NVidia first set of results, Intel second, which models were tested)
19:09 adavy: some comments explaining what is happening
19:10 adavy: (that the projection matrix is checked even when using a programmable vs shader, even if its content only affects ff vs shader (first projection matrix vs the second), etc)
19:10 adavy: then submit to wine
19:24 q4a: and you think that they will accept it?)
19:26 adavy: yes