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.
* Rename MetalImpl to MetalContext and move to separate header
* Remove m prefix from MetalContext variables
* Refactor out acquireDrawable method
* mCommandQueue -> commandQueue
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.
- 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
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.
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.
* 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
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.
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.
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.
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.
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
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.
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.