Commit Graph
2448 Commits
Author SHA1 Message Date
Pixelflinger 4e62e4f696 include alpha-masked objects in SSAO
this helps a lot with vegetations, which often uses alpha masking
2020-03-12 19:17:39 -07:00
Pixelflinger c0addf22ed Cleanup render loop to prepare for more features
- decouple the depth and ssao passes, so that the depth
  pass could be used by another client, down the framegraph

- set uniforms/samplers from the execute closure of the color pass,
  instead of using a separate pass. This is more correct and it 
  potentially reduces calls to commitUniforms.

- make setSampler check that the value set is different,
  the idea here is that it's much more costly to have to commit the
  samplers rather than having to compare them. Also realistically we
  don't have a lot of samplers in a frame, so that's not a lot of
  compares.

- one downside of this change is that commands for the SSAO pass are
  always generated, we will fix that in an upcoming change.
2020-03-12 14:31:56 -07:00
Romain Guy 880642ef4a Fix crash in glTF sample for Android 2020-03-12 14:27:11 -07:00
Pixelflinger 2f94e5990c workaround a framegraph bug with imported rendertargets
Imported render targets are only partially implemented, which
caused a discard flags bug. It would happen when an imported
 render target is used more than once like when using SSrefr
without tone mapping.  In that case, the 2nd pass would use the same
discard flags as the first pass.
2020-03-11 22:58:22 -07:00
Pixelflinger 4a5ce16322 Trivially make LinearAllocator 16 bytes instead of 24 2020-03-11 17:04:08 -07:00
Pixelflinger 454b08362d minor code cleanups
- go through 'FIXMEs' & `TODOs` and either fix or remove obsolete ones.
- add a few asserts
- fix some comments and IDE warnings
2020-03-11 17:04:08 -07:00
Ben Doherty f80c584db0 Update glslang to dbb56a1 (#2232) 2020-03-11 12:34:08 -07:00
Pixelflinger 68bcd6c159 fix setting an array mat3 as a parameter of material instance
this actually makes it possible to set mat3s from java.
2020-03-11 12:26:52 -07:00
Pixelflinger a9a9061f96 update GLSLPostProcessor optimization passes to latest
deactivate "mergeReturnPass" because it triggers a segfault with
AMD drivers on MacOS.
2020-03-11 11:11:28 -07:00
Pixelflinger 196c98fc2a Fix framebuffer clears
We make sure to only (and always) clear newly allocated buffers,
but only clear existing buffers based on the user request. This
should allow to share the depth buffer between drawing two
Views (if post-process is disabled). This should also fix 
a bug where the intermediate buffer wasn't cleared when blending
a view on to of another.

This should fix #2138
2020-03-11 11:11:09 -07:00
Ben Doherty 9ea2e69579 Fix gltf_viewer (#2233) 2020-03-10 17:57:59 -07:00
Ben Doherty f4da2ef8ec Add support for spot light shadows (#2209) 2020-03-10 17:53:25 -07:00
Pixelflinger 8fb65a19b4 fix utils::ctz() when builtins are not available
Our fallback 64-bits ctz() was completely wrong. 
The unit tests were wrong too.
2020-03-10 15:41:43 -07:00
Ben Doherty a2c6c34739 Update SPIRV-Tools to 2020.1 / SPIRV-Cross to 65aa0c3 (#2121) 2020-03-10 15:32:41 -07:00
Romain Guy a2818037b3 matinfo can print dictionaries, shrink Metal dictionary (#2230)
This change adds new commands to matinfo to print dictionaries.
This feature is useful to debug dictionaries, and I just used
it to identify that using a shared dictionary would save ~12 KiB
in the Android build. The macOS build (GLSL + Metal) would go
down to 71 KiB from 136 KiB.

The SPIRV to Metal conversion leaves leading spaces and some
comments. This change also runs the shrinker on optimized Metal
shaders to further reduce the size of shaders.
2020-03-10 11:42:19 -07:00
Romain Guy 02c7a22d43 Remove build time warning 2020-03-10 08:41:28 -07:00
Pixelflinger f6e993dfc8 fix bloom upsample shaders
We were not using the correct offsets, however because everything
was so blurry, it wasn't obvious that something was wrong.
This should result in a bit smoother bloom effect.
2020-03-08 22:28:25 -07:00
Pixelflinger 8866e2829f Add a quality option to dynamic-scaling
It controls the quality of the upsampling filter. This can help a lot
if heavy scaling is needed to maintain performance, it also helps if
MSAA is not enabled.

There are 3 quality levels, low, medium and high. 1, 4 and 9 bilinear
taps are used for each level respectively. The high quality setting
employs a tent filter.
2020-03-08 22:28:10 -07:00
Matthias Moulin d016e0f443 Replaced unnecessary std::forward with std::move
`execute` is an rvalue reference and not a forwarding reference, so `std::move` is more appropriate
2020-03-08 22:27:46 -07:00
Pixelflinger 0cbf6f8d76 disable spinlocks on ARMv7
we've had issues with some devices running in arm mode, where they
would throw spurious SIGILL on the WFE instruction used in spin locks.
Since on Android Mutexes are very efficient, we just use that instead.

This might fix #2197
2020-03-07 13:54:58 -08:00
Romain Guy 641b58c409 Be explicit about which NDK to use (#2221) 2020-03-06 16:53:41 -08:00
Romain Guy 5f0204f7b1 Clean build script 2020-03-06 15:36:14 -08:00
Romain Guy 660d1a1800 Enforce NDK 21 2020-03-06 15:24:45 -08:00
Pixelflinger 8d209a16c5 framegraph: destroy resources in reverse order
This is so that render targets are destroyed before their
attachments. In practice it doesn't matter too much, at least
on OpenGL, but it is cleaner.
2020-03-06 11:21:35 -08:00
Pixelflinger ed786701fc The FrameGraph is now emitting debug markers
A debug marker is emitted for each pass.
This greatly improves debugging with RenderDoc for instance.
2020-03-06 11:21:17 -08:00
Mathias Agopian 4842b1ca13 rework stream operators for libmath
libmath itself doesn't expose any stream operators anymore. However,
libutils is able to automatically print libmath types into its
io::ostream -- however matrices are not formatted nicely.

Added a new optional library, libmathio, that provides std::ostream
operators for all libmath types. libmathio does a better job at
formating matrices.

Also removed apply() and map() from libmath because there were not used
anywhere and they forced us to depend on <functional> in public headers.
2020-03-05 22:50:49 -08:00
Ben Doherty 0990550f45 Fix, mathfwd does not work correctly with MSVC (#2214) 2020-03-05 17:46:21 -08:00
Romain Guy 84b215c3b0 Switch to AGP 3.6.1 2020-03-05 17:11:47 -08:00
Ben Doherty 2a7724f601 Introduce ShadowMapManager class (#2207) 2020-03-05 15:32:00 -08:00
Ben Doherty b119d763da Fix visibility mask, encode enough SENTINEL commands (#2210) 2020-03-05 15:31:38 -08:00
Mathias Agopian ff25e6c18f Add support for MRT in the framegraph 2020-03-05 13:17:18 -08:00
Mathias Agopian 2677f05f0d get rid of the 'ignoreScissor' flag in beginRenderPass
The scissor is now always ignored -- i.e. when we clear, the whole
surface is cleared, which echoes how discard flags work. 
Geometry must be used to clear only a sub-region of the screen.

This simplifies a lot of things because we had workaround for Adreno
GPUs, which were slow when clearing with the scissor enabled.
2020-03-05 13:17:18 -08:00
Mathias Agopian bbfa47bbf0 More MRT support in the GL backend
in particular, we can now clear the proper draw buffer and
basic functionality works (tested on Adreno with systrace)
2020-03-05 13:17:18 -08:00
Mathias Agopian 060c0d2e6f remove discardSubRenderTargetBuffers() which isn't used right now 2020-03-05 13:17:18 -08:00
Romain Guy 414396efb6 Add background color selector to gltf_viewer 2020-03-05 12:58:52 -08:00
Philip Rideout 6825781718 gltf_viewer: fix string lifetime for #2190. 2020-03-05 09:26:27 -08:00
Ben Doherty 2494fff094 Refactor renderable partitioning scheme for spot light shadows (#2195) 2020-03-04 20:46:35 -08:00
Ben Doherty 924422261f Update ShadowMap for spot light shadows (#2206) 2020-03-04 20:20:32 -08:00
Philip Rideout f81e819901 gltfio: simplify API, privatize bindings.
The binding list can be internalized, clients should instead use
`getResourceUris` and `ResourceLoader` to load external resources.
2020-03-04 16:30:12 -08:00
Ben Doherty 81a2d70251 Use array texture for shadow maps (#2199) 2020-03-04 11:59:25 -08:00
Ben Doherty 3a2a40c76a Add additional shadow info to lights uniform (#2200) 2020-03-04 11:58:51 -08:00
Ben Doherty 6c3fa13e41 Changes to frameUniforms for spot shadows (#2201) 2020-03-04 11:58:31 -08:00
Philip Rideout 0ea2354be5 More TypeScript annotations. 2020-03-04 11:20:01 -08:00
Mathias Agopian 079056cfbc major FrameGraph rewrite (#2202)
Major changes are:

- RenderTarget are now real resources as opposed to ad-hoc objects.
  This allows to remove a lot of code and simply a lot of things.

- ResouceNode now have a level of indirection (i.e. we store a pointer
  to them), which allow fast and more correct implementation of
  moveResource(). 
  A new unit test checks that all scenarios of moveResource with a 
  generic resource are working.

- We have a special version of moveResource that moves a RenderTarget
  resource into a TextureResource -- this shouldn't be allowed, but
  this helps make the API better. What it means is that
  "all rendertargets that use the specified texture as attachment
   are replaced with the given rendertarget".

- In this version there are a lot of limitations when moving
  a rendertarget into a texture resource; be we cover the case that
  is useful to us.
2020-03-04 11:13:29 -08:00
Philip Rideout 1230fccbf9 JavaScript: Expose bloom and SSAO options.
Fixes #2198.
2020-03-04 08:43:20 -08:00
Ben Doherty 73e0facaed Save spot light outer clamped radius in light manager (#2193) 2020-03-03 14:25:26 -08:00
Ben Doherty 94b1ad52fa Add new Shadows uniform buffer (#2194) 2020-03-03 14:25:03 -08:00
Philip Rideout 6878d0d6e6 npm package now has a gl-matrix dep.
Our wasm API does not actually use gl-matrix, but we do import it
from our TypeScript declarations file.
2020-03-03 09:46:53 -08:00
Ben Doherty 76e7568994 Add visibility mask to RenderPass (#2183) 2020-03-02 16:14:52 -08:00
Romain Guy b176b2f0e6 Remove broken setLensProjection API (#2192) 2020-03-02 14:35:35 -08:00