Commit Graph

270 Commits

Author SHA1 Message Date
Philip Rideout
d4a396d52f matinfo / matdbg: fix SPIRV version, add validation.
The value we pass to spvContextCreate() is not SPV_ENV_UNIVERSAL_1_3,
which is what we use in GLSLPostProcessor.

Also add a call to spvValidateBinary(), which would have caught this
oversight.
2020-05-19 16:48:36 -07:00
Pixelflinger
6df20f3083 Add a private property to materials to control framebuffer_fetch
this is intended to be temporary until we properly add support
for vulkan's subpasses. this PR just helps us activate
ext_framebuffer_fetch on select materials.
2020-05-19 12:25:41 -07:00
brian.wang
0187caf10f Fix minor bug in Vulkan backend on Windows
* fix compile error when vulkan

* matc:print shaders support

* fix link error

* ussage for matc print flag

Co-authored-by: brian.wang <brian.wang@noitom.com>
2020-05-12 08:59:25 -07:00
Romain Guy
14ce9e30b9 Make the build more quiet (#2457)
* Make the build more quiet

* Add mising include
2020-04-25 01:13:30 -07:00
Philip Rideout
a55b75a739 Remove monkey mesh dependency from samples.
The only apps that need this filamesh are suzanne and hellopbr. This
change allows us to modify + test Filament without re-invoking resgen.
2020-04-20 18:25:43 -07:00
Philip Rideout
cc61707cc2 Improve build turnaround by breaking dependencies.
This adds a new "backend_headers" target because small changes to any
backend cpp file was resulting in a huge build, causing materials to be
rebuilt, etc. Note that filabridge only needs DriverEnums, nothing else.
2020-04-20 15:37:21 -07:00
Romain Guy
06593a97bb Add new --mip-levels option to mipgen (#2421)
This option (short: -m) can be used to limit the number of mip
levels generated. Using -m 1 allows to use mipgen as a cheap-ish
image converter.
2020-04-18 16:43:39 -07:00
Romain Guy
c28d9ddb9d Fix support of paletted images and alpha channel in imageio (#2420) 2020-04-18 16:32:05 -07:00
Romain Guy
bf97e7e15a Add ground-truth option to cso-lut (#2398)
The ground truth is computed using a Monte Carlo simulation.
2020-04-15 14:51:52 -07:00
Romain Guy
8094955fc1 Add new tool cso-lut (#2394)
* Add new tool cso-lut

This tool is for internal usage only. It computes a 3D lookup table
for cone/sphere occlusion computations. These can be used to implement
specular occlusion, directional ambient occlusion, etc.

* Improve generated comment

* Fix Windows build
2020-04-14 18:22:56 -07:00
Romain Guy
bf0dc32ee3 Change specularAmbientOcclusion from boolean to enum (#2352)
The user can now choose amongst 3 specular AO methods:
- None, specAO is off
- Simple, specAO is inferred from roughness and diffuse AO
- Bent normals, specAO is computed accurately from cone intersections

The last method is more expensive but produces the best results.

This change also fixes a few issues:
- Rename materialRefraction() and materialRefractionType() for
  consistency
- Fixes user time in shaders
2020-04-07 09:19:48 -07:00
Ben Doherty
acc36e8d9b Deprecating Clang on Windows in CMakeLists (#2243) 2020-03-13 12:33:02 -07:00
Romain Guy
a2818037b3 matinfo can print dictionaries, shrink Metal dictionary (#2230)
This change adds new commands to matinfo to print dictionaries.
This feature is useful to debug dictionaries, and I just used
it to identify that using a shared dictionary would save ~12 KiB
in the Android build. The macOS build (GLSL + Metal) would go
down to 71 KiB from 136 KiB.

The SPIRV to Metal conversion leaves leading spaces and some
comments. This change also runs the shrinker on optimized Metal
shaders to further reduce the size of shaders.
2020-03-10 11:42:19 -07:00
Mathias Agopian
fddf51dc74 cmgen -d would force importance sampling mips generation 2020-01-06 17:43:11 -08:00
Mathias Agopian
b8d4b981e0 Better roughness remapping and comments
We were conflating two concepts in our comments about the roughness
remapping, which was confusing. Also changed the remapping so it 
matches a log2 mapping in our default configuration.
2020-01-06 17:42:56 -08:00
Romain Guy
78842b59c9 Only build FBX and OBJ importers (#2003) 2020-01-06 14:38:32 -08:00
Philip Rideout
25c4efd2db cmgen: do not create useless folder for KTX files
With KTX, we should simply create the specified output folder and put
the KTX file(s) in there. There is no need to create a subfolder of the
output folder.

This change also allows users to pick a custom name for their KTX file,
because we only use the "deployment" name when generating filenames.
2019-12-18 13:03:02 -08:00
Pixelflinger
a924fbb490 Better roughness remapping for IBLs
This greatly improves the quality of semi-rough
materials.
2019-12-14 16:36:58 -08:00
Philip Rideout
28065e36e8 Make builds less verbose.
Fixes #1956.
2019-12-10 17:19:06 -08:00
Mathias Agopian
0f16f3177e some cmgen fixes
- support equirect/octahedron save in more cases
- apply 1/pi when rendering SH so it's easier to compare 
  (this is used only for debugging anyways)
2019-12-10 12:26:52 -08:00
Mathias Agopian
cbb5d2b423 fix typos and rename refraction to refractionMode 2019-12-08 22:18:18 -08:00
Pixelflinger
1ccae61d40 shader plumbing for screen-space refraction
In this PR, the filament side is missing, so we're outputting back.
But all codepaths in the shader are implemented:
 cubemap/screenspace, solid/thin
2019-12-08 22:18:18 -08:00
Mathias Agopian
f94aa731ed Add plumbing for refraction type (solid or thin) 2019-12-08 22:18:18 -08:00
Pixelflinger
0371a805ed basic refraction 2019-12-08 22:18:18 -08:00
Mathias Agopian
dbda77b091 Improve low roughness significantly
Filament will now allow incomplete mipmap chains for the IBL and
map the roughness to the available chain.

This allows to create roughness cubemaps with a minim size for
roughness==1, instead of always mapping it to 1x1.

cmgen will now use 16x16 cubemaps for roughness==1, which
improves the quality of rough objects significantly.

The beauty of this is that there is no asset or API change. Old assets
will continue to work like before.
2019-12-08 22:17:08 -08:00
Romain Guy
a4a1bf07aa Use our own constants instead of M_PI, M_*, etc. (#1733)
These constants are not part of the standard. We instead use our own
constexpr definitions in the filament::math namespace, as part of
the scalar.h include.
2019-10-02 15:31:38 -07:00
Ben Doherty
7ea7d1d5f2 Fix, matinfo doesn't work on Windows (#1732) 2019-10-02 13:20:24 -07:00
Gregory Popovitch
d5c0d11404 Final changes for building with msvc 2019 on Windows (#1681) 2019-09-30 14:18:06 -07:00
Ben Doherty
b28e535540 Combine license file generation functions for MSVC compatability (#1684) 2019-09-24 12:45:38 -07:00
Gregory Popovitch
a34903aa33 Update CMake configuration to support building with MSVC 2019-09-23 10:15:34 -07:00
Ben Doherty
d849231caf Remove old post-process shader pipeline (#1631) 2019-09-13 09:29:28 -07:00
Philip Rideout
2a2974580c resgen: remove unused / incorrect constant. 2019-09-10 10:19:37 -07:00
Philip Rideout
8d1b630b24 resgen: repair wasm builds. 2019-09-10 08:02:35 -07:00
Philip Rideout
1235a66f83 resgen: avoid overwriting the header if nothing changed. 2019-09-10 08:02:35 -07:00
Philip Rideout
411e7f4511 resgen: use extern int instead of #define. 2019-09-10 08:02:35 -07:00
Philip Rideout
72644f1416 mipgen: add --quiet argument.
Note that some encodings like astc will still be noisy due to
third-party code but this works fine for the s3tc encoder.
2019-09-10 08:01:49 -07:00
Philip Rideout
23ee5e276c matdbg server: add query for active programs.
This uses the program cache to determine the set of variants that
are actually being used.
2019-09-09 11:04:02 -07:00
Ben Doherty
32eee2cdf1 Tungsten: upgrade Gradle, fix IBL (#1604) 2019-09-09 09:13:06 -07:00
Philip Rideout
9eae72f99d matdbg: allow editing for GLSL shaders.
This performs surgical modification of the IFF chunks rather than
invoking filamat from within matdbg. Low-level direct manipulation
(bypassing optimization passes etc) allows us to diagnose issues with
the shading pipeline.

This CL also adds keystroke bindings to the Monaco editor. You can
press Cmd+S to rebuild the current materials, or use Ctrl+Arrow to
navigate between shader variants and materials.

In a subsequent CL I will add a README that describes how this works in
detail, it will include a list of limitations and a feature wishlist.
2019-09-05 13:03:49 -07:00
Benjamin Doherty
f1257994d1 Disable DirIncluder tests 2019-08-23 13:31:20 -07:00
Benjamin Doherty
efb9e005b2 Fix build due to DirIncluder test 2019-08-23 12:40:47 -07:00
Ben Doherty
d4943cc70b Add #include preprocessing to filamat and matc (#1541)
* Add #include preprocessing to filamat and matc

* Update RELEASE_NOTES

* Fix RELEASE_NOTES

* Use final instead of virtual / override

* Clarify comments

* Use pure virtual for includer functions

* Use a callback instead of an interface

* Rename Includer.h to IncludeCallback.h

* Update comment
2019-08-23 11:10:36 -07:00
Ben Doherty
9a47ea1ef0 Fix Tungsten build (#1548) 2019-08-23 11:08:27 -07:00
Philip Rideout
8d7c00b0d9 matdbg: add DebugServer class.
matdbg is now linked into the Filament Engine in debug config (allowing
live inspection of GLSL / SPIRV) and into the matinfo tool (to support
the --web-server option).

In both cases, the library spins up a small web server that listens to
http://localhost:8080. You can run any Filament app and attach to it.

The web client caches all material information. This allows the user to
close an atttached Filament app, and the web app will continue to
function properly (useful for crash diagnosis). Moreover the user can
launch a second Filament app and the web client will add its materials
to the existing list (useful when comparing two Filament apps).

For now this only supports inspection, not editing. Some of the material
info such as required attributes is not yet displayed but this will be
easy to flesh out in a subsequent PR.
2019-08-22 16:12:20 -07:00
Philip Rideout
c4b0edbfe3 Introduce matdbg library, simplify matinfo.
This moves some of the matinfo functionality into a library which will
soon have an embedded web server.
2019-08-22 08:11:06 -07:00
Philip Rideout
b859b57797 matc, matinfo et al: improve diagnostic output
This enhances the exisiting matc option "--debug" so that it includes
debug information in the resulting SPIR-V.

Previously we tied this to the build configuration which isn't very
flexible. Moreover this needs to be orthogonal to shader opts, because
we often need to debug problems that arise from optimization.

This CL also gives meaningful names to the ubershader materials and
fixes up the new matinfo analysis so that it prints the entire SPIRV
chunk that corresponds to each potentially problematic GLSL codeline.

Motivated by #1516.
2019-08-14 13:01:43 -07:00
Philip Rideout
38955a91e5 matinfo: fix ordering of analyze-spirv output. 2019-08-12 11:40:36 -07:00
Philip Rideout
5df53f733e Add error message to matinfo. 2019-08-12 10:45:44 -07:00
Philip Rideout
d2324d253c filamat: when building debug, use verbose SPIR-V. 2019-08-12 09:12:59 -07:00
Philip Rideout
cf9e87a892 matinfo: add SPIR-V analysis functionality
This adds a new option to matinfo that does some very dumb regex-based
analysis on the disassembled SPIR-V, then dumps out transpiled GLSL
that has annotations added to the end of some codelines. For example:

```glsl
float luminance(vec3 linear) // POTENTIAL MIXED PRECISION %49 = OpDot %float %linear %48; relaxed = %49 %linear
{
    return dot(linear, vec3(0.2125999927520751953125, 0.715200006961822509765625, 0.072200000286102294921875));
}
```

The code currently tries to find potential mixed precision but does not
do the right thing yet for pointers and structs. This is just a starting
point to help diagnose problem areas in our generated SPIR-V.
2019-08-12 09:12:59 -07:00