Commit Graph
27 Commits
Author SHA1 Message Date
Philip Rideout 1921536f90 filamat: Fix data race with SPIRV error registrations. 2021-02-24 10:17:51 -08:00
Ben Doherty 07ddd52dcf Add getVertexIndex API for vertex shaders (#3493) 2021-02-04 12:40:21 -08:00
Romain GuyandPhilip Rideout 4567b01c1d Multi-thread shaders generation when compiling materials (#3464)
* Stop using members as globals between methods

* Multi-thread shaders generation with JobSystem

* Pass JobSystem to MaterialBuilder::build()

* Fix MeshAssimp to use the new API

* Allow the Java API to pass a job system via Engine

* Update docs

* Apply suggestions from code review

Co-authored-by: Philip Rideout <philiprideout@gmail.com>
2021-01-29 09:30:37 -08:00
Philip Rideout b70eea9556 filamat: minify struct fields.
This shrinks the arm64 so file by 24 KiB.
2020-12-10 11:20:14 -08:00
Ben Doherty fdc28801a2 Silence spirv-opt warnings in release builds (#3288) 2020-11-13 13:55:19 -08:00
Ben Doherty 8019b11589 Update glslang and friends (#3277) 2020-11-12 12:23:51 -08:00
Ben Doherty de377c8e37 Apply clipspace fixup in GLSLPostProcessor (#2950) 2020-08-13 12:14:29 -07:00
Ben Doherty 13574f793c Run MergeReturnPass only on mobile (#2901) 2020-07-31 18:40:47 -07:00
Pixelflinger 8882132f43 fix a use after free in filamat
This would happen when using math -E -a vulkan. GLSLangCleaner lifetime
must be shorter than TProgram/TShader.
I think we can fix this by using another scoped GLSLangCleaner.

Tested successfully with ASAN.
2020-06-25 12:20:16 -07:00
Ben Doherty 7a8755b5b2 Implement framebuffer fetch for Metal backend (#2648) 2020-06-05 17:31:12 -07:00
Philip Rideout 0e38cc770d filamat: generate spirv 1.0 rather than spirv 1.3
Since we are still on Vulkan 1.0, we cannot use SPIR-V 1.3.
If we try to do so, this error is generated:

    Invalid SPIR-V binary version 1.3 for target environment SPIR-V 1.0

In non-optimized builds, we were already generating spirv 1.0, but
when we enabled the shader optimizer, we generated spirv 1.3.

This bug has actually been around forever, but we did not notice because
we were only invoking the optimizer in release builds, which does not
enable validation.

We cannot upgrade Vulkan 1.1 because the latest LunarG SDK for macOS
does not support it.
2020-05-21 08:41:53 -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
Pixelflinger d8e2e60692 remove CreateEliminateDeadMembersPass which breaks UBO layout
this fixes a crasher when using --optimize-size
2020-05-05 18:17:31 -07:00
Pixelflinger a9a9061f96 update GLSLPostProcessor optimization passes to latest
deactivate "mergeReturnPass" because it triggers a segfault with
AMD drivers on MacOS.
2020-03-11 11:11:28 -07:00
Ben Doherty a2c6c34739 Update SPIRV-Tools to 2020.1 / SPIRV-Cross to 65aa0c3 (#2121) 2020-03-10 15:32:41 -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
Gregory Popovitch d5c0d11404 Final changes for building with msvc 2019 on Windows (#1681) 2019-09-30 14:18: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 d2324d253c filamat: when building debug, use verbose SPIR-V. 2019-08-12 09:12:59 -07:00
Ben Doherty a47b5c21cf Update SPIRV-Cross (#1439) 2019-07-24 16:26:24 -07:00
Ben Doherty 5caf9b9575 SPIRV-cross update (#1295) 2019-06-13 12:15:37 -07:00
Mathias Agopian b26684deed rename namespace filament::driver -> filament::backend 2019-03-26 11:47:47 -07:00
Ben Doherty 7be3994c96 Add Metal shading language compilation to matc (#752) 2019-01-29 12:44:58 -07:00
Romain Guy e41dd027ab Enable optimization passes on materials with external samplers (#605)
* Enable optimization passes on materials with external samplers

Because external samplers are not properly supported by SPIRV and
associated library (spirv-cross and spirv-tools) we currently disable
all optimizations when we encounter a material with external samplers.

This however causes issues on some misbehaved drivers (not running
the optimizations has a side effect which causes a crash). To enable
the optimization pass we simply rely on the Vulkan codegen target to
substitute samplerExternal with sampler2D. We then analyze the output
GLSL (post-optimization) and revert the relevants sampler2D declarations
to samplerExternal declarations.

This fixup only occurs after optimization and for mobile targets and
if external samplers were declared.

* Address review comments
2018-12-10 12:02:59 -08:00
Ben Doherty fe4907d0ff Remove use of iostream in filamat (#549) 2018-11-29 10:35:37 -08:00
Ben Doherty a1ed3b81a3 Move static code analysis into filamat (#534)
* Handle static code analysis automatically

* Fix matc test cases

* Only call InitializeProcess once per process
2018-11-27 14:11:27 -08:00
Ben Doherty b5fa822e86 Move GLSLPostProcessor and dependencies into filamat (#500)
* Move GLSLPostProcessor into filamat
2018-11-20 12:30:26 -08:00