Commit Graph

15 Commits

Author SHA1 Message Date
Mathias Agopian
1c1cb11cf5 Use the new CallbackHandler in the java bindings
Java callbacks are now directly dispatched to their handler, instead
of first going through filament's opportunistic dispatch, reducing
callback latency.
2021-10-04 10:56:43 -07:00
Mathias Agopian
f7eb55f2f5 NEW API: Renderer can process standalone View
New Api:

- Renderer::renderStandaloneView() is a new method that can be used
  outside of beginFrame/endFrame on Views that have a RenderTarget
  associated. This can be used as a poor man's compute API.

Improvements to Renderer:

- more aggressively skip lighting/shadowing code that won't be
  needed by the current view

- Allow up to 64 KiB to be allocated from the render stream, up from
  1 KiB
2021-04-19 11:17:38 -07:00
Mathias Agopian
1b36f82c1e API BREAKAGE: this change aims to fix multi-view support (#2376)
* API BREAKAGE: this change aims to fix multi-view support


What has changed:
- View doesn't have a notion of clear color anymore
- View doesn't have a notion of discard flags anymore
- The clear color and color-buffer discard/clear flags are moved to Renderer
- Skybox can now be set to a constant color
- View have a blend-mode

What does is all mean:
"Clearing" (i.e.) setting its background is now handled by Skybox, by
setting a constant color to the Skybox. This should take care of
drawing views side by side.

When a view needs to be drawn on top of another, it's BlendMode needs to
be set to TRANSLUCENT and of course and, generally, it wither won't have
a skybox, or will have one that sets some translucent pixels.

As an optimization, a View with BlendMode::OPAQUE will have its
background cleared with the color specified in Renderer.

If the SwapChain already has some content, it's now possible to set
the Renderer to not discard the content, together with TRANSLUCENT views,
it's possible to draw on top of that content.


It is NOT possible to share depth/stencil buffers between views.

Fixes: #2369, #2372, #2364

* Address reviewers comments.

Note: WebGL is still broken with this PR
2020-04-10 15:54:14 -07:00
Pixelflinger
746e273336 rework how dynamic resolution scaling is specified
- now the DynamicResolutionOptions don't specify the target frame rate,
  they only specify how to scale this given view

- there is a new FrameRateOptions setting on Renderer, which is used
  to specify the desired target frame rate for the whole Renderer

- the frame rate is now specified as a "frame interval" in units of
  the display frame period.

- the display frame period is (indirectly) set via DisplayInfo.

In other words, the use must set (and update) DisplayInfo properly
(the default are reasonable, but assume 60 Hz). They must also set the
desired interval (default is 1, which is probably what you want).
Finally they must enable dynamic scaling per View, the defaults are
also reasonable.

Currently Renderer doesn't attempt (yet) to actually target the
requested frame rate, so it's up to the caller to push frames at the
desired speed. however, dynamic resolution, like before, will attempt
to shrink work to fit the target.
2020-04-06 16:55:24 -07:00
Pixelflinger
b2dd6683be Add a way to query and set Display information
Renderer can now be given a DisplayInfo that contains some
important information about the current display. This will be used
for frame-pacing and dynamic-resolution.

This is most relevant on Android, where we can accurately query these
parameters. Added support for that in our samples.


This also sets the minSDK to 19 (including gltf viewer's), since this is
the version we support. We were cheating before by under-reporting our
minSdk.
2020-04-06 16:55:24 -07:00
Pixelflinger
526898e7d6 add vsync timestamp to Renderer::beginFrame() API 2020-04-06 16:55:24 -07:00
Mathias Agopian
5462cc0fcf Renderer::readPixels() can now read back from a RenderTarget
Before it was limited to reading back from the SwapChain.
2019-11-04 17:18:39 -08:00
Philip Rideout
94b4f92bc5 Android: move JNI C++ utils into a common folder.
No need for a proper library, this is just a common location to simplify
JNI bindings in other projects like filamat and gltfio.

There is no need to move the one Java source file (`NioUtils.java`)
since downstream libraries will have a dependency on Filament, and
FindClass should work fine.
2019-06-17 08:47:27 -07:00
Mathias Agopian
c886d5bcfd rename mirrorFrame() to copyFrame()
"mirror" was misleading, like it would apply a symmetry to the frame.
mirrorFrame() is just a blit from a swapchain to another, so it's a
copy.

The Java language API is kept for compatibility.
2019-06-10 23:45:38 -07:00
Mathias Agopian
b26684deed rename namespace filament::driver -> filament::backend 2019-03-26 11:47:47 -07:00
Mathias Agopian
2b5f6cafa6 Separate src/driver into its own library
In this first step, we just "blindly" move everything under src/driver
to a new library libbackend.a. And all headers are moved under
private/backend.

Note that "driver" is renamed "backend", but namespaces are unchanged for now.

Later we'll have to untangle the actual private headers from public
ones and ideally not have any private headers.
2019-03-22 09:45:51 -07:00
Mathias Agopian
26468d9532 Split RenderPassParams into multiple structs
We split out Viewport and RenderPassFlags.
2019-02-14 18:08:40 -08:00
Mathias Agopian
76b15e895a [MATERIALS BREAK] higher period clock
THIS CHANGE BREAKS MATERIALS.

This adds getUserTime() in shaders/materials, which returns the time
in second since Renderer::resetUserTime() was called.
Two values are provided, the time in second encoded as a float and
the difference between that and the double value, which together allows
to perform high precision time computation when needed.

This change allows longer running animations in materials. Using only
the float value, give millisecond resolution for more than 4h.
2018-12-10 16:28:07 -08: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
Romain Guy
b3d758f3b3 Initial commit 2018-08-03 10:38:22 -07:00