Commit Graph
446 Commits
Author SHA1 Message Date
Ben Doherty 6992c8a584 Update README on linking against Filament (#379)
* Add section to README on linking against Filament
2018-10-15 11:18:45 -07:00
Philip Rideout 7c54faa8bd Add filamentjs to web release archive.
The web archive now has two subfolders: public and filamentjs.

- public contains the three C++ based web demos.
- jsbindings contains the new JS bindings and Filament-only WASM module.
2018-10-15 10:43:28 -07:00
Romain Guy 3a0f9791cc Remove outdated comment 2018-10-12 18:37:34 -07:00
Philip Rideout 473824b15e Introduce JavaScript API using embind.
This adds filamentjs to libs, which builds a Filament-only WASM file.
Unlike our existing web demos, this WASM file contains no application
code.

These bindings are by no means complete, but they are sufficient for a
"hello triangle" demo that I have working locally. Sneak peak of the
Triangle JS app code:

    https://gist.github.com/prideout/e9d6dd0e312146c8a287d2d109affa4d

This commit merely adds the bindings to the build. Demos and docs are
forthcoming.
2018-10-12 17:09:52 -07:00
Mathias Agopian b4c77166b7 fix normals when skinning with non-uniform scales 2018-10-11 18:46:42 -07:00
Mathias Agopian 920113b076 fix a typo that caused skinning to just not work sceneform-1.6pr4 2018-10-11 16:50:52 -07:00
Philip Rideout 2a10f8122d Remove STB from web samples.
Every texture now uses KTX, so there is no need to fatten the WASM with
a PNG decoder.
2018-10-11 11:34:05 -07:00
Philip Rideout 182d95c6ce Use filamat file instead of inc in a web sample.
For test coverage, ensure that one of our C++ based web samples
uses a filamat file instead of inc, because this is how the JS based
web samples will work.

This makes pre-zipped triangle wasm go from 747 KB to 741 KB.
2018-10-11 10:22:48 -07:00
Philip Rideout ed76aa04ca Shrink WASM files 30% by excluding VK materials. 2018-10-11 09:43:21 -07:00
Jonas Karlsson 76035711f4 Fix documentation typo (#368) 2018-10-11 08:53:51 -07:00
Philip Rideout 7959f31ebf OpenGL Backend fix for INVALID_OPERATION regression.
Recent changes to UBO management introduce the possibility of calling
glBufferSubData on zero-length regions, which cause a cascade of
GL_INVALID_OPERATION with the Suzanne WebGL demo. Note that the WebGL
variant of BufferSubData has special behavior when length = 0.

This also seems like a potentially useful optimization for non-web
platforms, since a CPU branch is likely cheaper than a GL entry point.

This commit also seems to fix a segfault seen with the "vk_imgui" sample
after changing its backend to OPENGL.

Fixes #366
2018-10-10 14:01:13 -07:00
Philip Rideout 10a3addf1a Filaweb now uses compression for the IBL.
The web build now invokes cmgen three times for each IBL: uncompressed,
S3TC (desktop), and ETC (mobile). Alternatively, we could enhance cmgen
to accept multiple compression strings, but per discussion with Mathias
we decided to keep it simple.

I decided not to use compression for the skybox in our web demos because
the quality is too poor (see PR image). I did not try playing with
compression settings, might be worth revisiting in the future.
2018-10-10 12:09:25 -07:00
Romain Guy 89982e6e97 Improve APIs for Kotlin usage (#361) 2018-10-10 10:13:07 -07:00
Mathias Agopian 7485cc5fd0 Skinning now supports non-rigid transforms
A full 3x3 + translate matrix is supported.
sceneform-1.6pr3
2018-10-09 18:17:44 -07:00
Mathias Agopian 95a2686555 Skip a copy entirely when updating per-renderable ubo
We now fill the buffer directly into the command stream
which avoids an extra copy of the data.
2018-10-09 16:47:56 -07:00
Mathias Agopian b29432e330 improve driver API to upload UBOs
The UniformBuffer class is moved out of the Driver,
and the driver api now takes a BufferDescriptor
as input of updateUniformBuffer. This makes it 
more generic.

As an added benefit, we can now allocate the
uploaded uniform data directly into the 
command stream, which saves synchronization points.
2018-10-09 16:47:56 -07:00
Mathias Agopian 94d224eac3 store all per-renderable uniform blocks in a single ubo 2018-10-09 16:47:56 -07:00
Mathias Agopian 8a70e02bea don’t store the UniformBuffer object in the driver
There was really no reason to do that. This
reduces significantly the size of the HwUniformBuffer
to only 8 bytes.
2018-10-09 16:47:56 -07:00
Mathias Agopian 66e66e4b45 minor clang-tidy fixes 2018-10-09 16:47:56 -07:00
Mathias Agopian 238c796026 Add bindUniformBufferRange() to the driver API 2018-10-09 16:47:56 -07:00
Mathias Agopian 8ed132b675 Rename driver.bindUnforms() to .bindUniformBuffer() 2018-10-09 16:47:56 -07:00
Mathias Agopian 24adeb9b8e Use glBindBufferRange() instead of glBindBufferBase() 2018-10-09 16:47:56 -07:00
Philip Rideout b905adfcb5 Vulkan: fix bad std::move usage.
Tested by running vk_hellopbr with MoltenVK, still works. :)
2018-10-09 14:22:38 -07:00
Philip Rideout fc672aa8a4 API CHANGE: remove deprecated RGBM enum. 2018-10-09 12:41:39 -07:00
Adrian Perez aa980682e6 Remove using std::string (#356) 2018-10-09 10:34:12 -07:00
Romain Guy c2ce7f8ffd Ensure the base layer is never glossier than the clear coat layer (#355)
* Ensure the base layer is never glossier than the clear coat layer

* Fix typo
2018-10-09 02:37:04 +02:00
tpsiaki faddb10a00 Add CLEAR flag to mirrorFrame (#351)
* Add CLEAR flag to cause mirrorFrame to clear before blit.

* Set viewport size for clear.

* set discardStart
2018-10-09 02:14:05 +02:00
Adrian Perez 6c66bc26e7 remove another instance of using namespace std (#354) 2018-10-09 01:51:41 +02:00
Adrian Perez 27a2d05c8a Remove 'using namespace std' (#352) 2018-10-08 20:41:08 +02:00
Philip Rideout c6cef9ff9c NEW API: add RGBM flag to Texture.
This change will allow the skybox use a compressed texture format.

For now, the old internal format "RGBM" is still honored, but in a
forthcoming change we will replace the enum with UNUSED.
2018-10-08 11:33:06 -07:00
Philip Rideout 06fc8e2f4c Add compression support to cmgen. 2018-10-08 09:25:09 -07:00
Philip Rideout 5ac2c96cb5 Fix typo in ETC compression string. 2018-10-05 15:25:06 -07:00
tpsiaki 9516080d21 Add support for mirroring the current view to a different swap chain. (#339)
* Add support for save/replay of the current view.

* Add support for having distinct draw/read surfaces.

Adds support to egl & glx drivers for distring draw/read surfaces and
uses this support to implement mirrorFrame using a single blit.

* Use src/dst, Viewport, clean up apis.

* Add SwapChain READABLE Config.

* Commit & setPresentationTime optional on mirror.

* Fix flag check.

* Add documentation for READABLE swap chain config.

* Fix missed s/ExternalContext/Platform/ cases.

* Build break fix.
2018-10-06 00:04:07 +02:00
Philip Rideout fcf52a72e8 Add UBO offsets to VulkanBinder. 2018-10-05 11:31:03 -07:00
Philip Rideout da698f2e36 Add high level compression API to prep for cmgen integration. 2018-10-05 10:11:48 -07:00
Mathias Agopian 311d2804bb mContextManager -> mPlatform 2018-10-04 16:10:45 -07:00
Mathias Agopian 2c4ecebf11 Minor importance sampling tweaks and code clean-up (#342)
* cleanup importance sampling code

* Add VNDF importance sampling -- work in progress.

* minor code cleanup
2018-10-04 15:21:34 -07:00
Philip Rideout eed2f72466 Implement TODO items for ASTC encoding.
These presets are copied over from the ARM standalone tool. I have not
tested them but they seem reasonable.
2018-10-04 14:29:18 -07:00
Philip Rideout 23efe17380 mipgen: fix dark miplevels in normal maps.
When using GAUSSIAN_NORMALS, image::resampleImage automatically unitizes
its output. This means that clients (e.g. mipgen) need to ensure that
the source image is in [-1,+1] rather than [0,+1].
2018-10-04 14:28:44 -07:00
Mathias Agopian 473b173647 fix Vulkan builds 2018-10-04 13:25:49 -07:00
Mathias Agopian 001965cf42 Separate Android specific code from EGL platform
This code manages the virtual machine as well as
external streams. The idea here is that the Vulkan
platform could use this code when it adds support
for external buffers/streams (or at least it will
be easier). None of this needs EGL.
2018-10-04 13:25:49 -07:00
Mathias Agopian 8a0c714108 Rename ExternalContext to Platform
Rename everything related.

Also Platform::create() returns a raw Driver* 
instead of a unique_ptr<Driver>. This is to
remove a dependency on <memory> in public
headers.
2018-10-04 13:25:49 -07:00
Mathias Agopian af5a168277 Make ExternalContext::createDriver() protected 2018-10-04 13:25:49 -07:00
Mathias Agopian 43070b413e don’t leak the ExternalContext object
FEngine doesn’t take ownership of ExternalContext if
it’s passed as a parameter, however, in the common
case it’s not, and FEngine owns it — and must take
care of destroying it.


Also fix this behavior in “single thread” mode,
the given ExternalContext was ignored.
2018-10-04 13:25:49 -07:00
Philip Rideout 551fe7ef8b Suzanne now uses LINEAR_MIPMAP_LINEAR. 2018-10-04 08:02:53 -07:00
prideout e74a306df2 Fix utils::Path concat for relative paths.
Concating with an empty path should not prepend a slash since doing so
implies that the user wants to access the system's root folder.

Fixes #332
2018-10-04 07:31:25 -07:00
Mathias Agopian 4302d9dcc3 reduce our dependency to the STL in public headers 2018-10-03 20:13:17 -07:00
Tim Psiaki 18504b1928 Remove unnecessary using. 2018-10-03 13:07:21 -07:00
Tim Psiaki 3defd8a855 Retry eglChooseConfig if no recordable config found. 2018-10-03 13:07:21 -07:00
Tim Psiaki 541db4fea5 Add Cocoa & WebGL stubs for setPresentationTime 2018-10-03 13:07:21 -07:00