Commit Graph

2721 Commits

Author SHA1 Message Date
Kostiantyn Zghirovskyi
2260fe5b62 Fix filament-utils-android build on Windows (#2508)
* Fix filament-utils-android build on Windows

* Update build.gradle

* nit: use char version instead

* Fix No signature of method: java.lang.String.replace() is applicable for argument types: (Character, String) values: [\, /]
2020-05-08 16:57:16 -07:00
Pixelflinger
e07f0dd244 Texture(Engine, long) instead of Texture(long)
deprecated Texture(long nativeTexture) in favor of
Texture(Engine, long nativeTexture), there is no difference
currently,  but in the future Texture(Engine, long nativeTexture) 
will be able to validate the native pointer.
2020-05-08 15:39:14 -07:00
Pixelflinger
d194eec0ad report to java when an object can't be destroyed
The JNI layer already does this, but can only track objects it created,
sometimes developers might create filament objects on the native side
and wrap them into java objects and this might cause a failure to
detected when objects are double-destroyed.

However, this can often be caught by the native code -- so, when the
native side is asked to destroy an object that doesn't exist, we now
return an error (exception if enabled) and we throw an exception
on the java side.

Filament typically doesn't do this kind of tests, however these bugs
can be very hard to find, and the cost is small.
2020-05-08 15:39:14 -07:00
Pixelflinger
addf325d42 better handling of invalid handles
- all backend return nullptr when handle_cast<> is called with
  an invalid handle. this ensures a prompt crash on all backends rather
  than different behaviors, some including potential memory corruptions.
  assert() in debug builds. The proper way to check is to cast the
  handle to bool.

- be more consistent in the GL backend about where we check for the
  validity of handle -- which is basically nowhere, except for destroy
  (because we have the same semantic than free(nullptr) -- i.e. no-op.
  Other places are treated like bad pointers, and as per above
  handle_cast<> will return nullptr.

- make sure we don't call FScene::updateUBOs with an invalid handle
  when the scene is empty
2020-05-08 15:39:14 -07:00
Pixelflinger
c019781471 only log "no texture bound" in debug builds
This is way to verbose in release builds, and since it's not
a bug issue on GLES, we silence this for now.
2020-05-08 15:39:14 -07:00
Pixelflinger
de849fa21f removed a wrong assert() 2020-05-08 15:39:14 -07:00
Philip Rideout
072d17d64f gltfio: use the new material name feature.
To see proof that this works, use gltf_viewer with -u and examine the
node hierarchy. You will now see the correct material names instead of
the ubershader names.
2020-05-08 11:24:38 -07:00
Philip Rideout
38b9cf4fe3 Vulkan: add support for resizing the window.
Fixes #334.
2020-05-08 09:46:49 -07:00
Philip Rideout
d0a8c6b4fa Vulkan: refactor destroySwapChain. 2020-05-08 09:46:49 -07:00
Philip Rideout
ab2ae245ba Vulkan: refactor createVkSurfaceKHR. 2020-05-08 09:46:49 -07:00
Philip Rideout
f53f03b5dd Java MaterialInstance::getName now creates string lazily. 2020-05-08 09:44:49 -07:00
Philip Rideout
474fe9c5ed Change behavior of MaterialInstance::getName. 2020-05-08 09:44:49 -07:00
Philip Rideout
c3c8293862 MaterialInstance now has an optional name.
When no name is provided during instance creation, it does NOT inherit
the name of its parent material. This is because instances should be
lightweight and users can already do instance->getMaterial()->getName().

In a subsequent PR, this feature will be exercised and tested via the
gltfio AssetLoader.

Fixes #2485.
2020-05-08 09:44:49 -07:00
Ben Doherty
3c42ace496 Fix, don't sample from cascades without visible shadows (#2501) 2020-05-07 16:50:34 -07:00
Romain Guy
2702ef123c Update README.md 2020-05-07 13:26:57 -07:00
Romain Guy
89e76fde57 Update README.md 2020-05-07 13:18:23 -07:00
Romain Guy
37c8f1d8ea Update README.md 2020-05-07 13:16:43 -07:00
Romain Guy
8416553724 Update README.md 2020-05-07 13:15:12 -07:00
Romain Guy
f3baecc4be Update README.md 2020-05-07 13:11:20 -07:00
Ben Doherty
89df8355aa Fix build warning (#2499) 2020-05-06 18:30:58 -07:00
Ben Doherty
0e00dbb967 Add up and down movement to free flight camera (#2494) 2020-05-06 18:30:43 -07:00
Pixelflinger
786dbdc6e4 fix JNI objects allocation and memory corruption
- we were allocating objects with a destructor in the command stream
  which is always invalid because there is no guarantee that when 
  the callback is called, the underlaying memory is still valid
  (and it wasn't).

- AutoBuffer move-ctor wasn't moving some of its state, which would
  lead to destroying the same ref several times.
2020-05-06 18:08:13 -07:00
KJ Liu
920dc6b167 AssetLoader now loads names for mesh-free nodes. 2020-05-06 17:59:20 -07:00
Pixelflinger
809379b93d only implement flushAndWait() debugging on android
it's causing some unrelated problem on the iOS simulator, and we're
looking for an Android bug anyways.
2020-05-06 17:42:48 -07:00
Ben Doherty
4701945c87 Add rudimentary cascading shadow map support (#2482) 2020-05-06 17:20:04 -07:00
Kostiantyn Zghirovskyi
2c79f4c480 Update building instruction on (#2496) 2020-05-06 16:14:38 -07:00
Philip Rideout
cc29359897 gltfio: fix unbound texture warnings in ubershader mode. 2020-05-06 15:24:21 -07:00
Philip Rideout
b54000ccb9 Add CMAKE_EXPORT_COMPILE_COMMANDS. 2020-05-06 12:21:49 -07:00
Philip Rideout
c65194fce1 gltfio-lite: fix UBO errors. 2020-05-06 09:09:56 -07:00
Pixelflinger
d8e2e60692 remove CreateEliminateDeadMembersPass which breaks UBO layout
this fixes a crasher when using --optimize-size
2020-05-05 18:17:31 -07:00
Philip Rideout
fb643eb422 Update web site and JS tutorials.
This updates the tutorial markdown, fixes up the literate programming
Python script, and updates the web site itself.

The doc build script now uses a Pipfile instead of "requirements.txt",
which I find less frustrating since it does not interfere with other
Python projects on your machine.

Fixes #2483.
2020-05-05 12:39:25 -07:00
Pixelflinger
e80ea979a4 improvements to DoF
- bokeh rotates with the aperture diameter
- match sample count on cpu and cpu sides which affects CoC calculation
- feather blur radius to avoid visible "steps" in bokeh size
2020-05-05 11:38:32 -07:00
Romain Guy
3e5fe994b9 Fix default lighting intensities in ModelViewer
They were waaay too high
2020-05-05 00:25:19 -07:00
Romain Guy
05def1a789 Update AGP 2020-05-04 17:55:39 -07:00
Philip Rideout
b36d29ef77 Vulkan: fix array textures.
This fixes a crash with `lightbulb -m`.

- During VkImage creation, the subresource depth should be 1 since it is
  meant for 3D textures.
- Render targets should select a single level from an array texture, not
  all of them.
- Add debug_trap to validation errors to make them easier to debug.
2020-05-04 15:51:27 -07:00
Pixelflinger
898ae083ee asserts that the engine is not terminated in flushAndWait() 2020-05-04 14:29:01 -07:00
Nakshathru Ajay
9c75c1ecfa Adding support for openjdk 13 (#2477)
Updated gradle version to 6.3 for openjdk 13 support
2020-05-04 09:15:12 -07:00
Pixelflinger
13767c3bb4 Don't use gl_FragCoord anywhere as it breaks with custom viewports
This fixes dynamic lighting and SSAO when a viewport is not in 0,0.
In practice this currently happens only when all post-processing is
disabled.

Instead of using gl_FragCoord we introduce a new API, 
getNormalizedViewportCoord(), which as the name implies returns
normalized [0, 1] viewport coordinates with origin at the bottom-left,
on all platforms.

This is implemented in this PR by interpolating gl_Position.
2020-05-01 23:51:17 -07:00
Pixelflinger
064ebd56e0 Reduce DoF sample count from 25 to 11
We keep very the same (or very close) quality by exploiting h/w
filtering. On the flip side, this is not compatible with dithering,
which is removed here.
2020-05-01 23:50:49 -07:00
Pixelflinger
b514b2e996 GL backend: Fix an issue with discardEnd flags
In OpenGL with use glInvalidateFramebuffer() for hinting controlling
the load/store of tiles. However, glInvalidateFramebuffer() conceptually
destroys the content of the framebuffer attachment.

This causes a problem when we want for instance to use a buffer for
reading only (e.g. a depth buffer) in multiple passes. In such
scenario, the attachment will be marked as "discard" (which is a
misnomer for storeOp==DONT_CARE in vulkan parlance), without the
intention of making the buffer invalid.

We fix this by ignoring the discardEnd flags entirely if a buffer
has not been written. In this case, we relying on the driver to not
write the tiles out -- but we don't have any other way to express
this in GL.

This issue cannot be encountered currently because the framegraph 
is not aggressive enough setting the discardEnd flags.
2020-05-01 18:19:23 -07:00
Philip Rideout
8c7fbb2e01 Fix stale IBL string in shadowtest sample. 2020-05-01 16:45:59 -07:00
Ben Doherty
3e67f628ee Bump version to 1.6.0 (#2474) v1.6.0 2020-05-01 15:58:56 -07:00
Pixelflinger
3bd1afedbd compute bitangeant in fragment shader
This saves 4 varying components.
Fixes #2092
2020-05-01 14:41:03 -07:00
Pixelflinger
f19533b149 fix a arithmetic error in SSR when a symmetry was present
Make sure that Camera returns a positive field-of-view, even when
the projection matrix has a symmetry (negative scaling).
2020-05-01 10:15:07 -07:00
Pixelflinger
dc5c48de33 fix a couple missing 'highp' qualifiers 2020-05-01 10:14:44 -07:00
Ben Doherty
fc4b88b5e9 Fix incorrect lightspace 2D bounds calculation for stable shadows (#2468) 2020-05-01 08:56:09 -07:00
Philip Rideout
116b475161 Both Vulkan timestamps should use BOTTOM.
As per the spec:

```
vkCmdWriteTimestamp latches the value of the timer when all previous
commands have completed executing as far as the specified pipeline
stage, and writes the timestamp value to memory.
```
2020-04-30 13:37:21 -07:00
Philip Rideout
cab4a660d3 Vulkan: fix race condition with queries. 2020-04-30 13:37:21 -07:00
Philip Rideout
72dafa4887 Vulkan: add support for timer queries. 2020-04-30 13:37:21 -07:00
Pixelflinger
4e873e8007 A new depth of field (DoF) post-process effect 2020-04-30 13:22:28 -07:00