10110111 / CalcMySky

Simulator of light scattering by planetary atmospheres
GNU General Public License v3.0
29 stars 7 forks source link

Fail to compute radiation from ground #2

Closed Atque closed 1 year ago

Atque commented 2 years ago

I thought it might be best to report this here.

When trying to run a calculation with calcmysky.exe (using the same commands as described in the Readme), it appears to fail when trying to compute the radiation from the ground. I get the message

Computing scattering density layers for radiation from the ground... FAILED: Invalid operation

I have an RX 5700 XT with the latest drivers (21.40.23.07) on a Windows 10 computer (latest updates installed). I have another computer, with the GTX 1070 (latest drivers), and the calculation runs fine from there. Is this an AMD issue?

Running showmysky.exe with already computed textures works fine.

10110111 commented 2 years ago

Please try the updated version with the added option --opengl-debug and post the terminal output.

Atque commented 2 years ago

I get the same output both with and without --opengl-debug. The command I run is

C:\CalcMySky\calcmysky.exe C:\CalcMySky\examples\sample.atmo --opengl-debug

Should I try something else?

10110111 commented 2 years ago

You forgot to specify the output directory using the --out-dir option.

Atque commented 2 years ago

Still the same. I get info about OpenGL vendor and the name of my graphics card (the same which I posted in the Stellarium thread).

10110111 commented 2 years ago

And then it crashes?

Atque commented 2 years ago

Yes, it reaches the part where radiation from the ground is computed, and the line shows up. This is the complete output after using C:\CalcMySky\calcmysky.exe C:\CalcMySky\examples\sample.atmo --out-dir /tmp_1/result --opengl-debug

Writing parameters to output description file... done OpenGL vendor : ATI Technologies Inc. OpenGL renderer: AMD Radeon RX 5700 XT Working on wavelengths 360, 391.333, 422.667, 454 nm (set 1 of 4): Saving shader "/tmp_1/result/shaders/zero-order-scattering/0/common-functions.frag"...done Saving shader "/tmp_1/result/shaders/zero-order-scattering/0/phase-functions.frag"...done Saving shader "/tmp_1/result/shaders/zero-order-scattering/0/render.frag"...done Saving shader "/tmp_1/result/shaders/zero-order-scattering/0/texture-coordinates.frag"...done Saving shader "/tmp_1/result/shaders/zero-order-scattering/0/texture-sampling-functions.frag"...done Saving shader "/tmp_1/result/shaders/eclipsed-zero-order-scattering/0/common-functions.frag"...done Saving shader "/tmp_1/result/shaders/eclipsed-zero-order-scattering/0/direct-irradiance.frag"...done Saving shader "/tmp_1/result/shaders/eclipsed-zero-order-scattering/0/eclipsed-direct-irradiance.frag"...done Saving shader "/tmp_1/result/shaders/eclipsed-zero-order-scattering/0/phase-functions.frag"...done Saving shader "/tmp_1/result/shaders/eclipsed-zero-order-scattering/0/render.frag"...done Saving shader "/tmp_1/result/shaders/eclipsed-zero-order-scattering/0/texture-coordinates.frag"...done Saving shader "/tmp_1/result/shaders/eclipsed-zero-order-scattering/0/texture-sampling-functions.frag"...done Computing parts of scattering order 1: Computing transmittance... done Saving transmittance texture to "/tmp_1/result/transmittance-wlset0.f32"... done Computing direct ground irradiance... done Computing light pollution single scattering... done Computing light pollution multiple scattering... Computing light pollution scattering order 2... done Computing light pollution scattering order 3... done Computing light pollution scattering order 4... done Saving shader "/tmp_1/result/shaders/light-pollution/common-functions.frag"...done Saving shader "/tmp_1/result/shaders/light-pollution/phase-functions.frag"...done Saving shader "/tmp_1/result/shaders/light-pollution/render.frag"...done Saving shader "/tmp_1/result/shaders/light-pollution/texture-coordinates.frag"...done Saving shader "/tmp_1/result/shaders/light-pollution/texture-sampling-functions.frag"...done Working on scattering orders 1 and 2: Computing scattering density layers for radiation from the ground... FAILED: Invalid operation

I'm really inexperienced using the command line, so it might be something obvious I am missing here.

10110111 commented 2 years ago

Computing scattering density layers for radiation from the ground... FAILED: Invalid operation

Oh, that's no good. Apparently, AMD driver doesn't provide useful comments on the errors it reports.

Could you use apitrace to trace what exactly happens? The run would look something like this:

c:\apitrace-10.0-win64\bin\apitrace.exe trace -o cms.trace C:\CalcMySky\calcmysky.exe C:\CalcMySky\examples\sample.atmo --out-dir /tmp_1/result

The result will be a file in the current directory, called cms.trace, which I'd like to analyze.

Atque commented 2 years ago

All right, here it is. I hope the problem can be traced from here. cms.trace.zip

Atque commented 2 years ago

Any news regarding this issue?

10110111 commented 2 years ago

The problem here is that apparently, your GPU (or its driver) doesn't support using a 3D texture as a render target. I don't know what you can do to fix it.

