Commit Graph

710 Commits

Author SHA1 Message Date
Mathias Agopian
f697b41a2b fix a few typos in comments 2018-10-16 16:50:10 -07:00
Mathias Agopian
8452c4f8f2 Add usage hints to the driver 2018-10-16 16:23:24 -07:00
Mathias Agopian
c238027e49 implemented Stream::getTimestamp()
this returns a timestamp in nanosecond corresponding
to the desired presentation time of the latest frame
bound to a filament texture.
2018-10-16 15:56:43 -07:00
Mathias Agopian
b374340ebb skinning allows 256 bones again, but disallow skews. 2018-10-16 15:56:30 -07:00
Romain Guy
c581b755fd Add helper to upload Android bitmaps to textures (#382)
* WIP Add helper to upload Android bitmaps to textures

* Add missing file

* Pass custom constants for bitmap formats

* Add sample app for texturing

* Update the README for samples

* Rename variable from callback to autoBitmap
2018-10-16 14:24:18 -07:00
Philip Rideout
9e5f44bd34 Consolidate two filamesh readers into a lib. 2018-10-16 13:31:16 -07:00
Philip Rideout
d9204052c8 Fix potential issue with detached ArrayBuffer. 2018-10-15 18:35:53 -07:00
Philip Rideout
5a8d4d818c Remove bad exception handler from wasmloader.
It is incorrect to assume that any exception thrown during onReady
must be due to a faulty download.
2018-10-15 18:35:53 -07:00
Philip Rideout
cd84980c84 Add tests for filamentjs. 2018-10-15 18:35:53 -07:00
Philip Rideout
9b8d5fdf12 Add JS bindings for Texture, PixelBufferDescriptor, et al. 2018-10-15 18:35:53 -07:00
Romain Guy
7cb01929a3 Clean up Kotlin samples (#380)
* Clean up Kotlin samples

* Further code cleanup
2018-10-15 15:28:39 -07:00
Philip Rideout
e7777ef330 Add literate JavaScript tutorial and Python tangler.
This commit contains a markdown file for a "hello triangle" tutorial
as well as a Python script that does two things:

1) Extracts JavaScript code blocks from the markdown to generate the
   code for the demo.

2) Converts the markdown into a nicely-rendered web page.

After we invoke the Python script for the first time, it will create
a set of files in the root docs folder, which will automatically be
published via GitHub Pages to the following URL.

    https://google.github.io/filament/webgl

This gives us an official place to host the latest web demos and
tutorials.

The tutorial can be previewed
[here](https://prideout.net/prototype/webgl/tutorial_triangle.html).
More JavaScript tutorials are forthcoming.
2018-10-15 12:42:13 -07:00
Philip Rideout
0326d60d0a jsbindings: simplify BufferDescriptor wrapper.
The JS BufferDescriptor wrapper is used in two directions: JS => WASM
and WASM => JS. In both cases, it needs to be sure to delete the
underlying driver::BufferDescriptor. This is safe because the contents
of the underlying descriptor are always moved to its final destination
before the wrapper is destroyed.
2018-10-15 12:16:02 -07:00
Ben Doherty
0d709b6074 Add a few new nodes to Tungsten (#326) 2018-10-15 12:02:05 -07:00
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