Commit Graph
77 Commits
Author SHA1 Message Date
Romain Guy e1b773958f Add screen and multiply blending modes (#1241)
* Add screen and multiply blending modes

This change also fixes a sorting issue: different sorting modes
were sorted in different buckets which is incorrect. We want
to sort only by distance.

* Update release notes and Java API

* Fix build error
2019-05-30 10:17:16 -07:00
Romain Guy 0a5c068cb6 Switch specular AA to Tokuyoshi and Kaplanyan (#1218)
This replaces the previous "curvature to roughness" method. Both are related
and rely on the screen space variance of geometric normals but this new
solution offers more control (the screen space variance and the clamping
threshold can be controlled).
2019-05-23 12:56:26 -07:00
Mathias Agopian 062ec48ee6 Implement basic SSAO 2019-05-07 18:35:19 -07:00
Mathias Agopian ad62b1e4ed Bake the constant bias into the shadow-map
The constant bias can be baked in the shadow map,
which saves some cycles in the vertex shader.
2019-04-13 11:01:02 -07:00
Philip Rideout 37cb9247fd Add new shading model to Filament for specularGlossiness. (#1083)
* Add new shading model to Filament for specularGlossiness.

This adds a shading model based on KHR_materials_pbrSpecularGlossiness.
The corollary gltfio change will be in an upcoming PR.

* Improve documentation for specular-glossiness
2019-04-09 13:22:16 -07:00
Mathias Agopian 6374c9ab59 Expose the depth buffer to the postprocess pass 2019-04-01 10:57:32 -07:00
Philip Rideout c92700ce28 Simplification due to sampler bindings starting at 0. 2019-03-28 07:29:14 -07:00
Philip Rideout 7a106be627 MATERIAL BREAK: VulkanBinder now binds 2 descriptor sets at a time.
This allows us to start Vulkan sampler bindings at zero, similar
to uniforms. Further cleanup will be implemented in a subsequent pull
request.
2019-03-27 13:11:24 -07:00
Philip Rideout 0076de25fa Configurability fixups per code review. 2019-03-27 09:24:44 -07:00
Philip Rideout 5090fe6395 Allow configurable attribute and binding counts.
This fixes two issues related to the Vulkan backend, one being a build
issue and the other being a run-time issue:

(1) Compile-Time Issue

To prevent accidental introduction of padding into hashed structures,
the Vulkan backend was static-asserting the size of the hash input. I
think it's fine to simply use a pragma pack instead.

(2) Run-Time Issue

SibGenerator was erroneuously using BindingPoints::COUNT instead of
UNIFORM_BINDING_COUNT for determining the first sampler binding index.
(Hopefully this logic will go away after some upcoming Vulkan cleanup.)
Since SibGenerator does not include Program, this moves the uniform and
sampler counts into EngineEnums, which might be a good place anyway
since they are ideally "config" constants.
2019-03-27 09:24:44 -07:00
Mathias Agopian b26684deed rename namespace filament::driver -> filament::backend 2019-03-26 11:47:47 -07:00
Mathias Agopian 639d05374b update layering: libbackend is now at the bottom
We now have:

backend -> filabridge -> filaflat -> filament
                      -> filamat

Instead of backend depending on filabridge.
2019-03-26 11:47:47 -07:00
Mathias Agopian 4bec201717 naming convention NUM_FOOS -> FOO_COUNT 2019-03-25 17:55:19 -07:00
Mathias Agopian 8ec3b62715 libbackend header cleanup
This is mostly about moving constant from EngineEnums.h to
the backend, either in Program.h or DriverEnums.h

The goal is that libbackend doesn't depend on EngineEnums.h
2019-03-25 17:55:19 -07:00
Mathias Agopian 1f183def46 move more public stuff out of Driver:: into DriverEnums.h
These data structures are part of the public API of libbackend.
2019-03-25 09:51:41 -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 0ce6c8d8d0 rework scissor/viewport API a bit in the backend
- the IGNORE_VIEWPORT flag is gone. It wasn't actually needed and what
  it was doing was ambiguous.

- removed the backend viewport() API which wasn't actually needed.

- beginRenderPass() now ALWAYS sets the viewport and scissor but 
  doesn't necessarily clears honoring the scissor (based on the
  IGNORE_SCISSOR flag).

- the GLES backend now just sets the scissor when it needs it, as opposed
  to always trying to keep it set. we now rely on state tracking to
  de-dup the gl calls.
2019-03-20 11:37:21 -07:00
Romain Guy 2e22a26ca5 Fix filamat build (#1005)
Filamat public headers were including a private header. This PR fixes
this problem. It also forces filamat to always be compiled to avoid
breaking filamat without noticing. The flag `-l` is not available
anymore in build.sh as a result.
2019-03-18 18:40:48 -07:00
Mathias Agopian ca79e9d420 More doxygen documentation 2019-03-12 13:35:58 -07:00
Mathias Agopian 07bb62490b Add an option to turn dithering on/off 2019-03-12 13:32:28 -07:00
Mathias Agopian 1836377753 don't have two version of SamplerFormat
Instead, alias one on the other.
Also sort aliases in the header.
2019-03-07 16:42:02 -08:00
Mathias Agopian d2afc27703 Address review comments 2019-03-07 13:43:27 -08:00
Mathias Agopian 91738d0513 Remove the 'group' parameter from SamplerBindingMap 2019-03-07 13:43:27 -08:00
Mathias Agopian 2a72e8aee8 break dependency of Program on SamplerInterfaceBlock and SamplerBindingMap
Instead of passing SamplerInterfaceBlocks and a SamplerBindingMap to
Program, we now set a 'sampler group' per binding point:

Program::addSamplerGroup(...)

A sampler group here consists of a list of N 'Sampler' and a 'Sampler'
is just a unique name (unifrom name in the shader) and binding point in
the shader.

That's all the driver layer needs.

With this change we get rid of the code that re-created the uniform
names in the driver -- this should never have been done there. And we
also remove the hash-map lookups in vulkan and metal drivers.
2019-03-07 13:43:27 -08:00
Pixelflinger 46e3326b81 move getSamplerBindingsStart() to SibGenerator
This is a bit more logical to have it there because SibGenerator
is about about what filament needs, whereas SamplerInterfaceBlock.h
is generic.
2019-03-06 11:47:26 -08:00
Pixelflinger 413f6a97b1 Engine.h doesn't need to store the per-view/post-process Sib
It's only used to get the size of the SamplerGroup.
Actually, Engine also uses the post-process Sib to create the
post-process material, but this should go away when we have
material domains -- so pretend it's not there.
2019-03-06 11:47:26 -08:00
Pixelflinger 1597b6f572 rename SamplerBuffer to SamplerGroup
This is the first part of a larger rework:
- Rename SamplerBuffer to SamplerGroup
- remove dependency on SamplerInterfaceGroup
2019-03-06 11:47:26 -08:00
Mathias Agopian 4abe017bc5 cleanup MaterialChunkType.h 2019-03-05 17:54:37 -08:00
Mathias Agopian 561726b938 remove unneeded dependency on SamplerBindingMap.h 2019-03-04 15:52:46 -08:00
Mathias Agopian 3297c9bc78 More headers clean-up
- EngineEnums.h is not a private headers as it contained mostly private
stuff

- MaterialEnums.h is still public, but now only contains public stuff.
Private parts were moved to MaterialEnums.h or MaterialBuilder.h

- And finally SamplerBinderMap is moved under private/ as well, since
it's certainly not a public API.

With this change, the public headers of filabridge become more reasonable
and limited.
2019-03-02 00:21:09 -08:00
Mathias Agopian bf93468c3f Minor MaterialEnum.h cleanup -- first step. 2019-03-01 08:43:01 -08:00
Mathias Agopian 4b587a1f6d silence a few warnings 2019-02-28 12:29:56 -08:00
Mathias Agopian 583645a943 Move MaterialParser from filaflat to filament
With this change, filaflat looses almost all its dependencies on
filabridge (only needs DriverEnums.h) and becomes only a parsing
library that doesn't know anything about materials.
It still knows about "shaders" as blobs of text or data (spirv).

Filaflat itself is used by matinfo and filament.
2019-02-28 12:29:56 -08:00
Mathias Agopian 9263eda90e Remove dependency on Variant.h in MaterialChunk.cpp
this dependency was only used to restrict the variant to filament's
usage of it. but really this shouldn't be done here.
2019-02-28 12:29:56 -08:00
Mathias Agopian d07222fc3c cleanup: break dependency filamat->filaflat dependency 2019-02-28 12:29:56 -08:00
Mathias Agopian 0dd8414844 minor cleanup, try to remove some uneeded dependencies
this is in praparation for much larger changes
2019-02-28 12:29:56 -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
Philip Rideout 91ce2f412b Bump MATERIAL_VERSION. 2019-02-19 15:54:58 -08:00
Philip Rideout e60744a6e4 Introduce MATERIAL_VERSION and panic.
Material archives already contain two version chunks (post process and
normal) but the renderer was ignoring these. The change makes it so that
matc writes a new MaterialEnums value into these chunks, and the engine
panics when receiving a material version that it does not expect.

This also adds a --version option to matc. No changes were necessary
to matinfo because it already prints out these values.

Fixes #796.
2019-02-19 15:54:58 -08:00
Mathias Agopian e98b413eb5 don't default initialize driver::Viewport/RenderPassFlags
instead we initialize them to zero in RenderPassParams.
2019-02-14 18:08:40 -08:00
Mathias Agopian 147e4d2189 Flags must be zero by default 2019-02-14 18:08:40 -08:00
Mathias Agopian 26468d9532 Split RenderPassParams into multiple structs
We split out Viewport and RenderPassFlags.
2019-02-14 18:08:40 -08:00
prideout 5ee359cf40 Move math namespace to fix #746. 2019-02-07 09:23:07 -08:00
Mathias Agopian 8298520f0a TextureUsage is now a bitmask, which makes it more flexible. 2019-02-01 17:10:45 -08:00
Ben Doherty 7be3994c96 Add Metal shading language compilation to matc (#752) 2019-01-29 12:44:58 -07:00
Ben Doherty 92de93bfb8 Add Metal skeleton code (#714) 2019-01-28 15:29:37 -07:00
prideout 98d39b7e7e Revert "Fix depth prepass (#722)"
This reverts commit 896c85c324.
2019-01-18 13:59:22 -08:00
Romain Guy 896c85c324 Fix depth prepass (#722)
The engine tries to be smart by using a single vertex shader when
rendering unskinned, non-alpha masked, non-customized materials.
This leads to a lot of issues when laying down the depth prepass.
This change simply gets rid of this optimization (which wasn't
properly profiled anyway). Correctness is more important.

Fixes #645
2019-01-17 17:57:43 -08:00
Romain Guy 8029ad5cc3 Add missing getWorldFromClip() API (#692)
Fixes #671
2019-01-10 16:35:00 -08:00