A few ideas:

  1. Try upgrading GPU driver. AMD might have fixed the issue (though I wouldn't hold my breath).
  2. Try running the demo from Bruneton's project and see if it fails too. If it runs successfully, this might point to something.
Atque commented 2 years ago

Thank you for the suggestions. I have the latest drivers (and have tried different settings, with no luck). Bruneton's online demo works fine, but I do remember it not working about 1 year ago (showing only a blank screen, no matter what web browser I used).

10110111 commented 2 years ago

OK, the fact that the demo works is good, but I meant the binary that can be built from the sources in that project. I didn't try to build it in Windows, but it seems to have platform/windows directory that has some scripts for this, like download_build_run.bat (this requires Visual Studio), and also there's a Code::Blocks project in the root directory of the repo.

Atque commented 2 years ago

No, building the project from source does not appear to work (showing only a black screen with the menu in the top-left corner of the screen). This is similar to how the online demo worked approximately 1 year ago.

10110111 commented 2 years ago

Do you have any other AMD GPU model to test on? I wonder whether it's common to AMD or just a special case of RX 5700 XT.

Atque commented 2 years ago

Yes, I tried it on my oldest computer (from 2011 I think, with an AMD card that was not high-end at the time), and it runs CalcMySky's calculation flawlessly (although it took 22 minutes for the normal 1.62 GB textures). I can't access the computer at the moment, so I can't give you the exact model of the GPU.

10110111 commented 2 years ago

Could you check whether using a smaller texture size makes it work? E.g. with sample-small-size.atmo from the examples directory.

Atque commented 2 years ago

Sorry, no difference. :(

10110111 commented 2 years ago

Please post the output from the updated calcmysky with the --opengl-debug option. I've added more error checks to hopefully understand where exactly things go wrong.

An interesting fact appeared that this error also happens on at least one MacBookPro with an Intel GPU, so it's not specific to AMD.

Atque commented 2 years ago

Here's the output:

CalcMySky v0.0.5-10-g39ea5a6 Compiled against Qt 5.12.6 Running on Windows 10 (10.0) x86_64 OpenGL vendor : ATI Technologies Inc. OpenGL renderer: AMD Radeon RX 5700 XT OpenGL version : 3.3.14800 Core Profile Forward-Compatible Context 22.5.1 30.0.15021.11005 GLSL version : 4.60 GL_ARB_shading_language_420pack is supported Writing parameters to output description file... done Working on wavelengths 360, 391.333, 422.667, 454 nm (set 1 of 4): Saving shader "/tmp/result/shaders/zero-order-scattering/0/common-functions.frag"...done Saving shader "/tmp/result/shaders/zero-order-scattering/0/phase-functions.frag"...done Saving shader "/tmp/result/shaders/zero-order-scattering/0/render.frag"...done Saving shader "/tmp/result/shaders/zero-order-scattering/0/texture-coordinates.frag"...done Saving shader "/tmp/result/shaders/zero-order-scattering/0/texture-sampling-functions.frag"...done Saving shader "/tmp/result/shaders/eclipsed-zero-order-scattering/0/common-functions.frag"...done Saving shader "/tmp/result/shaders/eclipsed-zero-order-scattering/0/direct-irradiance.frag"...done Saving shader "/tmp/result/shaders/eclipsed-zero-order-scattering/0/eclipsed-direct-irradiance.frag"...done Saving shader "/tmp/result/shaders/eclipsed-zero-order-scattering/0/phase-functions.frag"...done Saving shader "/tmp/result/shaders/eclipsed-zero-order-scattering/0/render.frag"...done Saving shader "/tmp/result/shaders/eclipsed-zero-order-scattering/0/texture-coordinates.frag"...done Saving shader "/tmp/result/shaders/eclipsed-zero-order-scattering/0/texture-sampling-functions.frag"...done Computing parts of scattering order 1: Computing transmittance... done Saving transmittance texture to "/tmp/result/transmittance-wlset0.f32"... done Computing direct ground irradiance... done Computing light pollution single scattering... done Computing light pollution multiple scattering... Computing light pollution scattering order 2... done Computing light pollution scattering order 3... done Computing light pollution scattering order 4... done Saving shader "/tmp/result/shaders/light-pollution/common-functions.frag"...done Saving shader "/tmp/result/shaders/light-pollution/phase-functions.frag"...done Saving shader "/tmp/result/shaders/light-pollution/render.frag"...done Saving shader "/tmp/result/shaders/light-pollution/texture-coordinates.frag"...done Saving shader "/tmp/result/shaders/light-pollution/texture-sampling-functions.frag"...done Working on scattering orders 1 and 2: Computing scattering density layers for radiation from the ground... 0 of 64 layers doneglDrawArrays() FAILED inside renderQuad():Invalid operation

Atque commented 1 year ago

Okay, now the computation seems to work. Not sure if you did something in the source code, or if AMD finally released a driver that makes it possible to compute textures.

Should the bug report remain open?

10110111 commented 1 year ago

If you can't reproduce the problem with v0.0.5-10-g39ea5a6 which failed for you previously, then indeed it would mean that AMD fixed it. If it still doesn't work but current master does, then I somehow fixed it. I'd be curious to know what exactly it was that made it work.

Atque commented 1 year ago

If you can't reproduce the problem with v0.0.5-10-g39ea5a6 which failed for you previously, then indeed it would mean that AMD fixed it. If it still doesn't work but current master does, then I somehow fixed it. I'd be curious to know what exactly it was that made it work.

The old version works too, so AMD must have done something.

10110111 commented 1 year ago

Could you post the version of your AMD GPU driver for reference of other users?

Atque commented 1 year ago

Could you post the version of your AMD GPU driver for reference of other users?

22.10.1, found here: https://www.amd.com/en/support/kb/release-notes/rn-rad-win-22-10-1

10110111 commented 1 year ago

Thanks.