Commit Graph
988 Commits
Author SHA1 Message Date
Ben Doherty c8a6a4dd62 Implement MSAA for Metal (#897) 2019-02-28 12:27:20 -08:00
Ben Doherty 4d90b9d0f0 Link iOS sample apps with the geometry library (#899) 2019-02-28 12:26:05 -08:00
Ondrej Stava ebe7b2e182 Fixed uninitialized properties in the Viewport class. (#903)
The default constructor of the Viewport class left the view properties in an uninitialized state that could lead to an undeterministic behavior in the later stages during rendering.
In our case, the issue manifested in the Froxelizer class in the setViewport() method that was flaky because sometimes the old viewport in the Froxelizer class (mViewport) was equal to the newly set viewport which caused the mDirtyFlags to not be updated. This then resulted in a crash because mPlanesX and mPlanesY were not allocated in the update() function even though they were used.
2019-02-28 10:25:55 -08:00
Philip Rideout 08af0f06bc Add new queries to TransformManager and Scene. 2019-02-28 02:17:18 -08:00
Mathias Agopian cdbfbcc1e4 docs: fix a few warnings when invoking doxygen 2019-02-27 19:01:05 -08:00
Benjamin Doherty ced19bde17 Fix a few documentation issues 2019-02-27 18:47:12 -08:00
Ben Doherty 523e1b957f Metal context cleanup (#895)
* Rename MetalImpl to MetalContext and move to separate header

* Remove m prefix from MetalContext variables

* Refactor out acquireDrawable method

* mCommandQueue -> commandQueue
2019-02-27 13:42:17 -08:00
Mathias Agopian 2ec6916f63 Fix a default material instance sampler initialization
This fixes #887. this bug existed since forever, when setting the
samplers on a new material instance from the default material
instance, we were losing the dirty bits (i.e. they were copied),
and so the newly initialized buffer would never be comited.


This adds a setSamplers() methods which does exactly that, and for
symmetry (and more efficiently) we also add setUniforms() to 
UniformBuffer.
2019-02-27 11:47:57 -08:00
Mathias Agopian 9d78f1a54e cleanup regarding SamplerBuffer and UniformBuffer
- UniformBuffer::toBufferDescriptor() now cleans the dirty flags
- SamplerBuffer move ctor and operator now clean the dirty flags of the
  moved (source) buffer.
- SamplerBuffer::toCommandStream() can be used to more efficiently copy
  a SamplerBuffer into the command stream -- this saves a copy.
- simplified SamplerBuffer's copy and move ctor/operator
- added a few constexpr here and there
2019-02-27 11:47:57 -08:00
Mathias Agopian 1ec8fc16a4 more support for 2D texture arrays in the driver
Very much untested, but it should work!
2019-02-27 11:47:38 -08:00
Romain Guy 705c1969b2 Add clearCoatIorChange property to materials (#890)
This property can be used to control the darkening of the base layer
due to a change in index of refraction when going through the clear
coat layer.
2019-02-27 10:30:46 -08:00
Philip Rideout ace38eff24 SurfaceOrientation cleanup per code review. 2019-02-27 08:47:24 -08:00
Philip Rideout 6d1e0ed6f4 Introduce SurfaceOrientation helper class.
This moves our existing VertexBuffer utility into a new "geometry"
library and adds new functionality for computing tangents based on UV's.
The UV-based method comes from Eric Lengyel.

We considered mikktspace (which thankfully has a zlib-style license) but
it would require re-indexing via meshoptimizer and is therefore a bit
heavyweight.

The new library has no dependencies and will add only 7 KB to Filament's
Android aar file.

Fixes #858 and preps for #528.
2019-02-27 08:47:24 -08:00
Philip Rideout c65e561c59 Fix nans in math::slerp, second attempt.
My earlier fix (3b373e5) was insufficient in some cases, this new
approach is cribbed from glMatrix.
2019-02-26 21:03:49 -08:00
Romain Guy 552b1c551f The cloth material model is not more expensive 2019-02-26 14:50:25 -08:00
Philip Rideout b1ba798312 Disable macOS deprecation warnings. 2019-02-26 14:14:59 -08:00
Mathias Agopian e40935dae8 Fix #871 -- double free if RenderableManager::Builder (#886)
The move ctor wasn't implemented properly. We actually fix this by
using a std::vector<> instead of a raw allocation for storing entries.
This std::vector<> is never reallocated.
2019-02-25 15:32:31 -08:00
Adrian Perez 38a6d047c9 Add a public method for creating atlas textures (#844) 2019-02-25 15:32:14 -08:00
Romain Guy b3284edb36 Android standalone toolchains are not longer necessary (#874)
* Android standalone toolchains are not longer necessary

The latest NDK (19) contains ABI/API level specific command line
tools making standalone toolchains unnecessary. This change adapts
to the new model which greatly simplifies the build script and
ensures the latest version of the tools is being used.

Note that this requires a fairly recent version of CMake which fixes
a bug related to ranlib. This change was tested with CMake 3.13
(CMake 3.7 does not work).

* Modify CI build script to fetch recent CMake

* Remove dependency on standalone toolchains in Windows README

* Use correct CMake path

* Update NDK to latest

* Only download CMake and NDK for Android builds

* Add version constant for ninja

* Make output more quiet
2019-02-25 15:14:31 -08:00
Ben Doherty 2378e64153 Add material-builder Android sample (#884) 2019-02-25 14:46:05 -08:00
Philip Rideout 186920e8d0 Fix up emissive energy compensation for glTF. 2019-02-25 14:32:58 -08:00
Ben Doherty d8ca867691 Small changes to iOS readme
Add `-i` flag to ensure installs and "apps" is now plural.
2019-02-25 13:57:43 -08:00
Ben Doherty 5e27fdea68 Add glRenderbufferStorageMultisampleEXT declaration to iOS (#866) 2019-02-25 13:22:38 -08:00
Mathias Agopian c0e63b24c1 rework multisample driver api
It's now possible to create a multisample FBO with a non-multisample
texture attachment. In this case, the drive is responsible for
automatically resolving the multisample buffer into the texture on
endRenderPass().

This allows us to avoid doing a "resolve blit" on the client side, but 
more importantly, it allows the driver to do this efficiently,
especially on tilers.

The semantic of this operation is the same than with
EXT_multisampled_render_to_texture. i.e. the multisample buffer is
lost after resolve. For GL/GLES drivers if 
EXT_multisampled_render_to_texture is not available this behavior
is emulated with a renderbuffer + blit.


This CL also fixes the creation of attachments to a face of a cubemap.
2019-02-25 13:22:38 -08:00
Pixelflinger 8a6de4cff1 Fix fxaa offset (#868)
vertex shader interpolants are interpolated at pixel centers by the GPU,
but we were doing our own "pixel-center" adjustment, so we ended-up with
"vertex_uv" at a pixel corner instead of center.

with this change, the vertex shader always compute vertex_uv in
fractional texels and the conversion to texture coordinates is done
in the fxaa code.

The half-pixel adjustment is removed.

This leads to sharper looking images because in addition to shifting
everything by 0.5 pixels, this was essentially applying a box-filter
to the whole picture -- kind of like taking 1 mip level down.
2019-02-25 13:22:14 -08:00
Philip Rideout e56ff75e1b Fix WebGL continuous builds. 2019-02-25 12:31:36 -08:00
Philip Rideout 147dafb4c1 Fix webgl on kokoro. 2019-02-25 12:02:47 -08:00
Ben Doherty 5f6f026648 Correct typo in Windows readme for Android
Fixes #882
2019-02-25 11:19:11 -08:00
Romain Guy fdee8e2e5c Add missing call to surfaceChanged()
Fixes #842
2019-02-23 22:34:43 -08:00
Philip Rideout e9430dd07f Do not use CMAKE_SOURCE_DIR.
This is one of those CMake gotchas, we should always use
CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR to allow
Filament to exist as a subproject.

In particular, this was causing the following build error when trying to
build Filament as a nested project.

    combine-static-libs.sh: No such file or directory

Fixes #861.
2019-02-22 15:38:52 -08:00
Ben Doherty 538243295c Add TextureReshaper (#862) 2019-02-22 12:34:29 -08:00
Ben Doherty fa3f34ea4b Update iOS samples README (#857) 2019-02-22 09:14:22 -08:00
Ben Doherty 3faef1f9cb Complete the MaterialBuilder JNI (#845) 2019-02-21 14:53:32 -08:00
Ben Doherty d0bab0fa8a Add hello-pbr iOS demo (#851) 2019-02-21 12:57:29 -08:00
Romain Guy 4738e93b83 Replace Cloth DFG approximation with DFG LUT
By removing the Fresnel term (often ommitted from fabric/cloth BRDFs)
we can store the DG term for the cloth BRDF in the 3rd channel of the
existing DFG LUT.
2019-02-21 11:44:52 -08:00
Ben Doherty 803c922ac1 Fix, can't set material parameters on default material instance (#854) 2019-02-21 10:30:01 -08:00
Ben Doherty cc637870b6 Fix Vulkan swapchain size on Windows (#852) 2019-02-20 17:25:29 -08:00
Ben Doherty 5c57a18b35 Initialize MaterialBuilder in samples (#850) 2019-02-20 14:47:29 -08:00
Philip Rideout d538e71959 Repair gltf_viewer by calling Material::init. 2019-02-20 14:39:30 -08:00
Mathias Agopian c1c84f6400 minor code and comments cleanups in dfg computations
also added uniform hemisphere sampling function for reference.
2019-02-20 13:52:57 -08:00
Philip Rideout 84eb9547f5 Tangent-related fixups in MeshAssimp.
Assimp's CalcTangentSpace deviates from de facto glTF 2.0 so we were
compensating for this with an unconditional fixup in MeshAssimp. However
the fixup should apply only when CalcTangentSpace is active, i.e. when
the model is missing tangents.

This makes it so that NormalTangentMirrorTest (has tangents) and
NormalTangentTest (needs tangents) both look reasonable.

I also noticed that MeshAssimp was inexplicably applying
aiProcess_CalcTangentSpace twice: once as a flag, and once as a
post-process. I removed the latter.

This will be fixed in the upcoming cgltf-based loader, which will
use our officially-sanctioned utility method in VertexBuffer.

See #528
2019-02-20 13:29:44 -08:00
Mathias Agopian 9b5060bb1d improve bindBufferRange() state tracking
we never rely (or should rely) on the fact that glBinderBufferRange()
also sets the generic binding, so we don't need to check for that when
calling glBindBufferRange().

This helps a little bit reducing the numbers of GL calls, especially
when several consecutive draw calls use the same material instance.
2019-02-20 12:34:45 -08:00
Ben Doherty d22e2f2834 Fix wrong init method being called (#846) 2019-02-20 11:05:55 -08:00
Ben Doherty 52ebfb1665 Add Init and Shutdown methods to MaterialBuilder (#840) 2019-02-20 10:44:12 -08:00
Adrian Perez 07eda48196 Missing include 2019-02-20 09:41:18 -08:00
Romain Guy b2f19a1879 Remove incorrect approximations 2019-02-19 18:41:31 -08:00
Mathias Agopian 39b9d30d1a Minor RenderStream cleanups 2019-02-19 18:31:43 -08:00
Mathias Agopian 45beccc68b Fix build when DEBUG_RENDER_STREAM is enabled 2019-02-19 18:31:43 -08:00
Mathias Agopian 45e7580dc6 rename synchronous driver calls
synchronous driver calls are split in 2 calls, respectively:
fooS() and fooR() instead of fooSynchronous() and foo().

This is a tiny step towards decoupling drivers from the
renderstream, which is a pipedream of mine.
2019-02-19 18:31:43 -08:00
Romain Guy 6f9df5bfab Update incorrect equations of importance sampling 2019-02-19 17:59:39 -08:00