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

GPU jobs for generating gas giant textures. #3719

Merged
merged 15 commits into from Jun 28, 2016

Conversation

fluffyfreak
Copy link
Contributor

@fluffyfreak fluffyfreak commented Jun 11, 2016

What is it?

This is some tech' I wrote a while ago that generates the texture map used by the gas giants on the GPU. It's a little rough right now but I hope to improve it as time goes by and to use the GPU jobs for other things.

  • Update linux makefiles
  • Make work on AMD MESA R600 GPU's

Testing:

The new GPU jobs are enabled by default, they can be deactivated by replacing the line EnableGPUJobs=1 with EnableGPUJobs=0 in the config.ini file.

Then ingame pick the Earth based starting location and once it's loaded you use the F2->F7->Click a Gas Giant->Ctrl+F10 to view one of the giants in the object viewer.

Linux:

As usual the problem is the open source GPU drivers similar to #2176, this is why you can't have nice things :P on AMD Radeon chipsets using the R600 gallium drivers the shader fails to compile.

There is now a workaround in place that uses less noise octaves. This produces less detailed texture maps for the gas/ice giants but they still look good and at least the program runs.

Andy

@impaktor
Copy link
Member

I was going to try this, but ended up in libpng 1.2 v.s. libpng 1.6 hell (also on my master), and threw in my towel. Sorry, but I feel I don't have much energy left in me nowadays.

@laarmen
Copy link
Contributor

laarmen commented Jun 14, 2016

Oh, I was gonna try and reboot on my Linux partition tonight to update my resume, I'll try this while I'm at it. And for good measure, i'll even try to understand the code (and will probably fail)

@laarmen
Copy link
Contributor

laarmen commented Jun 14, 2016

GasGiant.o: In function GasGiant::OnAddGPUGenResult(SystemPath const&, GasGiantJobs::SGPUGenResult*)': /home/laarmen/dev/pioneer/src/GasGiant.cpp:325: undefined reference toGasGiantJobs::SGPUGenResult::OnCancel()'
GasGiant.o: In function GasGiant::GenerateTexture()': /home/laarmen/dev/pioneer/src/GasGiant.cpp:527: undefined reference toGasGiantJobs::STextureFaceRequest::STextureFaceRequest(vector3 const_, SystemPath const&, int, int, Terrain_)'
/home/laarmen/dev/pioneer/src/GasGiant.cpp:562: undefined reference to GasGiantJobs::GenFaceQuad::GenFaceQuad(Graphics::Renderer*, vector2<float> const&, Graphics::RenderState*, unsigned int)' /home/laarmen/dev/pioneer/src/GasGiant.cpp:564: undefined reference toGasGiantJobs::SGPUGenRequest::SGPUGenRequest(SystemPath const&, int, Terrain_, float, GasGiantJobs::GenFaceQuad_, Graphics::Texture_)'
/home/laarmen/dev/pioneer/src/GasGiant.cpp:565: undefined reference to GasGiantJobs::SingleGPUGenJob::SingleGPUGenJob(GasGiantJobs::SGPUGenRequest_)' GasGiant.o: In function GasGiantJobs::SingleTextureFaceJob::SingleTextureFaceJob(GasGiantJobs::STextureFaceRequest*)':
/home/laarmen/dev/pioneer/src/GasGiantJobs.h:140: undefined reference tovtable for GasGiantJobs::SingleTextureFaceJob' graphics/opengl/libgraphicsopengl.a(RendererGL.o): In function Graphics::OGL::GenGasGiantColourMaterial::GenGasGiantColourMaterial()':
/home/laarmen/dev/pioneer/src/graphics/opengl/GenGasGiantColourMaterial.h:54: undefined reference to`vtable for Graphics::OGL::GenGasGiantColourMaterial'
collect2: error: ld returned 1 exit status

Ooooops ;-)

… shaders compiled.

Add in a workaround for AMD R600 GPUs using MESA failing to compile shaders - use the DisableEclipse config flag as indicator.
Pack the data into the top 16-bits of the MaterialDescriptor::quality member.
@fluffyfreak
Copy link
Contributor Author

@laarmen have you got everything? I updated the makefiles and it works on two Linux installations here. Not sure what's different that would stop yours from working.

@walterar
Copy link
Contributor

What is the point of a new feature that is turned off?

  1. It looks very ugly on linux 64 - nvidia 650

@impaktor
Copy link
Member

  1. It looks very ugly on linux 64 - nvidia 650

Maybe a screenshot to demonstrate what isn't working properly?

@walterar
Copy link
Contributor

EnableGPUJobs=0
jupiter1

EnableGPUJobs=1
jupiter2

@nozmajner
Copy link
Contributor

nozmajner commented Jun 24, 2016

Which one is the problematic? The second one seem to resemble Jupiter a lot more. And I'm not seeing any glitches either.
jupiter

@fluffyfreak
Copy link
Contributor Author

Ok the nightmare is that this works when generating the texture, but won't render if you have the eclipse code enabled...

@fluffyfreak
Copy link
Contributor Author

@laarmen are you still having those builds problems?

@fluffyfreak
Copy link
Contributor Author

@walterar which one do you mean is ugly? I was trying to make them look more like the real planets.

@impaktor
Copy link
Member

Compiles fine.

Asking for a seed twice, with EnableGpujobs=0, (like pressing random seed twice), crashes the game:

pioneer: GasGiant.cpp:531: void GasGiant::GenerateTexture(): Assertion `!m_job[i].HasJob()' failed.
[1]    25657 abort      ./src/pioneer

I assume this is due to the debug just being temporary hack? But seems to work when enabled, although sluggish during first 3-4 seconds.

Merge whenever you're happy.

@fluffyfreak
Copy link
Contributor Author

I haven't been able to get that assert, how did you do it?

@fluffyfreak fluffyfreak merged commit 63e9208 into pioneerspacesim:master Jun 28, 2016
@fluffyfreak fluffyfreak deleted the gpu-gas-giant-textures branch June 28, 2016 18:59
@impaktor
Copy link
Member

Well, I had the GPU-jobs disabled (from before) in my config, started pioneer, and did exactly what you suggested in your top post, then looked at the gas giant (I might have rotated it a bit with my mouse? If that is possible?), pressed new seed -> then random seed -> crash.

Second time I tried it, I though asking for random seed caused crash, so did same as above, but instead asked for random seed, which worked first time, but then second time it crashed.

Or that's how I remember it.

@Tichy
Copy link

Tichy commented Jul 4, 2016

I saw that this doesn't work on R600 (blank untextured plantes) unless I set AMD_MESA_HACKS=1 in config.ini

Should I add an entry to the FAQ about this?

@impaktor
Copy link
Member

impaktor commented Jul 4, 2016

@Tichy Please do.

@Tichy
Copy link

Tichy commented Jul 5, 2016

@fluffyfreak
Copy link
Contributor Author

Thanks @Tichy :)

@impaktor
Copy link
Member

This adds new source files that cause XCode to stop working.
Ping @salborrelli if still with us.

@salborrelli
Copy link

salborrelli commented Jul 14, 2016

@impaktor yup I'm still with you guys, and following the discussions, even though my job workload is getting out of control 😄 I will pull the latest version and check the Xcode as soon as I can.

@jfacoustic
Copy link
Contributor

jfacoustic commented Jul 17, 2016

Hey I got it working for OSX! I submitted a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants