Compare commits

...

985 Commits

Author SHA1 Message Date
Benjamin Doherty
71f60de0ad Merge branch 'rc/1.40.4' into release 2023-08-01 15:38:37 -07:00
Powei Feng
743661109d vulkan: fix TSAN in readpixels 2023-08-01 15:35:06 -07:00
Benjamin Doherty
5014cbb023 Bump version to 1.40.4 2023-07-26 12:53:47 -07:00
Benjamin Doherty
4142e7a1cf Merge branch 'rc/1.40.3' into release 2023-07-26 12:52:12 -07:00
Benjamin Doherty
9452d5be1d Release Filament 1.40.3 2023-07-26 12:51:50 -07:00
Romain Guy
ea3f449a08 Update dependencies (#6992) 2023-07-26 11:05:09 -07:00
Ben Doherty
dc9510fe25 Support EXT_clip_cull_distance for future use (#6965)
This PR sets up the ability for shaders to use `gl_ClipDistance`, which will be needed in the future. Desktop GL supports this natively. OpenGL ES requires the EXT_clip_cull_distance extension.

Unfortunately glslang does not support this extension, so we have to employ a workaround for mobile when going through glslang. We instead write to `filament_gl_ClipDistance`, and then modify the SPIR-V to decorate this as `gl_ClipDistance`. See the comment in SpirvFixup.h.

Note this PR does not actually use `gl_ClipDistance` yet, so there should be no change to shaders.
2023-07-26 10:01:28 -07:00
Powei Feng
731dd761d9 vulkan: Implement async readPixels (#6695)
- Carry out readPixels without blocking and wait for the read to
   complete own a separate thread.
 - Add mContext.commands->wait() in finish()
 - Wait for readPixels to complete in finish()
 - Remove unused commandBuffer in Context
2023-07-25 14:07:56 -07:00
Powei Feng
6726ccb2fb vulkan: fix subpass validation (#6980)
- Before, we supposed that the maximum number of input attachment
   should match the maximum number of color attachments. But in
   reality, we've only used one input attachment for the second
   subpass.
 - The problem with the above supposition is that the descriptor
   set layout for the input attachment descriptor set must have the
   exact number of input attachment specified in the shader. If the
   *layout* has more input attachment slots than specified in the
   shader, then we'd run into a validation error.
 - In this patch, we fix the number of max input attachment in
   the descriptor set layout to 1, since we ever only make use of
   one.

Fixes #6513
2023-07-25 11:24:14 -07:00
Powei Feng
5fce0f9ecf filamentapp: fix vulkan dependency (#6987)
Fixes #6983
2023-07-24 16:50:51 -07:00
Mathias Agopian
ad03fc4118 fix typo that prevented the shader blob cache to work (#6979)
fixes b/290670707
2023-07-24 09:59:19 -07:00
Y-way
3f77ff8815 Build error on msvc 2022 2023-07-21 10:00:51 -07:00
Mathias Agopian
26b5fa1e38 fix a crash when using Material::compile with a callback
The work queue is sorted by priority but when we insert a notification
job we didn't have a priority to use for insertion, in addition the
priority was taken from the token, but for the notification job we don't
have a token.

The fix consists in passing the priority around so we have it when needed.
2023-07-21 10:00:21 -07:00
mackong
24286e6016 gltfio: fix crash when compute morph target without material 2023-07-21 09:08:22 -07:00
Ben Doherty
626577fe3d Fix ineffective FOG variant filter (#6968) 2023-07-20 11:54:18 -07:00
Romain Guy
176915b59c Add missing setParameter variants to MaterialInstance (#6973)
Adds support for mat3/mat4 parameter types
2023-07-20 11:19:35 -07:00
mackong
0b60933c2a web: remove const qualifier for getMaterialInstances (#6952) 2023-07-20 10:43:33 -07:00
Pawan Vimukthi
0e31d6936a Update android/Windows.md (#6964)
Updated the flag `filament-skip-samples` in the code snippet to align with the documentation.
2023-07-19 13:23:08 -07:00
Benjamin Doherty
a721e648b7 Bump version to 1.40.3 2023-07-17 15:50:20 -06:00
Benjamin Doherty
358e89ef08 Merge branch 'rc/1.40.2' into release 2023-07-17 15:49:29 -06:00
Benjamin Doherty
78d9c43ef1 Release Filament 1.40.2 2023-07-17 15:49:14 -06:00
Powei Feng
ce253a9563 vulkan: swapchain resize condition update (#6951) 2023-07-13 10:54:51 -07:00
Benjamin Doherty
e023e90e7a Bump version to 1.40.2 2023-07-12 13:44:52 -07:00
Benjamin Doherty
a5b5b0c3a7 Merge branch 'rc/1.40.1' into release 2023-07-12 13:43:33 -07:00
Benjamin Doherty
18c3c36727 Release Filament 1.40.1 2023-07-12 13:43:11 -07:00
Ben Doherty
4e6f6a4579 Disable shader precompilation on WebGL (#6925) 2023-07-12 07:32:58 -07:00
Powei Feng
84487f4d8d vulkan: add lock to VulkanTimerQuery fence (#6949)
Call to Driver::getTimerQueryValue is synchronous so we need to
make sure the fence shared_ptr is protected by a lock.
2023-07-11 09:14:06 -07:00
Powei Feng
45f5a07989 Update MATERIAL_VERSION to 40 (#6948) 2023-07-10 15:22:15 -07:00
Powei Feng
b7b4d3c295 Update Material version to match 1.40.1 2023-07-10 14:27:51 -07:00
Romain Guy
0061883dbf Fix dynamic resolution with quality > low and translucency (#6940)
The scene graph was using the wrong boolean to decide whether to fallback
to low quality upscaling when the render target is translucent. It was
instead only looking at the view's blending mode. We need to check both,
as color grading does in the same function.
2023-07-10 12:48:54 -07:00
조다니엘(Daniel Cho)
47e3be11f0 Fix typo in BUILDING.md (#6942) 2023-07-07 08:13:37 -07:00
junsang.lee
420f4000c2 fix: 64-Bits Windows, Path::exists() fails for files over 2GB. (#6938) 2023-07-07 00:14:54 -07:00
Romain Guy
4582ce8769 Fix texture upload callbacks in Java/Kotlin (#6939)
* Fix texture upload callbacks in Java/Kotlin

* Update release notes
2023-07-06 15:53:24 -07:00
조다니엘(Daniel Cho)
3beb39f30b Fix typo in build.sh (#6935) 2023-07-06 09:07:14 -07:00
Romain Guy
b72d6c058a Move file to the correct location 2023-06-26 12:48:22 -07:00
Benjamin Doherty
a445c4e156 Merge branch 'rc/1.40.0' into release 2023-06-26 13:29:06 +08:00
Benjamin Doherty
1432c59499 Add missing atomic header 2023-06-26 13:23:38 +08:00
Benjamin Doherty
4c7c10fad0 Bump version to 1.40.1 2023-06-26 13:17:45 +08:00
Benjamin Doherty
0c8f367b29 Release Filament 1.40.0 2023-06-26 13:16:53 +08:00
JEONG TAEHUN
50045edb4f [ModelViewer.kt, Remove Lint warning] (#6917)
- Use of getter method instead of property access syntax (for getInstance)
 - 'rangeTo' or the '..' call should be replaced with 'until' (in for)

Co-authored-by: jeongth9446 <taehuniy@gmail.com>
2023-06-26 12:05:43 +08:00
Benjamin Doherty
f538d1aa43 Add missing atomic header 2023-06-26 11:47:44 +08:00
Benjamin Doherty
7c8a0d1967 Bump MATERIAL_VERSION to 40 2023-06-26 10:33:02 +08:00
SahilMadan
4bd8d2a3b7 Make initializeGlExtensions protected (#6914) 2023-06-22 14:17:12 +08:00
Ben Doherty
9fa952d968 For web assembly, implement logging as emscripten_err and emscripten_out (#6913) 2023-06-22 11:18:23 +08:00
Ben Doherty
1edad92d73 Update RELEASE_GUIDE.md 2023-06-21 07:45:37 +08:00
Powei Feng
11fbacea20 Update MaterialEnums.h to v39 2023-06-20 11:57:42 -07:00
Powei Feng
8cd70454c3 Update MaterialEnums.h to v39 2023-06-20 11:56:40 -07:00
Powei Feng
52282baeff Update MaterialEnums.h to v39 2023-06-20 11:48:07 -07:00
Benjamin Doherty
1d988182fc Bump version to 1.40.0 2023-06-20 23:55:00 +08:00
Benjamin Doherty
dba49f00df Merge branch 'rc/1.39.0' into release 2023-06-20 23:45:04 +08:00
Benjamin Doherty
85ab9d211d Release Filament 1.39.0 2023-06-20 23:44:33 +08:00
Ben Doherty
6e99a4dcfc Turn off iOS exceptions in debug builds (#6912) 2023-06-20 14:59:10 +08:00
Ben Doherty
89c0b44da9 Re-enable Metal half conversion, only register SimplificationPasses for Metal (#6883) 2023-06-20 14:27:44 +08:00
Ben Doherty
4f450fd5c4 Temporarily disable Metal relaxed to half pass due to spirv-cross bug (#6880) 2023-06-20 14:27:37 +08:00
Mathias Agopian
f0943cfca2 align uniform buffer to 16 bytes
this is needed on armv7 because we use alignas to get strcture-alignment,
but that also implies (to the compiler) that the structure itself
is aligned properly.
2023-06-20 14:23:47 +08:00
Mathias Agopian
35c91827af fix error reporting with ShaderCompilerService
when using the thread pool we were destroying the shaders immediately,
we need to defer this until we query the program link status, so that 
in case of failure we can query each shader compile status.

we make the shader handles part of the promise/future so they can be 
transferred to the main thread, just like the program id is.
2023-06-16 11:04:59 -07:00
Powei Feng
5c11b237f3 vulkan: address debugUtils bug (#6904)
vkCmdEndDebugUtilsLabelEXT expects that a label was "pushed" onto
the command queue (as described in the spec). It is possible to push
labels across command buffers, but the pushed label must still be in
the queue (unexecuted) when End is called. This implies that we need
to make sure the labels are in a good state (all popped) when
vkQueueSubmit is called.

- We add a stack to carry the labels across vkQueueSubmit.
- Also add CPU time durations between push and pop to provide rough
  CPU execution times (in debug).
- Add systrace markers for Android systrace
2023-06-15 11:27:48 -07:00
Powei Feng
432b5d0427 vulkan: fix taa validations (#6903)
- Validation failing due to incorrect layout wrt Blitter
   render pass.
 - Clear colors are also not needed for blitter renderpass.
 - SAMPLEABLE + DEPTH_ATTACHMENT needs to have the correct layout.
2023-06-15 09:20:08 -07:00
Powei Feng
b8b1fadfa1 vulkan: fix timer query (#6905)
- Timer query stashed a pointer to VulkanCommandBuffer, but this
   points to an object that can be reused.
- We use the shared_ptr'd fence object instead to track whether
  the query request has been completed.
2023-06-14 22:17:10 -07:00
Mathias Agopian
74f5d8a066 the ShaderCompilerService handles async shader compilation (#6848)
It supports KHR_parallel_shader_compile as well as a
thread pool of GL contexts.

- we have a new 2-priorities queue for shader compilation
- use this feature in gltfio in the ubershader case
2023-06-14 10:51:02 -07:00
Powei Feng
09aeeccfa7 vulkan: fix present layout warning on mac (#6896)
Fixing validation warning of the form:
(UNASSIGNED-BestPractices-ImageBarrierAccessLayout) Validation Warning: [ UNASSIGNED-BestPractices-ImageBarrierAccessLayout ] Object 0: handle = 0x7f824f057218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x849fcec7 | vkCmdPipelineBarrier: accessMask is VK_ACCESS_2_TRANSFER_READ_BIT, but for layout VK_IMAGE_LAYOUT_PRESENT_SRC_KHR expected accessMask are VkAccessFlags2(0).
2023-06-13 16:22:53 -07:00
Mathias Agopian
9aa52b79d4 helpers to fix jank when resizing a TextureView (#6889)
There was two related issues:
- we need to "latch" the new TextureView size when its resized. That
  can only be done by recreating the EGLSurface (i.e. recreating the
  SwapChain). UiHelper now calls onNativeWindowChanged in the case of
  the TextureView resize, so clients can recreate their SwapChain.
- we also needed to make sure that all current filament frames have
  finished to render (i.e. the last eglSwapBuffers has been called) so
  that they don't pick-up a new size (this happens after
  eglSwapBuffers) that doesn't match the viewport.

Fixes b/282220665
2023-06-12 23:13:48 -07:00
Mathias Agopian
094abdc194 helpers to fix jank when resizing a TextureView (#6889)
There was two related issues:
- we need to "latch" the new TextureView size when its resized. That
  can only be done by recreating the EGLSurface (i.e. recreating the
  SwapChain). UiHelper now calls onNativeWindowChanged in the case of
  the TextureView resize, so clients can recreate their SwapChain.
- we also needed to make sure that all current filament frames have
  finished to render (i.e. the last eglSwapBuffers has been called) so
  that they don't pick-up a new size (this happens after
  eglSwapBuffers) that doesn't match the viewport.

Fixes b/282220665
2023-06-12 23:09:47 -07:00
Mathias Agopian
f4b97028b0 align uniform buffer to 16 bytes
this is needed on armv7 because we use alignas to get strcture-alignment,
but that also implies (to the compiler) that the structure itself
is aligned properly.
2023-06-12 23:08:51 -07:00
Ben Doherty
e14cbf2163 Add query instead of relying on CONFIG_MAX_INSTANCES (#6891) 2023-06-12 21:43:38 -07:00
Powei Feng
032cbab7b0 vulkan: fix missing sampler texture (#6885) 2023-06-12 09:30:10 -07:00
Mathias Agopian
e306856c4f update spirv-cross (#6881) 2023-06-09 14:08:03 -05:00
Ben Doherty
c1f164190b Re-enable Metal half conversion, only register SimplificationPasses for Metal (#6883) 2023-06-08 14:00:05 -05:00
Powei Feng
8030a078ff vulkan: sRGB swapchain (#6879) 2023-06-08 10:06:52 -07:00
Mathias Agopian
11adcbed25 fix VSM's high precision option on mobile (#6873)
the math needs to be maintained in highp, including during the blur
pass.

we add the ability to specify a "precision" qualifier to the "output"
of a post-process material.

we also remove the mediump clamping we used to do on mobile, it shouldn't
be done automatically behind the scenes, it's up to the shaders to do
it if it makes sense.
2023-06-07 21:57:17 -07:00
Ben Doherty
c2b10859c9 Temporarily disable Metal relaxed to half pass due to spirv-cross bug (#6880) 2023-06-07 19:30:31 -05:00
Powei Feng
a82125dbbd vulkan: minor fixes (#6874)
- flush() and wait() before destroying a swapchain
 - Make sure the debug marker extension is enabled under correct
   circumstances.
 - Change shared_ptrs to unique_ptrs and raw pointers.
 - Rename most teardown methods to terminate()
2023-06-07 11:45:09 -07:00
Powei Feng
e0e2c76d2f vulkan: minor fixes (#6874)
- flush() and wait() before destroying a swapchain
 - Make sure the debug marker extension is enabled under correct
   circumstances.
 - Change shared_ptrs to unique_ptrs and raw pointers.
 - Rename most teardown methods to terminate()
2023-06-07 11:05:47 -07:00
Benjamin Doherty
24fcb299b5 Bump version to 1.39.0 2023-06-07 11:32:33 -05:00
Benjamin Doherty
753aa9ca61 Merge branch 'rc/1.38.0' into release 2023-06-07 11:31:21 -05:00
Benjamin Doherty
b0238c1560 Release Filament 1.38.0 2023-06-07 11:31:01 -05:00
Benjamin Doherty
a33eada7ec Bump version to 1.38.0 2023-06-07 11:29:02 -05:00
Mathias Agopian
5ffb52a17d Workaround invalid glsl generation
spirv-opt's CreateSimplificationPass() cuases spirv-cross to fail
generating working glsl.
2023-06-06 19:53:57 -07:00
Mathias Agopian
6b34e72418 disable glsl/msl minification when generate debug info is active 2023-06-06 19:53:09 -07:00
Powei Feng
d43c632e55 vulkan: add option to choose gpu in platform (#6864) 2023-06-06 17:18:57 -07:00
Romain Guy
d55dfdebde Fix erroneous comment 2023-06-06 15:30:06 -07:00
Powei Feng
4b12876ebc vulkan: fix context sharing (#6869)
- Make sure terminate() doesn't free shared context
- Assume no extensions have been enabled.
2023-06-06 14:04:28 -07:00
Daniel Kutenin
3e12449b8f Fix strict weak ordering in VulkanPlatform.cpp (#6867)
Merged-by: Powei Feng <powei@google.com>
2023-06-06 13:07:28 -07:00
Mathias Agopian
fdc3f302d9 fix a crash on adreno when vsm is enabled
fixes b/285928132
2023-06-06 09:55:35 -07:00
Mathias Agopian
07642fec83 workaround a bug in spirv-tools causing vsm to fail
it's unclear if the problem was in spirv-cross or spirv-opt, but
eitherway, the generated code at the end was invalid.
2023-06-06 09:54:45 -07:00
Benjamin Doherty
676a2be874 Correct MATERIAL_VERSION to 37 2023-06-05 17:20:18 -05:00
Mathias Agopian
4ce93232c3 MaterialParser micro optimizations
- improves performance
- reduces code size
2023-06-05 12:45:30 -07:00
Powei Feng
ccea370cd9 vulkan: wait on command buffers before resource gc (#6855) 2023-06-02 10:50:06 -07:00
Powei Feng
8f6885689b release: adjust version-bump script for linux (#6859) 2023-06-02 09:58:47 -07:00
Romain Guy
64b15fafe2 Save ImGui settings in a user-specific directory (#6865)
* Save ImGui settings in a user-specific directory

Fixes #6862

* Fix Windows build

* Fix Web build

* Add missing file
2023-06-02 08:42:27 -07:00
Powei Feng
c95d466cdd Fix missing include (#6858) 2023-06-01 16:28:05 -07:00
Powei Feng
d891acb8c0 Fix missing include (#6858) 2023-06-01 15:15:34 -07:00
Powei Feng
de0bc718be vulkan: fix freebsd platform breakage (#6863) 2023-06-01 13:42:39 -07:00
Romain Guy
283a06e200 Update AGP and Kotlin coroutines dependency (#6857) 2023-06-01 08:22:51 -07:00
Powei Feng
3cfb2f8339 vulkan: fix accidentally enabled API dump (#6856) 2023-05-31 16:05:27 -07:00
Powei Feng
3d8ac384ad Update MATERIAL_VERSION to 38 (#6852) (#6854) 2023-05-31 15:00:34 -07:00
Powei Feng
21164885e8 Update MATERIAL_VERSION to 38 (#6852) 2023-05-31 11:26:03 -07:00
Mathias Agopian
0d745c4fea JobQueue is not used anymore, remove it. 2023-05-30 17:44:06 -07:00
Powei Feng
57424cc7e9 Merge branch 'rc/1.37.0' into release 2023-05-30 16:22:31 -07:00
Powei Feng
0e2f8b5dda Release Filament 1.37.0 2023-05-30 16:21:45 -07:00
Powei Feng
321777e8c1 Fix froxelizer entry count (#6845) 2023-05-26 15:46:34 -07:00
Powei Feng
aa9f0a4ca3 vulkan: platform API for context sharing (#6844) 2023-05-26 11:01:03 -07:00
Mathias Agopian
bee8862897 add basic support for KHR_parallel_shader_compile
We're just detecting the extension here, not making use of it.
2023-05-25 21:24:01 -07:00
Mathias Agopian
fed69025d2 update remote-ui and web samples 2023-05-25 11:26:21 -07:00
Powei Feng
f953488a31 vulkan: platform swapchain API (#6830)
- Introduce new custom swapchain API for VulkanPlatform.h
 - Implement the API for the base VulkanPlatform by refactoring
   the existing swapchain code.
 - VulkanSwapChain is now a wrapper for VulkanPlatform's
   swap chain API.
 - Actual implementation is in
   vulkan/platform/VulkanPlatformSwapChainImpl.{h,cpp}
2023-05-25 07:57:55 -07:00
Mathias Agopian
25708e8082 don't hardcode the system page size to 4096
It's already 16K on macOS and other systems.
2023-05-24 21:35:38 -07:00
Powei Feng
78fe4ba547 vulkan: allow for headless linux builds (#6836) 2023-05-24 17:19:42 -07:00
Mathias Agopian
a8afa91b7d add support for custom fog color in gltf_viewer
this is implemented by here by using the skybox texture and blurring it
with the irradiance filter + mipmapping. This only creates a subtle
anisotropic phase-function effect.
2023-05-24 16:37:10 -07:00
Mathias Agopian
2806221eda fix a couple of subtle bugs related to custom commands
- we must sort commmands *after* we have added all commands!
- custom commands could change the UBO/Sampler bindings so we need
  to make sure to invalidate them after executing the command.
2023-05-24 16:02:14 -07:00
Mathias Agopian
a9763376b7 IBLPrefilter can now generate the irradiance texture 2023-05-23 15:52:22 -07:00
Mathias Agopian
153dc08aa7 Support for custom fog-color texture
Fix 282968398
2023-05-23 15:52:01 -07:00
Ben Doherty
332b924325 Better fix for WebGL debug assertion (#6832) 2023-05-23 14:34:18 -07:00
Ben Doherty
b2ee4e93d4 Fix assertion in WebGL debug (#6831) 2023-05-23 14:10:22 -07:00
Mathias Agopian
fda62e0065 fix sampling direction of fog color from IBL
When sampling the fog color from the IBL we need to take into account
the IBL transform. This broke recently when the for calculation was
moved in user world coordinates.
2023-05-23 09:01:34 -07:00
Mathias Agopian
faafb1464c fix build, a unit test was broken 2023-05-23 00:01:53 -07:00
Mathias Agopian
edfd06eaef froxelizer doesn't use textures anymore (#6824)
* froxelizer doesn't use textures anymore

All data is stored in UBOs.
Additionally, the buffer size is no longer hardcoded at compile time.

This CL cuts in half the numbers of froxels to accommodate devices
limited to 16KiB,

* Use a specialization constant to adjust the size of froxel UBO

This really only affects OpenGL in practice because metal supports 256MB
minimum and only 3% of android devices support less than 32K, which is
what we need.
2023-05-22 13:56:13 -07:00
Powei Feng
1a83083651 vulkan: fix unitialization (#6822)
And reformat VulkanContext.h
2023-05-22 11:47:03 -07:00
Mathias Agopian
5cb3b16f36 correctly account for user samplers in matc and document it
The number of usable sampler in materials is now documented and properly
accounted for in matc.
2023-05-22 09:59:12 -07:00
Romain Guy
3aa6913538 Add .bin option to --sh-output to generate SH in binary (#6823)
- Passing filename.bin to --sh-output generates a file containing the SH
  as binary floats in native endianness (LE on x86 and arm64)
- Fix --sh-output so it works properly with -x
- Cleanup variable names to avoid shadowing
2023-05-19 14:27:55 -07:00
Mathias Agopian
2c6f723317 extract depth/view reconstruction from ssao
these utilities can be used by other materials
2023-05-18 16:28:31 -07:00
Powei Feng
ddfeaef2ca vulkan: VulkanContext/Platform refactor (#6810)
We need to keep the context handles as part of the platform
class so that we can implement the new swapchain API based
on them.

 - Move creation of "context" handles from Context to Platform
 - VulkanContext contains immutable data
 - Change constructor of classes that depended on VulkanContext
 - Move timer query logic from VulkanDriver to VulkanTimerQuery
   and VulkanTimestamps
2023-05-18 13:27:55 -07:00
Mathias Agopian
a71baef5d3 improve internal documentation of per-view sampler interface blocks 2023-05-18 11:45:12 -07:00
Powei Feng
e63ec23922 vulkan: fix depth+stencil image aspect (#6813)
- Need to be specific about image aspect
Also:
 - Add missing layout for debug print in VulkanImageUtility
2023-05-18 10:59:34 -07:00
Mathias Agopian
da17b6f867 New RenderableManager API to opt-out of fog
Fog can now be opted-out on a per renderable basis. When fog is disabled
on a renderable it removes the requirement that this renderable's 
materials have the FOG variant.
2023-05-17 15:58:56 -07:00
Romain Guy
002becdc4f Don't use large runners yet (#6814) 2023-05-17 13:46:55 -07:00
Romain Guy
2ade1778b1 Don't rely on Java8 to invoke sdkmanager (#6809) 2023-05-16 13:01:56 -07:00
Mathias Agopian
f6c8ce1fd1 New API to apply a transform to the large-scale fog.
This works by making the fog an entity which can be used to create
a TransformManager component an participate to the transform hierarchy.

This feature can be used as more advanced way to set the fog's floor,
which now can have an orientation (essentially be a plane).
This is useful for coordinate systems that are not y-up.
2023-05-16 12:42:59 -07:00
Mathias Agopian
8aa1435fbd fogHeight is not needed in the shader 2023-05-16 12:42:59 -07:00
Benjamin Doherty
a3d25cd22b Bump version to 1.37.0 2023-05-15 16:57:27 -07:00
Benjamin Doherty
56bf841bac Merge branch 'rc/1.36.0' into release 2023-05-15 16:55:48 -07:00
Benjamin Doherty
3e29b6e443 Release Filament 1.36.0 2023-05-15 16:55:11 -07:00
Ben Doherty
dfdf0db794 Fix incorrect target passed to glBindFramebuffer (#6807) 2023-05-15 15:28:44 -07:00
Ben Doherty
1a138aea1a Fix incorrect target passed to glBindFramebuffer (#6807) 2023-05-15 15:27:54 -07:00
Mathias Agopian
d40712937d Fog should be calculated in the user's world coordinates
Fixes #6798
2023-05-12 17:40:25 -07:00
Mathias Agopian
cfe1abec08 fog color from ibl should work with unlit
the skybox is unlit for instance, but for should still get the color
from the ibl. that can't work with ES2 though.
2023-05-12 17:40:06 -07:00
Mathias Agopian
719ed28d7e API to asynchronously force material compilation
Material::compile() can be used to asynchronously ask the backend to
compile a subset of the variants of a Material and be notified when
done. This can be used during initialization to avoid hiccups later.
This will also force caching of those material programs if the 
Platform provides the blob cache API.
2023-05-12 10:46:30 -07:00
Mathias Agopian
aa1773d633 cache programs in gl backend 2023-05-12 10:46:30 -07:00
Mathias Agopian
9b8b882818 Blob cache API in Platform
This is compatible with EGL_blob_cache.
2023-05-12 10:46:30 -07:00
Mathias Agopian
17664d294e A new Builder-based API to create a filament Engine
This doesn't add or remove functionality, but merely changes the API
to create an Engine, to be more consistant with how we construct other
objects in filament.

You can now use Engine::Builder to construct an Engine.
2023-05-12 10:46:30 -07:00
Ben Doherty
2ae4ee85e0 Fix IndexError in zbloat tool (#6802) 2023-05-11 11:43:33 -07:00
Powei Feng
70bb08a93a vulkan: refactor VulkanPlatform implementations (#6797)
Fold all the platform code into a single concrete implementation
named PlatformVulkan.
2023-05-10 12:49:08 -07:00
Mathias Agopian
88f6360321 update remote ui and web samples 2023-05-10 10:19:49 -07:00
Ben Doherty
f7538342df Use a single material for separable gaussian blur (#6791) 2023-05-09 16:50:31 -04:00
Mathias Agopian
8e6d5d11b6 deleteVertexArrays only destroyed the first VAO
fixes #6794
2023-05-09 11:50:23 -07:00
Benjamin Doherty
bf6bd4eca8 Fix Android CI release build 2023-05-09 13:22:47 -04:00
Benjamin Doherty
ac74f09dc8 Fix Android CI release build 2023-05-09 13:22:29 -04:00
Benjamin Doherty
36c69dda9c Fix Android CI release build 2023-05-09 13:22:20 -04:00
Benjamin Doherty
f14fdc11f5 Bump MATERIAL_VERSION to 36 2023-05-08 18:07:13 -04:00
Benjamin Doherty
0157487b1f Bump version to 1.36.0 2023-05-08 18:06:59 -04:00
Benjamin Doherty
1716c856c3 Merge branch 'rc/1.35.0' into release 2023-05-08 18:05:07 -04:00
Benjamin Doherty
f47265e9c5 Release Filament 1.35.0 2023-05-08 18:04:40 -04:00
dingyi.chen
9243887a3a Fix Sampler External texture build 2023-05-05 16:55:42 -07:00
Mathias Agopian
4efac2c0fa iOS: make sure to save/restore the framebuffer binding
this is needed because filament does state tracking.
2023-05-04 14:42:15 -07:00
Mathias Agopian
f3e1d5592a Extend OpenGLPlatform to support preserving attachments on commit
By default ancillary buffers are discarded on commit (eg. depth buffer),
but in certain situations the platform may want to preserve them. this
new virtual allows a concrete implementation to specify which buffers
need to be preserved.
2023-05-04 14:29:41 -07:00
Mathias Agopian
c67d9ce09b ES2: add support for devices without VAOs 2023-05-03 10:40:29 -07:00
Mathias Agopian
27ee90a56d fix windows build 2023-05-03 00:11:06 -07:00
Mathias Agopian
41ccbdbf17 ES2 support: support picking properly
Note that in ES2 mode, the depth value returned by the picking API
only has 8-bits precision and incurs a bigger performance penalty,
because glReadPixels is synchronous.
2023-05-02 21:23:47 -07:00
Mathias Agopian
17fc3c23ed ES2 support: rec709 out colorspace emulation for ES2
This is only the 2nd step where we implement the
emulation logic and set the appropriate spec-constant and
uniform.
2023-05-02 21:23:47 -07:00
Mathias Agopian
fdb0798f28 ES2 support: rec709 out colorspace emulation for ES2
This is only the first step where we:
- clean-up some code to prepare for 2nd step
- add support for the linear->srgb in the shaders

The linear->srgb conversion is protected by a
specification constant and will be enabled only
if the corresponding EGL extension in not present.

Then, if enabled, the actual conversion is
controlled by a uniform so that it can be
selectively enabled on swapchains that have it
turned on.

In this change, the emulation logic that sets
these gates is not implemented (that's step 2).
2023-05-02 21:23:47 -07:00
Mathias Agopian
b4d842c342 ES2 support: filament and filamat changes
This CL contains two parts:
- changes to matc/filamat
- changes to filament itself

Filamat can now generate ES2 compatible shaders. Only the unlit variant
is supported. Fog and picking are supported as well.
post-processing, skinning, instancing, all lighting and shadowing are not supported.

Filament is updated to not issue commands that are not supported in ES2.

Addtionnally, the hello-triangle sample is updated to work on an ES2 device.
2023-05-02 21:23:47 -07:00
Mathias Agopian
7cddd832aa ES2 support: backend API to specify attributes of a Program
In ES2 attributes must be bound by name, so we need to pass that
information to the backend.

This is needed only for ES2 (feature level 0)
2023-05-02 21:23:47 -07:00
Mathias Agopian
6a10753267 ES2 support: add support for emulated UBOs in the backend
From the backend's point of view, UBOs are emulated with uniforms.
The backend will maintain a data structure that maps an offset into
the UBO to a uniform and will do the appropriate glUniform* calls
at the right time and if needed (e.g. only if the UBO content has
changed).

The mapping from an UBO content to uniforms is passed to Program
upon creation.
2023-05-02 21:23:47 -07:00
Mathias Agopian
38dba5394e ES2 support: basic support in backend
This first round is mostly about making the backend compile with the
ES2 header only and use the ES2 code path when running on an ES2
context. We also add feature level 0, which corresponds to ES2
devices.

We introduce the macro FILAMENT_SILENCE_NOT_SUPPORTED_BY_ES2, which is
exclusively used to compile-out code that cannot compile with ES2
headers. This macro is active when ES2 headers are used.

There is also a new `OpenGLContext::isES2()` method that is returns
whether we're running an ES2 context, either statically (desktop, ios)
or dynamically (mobile).

This PR should add or remove any functionality.
2023-05-02 21:23:47 -07:00
Powei Feng
108cdd4242 vulkan: Fix Adreno crash for debug build (#6752)
- Remove `const` from `const highp mat4` just for mobile+vulkan

Fixes #5294
2023-05-02 13:00:38 -07:00
Powei Feng
228aa6c631 vulkan: fix surface format (#6783) 2023-05-02 12:28:48 -07:00
Powei Feng
8936b3aa66 opengl: fix web readPixels (#6781) 2023-05-02 10:56:05 -07:00
Benjamin Doherty
31521c70c2 Fix Android CI release build 2023-05-01 18:45:34 -04:00
Ben Doherty
6558448eae Add support for supplying instance local transforms (#6762)
Clients can now supply a local transform for each GPU instance.
2023-05-01 18:00:27 -04:00
Romain Guy
88be599c2e Use width instead of heigh 2023-05-01 13:53:25 -07:00
Benjamin Doherty
cf1bbf63fc Bump MATERIAL_VERSION to 35 2023-05-01 13:39:45 -04:00
Benjamin Doherty
8cac90d81e Bump MATERIAL_VERSION to 35 2023-05-01 13:37:24 -04:00
Benjamin Doherty
388b4f5efb Bump version to 1.35.0 2023-05-01 13:36:40 -04:00
Benjamin Doherty
f9b5a7f301 Merge branch 'rc/1.34.0' into release 2023-05-01 13:35:16 -04:00
Benjamin Doherty
4e888d142b Release Filament 1.34.0 2023-05-01 13:34:52 -04:00
Benjamin Doherty
00c78cc225 Bump MATERIAL_VERSION to 34 2023-05-01 12:20:50 -04:00
Powei Feng
2bdb8b560c vulkan: fix RenderPass size (#6775) (#6776) 2023-04-27 14:09:46 -07:00
Mathias Agopian
a5e6d9ef3d cleanup PlatformEGL a bit. (#6769)
- add a helper Config class to more easily manage EGL's attribute
  pairs.

- consolidate config selection code
2023-04-27 11:39:09 -07:00
Powei Feng
5e58af466c vulkan: fix RenderPass size (#6775) 2023-04-27 10:09:23 -07:00
Mathias Agopian
899c15f023 very basic API for materials to have global variables (#6764)
A material global is a variable seen by all materials. There are 4 such 
variable which are all vec4 and they can be set on a per-view basis.

All materials used during Renderer::render() will see the same value.

These variable can be accessed in the materials by using 
getMaterialGloabal{0|1|2|3}.
2023-04-25 17:20:43 -07:00
Powei Feng
861da7b5c9 Change mac/linux runners to more cores (#6768) 2023-04-25 15:12:49 -07:00
Benjamin Doherty
a974fddd4c Bump version to 1.34.0 2023-04-25 13:10:24 -04:00
Benjamin Doherty
83a3e243da Merge branch 'rc/1.33.0' into release 2023-04-25 13:09:13 -04:00
Benjamin Doherty
b62cf698a5 Release Filament 1.33.0 2023-04-25 13:08:56 -04:00
Powei Feng
b928e5c4dc vulkan: Fix Adreno issue with optimized material (#6757)
* vulkan: Fix Adreno issue with optimized material

Turning off the simplification pass seems to remove all of the
artifacts associated with Adreno GPUs.
2023-04-24 15:11:29 -07:00
Powei Feng
b748ea7239 Fix no-opt build option for materials (#6756)
- `-g` option was missing from `build.sh`
- `-Pcom.google.android.filament.matnopt` should be passed to
   the sample apps as well.
- Add logic to respect `-Pcom.google.android.filament.matnopt`
   in `FilamentPlugin.groovy`
2023-04-24 13:05:23 -07:00
Romain Guy
bd9ba1139e Update Kotlin math APIs (#6761)
Fixes bugs and adds new useful APIs.
2023-04-24 05:17:09 -07:00
Romain Guy
5ed25aa327 Apply post-lighting blending before the fog (#6755)
* Apply post-lighting blending before the fog

* Update release notes
2023-04-21 16:51:38 -07:00
Romain Guy
7f51f21512 Fix Android samples 2023-04-21 15:53:59 -07:00
Mathias Agopian
c24cc726e8 Fix Android samples so they handle surface resizes properly 2023-04-21 15:36:02 -07:00
Romain Guy
7b90a8f921 Set the Kotlin JDK version to match AGP's 2023-04-20 23:17:25 -07:00
Romain Guy
9fb96cd200 Upgrade to AGP/Gradle 8.0.0, and other dependency upgrades (#6753)
This upgrade lets us remove several hacks we needed to properly publish
our artifacts on Maven.
2023-04-20 18:02:23 -07:00
Mathias Agopian
f881b59d60 fog: disable fog color from IBL when unlit
When unlit, the IBL specular map is not defined.
2023-04-20 12:45:29 -07:00
Mathias Agopian
ebb07520c0 change picking to use floats (#6747)
floats can have up to 16.7M unique integers which is enough for encoding
an Entity. 
This change will help a later one that adds support for ES2
2023-04-19 13:53:45 -07:00
Benjamin Doherty
f286e308bf Bump version to 1.33.0 2023-04-19 14:11:43 -04:00
Benjamin Doherty
29af3be2e3 Merge branch 'rc/1.32.4' into release 2023-04-19 14:10:10 -04:00
Benjamin Doherty
29d5ae621a Release Filament 1.32.4 2023-04-19 14:09:32 -04:00
Mathias Agopian
6e275514ad matc: attributes are no longer hardcoded in a file
They're not hardcoded in a database inside MaterialBuilder and are
generated. This will be needed later for ES2 support.

We could actually imagine something more dynamic in the future too.
2023-04-18 15:09:43 -07:00
Benjamin Doherty
08503943f4 Update web docs 2023-04-17 13:29:47 -04:00
Elie Michel
0c547748bf Small typos in Design doc (#6740) 2023-04-17 10:23:16 -07:00
Mathias Agopian
6623dcbebf fix specification constant injection in glsl
- boolean where handled as int
- always cast float to float()
2023-04-17 10:29:02 -04:00
Powei Feng
89dc43f361 vulkan: fix spec constant bool size 2023-04-17 10:28:44 -04:00
Ben Doherty
b77aac43ea Fix float spec constant formatting (#6731) 2023-04-17 10:28:24 -04:00
Benjamin Doherty
0d63fa02ee Fix build when exceptions disabled 2023-04-17 10:28:00 -04:00
Powei Feng
19ab9f0403 vulkan: refactor image layout transition (#6729)
- Moved most of the layout transition logic into VulkanImageUtil
   so that we'd have a single place to consider if failure arises
 - Add an abstraction on top of vk's layouts so that reasoning
   about our use cases (and corresponding layout is easier).
 - Removed the redundant VulkanDepthLayout
 - Refactor VulkanTexture::transitionLayout so that most of the
   transition paths can be done through this entry point. It also
   enables us to handle tracking the current layout.
 - Add a special case to transition the depth attachment/texture
   if it is both a sampler and an attachment.
 - Add a few debug printing markers across the classe - guarded
   under the existing FILAMENT_VULKAN_VERBOSE define.
2023-04-12 15:49:37 -07:00
Mathias Agopian
c895554a22 don't write floats with a trailing f
this is not supported in ES2
2023-04-12 10:12:19 -07:00
Mathias Agopian
968c2c40fa Cleanup shader generation
- refactor the code so that all defines are generated in the same place
- generate common_type after all defines are generated
- protect (with defines) structures and UBOs that are not needed, based
  on the variant
2023-04-12 10:12:19 -07:00
Mathias Agopian
de845d2885 make CodeGenParam a parameter of semantic analysis 2023-04-12 10:12:19 -07:00
Mathias Agopian
0e1f57d712 simplify code that resolves precision qualifiers
Some logic specific to uniform was pushed too low in the method 
resolving a precision to a string.
2023-04-12 10:12:19 -07:00
Mathias Agopian
6b3dfbc635 reduce our reliance on unsigned types
This is to facilitate ES2 support, in all places where unsigned types
were not strictly needed, we now use the corresponding signed type.
2023-04-12 10:12:19 -07:00
Mathias Agopian
5e2b4dec99 fix specification constant injection in glsl
- boolean where handled as int
- always cast float to float()
2023-04-11 15:56:06 -07:00
Powei Feng
0cd4a143ab vulkan: fix spec constant bool size 2023-04-11 15:55:37 -07:00
Ben Doherty
c7ad9acc79 Fix float spec constant formatting (#6731) 2023-04-11 15:55:04 -07:00
Benjamin Doherty
afeaf90d0d Fix build when exceptions disabled 2023-04-11 15:36:24 -07:00
Benjamin Doherty
e187bc442d Bump version to 1.32.4 2023-04-11 11:19:53 -07:00
Benjamin Doherty
d62268fbfb Merge branch 'rc/1.32.3' into release 2023-04-11 11:17:47 -07:00
Benjamin Doherty
3603aaafa6 Release Filament 1.32.3 2023-04-11 11:17:21 -07:00
Ben Doherty
6cab8d2cd4 Expose specialization constants to materials as constant parameters (#6652) 2023-04-11 11:09:53 -07:00
Ben Doherty
ca2f3d76e6 Metal: work around iPad pipeline error (#6724) 2023-04-10 16:45:38 -07:00
daemyung jang(danny.jang)
a2beaf0582 Support the external image on macOS (#6689)
* Support the external image on macOS

Implement CocoaExternalImage.

* Fix to take an onwership of the external image

* Correct incorrect comments

* Rename a function explicitly

Make a function name to know copying RECTANGLE to TEXTURE2D.

* Do lazy initialization

Create CocoaExternalImage::SharedGl when it's needed.

* Fix a crash when engine is terminated

Destroy the external image shared gl before gl context is destroyed.

* Remove an useless variable
2023-04-10 09:38:26 -07:00
Romain Guy
4a116e6791 Improve size optimizations when compiling material (#6721)
* Improve size optimizations when compiling material

This changes the behavior of the size optimizer in matc (-S), but
only for GLSL and MSL. With this change we gain a ~65% size reduction
on a lit material compiled for OpenGL. To get those gains we generate
extra SPIRV debug information to preserve variable names and better
utilize the line dictionary. Unfortunately this break the SPIRV
optimizer so we skip it and instead rely on a simple DCE pass provided
by glslang. We also enhance the whitespace removal pass of the GLSL
minifier to move lone { and } to the previous line, which avoids
generating an extra index in each shader variant. Each index being
at least as big as the character itself, this is quite wasteful.

When generating SPIRV for Vulkan, we rely on spirv-opt for size
optimizations as before.
2023-04-07 09:34:43 -07:00
Mathias Agopian
040fc64583 Improve how we cache shared shaders
Some shaders can be shared across all materials (e.g. the depth 
shaders). We use the filament default material as the "source" of
the cache, but until now we relied on an a priori knowledge of which
variants were present in the default material.

With this change, we now query once the list of variants (of interest)
in the default material and reuse that list for caching these variants
later.

This is better because the cached variants are now entirely driven by
the default material (which they depend on anyways). This is also faster
because we don't need to query which variant we need each time we create
a material.
2023-04-07 09:33:26 -07:00
Mathias Agopian
e19011d0e0 use the enum instead of ints everywhere for ShaderModel and ShaderStage 2023-04-07 09:33:26 -07:00
Mathias Agopian
8d3b395e86 ProgramBuilder is a relic, rename to Program 2023-04-07 09:33:26 -07:00
Mathias Agopian
2d1d8a6eec add a few asserts 2023-04-07 09:33:06 -07:00
Powei Feng
498a355fb2 vulkan: Fix validation errors (#6717)
- Depth attachment layout has generated a lot of error due to
   it being read-only. But the store-ops for the attachment during
   the renderpass are all write ops. We set the depth attachment
   layout as VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
 - Enable extra blitting step for SSAO because of the above layout
   conundrum.
 - Index buffers did not have a pipeline barriers after loading
   them.
 - Remove `assert_invariant(utils::popcount(sampleCount) == 1);`
   from `reduceSampleCount`. This assert fails when enabling the
   duplicate pass for SSAO.
2023-04-06 17:32:27 -07:00
Powei Feng
944031af14 vulkan: add missing index buffer barrier (#6718) 2023-04-06 15:09:10 -07:00
Mathias Agopian
ee9d427526 hellotriangle can now choose the backend 2023-04-05 16:22:46 -07:00
Benjamin Doherty
3b73e3de60 Bump version to 1.32.3 2023-04-05 12:56:23 -07:00
Benjamin Doherty
7685736d6c Merge branch 'rc/1.32.2' into release 2023-04-05 12:55:12 -07:00
Benjamin Doherty
9b98ae66ce Release Filament 1.32.2 2023-04-05 12:54:40 -07:00
Benjamin Doherty
b8a3a7f221 Bump version to 1.32.2 2023-04-05 12:53:18 -07:00
Mathias Agopian
126ba44719 expose getShadowCascade() only when shadowing and lighting is enabled 2023-04-04 21:31:23 -07:00
Mathias Agopian
503e3ba555 honor matc -t (print shader) options, even when compilation fails early 2023-04-04 21:30:49 -07:00
Mathias Agopian
c264d26edd filter out VSM variant for unlit materials DEPTH shaders
The VSM variant is never needed for unlit materials, it was filtered
out correctly for color shaders but not for the depth shaders.
This removes 4 variants from all unlit materials.

Also improve matinfo variants output.
2023-04-04 16:52:04 -07:00
Romain Guy
185c68c55b Suppress numerous libz warnings (#6709)
* Suppress numerous libz warnings

zlib will fix this issue later (see https://github.com/madler/zlib/issues/633).
For now we will just turn off the warning.

* Fix Windows build
2023-04-04 11:15:39 -07:00
Romain Guy
4624b0d1a1 Update libz and libpng to fix compilation warnings (#6708) 2023-04-04 10:07:18 -07:00
Romain Guy
5fe0a50c99 Update spirv-cross to fix build failures with recent versions of clang (#6707) 2023-04-04 10:06:57 -07:00
Mathias Agopian
a484fe1de3 rename ChunkcContainer::addChild/addSimpleChild to push/emplace (#6704)
'child' didn't make any sense in this API, push/emplace mimics
std::vector, which is closer to what the api actually does.
2023-04-03 14:06:42 -07:00
Mathias Agopian
e48690bdf9 matc: new feature-level options
The feature-level option sets the maximum feature level allowed for
the material. matc will fail if the specified material has a higher
feature level than the value set with the feature-level option. The
default is 3 (max).

This can be used to ensure that materials don't use features above
a specified level.
2023-04-03 14:05:38 -07:00
Mathias Agopian
bc40ff7f19 fix typos in documentation
Fixes #6294
2023-03-31 15:27:50 -07:00
Mathias Agopian
30979124b5 skinning now works when the model is far from the origin
We are doing skinning computations effectively in world space, so
some of the math must be done in high-precision.
2023-03-31 14:47:54 -07:00
Mathias Agopian
6eb4c5e356 gltf_viewer: debug option to move the origin far away 2023-03-31 14:47:54 -07:00
Ben Doherty
38ede3719f TangentSpaceMesh fixes (#6697) 2023-03-31 12:03:49 -07:00
Mathias Agopian
4503ad1e34 fix -ffast-math and -fno-finite-math-only
- remove -ffast-math in place where it didn't seem too useful
- added -fno-finite-math-only everywhere we use -ffast-math so that
  isinf/isnan work.
2023-03-30 16:15:42 -07:00
Romain Guy
9fc6b0d654 Update LICENSE (#6691) 2023-03-28 17:27:31 -07:00
Romain Guy
d00223332e Update README.md 2023-03-28 15:22:20 -07:00
Mathias Agopian
d3013ae151 better selection of opengl context version on desktop
fixes #6682
2023-03-28 11:59:05 -07:00
Mathias Agopian
b2fc46c320 start froxelization earlier 2023-03-28 10:46:11 -07:00
Romain Guy
53aac259a0 Fix emscripten compilation errors and warnings (#6688)
These errors and warnings only appear with more recent versions of
the emscripten SDK.
2023-03-27 17:33:45 -07:00
Powei Feng
af35b87d5b vulkan: prefer discrete GPU over integrated (#6677) 2023-03-27 08:09:16 -07:00
Mathias Agopian
0171452b02 fix stream unit-test 2023-03-24 17:30:00 -07:00
alexfh
065a33c846 Add a missing #include <exception>
... which is needed to avoid compilation error with recent LLVM libc++ (after https://reviews.llvm.org/D146097). Previously, symbols like std::terminate() were available through other headers (e.g. <functional>, <vector>, etc.).
2023-03-24 17:21:28 -07:00
Mathias Agopian
90601b9471 update remote ui 2023-03-24 17:19:35 -07:00
Romain Guy
327f630ed7 Update web demos 2023-03-24 09:38:42 -07:00
Mathias Agopian
96acc6900d gltf_viewer now respects FILAMENT_DISABLE_MATOPT
debug builds are unchanged, release builds will now optimize shaders and
either build can be overridden with OPTIMIZE_MATERIALS.
2023-03-24 09:23:10 -07:00
Mathias Agopian
91cc36f1ec fix IDE warnings
mostly const decorators.
2023-03-24 09:22:53 -07:00
Mathias Agopian
575e54e5d6 convert floats to their smallest string representation 2023-03-23 15:23:18 -07:00
Mathias Agopian
9a2fd38f33 update libutils to output floats/double without loss 2023-03-23 15:23:18 -07:00
Mathias Agopian
7cba0da0a2 implement cascades visualization as a post-process
this allows us to remove code from the main shaders that is basically
never used, reducing shader size and runtime costs.
2023-03-23 12:11:56 -07:00
Mathias Agopian
d8eb48c9de Improvements to fog
- FogOption::color is now correctly multiplied by the exposure and
  environment intensity.
- New option to exclude the skybox from the fog
- better documentation and naming
2023-03-23 09:31:01 -07:00
Mathias Agopian
3ccd592eab fix manual instancing
only use the instanced UBO with automatic instancing.

Fixes #6579
2023-03-23 09:30:36 -07:00
Benjamin Doherty
732628acf5 Merge branch 'rc/1.32.1' into release 2023-03-21 15:48:49 -07:00
Benjamin Doherty
a157546d82 Release Filament 1.32.1 2023-03-21 15:47:47 -07:00
Mathias Agopian
3ec704b91c fix world-space coords of DEVICE vertex domain at infinity
In device vertex domain it is easy to specify infinite world-space
coordinated (e.g. with the skybox), this results in complications
everywhere. We were mitigating this by essentially moving these
coordinates to around 16000 (give or take depending on the near plane),
but that was way too small.
Now we move them around 1e19, which seems to work. It's important with
applications rendering very large scenes to not use too small of a value.
2023-03-21 11:11:17 -07:00
Romain Guy
331af7bf35 Add sun size and halo properties to glTF viewer controls. (#6655)
This change also simplifies libviewer by removing duplicated code.
2023-03-21 10:08:20 -07:00
Mathias Agopian
473aff9093 Fix a bug in matdbg where it could reorder the shaders in the package (#6656)
This happened because the code iterated over the keys of a hashmap,
which obviously were not guaranteed to be in the same order as those
entries where added to the hashmap.

We fix this by adding a "visitor" to the materialchunk, so we can
iterate through it in order and retried the info we need.
2023-03-21 10:00:33 -07:00
Powei Feng
6ff08f2ac1 Update filament rendering test (#6654)
- If the callback isn't called, fail.
- Simplify by disabling post-processing.
2023-03-21 09:50:13 -07:00
Romain Guy
3db7f6675e The sun disc should be computed in high quality only. (#6653)
This will provide a boost to mobile devices by not computing the sun
disc as it was intended.
2023-03-20 16:20:46 -07:00
Powei Feng
e501a15ef2 gltfio: Release cancelled, decoded texture resources (#6620)
When we call TextureProvider::cancelDecoding, we should make sure
that textures that have been decoded, but not yet used (popped)
should be released (i.e. memory freed and the meta data marked
appropriately.)
2023-03-20 10:34:24 -07:00
Powei Feng
4e8974bcd9 vulkan: disable xlib when using swiftshader (#6647) 2023-03-17 16:21:03 -07:00
Andi Smithers
7914372707 Update Materials.md.html (#6646)
Fixed typo in the source documentation : getUserTimeMode(float m) which should be getUserTimeMod(float m)
2023-03-17 12:36:39 -07:00
Ben Doherty
3c794247c3 Update web docs (#6645) 2023-03-17 00:34:39 -07:00
Powei Feng
7bd00d2b30 Revert "vulkan: async readPixels (#6605)" (#6644)
This reverts commit 6f25e8ae5a.

Reason for revert: breaks clients that were expecting synchronous readPixels for vulkan
2023-03-16 13:05:48 -07:00
Powei Feng
ae12e3a51c Revert "vulkan: async readPixels (#6605)" (#6644)
This reverts commit 6f25e8ae5a.

Reason for revert: breaks clients that were expecting synchronous readPixels for vulkan
2023-03-16 12:55:19 -07:00
Benjamin Doherty
0759797e61 Include atomic in VulkanCommands.h 2023-03-15 11:15:24 -07:00
Benjamin Doherty
fdc2ab30c0 Include atomic in VulkanCommands.h 2023-03-15 11:15:04 -07:00
mackong
122541eedc web: fix animation stopped premature (#6630) 2023-03-14 10:52:34 -07:00
Benjamin Doherty
fddc5160c7 Bump version to 1.32.1 2023-03-14 10:48:50 -07:00
Benjamin Doherty
2a579c460f Merge branch 'rc/1.32.0' into release 2023-03-14 10:46:27 -07:00
Benjamin Doherty
7e54bc8bcd Release Filament 1.32.0 2023-03-14 10:46:08 -07:00
Ben Doherty
e1ebe97eb5 Vulkan: fix stack use-after-free (#6639) 2023-03-14 10:25:01 -07:00
Ben Doherty
efdc801cff Vulkan: fix stack use-after-free (#6639) 2023-03-14 10:24:18 -07:00
Powei Feng
9fed30af55 gltf-viewer: update API/backend usage description (#6638) 2023-03-13 23:22:30 -07:00
mackong
4fd02d7e75 gltfio: fix crash when custom attributes used 2023-03-13 15:16:36 -07:00
Daniel Rahme
e30a99f692 Fix wrong package name 2023-03-13 15:14:46 -07:00
mackong
b891c52d9b web: fix getWorldTransform typo 2023-03-13 15:14:21 -07:00
Benjamin Doherty
74eb8a77e5 Bump MATERIAL_VERSION to 32 2023-03-13 14:04:40 -07:00
Benjamin Doherty
dd654c575a Bump MATERIAL_VERSION to 32 2023-03-13 14:04:13 -07:00
Mathias Agopian
ba59d6d1b7 update webgl samples and remote ui 2023-03-09 15:11:29 -08:00
Ben Doherty
46efeb7fa8 Fix RELEASE_GUIDE numbering 2023-03-09 10:50:06 -08:00
Ben Doherty
673c1104b2 Update RELEASE_GUIDE
Reflect the NEW_RELEASE_NOTES process
2023-03-09 10:48:06 -08:00
Benjamin Doherty
0c2599b6ca Bump version to 1.32.0 2023-03-09 10:40:39 -08:00
Benjamin Doherty
979d6742e0 Merge branch 'rc/1.31.7' into release 2023-03-09 10:39:41 -08:00
Benjamin Doherty
7cca872af5 Release Filament 1.31.7 2023-03-09 10:39:17 -08:00
Mathias Agopian
3cef1991b2 Minor cleanup of GL backend 2023-03-08 12:49:22 -08:00
Mathias Agopian
4a7a033d04 Fix timer query breakage on webgl 2023-03-08 12:33:11 -08:00
Mathias Agopian
64493d8636 Fix timer query breakage on webgl 2023-03-08 12:06:59 -08:00
Powei Feng
df78322bdc android: fix sample-material-builder app name (#6624)
fixes #6622
2023-03-08 11:11:56 -08:00
Ben Doherty
5c2bbcb4a1 Remove compute shader assertion in GLProgram 2023-03-08 10:56:24 -08:00
Ben Doherty
f1a967d631 Update web docs and include ktx2 assets (#6616) 2023-03-08 10:55:13 -08:00
Ben Doherty
ec48dfa453 Remove compute shader assertion in GLProgram 2023-03-07 23:31:33 -08:00
Deadlock Yoon
5881a13b20 Metal: fix memory leak in readPixels
The PixelBufferDescriptor was not being deallocated properly, which
resulted in the leak. This patch explicitly deletes the
PixelBufferDescriptor at the end of the callback to prevent the leak
.This is necessary as the move constructor does not automatically
deallocate the existing PixelBufferDescriptor.
2023-03-07 11:02:39 -08:00
Mathias Agopian
efd9e875db fix a discard flags issue
An attachment would be wrongly discarded if used as read-only: because
it didn't have a dependency to it, the discard flag was set.
This is fixed by setting the discard flag only if a resource is written
and has dependencies to it.

Should fix: #5005
2023-03-06 22:39:11 -08:00
Powei Feng
6f25e8ae5a vulkan: async readPixels (#6605)
- Add a TaskHandler class for process events on the backend
   thread
 - Check fence status when handler runs and copy bits to the client
   when the fence is reached.
2023-03-06 18:03:28 -08:00
Mathias Agopian
449519c1b4 cleanup fog
- update comments and some names
2023-03-06 16:28:31 -08:00
Mathias Agopian
e2e5f7cee9 Add way to retrieve the user world-space in materials (#6607)
* Add way to retrieve the user world-space in materials

added `getUserWorldFromWorldMatrix()` and `getUserWorldPosition()` to
retrieve the API-level (user) world position in materials.
Deprecated `getWorldOffset()`

`getWorldOffset` didn't work when an IBL rotation was applied.

* fix large scenes with an ibl rotation

Rotate the IBL around the camera instead of the world so that the camera 
is always at the origin regardless of the rotation.
2023-03-03 21:34:17 -08:00
Powei Feng
9d30233a38 geometry: clean up TangentSpaceMesh (#6595)
- Reordered the 'const var' declarations to 'var const'
 - Use std::vector for data arrays instead of manually managing
   allocations
2023-03-03 15:33:28 -08:00
Ben Doherty
d684fc4096 Compute shading_view will full precision (#6611) 2023-03-03 13:48:36 -08:00
Ben Doherty
5f3f3f1b24 Fix NaN parameters in material_sandbox (#6609) 2023-03-03 12:13:06 -08:00
Romain Guy
6aa2a2b89b Update getopt to musl-1.1's implementation (#6610)
* Update getopt to musl-1.1's implementation

Our former implementation was rather ancient and was using unsupported
features of C.

* Fix Windows
2023-03-03 11:56:32 -08:00
Powei Feng
47135164ee vulkan: fix validation BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear (#6608) 2023-03-03 11:14:05 -08:00
Romain Guy
5a75fb9b53 Add new alphaToCoverage material property (#6606)
* Add new alphaToCoverage material property

The alphaToCoverage property lets you enable or disable alpha to coverage
in a material. More importantly it lets you overrides the behavior of
blending: masked which automatically enables alphaToCoverage.

* Update release notes
2023-03-02 12:40:55 -08:00
Mathias Agopian
7933b08e85 fix fog instability with strong falloff
The fog calculation could fail when the falloff was strong and the
camera z position was far from the fog height. The problem was
that the computation was spread between the cpu and gpu by splitting
an exp(), but with certain parameters the two exp() would independently
blow-up.  We fix this by doing the exp() only on the gpu side.
2023-03-01 16:48:16 -08:00
Mathias Agopian
a6809b4550 Fix fog's z origin
the fog's z origin was always the camera height instead of being the
ground (or more precisely the value of fogHeight).
2023-03-01 16:48:16 -08:00
Mathias Agopian
8f77308bca fix fog integral computation
1-a/b not the same as (1-a)/b !
2023-03-01 16:48:16 -08:00
Mathias Agopian
65f1e64812 fix fog heigh falloff computation
it was especially wrong when near or at 0.
2023-03-01 16:48:16 -08:00
Mathias Agopian
79942b3bea fog parameters should be calculated in highp 2023-03-01 16:48:16 -08:00
Mathias Agopian
9ee41b9b6a rework again how we manage different versions of GL
try to be more explicit about which configurations are supported,
and use the same pattern everywhere for checking the gl version at
either compile and runtime.
2023-03-01 15:59:04 -08:00
Mathias Agopian
21995e4ac9 clip_control could fail on desktop
This didn't happen in practice, but we would call (null) if the
clip_control extension was available and we were not on GL 4.1.

We "fix" this by not supporting the clip_control extension on desktop.
It doesn't matter because clip_control is core as of 4.5 and is 
present in only 8% of non 4.5 GL implementation, and this doesn't
include any macOS versions.
2023-03-01 15:59:04 -08:00
Mathias Agopian
8dc871c86e remove code for unused extensions 2023-03-01 15:59:04 -08:00
Benjamin Doherty
dec903a0ee Bump version to 1.31.7 2023-03-01 11:26:50 -08:00
Benjamin Doherty
e9475b322b Merge branch 'rc/1.31.6' into release 2023-03-01 11:24:13 -08:00
Benjamin Doherty
78785a5bca Release Filament 1.31.6 2023-03-01 11:23:37 -08:00
Mathias Agopian
662b4b5ca3 fix typo that could cause a OOB
fortunately this would only happen when using SSBOs (which are not
used currently).
2023-02-27 13:06:25 -08:00
Mathias Agopian
bee96d1cf1 abstract OpenGL's GLSync
This small abstraction is (will be) needed because GLES 2.0 doesn't
have sync object, however synchronization is sometimes available
externally, in particular with EGL.

This PR doesn't provide other implementations.
2023-02-27 12:40:21 -08:00
Mathias Agopian
122ebe1ccb More improvements to how we handle extensions (#6591)
- make sure to initialize all extension booleans, we treat them
  as feature flags.
- be more explicit about #define'ing gl tokens, so we can more easily
  catch errors later.
- don't blindly use extension tokens that might not be available
  (e.g.: GL_TEXTURE_EXTERNAL_OES or GL_TEXTURE_CUBE_MAP_ARRAY). It
  would probably cause a spurious gl error.
2023-02-24 16:52:43 -08:00
Mathias Agopian
e741e165ae remove unused / no longer used code 2023-02-24 16:50:15 -08:00
Mathias Agopian
d38dc24915 Cleanup how we get GL extensions entry-points
- iOS is treated the same way than Android now. The only difference
  is that iOS only provides prototypes and no typedef, whereas 
  Android only provides typedefs and no prototypes.

- Timer queries is core in GL and an extension on all versions of
  GLES. On iOS it's not available at the header level. An additional
  subtlety is that glGetObjectuiv is core in GLES 3.0, so it conflicts
  with the extension.
  So, now we do things correctly:
  - on desktop we use the core methods
  - on ios we ifdef out everything related to timer queries
  - on gles 2.0 and up we use only the extension entry-points
2023-02-24 11:55:22 -08:00
Powei Feng
d12612f091 Add UV-based tangent space algorithms (#6572)
Added mikktspace as a third party lib
2023-02-24 09:32:02 -08:00
Mathias Agopian
e6d73135c1 fix DEPTH_STENCIL case for fbo attachments
We were not testing for that case properly. This case is taken when 
either:
- depth & stencil textures are the same and not null
- or, only depth is specified but both attachments are requested


Also cleanup the dimension checks in debug builds.
2023-02-23 14:47:17 -08:00
Mathias Agopian
816612cf0a Fix readPixels() for "auto-resolved" MS color buffers
glReadPixel doesn't resolve automatically, but it does with the 
auto-resolve extension, which we're always emulating.
2023-02-23 10:56:08 -08:00
Mathias Agopian
7ca8ba272c don't rely on GL PACK/UNPACK convenience
- some of the convenience are not available in ES2
- it's less efficient
- we can save some PBO space when reading back
  a partial framebuffer.

We also avoid using GL_PACK_ROW_LENGTH which technically is not
a convenience, but in our case we are doing an extra copy anyways, so
we can account for the row-length at that point.
2023-02-23 10:55:46 -08:00
Mathias Agopian
d337a6d019 Scene::prepare is now multithreaded 2023-02-22 16:28:40 -08:00
Mathias Agopian
f79c4c6080 Improve directional shadow performance with large scenes
- We now call visitScene only once for the directional shadowmap instead of
1 + cascade_count times.

- Don't use visitScene for spot shadows

it was only used to compute the near/far planes, but instead we can
use the radius of the light. This could degrade the quality of the
spot shadows, but this can be corrected by setting a correct radius.

caveat: currently the near is hardcoded to 0.01 units. this should be
user-settable.

- Improve performance of visitScene calls

instead of transforming 8 points of an AABB and finding the min/max,
we transform the AABB and use its minz and maxz. This works for affine
transforms.

This change also cleans-up AABB and Box transform APIs, which also
are now inline.
2023-02-22 16:28:40 -08:00
Mathias Agopian
2e7fc6229b Improve StructureOfArray
- StructureOfArray: don't initialize trivial ctors

We mimic the behavior of std::vector<> here, where a resize() won't
initialize the array if the type is trivially_default_constructible.
This can reveal existing bugs, where we depended on the initialization
to 0.

- StructureOfArray: add push_back(std::tuple<>)

This basically allows us to push_back() a struct of the SoA.

- Make PerRenderableData trivially constructible

this improves performance when we have tons of objects in the scene
because PerRenderableData is used in arrays.
2023-02-22 16:28:40 -08:00
Mathias Agopian
fc724575fa Make SYSTRACE_CALL work with SYSTRACE_CONTEXT
SYSTRACE_VALUE now requires a SYSTRACE_CONTEXT.
2023-02-22 16:28:40 -08:00
Mathias Agopian
84716610b8 cleanup: make const everything that can be 2023-02-22 16:28:40 -08:00
Benjamin Doherty
d9aead8aac Linux CI: use clang 14 2023-02-21 16:06:48 -08:00
Powei Feng
ce148ebeb1 Update linux clang to version 10 (#6556) 2023-02-21 16:00:07 -08:00
Powei Feng
e1315fbaa7 Update CI Ubuntu version 2023-02-21 15:57:00 -08:00
Benjamin Doherty
1690549392 Bump version to 1.31.6 2023-02-21 13:18:22 -08:00
Benjamin Doherty
c73710e343 Merge branch 'rc/1.31.5' into release 2023-02-21 13:16:47 -08:00
Benjamin Doherty
29983772ed Release Filament 1.31.5 2023-02-21 13:16:09 -08:00
ViktorHeisenberger
d100e628c2 Invoke ccache on Win+ninja. There is no support for ENV vars. (#6582) 2023-02-21 09:19:03 -08:00
Mathias Agopian
94f121f37d Add a camera near/far setting in gltf_viewer 2023-02-17 11:16:42 -08:00
Mathias Agopian
d9266ba61c fix a main camera far plane culling
we need to use the culling projection matrix for culling!
2023-02-16 15:40:32 -08:00
Ben Doherty
8389056d2d gltfio: Fix crash when a MIME type has no texture provider (#6569) 2023-02-16 14:21:26 -08:00
Powei Feng
26b8cb238a Add build.sh flag for ASAN/UBSAN (#6566) 2023-02-16 13:19:32 -08:00
Powei Feng
f8d4690cd8 Update linux-continuous.yml to use ubuntu-22.04 (#6559) 2023-02-14 16:47:02 -08:00
Benjamin Doherty
c2e2f80945 Fix RELEASE_NOTES.md 2023-02-14 14:10:40 -08:00
Powei Feng
e9efcdf191 -Werror for libfilament and backend (#6547) 2023-02-14 01:15:25 -08:00
Mathias Agopian
8ea159520d workaround our -ffast-math
We use isnan() to detect that the estimation of directional light
parameters from the IBL has failed, however isnan() always returns
false with -ffast-math, which we're using in release builds.
This works around that. The affected code is non essential, performance
is not a concern here.
2023-02-13 21:51:43 -08:00
Mathias Agopian
337e18051a The default render channel is now 2 instead of 0
This also fixes some potential issues with refraction when using
render channels.
2023-02-13 17:31:34 -08:00
Ben Doherty
3c4e094990 Rework how release notes work (#6557) 2023-02-13 14:54:07 -08:00
Powei Feng
71e6f3d037 Update linux clang to version 10 (#6556) 2023-02-13 14:49:45 -08:00
Benjamin Doherty
092a0489da Bump version to 1.31.5 2023-02-13 11:53:24 -08:00
Benjamin Doherty
1c6279366f Merge branch 'rc/1.31.4' into release 2023-02-13 11:51:37 -08:00
Benjamin Doherty
d2690bf75a Release Filament 1.31.4 2023-02-13 11:51:06 -08:00
Ben Doherty
44f002a5a1 gltfio: Fix race condition affecting mobile and web (#6548)
When loading a glTF file on platforms without a filesystem, a client
calls `addResourceData` to populate `ResourceLoader`'s cache with data.
For example, a web client might make HTTP fetch requests to fill in
buffer data. This internal cache of data is stored in
`ResourceLoader::Impl::mUriDataCache`.

This works well, except the cache must persist until after it has been
uploaded to the GPU.

There was already a mechanism (see `uploadUserdata`) in place to ensure
that glTF data persisted until after it had been uploaded to the GPU.
However, this mechanism did not extend to client-provided data. Thus, a
race occured between Filament's driver consuming the buffer and it
getting freed.
2023-02-13 10:44:22 -08:00
Powei Feng
f8442c9ec0 vulkan: Remove unused presentQueueFamilyIndex (#6545) 2023-02-10 12:41:00 -08:00
Powei Feng
b3513c7d1f geometry: Add TangentSpaceMesh implementations (#6530)
geometry: Add TangentSpaceMesh implementations

Added:
 - Hughes-Moller
 - Frisvad's method
 - Flat shading
2023-02-10 09:34:49 -08:00
Mathias Agopian
a82e813333 fix libmath streaming operators 2023-02-09 16:11:30 -08:00
Powei Feng
dd246aeee4 vulkan: Assert that graphics-QF is present-QF (#6540) 2023-02-09 13:31:29 -08:00
Ben Doherty
1653d3615b Fix Metal crash due to empty program names (#6537) 2023-02-09 12:11:04 -08:00
Mathias Agopian
4847b00f9e improve SoA a bit
Instead of storing the arrays into an array of void*, we use a 
tuple<> instead. This improves debugging because now the tuple<>
has pointer with the correct types.

It also improves most of the code except `push_back` which now
relies on a hack -- this is the only place where I'm not able to 
resolve the array strictly at compile time, even if in practice it is.
2023-02-08 16:22:00 -08:00
Igor Korobka
d613145c1a Fix JNI after minification is applied
UbershaderProvider.getNativeObject() is accessed from AssetLoader.cpp,
so it must be annotated with @UsedByNative("AssetLoader.cpp") to
avoid runtime crashes when minification is applied.

Fixes #5944
2023-02-08 15:29:55 -08:00
ritik619
a788f66e18 Fixed typographic error 2023-02-08 12:01:50 -08:00
Romain Guy
9ca3a7456c Fix JNI 2023-02-08 09:07:59 -08:00
Mathias Agopian
5cec001058 matdbg: direct SPIRV edit now supported 2023-02-03 13:57:44 -08:00
Mathias Agopian
2fb42f5144 matdbg: refresh spirv properly
we now refresh the spirv code properly after it's rebuilt from the
glsl tab.
2023-02-02 11:10:21 -08:00
Mathias Agopian
02c22a668c matdbg: make sure we use the same spirv parameters everywhere 2023-02-02 11:10:02 -08:00
Mathias Agopian
a7bf90f5be build.sh -d is now split in two options
`-d` now enables matdbg and adds debugging data, but doesn't affect 
 material optimization

`-g` disables material optimizations


A similar change is done with gradle options. The new proprety
`com.google.android.filament.matnopt` is used to disable material
optimizations.

These options mimic `matc` options.
2023-02-01 23:59:00 -08:00
Mathias Agopian
f71e90fae0 deduplicate spirv disassembly code 2023-02-01 21:12:53 -08:00
Mathias Agopian
8afb11128d move UibGenerator and SibGenerator to the shader folder
The shader folder is where we generate the glsl, so this is more
appropriate.
2023-02-01 21:12:53 -08:00
Mathias Agopian
2e0c238cc6 We now require Vulkan 1.1 for the vulkan backend 2023-02-01 21:10:26 -08:00
Benjamin Doherty
2ac85049a9 Bump version to 1.31.4 2023-02-01 11:55:09 -08:00
Benjamin Doherty
ea428a27d1 Merge branch 'rc/1.31.3' into release 2023-02-01 11:54:04 -08:00
Benjamin Doherty
03b89b4327 Release Filament 1.31.3 2023-02-01 11:53:41 -08:00
Mathias Agopian
a878d1f39c improve sample_full_pbr
- -m option now works with "directory_*.png" or just "*.png"
- "color" replaced by "albedo" to mach other places in the source tree
- fixed warnings
- clear the background when IBL is not used
2023-02-01 10:04:02 -08:00
Mathias Agopian
4a09e13e9d fix a couple typos and consts.
make it easier to activate matdbg on android builds, by adding, but
commenting out the appropriate property.
2023-02-01 10:03:20 -08:00
Mathias Agopian
0b4d32bf98 matdbg: use GLSL 4.5 on desktop when debugging spirv
GLSL 4.5 is closer to spriv than 4.1 and since this is just to 
"interpret" the spirv, 4.5 is fine.

Set the default precision for GLES though.
2023-02-01 10:03:20 -08:00
Mathias Agopian
b940fc9c48 update remote ui 2023-01-31 20:55:23 -08:00
Koncz Levente
2eb0dd7153 Sample Full PBR fixes (#6490)
* Calculate view vector without using camera eye position

* Fix compilation error (during parsing the material when a height map is passed in)

* Add SUN light to the scene
2023-01-31 12:28:25 -08:00
Mathias Agopian
101c7db9a2 update remote ui 2023-01-31 09:52:37 -08:00
Mathias Agopian
032ace2051 Add output color space to ColorGrading settings 2023-01-31 09:46:22 -08:00
Mathias Agopian
5754b9907d Add support for sRGB swapchains
This change adds a 'SRGB' config flag when creating a SwapChain that
enables linear to sRGB conversion on write.

When using this flag, the linear->srgb conversion in the color grading
post processing should be disabled (or, the whole post-processing
stage should be disabled).

There is also a new query to determine if this flag is supported by
the underlaying platform.

On Metal, this happens automatically when the underlaying layer is sRGB.

This reverts commit 3799e219fc.
2023-01-31 09:29:02 -08:00
Mathias Agopian
ffb8203ae7 Fix typo in ColorSpace operator= 2023-01-30 21:35:51 -08:00
Powei Feng
906da033dd vulkan: Add fallback extent for swap chain sizing (#6495)
vulkan: Add fallback extent for swap chain sizing
2023-01-30 19:29:10 -08:00
daemyung danny jang
1077405bc1 Support Windows32 on bluegl as C backend (#6499) 2023-01-30 15:56:15 -08:00
daemyung danny jang
e37df8fc89 Include a header in alphabetical order (#6507) 2023-01-30 14:58:56 -08:00
Mathias Agopian
3799e219fc Revert "Add support for sRGB swapchains"
This reverts commit eab14da30e.

This broke macOS desktop (and maybe other GL platforms).
2023-01-30 11:20:18 -08:00
Mathias Agopian
eab14da30e Add support for sRGB swapchains
This change adds a 'SRGB' config flag when creating a SwapChain that
enables linear to sRGB conversion on write.

When using this flag, the linear->srgb conversion in the color grading
post processing should be disabled (or, the whole post-processing
stage should be disabled).

There is also a new query to determine if this flag is supported by
the underlaying platform.


On Metal, this happens automatically when the underlaying layer is sRGB.
2023-01-30 10:49:38 -08:00
Mathias Agopian
84e999fe57 cleanup PlatformEGL config selection code
We now structure the code to assume we have EGL_KHR_no_config_context,
which is the common case. This allows use to decouple context creation
from swapchain creation.

We still handle the case where the extension is not present by always
selecting a transparent config.
2023-01-30 10:49:38 -08:00
Mathias Agopian
f22ff6a340 the createSwapChain flag shouldn't be a reference 2023-01-30 10:49:38 -08:00
daemyung danny jang
d9d0b93306 Fix a build error (#6502) 2023-01-30 10:38:36 -08:00
Powei Feng
09248cd451 Destroy FilamentInstance's mRoot in EntityManager (#6500) 2023-01-27 16:05:42 -08:00
Koncz Levente
73880428dc Ortho shading fixes (#6453) 2023-01-27 09:36:56 -08:00
Ben Doherty
2a049d1324 Initialize object_uniforms in depth shader (#6492) 2023-01-26 16:23:14 -08:00
Powei Feng
51cbd74235 Add missing STL includes (#6496) 2023-01-26 16:07:58 -08:00
Powei Feng
45246b6109 geometry: Add TangentSpaceMesh class outline (#6476)
- Defined class with documentation in comments
 - Implemented algorithm selection
 - No actual algorithms written yet

Part of google/filament#6358
2023-01-26 14:39:48 -08:00
Ben Doherty
d3956adca8 matdbg: take desktop/mobile into account for SPIR-V to GLSL translation (#6488) 2023-01-26 11:30:51 -08:00
Benjamin Doherty
3bef718238 Bump version to 1.31.3 2023-01-24 14:28:21 -08:00
Benjamin Doherty
e9daaa0503 Merge branch 'rc/1.31.2' into release 2023-01-24 14:27:02 -08:00
Benjamin Doherty
298e54c32a Release Filament 1.31.2 2023-01-24 14:26:22 -08:00
Ben Doherty
4c82f0259d Add systrace support on Apple platforms (#6480) 2023-01-23 14:11:47 -08:00
Mathias Agopian
d0c043c7ff implement draw command channels
There can be up to 4 channels drawing commands can be associated to. 
Channels work like "priorities" except it's the strongest command ordering 
key, in particular it takes precedence over the object's blending mode.
2023-01-23 13:47:41 -08:00
Powei Feng
20cbecfd7c vulkan: put getEnabledLayers behind VK_ENABLE_VALIDATION (#6474) 2023-01-18 18:38:53 -08:00
Powei Feng
194defdb1b vulkan: Fix readPixels memory leak (#6473) 2023-01-18 16:35:58 -08:00
Benjamin Doherty
6d3ea21993 Bump version to 1.31.2 2023-01-18 14:25:45 -08:00
Benjamin Doherty
f39127605d Merge branch 'rc/1.31.1' into release 2023-01-18 14:23:59 -08:00
Benjamin Doherty
5017cbe67e Release Filament 1.31.1 2023-01-18 14:23:21 -08:00
Ben Doherty
4c4201cb72 Update check-headers script to ignore platform headers (#6472) 2023-01-18 13:53:45 -08:00
Powei Feng
3ee635f8e4 Fix enabledLayers (#6467)
instanceCreateInfo should not take stack-allocated data
2023-01-18 13:50:10 -08:00
Ben Doherty
4c2dabffd6 Vulkan: fix stack-use-after-scope ASAN error in VulkanContext.cpp (#6463) 2023-01-18 12:00:08 -08:00
Ben Doherty
db476f00f7 Vulkan: fix stack-use-after-scope ASAN error in VulkanContext.cpp (#6463) 2023-01-18 11:59:10 -08:00
Mathias Agopian
185c83dae2 Fix a crash on Vulkan with some Adreno drivers
We were using a specialization constant to size an array inside an
UBO interface block, which caused the crash in the Vulkan driver.

However, this specialization constant was only used to workaround a
Chrome bug on WebGL. Additionally, specialized array size inside blocks
are not fully supported in spirv.

This workaround simply replaces the specialization constant by a 
constant on Vulkan.

Fix #6444
2023-01-18 10:36:43 -08:00
Mathias Agopian
15d124b225 disable KHR_debug messages
there were never useful and in fact harmful, because confusing to our
users.
2023-01-18 10:35:48 -08:00
Mathias Agopian
9c474c5b08 remove too verbose log when auto-instancing 2023-01-18 10:35:31 -08:00
Mathias Agopian
f92f283e00 Fix a typo with auto instancing
fixes b/265831206
2023-01-17 16:42:26 -08:00
Mathias Agopian
f6b94614e8 Make all OpenGLPlatform related interfaces public
- Remove DefaultPlatform from public headers
DefaultPlatform is now PlatormFactory and is just an implementation
detail.

- VulkanPlatform is now public
- Improvements to the OpenGLPlatform interface
- Cleanup PlatformEGL and PlatformEGLAndroid

Also:

- reworked how external image worked so that all the implementation
  is contained in the Platform and no dependency to the backend is
  needed.

- MetalPlatform is now entirely private and final

This is because MetalPlatform wasn't an interface. We probably need one
so it could be customized in the future. But as it stands now it's
better to be private.
2023-01-17 16:39:44 -08:00
Powei Feng
e54d8ec0a4 [vulkan] enumerate: Returning size = 0 is ok (#6450) 2023-01-17 10:14:45 -08:00
Ben Doherty
978517b057 Update actions/checkout version (#6454) 2023-01-17 09:59:19 -08:00
Levente Koncz
d911640809 Attempt to fix skybox shader in ORTHO view 2023-01-13 16:29:08 -08:00
Mathias Agopian
473e610430 reenable compute in the GL backend
We do some shenanigans so it works with API < 21 on android.
2023-01-13 16:00:56 -08:00
Mathias Agopian
3b9b725406 fix dynamic lighting with custom projections
Forxelization made many assumptions about the shape of the projection
matrix, the gist of these fixes is to remove those assumptions.

Fix #6390
2023-01-13 11:36:44 -08:00
Mathias Agopian
fa742bc6bf fix typos 2023-01-13 11:36:44 -08:00
Romain Guy
6a02dd0993 Update to Android Studio Electric Eel and AGP 7.4.0 (#6456) 2023-01-13 08:21:03 -08:00
Powei Feng
243d10f864 [vulkan] enumerate: Returning size = 0 is ok (#6450) 2023-01-12 12:56:34 -08:00
Romain Guy
bbe46071f3 Update Android dependencies (#6452) 2023-01-12 10:02:18 -08:00
Ben Doherty
8ded184ea3 Metal: add labels to aid debugging (#6451) 2023-01-12 09:55:43 -08:00
Romain Guy
ce407ba844 Fix typo 2023-01-11 08:48:04 -08:00
Powei Feng
ddb6a7fa93 Update Linux build instructions (#6438) 2023-01-10 16:42:44 -08:00
Benjamin Doherty
b95ac854b4 Bump version to 1.31.1 2023-01-10 12:52:49 -05:00
Benjamin Doherty
96443f6dac Merge branch 'rc/1.31.0' into release 2023-01-10 12:50:52 -05:00
Benjamin Doherty
72bba47880 Release Filament 1.31.0 2023-01-10 12:50:17 -05:00
Ben Doherty
0c38b1e3f9 Add SPIR-V debugging guide (#6405) 2023-01-09 13:15:41 -08:00
Powei Feng
8de3de235b Refactor VulkanContext/Driver initialization (#6429)
* Refactor VulkanContext/Driver initialization

Move the initialization of VulkanContext fields to the class
itself. This will clean up how the various extension support
flags are deteremined.

Also disable debugUtils extension for Mesa driver (#6192).
2023-01-09 12:51:49 -08:00
Romain Guy
24e1eef56e Fix glTF volumes 2023-01-05 17:38:16 -08:00
Powei Feng
378fb92434 Re-land #1 "[vulkan] Refactor vkEnumerate methods (#6423)" (#6426)
* Re-land #1 "[vulkan] Refactor vkEnumerate methods (#6423)"

This reverts commit 6f7d203adb.
The above commit (6f7d20) is the revert of #6423. Commit
6f7d20 is PR #6425.

"[vulkan] Refactor vkEnumerate methods (#6423)" failed [here] due to
a missing function attribute (VKAPI_ATTR in bluevk) for ARM64
compilers.

[here]: https://github.com/google/filament/actions/runs/3841550984
2023-01-05 11:45:25 -08:00
daemyung danny jang
c7c184d952 Make a small optimization on drop event at filament app (#6424) 2023-01-05 08:38:28 -08:00
Powei Feng
6f7d203adb Revert "[vulkan] Refactor vkEnumerate methods (#6423)" (#6425)
This reverts commit 8d608830d4.

Reason: broke Android build -> https://github.com/google/filament/actions/runs/3841550984
2023-01-04 15:16:23 -08:00
Po
8d608830d4 [vulkan] Refactor vkEnumerate methods (#6423)
* [vulkan] Refactor vkEnumerate methods

Use templates to help clean up the enumeration a bit.
2023-01-04 12:58:18 -08:00
daemyung danny jang
6734dc6f43 Create a path from a string view (#6406) 2023-01-03 09:36:41 -08:00
Po
5343d504c4 [vulkan] Break when desired layer is found (#6403) 2022-12-21 13:29:26 -08:00
Nick Fisher
f8684beba2 expose joint inverse bind matrices via method on FilamentInstance (#6388)
* expose joint inverse bind matrices via method on FilamentInstance

* change const pointer refs, add asserts and update release notes

Co-authored-by: Mathias Agopian <mathias@google.com>
2022-12-20 15:19:19 -08:00
Po
c88277a898 [filamesh] Add option to skip secondary UV coords (#6398)
Also added error and exit for when there's a mismatch in the
number of vertices vs. the number of UV coords (either primary or
secondary).
2022-12-20 14:14:31 -08:00
Romain Guy
1f0b988472 Add Filamesh template for Hex Fiend 2022-12-20 10:07:33 -08:00
Romain Guy
60c264a2e7 Add Hex Fiend template for filamesh files 2022-12-20 10:01:56 -08:00
Benjamin Doherty
e5e3dff9fa Fix Windows CI build 2022-12-20 11:01:49 -07:00
Benjamin Doherty
7724219f1e Fix Windows CI build 2022-12-20 11:01:10 -07:00
Benjamin Doherty
31d9da38fd Fix CI build 2022-12-20 09:40:07 -07:00
Ben Doherty
1d5ce4d1c2 Update spirv-tools to 025ea89 (#6393) 2022-12-19 15:42:42 -08:00
Mathias Agopian
9ff4a311ef fix typos 2022-12-19 15:22:49 -08:00
Benjamin Doherty
c5a59bb6b1 Bump version to 1.31.0 2022-12-19 11:14:41 -08:00
Benjamin Doherty
e6854148d7 Merge branch 'rc/1.30.0' into release 2022-12-19 11:12:54 -08:00
Benjamin Doherty
2f0bdd9c39 Release Filament 1.30.0 2022-12-19 11:11:45 -08:00
Ben Doherty
e1ba37b910 Fix memory leak in Scene (#6387) 2022-12-16 14:39:01 -08:00
Ben Doherty
001daf0350 Fix memory leak in Scene (#6387) 2022-12-16 14:38:38 -08:00
Mathias Agopian
7448e7c3c5 CMakeLists minor cleanup 2022-12-15 15:19:31 -08:00
Mathias Agopian
d26c48110d Fix Android continuous and presubmit builds
Since cmake 3.25 LINUX is automatically set based on CMAKE_SYSTEM_NAME, 
which the android cmake files are setting to "Linux". This created an
inconsistant state in our build system.
2022-12-15 11:54:33 -08:00
Mathias Agopian
ee6612ecfa Workaround for a bug in Adreno's shader compiler
At least some adreno compilers don't like returning an element of a
UBO array that is a structure in the vertex shader.
To work this around we have to copy the each of the structure fields.

Fixes #6355
2022-12-14 15:39:18 -08:00
Mathias Agopian
aa5504aad3 auto instancing wasn't applied in Settings. 2022-12-14 00:52:37 -08:00
Mathias Agopian
1523edd519 attempt to fix helmet web sample 2022-12-14 00:11:18 -08:00
Mathias Agopian
190d6faa67 attempt to fix web demos #4 2022-12-13 23:17:44 -08:00
Mathias Agopian
9f97ff4ced 3rd attempt at fixing web demos 2022-12-13 23:08:22 -08:00
Mathias Agopian
989e6c9198 2nd attempt at fixing the web demos 2022-12-13 22:54:29 -08:00
Mathias Agopian
9c19e746a4 attempt to fix webgl demos 2022-12-13 22:38:00 -08:00
Mathias Agopian
0a20be7097 update docs/remote 2022-12-13 22:25:17 -08:00
Mathias Agopian
0d72a0904b getNormalizedViewportCoord() now returns the logical viewport coords
This is a better user-facing API because materials don't need to know
about the physical viewport.
2022-12-13 16:37:49 -08:00
Romain Guy
7f9e7a4566 Update Web demos 2022-12-13 15:04:12 -08:00
Mathias Agopian
48d9f44291 Handle Vulkan and Metal shadow coordinates in the same way
Vulkan and Metal should be handled exactly the same within filament,
when it comes to texture-space and clip-space because filament
always transforms vulkan's clip-space to gl's/metal's).

Our shadow code took different paths, both equivalent though, but it's
confusing.
2022-12-12 15:21:35 -08:00
Mathias Agopian
b5d197dfe3 Fix unused variables in release builds 2022-12-12 12:30:33 -08:00
Mathias Agopian
1d387d04fd add a debug option for Renderer's buffer padding 2022-12-12 11:18:17 -08:00
Mathias Agopian
15a070f0c9 Fix unused variables in release builds 2022-12-12 11:17:42 -08:00
Mathias Agopian
93230b06cf Fix Android continuous and presubmit builds
Since cmake 3.25 LINUX is automatically set based on CMAKE_SYSTEM_NAME, 
which the android cmake files are setting to "Linux". This created an
inconsistant state in our build system.
2022-12-12 10:44:49 -08:00
Mathias Agopian
4c55fc3c48 fix TransformManager high precision mode
The residual would be corrupted when using transactions.
2022-12-12 10:06:18 -08:00
Mathias Agopian
4215ba6476 code cleanup
fix new code quality warnings enabled by CLion
2022-12-09 11:05:26 -08:00
Mathias Agopian
5b2a92a5c4 fix a typo that caused a wrong allocation size
this only affect the WebGL build's readPixels.
2022-12-09 10:52:24 -08:00
Mathias Agopian
9661cd4c3a fix a race condition with acquired streams
The race coud lead to user after free and crashes.

We now keep a list of acquired streams with pending images on the 
main thread, and use that to update the streams synchronously in
beginFrame. We can then enqueue a command for the driver thread that
will look for that stream in the active list of textures with stream
attached. Race avoided.


The previous code used the later list from both threads.
2022-12-08 16:19:11 -08:00
Balazs Vegh
cc2580230f Add fallback return to uintToColorDebug() (#6364) 2022-12-08 09:00:23 -08:00
Romain Guy
2a69a892b0 Add TS definition for Engine.destroy (#6359)
* Add TS definition for Engine.destroy

* Update release notes
2022-12-07 16:18:45 -08:00
Mathias Agopian
34e5865941 fix TransformManager high precision mode
The residual would be corrupted when using transactions.
2022-12-06 14:18:33 -08:00
Mathias Agopian
07464c967b Add missing Scene::getIndirectLight()
Also add missing getSkybox in js bindings
2022-12-06 11:19:43 -08:00
Koncz Levente
c2fcaf7a6b Add RGTC + BPTC support (#6320)
* Add RGTC support
* Add BPTC support
2022-12-06 11:18:35 -08:00
Mathias Agopian
d8c9391498 fix clear options
When more than one view was used, only the first view was cleared with
the ClearOption. This was actually intended when the views are rendering
into the swapchain (e.g. post process disabled), but that's incorrect 
when the views render into intermediate buffers.

The clear flags are now associated with the actual rendertarget.
2022-12-02 15:24:40 -08:00
Romain Guy
78554d2319 Add new outputColorSpace() API to ColorGrading (#6342)
* Add new outputColorSpace() API to ColorGrading

This allows the application to select the desired output color space.
The default is set to Rec709-sRGB-D65 ("sRGB") but can be changed to
Rec709-Linear-D65.

Currently only the transfer function is taken into account and must
be either sRGB or Linear. Future updates will add support for
different gamuts and white points.

* Update release notes
2022-12-01 17:00:30 -08:00
Mathias Agopian
c2711d643e minor code cleanup 2022-12-01 09:37:10 -08:00
Mathias Agopian
913e3d32ee fix viewtest
- it didn't clear the swapchain
- added support for `-a` option
2022-12-01 09:36:46 -08:00
Mathias Agopian
a4797a631e Fix a WebGL program link failure
WebGL complained about:

Precisions of uniform block 'ShadowUniforms' member
'ShadowUniforms.shadows.texelSizeAtOneMeter' differ between VERTEX and
FRAGMENT shaders.


this field didn't have a precision qualifier, this might be specific to
WebGL or a Chrome bug, unsure. Either we fix it by specifying all
qualifiers.
2022-11-29 23:32:21 -08:00
Mathias Agopian
5868e857aa Fix a WebGL program link failure
WebGL complained about:

Precisions of uniform block 'ShadowUniforms' member 
'ShadowUniforms.shadows.texelSizeAtOneMeter' differ between VERTEX and 
FRAGMENT shaders.


this field didn't have a precision qualifier, this might be specific to
WebGL or a Chrome bug, unsure. Either we fix it by specifying all
qualifiers.
2022-11-29 23:31:03 -08:00
Mathias Agopian
f0b9c5fff4 Fix a WebGL program link failure
WebGL complained about:

Precisions of uniform block 'ShadowUniforms' member 
'ShadowUniforms.shadows.texelSizeAtOneMeter' differ between VERTEX and 
FRAGMENT shaders.


this field didn't have a precision qualifier, this might be specific to
WebGL or a Chrome bug, unsure. Either we fix it by specifying all
qualifiers.
2022-11-29 23:27:55 -08:00
ThomasGorisse
fe67404fd5 Fix typo in LightManager documentation 2022-11-28 14:56:22 -08:00
ThomasGorisse
555ed96918 Fix confusing typo in Camera documentation 2022-11-28 14:56:22 -08:00
Mathias Agopian
fc74154ffe Fix Android continuous and presubmit builds
Since cmake 3.25 LINUX is automatically set based on CMAKE_SYSTEM_NAME, 
which the android cmake files are setting to "Linux". This created an
inconsistant state in our build system.
2022-11-28 14:07:04 -08:00
Mathias Agopian
74e8ddaf95 Directional shadow improvements
Use a much more precise way to calculate the directional shadow frustum.
With very large scenes, we were losing the precision on the direction
of the light, and in some case even producing NaN in the matrix.

This partially addresses #6293
2022-11-28 10:25:06 -08:00
Benjamin Doherty
f05c7f1141 Fix CI build 2022-11-22 13:49:59 -08:00
ViktorHeisenberger
565d385132 Use Frisvad's method to compute tangent space from normals-only mesh input (#6313)
* Change tangent basis computation for normals-only to Frisvad's method

* Update RELEASE_NOTES.md
2022-11-22 09:30:37 -08:00
Benjamin Doherty
32ba063bd7 Fix CI build 2022-11-21 16:58:37 -08:00
Benjamin Doherty
02f0839f9b Bump version to 1.30.0 2022-11-21 15:45:27 -08:00
Benjamin Doherty
e50f3c4c91 Merge branch 'rc/1.29.0' into release 2022-11-21 15:44:36 -08:00
Benjamin Doherty
e2384f59a2 Release Filament 1.29.0 2022-11-21 15:44:09 -08:00
Ben Doherty
7ca15bfc16 Use GitHub script for release asset upload (#6308) 2022-11-21 15:39:55 -08:00
Mathias Agopian
f619b62877 Handle shadow borders better
All shadow maps need a 1-px border for different reasons.
The directional shadow needs a "not in shadow" border because it uses
the intersection of receivers and casters in light-space.
Other shadow types need a border because of bilinear access at the 
edges. Until now, the spot/point shadow border was handled with the
sampler's CLAMP.

Instead, now, we always generate a border and in one case we fill it
with "not in shadow" (by not rendering into it), in the other cases we
render the 2px larger shadowmap so we get completely correct bilinear 
filter.

Additionally, for PCF, DPCF and PCSS we use a large filter kernel which
accesses data outside the texture, until now this was handled with CLAMP,
but that failed (2 of the edges were not handled in the same way) when 
the shadowmap was smaller than the texture.
We fix this by clamping manually the texture coordinates.


The real motivation for these changes is to allow the use of a
shadow Atlas later.
2022-11-21 15:38:25 -08:00
Ben Doherty
22e5d15a17 Use GitHub script for release asset upload (#6308) 2022-11-21 10:25:20 -08:00
Mathias Agopian
77fcf4d260 don't store the light direction in the shadowmap structure
We already have it in the Light structure.
2022-11-17 11:07:47 -08:00
Mathias Agopian
46a8b242a8 don't set invalid viewport in gl backend
When width/height is converted to GLSizei, which is signed, it can
become negative, which happened with a "full" viewport.
On some GL implementation, this resulted in a failure.
2022-11-17 11:07:30 -08:00
Romain Guy
901d255026 Update README.md 2022-11-16 11:01:57 -08:00
Mathias Agopian
b3cf555eb2 fixup: better accounting of available shadowmaps 2022-11-16 09:20:59 -08:00
Mathias Agopian
594cce35c7 the 1-px border is only needed for the directional light 2022-11-16 09:20:38 -08:00
Mathias Agopian
8b96af8e3f AtlasAllocator improvements 2022-11-16 09:20:22 -08:00
Mathias Agopian
641a0bda9e spell specialization correctly 2022-11-16 09:20:00 -08:00
Mathias Agopian
b1e438e141 move vsm's MSAA sample count to the view settings
VSM's MSAA is no longer a "per light" setting, it is now global for
the whole view.
2022-11-14 15:29:08 -08:00
Mathias Agopian
a61338ff8b fix scissor override
don't forget to update the scissor state when setting the override.
2022-11-10 16:14:10 -08:00
Mathias Agopian
82da7dc999 minor cleanups 2022-11-10 15:46:24 -08:00
Joel Winarske
9f7bb14bd1 Enable CMake fo subdirectory use (#6287)
-Addresses issue where launch-c/launch-cxx is expected in CMAKE_BINARY_DIR

https://github.com/google/filament/issues/6285

Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
2022-11-10 15:18:21 -08:00
Mathias Agopian
6ec5fd86fa rework how we set the viewport for shadows
The viewport is now entirely handled by ShadowMap, that is, we're no
longer setting a viewport in the renderpass, instead the ShadowMap
uses a post projection transform to achieve the same effect.
This will become useful when store shadow maps in an Atlas.
2022-11-10 15:15:43 -08:00
Mathias Agopian
cf16bbe64b fix atlas allocator
it could return an orphan node, that is some of the parent in its
ancestry have no children.
2022-11-10 11:33:30 -08:00
daemyung jang
3da450a019 Include the windows.h header after packing alignment (#6280) 2022-11-10 11:02:45 -08:00
Ben Doherty
66276710f4 Fix memory corruption in FScene (#6282) 2022-11-10 10:44:58 -08:00
Benjamin Doherty
b7b7afb62a Bump version to 1.29.0 2022-11-09 16:43:08 -08:00
Benjamin Doherty
957380b258 Release Filament 1.28.3 (ignore prev commit) 2022-11-09 16:41:13 -08:00
Benjamin Doherty
b8ff6a9ad9 Merge branch 'rc/1.28.3' into release 2022-11-09 16:38:02 -08:00
Benjamin Doherty
fe3f16924d Release Filament 1.29.0 2022-11-09 16:37:39 -08:00
Ben Doherty
a1dcb4f259 Skip rendering renderables with missing geometry (#6281) 2022-11-09 16:35:31 -08:00
Ben Doherty
ffc3128377 Skip rendering renderables with missing geometry (#6281) 2022-11-09 16:35:02 -08:00
Benjamin Doherty
c3501393fd Fix RELEASE_NOTES 2022-11-09 16:34:42 -08:00
Mathias Agopian
c05e2ec47d improve variant filter
- variant filter didn't filter the VSM variant of depth variants

Fix #6274
2022-11-08 16:48:54 -08:00
Mathias Agopian
9768f49714 unify point and spotlight shadows
point light shadows are not sampled just like spotlight shadows, the
only difference is that we're calculating the face first to access the
corresponding shadowmap data (including the light transform).
2022-11-08 16:35:54 -08:00
Mathias Agopian
6c54cfe88a Shadowmaping code improvements
- the layer is now stored in the shadow ubo
- we now have one shadow ubo per face
- ShadowMap holds UBO index even for cascades
- move some shadow "view" uniforms into the shadow UBO
2022-11-08 15:25:33 -08:00
Benjamin Doherty
a03de75a4e Update Python requirements.txt to fix CI 2022-11-04 11:35:21 -07:00
Benjamin Doherty
0c3d59aba3 Update Python requirements.txt to fix CI 2022-11-03 16:15:29 -07:00
Benjamin Doherty
ce1987f291 Fix iOS build 2022-11-01 15:10:57 -04:00
Benjamin Doherty
7eae926ed7 Bump version to 1.28.3 2022-11-01 13:03:19 -04:00
Benjamin Doherty
606af52eda Merge branch 'rc/1.28.2' into release 2022-11-01 13:02:05 -04:00
Benjamin Doherty
8ea30aea80 Update RELEASE_NOTES for 1.28.2 2022-11-01 13:00:04 -04:00
Ben Doherty
72dea695ba Fix G3 reported ubsan warning (#6257) 2022-11-01 12:52:10 -04:00
daemyung jang
1c0cf56ed0 Fix glTF breaking issue (#6239) 2022-10-28 13:08:50 -04:00
Benjamin Doherty
bcb4eb35cd Bump version to 1.28.2 2022-10-25 13:09:21 -04:00
Benjamin Doherty
bce2676335 Merge branch 'rc/1.28.1' into release 2022-10-25 13:08:12 -04:00
Benjamin Doherty
510097d722 Force spirv-cross to keep Metal argument buffer equal sized 2022-10-25 12:10:54 -04:00
Ben Doherty
5784118a12 Fix, don't use encoder.device (#6212) 2022-10-20 13:08:04 -04:00
Ben Doherty
b5de0f2d23 Metal: fix simulator regression due to arg buffers (#6181) 2022-10-18 16:29:18 -04:00
Ben Doherty
04df3f4dad Metal: fix use-after-free ASAN error (#6203) 2022-10-18 16:29:12 -04:00
Benjamin Doherty
093ca4d623 Revert Android API_LEVEL change
glDispatchCompute requires Android API level 21, however bumping our
required minimum from 19 to 21 caused some clients' builds to fail.
Commenting-out that line for now to proceed with the 1.28.0 upgrade.
2022-10-18 16:28:58 -04:00
Mathias Agopian
a3ed1558d3 fix a directional light shadowing issue
the shadow frustum could be be smaller than expected.
2022-10-14 15:42:03 -07:00
Benjamin Doherty
fe379070ae Bump version to 1.28.1 2022-10-13 12:38:40 -04:00
Benjamin Doherty
ead0a2f597 Merge branch 'rc/1.28.0' into release 2022-10-13 12:37:07 -04:00
Benjamin Doherty
5dbc593f90 Fix assertion in ShadowMap due to vertexCount 2022-10-12 18:16:53 -04:00
Ben Doherty
d47dc12bf0 G3 fixes for 1.28.0 (#6174) 2022-10-12 14:48:37 -04:00
Philip Rideout
4392f63e57 Vulkan: fix black screen regression
The VulkanProgram constructor was bailing out early and emitting a
warning because it saw that one of the stages wasn't fulfilled.
However it's okay for a pipeline to be missing a compute program.

Fixes regression that started with fabba73b1.
2022-10-12 14:48:25 -04:00
Ben Doherty
f64b7aca79 Fix Metal argument buffer encoding (#6150) 2022-10-10 10:07:41 -07:00
Ben Doherty
3762ec5750 Fix Android release build (#6133) 2022-09-30 11:48:13 -07:00
Ben Doherty
4591fdd9c0 Fix Android release build (#6133) 2022-09-30 11:47:41 -07:00
Benjamin Doherty
d3068d2a0e Bump version to 1.28.0 2022-09-29 13:13:18 -07:00
Benjamin Doherty
ca0a4bc23a Merge branch 'rc/1.27.2' into release 2022-09-29 13:12:20 -07:00
Ben Doherty
433c163c61 Fixes for 1.27.2 release (#6125) 2022-09-29 13:08:39 -07:00
Mathias Agopian
c867fda883 don't attempt to use more texture units than present
to emulate the bindless API in the gl backend we always used the highest
texture unit available. However at feature level 3, we support up to 62
textures, so the that max was bumped to 62 -- however, where we're not
on a feature level 2 device, that texture unit doesn't exist.

Instead we now always use binding 31, which is guaranteed to exist by 
EGL's minspec.
2022-09-29 12:36:28 -07:00
Ben Doherty
566540ae6d Fix generic/Mutex.h not installed on Linux (#6117) 2022-09-28 16:49:03 -07:00
Benjamin Doherty
759f490dae Bump version to 1.27.2 2022-09-20 11:06:02 -07:00
Benjamin Doherty
867d4d44f5 Merge branch 'rc/1.27.1' into release 2022-09-20 11:04:58 -07:00
Ben Doherty
65747d5877 Update glslang to c0cf8ad87 (master) (#6076) 2022-09-19 12:38:05 -07:00
Benjamin Doherty
bd357f6076 Bump version to 1.27.1 2022-09-13 10:15:12 -07:00
Benjamin Doherty
9e960b7d45 Merge branch 'rc/1.27.0' into release 2022-09-13 10:14:24 -07:00
Ben Doherty
0c54d4a6a1 Add return case to fix G3 compiler error (#6062) 2022-09-12 12:34:56 -07:00
Philip Rideout
526e846a81 gltfio: fix crash when material is unspecified 2022-09-06 22:13:19 -04:00
Philip Rideout
8bcfa373d4 gltfio: do not clear out the texture slots too early.
This broke asyncGetLoadProgress() and caused WebGL to crash reliably
because ResourceLoader got destroyed too soon.

Bug was introduced with de7dfc2ea6.

I intend to cherry pick this to rc/1.27.0, which is where it was
introduced, so there's no need to update the release notes.
2022-09-06 22:09:25 -04:00
Ben Doherty
db9a0f2c1f Fix uberarchive not included in PodSpec (#6024) 2022-09-01 12:18:20 -04:00
Benjamin Doherty
646b1e2193 Bump version to 1.27.0 2022-08-31 12:04:55 -04:00
Benjamin Doherty
41bd30f81d Merge branch 'rc/1.26.0' into release 2022-08-31 12:04:08 -04:00
Mathias Agopian
bd626aea27 material instanced property must be false by default.
this fix auto-instancing.
2022-08-26 18:28:56 -04:00
Benjamin Doherty
8a03f75485 Bump version to 1.26.0 2022-08-23 12:07:33 -04:00
Benjamin Doherty
dc9594fbdf Merge branch 'rc/1.25.6' into release 2022-08-23 12:05:44 -04:00
Benjamin Doherty
fad0b533c0 Update RELEASE_NOTES for 1.25.6 2022-08-23 12:03:28 -04:00
Benjamin Doherty
4d773e9453 Bump version to 1.25.6 2022-08-16 11:03:07 -07:00
Benjamin Doherty
e0c610b013 Merge branch 'rc/1.25.5' into release 2022-08-16 11:01:04 -07:00
Benjamin Doherty
0da4f36c33 Bump version to 1.25.5 2022-08-16 10:54:00 -07:00
Ben Doherty
11d17e1db3 Fix SamplerGroup update issue (#5928) 2022-08-16 10:47:18 -07:00
Philip Rideout
b8c318d923 WASM: Allow clients to enable pthreads.
Filament does not yet fully support threads with WASM, but this is a
baby step in that direction.

To enable experimental pthreads support, enable the WEBGL_PTHREADS CMake
option. This will enable pthreads support in `gltfio` and `utils`, which
is known to work, but not when served with GitHub Pages.

The web server must emit COOP, COEP and CORP headers, so our build
instructions now recommend the use of `emrun` for local testing.

This also changes our demos so that they do not use unpkg, which
does not work when using `emrun`, due to cross-origin restrictions.
2022-08-12 15:43:28 -07:00
Philip Rideout
e563cc6f5e gltfio: add 'detach' methods to allow ownership transfer
These new methods allow gltfio to be integrated into internal Google
libraries.
2022-08-09 14:37:44 -07:00
Benjamin Doherty
cb8914ab96 Merge branch 'rc/1.25.4' into release 2022-08-02 11:47:52 -07:00
Alan Eneev
2fecda7bdc Headless EGL: Fallback to a 24-bit depth buffer 2022-07-29 10:10:46 -07:00
Alan Eneev
543d8efb25 Fix PlatformEGLHeadless build and add a build.sh option to build EGL
I have disabled building SDL with headless EGL, because
SDL_config_minimal.h doesn't work with EGL, and I don't know how to
implement a an SDL config that would work with EGL.

I have verified that this works in a separate project, and that it
compiles in this project.

```
$ ./build.sh -e release
$ find ./out/ -name "*EGL*"
./out/cmake-release/filament/backend/CMakeFiles/backend.dir/src/opengl/platforms/PlatformEGL.cpp.o
./out/cmake-release/filament/backend/CMakeFiles/backend.dir/src/opengl/platforms/PlatformEGLHeadless.cpp.o
./out/cmake-release/libs/bluegl/CMakeFiles/bluegl.dir/src/BlueGLLinuxEGL.cpp.o
```
2022-07-29 10:10:40 -07:00
Benjamin Doherty
396b1079a7 Bump version to 1.25.4 2022-07-26 09:57:34 -07:00
Benjamin Doherty
eedcd9f8cb Merge branch 'rc/1.25.3' into release 2022-07-26 09:56:22 -07:00
Ben Doherty
ab252b210c Fix config object related build failures (#5814) 2022-07-26 09:51:55 -07:00
Benjamin Doherty
1071b8ea90 Bump version to 1.25.3 2022-07-18 15:15:03 -07:00
Benjamin Doherty
a9c5bbf185 Merge branch 'rc/1.25.2' into release 2022-07-18 15:14:02 -07:00
Philip Rideout
8dd4bff7a7 gltfio: minor fixups to prep for g3 integration. 2022-07-18 15:11:36 -07:00
Philip Rideout
77c54446af gltfio: use openLocalTransformTransaction API. 2022-07-18 15:11:30 -07:00
Benjamin Doherty
4a0bc0af57 Bump version to 1.25.2 2022-07-11 15:51:55 -07:00
Benjamin Doherty
a171e75e70 Merge branch 'rc/1.25.1' into release 2022-07-11 15:50:10 -07:00
Benjamin Doherty
f5ffa092fe Bump version to 1.25.1 2022-07-06 19:09:34 -07:00
Benjamin Doherty
8de5fdd551 Merge branch 'rc/1.25.0' into release 2022-07-06 19:07:42 -07:00
Benjamin Doherty
ecca3abe98 Bump version to 1.25.0 2022-07-01 12:09:29 -07:00
Benjamin Doherty
8570e35224 Merge branch 'rc/1.24.0' into release 2022-07-01 12:08:48 -07:00
Benjamin Doherty
84df9f9a03 Update version to 1.24.0 2022-07-01 12:03:38 -07:00
Benjamin Doherty
5f93fb9613 Update RELEASE_NOTES for 1.24.0 2022-06-30 16:37:03 -07:00
Benjamin Doherty
75f77fdbdd Metal: Allow Filament to disregard MTLTexture pixelFormat when importing 2022-06-30 16:04:28 -07:00
Ben Doherty
7825d582c2 CocoaPods: include uberz library (#5752) 2022-06-30 14:07:55 -07:00
Ben Doherty
5deb0ba933 CocoaPods: include uberz library (#5752) 2022-06-30 14:04:02 -07:00
Philip Rideout
18e917aaf2 ImGuiHelper: add support for Y flip. (#5748)
Reflects a change from Betty and should be cherry picked to v1.23.3

Users could customize the ImGuiHelper camera, but they had no control
over the scissor coordinates. This allows them to use vertically flipped
coordinates, which, unfortunately, is required for MediaPipe
integration.
2022-06-30 12:05:53 -07:00
Benjamin Doherty
a165f3890a Vulkan: Support VMA_DYNAMIC_VULKAN_FUNCTIONS off 2022-06-21 15:09:26 -07:00
Philip Rideout
f88b6d9c97 Do not trigger UB with string_view. 2022-06-20 21:11:52 -07:00
Mathias Agopian
db8ecd9952 configure render primitive pool so it works with msvc
a 64 bytes pool seems to work with both clang and msvc, unfortunately,
c++ doesn't let us know the allocator object size at compile time
for map containers, so we have to guess.
2022-06-16 13:13:33 -07:00
Benjamin Doherty
b5ec06c2d2 Fix build breakage 2022-06-15 17:05:53 -07:00
Benjamin Doherty
dfbac8385e Merge branch 'rc/1.23.2' into release 2022-06-15 11:49:06 -07:00
Ben Doherty
eaab737b2c NoopDriver: return unique handles (#5697) 2022-06-15 11:28:08 -07:00
Benjamin Doherty
45991cda0a Update RELEASE_NOTES for 1.23.2 2022-06-13 15:27:03 -07:00
Philip Rideout
09a016bb6f Remove an 'API Change' warning from one item. 2022-06-09 14:33:49 -07:00
Benjamin Doherty
31607d355d Bump version to 1.23.2 2022-06-06 15:18:57 -07:00
Benjamin Doherty
a67d50b9e2 Merge branch 'rc/1.23.1' into release 2022-06-06 15:16:53 -07:00
Benjamin Doherty
8d42f53c80 Update RELEASE_NOTES for 1.23.1 2022-06-06 15:14:59 -07:00
Benjamin Doherty
5e21a55bce Revert "iOS: implement headleass swapchain (#5486)"
This reverts commit 0e5ba60cb6.

This causes issues in G3, still need to investigate the root cause.
2022-06-06 13:17:04 -07:00
Benjamin Doherty
85930ea2e8 Bump version to 1.23.1 2022-06-01 14:58:29 -07:00
Benjamin Doherty
4b3cde8b39 Merge branch 'rc/1.23.0' into release 2022-06-01 14:55:20 -07:00
Benjamin Doherty
eedfa85355 Update RELEASE_NOTES for 1.23.0 2022-06-01 14:54:50 -07:00
Benjamin Doherty
bb54c6c807 Release Filament 1.23.0 2022-06-01 14:53:48 -07:00
Benjamin Doherty
c23f905858 Update RELEASE_NOTES for 1.23.0 2022-06-01 14:53:23 -07:00
Benjamin Doherty
8c7be0a1d0 Revert "iOS: implement headleass swapchain (#5486)"
This reverts commit 0e5ba60cb6.

This causes issues in G3, still need to investigate the root cause.
2022-05-31 11:29:38 -07:00
Benjamin Doherty
878497b3d5 Bump version to 1.23.0 2022-05-24 15:19:51 -07:00
Benjamin Doherty
a155561769 Merge branch 'rc/1.22.2' into release 2022-05-24 15:17:55 -07:00
Benjamin Doherty
8b86a0ed2e Revert "iOS: implement headleass swapchain (#5486)"
This reverts commit 0e5ba60cb6.

This causes issues in G3, still need to investigate the root cause.
2022-05-24 20:13:10 +00:00
Benjamin Doherty
26f9a9b122 Update RELEASE_NOTES for 1.22.2 2022-05-23 12:40:47 -07:00
Ben Doherty
6e5f6978fb Add ktxreader and viewer libs to CocoaPods (#5573) 2022-05-18 16:24:51 -07:00
Ben Doherty
0d31d7b2de Add ktxreader and viewer libs to CocoaPods (#5573) 2022-05-18 16:13:26 -07:00
Benjamin Doherty
dd862b7e0a Bump version to 1.22.2 2022-05-17 18:03:38 -07:00
Benjamin Doherty
52065f2cbd Merge branch 'rc/1.22.1' into release 2022-05-17 18:01:37 -07:00
Benjamin Doherty
77c02d5831 Update RELEASE_NOTES for 1.22.1 2022-05-17 17:51:37 -07:00
Ben Doherty
f7e4c8d16d Add package name back to AndroidManifest.xml to fix G3 (#5569) 2022-05-17 17:51:21 -07:00
Philip Rideout
b7410474ff Workaround: partially revert "don't issue a flush..."
This is a temporary workaround for a memory corruption issue observed on
some devices from a specific vendor. We will try to make this workaround
more targeted in a subequent change.

Partial revert for b2cdf9f2b4.
2022-05-16 10:39:55 -07:00
Benjamin Doherty
384cc4ebf6 Bump version to 1.22.1 2022-05-09 13:09:39 -07:00
Benjamin Doherty
7c0643f122 Merge branch 'rc/1.22.0' into release 2022-05-09 13:07:07 -07:00
Benjamin Doherty
58abae3067 Release Filament 1.22.0 2022-05-09 13:07:02 -07:00
Benjamin Doherty
4742693869 Update RELEASE_NOTES for 1.22.0 2022-05-09 13:04:55 -07:00
Benjamin Doherty
6c39e474ea Bump version to 1.22.0 2022-05-02 13:19:43 -04:00
Benjamin Doherty
5c8977c906 Merge branch 'rc/1.21.3' into release 2022-05-02 13:18:06 -04:00
Benjamin Doherty
6b3cc2e2f3 Update RELEASE_NOTES for 1.21.3 2022-05-02 13:12:51 -04:00
Ben Doherty
76b2edd6ea Move toCompressedFilamentEnum to Ktx1Reader header (#5493) 2022-04-29 14:50:24 -04:00
Benjamin Doherty
8ebb37d011 Bump version to 1.21.3 2022-04-25 16:58:19 -04:00
Benjamin Doherty
3366db83ef Merge branch 'rc/1.21.2' into release 2022-04-25 16:57:25 -04:00
Benjamin Doherty
5415254aac Update RELEASE_NOTES for 1.21.2 2022-04-25 16:50:53 -04:00
Benjamin Doherty
caacc61602 Bump version to 1.21.2 2022-04-13 10:21:09 -06:00
Benjamin Doherty
e902df19b2 Merge branch 'rc/1.21.1' into release 2022-04-13 10:15:50 -06:00
Benjamin Doherty
40b372dda7 Update RELEASE_NOTES for 1.21.1 2022-04-12 14:36:26 -06:00
Ben Doherty
fd330a98aa Releases: specify Python dependencies in requirements.txt file (#5402) 2022-04-08 14:35:51 -07:00
Ben Doherty
90c23a7d5d Correctly prepare color grading as subpass programs (#5384) 2022-04-04 13:24:01 -07:00
Benjamin Doherty
5710304114 Bump version to 1.21.1 2022-04-04 13:03:39 -07:00
Benjamin Doherty
0f684820bc Merge branch 'rc/1.21.0' into release 2022-04-04 13:01:35 -07:00
Benjamin Doherty
e1d2d6ade6 Update RELEASE_NOTES for 1.21.0 2022-04-04 12:58:54 -07:00
Mathias Agopian
e0b6f2ca71 Change version number to 1.21.0 2022-04-04 12:41:38 -07:00
Benjamin Doherty
2a35ee279b Bump version to 1.20.6 2022-03-28 18:47:38 -07:00
Benjamin Doherty
5abf780360 Merge branch 'rc/1.20.5' into release 2022-03-28 18:45:34 -07:00
Benjamin Doherty
181f158ea9 Update RELEASE_NOTES for 1.20.5 2022-03-28 18:42:41 -07:00
Benjamin Doherty
f4087fc81d Bump version to 1.20.5 2022-03-21 14:45:34 -07:00
Benjamin Doherty
82793f9b82 Merge branch 'rc/1.20.4' into release 2022-03-21 14:43:15 -07:00
Benjamin Doherty
537576e84a Update RELEASE_NOTES for 1.20.4 2022-03-21 14:42:35 -07:00
Benjamin Doherty
375d1f55e3 Release Filament 1.20.4 2022-03-21 14:38:14 -07:00
Benjamin Doherty
597218963f Update RELEASE_NOTES for 1.20.4 2022-03-21 14:37:17 -07:00
Philip Rideout
0d29b3ddc8 WebGL endFrame: restore additional default state. 2022-03-21 09:43:45 -07:00
Philip Rideout
e0e3b42623 WebGL: reset VAO and texture bindings when frame ends. 2022-03-21 09:43:33 -07:00
Benjamin Doherty
0995ca6614 Bump version to 1.20.4 2022-03-14 14:19:36 -07:00
Benjamin Doherty
3d741fc8d4 Merge branch 'rc/1.20.3' into release 2022-03-14 14:17:54 -07:00
Benjamin Doherty
c20772b458 Update RELEASE_NOTES for 1.20.3 2022-03-10 12:56:56 -08:00
Benjamin Doherty
4a6b659098 Bump version to 1.20.3 2022-03-07 14:12:28 -08:00
Benjamin Doherty
2b93f08ca5 Merge branch 'rc/1.20.2' into release 2022-03-07 14:10:07 -08:00
Benjamin Doherty
fca62b8fff Update RELEASE_NOTES for 1.20.2 2022-03-07 14:08:41 -08:00
Benjamin Doherty
dee6d9de2c Bump version to 1.20.2 2022-03-02 15:51:38 -08:00
Benjamin Doherty
574e3e7521 Merge branch 'rc/1.20.1' into release 2022-03-02 15:47:21 -08:00
Ben Doherty
29fdf82ac5 Make VulkanContext compatible with vk_mem_alloc dev 2022-03-02 12:10:20 -08:00
Benjamin Doherty
c8cf2a54e8 Update RELEASE_NOTES for 1.20.1 2022-03-02 11:47:51 -08:00
Ben Doherty
bfd32e67d4 Apply some clang-tidy fixes (#5281) 2022-03-02 11:43:51 -08:00
Benjamin Doherty
95915367fa Bump version to 1.20.1 2022-02-24 13:59:17 -08:00
Benjamin Doherty
b769cfda62 Merge branch 'rc/1.20.0' into release 2022-02-24 13:57:10 -08:00
Benjamin Doherty
40ac88dfed Bump MATERIAL_VERSION to 20 2022-02-24 13:53:43 -08:00
Benjamin Doherty
6d96082f07 Bump version to 1.20.0 2022-02-24 13:53:43 -08:00
Benjamin Doherty
21f913db1c Update RELEASE_NOTES for 1.20.0 2022-02-24 13:53:42 -08:00
Ben Doherty
699a578966 Add SSR variant filter to matc (#5256) 2022-02-24 10:36:06 -08:00
Philip Rideout
babbfa1394 Vulkan: remove layout checks from SwapChain.
These asserts will come back in the next Filament release, which has
much cleaner layout tracking.
2022-02-23 13:48:13 -08:00
Philip Rideout
73f0d58e10 Vulkan: fix backend tests (especially ReadPixels Y flip). 2022-02-23 11:18:29 -08:00
Philip Rideout
9cb4b74bbd Fix web apps that have multiple Filament viewers.
This fixes the emscripten binding errors that we've been seeing
with the <filament-viewer> test page, which prevented us from
including web in the last few Filament releases.

The binding errors were caused by double-initializing the emscripten
module.

I fixed this by allowing clients (e.g. FilamentViewer) to call
Filament.init() more than once. We now accumulate a list of "on ready"
callbacks that get triggered after the emscripten module becomes ready.

As far as I can tell, multiple canvases were actually always broken, and
the viewer test page worked in the past only because we got lucky.
2022-02-22 16:12:13 -08:00
Ben Doherty
f2c8456971 Attempt to fix Windows CI builds (#5205) 2022-02-15 11:12:19 -08:00
Benjamin Doherty
e571600c30 Bump version to 1.19.1 2022-02-14 13:48:59 -08:00
Benjamin Doherty
e84c94d3eb Merge branch 'rc/1.19.0' into release 2022-02-14 13:46:45 -08:00
Benjamin Doherty
e791d4818f Update RELEASE_NOTES for 1.19.0 2022-02-14 13:45:28 -08:00
Philip Rideout
cdadb43e50 WebGL: another fix for BufferDescriptor bindings.
The previous code would convert each element of the source data
into 8 bit-per-element, but we wnat to preserve the original format
that the user provides.

The new solution is to use `slice()` which is a robust way to clone
all the data in a typed array.

This fixes the new regression with Triangle that Ben caught.
2022-02-09 15:44:26 -08:00
Philip Rideout
edaff60fbf WebGL: remove buffer sharing optimization.
If emscripten grows the heap inside one of our BufferDescriptor binding
functions, then the old heap becomes "detached" and an error can
occur.

This fixes the issue seen with the Parquet demo that Ben caught.
2022-02-09 12:51:06 -08:00
Benjamin Doherty
3f64e46557 Bump version to 1.19.0 2022-02-08 09:27:14 -08:00
Benjamin Doherty
32dab23bc6 Update RELEASE_NOTES for 1.18.0 2022-02-08 09:25:41 -08:00
Benjamin Doherty
362de7dd31 Merge branch 'rc/1.18.0' into release 2022-02-08 09:22:21 -08:00
Benjamin Doherty
6b01fbb903 Correct version to 1.18.0 2022-02-08 09:08:49 -08:00
Philip Rideout
4934d9f7bc Vulkan: fix leak when apps do not draw anything. 2022-02-07 14:27:06 -08:00
Ben Doherty
ed73955b00 Initialize useLegacyMorphing to fix MSAN warning (#5164) 2022-02-07 11:28:03 -08:00
Ben Doherty
3f1f2726c4 Add a MAX_LEGACY_MORPH_TARGETS definition (#5163) 2022-02-07 11:27:45 -08:00
Philip Rideout
1a7bd7ea8d Rewrite VulkanPipelineCache (without changing its API).
All three types of caches (descriptor sets, pipelines, and pipeline
layouts) are now managed in exactly the same way. They all use an LRU
eviction scheme that is based on a count of command buffer flush
events.

Vulkan objects can only be destroyed if there are no in-flight command
buffers that reference them, so an easy way to know when it is safe to
evict a given entry is to wait for "N" flushes after its last use, where
"N" is the number of command buffers in the command buffer ring.

Another big simplification is that there are no more dirty flags,
instead we store two sets of state vectors for each type of cache: the
"currently bound" state, and the "current requirements" state.
2022-02-03 17:37:40 -08:00
Ben Doherty
946ea43436 Fix sampler overflow check in SamplerBindingMap (#5143) 2022-02-02 11:04:48 -08:00
Philip Rideout
7f42385f5f VulkanPipelineCache: fix spurious SEGV.
Fixes #5142 by replacing unsafe pointers with map keys.

One of the differences between robin_map and unordered_map is the
following:

    pointers to keys or values in the map are invalidated in the same
    way as iterators to these keys-values

Therefore it is unsafe to track the pointer to a value that is stored
in a robin_map.
2022-02-01 16:34:34 -08:00
Philip Rideout
8845ac2b75 VulkanPipelineCache: code cleanup and minor fixes.
This is mostly just code cleanup. One actual bug was the fact that the
dummy sampler was re-created every time a new pipeline layout was
created.

It also felt strange to use `auto&` to refer to a C-style array. I
changed this into a `std::array` which is more consistent with other
fixed size arrays in this class.
2022-02-01 16:34:27 -08:00
Ben Doherty
da85001d4d Support legacy morphing (#5129)
Support legacy morphing (morphing with targets supplied via VertexAttributes) for older clients. This gives clients more time to transition over to the new MorphTargetBuffer API.
2022-01-27 16:08:46 -08:00
Mathias Agopian
8d15079937 update material version to 18 2022-01-26 14:32:46 -08:00
daemyung jang
adc542b5cd Bind samplers to specified shader stages (#5036)
Co-authored-by: Ben Doherty <bendoherty@google.com>
Co-authored-by: Mathias Agopian <mathias@google.com>
2022-01-26 14:31:30 -08:00
Philip Rideout
72feb044a3 Vulkan now supports offsets when uploading texture data.
This allows `MorphStressTest` to work on Vulkan.

However, `Horse` is still broken because it provides positions but not
tangents.  Separate fix for that is coming.

Partial fix for #5109.
2022-01-26 14:31:00 -08:00
Philip Rideout
c0ba260ddf Vulkan: clean up image layout management.
This fixes validation errors and makes a first pass at simplification.
VulkanTexture now tracks image layout using RangeMap, which paves the
way for further simplification.
2022-01-26 14:30:45 -08:00
Philip Rideout
2da215e8e7 RangeMap: improve naming convention, etc. 2022-01-26 14:30:23 -08:00
Philip Rideout
4d0368b5f1 RangeMap: improve the auto-merge functionality. 2022-01-26 14:30:09 -08:00
Philip Rideout
d11c78857d utils: introduce RangeMap container and unit test.
This will allow the Vulkan backend to efficiently track the subresource
image layouts for each texture.

This is a sparse container for a series of ordered non-overlapping
integer intervals, where each interval maps to a concrete value.
2022-01-26 14:29:45 -08:00
Mathias Agopian
e829d90c4a A morphing buffer must be bound when skinning is active
This is because we're using the same program variant for skinning
and morphing, in the skinning-only case, the buffer won't be accessed
in the shader, but it must be present.

fixes #5085
2022-01-26 14:20:25 -08:00
Mathias Agopian
a8006acd33 [GL backend] fix sampler binding bug
When a program had an unused SamplerInterfaceBlock, other samplers
could be bound to the wrong TMU

Fixes #5088
2022-01-26 14:20:12 -08:00
Benjamin Doherty
86ec502040 Bump version to 1.17.1 2022-01-24 12:52:22 -08:00
Benjamin Doherty
b19a73cc50 Merge branch 'rc/1.17.0' into release 2022-01-24 12:50:22 -08:00
Benjamin Doherty
a99c695932 Update RELEASE_NOTES for 1.17.0 2022-01-24 12:45:05 -08:00
Benjamin Doherty
8cd720b53a Bump version to 1.17.0 2022-01-18 13:54:40 -08:00
Benjamin Doherty
04df79e58f Merge branch 'rc/1.16.1' into release 2022-01-18 13:53:02 -08:00
Benjamin Doherty
a4b3717762 Update RELEASE_NOTES for 1.16.1 2022-01-18 13:48:36 -08:00
Benjamin Doherty
1035e442ee Bump version to 1.16.1 2022-01-10 10:47:46 -08:00
Benjamin Doherty
60d3638f15 Merge branch 'rc/1.16.0' into release 2022-01-10 10:44:36 -08:00
Benjamin Doherty
3e7d3c9035 Update RELEASE_NOTES for 1.16.0 2022-01-10 10:41:14 -08:00
jeanlemotan
eb360be2ad Fixed cubemap update 2022-01-10 10:34:49 -08:00
Benjamin Doherty
485ac8704d Bump version to 1.16.0 2022-01-04 11:55:19 -08:00
Benjamin Doherty
dc74540423 Merge branch 'rc/1.15.2' into release 2022-01-04 11:53:02 -08:00
Benjamin Doherty
96219c22db Update RELEASE_NOTES for 1.15.2 2022-01-04 11:49:50 -08:00
Romain Guy
f3b7048775 Add missing JNI impl (#4959) 2022-01-04 11:43:19 -08:00
Romain Guy
aaed6fb376 Fix rounding math 2022-01-04 11:43:13 -08:00
Romain Guy
35a5d3310f Fix preprocessor test 2021-12-13 13:53:20 -07:00
Benjamin Doherty
9da79a1d2d Bump version to 1.15.2 2021-12-13 11:08:28 -07:00
Benjamin Doherty
595b355d1b Merge branch 'rc/1.15.1' into release 2021-12-13 11:06:45 -07:00
Benjamin Doherty
3a67d769f4 Update RELEASE_NOTES for 1.15.1 2021-12-06 16:54:28 -08:00
Benjamin Doherty
6fb536a937 Bump version to 1.15.1 2021-12-06 11:17:37 -08:00
Benjamin Doherty
bb460d78d8 Merge branch 'rc/1.15.0' into release 2021-12-06 11:14:00 -08:00
Benjamin Doherty
838835a715 Update RELEASE_NOTES for 1.15.0 2021-12-02 11:52:04 -08:00
Romain Guy
63acd53e23 Use __ANDROID__ instead of ANDROID 2021-11-30 11:15:49 -08:00
Romain Guy
fcd2d0457b Workaround for a build system issue 2021-11-30 11:15:42 -08:00
Benjamin Doherty
58fc26461b Bump version to 1.15.0 2021-11-29 14:08:28 -08:00
Benjamin Doherty
fd82f6b04e Merge branch 'rc/1.14.2' into release 2021-11-29 14:07:03 -08:00
Benjamin Doherty
cef3200533 Add additional RELEASE_NOTES for 1.14.2 2021-11-29 10:21:56 -08:00
Ben Doherty
634500c398 Fix, avoid divide-by-zero inside makeBone (#4889) 2021-11-24 16:29:33 -08:00
Ben Doherty
b3e294ac54 Fix Metal depth comparison initialization (#4886) 2021-11-23 12:09:43 -08:00
Benjamin Doherty
2bf7535ad0 Update RELEASE_NOTES for 1.14.2 2021-11-22 10:16:00 -08:00
Benjamin Doherty
3315f75de9 Bump version to 1.14.2 2021-11-22 10:12:44 -08:00
Benjamin Doherty
bbe7dbfa92 Merge branch 'rc/1.14.1' into release 2021-11-22 10:11:06 -08:00
Benjamin Doherty
5697922a65 Update RELEASE_NOTES for 1.14.1 2021-11-17 12:04:26 -08:00
Ben Doherty
4da83df2b9 Fix material compilation error with device vertex domain (#4865)
A recent refactor was causing the following error when the vertex domain
was set to `device`:
```
ERROR: main.vs:23: 'material' : undeclared identifier
ERROR: main.vs:23: 'materialVertex' : no matching overloaded function found
```
2021-11-17 12:03:55 -08:00
Ben Doherty
8f156d6588 Android: re-enable VSM cascade fix (#4863) 2021-11-17 10:19:09 -08:00
Benjamin Doherty
cec0871c11 Bump version to 1.14.1 2021-11-15 10:09:45 -08:00
Benjamin Doherty
41a809368b Merge branch 'rc/1.14.0' into release 2021-11-15 10:07:56 -08:00
Romain Guy
ea53eb9290 Skip task incompatible with configuration caching (#4831) 2021-11-09 15:56:00 -08:00
Benjamin Doherty
05875057c9 Update RELEASE_NOTES for 1.14.0 2021-11-09 15:51:13 -08:00
Benjamin Doherty
44125926d1 Disable configuration-cache 2021-11-08 17:05:34 -08:00
Benjamin Doherty
60734349de Bump version to 1.14.0 2021-11-08 11:52:50 -08:00
Benjamin Doherty
fbfd5ec0ec Merge branch 'rc/1.13.0' into release 2021-11-08 11:50:19 -08:00
Ben Doherty
a74a95cc65 Call VirtualMachineEnv::JNI_OnLoad for non-Android Java builds (better fix) (#4779) 2021-11-04 13:28:17 -07:00
Benjamin Doherty
bc0ea16ff0 Update RELEASE_NOTES for 1.13.0 2021-11-02 13:15:53 -07:00
Mathias Agopian
b2dc8aa84c Fix typo that broke the directional shadowmap 2021-11-02 13:11:44 -07:00
Benjamin Doherty
9987e8b6ab Bump version to 1.13.0 2021-11-01 14:59:11 -07:00
Benjamin Doherty
0d9bdcc008 Merge branch 'rc/1.12.11' into release 2021-11-01 14:55:58 -07:00
Benjamin Doherty
b5c634045e Update RELEASE_NOTES for 1.12.11 2021-10-28 16:13:50 -07:00
Ben Doherty
1f05531d53 Call VirtualMachineEnv::JNI_OnLoad for non-Android Java builds (better fix) (#4779) 2021-10-28 16:02:23 -07:00
Benjamin Doherty
88f382f0e3 Revert "refactor colorgrading materials"
This reverts commit fb86a77cf8.
2021-10-28 15:56:50 -07:00
Benjamin Doherty
3e59925900 Remove problematic configuration-cache setting for release build 2021-10-28 15:56:26 -07:00
Benjamin Doherty
ea404f8d4f Remove problematic configuration-cache setting for release build 2021-10-26 10:09:51 -07:00
Benjamin Doherty
602a550d93 Bump version to 1.12.11 2021-10-25 12:30:37 -07:00
Benjamin Doherty
12abbe2d23 Merge branch 'rc/1.12.10' into release 2021-10-25 11:06:18 -07:00
Benjamin Doherty
fb0ee97588 Update RELEASE_NOTES for 1.12.10 2021-10-25 11:00:06 -07:00
Ben Doherty
56ef48c9c3 Fix, call VirtualMachineEnv::JNI_OnLoad for non-Android Java builds (#4749) 2021-10-25 10:39:24 -07:00
Benjamin Doherty
47c3dd3dd1 Revert "refactor colorgrading materials"
This reverts commit fb86a77cf8.
2021-10-25 10:37:52 -07:00
Benjamin Doherty
c181648bfa Bump version to 1.12.10 2021-10-20 12:15:51 -07:00
Benjamin Doherty
0cf78b3abe Merge branch 'rc/1.12.9' into release 2021-10-20 12:12:33 -07:00
Ben Doherty
22889a7ad9 Fix VirtualMachineEnv.cpp with older JNI versions (#4752) 2021-10-20 11:16:55 -07:00
Ben Doherty
a14451d0ac Fix, call VirtualMachineEnv::JNI_OnLoad for non-Android Java builds (#4749) 2021-10-20 10:41:34 -07:00
Benjamin Doherty
5dfdab10b7 Revert "refactor colorgrading materials"
This reverts commit fb86a77cf8.
2021-10-19 16:13:21 -07:00
Benjamin Doherty
d6f2e3b8e9 Update RELEASE_NOTES for 1.12.9 2021-10-14 18:22:20 -07:00
Benjamin Doherty
df30517743 Bump version to 1.12.9 2021-10-11 11:06:43 -07:00
Benjamin Doherty
8f80643c1a Merge branch 'rc/1.12.8' into release 2021-10-11 11:02:56 -07:00
Benjamin Doherty
5aea9be2fb Update RELEASE_NOTES for 1.12.8 2021-10-07 11:03:45 -07:00
Benjamin Doherty
ad02e483d0 Bump version to 1.12.8 2021-10-04 10:26:57 -07:00
Benjamin Doherty
f463d53036 Merge branch 'rc/1.12.7' into release 2021-10-04 10:21:42 -07:00
Benjamin Doherty
b8d4408524 Update RELEASE_NOTES for 1.12.7 2021-10-04 10:18:56 -07:00
Benjamin Doherty
fef70be848 Bump version to 1.12.7 2021-09-27 11:15:58 -07:00
Benjamin Doherty
bdb12d9b24 Merge branch 'rc/1.12.6' into release 2021-09-27 11:12:42 -07:00
Ben Doherty
43ad283a83 Fix, missing call to setTransparencyMode (#4674) 2021-09-24 13:32:49 -07:00
Benjamin Doherty
2e4936afc4 Revert "fix a race in jobsystem"
This reverts commit 2feb0ad325.
2021-09-24 11:24:44 -07:00
Benjamin Doherty
891ffabd11 Update RELEASE_NOTES for 1.12.6 2021-09-23 17:25:25 -07:00
Ben Doherty
e2c19498b4 Metal: don't call createTextureViewWithsSwizzle directly (#4662) 2021-09-23 11:28:04 -07:00
Ben Doherty
c32630b265 Fix MetalBlitter crash when shader contains warnings (#4663) 2021-09-23 11:27:56 -07:00
Alexey Pelykh
bf21e78d02 Podspec: include headers in nested directories (#4658) 2021-09-22 16:48:12 -07:00
Benjamin Doherty
525d4e08a3 Bump version to 1.12.6 2021-09-20 10:17:18 -07:00
Benjamin Doherty
2e9bf6d694 Merge branch 'rc/1.12.5' into release 2021-09-20 10:14:37 -07:00
Benjamin Doherty
e845f01d85 Update RELEASE_NOTES for 1.12.5 2021-09-20 10:10:56 -07:00
Benjamin Doherty
bef48be7b4 Bump version to 1.12.5 2021-09-13 10:47:09 -07:00
Benjamin Doherty
b54fdc9e6e Merge branch 'rc/1.12.4' into release 2021-09-13 10:43:06 -07:00
Benjamin Doherty
cedbf2e30b Update RELEASE_NOTES for 1.12.4 2021-09-13 10:40:55 -07:00
Benjamin Doherty
592f8d1b0d Bump version to 1.12.4 2021-09-08 11:05:44 -07:00
Benjamin Doherty
29612a684e Merge branch 'rc/1.12.3' into release 2021-09-08 11:03:53 -07:00
Benjamin Doherty
e6d5807399 Bump version to 1.12.3 2021-08-30 11:46:51 -07:00
Benjamin Doherty
fa2553251f Merge branch 'rc/1.12.2' into release 2021-08-30 11:44:00 -07:00
Benjamin Doherty
7387718852 Update RELEASE_NOTES for 1.12.2 2021-08-30 11:41:52 -07:00
Ben Doherty
a503a6209a Fix regression with clipSpaceTransform (#4552) 2021-08-26 14:14:58 -07:00
Ben Doherty
ce3e5f74e8 Fix Metal STREAM buffers (#4543) 2021-08-25 09:48:34 -07:00
Ben Doherty
f37112358e Fix missing bookkeeping in bindUniformBufferRange (#4538) 2021-08-24 09:51:40 -07:00
Benjamin Doherty
f368b14621 Bump version to 1.12.2 2021-08-23 12:41:33 -07:00
Benjamin Doherty
6960b1148a Merge branch 'rc/1.12.1' into release 2021-08-23 12:39:38 -07:00
Benjamin Doherty
3cc23aac25 Update RELEASE_NOTES for 1.12.1 2021-08-23 10:45:59 -07:00
Benjamin Doherty
11dc8740f2 Fix stack-use-after-scope error 2021-08-20 15:40:06 -07:00
Ben Doherty
4b797cff88 Windows: fix incorrect CRT flags with Visual Studio generators (#4516) 2021-08-20 10:56:41 -07:00
Ben Doherty
fe1c1736cd Fix, potential null dereferences in MetalBlitter (#4481) 2021-08-10 16:30:11 -07:00
Benjamin Doherty
4058ef5f09 Bump version to 1.12.1 2021-08-09 12:06:47 -07:00
Benjamin Doherty
d25ca01624 Merge branch 'rc/1.12.0' into release 2021-08-09 12:03:33 -07:00
Benjamin Doherty
d96f87dbbf Update RELEASE_NOTES for 1.12.0 2021-08-09 12:01:46 -07:00
Ben Doherty
8a2e31023f Attempt to fix TSAN failure in ColorGrading.cpp (#4447) 2021-08-05 11:54:07 -07:00
Benjamin Doherty
1ea8e171d9 Bump version to 1.12.0 2021-08-03 11:18:56 -07:00
Benjamin Doherty
e2be3dd0ac Merge branch 'rc/1.11.2' into release 2021-08-03 11:15:19 -07:00
Romain Guy
1c51164e7b Fix inverse tone mapping issues (#4437)
Bring color grading back into the Rec.709 color space to match
previous behaviors. This change also implements an exact inverse
tone map function for the "Filmic" operator.
2021-08-02 20:54:44 -07:00
Benjamin Doherty
f190f03530 Update RELEASE_NOTES for 1.11.2 2021-08-02 11:17:42 -07:00
Ben Doherty
055fc7cbc1 Attempt to fix Windows CI by turning off concurrent builds (#4395) 2021-07-30 14:09:07 -07:00
Ben Doherty
9073fc3dc3 Attempt to fix Windows CI by turning off concurrent builds (#4395) 2021-07-28 10:49:37 -07:00
Ben Doherty
2409dc9bc4 Expose Engine::flush (#4385) 2021-07-26 15:09:14 -07:00
Benjamin Doherty
6586c8d70b Bump version to 1.11.2 2021-07-26 12:50:29 -07:00
Benjamin Doherty
ac0c94da69 Merge branch 'rc/1.11.1' into release 2021-07-26 12:48:36 -07:00
Ben Doherty
d19d6a72b0 Expose Engine::flush (#4385) 2021-07-26 12:10:19 -07:00
Benjamin Doherty
c81b5d98ef Update RELEASE_NOTES for 1.11.1 2021-07-26 10:05:41 -07:00
Mathias Agopian
756866675f fix an issue where a sampler could fail to be updated
SamplerGroup was comparing texture handles to decide if a texture needed
to be updated, however, texture handles are (quickly) recycled and
therefore can't be used for that purpose. e.g. if a texture is destroyed,
its handle could be reused quickly by another texture, if that texture 
is now set on the SamplerGroup, it will ignore it, thinking it's not
different.
2021-07-21 14:46:44 -07:00
Benjamin Doherty
ebcd4925f7 Bump version to 1.11.1 2021-07-19 10:24:01 -07:00
Benjamin Doherty
13bed4fdf9 Merge branch 'rc/1.11.0' into release 2021-07-19 10:20:29 -07:00
Benjamin Doherty
1dae5c6b6c Update RELEASE_NOTES for 1.11.0 2021-07-19 10:18:07 -07:00
Benjamin Doherty
8e6663e4b0 Bump version to 1.11.0 2021-07-12 10:49:43 -07:00
Benjamin Doherty
ba804444b8 Merge branch 'rc/1.10.7' into release 2021-07-12 10:47:12 -07:00
Benjamin Doherty
58cfb85004 Update RELEASE_NOTES for 1.10.7 2021-07-12 10:45:24 -07:00
Mathias Agopian
ab46481b45 Fix colorgrading as subpass
We were inserting the colorgrading subpass command between the
refracted and blended objects, instead of after all of them.

Another bad side effect of this was to trigger the refraction pass for
no reason.
2021-07-12 10:35:01 -07:00
Mathias Agopian
4296782399 don't crash when refraction pass is empty 2021-07-12 09:53:37 -07:00
Benjamin Doherty
ef375a7103 Bump version to 1.10.7 2021-07-07 11:02:30 -07:00
Benjamin Doherty
fd258b7765 Merge branch 'rc/1.10.6' into release 2021-07-07 10:59:12 -07:00
Benjamin Doherty
147de8d372 Update RELEASE_NOTES for 1.10.6 2021-07-07 10:57:25 -07:00
Philip Rideout
eb2a1928b6 ShadowMapManager: fix MSAN use-of-uninitialized-value.
The operator!= in std::array compares SPLIT_COUNT elements, which
is potentially greater than cascadeCount, which was the number of
initialized elements in splitPercentages.
2021-07-07 10:51:18 -07:00
Benjamin Doherty
35b033102f Bump version to 1.10.6 2021-06-28 12:07:58 -07:00
Benjamin Doherty
7bc65421a9 Merge branch 'rc/1.10.5' into release 2021-06-28 12:04:31 -07:00
Benjamin Doherty
736514cf37 Update RELEASE_NOTES for 1.10.5 2021-06-28 12:04:27 -07:00
Mathias Agopian
db0158dae8 fix webgl build
we need to select opengl on webgl.
2021-06-28 08:27:46 -07:00
Benjamin Doherty
e706695ed1 Bump version to 1.10.5 2021-06-21 11:18:26 -07:00
Benjamin Doherty
e8877ffe2d Merge branch 'rc/1.10.4' into release 2021-06-21 11:16:10 -07:00
Benjamin Doherty
1fd5d9dae6 Update RELEASE_NOTES for 1.10.4 2021-06-21 11:14:35 -07:00
Ben Doherty
cd48089318 filament-utils-android: fix string literal conversions (#4137) 2021-06-15 16:19:32 -06:00
Benjamin Doherty
6379ab22c9 Bump version to 1.10.4 2021-06-14 11:06:42 -06:00
Benjamin Doherty
0bf02b75d5 Merge branch 'rc/1.10.3' into release 2021-06-14 11:04:25 -06:00
Benjamin Doherty
c4259b5598 Update RELEASE_NOTES for 1.10.3 2021-06-14 11:02:45 -06:00
Ben Doherty
6b3c1179bc Include sample-gltf-viewer with Android releases (#4099) 2021-06-08 10:41:48 -07:00
Philip Rideout
c1a0e61e8e Fix FixedCapacityVector destructor.
std::allocator::deallocate() expects the same value that was given
during allocate().

Interestingly, this bug did not manifest any issues (even with ASAN) on
some platforms.
2021-06-07 15:56:33 -07:00
Benjamin Doherty
fc06298ed4 Bump version to 1.10.3 2021-06-07 11:22:04 -07:00
Benjamin Doherty
4ca87b188c Merge branch 'rc/1.10.2' into release 2021-06-07 11:19:51 -07:00
Benjamin Doherty
f1f60c3e0d Turn off warnings as errors for spirv-tools 2021-06-07 11:18:56 -07:00
Benjamin Doherty
76d21b56af Update RELEASE_NOTES for 1.10.2 2021-06-07 11:18:09 -07:00
Benjamin Doherty
0ab0e50a4f Turn off warnings as errors for spirv-tools 2021-06-02 11:16:42 -07:00
Benjamin Doherty
34f4c06a5c Bump version to 1.10.2 2021-06-01 11:17:32 -07:00
Benjamin Doherty
6de36f1e53 Merge branch 'rc/1.10.1' into release 2021-06-01 11:15:49 -07:00
Benjamin Doherty
2a9a3b1ac2 Update RELEASE_NOTES for 1.10.1 2021-06-01 11:13:04 -07:00
Benjamin Doherty
84b73a3770 Bump version to 1.10.1 2021-05-24 10:52:02 -07:00
Benjamin Doherty
662a10e273 Merge branch 'rc/1.10.0' into release 2021-05-24 10:49:10 -07:00
Benjamin Doherty
ecce02502e Update RELEASE_NOTES for 1.10.0 2021-05-24 10:47:39 -07:00
Philip Rideout
d17875aea1 ImGuiHelper: fix support for custom images.
The texture binding in the material instance needs to be restored to the
glyph atlas when a custom image is not in use.
2021-05-21 12:49:37 -07:00
Philip Rideout
b8897a68f9 matc: detect missing end brace.
matc was failing to report certain kinds of syntax errors and would
read out-of-bounds memory.

This change casuses the flare material to fail.
2021-05-21 09:20:33 -07:00
Ben Doherty
84efd4871e API CHANGE: remove some Camera, Engine, and View deprecated APIs (#3965) 2021-05-19 12:02:13 -07:00
Benjamin Doherty
85ea5a6b70 Bump version to 1.10.0 2021-05-17 11:00:42 -07:00
Benjamin Doherty
77891acb92 Merge branch 'rc/1.9.25' into release 2021-05-17 10:57:30 -07:00
Benjamin Doherty
74fe102035 Update RELEASE_NOTES for 1.9.25 2021-05-17 10:54:38 -07:00
Philip Rideout
25cc554925 WASM: fix "Missing field" error for lensFlare. 2021-05-17 10:06:56 -07:00
Ben Doherty
d787a521b5 Fix DIST_DIR setting for Windows builds (#3945) 2021-05-12 11:16:30 -07:00
Ben Doherty
46e52c71e1 Fix DIST_DIR setting for Windows builds (#3945) 2021-05-12 11:15:49 -07:00
Philip Rideout
1dad27a172 Repair WebGL and fix potential INVALID_OPERATION.
We should take care not to call glVertexAttribPointer when there is
no bound ARRAY_BUFFER (i.e. when its binding is zero).

This fixes the black screen seen with some WebGL samples after
the recent memory leak fix related to the new BufferObject API.
2021-05-10 13:38:56 -07:00
Benjamin Doherty
60d230b380 Bump version to 1.9.25 2021-05-07 21:42:48 -07:00
Benjamin Doherty
d7cb38e706 Merge branch 'rc/1.9.24' into release 2021-05-07 21:39:17 -07:00
Benjamin Doherty
ce00cca6ee Update RELEASE_NOTES for 1.9.24 2021-05-07 21:36:49 -07:00
Philip Rideout
d627d57bad Second memory leak fix. (#3906)
Fixes #3888.
2021-05-06 14:25:46 -07:00
Philip Rideout
8ffc776f1c Fix horrible memory leak in the GL driver. (#3894)
This leak was introduced in the following PR on April 7.
https://github.com/google/filament/pull/3775

The guilty party has been contacted and properly admonished for his
transgression.

This was tested by adding the following code after applyAnimation in
gltf_viewer.cpp

        static int nframes = 0;
        if (!gpath.empty() && nframes++ > 100) {
            static int count = 0;
            printf("reloading %d\n", count++);
            nframes = 0;
            app.resourceLoader->asyncCancelLoad();
            app.resourceLoader->evictResourceData();
            app.viewer->removeAsset();
            app.assetLoader->destroyAsset(app.asset);
            loadAsset(gpath, app);
            loadResources(gpath, app);
        }
2021-05-04 18:22:08 -07:00
Benjamin Doherty
be032b52c1 Bump version to 1.9.24 2021-05-03 10:42:19 -07:00
Benjamin Doherty
4388e81e5f Merge branch 'rc/1.9.23' into release 2021-05-03 10:40:49 -07:00
Benjamin Doherty
71a185d139 Update RELEASE_NOTES for 1.9.23 2021-05-03 10:38:59 -07:00
Benjamin Doherty
d2cf5985ac Bump version to 1.9.23 2021-04-26 10:55:10 -07:00
Benjamin Doherty
debcbb8e5c Merge branch 'rc/1.9.22' into release 2021-04-26 10:52:43 -07:00
Benjamin Doherty
b9dd62c7d3 Update RELEASE_NOTES for 1.9.22 2021-04-26 10:47:11 -07:00
Benjamin Doherty
dc2b430f34 Bump version to 1.9.22 2021-04-26 10:39:16 -07:00
Benjamin Doherty
e5ef4e8868 Update RELEASE_NOTES for 1.9.21 2021-04-19 11:36:37 -07:00
Benjamin Doherty
c0d6cd3ac3 Merge branch 'rc/1.9.21' into release 2021-04-19 11:34:23 -07:00
Benjamin Doherty
b63ab2dc19 Update RELEASE_NOTES for 1.9.21 2021-04-19 11:32:31 -07:00
Benjamin Doherty
5d8dad561c Bump version to 1.9.21 2021-04-12 11:38:27 -07:00
Benjamin Doherty
8933be1ae2 Merge branch 'rc/1.9.20' into release 2021-04-12 11:36:17 -07:00
Benjamin Doherty
6b66b48b1d Update RELEASE_NOTES for 1.9.20 2021-04-12 11:35:45 -07:00
Benjamin Doherty
9c23eb6e33 Release Filament 1.9.20 2021-04-12 11:34:39 -07:00
Benjamin Doherty
baea54a3fc Update RELEASE_NOTES for 1.9.20 2021-04-12 09:20:31 -07:00
Benjamin Doherty
d9f800454c Bump version to 1.9.20 2021-04-05 11:14:17 -07:00
Benjamin Doherty
f9ee0de07a Merge branch 'rc/1.9.19' into release 2021-04-05 11:11:13 -07:00
Benjamin Doherty
2786d0a9f7 Update RELEASE_NOTES for 1.9.19 2021-04-05 11:10:50 -07:00
Benjamin Doherty
491e8032e6 Release Filament 1.9.19 2021-04-05 11:10:20 -07:00
Benjamin Doherty
ef3f13f5d3 Update RELEASE_NOTES for 1.9.19 2021-04-05 11:09:38 -07:00
Benjamin Doherty
bcb5b2d790 Implement Metal BufferObjects 2021-04-05 11:01:36 -07:00
Ben Doherty
02de3f2e2a Fix, regression with Metal buffers (#3715) 2021-03-29 14:21:34 -07:00
Benjamin Doherty
0e7bb53c07 Bump version to 1.9.19 2021-03-29 11:09:32 -07:00
Benjamin Doherty
759109d478 Merge branch 'rc/1.9.18' into release 2021-03-29 11:06:55 -07:00
Benjamin Doherty
54d5af6edf Update RELEASE_NOTES for 1.9.18 2021-03-29 11:04:57 -07:00
Philip Rideout
38fbe47ced RenderTarget: fix NPE when depth is not present.
This fixes a recent regression that would occur when a RenderTarget
does not have a depth attachment.
2021-03-29 10:32:22 -07:00
Benjamin Doherty
f066c925ba Bump version to 1.9.18 2021-03-22 10:16:34 -07:00
Benjamin Doherty
994fdf4e1d Merge branch 'rc/1.9.17' into release 2021-03-22 10:12:20 -07:00
Benjamin Doherty
50b50d65e3 Update RELEASE_NOTES for 1.9.17 2021-03-22 10:11:02 -07:00
Mathias Agopian
0aaa985649 Fix a hang in JobSystem
The hang was caused by a subtle race. When a job is completed, its 
thread must signal all the threads that might be waiting on this job.
The signaling code was attempting to signal only the minimum number
of threads -- this was important especially in the case where no threads
were waiting, then the call to notify() could be avoided.

Unfortunately, for performance reasons we're not calling notify() with
the condition lock held, this meant that between the time the number of 
waiting threads was latched and the time of the notify() call, more
threads could enter their condition variable wait(), and it would
then be possible for these threads to wake up, instead of the thread
we were trying to wake up (the one waiting on the job).

It would then get stuck forever.

This bug was introduced in 2df639133b


Also add some debugging code for this kind of failure (disabled)
2021-03-18 09:57:25 -07:00
Benjamin Doherty
29564f8eae Bump version to 1.9.17 2021-03-15 10:15:25 -07:00
Benjamin Doherty
c15db68a5b Merge branch 'rc/1.9.16' into release 2021-03-15 10:12:56 -07:00
Benjamin Doherty
3452fb3e56 Update RELEASE_NOTES for 1.9.16 2021-03-15 10:10:40 -07:00
Mathias Agopian
35eb8e7be1 Revert GL backend handle tracking
This wasn't very useful in the first place because we're recycling
handles very quickly. Additionally there was a race condition
which cause false positives.

This reverts commit bc6acd5c5a.
This reverts commit 3a15756c78.
2021-03-12 13:02:55 -08:00
Mathias Agopian
834b774128 Fixes some issues with imported rendertargets
We were not declaring the attachments it was using.

Fixes #3628
2021-03-12 08:26:16 -08:00
Benjamin Doherty
5aa0eb9f9d Bump version to 1.9.16 2021-03-08 10:09:14 -08:00
Benjamin Doherty
d9a6e2e649 Merge branch 'rc/1.9.15' into release 2021-03-08 10:07:00 -08:00
Benjamin Doherty
cb823b16a1 Update RELEASE_NOTES for 1.9.15 2021-03-08 10:05:19 -08:00
Ben Doherty
0bd41e877e Downgrade Linux GitHub Actions environment to fix error (#3588) 2021-03-01 11:21:11 -08:00
Benjamin Doherty
ecc3e73967 Bump version to 1.9.15 2021-03-01 11:13:44 -08:00
Benjamin Doherty
464b4c24f9 Merge branch 'rc/1.9.14' into release 2021-03-01 11:11:53 -08:00
Benjamin Doherty
32367516e8 Update RELEASE_NOTES for 1.9.14 2021-03-01 11:10:06 -08:00
Philip Rideout
1709a55606 filamat: Fix data race with SPIRV error registrations. 2021-02-26 10:34:36 -08:00
Benjamin Doherty
58b4455979 Bump version to 1.9.14 2021-02-22 10:32:56 -08:00
Benjamin Doherty
ea1dede19c Merge branch 'rc/1.9.13' into release 2021-02-22 10:29:57 -08:00
Benjamin Doherty
20ea3381fa Update RELEASE_NOTES for 1.9.13 2021-02-22 10:28:21 -08:00
Philip Rideout
7aa6fccd7c Modernize Python print syntax to appease external codebase. 2021-02-19 11:38:18 -08:00
Philip Rideout
adbd54f4f8 Change abs() to std::abs to appease external codebase. 2021-02-19 11:38:18 -08:00
Philip Rideout
9d54261f18 Move vk_mem_alloc to its own cpp.
This will improve parity between the GitHub repo and its sister codebase
within Google.
2021-02-19 11:38:18 -08:00
Philip Rideout
a97757c9ae Avoid uninitialized reads in computeVisibilityMasks.
I verified that this code is not enabled in our GitHub builds, and I
verified that the MSAN error goes away.
2021-02-19 11:38:18 -08:00
Philip Rideout
7c79d9f89d Remove some Windows line endings.
These line endings cause annoying diffs when comparing Filament's GitHub
source with its twin sister within Google.
2021-02-19 11:38:18 -08:00
Benjamin Doherty
bf0914f813 Bump version to 1.9.13 2021-02-16 10:48:24 -08:00
Benjamin Doherty
b96bc30fbd Merge branch 'rc/1.9.12' into release 2021-02-16 10:44:13 -08:00
Benjamin Doherty
62b50eb8ba Update RELEASE_NOTES for 1.9.12 2021-02-16 10:42:41 -08:00
Ben Doherty
b4932e384a matc: Use consistent params for semantic code analysis (#3524)
When running semantic analysis on a material, we were arbitrarily choosing the first code gen permutation to analyze. So, running matc with arguments --api metal versus --api all would run analysis on slightly different shader code. This causes bugs when flags passed to glslang differ during semantic analysis. This change updates all semantic analysis to always use the same shader code.
2021-02-08 14:06:47 -08:00
Benjamin Doherty
5e68dc5f8d Bump version to 1.9.12 2021-02-08 09:58:15 -08:00
Benjamin Doherty
f222f1b925 Merge branch 'rc/1.9.11' into release 2021-02-08 09:51:08 -08:00
Ben Doherty
22e4a54782 Update RELEASE_NOTES for 1.9.11 2021-02-08 09:50:23 -08:00
Benjamin Doherty
1289922c5f Release Filament 1.9.11 2021-02-08 09:48:50 -08:00
Ben Doherty
2839c352b8 Update RELEASE_NOTES for 1.9.11 2021-02-08 09:47:18 -08:00
Ben Doherty
6a01cbc312 Draft: fix TSAN issue by using lock in ColorGrading constructor (#3510)
This is a second attempt to fix Google3 TSAN failures seen inside of the ColorGrading constructor.

Related first attempt: #3462
2021-02-05 14:06:40 -08:00
Benjamin Doherty
6193156556 Bump version to 1.9.11 2021-02-01 11:49:12 -08:00
Benjamin Doherty
fe23aa917d Merge branch 'rc/1.9.10' into release 2021-02-01 11:45:47 -08:00
Benjamin Doherty
eb8a29a332 Update RELEASE_NOTES for 1.9.10 2021-02-01 11:45:17 -08:00
Ben Doherty
0626902530 Fix sporatic data race warning seen in Google3 (#3462) 2021-01-27 16:40:16 -08:00
Philip Rideout
042bfe2597 Partial fix for MSVC build. 2020-12-14 12:15:06 -08:00
Ben Doherty
97133f3591 Fix Windows iterator issue in Zip2Iterator and StructureOfArrays (#3322) 2020-12-14 12:14:53 -08:00
Philip Rideout
d06cc4390e filamat: minify struct fields.
This shrinks the arm64 so file by 24 KiB.
2020-12-14 11:19:43 -08:00
Philip Rideout
6047d3235f Remove VSM variant from Skybox material. 2020-12-14 11:19:31 -08:00
Philip Rideout
2cda6e35bd math: reduce template bloat for matrices
This does not change our API, it merely reduces the number of
non-inlined function instantiations appearing in non-optimized binaries.
2020-12-14 11:19:22 -08:00
Philip Rideout
8f8d51e17b Code review fixups for libibl_lite. 2020-12-14 11:19:16 -08:00
Philip Rideout
6919e3b274 libibl: use C callback for progress 2020-12-14 11:19:09 -08:00
Philip Rideout
10bf944410 Add libibl_lite. 2020-12-14 11:19:03 -08:00
Philip Rideout
9a2f6fdb53 Vulkan: change vkWaitForFences usage for SwiftShader.
When passing only 1 fence to vkWaitForFences, the `waitAll` argument
should not have any effect, but SwiftShader seems to skip the wait
when this argument is set to VK_FALSE.

More specifically, the failure to wait in `acquireWorkCommandBuffer`
causes the subsequent destruction of an in-use fence, which causes
a TSAN failure with Google's internal tests.

I am consulting with the SwiftShader team on a real fix, meanwhile
we can commit this easy workaround.

We have 5 usages of vkWaitForFences, one of which uses multiple fences
and should have used VK_TRUE anyway.
2020-11-20 09:37:54 -08:00
Philip Rideout
761977d385 Filament should always bind an IBL texture.
This prevents a SwiftShader crash and/or a slew of "no texture bound"
warnings that would appear when the client provides an IBL without
providing reflections texture, which should be a valid thing to do.

Note that it is okay to declare a sampler in GLSL that never gets bound,
as long as it is never sampled from. Since we always sample from the
IBL specular texture, we should always bind something to it.
2020-11-19 13:28:19 -08:00
Ben Doherty
21248f15b5 Fix, matc crash when building mobile materials (#3296) 2020-11-16 14:37:55 -08:00
Benjamin Doherty
4f32817f6d Bump version to 1.9.10 2020-11-16 12:37:49 -08:00
Benjamin Doherty
cc9e05e711 Merge branch 'rc/1.9.9' into release 2020-11-16 12:34:13 -08:00
Benjamin Doherty
419d68d4db Update RELEASE_NOTES for 1.9.9 2020-11-16 12:17:02 -08:00
Philip Rideout
8450232448 Improve the "unbound texture" warnings.
With Vulkan, this warning would sometimes be a false positive. It could
trigger for internal samplers like `ssao` and `structure`, even though
they were not declared in SPIR-V.

With OpenGL, this warning would never be a false positive because it has
the luxury of calling `glGetUniformLocation`.

This adds a private attribute to our samplers called `strict` that
indicates whether or not a sampler should always have a bound texture.
For now the only strict samplers are the custom ones declared in the
user's material.

At some point I think we should consider adding `spirv-reflect` to our
tree to help with problems like this.
2020-11-12 16:21:13 -08:00
Philip Rideout
cc51726590 Vulkan: improve robustness by providing 1x1 fallback. 2020-11-12 10:36:13 -08:00
Philip Rideout
318e22af51 Fix clear behavior with RenderTarget API.
This fixes a bug seen with client applications that use ClearOptions
instead of Skybox, and one or more offscreen RenderTarget objects.
These apps would see junk pixels because Filament would only clear the
first render target in the frame.

The fix is to factor some the flag-setting logic in `beginFrame()` into
a private method, and call this method from `render()` each time
the user-level RenderTarget has been changed.

I wrote a simple C++ demo to reproduce the issue and to verify that
this fix works.
2020-11-11 09:25:36 -08:00
Philip Rideout
68ac87dc24 NOOP backend should not care about GLSL vs SPIRV.
This fixes errors that would occur when using the NOOP backend with
materials that were built without OpenGL support.
2020-11-10 15:44:01 -08:00
Benjamin Doherty
acb8f00075 Bump version to 1.9.9 2020-11-09 09:32:55 -08:00
Benjamin Doherty
06d9183aaa Merge branch 'rc/1.9.8' into release 2020-11-09 09:28:58 -08:00
Benjamin Doherty
75af25419d Update RELEASE_NOTES for 1.9.8 2020-11-09 09:26:27 -08:00
Benjamin Doherty
f6b90d2a31 Bump version to 1.9.8 2020-11-09 09:21:36 -08:00
Philip Rideout
a3822f4af0 Fix FENCE_WAIT_FOR_EVER in Linux.
The number of infinite nanoseconds was negative because we asked
chrono for a signed integer, so "wait forever" really meant "do not
wait at all".
2020-11-02 16:12:53 -08:00
Benjamin Doherty
bcdad769ff Merge branch 'rc/1.9.7' into release 2020-11-02 11:03:57 -07:00
Benjamin Doherty
be4fb4fdbb Update RELEASE_NOTES for 1.9.7 2020-11-02 10:59:19 -07:00
Benjamin Doherty
65394f6301 Bump version to 1.9.7 2020-10-26 11:34:20 -06:00
Benjamin Doherty
b0beee03bc Merge branch 'rc/1.9.6' into release 2020-10-26 11:29:45 -06:00
Benjamin Doherty
fe1de41b8e Update RELEASE_NOTES for 1.9.6 2020-10-26 11:25:31 -06:00
Benjamin Doherty
a37b431e87 Bump version to 1.9.6 2020-10-19 11:55:13 -06:00
Benjamin Doherty
98107016b9 Merge branch 'rc/1.9.5' into release 2020-10-19 11:51:30 -06:00
Benjamin Doherty
8bccfc2863 Update RELEASE_NOTES for 1.9.5 2020-10-19 11:49:05 -06:00
Benjamin Doherty
f54a0a3452 Fix CocoaPod version 2020-10-13 15:15:02 -06:00
Benjamin Doherty
6778ab0624 Fix CocoaPod version 2020-10-13 15:09:59 -06:00
Benjamin Doherty
269d636785 Bump version to 1.9.5 2020-10-12 12:03:29 -06:00
Benjamin Doherty
39862c91ce Merge branch 'rc/1.9.4' into release 2020-10-12 11:56:24 -06:00
Benjamin Doherty
523f4026b4 Update RELEASE_NOTES for 1.9.4 2020-10-12 11:52:01 -06:00
Benjamin Doherty
a6bf162431 Bump version to 1.9.4 2020-10-07 16:06:23 -06:00
Benjamin Doherty
826e8d181c Merge branch 'rc/1.9.3' into release 2020-10-05 11:36:16 -06:00
Benjamin Doherty
16dfadbba0 Update RELEASE_NOTES for 1.9.3 2020-10-05 11:29:36 -06:00
Benjamin Doherty
5cbb97551f Bump version to 1.9.3 2020-09-28 11:40:31 -06:00
Benjamin Doherty
defee767c3 Merge branch 'rc/1.9.2' into release 2020-09-28 11:27:47 -06:00
Benjamin Doherty
9560318521 Update RELEASE_NOTES for 1.9.2 2020-09-28 11:26:21 -06:00
Benjamin Doherty
ef09feb048 Bump version to 1.9.2 2020-09-21 11:16:53 -06:00
Benjamin Doherty
39f323fe09 Merge branch 'rc/1.9.1' into release 2020-09-21 11:00:07 -06:00
Benjamin Doherty
11b95304ea Merge branch 'release' into rc/1.9.1 2020-09-21 10:59:52 -06:00
Benjamin Doherty
b7c30a7916 Update RELEASE_NOTES for 1.9.1 2020-09-21 10:59:06 -06:00
Benjamin Doherty
4cae48fc77 Bump version to 1.9.1 2020-09-14 11:51:36 -07:00
Benjamin Doherty
d1a93f0557 Update release notes for 1.9.0 2020-09-14 10:54:28 -07:00
Benjamin Doherty
b93059fad7 Bump version to 1.9.0 2020-09-08 10:47:23 -07:00
2878 changed files with 448213 additions and 322061 deletions

View File

@@ -13,7 +13,11 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Run build script
run: |
cd build/android && printf "y" | ./build.sh continuous

View File

@@ -13,7 +13,7 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
- name: Run build script
run: |
cd build/ios && printf "y" | ./build.sh continuous

View File

@@ -10,10 +10,10 @@ on:
jobs:
build-linux:
name: build-linux
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
- name: Run build script
run: |
cd build/linux && printf "y" | ./build.sh continuous

View File

@@ -13,7 +13,7 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
- name: Run build script
run: |
cd build/mac && printf "y" | ./build.sh continuous

View File

@@ -15,10 +15,10 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-18.04]
os: [macos-latest, ubuntu-22.04]
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
- name: Run build script
run: |
WORKFLOW_OS=`echo \`uname\` | sed "s/Darwin/mac/" | tr [:upper:] [:lower:]`
@@ -32,7 +32,7 @@ jobs:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
- name: Run build script
run: |
build\windows\build-github.bat presubmit
@@ -43,7 +43,11 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Run build script
run: |
cd build/android && printf "y" | ./build.sh presubmit
@@ -53,7 +57,7 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
- name: Run build script
run: |
cd build/ios && printf "y" | ./build.sh presubmit
@@ -66,7 +70,7 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
- name: Run build script
run: |
cd build/web && printf "y" | ./build.sh presubmit

View File

@@ -31,7 +31,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-18.04]
os: [macos-latest, ubuntu-22.04]
steps:
- name: Decide Git ref
@@ -41,22 +41,27 @@ jobs:
TAG=${REF##*/}
echo "ref=${REF}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
with:
ref: ${{ steps.git_ref.outputs.ref }}
- name: Run build script
env:
TAG: ${{ steps.git_ref.outputs.tag }}
run: |
WORKFLOW_OS=`echo \`uname\` | sed "s/Darwin/mac/" | tr [:upper:] [:lower:]`
cd build/$WORKFLOW_OS && printf "y" | ./build.sh release
- name: Upload release assets
run: |
xargs -L 1 sudo pip3 install < build/common/requirements.txt
cd ../..
if [ -f out/filament-release-darwin.tgz ]; then mv out/filament-release-darwin.tgz out/filament-${TAG}-mac.tgz; fi;
if [ -f out/filament-release-linux.tgz ]; then mv out/filament-release-linux.tgz out/filament-${TAG}-linux.tgz; fi;
python3 build/common/upload-assets.py ${TAG} out/*.tgz
- uses: actions/github-script@v6
env:
TAG: ${{ steps.git_ref.outputs.tag }}
GITHUB_API_KEY: ${{ secrets.GITHUB_API_KEY }}
with:
script: |
const upload = require('./build/common/upload-release-assets');
const { TAG } = process.env;
const globber = await glob.create('out/*.tgz');
await upload({ github, context }, await globber.glob(), TAG);
build-web:
name: build-web
@@ -71,20 +76,25 @@ jobs:
TAG=${REF##*/}
echo "ref=${REF}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
with:
ref: ${{ steps.git_ref.outputs.ref }}
- name: Run build script
run: |
cd build/web && printf "y" | ./build.sh release
- name: Upload release assets
run: |
xargs -L 1 sudo pip3 install < build/common/requirements.txt
mv out/filament-release-web.tgz out/filament-${TAG}-web.tgz
python3 build/common/upload-assets.py ${TAG} out/*.tgz
env:
TAG: ${{ steps.git_ref.outputs.tag }}
GITHUB_API_KEY: ${{ secrets.GITHUB_API_KEY }}
run: |
cd build/web && printf "y" | ./build.sh release
cd ../..
mv out/filament-release-web.tgz out/filament-${TAG}-web.tgz
- uses: actions/github-script@v6
env:
TAG: ${{ steps.git_ref.outputs.tag }}
with:
script: |
const upload = require('./build/common/upload-release-assets');
const { TAG } = process.env;
const globber = await glob.create('out/*.tgz');
await upload({ github, context }, await globber.glob(), TAG);
build-android:
name: build-android
@@ -99,12 +109,24 @@ jobs:
TAG=${REF##*/}
echo "ref=${REF}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
with:
ref: ${{ steps.git_ref.outputs.ref }}
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Run build script
env:
TAG: ${{ steps.git_ref.outputs.tag }}
run: |
cd build/android && printf "y" | ./build.sh release
cd ../..
mv out/filament-android-release.aar out/filament-${TAG}-android.aar
mv out/filamat-android-release.aar out/filamat-${TAG}-android.aar
mv out/filamat-android-lite-release.aar out/filamat-${TAG}-lite-android.aar
mv out/gltfio-android-release.aar out/gltfio-${TAG}-android.aar
mv out/filament-utils-android-release.aar out/filament-utils-${TAG}-android.aar
- name: Sign sample-gltf-viewer
run: |
echo "${APK_KEYSTORE_BASE64}" > filament.jks.base64
@@ -119,18 +141,15 @@ jobs:
TAG: ${{ steps.git_ref.outputs.tag }}
APK_KEYSTORE_BASE64: ${{ secrets.APK_KEYSTORE_BASE64 }}
APK_KEYSTORE_PASS: ${{ secrets.APK_KEYSTORE_PASS }}
- name: Upload release assets
run: |
xargs -L 1 sudo pip3 install < build/common/requirements.txt
mv out/filament-android-release.aar out/filament-${TAG}-android.aar
mv out/filamat-android-release.aar out/filamat-${TAG}-android.aar
mv out/filamat-android-lite-release.aar out/filamat-${TAG}-lite-android.aar
mv out/gltfio-android-release.aar out/gltfio-${TAG}-android.aar
mv out/filament-utils-android-release.aar out/filament-utils-${TAG}-android.aar
python3 build/common/upload-assets.py ${TAG} out/*.aar out/*.apk
- uses: actions/github-script@v6
env:
TAG: ${{ steps.git_ref.outputs.tag }}
GITHUB_API_KEY: ${{ secrets.GITHUB_API_KEY }}
with:
script: |
const upload = require('./build/common/upload-release-assets');
const { TAG } = process.env;
const globber = await glob.create(['out/*.aar', 'out/*.apk'].join('\n'));
await upload({ github, context }, await globber.glob(), TAG);
build-ios:
name: build-ios
@@ -145,20 +164,25 @@ jobs:
TAG=${REF##*/}
echo "ref=${REF}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
with:
ref: ${{ steps.git_ref.outputs.ref }}
- name: Run build script
run: |
cd build/ios && printf "y" | ./build.sh release
- name: Upload release assets
run: |
xargs -L 1 sudo pip3 install < build/common/requirements.txt
mv out/filament-release-ios.tgz out/filament-${TAG}-ios.tgz
python3 build/common/upload-assets.py ${TAG} out/*.tgz
env:
TAG: ${{ steps.git_ref.outputs.tag }}
GITHUB_API_KEY: ${{ secrets.GITHUB_API_KEY }}
run: |
cd build/ios && printf "y" | ./build.sh release
cd ../..
mv out/filament-release-ios.tgz out/filament-${TAG}-ios.tgz
- uses: actions/github-script@v6
env:
TAG: ${{ steps.git_ref.outputs.tag }}
with:
script: |
const upload = require('./build/common/upload-release-assets');
const { TAG } = process.env;
const globber = await glob.create('out/*.tgz');
await upload({ github, context }, await globber.glob(), TAG);
build-windows:
name: build-windows
@@ -174,19 +198,23 @@ jobs:
echo "ref=${REF}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
with:
ref: ${{ steps.git_ref.outputs.ref }}
- name: Run build script
run: |
build\windows\build-github.bat release
shell: cmd
- name: Upload release assets
run: |
pip3 install PyGithub
mv out/filament-windows.tgz out/filament-${TAG}-windows.tgz
python build/common/upload-assets.py ${TAG} out/*.tgz
shell: bash
env:
TAG: ${{ steps.git_ref.outputs.tag }}
GITHUB_API_KEY: ${{ secrets.GITHUB_API_KEY }}
run: |
build\windows\build-github.bat release
cd ..\..
move out\filament-windows.tgz out\filament-%TAG%-windows.tgz
shell: cmd
- uses: actions/github-script@v6
env:
TAG: ${{ steps.git_ref.outputs.tag }}
with:
script: |
const upload = require('./build/common/upload-release-assets');
const { TAG } = process.env;
const globber = await glob.create('out/*.tgz');
await upload({ github, context }, await globber.glob(), TAG);

View File

@@ -24,3 +24,4 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pull-request-number: ${{ github.event.pull_request.number }}
release-notes-file: 'NEW_RELEASE_NOTES.md'

View File

@@ -13,7 +13,7 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
- name: Run build script
run: |
cd build/web && printf "y" | ./build.sh continuous

View File

@@ -13,7 +13,7 @@ jobs:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2.0.0
- uses: actions/checkout@v3.3.0
- name: Run build script
run: |
build\windows\build-github.bat continuous

View File

@@ -13,9 +13,10 @@ section below.
To build Filament for Android you must also install the following:
- Android Studio Arctic Fox or more recent
- Android Studio Flamingo or more recent
- Android SDK
- Android NDK 25.1 or higher
- Java 17
### Environment variables
@@ -77,7 +78,7 @@ To turn an option on or off:
```
$ cd <cmake-build-directory>
$ cmake . -DOPTION=ON # Relace OPTION with the option name, set to ON / OFF
$ cmake . -DOPTION=ON # Replace OPTION with the option name, set to ON / OFF
```
Options can also be set with the CMake GUI.
@@ -92,6 +93,8 @@ Make sure you've installed the following dependencies:
- `libc++abi-7-dev` (`libcxxabi-static` on Fedora) or higher
- `ninja-build`
- `libxi-dev`
- `libxcomposite-dev` (`libXcomposite-devel` on Fedora)
- `libxxf86vm-dev` (`libXxf86vm-devel` on Fedora)
After dependencies have been installed, we highly recommend using the [easy build](#easy-build)
script.
@@ -178,7 +181,7 @@ Install the following components:
- [Python 3.7](https://www.python.org/ftp/python/3.7.0/python-3.7.0.exe)
- [CMake 3.14 or later](https://github.com/Kitware/CMake/releases/download/v3.14.7/cmake-3.14.7-win64-x64.msi)
The latest Windows SDK can also by installed by opening Visual Studio and selecting _Get Tools and
The latest Windows SDK can also be installed by opening Visual Studio and selecting _Get Tools and
Features..._ under the _Tools_ menu.
By default, Windows treats the file system as case insensitive. Please do not enable case

View File

@@ -31,6 +31,8 @@ option(FILAMENT_SKIP_SDL2 "Skip dependencies of SDL2, and SDL2" OFF)
option(FILAMENT_LINUX_IS_MOBILE "Treat Linux as Mobile" OFF)
option(FILAMENT_ENABLE_ASAN_UBSAN "Enable Address and Undefined Behavior Sanitizers" OFF)
set(FILAMENT_NDK_VERSION "" CACHE STRING
"Android NDK version or version prefix to be used when building for Android."
)
@@ -67,25 +69,30 @@ endif()
# ==================================================================================================
find_program(CCACHE_PROGRAM ccache)
if (CCACHE_PROGRAM)
set(C_LAUNCHER "${CCACHE_PROGRAM}")
set(CXX_LAUNCHER "${CCACHE_PROGRAM}")
configure_file(build/launch-c.in launch-c)
configure_file(build/launch-cxx.in launch-cxx)
execute_process(COMMAND chmod a+rx
"${CMAKE_BINARY_DIR}/launch-c"
"${CMAKE_BINARY_DIR}/launch-cxx"
)
if (CMAKE_GENERATOR STREQUAL "Xcode")
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/launch-c")
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/launch-cxx")
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/launch-c")
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/launch-cxx")
if (WIN32)
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
else()
set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_BINARY_DIR}/launch-c")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_BINARY_DIR}/launch-cxx")
set(C_LAUNCHER "${CCACHE_PROGRAM}")
set(CXX_LAUNCHER "${CCACHE_PROGRAM}")
configure_file(build/launch-c.in launch-c)
configure_file(build/launch-cxx.in launch-cxx)
execute_process(COMMAND chmod a+rx
"${CMAKE_CURRENT_BINARY_DIR}/launch-c"
"${CMAKE_CURRENT_BINARY_DIR}/launch-cxx"
)
if (CMAKE_GENERATOR STREQUAL "Xcode")
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_CURRENT_BINARY_DIR}/launch-c")
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_CURRENT_BINARY_DIR}/launch-cxx")
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_CURRENT_BINARY_DIR}/launch-c")
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_CURRENT_BINARY_DIR}/launch-cxx")
else()
set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_CURRENT_BINARY_DIR}/launch-c")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_CURRENT_BINARY_DIR}/launch-cxx")
endif()
endif()
endif()
@@ -99,6 +106,10 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# ==================================================================================================
if (UNIX AND NOT APPLE AND NOT ANDROID AND NOT WEBGL)
set(LINUX TRUE)
else()
# since cmake 3.25 LINUX is automatically set based on CMAKE_SYSTEM_NAME, which the android
# cmake files are setting to "Linux".
set(LINUX FALSE)
endif()
if (LINUX)
@@ -113,11 +124,16 @@ if (LINUX)
add_definitions(-DFILAMENT_SUPPORTS_XCB)
endif()
# Default Swiftshader build does not enable the xlib extension
if (FILAMENT_SUPPORTS_XLIB AND FILAMENT_USE_SWIFTSHADER)
set(FILAMENT_SUPPORTS_XLIB OFF)
endif()
if (FILAMENT_SUPPORTS_XLIB)
add_definitions(-DFILAMENT_SUPPORTS_XLIB)
endif()
if (FILAMENT_SUPPORTS_XCB OR FILAMENT_SUPORTS_XLIB)
if (FILAMENT_SUPPORTS_XCB OR FILAMENT_SUPPORTS_XLIB)
add_definitions(-DFILAMENT_SUPPORTS_X11)
set(FILAMENT_SUPPORTS_X11 TRUE)
endif()
@@ -356,6 +372,12 @@ if (ANDROID OR IOS OR WEBGL)
endif()
endif()
# Turn off exceptions on iOS debug as well. This fixes an availability error we see when using
# std::visit, which is not supported on iOS 11.0 when exceptions are enabled.
if (IOS)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-exceptions")
endif()
# With WebGL, we disable RTTI even for debug builds because we pass emscripten::val back and forth
# between C++ and JavaScript in order to efficiently access typed arrays, which are unbound.
# NOTE: This is not documented in emscripten so we should consider a different approach.
@@ -370,10 +392,10 @@ endif()
# ==================================================================================================
# Debug compiler flags
# ==================================================================================================
# ASAN is deactivated for now because:
# -fsanitize=undefined causes extremely long link times
# -fsanitize=address causes a crash with assimp, which we can't explain for now
#set(EXTRA_SANITIZE_OPTIONS "-fsanitize=undefined -fsanitize=address")
if (FILAMENT_ENABLE_ASAN_UBSAN)
set(EXTRA_SANITIZE_OPTIONS "-fsanitize=address -fsanitize=undefined")
endif()
if (NOT MSVC AND NOT WEBGL)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fstack-protector")
endif()
@@ -493,9 +515,14 @@ if (FILAMENT_SUPPORTS_METAL)
set(MATC_API_FLAGS ${MATC_API_FLAGS} -a metal)
endif()
# Disable optimizations and enable debug info (preserves names in SPIR-V)
# Enable debug info (preserves names in SPIR-V)
if (FILAMENT_ENABLE_MATDBG)
set(MATC_OPT_FLAGS ${MATC_OPT_FLAGS} -d)
endif()
# Disable optimizations
if (FILAMENT_DISABLE_MATOPT)
set(MATC_OPT_FLAGS -gd)
set(MATC_OPT_FLAGS ${MATC_OPT_FLAGS} -g)
endif()
set(MATC_BASE_FLAGS ${MATC_API_FLAGS} -p ${MATC_TARGET} ${MATC_OPT_FLAGS})
@@ -550,7 +577,7 @@ function(list_licenses OUTPUT MODULES)
endif()
endforeach()
configure_file(${FILAMENT}/build/licenses.inc.in ${OUTPUT})
endfunction(list_licenses)
endfunction()
set(COMBINE_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/build/linux/combine-static-libs.sh")
if (WIN32)
@@ -671,6 +698,7 @@ add_subdirectory(${EXTERNAL}/robin-map/tnt)
add_subdirectory(${EXTERNAL}/smol-v/tnt)
add_subdirectory(${EXTERNAL}/benchmark/tnt)
add_subdirectory(${EXTERNAL}/meshoptimizer/tnt)
add_subdirectory(${EXTERNAL}/mikktspace)
add_subdirectory(${EXTERNAL}/cgltf/tnt)
add_subdirectory(${EXTERNAL}/draco/tnt)
add_subdirectory(${EXTERNAL}/jsmn/tnt)

View File

@@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Copyright 2023 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

9
NEW_RELEASE_NOTES.md Normal file
View File

@@ -0,0 +1,9 @@
# Filament Release Notes log
**If you are merging a PR into main**: please add the release note below, under the *Release notes
for next branch cut* header.
**If you are cherry-picking a commit into an rc/ branch**: add the release note under the
appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md).
## Release notes for next branch cut

View File

@@ -31,7 +31,7 @@ repositories {
}
dependencies {
implementation 'com.google.android.filament:filament-android:1.28.2'
implementation 'com.google.android.filament:filament-android:1.40.4'
}
```
@@ -41,7 +41,6 @@ Here are all the libraries available in the group `com.google.android.filament`:
| ------------- | ------------- |
| [![filament-android](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filament-android/badge.svg?subject=filament-android)](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filament-android) | The Filament rendering engine itself. |
| [![gltfio-android](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/gltfio-android/badge.svg?subject=gltfio-android)](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/gltfio-android) | A glTF 2.0 loader for Filament, depends on `filament-android`. |
| [![gltfio-android-lite](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/gltfio-android-lite/badge.svg?subject=gltfio-android-lite)](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/gltfio-android-lite) | Trimmed version of `gltfio` that does not support some glTF extensions. |
| [![filament-utils-android](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filament-utils-android/badge.svg?subject=filament-utils-android)](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filament-utils-android) | KTX loading, Kotlin math, and camera utilities, depends on `gltfio-android`. |
| [![filamat-android](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filamat-android/badge.svg?subject=filamat-android)](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filamat-android) | A runtime material builder/compiler. This library is large but contains a full shader compiler/validator/optimizer and supports both OpenGL and Vulkan. |
| [![filamat-android-lite](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filamat-android-lite/badge.svg?subject=filamat-android-lite)](https://maven-badges.herokuapp.com/maven-central/com.google.android.filament/filamat-android-lite) | A much smaller alternative to `filamat-android` that can only generate OpenGL shaders. It does not provide validation or optimizations. |
@@ -51,7 +50,7 @@ Here are all the libraries available in the group `com.google.android.filament`:
iOS projects can use CocoaPods to install the latest release:
```
pod 'Filament', '~> 1.28.2'
pod 'Filament', '~> 1.40.4'
```
### Snapshots
@@ -117,9 +116,9 @@ steps:
- Image-based lighting
- Physically-based camera (shutter speed, sensitivity and aperture)
- Physical light units
- Point lights, spot lights and directional light
- Point lights, spot lights, and directional light
- Specular anti-aliasing
- Spot and directional light shadows
- Point, spot, and directional light shadows
- Cascaded shadows
- EVSM, PCSS, DPCF, or PCF shadows
- Transparent shadows

View File

@@ -9,26 +9,15 @@ Before starting, ensure that each of these branches is up-to-date with origin:
- rc/$RELEASE
- main
## 0. Make sure the rc/$RELEASE branch has the correct version.
## 0. Check versions.
It should have the version corresponding to its name, $RELEASE.
Make sure the rc/$RELEASE branch has the correct Filament version. It should have the version
corresponding to its name, $RELEASE.
## 1. Update RELEASE_NOTES.md on the rc branch.
Make sure `MATERIAL_VERSION` has been bumped to a new version if this is a MAJOR or MINOR release
(first two version numbers).
Checkout the rc/$RELEASE branch. In RELEASE_NOTES.md, locate the header corresponding to $RELEASE
and write release notes. To see which commits make up the release, run:
```
build/common/release.sh -c rc/$RELEASE
```
Commit the changes to rc/$RELEASE with the title:
```
Update RELEASE_NOTES for $RELEASE
```
## 2. Bump versions on main to $RELEASE.
## 1. Bump Filament versions on main to $RELEASE.
Checkout main and run the following command to bump Filament's version to $RELEASE:
@@ -44,49 +33,19 @@ Release Filament $RELEASE
Do not push to origin yet.
## 3. Cherry-pick RELEASE_NOTES change from rc branch to main.
## 2. Update RELEASE_NOTES.md on main.
```
git cherry-pick rc/$RELEASE
```
Create a new header in RELEASE_NOTES.md for $NEXT_RELEASE. Copy the release notes in
NEW_RELEASE_NOTES.md to RELEASE_NOTES.md under the new header. Clear NEW_RELEASE_NOTES.md.
Update the headers. The "main branch" header becomes a header for $NEXT_RELEASE, and a new "main
branch" header is added.
For example, this:
```
## main branch
- foo
- bar
## v1.9.3
- baz
- bat
```
becomes:
```
## main branch
## v1.9.4
- foo
- bar
## v1.9.3
- baz
- bat
```
Ammend these changes to the cherry-picked change.
Amend these changes to the "Release Filament $RELEASE" commit.
```
git add -u
git commit --amend --no-edit
```
## 4. Run release script.
## 3. Run release script.
```
build/common/release.sh rc/$RELEASE rc/$NEXT_RELEASE
@@ -95,18 +54,18 @@ build/common/release.sh rc/$RELEASE rc/$NEXT_RELEASE
This script will merge rc/$RELEASE into release, delete the rc branch, and create a new rc
branch called rc/$NEXT_RELEASE. Verify that everything looks okay locally.
## 5. Push the release branch.
## 4. Push the release branch.
```
git push origin release
```
## 6. Create the GitHub release.
## 5. Create the GitHub release.
Use the GitHub UI to create a GitHub release corresponding to $RELEASE version.
Make sure the target is set to the release branch.
## 7. Delete the old rc branch (optional).
## 6. Delete the old rc branch (optional).
This step is optional. The old rc branch may be left alive for a few weeks for posterity.
@@ -114,7 +73,7 @@ This step is optional. The old rc branch may be left alive for a few weeks for p
git push origin --delete rc/$RELEASE
```
## 8. Bump the version on the new rc branch to $NEXT_RELEASE.
## 7. Bump the version on the new rc branch to $NEXT_RELEASE.
```
git checkout rc/$NEXT_RELEASE
@@ -127,19 +86,19 @@ Commit the changes to rc/$NEXT_RELEASE with the title:
Bump version to $NEXT_RELEASE
```
## 9. Push main.
## 8. Push main.
```
git push origin main
```
## 10. Push the new rc branch.
## 9. Push the new rc branch.
```
git push origin -u rc/$NEXT_RELEASE
```
## 11. Rebuild the GitHub release (if failed).
## 10. Rebuild the GitHub release (if failed).
Sometimes the GitHub release job will fail. In this case, you can manually re-run the release job.

View File

@@ -3,15 +3,166 @@
This file contains one line summaries of commits that are worthy of mentioning in release notes.
A new header is inserted each time a *tag* is created.
## main branch
**Do not edit this file unless you are performing a release or cherry-picking into an rc/ branch.**
Instead, if you are authoring a PR for the main branch, add your release note to
[NEW_RELEASE_NOTES.md](./NEW_RELEASE_NOTES.md).
## v1.40.4
- gltfio: fix crash when compute morph target without material
- matc: fix buggy `variant-filter` flag
- web: Added missing setMat3Parameter()/setMat4Parameter() to MaterialInstance
- opengl: fix b/290670707 : crash when using the blob cache
- engine: fix a crash with `Material::compile()` when a callback is specified
## v1.40.3
## v1.40.2
- rendering: dynamic resolution would not work with a translucent render target and quality > low
- Java/Kotlin: user callbacks were not invoked on successful texture upload
## v1.40.1
## v1.40.0
- matc: fix VSM high precision option on mobile [⚠️ **Recompile materials**]
- vulkan: support sRGB swap chain
- Add new `getMaxAutomaticInstances()` API on `Engine` to get max supported automatic instances.
- UiHelper: fix jank when a `TextureView` is resized (fixes b\282220665)
- backend: parallel shader compilation support. This breaks and improves the recent `Material::compile` API.
## v1.39.0
- matc: workaround a bug in spirv-tools causing vsm to fail [⚠️ **Recompile materials**]
## v1.38.0
- engine: a new feature to set a transform on the global-scale fog [⚠️ **Recompile materials**]
- engine: large-scale fog can now be opted-out on a per-renderable basis
- engine: improve froxelizer resource efficiency [⚠️ **Recompile materials**]
- matc: better accounting and validation of used samplers in user materials
- engine: add support for sampling fog color from a custom texture [⚠️ **Recompile materials**]
- vulkan: introduce new custom swapchain API
- vulkan: new context sharing API
## v1.37.0
- backend: added `Platform` blob cache APIs, typically used to cache programs [⚠️ **Recompile materials**]
## v1.36.0
- engine: a local transform can now be supplied for each GPU instance [⚠️ **Recompile materials**]
- everything: Add limited support for OpenGL ES 2.0 devices. [⚠️ **Recompile Materials**]
- platform: New virtual on `OpenGLPlatform` to preserve ancillary buffers
## v1.35.0
- materials: Materials can now access up to 4 global `vec4` visible by all materials [⚠️ **Recompile Materials**]
## v1.34.0
- materials: picking is done in float (prepare for ES2) [⚠️ **New Material Version**]
- materials: postLightingBlending is now applied before the fog [⚠️ **Recompile materials**]
- vulkan: fix adreno optimized material artifacts [⚠️ **Recompile Materials**]
## v1.33.0
- materials: prepare ES2 support [⚠️ **New Material Version**]
## v1.32.4
- engine: Add support for _constant parameters_, which are constants that can be specialized after material compilation.
- materials: improved size reduction of OpenGL/Metal shaders by ~65% when compiling materials with
size optimizations (`matc -S`) [⚠️ **Recompile Materials**]
- engine: fix potential crash on Metal devices with A8X GPU (iPad Air 2) [⚠️ **Recompile Materials**]
- opengl: support the external image on macOS
## v1.32.3
- fog: added an option to disable the fog after a certain distance [⚠️ **Recompile Materials**].
- fog: fog color now takes exposure and IBL intensity into account [⚠️ **Recompile Materials**].
- materials: implement cascades debugging as a post-process [⚠️ **Recompile Materials**].
- materials: use 9 digits or less for floats [⚠️ **Recompile Materials**].
- gltfio: fix skinning when objects are far from the origin
- materials: remove 4 unneeded variants from `unlit` materials [⚠️ **Recompile Materials**].
## v1.32.2
- lighting: the sun disc was computed in low/medium quality instead of high quality. This will
provide performance improvements to mobile devices [⚠️ **Recompile Materials**]
## v1.32.1
## v1.32.0
- fog: fixed fog height falloff and computation precision on mobile [⚠️ **Recompile Materials**]
- materials: new alphaToCoverage property can be used to control alpha to coverage behavior
- materials: added `getUserWorldFromWorldMatrix()` and `getUserWorldPosition()` to retrieve the
API-level (user) world position in materials. Deprecated `getWorldOffset()`. [⚠️ **Recompile
Materials**]
- engine: fix precision issue with `shading_view` in large scenes
- vulkan: readPixels is now async (#6560)
## v1.31.7
## v1.31.6
- engine: the default render channel is now 2 instead of 0
- gltfio: Fix crash when a MIME type has no texture provider
## v1.31.5
- gltfio: fix potential early freeing of data provided with `ResourceLoader::addResourceData`.
## v1.31.4
- engine: fix broken picking [⚠️ **Recompile Materials to get the fix**]
- engine: added support for sRGB swapchains. See `SwapChain.h`
- bluegl: support Windows32
## v1.31.3
- vulkan: fix memory leak in readPixels
- engine: added support for draw-commands channels (stronger ordering of commands/renderables)
## v1.31.2
## v1.31.1
- gltfio: expose joint inverse bind matrices via method on FilamentInstance
- filamesh: add error when uv coords size does not match num of vertices. (#6351)
## v1.31.0
- java: fix confusing typo in Camera documentation
- engine: the output color space can be set on `ColorGrading`. This API currently has limitations,
please refer to the documentation for more details
- Support for RGTC and BPTC texture compression
- engine: fix TransformManager high precision mode when using transactions
- web: added TypeScript definition for `Engine.destroy`
- materials: `getNormalizedViewportCoord()` now returns the logical (i.e. user) viewport
normalized position and keeps z reversed [⚠️ **Recompile Materials**]
- backend: workaround Adreno shader compiler bug (#6355) [⚠️ **Recompile Materials**]
- geometry: change computing tangent basis from normal vector to use Frisvad's method
## v1.30.0
- engine: optimize per-shadow UBO [⚠️ **Recompile Materials**]
- engine: fix potential memory corruption with larger scenes
- engine: VSM's MSAA setting is now per-view instead of per-light [⚠️ **API Change**]
## v1.29.0
- gltfio: calculate primitive's AABB correctly.
- gltfio: recompute bounding boxes with morph targets
- engine: add missing getters on `MaterialInstance`
- WebGL: add missing `ColorGrading` JS bindings
- engine: improvements/cleanup of Shadow mapping code [⚠️ **Recompile Materials**]
## v1.28.3
- backend: add support for GGP platform
- engine: primitives with `CullingMode::FRONT_AND_BACK` are now skipped.

View File

@@ -135,7 +135,7 @@ gradlew -Pcom.google.android.filament.dist-dir=..\out\android-release\filament a
If you're only interested in building SDK, you may skip samples build by passing a `com.google.android.filament.skip-samples` flag:
```
gradlew -Pcom.google.android.filament.dist-dir=..\out\android-release\filament assembleRelease -Pfilament_skip_samples
gradlew -Pcom.google.android.filament.dist-dir=..\out\android-release\filament assembleRelease -Pcom.google.android.filament.skip-samples
```

View File

@@ -12,7 +12,10 @@
// When set, support for Vulkan will be excluded.
//
// com.google.android.filament.matdbg
// When set, enables matdbg, disables shader optimizations
// When set, enables matdbg
//
// com.google.android.filament.matnopt
// When set, disable shader optimizations.
//
// com.google.android.filament.skip-samples
// Exclude samples from the project. Useful to speed up compilation.
@@ -62,6 +65,10 @@ buildscript {
.gradleProperty("com.google.android.filament.matdbg")
.isPresent()
def matnopt = providers
.gradleProperty("com.google.android.filament.matnopt")
.isPresent()
def abis = ["arm64-v8a", "armeabi-v7a", "x86_64", "x86"]
def newAbis = providers
.gradleProperty("com.google.android.filament.abis")
@@ -72,15 +79,16 @@ buildscript {
}
ext.versions = [
'jdk': 17,
'minSdk': 19,
'targetSdk': 33,
'compileSdk': 33,
'kotlin': '1.7.10',
'kotlin_coroutines': '1.6.1',
'buildTools': '33.0.0',
'kotlin': '1.9.0',
'kotlin_coroutines': '1.7.2',
'buildTools': '34.0.0',
'ndk': '25.1.8937393',
'androidx_core': '1.9.0',
'androidx_annotations': '1.3.0'
'androidx_core': '1.10.1',
'androidx_annotations': '1.6.0'
]
ext.deps = [
@@ -96,8 +104,7 @@ buildscript {
]
dependencies {
// NOTE: See TODO in gradle.properties once we move to Gradle 7.4
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.android.tools.build:gradle:8.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
}
@@ -109,7 +116,7 @@ buildscript {
"-DFILAMENT_DIST_DIR=${filamentPath}".toString(),
"-DFILAMENT_SUPPORTS_VULKAN=${excludeVulkan ? 'OFF' : 'ON'}".toString(),
"-DFILAMENT_ENABLE_MATDBG=${matdbg ? 'ON' : 'OFF'}".toString(),
"-DFILAMENT_DISABLE_MATOPT=${matdbg ? 'ON' : 'OFF'}".toString()
"-DFILAMENT_DISABLE_MATOPT=${matnopt ? 'ON' : 'OFF'}".toString()
]
ext.cppFlags = [
@@ -120,6 +127,7 @@ buildscript {
"-fno-asynchronous-unwind-tables",
"-fno-rtti",
"-ffast-math",
"-fno-finite-math-only",
"-ffp-contract=fast",
"-fvisibility-inlines-hidden",
"-fvisibility=hidden",
@@ -144,7 +152,7 @@ buildscript {
}
plugins {
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
}
// See https://github.com/gradle-nexus/publish-plugin
@@ -187,6 +195,7 @@ subprojects {
}
ndk {
//noinspection ChromeOsAbiSupport
abiFilters(*rootProject.ext.abis)
}
@@ -207,8 +216,8 @@ subprojects {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility versions.jdk
targetCompatibility versions.jdk
}
}
}

View File

@@ -142,6 +142,14 @@ abstract class MaterialCompiler extends TaskWithBinary {
if (!exclude_vulkan) {
matcArgs += ['-a', 'vulkan']
}
def mat_no_opt = providers
.gradleProperty("com.google.android.filament.matnopt")
.forUseAtConfigurationTime().present
if (mat_no_opt) {
matcArgs += ['-g']
}
matcArgs += ['-a', 'opengl', '-p', 'mobile', '-o', getOutputFile(file), file]
exec.exec {

View File

@@ -17,6 +17,17 @@ android {
}
}
}
publishing {
singleVariant("fullRelease") {
withSourcesJar()
withJavadocJar()
}
singleVariant("liteRelease") {
withSourcesJar()
withJavadocJar()
}
}
}
dependencies {

View File

@@ -250,6 +250,13 @@ Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderMaskThr
builder->maskThreshold(maskThreshold);
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderAlphaToCoverage(JNIEnv*,
jclass, jlong nativeBuilder, jboolean enable) {
auto builder = (MaterialBuilder*) nativeBuilder;
builder->alphaToCoverage(enable);
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_filamat_MaterialBuilder_nMaterialBuilderShadowMultiplier(
JNIEnv*, jclass, jlong nativeBuilder, jboolean shadowMultiplier) {

View File

@@ -360,6 +360,12 @@ public class MaterialBuilder {
return this;
}
@NonNull
public MaterialBuilder alphaToCoverage(boolean enable) {
nMaterialBuilderAlphaToCoverage(mNativeObject, enable);
return this;
}
@NonNull
public MaterialBuilder shadowMultiplier(boolean shadowMultiplier) {
nMaterialBuilderShadowMultiplier(mNativeObject, shadowMultiplier);
@@ -584,6 +590,7 @@ public class MaterialBuilder {
private static native void nMaterialBuilderDepthCulling(long nativeBuilder, boolean enable);
private static native void nMaterialBuilderDoubleSided(long nativeBuilder, boolean doubleSided);
private static native void nMaterialBuilderMaskThreshold(long nativeBuilder, float mode);
private static native void nMaterialBuilderAlphaToCoverage(long nativeBuilder, boolean enable);
private static native void nMaterialBuilderShadowMultiplier(long mNativeObject,
boolean shadowMultiplier);

View File

@@ -1,5 +1,12 @@
android {
namespace 'com.google.android.filament'
publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
}
dependencies {

View File

@@ -79,7 +79,7 @@ Java_com_google_android_filament_LightManager_nBuilderShadowOptions(JNIEnv* env,
jfloat shadowFarHint, jboolean stable, jboolean lispsm,
jfloat polygonOffsetConstant, jfloat polygonOffsetSlope,
jboolean screenSpaceContactShadows, jint stepCount,
jfloat maxShadowDistance, jint vsmMsaaSamples, jboolean elvsm, jfloat blurWidth, jfloat shadowBulbRadius) {
jfloat maxShadowDistance, jboolean elvsm, jfloat blurWidth, jfloat shadowBulbRadius) {
LightManager::Builder *builder = (LightManager::Builder *) nativeBuilder;
LightManager::ShadowOptions shadowOptions {
.mapSize = (uint32_t)mapSize,
@@ -97,7 +97,6 @@ Java_com_google_android_filament_LightManager_nBuilderShadowOptions(JNIEnv* env,
.stepCount = uint8_t(stepCount),
.maxShadowDistance = maxShadowDistance,
.vsm = {
.msaaSamples = (uint8_t) vsmMsaaSamples,
.elvsm = (bool)elvsm,
.blurWidth = blurWidth
},

View File

@@ -153,6 +153,14 @@ Java_com_google_android_filament_Material_nIsDoubleSided(JNIEnv*, jclass,
return (jboolean) material->isDoubleSided();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_Material_nIsAlphaToCoverageEnabled(JNIEnv*, jclass,
jlong nativeMaterial) {
Material* material = (Material*) nativeMaterial;
return (jboolean) material->isAlphaToCoverageEnabled();
}
extern "C"
JNIEXPORT jfloat JNICALL
Java_com_google_android_filament_Material_nGetMaskThreshold(JNIEnv*, jclass,

View File

@@ -457,7 +457,6 @@ extern "C"
JNIEXPORT jfloat JNICALL
Java_com_google_android_filament_MaterialInstance_nGetMaskThreshold(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
// TODO: implement nGetMaskThreshold()
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
return instance->getMaskThreshold();
}
@@ -466,7 +465,6 @@ extern "C"
JNIEXPORT jfloat JNICALL
Java_com_google_android_filament_MaterialInstance_nGetSpecularAntiAliasingVariance(JNIEnv* env,
jclass clazz, jlong nativeMaterialInstance) {
// TODO: implement nGetSpecularAntiAliasingVariance()
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
return instance->getSpecularAntiAliasingVariance();
}
@@ -475,7 +473,6 @@ extern "C"
JNIEXPORT jfloat JNICALL
Java_com_google_android_filament_MaterialInstance_nGetSpecularAntiAliasingThreshold(JNIEnv* env,
jclass clazz, jlong nativeMaterialInstance) {
// TODO: implement nGetSpecularAntiAliasingThreshold()
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
return instance->getSpecularAntiAliasingThreshold();
}
@@ -484,7 +481,6 @@ extern "C"
JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_MaterialInstance_nIsDoubleSided(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
// TODO: implement nIsDoubleSided()
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
return instance->isDoubleSided();
}
@@ -493,7 +489,6 @@ extern "C"
JNIEXPORT jint JNICALL
Java_com_google_android_filament_MaterialInstance_nGetCullingMode(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
// TODO: implement nGetCullingMode()
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
return (jint)instance->getCullingMode();
}
@@ -502,7 +497,6 @@ extern "C"
JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_MaterialInstance_nIsColorWriteEnabled(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
// TODO: implement nIsColorWriteEnabled()
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
return instance->isColorWriteEnabled();
}
@@ -511,7 +505,6 @@ extern "C"
JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_MaterialInstance_nIsDepthWriteEnabled(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
// TODO: implement nIsDepthWriteEnabled()
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
return instance->isDepthWriteEnabled();
}
@@ -520,7 +513,6 @@ extern "C"
JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_MaterialInstance_nIsStencilWriteEnabled(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
// TODO: implement nIsStencilWriteEnabled()
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
return instance->isStencilWriteEnabled();
}
@@ -529,7 +521,6 @@ extern "C"
JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_MaterialInstance_nIsDepthCullingEnabled(JNIEnv* env, jclass clazz,
jlong nativeMaterialInstance) {
// TODO: implement nIsDepthCullingEnabled()
MaterialInstance* instance = (MaterialInstance*)nativeMaterialInstance;
return instance->isDepthCullingEnabled();
}

View File

@@ -150,6 +150,13 @@ Java_com_google_android_filament_RenderableManager_nBuilderPriority(JNIEnv*, jcl
builder->priority((uint8_t) priority);
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_RenderableManager_nBuilderChannel(JNIEnv*, jclass,
jlong nativeBuilder, jint channel) {
RenderableManager::Builder *builder = (RenderableManager::Builder *) nativeBuilder;
builder->channel((uint8_t) channel);
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_RenderableManager_nBuilderCulling(JNIEnv*, jclass,
jlong nativeBuilder, jboolean enabled) {
@@ -194,12 +201,19 @@ Java_com_google_android_filament_RenderableManager_nBuilderSkinning(JNIEnv*, jcl
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_RenderableManager_nEnableSkinningBuffers(JNIEnv*, jclass,
Java_com_google_android_filament_RenderableManager_nBuilderEnableSkinningBuffers(JNIEnv*, jclass,
jlong nativeBuilder, jboolean enabled) {
RenderableManager::Builder *builder = (RenderableManager::Builder *) nativeBuilder;
builder->enableSkinningBuffers(enabled);
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_RenderableManager_nBuilderFog(JNIEnv*, jclass,
jlong nativeBuilder, jboolean enabled) {
RenderableManager::Builder *builder = (RenderableManager::Builder *) nativeBuilder;
builder->fog(enabled);
}
extern "C" JNIEXPORT jint JNICALL
Java_com_google_android_filament_RenderableManager_nBuilderSkinningBones(JNIEnv* env, jclass,
jlong nativeBuilder, jint boneCount, jobject bones, jint remaining) {
@@ -339,6 +353,13 @@ Java_com_google_android_filament_RenderableManager_nSetPriority(JNIEnv*, jclass,
rm->setPriority((RenderableManager::Instance) i, (uint8_t) priority);
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_RenderableManager_nSetChannel(JNIEnv*, jclass,
jlong nativeRenderableManager, jint i, jint channel) {
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
rm->setChannel((RenderableManager::Instance) i, (uint8_t) channel);
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_RenderableManager_nSetCulling(JNIEnv*, jclass,
jlong nativeRenderableManager, jint i, jboolean enabled) {
@@ -346,6 +367,20 @@ Java_com_google_android_filament_RenderableManager_nSetCulling(JNIEnv*, jclass,
rm->setCulling((RenderableManager::Instance) i, enabled);
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_RenderableManager_nSetFogEnabled(JNIEnv*, jclass,
jlong nativeRenderableManager, jint i, jboolean enabled) {
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
rm->setFogEnabled((RenderableManager::Instance) i, enabled);
}
extern "C" JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_RenderableManager_nGetFogEnabled(JNIEnv*, jclass,
jlong nativeRenderableManager, jint i) {
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
return (jboolean)rm->getFogEnabled((RenderableManager::Instance) i);
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_RenderableManager_nSetCastShadows(JNIEnv*, jclass,
jlong nativeRenderableManager, jint i, jboolean enabled) {

View File

@@ -16,6 +16,7 @@
#include <jni.h>
#include <filament/Engine.h>
#include <filament/SwapChain.h>
#include "common/CallbackUtils.h"
@@ -32,3 +33,9 @@ Java_com_google_android_filament_SwapChain_nSetFrameCompletedCallback(JNIEnv* en
JniCallback::postToJavaAndDestroy(callback);
}, callback);
}
extern "C" JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_SwapChain_nIsSRGBSwapChainSupported(JNIEnv *, jclass, jlong nativeEngine) {
Engine* engine = (Engine*) nativeEngine;
return (bool)SwapChain::isSRGBSwapChainSupported(*engine);
}

View File

@@ -511,9 +511,7 @@ public:
private:
void* mData = nullptr;
jobject mBitmap = nullptr;
jobject mHandler = nullptr;
jobject mCallback = nullptr;
jobject mBitmap{};
AndroidBitmapInfo mInfo{};
};

View File

@@ -315,12 +315,14 @@ Java_com_google_android_filament_View_nSetBloomOptions(JNIEnv*, jclass,
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_View_nSetFogOptions(JNIEnv *, jclass , jlong nativeView,
jfloat distance, jfloat maximumOpacity, jfloat height, jfloat heightFalloff, jfloat r,
jfloat g, jfloat b, jfloat density, jfloat inScatteringStart,
jfloat inScatteringSize, jboolean fogColorFromIbl, jboolean enabled) {
jfloat distance, jfloat maximumOpacity, jfloat height, jfloat heightFalloff, jfloat cutOffDistance,
jfloat r, jfloat g, jfloat b, jfloat density, jfloat inScatteringStart,
jfloat inScatteringSize, jboolean fogColorFromIbl, jlong skyColorNativeObject, jboolean enabled) {
View* view = (View*) nativeView;
Texture* skyColor = (Texture*) skyColorNativeObject;
View::FogOptions options = {
.distance = distance,
.cutOffDistance = cutOffDistance,
.maximumOpacity = maximumOpacity,
.height = height,
.heightFalloff = heightFalloff,
@@ -329,6 +331,7 @@ Java_com_google_android_filament_View_nSetFogOptions(JNIEnv *, jclass , jlong na
.inScatteringStart = inScatteringStart,
.inScatteringSize = inScatteringSize,
.fogColorFromIbl = (bool)fogColorFromIbl,
.skyColor = skyColor,
.enabled = (bool)enabled
};
view->setFogOptions(options);
@@ -485,3 +488,30 @@ Java_com_google_android_filament_View_nSetGuardBandOptions(JNIEnv *, jclass,
View* view = (View*) nativeView;
view->setGuardBandOptions({ .enabled = (bool)enabled });
}
extern "C"
JNIEXPORT void JNICALL
Java_com_google_android_filament_View_nSetMaterialGlobal(JNIEnv * , jclass, jlong nativeView,
jint index, jfloat x, jfloat y, jfloat z, jfloat w) {
View *view = (View *) nativeView;
view->setMaterialGlobal((uint32_t)index, { x, y, z, w });
}
extern "C"
JNIEXPORT void JNICALL
Java_com_google_android_filament_View_nGetMaterialGlobal(JNIEnv *env, jclass clazz,
jlong nativeView, jint index, jfloatArray out_) {
jfloat* out = env->GetFloatArrayElements(out_, nullptr);
View *view = (View *) nativeView;
auto result = view->getMaterialGlobal(index);
std::copy_n(result.v, 4, out);
env->ReleaseFloatArrayElements(out_, out, 0);
}
extern "C"
JNIEXPORT int JNICALL
Java_com_google_android_filament_View_nGetFogEntity(JNIEnv *env, jclass clazz,
jlong nativeView) {
View *view = (View *) nativeView;
return (jint)view->getFogEntity().getId();
}

View File

@@ -365,7 +365,7 @@ public class Camera {
* By default, this is an identity matrix.
* </p>
*
* @param scaling diagonal of the scaling matrix to be applied after the projection matrix.
* @param inScaling diagonal of the scaling matrix to be applied after the projection matrix.
*
* @see Camera#setProjection
* @see Camera#setLensProjection
@@ -409,7 +409,7 @@ public class Camera {
*
* <pre>
* engine.getTransformManager().setTransform(
* engine.getTransformManager().getInstance(camera->getEntity()), viewMatrix);
* engine.getTransformManager().getInstance(camera->getEntity()), modelMatrix);
* </pre>
*
* @param modelMatrix The camera position and orientation provided as a <b>rigid transform</b> matrix.

View File

@@ -118,6 +118,7 @@ public class ColorGrading {
*
* @deprecated Use {@link ColorGrading.Builder#toneMapper(ToneMapper)}
*/
@Deprecated
public enum ToneMapping {
/** Linear tone mapping (i.e. no tone mapping). */
LINEAR,
@@ -231,6 +232,7 @@ public class ColorGrading {
*
* @deprecated Use {@link #toneMapper(ToneMapper)}
*/
@Deprecated
public Builder toneMapping(ToneMapping toneMapping) {
nBuilderToneMapping(mNativeBuilder, toneMapping.ordinal());
return this;

View File

@@ -349,20 +349,6 @@ public class LightManager {
* @see View#setShadowType
*/
/**
* The number of MSAA samples to use when rendering VSM shadow maps.
* Must be a power-of-two and greater than or equal to 1. A value of 1 effectively turns
* off MSAA.
* Higher values may not be available depending on the underlying hardware.
*
* <p>
* <strong>Warning: This API is still experimental and subject to change.</strong>
* </p>
*/
@IntRange(from = 1)
public int vsmMsaaSamples = 1;
/**
* When elvsm is set to true, "Exponential Layered VSM without Layers" are used. It is
* an improvement to the default EVSM which suffers important light leaks. Enabling
@@ -519,7 +505,7 @@ public class LightManager {
options.shadowFarHint, options.stable, options.lispsm,
options.polygonOffsetConstant, options.polygonOffsetSlope,
options.screenSpaceContactShadows,
options.stepCount, options.maxShadowDistance, options.vsmMsaaSamples,
options.stepCount, options.maxShadowDistance,
options.elvsm, options.blurWidth, options.shadowBulbRadius);
return this;
}
@@ -1018,8 +1004,6 @@ public class LightManager {
* lightbulbs.
*
* @param efficiency Efficiency in percent. This depends on the type of lightbulb used.
*
* @return This Builder, for chaining calls.
*/
public void setIntensity(@EntityInstance int i, float watts, float efficiency) {
nSetIntensity(mNativeObject, i , watts, efficiency);
@@ -1185,7 +1169,7 @@ public class LightManager {
boolean stable, boolean lispsm,
float polygonOffsetConstant, float polygonOffsetSlope,
boolean screenSpaceContactShadows, int stepCount, float maxShadowDistance,
int vsmMsaaSamples, boolean elvsm, float blurWidth, float shadowBulbRadius);
boolean elvsm, float blurWidth, float shadowBulbRadius);
private static native void nBuilderCastLight(long nativeBuilder, boolean enabled);
private static native void nBuilderPosition(long nativeBuilder, float x, float y, float z);
private static native void nBuilderDirection(long nativeBuilder, float x, float y, float z);

View File

@@ -503,6 +503,17 @@ public class Material {
return nIsDoubleSided(getNativeObject());
}
/**
* Indicates whether instances of this material will use alpha to coverage.
*
* @see
* <a href="https://google.github.io/filament/Materials.html#materialdefinitions/materialblock/rasterization:alphatocoverage">
* Rasterization: alphaToCoverage</a>
*/
public boolean isAlphaToCoverageEnabled() {
return nIsAlphaToCoverageEnabled(getNativeObject());
}
/**
* Returns the alpha mask threshold used when the blending mode is set to masked.
*
@@ -915,6 +926,7 @@ public class Material {
private static native boolean nIsDepthWriteEnabled(long nativeMaterial);
private static native boolean nIsDepthCullingEnabled(long nativeMaterial);
private static native boolean nIsDoubleSided(long nativeMaterial);
private static native boolean nIsAlphaToCoverageEnabled(long nativeMaterial);
private static native float nGetMaskThreshold(long nativeMaterial);
private static native float nGetSpecularAntiAliasingVariance(long nativeMaterial);
private static native float nGetSpecularAntiAliasingThreshold(long nativeMaterial);

View File

@@ -257,23 +257,79 @@ public class RenderableManager {
* Provides coarse-grained control over draw order.
*
* <p>In general Filament reserves the right to re-order renderables to allow for efficient
* rendering. However clients can control ordering at a coarse level using <em>priority</em>.</p>
* rendering. However clients can control ordering at a coarse level using \em priority.
* The priority is applied separately for opaque and translucent objects, that is, opaque
* objects are always drawn before translucent objects regardless of the priority.</p>
*
* <p>For example, this could be used to draw a semitransparent HUD, if a client wishes to
* avoid using a separate View for the HUD. Note that priority is completely orthogonal to
* {@link Builder#layerMask}, which merely controls visibility.</p>
* <p>The Skybox always using the lowest priority, so it's drawn last, which may improve
* performance.</p>
*
* <p>The priority is clamped to the range [0..7], defaults to 4; 7 is lowest priority
* (rendered last).</p>
*
* @see Builder#blendOrder
*/
/**
* Provides coarse-grained control over draw order.
*
* <p>In general Filament reserves the right to re-order renderables to allow for efficient
* rendering. However clients can control ordering at a coarse level using priority.
* The priority is applied separately for opaque and translucent objects, that is, opaque
* objects are always drawn before translucent objects regardless of the priority.</p>
*
* <p>For example, this could be used to draw a semitransparent HUD, if a client wishes to
* avoid using a separate View for the HUD. Note that priority is completely orthogonal to
* {@link Builder#layerMask}, which merely controls visibility.</p>
* <p>The Skybox always using the lowest priority, so it's drawn last, which may improve
* performance.</p>
*
* @param priority clamped to the range [0..7], defaults to 4; 7 is lowest priority
* (rendered last).
*
* @return Builder reference for chaining calls.
*
* @see Builder#channel
* @see Builder#blendOrder
* @see #setPriority
* @see #setBlendOrderAt
*/
@NonNull
public Builder priority(@IntRange(from = 0, to = 7) int priority) {
nBuilderPriority(mNativeBuilder, priority);
return this;
}
/**
* Set the channel this renderable is associated to. There can be 4 channels.
*
* <p>All renderables in a given channel are rendered together, regardless of anything else.
* They are sorted as usual within a channel.</p>
* <p>Channels work similarly to priorities, except that they enforce the strongest
* ordering.</p>
*
* <p>Channels 0 and 1 may not have render primitives using a material with `refractionType`
* set to `screenspace`.</p>
*
* @param channel clamped to the range [0..3], defaults to 2.
*
* @return Builder reference for chaining calls.
*
* @see Builder::blendOrder()
* @see Builder::priority()
* @see RenderableManager::setBlendOrderAt()
*/
@NonNull
public Builder channel(@IntRange(from = 0, to = 3) int channel) {
nBuilderChannel(mNativeBuilder, channel);
return this;
}
/**
* Controls frustum culling, true by default.
*
@@ -300,16 +356,16 @@ public class RenderableManager {
/**
* Specifies the number of draw instance of this renderable. The default is 1 instance and
* the maximum number of instances allowed is 65535. 0 is invalid.
* the maximum number of instances allowed is 32767. 0 is invalid.
* All instances are culled using the same bounding box, so care must be taken to make
* sure all instances render inside the specified bounding box.
* The material can use getInstanceIndex() in the vertex shader to get the instance index and
* possibly adjust the position or transform.
*
* @param instanceCount the number of instances silently clamped between 1 and 65535.
* @param instanceCount the number of instances silently clamped between 1 and 32767.
*/
@NonNull
public Builder instances(@IntRange(from = 1, to = 65535) int instanceCount) {
public Builder instances(@IntRange(from = 1, to = 32767) int instanceCount) {
nBuilderInstances(mNativeBuilder, instanceCount);
return this;
}
@@ -361,7 +417,19 @@ public class RenderableManager {
*/
@NonNull
public Builder enableSkinningBuffers(boolean enabled) {
nEnableSkinningBuffers(mNativeBuilder, enabled);
nBuilderEnableSkinningBuffers(mNativeBuilder, enabled);
return this;
}
/**
* Controls if this renderable is affected by the large-scale fog.
* @param enabled If true, enables large-scale fog on this object. Disables it otherwise.
* True by default.
* @return this <code>Builder</code> object for chaining calls
*/
@NonNull
public Builder fog(boolean enabled) {
nBuilderFog(mNativeBuilder, enabled);
return this;
}
@@ -655,6 +723,15 @@ public class RenderableManager {
nSetPriority(mNativeObject, i, priority);
}
/**
* Changes the channel of a renderable
*
* @see Builder#channel
*/
public void setChannel(@EntityInstance int i, @IntRange(from = 0, to = 3) int channel) {
nSetChannel(mNativeObject, i, channel);
}
/**
* Changes whether or not frustum culling is on.
*
@@ -664,6 +741,23 @@ public class RenderableManager {
nSetCulling(mNativeObject, i, enabled);
}
/**
* Changes whether or not the large-scale fog is applied to this renderable
* @see Builder#fog
*/
public void setFogEnabled(@EntityInstance int i, boolean enabled) {
nSetFogEnabled(mNativeObject, i, enabled);
}
/**
* Returns whether large-scale fog is enabled for this renderable.
* @return True if fog is enabled for this renderable.
* @see Builder#fog
*/
public boolean getFogEnabled(@EntityInstance int i) {
return nGetFogEnabled(mNativeObject, i);
}
/**
* Enables or disables a light channel.
* Light channel 0 is enabled by default.
@@ -876,6 +970,7 @@ public class RenderableManager {
private static native void nBuilderBoundingBox(long nativeBuilder, float cx, float cy, float cz, float ex, float ey, float ez);
private static native void nBuilderLayerMask(long nativeBuilder, int select, int value);
private static native void nBuilderPriority(long nativeBuilder, int priority);
private static native void nBuilderChannel(long nativeBuilder, int channel);
private static native void nBuilderCulling(long nativeBuilder, boolean enabled);
private static native void nBuilderCastShadows(long nativeBuilder, boolean enabled);
private static native void nBuilderReceiveShadows(long nativeBuilder, boolean enabled);
@@ -885,7 +980,8 @@ public class RenderableManager {
private static native void nBuilderSkinningBuffer(long nativeBuilder, long nativeSkinningBuffer, int boneCount, int offset);
private static native void nBuilderMorphing(long nativeBuilder, int targetCount);
private static native void nBuilderSetMorphTargetBufferAt(long nativeBuilder, int level, int primitiveIndex, long nativeMorphTargetBuffer, int offset, int count);
private static native void nEnableSkinningBuffers(long nativeBuilder, boolean enabled);
private static native void nBuilderEnableSkinningBuffers(long nativeBuilder, boolean enabled);
private static native void nBuilderFog(long nativeBuilder, boolean enabled);
private static native void nBuilderLightChannel(long nativeRenderableManager, int channel, boolean enable);
private static native void nBuilderInstances(long nativeRenderableManager, int instances);
@@ -898,7 +994,10 @@ public class RenderableManager {
private static native void nSetAxisAlignedBoundingBox(long nativeRenderableManager, int i, float cx, float cy, float cz, float ex, float ey, float ez);
private static native void nSetLayerMask(long nativeRenderableManager, int i, int select, int value);
private static native void nSetPriority(long nativeRenderableManager, int i, int priority);
private static native void nSetChannel(long nativeRenderableManager, int i, int channel);
private static native void nSetCulling(long nativeRenderableManager, int i, boolean enabled);
private static native void nSetFogEnabled(long nativeRenderableManager, int i, boolean enabled);
private static native boolean nGetFogEnabled(long nativeRenderableManager, int i);
private static native void nSetLightChannel(long nativeRenderableManager, int i, int channel, boolean enable);
private static native boolean nGetLightChannel(long nativeRenderableManager, int i, int channel);
private static native void nSetCastShadows(long nativeRenderableManager, int i, boolean enabled);

View File

@@ -124,7 +124,24 @@ public class Renderer {
*/
public static class ClearOptions {
/**
* Color to use to clear the SwapChain
* Color (sRGB linear) to use to clear the RenderTarget (typically the SwapChain).
*
* The RenderTarget is cleared using this color, which won't be tone-mapped since
* tone-mapping is part of View rendering (this is not).
*
* When a View is rendered, there are 3 scenarios to consider:
* - Pixels rendered by the View replace the clear color (or blend with it in
* `BlendMode.TRANSLUCENT` mode).
*
* - With blending mode set to `BlendMode.TRANSLUCENT`, Pixels untouched by the View
* are considered fulling transparent and let the clear color show through.
*
* - With blending mode set to `BlendMode.OPAQUE`, Pixels untouched by the View
* are set to the clear color. However, because it is now used in the context of a View,
* it will go through the post-processing stage, which includes tone-mapping.
*
* For consistency, it is recommended to always use a Skybox to clear an opaque View's
* background, or to use black or fully-transparent (i.e. {0,0,0,0}) as the clear color.
*/
@NonNull
public float[] clearColor = { 0.0f, 0.0f, 0.0f, 0.0f };

View File

@@ -91,11 +91,34 @@ public class SwapChain {
*/
public static final long CONFIG_ENABLE_XCB = 0x4;
/**
* Indicates that the SwapChain must automatically perform linear to sRGB encoding.
*
* This flag is ignored if isSRGBSwapChainSupported() is false.
*
* When using this flag, post-processing should be disabled.
*
* @see SwapChain#isSRGBSwapChainSupported
* @see View#setPostProcessingEnabled
*/
public static final long CONFIG_SRGB_COLORSPACE = 0x10;
SwapChain(long nativeSwapChain, Object surface) {
mNativeObject = nativeSwapChain;
mSurface = surface;
}
/**
* Return whether createSwapChain supports the SWAP_CHAIN_CONFIG_SRGB_COLORSPACE flag.
* The default implementation returns false.
*
* @param engine A reference to the filament Engine
* @return true if SWAP_CHAIN_CONFIG_SRGB_COLORSPACE is supported, false otherwise.
*/
public static boolean isSRGBSwapChainSupported(@NonNull Engine engine) {
return nIsSRGBSwapChainSupported(engine.getNativeObject());
}
/**
* @return the native <code>Object</code> this <code>SwapChain</code> was created from or null
* for a headless SwapChain.
@@ -141,4 +164,5 @@ public class SwapChain {
}
private static native void nSetFrameCompletedCallback(long nativeSwapChain, Object handler, Runnable callback);
private static native boolean nIsSRGBSwapChainSupported(long nativeEngine);
}

View File

@@ -250,7 +250,19 @@ public class Texture {
SRGB8_ALPHA8_ASTC_10x8,
SRGB8_ALPHA8_ASTC_10x10,
SRGB8_ALPHA8_ASTC_12x10,
SRGB8_ALPHA8_ASTC_12x12
SRGB8_ALPHA8_ASTC_12x12,
// RGTC formats available with a GLES extension
RED_RGTC1, // BC4 unsigned
SIGNED_RED_RGTC1, // BC4 signed
RED_GREEN_RGTC2, // BC5 unsigned
SIGNED_RED_GREEN_RGTC2, // BC5 signed
// BPTC formats available with a GLES extension
RGB_BPTC_SIGNED_FLOAT, // BC6H signed
RGB_BPTC_UNSIGNED_FLOAT,// BC6H unsigned
RGBA_BPTC_UNORM, // BC7
SRGB_ALPHA_BPTC_UNORM // BC7 sRGB
}
/**
@@ -296,7 +308,19 @@ public class Texture {
SRGB8_ALPHA8_ASTC_10x8,
SRGB8_ALPHA8_ASTC_10x10,
SRGB8_ALPHA8_ASTC_12x10,
SRGB8_ALPHA8_ASTC_12x12
SRGB8_ALPHA8_ASTC_12x12,
// RGTC formats available with a GLES extension
RED_RGTC1, // BC4 unsigned
SIGNED_RED_RGTC1, // BC4 signed
RED_GREEN_RGTC2, // BC5 unsigned
SIGNED_RED_GREEN_RGTC2, // BC5 signed
// BPTC formats available with a GLES extension
RGB_BPTC_SIGNED_FLOAT, // BC6H signed
RGB_BPTC_UNSIGNED_FLOAT,// BC6H unsigned
RGBA_BPTC_UNORM, // BC7
SRGB_ALPHA_BPTC_UNORM // BC7 sRGB
}
/**

View File

@@ -276,7 +276,7 @@ public class TextureSampler {
}
/**
* Sets the wrapping mode in the t (depth) direction.
* Sets the wrapping mode in the r (depth) direction.
* @param mode wrapping mode
*/
public void setWrapModeR(WrapMode mode) {

View File

@@ -962,9 +962,10 @@ public class View {
assertFloat3In(options.color);
mFogOptions = options;
nSetFogOptions(getNativeObject(), options.distance, options.maximumOpacity, options.height,
options.heightFalloff, options.color[0], options.color[1], options.color[2],
options.heightFalloff, options.cutOffDistance,
options.color[0], options.color[1], options.color[2],
options.density, options.inScatteringStart, options.inScatteringSize,
options.fogColorFromIbl,
options.fogColorFromIbl, options.skyColor.getNativeObject(),
options.enabled);
}
@@ -1116,6 +1117,51 @@ public class View {
float mFragCoordsZ;
}
/**
* Set the value of material global variables. There are up-to four such variable each of
* type float4. These variables can be read in a user Material with
* `getMaterialGlobal{0|1|2|3}()`. All variable start with a default value of { 0, 0, 0, 1 }
*
* @param index index of the variable to set between 0 and 3.
* @param value new value for the variable.
* @see #getMaterialGlobal
*/
public void setMaterialGlobal(int index, @NonNull @Size(min = 4) float[] value) {
Asserts.assertFloat4In(value);
nSetMaterialGlobal(getNativeObject(), index, value[0], value[1], value[2], value[3]);
}
/**
* Get the value of the material global variables.
* All variable start with a default value of { 0, 0, 0, 1 }
*
* @param index index of the variable to set between 0 and 3.
* @param out A 4-float array where the value will be stored, or null in which case the array is
* allocated.
* @return A 4-float array containing the current value of the variable.
* @see #setMaterialGlobal
*/
@NonNull @Size(min = 4)
public float[] getMaterialGlobal(int index, @Nullable @Size(min = 4) float[] out) {
out = Asserts.assertFloat4(out);
nGetMaterialGlobal(getNativeObject(), index, out);
return out;
}
/**
* Get an Entity representing the large scale fog object.
* This entity is always inherited by the View's Scene.
*
* It is for example possible to create a TransformManager component with this
* Entity and apply a transformation globally on the fog.
*
* @return an Entity representing the large scale fog object.
*/
@Entity
public int getFogEntity() {
return nGetFogEntity(getNativeObject());
}
public long getNativeObject() {
if (mNativeObject == 0) {
throw new IllegalStateException("Calling method on destroyed View");
@@ -1157,7 +1203,7 @@ public class View {
private static native void nSetSSCTOptions(long nativeView, float ssctLightConeRad, float ssctStartTraceDistance, float ssctContactDistanceMax, float ssctIntensity, float v, float v1, float v2, float ssctDepthBias, float ssctDepthSlopeBias, int ssctSampleCount, int ssctRayCount, boolean ssctEnabled);
private static native void nSetBloomOptions(long nativeView, long dirtNativeObject, float dirtStrength, float strength, int resolution, float anamorphism, int levels, int blendMode, boolean threshold, boolean enabled, float highlight,
boolean lensFlare, boolean starburst, float chromaticAberration, int ghostCount, float ghostSpacing, float ghostThreshold, float haloThickness, float haloRadius, float haloThreshold);
private static native void nSetFogOptions(long nativeView, float distance, float maximumOpacity, float height, float heightFalloff, float v, float v1, float v2, float density, float inScatteringStart, float inScatteringSize, boolean fogColorFromIbl, boolean enabled);
private static native void nSetFogOptions(long nativeView, float distance, float maximumOpacity, float height, float heightFalloff, float cutOffDistance, float v, float v1, float v2, float density, float inScatteringStart, float inScatteringSize, boolean fogColorFromIbl, long skyColorNativeObject, boolean enabled);
private static native void nSetBlendMode(long nativeView, int blendMode);
private static native void nSetDepthOfFieldOptions(long nativeView, float cocScale, float maxApertureDiameter, boolean enabled, int filter,
boolean nativeResolution, int foregroundRingCount, int backgroundRingCount, int fastGatherRingCount, int maxForegroundCOC, int maxBackgroundCOC);
@@ -1172,6 +1218,10 @@ public class View {
private static native void nPick(long nativeView, int x, int y, Object handler, InternalOnPickCallback internalCallback);
private static native void nSetStencilBufferEnabled(long nativeView, boolean enabled);
private static native boolean nIsStencilBufferEnabled(long nativeView);
private static native void nSetMaterialGlobal(long nativeView, int index, float x, float y, float z, float w);
private static native void nGetMaterialGlobal(long nativeView, int index, float[] out);
private static native int nGetFogEntity(long nativeView);
/**
* List of available ambient occlusion techniques.
@@ -1392,48 +1442,109 @@ public class View {
}
/**
* Options to control fog in the scene
* Options to control large-scale fog in the scene
*/
public static class FogOptions {
/**
* distance in world units from the camera where the fog starts ( >= 0.0 )
* Distance in world units [m] from the camera to where the fog starts ( >= 0.0 )
*/
public float distance = 0.0f;
/**
* Distance in world units [m] after which the fog calculation is disabled.
* This can be used to exclude the skybox, which is desirable if it already contains clouds or
* fog. The default value is +infinity which applies the fog to everything.
*
* Note: The SkyBox is typically at a distance of 1e19 in world space (depending on the near
* plane distance and projection used though).
*/
public float cutOffDistance = Float.POSITIVE_INFINITY;
/**
* fog's maximum opacity between 0 and 1
*/
public float maximumOpacity = 1.0f;
/**
* fog's floor in world units
* Fog's floor in world units [m]. This sets the "sea level".
*/
public float height = 0.0f;
/**
* how fast fog dissipates with altitude
* How fast the fog dissipates with altitude. heightFalloff has a unit of [1/m].
* It can be expressed as 1/H, where H is the altitude change in world units [m] that causes a
* factor 2.78 (e) change in fog density.
*
* A falloff of 0 means the fog density is constant everywhere and may result is slightly
* faster computations.
*/
public float heightFalloff = 1.0f;
/**
* fog's color (linear), see fogColorFromIbl
* Fog's color is used for ambient light in-scattering, a good value is
* to use the average of the ambient light, possibly tinted towards blue
* for outdoors environments. Color component's values should be between 0 and 1, values
* above one are allowed but could create a non energy-conservative fog (this is dependant
* on the IBL's intensity as well).
*
* We assume that our fog has no absorption and therefore all the light it scatters out
* becomes ambient light in-scattering and has lost all directionality, i.e.: scattering is
* isotropic. This somewhat simulates Rayleigh scattering.
*
* This value is used as a tint instead, when fogColorFromIbl is enabled.
*
* @see fogColorFromIbl
*/
@NonNull @Size(min = 3)
public float[] color = {0.5f, 0.5f, 0.5f};
public float[] color = {1.0f, 1.0f, 1.0f};
/**
* fog's density at altitude given by 'height'
* Extinction factor in [1/m] at altitude 'height'. The extinction factor controls how much
* light is absorbed and out-scattered per unit of distance. Each unit of extinction reduces
* the incoming light to 37% of its original value.
*
* Note: The extinction factor is related to the fog density, it's usually some constant K times
* the density at sea level (more specifically at fog height). The constant K depends on
* the composition of the fog/atmosphere.
*
* For historical reason this parameter is called `density`.
*/
public float density = 0.1f;
/**
* distance in world units from the camera where in-scattering starts
* Distance in world units [m] from the camera where the Sun in-scattering starts.
*/
public float inScatteringStart = 0.0f;
/**
* size of in-scattering (>0 to activate). Good values are >> 1 (e.g. ~10 - 100).
* Very inaccurately simulates the Sun's in-scattering. That is, the light from the sun that
* is scattered (by the fog) towards the camera.
* Size of the Sun in-scattering (>0 to activate). Good values are >> 1 (e.g. ~10 - 100).
* Smaller values result is a larger scattering size.
*/
public float inScatteringSize = -1.0f;
/**
* Fog color will be modulated by the IBL color in the view direction.
* The fog color will be sampled from the IBL in the view direction and tinted by `color`.
* Depending on the scene this can produce very convincing results.
*
* This simulates a more anisotropic phase-function.
*
* `fogColorFromIbl` is ignored when skyTexture is specified.
*
* @see skyColor
*/
public boolean fogColorFromIbl = false;
/**
* enable or disable fog
* skyTexture must be a mipmapped cubemap. When provided, the fog color will be sampled from
* this texture, higher resolution mip levels will be used for objects at the far clip plane,
* and lower resolution mip levels for objects closer to the camera. The skyTexture should
* typically be heavily blurred; a typical way to produce this texture is to blur the base
* level with a strong gaussian filter or even an irradiance filter and then generate mip
* levels as usual. How blurred the base level is somewhat of an artistic decision.
*
* This simulates a more anisotropic phase-function.
*
* `fogColorFromIbl` is ignored when skyTexture is specified.
*
* @see Texture
* @see fogColorFromIbl
*/
@Nullable
public Texture skyColor = null;
/**
* Enable or disable large-scale fog
*/
public boolean enabled = false;
}
@@ -1817,6 +1928,13 @@ public class View {
* Whether to generate mipmaps for all VSM shadow maps.
*/
public boolean mipmapping = false;
/**
* The number of MSAA samples to use when rendering VSM shadow maps.
* Must be a power-of-two and greater than or equal to 1. A value of 1 effectively turns
* off MSAA.
* Higher values may not be available depending on the underlying hardware.
*/
public int msaaSamples = 1;
/**
* Whether to use a 32-bits or 16-bits texture format for VSM shadow maps. 32-bits
* precision is rarely needed, but it does reduces light leaks as well as "fading"

View File

@@ -0,0 +1,60 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.filament.android;
import com.google.android.filament.Engine;
import com.google.android.filament.Fence;
public class FilamentHelper {
/**
* Wait for all pending frames to be processed before returning. This is to avoid a race
* between the surface being resized before pending frames are rendered into it.
* <p>
* For {@link android.view.TextureView} this must be called before the texture's size is
* reconfigured, which unfortunately is done by the Android framework before
* {@link UiHelper} listeners are invoked. Therefore <code>synchronizePendingFrames</code>
* cannot be called from
* {@link android.view.TextureView.SurfaceTextureListener#onSurfaceTextureSizeChanged}; instead
* a subclass of {@link android.view.TextureView} must be used in order to call it from
* {@link android.view.TextureView#onSizeChanged}:
* </p>
* <pre>
* public class MyTextureView extends TextureView {
* private Engine engine;
* protected void onSizeChanged(int w, int h, int oldw, int oldh) {
* FilamentHelper.synchronizePendingFrames(engine);
* super.onSizeChanged(w, h, oldw, oldh);
* }
* }
* </pre>
*
* Otherwise, this is typically called from {@link UiHelper.RendererCallback#onResized},
* {@link android.view.SurfaceHolder.Callback#surfaceChanged}.
*
* @param engine Filament engine to synchronize
*
* @see UiHelper.RendererCallback#onResized
* @see android.view.SurfaceHolder.Callback#surfaceChanged
* @see android.view.TextureView#onSizeChanged
*/
static public void synchronizePendingFrames(Engine engine) {
Fence fence = engine.createFence();
fence.wait(Fence.Mode.FLUSH, Fence.WAIT_FOR_EVER);
engine.destroyFence(fence);
}
}

View File

@@ -84,6 +84,14 @@ import com.google.android.filament.SwapChain;
* // The native surface has changed size. This is always called at least once
* // after the surface is created (after onNativeWindowChanged() is invoked).
* public void onResized(int width, int height) {
*
* // Wait for all pending frames to be processed before returning. This is to
* // avoid a race between the surface being resized before pending frames are
* // rendered into it.
* Fence fence = mEngine.createFence();
* fence.wait(Fence.Mode.FLUSH, Fence.WAIT_FOR_EVER);
* mEngine.destroyFence(fence);
*
* // Compute camera projection and set the viewport on the view
* }
* });
@@ -175,7 +183,7 @@ public class UiHelper {
}
private static class SurfaceViewHandler implements RenderSurface {
private SurfaceView mSurfaceView;
private final SurfaceView mSurfaceView;
SurfaceViewHandler(SurfaceView surface) {
mSurfaceView = surface;
@@ -192,7 +200,7 @@ public class UiHelper {
}
private static class SurfaceHolderHandler implements RenderSurface {
private SurfaceHolder mSurfaceHolder;
private final SurfaceHolder mSurfaceHolder;
SurfaceHolderHandler(SurfaceHolder surface) {
mSurfaceHolder = surface;
@@ -209,7 +217,7 @@ public class UiHelper {
}
private class TextureViewHandler implements RenderSurface {
private TextureView mTextureView;
private final TextureView mTextureView;
private Surface mSurface;
TextureViewHandler(TextureView surface) { mTextureView = surface; }
@@ -236,6 +244,10 @@ public class UiHelper {
}
mSurface = surface;
}
public Surface getSurface() {
return mSurface;
}
}
/**
@@ -481,6 +493,14 @@ public class UiHelper {
} else {
mRenderCallback.onResized(width, height);
}
// We must recreate the SwapChain to guarantee that it sees the new size.
// More precisely, for an EGL client, the EGLSurface must be recreated. For
// a Vulkan client, the SwapChain must be recreated. Calling
// onNativeWindowChanged() will accomplish that.
// This requirement comes from SurfaceTexture.setDefaultBufferSize()
// documentation.
TextureViewHandler textureViewHandler = (TextureViewHandler) mRenderSurface;
mRenderCallback.onNativeWindowChanged(textureViewHandler.getSurface());
}
@Override

View File

@@ -1,4 +1,7 @@
apply plugin: 'kotlin-android'
kotlin {
jvmToolchain(versions.jdk)
}
android {
namespace 'com.google.android.filament.utils'
@@ -21,16 +24,11 @@ android {
excludes += ['lib/*/libfilament-jni.so', 'lib/*/libgltfio-jni.so']
}
}
}
configurations.all { config ->
// Hack to preserve the version of the dependencies
if (!config.name.endsWith('Publication')) {
resolutionStrategy {
dependencySubstitution {
substitute(module("com.google.android.filament:gltfio-android:${VERSION_NAME}")).with(project(":gltfio-android"))
substitute(module("com.google.android.filament:gltfio-android-lite:${VERSION_NAME}")).with(project(":gltfio-android"))
}
publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
}
@@ -43,7 +41,7 @@ dependencies {
implementation deps.coroutines.android
api project(':filament-android')
api module("com.google.android.filament:gltfio-android:${VERSION_NAME}")
api project(':gltfio-android')
}
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')

View File

@@ -166,6 +166,8 @@ Java_com_google_android_filament_utils_AutomationEngine_nGetViewerOptions(JNIEnv
const jfieldID cameraAperture = env->GetFieldID(klass, "cameraAperture", "F");
const jfieldID cameraSpeed = env->GetFieldID(klass, "cameraSpeed", "F");
const jfieldID cameraISO = env->GetFieldID(klass, "cameraISO", "F");
const jfieldID cameraNear = env->GetFieldID(klass, "cameraNear", "F");
const jfieldID cameraFar = env->GetFieldID(klass, "cameraFar", "F");
const jfieldID groundShadowStrength = env->GetFieldID(klass, "groundShadowStrength", "F");
const jfieldID groundPlaneEnabled = env->GetFieldID(klass, "groundPlaneEnabled", "Z");
const jfieldID skyboxEnabled = env->GetFieldID(klass, "skyboxEnabled", "Z");
@@ -177,6 +179,8 @@ Java_com_google_android_filament_utils_AutomationEngine_nGetViewerOptions(JNIEnv
env->SetFloatField(result, cameraAperture, options.cameraAperture);
env->SetFloatField(result, cameraSpeed, options.cameraSpeed);
env->SetFloatField(result, cameraISO, options.cameraISO);
env->SetFloatField(result, cameraNear, options.cameraNear);
env->SetFloatField(result, cameraFar, options.cameraFar);
env->SetFloatField(result, groundShadowStrength, options.groundShadowStrength);
env->SetBooleanField(result, groundPlaneEnabled, options.groundPlaneEnabled);
env->SetBooleanField(result, skyboxEnabled, options.skyboxEnabled);

View File

@@ -97,6 +97,8 @@ public class AutomationEngine {
public float cameraAperture = 16.0f;
public float cameraSpeed = 125.0f;
public float cameraISO = 100.0f;
public float cameraNear = 0.1f;
public float cameraFar = 100.0f;
public float groundShadowStrength = 0.75f;
public boolean groundPlaneEnabled = false;
public boolean skyboxEnabled = true;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
@file:Suppress("unused")
@file:Suppress("NOTHING_TO_INLINE", "unused")
package com.google.android.filament.utils
@@ -24,8 +24,16 @@ enum class MatrixColumn {
X, Y, Z, W
}
enum class RotationsOrder {
XYZ, XZY, YXZ, YZX, ZXY, ZYX
enum class RotationsOrder(
val yaw: VectorComponent,
val pitch: VectorComponent,
val roll: VectorComponent) {
XYZ(VectorComponent.X, VectorComponent.Y, VectorComponent.Z),
XZY(VectorComponent.X, VectorComponent.Z, VectorComponent.Y),
YXZ(VectorComponent.Y, VectorComponent.X, VectorComponent.Z),
YZX(VectorComponent.Y, VectorComponent.Z, VectorComponent.X),
ZXY(VectorComponent.Z, VectorComponent.X, VectorComponent.Y),
ZYX(VectorComponent.Z, VectorComponent.Y, VectorComponent.X);
}
data class Mat2(
@@ -77,6 +85,12 @@ data class Mat2(
operator fun minus(v: Float) = Mat2(x - v, y - v)
operator fun times(v: Float) = Mat2(x * v, y * v)
operator fun div(v: Float) = Mat2(x / v, y / v)
inline fun compareTo(v: Float, delta: Float = 0.0f) = Mat2(
x.compareTo(v, delta),
y.compareTo(v, delta)
)
inline fun equals(v: Float, delta: Float = 0.0f) = x.equals(v, delta) && y.equals(v, delta)
operator fun times(m: Mat2) = Mat2(
Float2(
@@ -89,12 +103,18 @@ data class Mat2(
)
)
inline fun compareTo(m: Mat2, delta: Float = 0.0f) = Mat2(
x.compareTo(m.x, delta),
y.compareTo(m.y, delta)
)
inline fun equals(m: Mat2, delta: Float = 0.0f) = x.equals(m.x, delta) && y.equals(m.y, delta)
operator fun times(v: Float2) = Float2(
x.x * v.x + y.x * v.y,
x.y * v.x + y.y * v.y,
)
fun toFloatArray() = floatArrayOf(
x.x, y.x,
x.y, y.y
@@ -106,7 +126,6 @@ data class Mat2(
|${x.y} ${y.y}|
""".trimIndent()
}
}
data class Mat3(
@@ -162,6 +181,14 @@ data class Mat3(
operator fun minus(v: Float) = Mat3(x - v, y - v, z - v)
operator fun times(v: Float) = Mat3(x * v, y * v, z * v)
operator fun div(v: Float) = Mat3(x / v, y / v, z / v)
inline fun compareTo(v: Float, delta: Float = 0.0f) = Mat3(
x.compareTo(v, delta),
y.compareTo(v, delta),
z.compareTo(v, delta)
)
inline fun equals(v: Float, delta: Float = 0.0f) =
x.equals(v, delta) && y.equals(v, delta) && z.equals(v, delta)
operator fun times(m: Mat3) = Mat3(
Float3(
@@ -181,6 +208,15 @@ data class Mat3(
)
)
inline fun compareTo(m: Mat3, delta: Float = 0.0f) = Mat3(
x.compareTo(m.x, delta),
y.compareTo(m.y, delta),
z.compareTo(m.z, delta)
)
inline fun equals(m: Mat3, delta: Float = 0.0f) =
x.equals(m.x, delta) && y.equals(m.y, delta) && z.equals(m.z, delta)
operator fun times(v: Float3) = Float3(
x.x * v.x + y.x * v.y + z.x * v.z,
x.y * v.x + y.y * v.y + z.y * v.z,
@@ -212,6 +248,7 @@ data class Mat4(
constructor(m: Mat4) : this(m.x.copy(), m.y.copy(), m.z.copy(), m.w.copy())
companion object {
fun of(vararg a: Float): Mat4 {
require(a.size >= 16)
return Mat4(
@@ -302,6 +339,15 @@ data class Mat4(
operator fun minus(v: Float) = Mat4(x - v, y - v, z - v, w - v)
operator fun times(v: Float) = Mat4(x * v, y * v, z * v, w * v)
operator fun div(v: Float) = Mat4(x / v, y / v, z / v, w / v)
inline fun compareTo(v: Float, delta: Float = 0.0f) = Mat4(
x.compareTo(v, delta),
y.compareTo(v, delta),
z.compareTo(v, delta),
w.compareTo(v, delta)
)
inline fun equals(v: Float, delta: Float = 0.0f) =
x.equals(v, delta) && y.equals(v, delta) && z.equals(v, delta) && w.equals(v, delta)
operator fun times(m: Mat4) = Mat4(
Float4(
@@ -330,6 +376,16 @@ data class Mat4(
)
)
inline fun compareTo(m: Mat4, delta: Float = 0.0f) = Mat4(
x.compareTo(m.x, delta),
y.compareTo(m.y, delta),
z.compareTo(m.z, delta),
w.compareTo(m.w, delta)
)
inline fun equals(m: Mat4, delta: Float = 0.0f) =
x.equals(m.x, delta) && y.equals(m.y, delta) && z.equals(m.z, delta) && w.equals(m.w, delta)
operator fun times(v: Float4) = Float4(
x.x * v.x + y.x * v.y + z.x * v.z+ w.x * v.w,
x.y * v.x + y.y * v.y + z.y * v.z+ w.y * v.w,
@@ -337,6 +393,26 @@ data class Mat4(
x.w * v.x + y.w * v.y + z.w * v.z+ w.w * v.w
)
/**
* Get the Euler angles in degrees from this rotation Matrix
*
* Don't forget to extract the rotation with [rotation] if this is a transposed matrix
*
* @param order The order in which to apply rotations.
* Default is [RotationsOrder.ZYX] which means that the object will first be rotated around its Z
* axis, then its Y axis and finally its X axis.
*
* @see eulerAngles
*/
fun toEulerAngles(order: RotationsOrder = RotationsOrder.ZYX) = eulerAngles(this, order)
/**
* Get the [Quaternion] from this rotation Matrix
*
* Don't forget to extract the rotation with [rotation] if this is a transposed matrix
*
* @see quaternion
*/
fun toQuaternion() = quaternion(this)
fun toFloatArray() = floatArrayOf(
@@ -356,6 +432,78 @@ data class Mat4(
}
}
inline fun equal(a: Mat2, b: Float, delta: Float = 0.0f) = Bool2(
a.x.equals(b, delta),
a.y.equals(b, delta)
)
inline fun equal(a: Mat2, b: Mat2, delta: Float = 0.0f) = Bool2(
a.x.equals(b.x, delta),
a.y.equals(b.y, delta)
)
inline fun notEqual(a: Mat2, b: Float, delta: Float = 0.0f) = Bool2(
!a.x.equals(b, delta),
!a.y.equals(b, delta)
)
inline fun notEqual(a: Mat2, b: Mat2, delta: Float = 0.0f) = Bool2(
!a.x.equals(b.x, delta),
!a.y.equals(b.y, delta)
)
inline fun equal(a: Mat3, b: Float, delta: Float = 0.0f) = Bool3(
a.x.equals(b, delta),
a.y.equals(b, delta),
a.z.equals(b, delta)
)
inline fun equal(a: Mat3, b: Mat3, delta: Float = 0.0f) = Bool3(
a.x.equals(b.x, delta),
a.y.equals(b.y, delta),
a.z.equals(b.z, delta)
)
inline fun notEqual(a: Mat3, b: Float, delta: Float = 0.0f) = Bool3(
!a.x.equals(b, delta),
!a.y.equals(b, delta),
!a.z.equals(b, delta)
)
inline fun notEqual(a: Mat3, b: Mat3, delta: Float = 0.0f) = Bool3(
!a.x.equals(b.x, delta),
!a.y.equals(b.y, delta),
!a.z.equals(b.z, delta)
)
inline fun equal(a: Mat4, b: Float, delta: Float = 0.0f) = Bool4(
a.x.equals(b, delta),
a.y.equals(b, delta),
a.z.equals(b, delta),
a.w.equals(b, delta)
)
inline fun equal(a: Mat4, b: Mat4, delta: Float = 0.0f) = Bool4(
a.x.equals(b.x, delta),
a.y.equals(b.y, delta),
a.z.equals(b.z, delta),
a.w.equals(b.w, delta)
)
inline fun notEqual(a: Mat4, b: Float, delta: Float = 0.0f) = Bool4(
!a.x.equals(b, delta),
!a.y.equals(b, delta),
!a.z.equals(b, delta),
!a.w.equals(b, delta)
)
inline fun notEqual(a: Mat4, b: Mat4, delta: Float = 0.0f) = Bool4(
!a.x.equals(b.x, delta),
!a.y.equals(b.y, delta),
!a.z.equals(b.z, delta),
!a.w.equals(b.w, delta)
)
fun transpose(m: Mat2) = Mat2(
Float2(m.x.x, m.y.x),
Float2(m.x.y, m.y.y)
@@ -494,14 +642,7 @@ fun rotation(m: Mat4) = Mat4(normalize(m.right), normalize(m.up), normalize(m.fo
*/
fun rotation(d: Float3, order: RotationsOrder = RotationsOrder.ZYX): Mat4 {
val r = transform(d, ::radians)
return when(order) {
RotationsOrder.XZY -> rotation(r.x, r.z, r.y)
RotationsOrder.XYZ -> rotation(r.x, r.y, r.z)
RotationsOrder.YXZ -> rotation(r.y, r.x, r.z)
RotationsOrder.YZX -> rotation(r.y, r.z, r.x)
RotationsOrder.ZYX -> rotation(r.z, r.y, r.x)
RotationsOrder.ZXY -> rotation(r.z, r.x, r.y)
}
return rotation(r[order.yaw], r[order.pitch], r[order.roll], order)
}
/**
@@ -599,13 +740,93 @@ fun rotation(quaternion: Quaternion): Mat4 {
Float4(
2.0f * (n.x * n.z + n.y * n.w),
2.0f * (n.y * n.z - n.x * n.w),
1.0f - 2.0f * (n.x * n.x + n.y * n.y),
1.0f - 2.0f * (n.x * n.x + n.y * n.y)
)
)
}
/**
* Extract Quaternion rotation from a Matrix
* Get the Euler angles in degrees from a rotation Matrix
*
* @param m The rotation matrix.
* Don't forget to extract the rotation with [rotation] if it's transposed
* @param order The order in which to apply rotations.
* Default is [RotationsOrder.ZYX] which means that the object will first be rotated around its Z
* axis, then its Y axis and finally its X axis.
*/
fun eulerAngles(m: Mat4, order: RotationsOrder = RotationsOrder.ZYX): Float3 {
// We need to more simplify this with RotationsOrder VectorComponents mapped to MatrixColumn
return transform(Float3().apply {
when (order) {
RotationsOrder.XYZ -> {
this[order.pitch] = asin(clamp(m.z.x, -1.0f, 1.0f))
if (abs(m.z.x) < 0.9999999f) {
this[order.yaw] = atan2(-m.z.y, m.z.z)
this[order.roll] = atan2(-m.y.x, m.x.x)
} else {
this[order.yaw] = atan2(m.y.z, m.y.y)
this[order.roll] = 0.0f
}
}
RotationsOrder.XZY -> {
this[order.pitch] = asin(-clamp(m.y.x, -1.0f, 1.0f))
if (abs(m.y.x) < 0.9999999f) {
this[order.yaw] = atan2(m.y.z, m.y.y)
this[order.roll] = atan2(m.z.x, m.x.x)
} else {
this[order.yaw] = atan2(-m.z.y, m.z.z)
this[order.roll] = 0.0f
}
}
RotationsOrder.YXZ -> {
this[order.pitch] = asin(-clamp(m.z.y, -1.0f, 1.0f))
if (abs(m.z.y) < 0.9999999f) {
this[order.yaw] = atan2(m.z.x, m.z.z)
this[order.roll] = atan2(m.x.y, m.y.y)
} else {
this[order.yaw] = atan2(-m.x.z, m.x.x)
this[order.roll] = 0.0f
}
}
RotationsOrder.YZX -> {
this[order.pitch] = asin(clamp(m.x.y, -1.0f, 1.0f))
if (abs(m.x.y) < 0.9999999f) {
this[order.roll] = atan2(-m.z.y, m.y.y)
this[order.yaw] = atan2(-m.x.z, m.x.x)
} else {
this[order.roll] = 0.0f
this[order.yaw] = atan2(m.z.x, m.z.z)
}
}
RotationsOrder.ZXY -> {
this[order.pitch] = asin(clamp(m.y.z, -1.0f, 1.0f))
if (abs(m.y.z) < 0.9999999f) {
this[order.roll] = atan2(-m.x.z, m.z.z)
this[order.yaw] = atan2(-m.y.x, m.y.y)
} else {
this[order.roll] = 0.0f
this[order.yaw] = atan2(m.x.y, m.x.x)
}
}
RotationsOrder.ZYX -> {
this[order.pitch] = asin(-clamp(m.x.z, -1.0f, 1.0f))
if (abs(m.x.z) < 0.9999999f) {
this[order.roll] = atan2(m.y.z, m.z.z)
this[order.yaw] = atan2(m.x.y, m.x.x)
} else {
this[order.roll] = 0.0f
this[order.yaw] = atan2(-m.y.x, m.y.y)
}
}
}
}, ::degrees)
}
/**
* Get the [Quaternion] from a rotation Matrix
*
* @param m The rotation matrix.
* Don't forget to extract the rotation with [rotation] if it's transposed
*/
fun quaternion(m: Mat4): Quaternion {
val trace = m.x.x + m.y.y + m.z.z
@@ -673,9 +894,14 @@ fun perspective(fov: Float, ratio: Float, near: Float, far: Float): Mat4 {
}
fun ortho(l: Float, r: Float, b: Float, t: Float, n: Float, f: Float) = Mat4(
Float4(x = 2.0f / (r - 1.0f)),
Float4(y = 2.0f / (t - b)),
Float4(z = -2.0f / (f - n)),
Float4(-(r + l) / (r - l), -(t + b) / (t - b), -(f + n) / (f - n), 1.0f)
Float4(x = 2.0f / (r - l)),
Float4(y = 2.0f / (t - b)),
Float4(z = -2.0f / (f - n)),
Float4(
-(r + l) / (r - l),
-(t + b) / (t - b),
-(f + n) / (f - n),
1.0f
)
)

View File

@@ -27,8 +27,8 @@ import com.google.android.filament.gltfio.*
import kotlinx.coroutines.*
import java.nio.Buffer
private const val kNearPlane = 0.05 // 5 cm
private const val kFarPlane = 1000.0 // 1 km
private const val kNearPlane = 0.05f // 5 cm
private const val kFarPlane = 1000.0f // 1 km
private const val kAperture = 16f
private const val kShutterSpeed = 1f / 125f
private const val kSensitivity = 100f
@@ -80,6 +80,18 @@ class ModelViewer(
updateCameraProjection()
}
var cameraNear = kNearPlane
set(value) {
field = value
updateCameraProjection()
}
var cameraFar = kFarPlane
set(value) {
field = value
updateCameraProjection()
}
val scene: Scene
val view: View
val camera: Camera
@@ -179,7 +191,7 @@ class ModelViewer(
asset = assetLoader.createAsset(buffer)
asset?.let { asset ->
resourceLoader.asyncBeginLoad(asset)
animator = asset.getInstance().animator
animator = asset.instance.animator
asset.releaseSourceData()
}
}
@@ -202,7 +214,7 @@ class ModelViewer(
resourceLoader.addResourceData(uri, resourceBuffer)
}
resourceLoader.asyncBeginLoad(asset)
animator = asset.getInstance().animator
animator = asset.instance.animator
asset.releaseSourceData()
}
}
@@ -299,7 +311,7 @@ class ModelViewer(
var count = 0
val popRenderables = { count = asset.popRenderables(readyRenderables); count != 0 }
while (popRenderables()) {
for (i in 0..count - 1) {
for (i in 0 until count) {
val ri = rcm.getInstance(readyRenderables[i])
rcm.setScreenSpaceContactShadows(ri, true)
}
@@ -359,7 +371,7 @@ class ModelViewer(
resourceLoader.addResourceData(uri, buffer)
}
resourceLoader.asyncBeginLoad(asset)
animator = asset.getInstance().animator
animator = asset.instance.animator
asset.releaseSourceData()
}
}
@@ -368,7 +380,8 @@ class ModelViewer(
val width = view.viewport.width
val height = view.viewport.height
val aspect = width.toDouble() / height.toDouble()
camera.setLensProjection(cameraFocalLength.toDouble(), aspect, kNearPlane, kFarPlane)
camera.setLensProjection(cameraFocalLength.toDouble(), aspect,
cameraNear.toDouble(), cameraFar.toDouble())
}
inner class SurfaceCallback : UiHelper.RendererCallback {
@@ -392,9 +405,19 @@ class ModelViewer(
view.viewport = Viewport(0, 0, width, height)
cameraManipulator.setViewport(width, height)
updateCameraProjection()
synchronizePendingFrames(engine)
}
}
private fun synchronizePendingFrames(engine: Engine) {
// Wait for all pending frames to be processed before returning. This is to
// avoid a race between the surface being resized before pending frames are
// rendered into it.
val fence = engine.createFence()
fence.wait(Fence.Mode.FLUSH, Fence.WAIT_FOR_EVER)
engine.destroyFence(fence)
}
companion object {
private val kDefaultObjectPosition = Float3(0.0f, 0.0f, -4.0f)
}

View File

@@ -33,9 +33,9 @@ data class Quaternion(
var x: Float = 0.0f,
var y: Float = 0.0f,
var z: Float = 0.0f,
var w: Float = 0.0f) {
var w: Float = 1.0f) {
constructor(v: Float3, w: Float = 0.0f) : this(v.x, v.y, v.z, w)
constructor(v: Float3, w: Float = 1.0f) : this(v.x, v.y, v.z, w)
constructor(v: Float4) : this(v.x, v.y, v.z, v.w)
constructor(q: Quaternion) : this(q.x, q.y, q.z, q.w)
@@ -52,42 +52,84 @@ data class Quaternion(
}
/**
* Construct a Quaternion from Euler angles using YPR around ZYX respectively
* Construct a Quaternion from Euler angles using YPR around a specified order
*
* The Euler angles are applied in ZYX order.
* i.e: a vector is first rotated about X (roll) then Y (pitch) and then Z (yaw).
* Uses intrinsic Tait-Bryan angles. This means that rotations are performed with respect to
* the local coordinate system.
* That is, for order 'XYZ', the rotation is first around the X axis (which is the same as
* the world-X axis), then around local-Y (which may now be different from the world
* Y-axis), then local-Z (which may be different from the world Z-axis)
*
* @param d Per axis Euler angles in degrees
* Yaw, pitch, roll (YPR) are taken accordingly to the rotations order input.
* @param order The order in which to apply rotations.
* Default is [RotationsOrder.ZYX] which means that the object will first be rotated around
* its Z axis, then its Y axis and finally its X axis.
*/
fun fromEuler(d: Float3): Quaternion {
fun fromEuler(d: Float3, order: RotationsOrder = RotationsOrder.ZYX): Quaternion {
val r = transform(d, ::radians)
return fromEulerZYX(r.z, r.y, r.x)
return fromEuler(r[order.yaw], r[order.pitch], r[order.roll], order)
}
/**
* Construct a Quaternion from Euler angles using YPR around ZYX respectively
* Construct a Quaternion from Euler yaw, pitch, roll around a specified order.
*
* The Euler angles are applied in ZYX order.
* i.e: a vector is first rotated about X (roll) then Y (pitch) and then Z (yaw).
*
* @param roll about X axis in radians
* @param pitch about Y axis in radians
* @param yaw about Z axis in radians
* @param roll about 1st rotation axis in radians. Z in case of ZYX order
* @param pitch about 2nd rotation axis in radians. Y in case of ZYX order
* @param yaw about 3rd rotation axis in radians. X in case of ZYX order
* @param order The order in which to apply rotations.
* Default is [RotationsOrder.ZYX] which means that the object will first be rotated around its Z
* axis, then its Y axis and finally its X axis.
*/
fun fromEulerZYX(yaw: Float = 0.0f, pitch: Float = 0.0f, roll: Float = 0.0f): Quaternion {
val cy = cos(yaw * 0.5f)
val sy = sin(yaw * 0.5f)
val cp = cos(pitch * 0.5f)
val sp = sin(pitch * 0.5f)
val cr = cos(roll * 0.5f)
val sr = sin(roll * 0.5f)
return Quaternion(
sr * cp * cy - cr * sp * sy,
cr * sp * cy + sr * cp * sy,
cr * cp * sy - sr * sp * cy,
cr * cp * cy + sr * sp * sy
)
fun fromEuler(
yaw: Float = 0.0f,
pitch: Float = 0.0f,
roll: Float = 0.0f,
order: RotationsOrder = RotationsOrder.ZYX
): Quaternion {
val c1 = cos(yaw * 0.5f)
val s1 = sin(yaw * 0.5f)
val c2 = cos(pitch * 0.5f)
val s2 = sin(pitch * 0.5f)
val c3 = cos(roll * 0.5f)
val s3 = sin(roll * 0.5f)
return when (order) {
RotationsOrder.XZY -> Quaternion(
s1 * c2 * c3 - c1 * s2 * s3,
c1 * c2 * s3 - s1 * s2 * c3,
s1 * c2 * s3 + c1 * s2 * c3,
s1 * s2 * s3 + c1 * c2 * c3)
RotationsOrder.XYZ -> Quaternion(
s1 * c2 * c3 + s2 * s3 * c1,
s2 * c1 * c3 - s1 * s3 * c2,
s1 * s2 * c3 + s3 * c1 * c2,
c1 * c2 * c3 - s1 * s2 * s3
)
RotationsOrder.YXZ -> Quaternion(
s1 * c2 * s3 + c1 * s2 * c3,
s1 * c2 * c3 - c1 * s2 * s3,
c1 * c2 * s3 - s1 * s2 * c3,
s1 * s2 * s3 + c1 * c2 * c3
)
RotationsOrder.YZX -> Quaternion(
s1 * s2 * c3 + c1 * c2 * s3,
s1 * c2 * c3 + c1 * s2 * s3,
c1 * s2 * c3 - s1 * c2 * s3,
c1 * c2 * c3 - s1 * s2 * s3
)
RotationsOrder.ZYX -> Quaternion(
c1 * c2 * s3 - s1 * s2 * c3,
s1 * c2 * s3 + c1 * s2 * c3,
s1 * c2 * c3 - c1 * s2 * s3,
s1 * s2 * s3 + c1 * c2 * c3
)
RotationsOrder.ZXY -> Quaternion(
c1 * s2 * c3 - s1 * c2 * s3,
s1 * s2 * c3 + c1 * c2 * s3,
s1 * c2 * c3 + c1 * s2 * s3,
c1 * c2 * c3 - s1 * s2 * s3
)
}
}
}
@@ -222,16 +264,44 @@ data class Quaternion(
inline operator fun minus(v: Float) = Quaternion(x - v, y - v, z - v, w - v)
inline operator fun times(v: Float) = Quaternion(x * v, y * v, z * v, w * v)
inline operator fun div(v: Float) = Quaternion(x / v, y / v, z / v, w / v)
inline fun compareTo(v: Float, delta: Float = 0.0f) = Float4(
x.compareTo(v, delta),
y.compareTo(v, delta),
z.compareTo(v, delta),
w.compareTo(v, delta)
)
inline fun equals(v: Float, delta: Float = 0.0f) = Bool4(
x.equals(v, delta),
y.equals(v, delta),
z.equals(v, delta),
w.equals(v, delta)
)
inline operator fun times(v: Float3) = (this * Quaternion(v, 0.0f) * inverse(this)).xyz
inline operator fun plus(q: Quaternion) = Quaternion(x + q.x, y + q.y, z + q.z, w + q.w)
inline operator fun minus(q: Quaternion) = Quaternion(x - q.x, y - q.y, z - q.z, w - q.w)
inline operator fun times(q: Quaternion) = Quaternion(
w * q.x + x * q.w + y * q.z - z * q.y,
w * q.y - x * q.z + y * q.w + z * q.x,
w * q.z + x * q.y - y * q.x + z * q.w,
w * q.w - x * q.x - y * q.y - z * q.z)
w * q.x + x * q.w + y * q.z - z * q.y,
w * q.y - x * q.z + y * q.w + z * q.x,
w * q.z + x * q.y - y * q.x + z * q.w,
w * q.w - x * q.x - y * q.y - z * q.z
)
inline fun compareTo(v: Float4, delta: Float = 0.0f) = Float4(
x.compareTo(v.x, delta),
y.compareTo(v.y, delta),
z.compareTo(v.z, delta),
w.compareTo(v.w, delta)
)
inline fun equals(v: Float4, delta: Float = 0.0f) = Bool4(
x.equals(v.x, delta),
y.equals(v.y, delta),
z.equals(v.z, delta),
w.equals(v.w, delta)
)
inline fun transform(block: (Float) -> Float): Quaternion {
x = block(x)
@@ -253,6 +323,103 @@ inline operator fun Float.minus(q: Quaternion) = Quaternion(this - q.x, this - q
inline operator fun Float.times(q: Quaternion) = Quaternion(this * q.x, this * q.y, this * q.z, this * q.w)
inline operator fun Float.div(q: Quaternion) = Quaternion(this / q.x, this / q.y, this / q.z, this / q.w)
inline fun lessThan(a: Quaternion, b: Float) = Bool4(
a.x < b,
a.y < b,
a.z < b,
a.w < b
)
inline fun lessThan(a: Quaternion, b: Quaternion) = Bool4(
a.x < b.x,
a.y < b.y,
a.z < b.z,
a.w < b.w
)
inline fun lessThanEqual(a: Quaternion, b: Float) = Bool4(
a.x <= b,
a.y <= b,
a.z <= b,
a.w <= b
)
inline fun lessThanEqual(a: Quaternion, b: Quaternion) = Bool4(
a.x <= b.x,
a.y <= b.y,
a.z <= b.z,
a.w <= b.w
)
inline fun greaterThan(a: Quaternion, b: Float) = Bool4(
a.x > b,
a.y > b,
a.z > b,
a.w > b
)
inline fun greaterThan(a: Quaternion, b: Quaternion) = Bool4(
a.x > b.y,
a.y > b.y,
a.z > b.z,
a.w > b.w
)
inline fun greaterThanEqual(a: Quaternion, b: Float) = Bool4(
a.x >= b,
a.y >= b,
a.z >= b,
a.w >= b
)
inline fun greaterThanEqual(a: Quaternion, b: Quaternion) = Bool4(
a.x >= b.x,
a.y >= b.y,
a.z >= b.z,
a.w >= b.w
)
inline fun equal(a: Quaternion, b: Float, delta: Float = 0.0f) = Bool4(
a.x.equals(b, delta),
a.y.equals(b, delta),
a.z.equals(b, delta),
a.w.equals(b, delta)
)
inline fun equal(a: Quaternion, b: Quaternion, delta: Float = 0.0f) = Bool4(
a.x.equals(b.x, delta),
a.y.equals(b.y, delta),
a.z.equals(b.z, delta),
a.w.equals(b.w, delta)
)
inline fun notEqual(a: Quaternion, b: Float, delta: Float = 0.0f) = Bool4(
!a.x.equals(b, delta),
!a.y.equals(b, delta),
!a.z.equals(b, delta),
!a.w.equals(b, delta)
)
inline fun notEqual(a: Quaternion, b: Quaternion, delta: Float = 0.0f) = Bool4(
!a.x.equals(b.x, delta),
!a.y.equals(b.y, delta),
!a.z.equals(b.z, delta),
!a.w.equals(b.w, delta)
)
inline infix fun Quaternion.lt(b: Float) = Bool4(x < b, y < b, z < b, w < b)
inline infix fun Quaternion.lt(b: Float4) = Bool4(x < b.x, y < b.y, z < b.z, w < b.w)
inline infix fun Quaternion.lte(b: Float) = Bool4(x <= b, y <= b, z <= b, w <= b)
inline infix fun Quaternion.lte(b: Float4) = Bool4(x <= b.x, y <= b.y, z <= b.z, w <= b.w)
inline infix fun Quaternion.gt(b: Float) = Bool4(x > b, y > b, z > b, w > b)
inline infix fun Quaternion.gt(b: Float4) = Bool4(x > b.x, y > b.y, z > b.z, w > b.w)
inline infix fun Quaternion.gte(b: Float) = Bool4(x >= b, y >= b, z >= b, w >= b)
inline infix fun Quaternion.gte(b: Float4) = Bool4(x >= b.x, y >= b.y, z >= b.z, w >= b.w)
inline infix fun Quaternion.eq(b: Float) = Bool4(x == b, y == b, z == b, w == b)
inline infix fun Quaternion.eq(b: Float4) = Bool4(x == b.x, y == b.y, z == b.z, w == b.w)
inline infix fun Quaternion.neq(b: Float) = Bool4(x != b, y != b, z != b, w != b)
inline infix fun Quaternion.neq(b: Float4) = Bool4(x != b.x, y != b.y, z != b.z, w != b.w)
inline fun abs(q: Quaternion) = Quaternion(abs(q.x), abs(q.y), abs(q.z), abs(q.w))
inline fun length(q: Quaternion) = sqrt(q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w)
inline fun length2(q: Quaternion) = q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w
@@ -278,6 +445,10 @@ fun cross(a: Quaternion, b: Quaternion): Quaternion {
return Quaternion(m.x, m.y, m.z, 0.0f)
}
fun angle(a: Quaternion, b: Quaternion): Float {
return 2.0f * acos(abs(clamp(dot(a, b), -1.0f, 1.0f)))
}
/**
* Spherical linear interpolation between two given orientations
*
@@ -287,36 +458,38 @@ fun cross(a: Quaternion, b: Quaternion): Quaternion {
* @param a The beginning value
* @param b The ending value
* @param t The ratio between the two floats
* @param valueEps Prevent blowing up when slerping between two quaternions that are very near each
* other. Linear interpolation (lerp) is returned in this case.
* @param dotThreshold If the quaternion dot product is greater than this value
* (i.e. the quaternions are very close to each other), then the quaternions are
* linearly interpolated instead of spherically interpolated.
*
* @return Interpolated value between the two floats
*/
fun slerp(a: Quaternion, b: Quaternion, t: Float, valueEps: Float = 0.0000000001f): Quaternion {
fun slerp(a: Quaternion, b: Quaternion, t: Float, dotThreshold: Float = 0.9995f): Quaternion {
// could also be computed as: pow(q * inverse(p), t) * p;
val d = dot(a, b)
val absd = abs(d)
var dot = dot(a, b)
var b1 = b
// If the dot product is negative, then the interpolation won't follow the shortest angular path
// between the two quaterions. In this case, invert the end quaternion to produce an equivalent
// rotation that will give us the path we want.
if (dot < 0.0f) {
dot = -dot
b1 = -b
}
// Prevent blowing up when slerping between two quaternions that are very near each other.
if ((1.0f - absd) < valueEps) {
return normalize(lerp(if (d < 0.0f) -a else a, b, t))
return if (dot < dotThreshold) {
val angle = acos(dot)
val s = sin(angle)
a * sin((1.0f - t) * angle) / s + b1 * sin(t * angle) / s
} else {
// If the angle is too small, use linear interpolation
nlerp(a, b1, t)
}
val npq = sqrt(dot(a, a) * dot(b, b)) // ||p|| * ||q||
val acos = acos(clamp(absd / npq, -1.0f, 1.0f))
val acos0 = acos * (1.0f - t)
val acos1 = acos * t
val sina = sin(acos)
if (sina < valueEps) {
return normalize(lerp(a, b, t))
}
val isina = 1.0f / sina
val s0 = sin(acos0) * isina
val s1 = sin(acos1) * isina
// ensure we're taking the "short" side
return normalize(s0 * a + (if (d < 0.0f) -s1 else (s1)) * b)
}
fun lerp(a: Quaternion, b: Quaternion, t: Float): Quaternion {
return ((1 - t) * a) + (t * b)
return ((1.0f - t) * a) + (t * b)
}
fun nlerp(a: Quaternion, b: Quaternion, t: Float): Quaternion {
@@ -324,19 +497,12 @@ fun nlerp(a: Quaternion, b: Quaternion, t: Float): Quaternion {
}
/**
* Convert a Quaternion to Euler angles using YPR around ZYX respectively
* Convert a Quaternion to Euler angles
*
* The Euler angles are applied in ZYX order
* @param order The order in which to apply rotations.
* Default is [RotationsOrder.ZYX] which means that the object will first be rotated around its Z
* axis, then its Y axis and finally its X axis.
*/
fun eulerAngles(q: Quaternion): Float3 {
val nq = normalize(q)
return Float3(
// roll (x-axis rotation)
degrees(atan2(2.0f * (nq.y * nq.z + nq.w * nq.x),
nq.w * nq.w - nq.x * nq.x - nq.y * nq.y + nq.z * nq.z)),
// pitch (y-axis rotation)
degrees(asin(-2.0f * (nq.x * nq.z - nq.w * nq.y))),
// yaw (z-axis rotation)
degrees(atan2(2.0f * (nq.x * nq.y + nq.w * nq.z),
nq.w * nq.w + nq.x * nq.x - nq.y * nq.y - nq.z * nq.z)))
fun eulerAngles(q: Quaternion, order: RotationsOrder = RotationsOrder.ZYX): Float3 {
return eulerAngles(rotation(q), order)
}

View File

@@ -28,12 +28,21 @@ const val INV_PI = 1.0f / FPI
const val INV_TWO_PI = INV_PI * 0.5f
const val INV_FOUR_PI = INV_PI * 0.25f
inline fun clamp(x: Float, min: Float, max: Float)= if (x < min) min else (if (x > max) max else x)
val HALF_ONE = Half(0x3c00.toUShort())
val HALF_TWO = Half(0x4000.toUShort())
inline fun clamp(x: Float, min: Float, max: Float) = if (x < min) min else (if (x > max) max else x)
inline fun clamp(x: Half, min: Half, max: Half) = if (x < min) min else (if (x > max) max else x)
inline fun saturate(x: Float) = clamp(x, 0.0f, 1.0f)
inline fun saturate(x: Half) = clamp(x, Half.POSITIVE_ZERO, HALF_ONE)
inline fun mix(a: Float, b: Float, x: Float) = a * (1.0f - x) + b * x
inline fun mix(a: Half, b: Half, x: Half) = a * (HALF_ONE - x) + b * x
inline fun degrees(v: Float) = v * (180.0f * INV_PI)
inline fun radians(v: Float) = v * (FPI / 180.0f)
@@ -42,4 +51,6 @@ inline fun fract(v: Float) = v % 1
inline fun sqr(v: Float) = v * v
inline fun sqr(v: Half) = v * v
inline fun pow(x: Float, y: Float) = (x.toDouble().pow(y.toDouble())).toFloat()

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.google.android.filament.textured
package com.google.android.filament.utils
import android.content.res.Resources
import android.graphics.Bitmap

View File

@@ -22,6 +22,8 @@ import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min
import kotlin.math.sqrt
import kotlin.math.acos
import kotlin.math.absoluteValue
enum class VectorComponent {
X, Y, Z, W,
@@ -124,11 +126,23 @@ data class Float2(var x: Float = 0.0f, var y: Float = 0.0f) {
inline operator fun minus(v: Float) = Float2(x - v, y - v)
inline operator fun times(v: Float) = Float2(x * v, y * v)
inline operator fun div(v: Float) = Float2(x / v, y / v)
inline fun compareTo(v: Float, delta: Float = 0.0f) = Float2(
x.compareTo(v, delta),
y.compareTo(v, delta)
)
inline fun equals(v: Float, delta: Float = 0.0f) = x.equals(v, delta) && y.equals(v, delta)
inline operator fun plus(v: Float2) = Float2(x + v.x, y + v.y)
inline operator fun minus(v: Float2) = Float2(x - v.x, y - v.y)
inline operator fun times(v: Float2) = Float2(x * v.x, y * v.y)
inline operator fun div(v: Float2) = Float2(x / v.x, y / v.y)
inline fun compareTo(v: Float2, delta: Float = 0.0f) = Float2(
x.compareTo(v.x, delta),
y.compareTo(v.y, delta)
)
inline fun equals(v: Float2, delta: Float = 0.0f) = x.equals(v.x, delta) && y.equals(v.y, delta)
inline fun transform(block: (Float) -> Float): Float2 {
x = block(x)
@@ -291,6 +305,14 @@ data class Float3(var x: Float = 0.0f, var y: Float = 0.0f, var z: Float = 0.0f)
inline operator fun minus(v: Float) = Float3(x - v, y - v, z - v)
inline operator fun times(v: Float) = Float3(x * v, y * v, z * v)
inline operator fun div(v: Float) = Float3(x / v, y / v, z / v)
inline fun compareTo(v: Float, delta: Float = 0.0f) = Float3(
x.compareTo(v, delta),
y.compareTo(v, delta),
z.compareTo(v, delta)
)
inline fun equals(v: Float, delta: Float = 0.0f) =
x.equals(v, delta) && y.equals(v, delta) && z.equals(v, delta)
inline operator fun plus(v: Float2) = Float3(x + v.x, y + v.y, z)
inline operator fun minus(v: Float2) = Float3(x - v.x, y - v.y, z)
@@ -301,6 +323,14 @@ data class Float3(var x: Float = 0.0f, var y: Float = 0.0f, var z: Float = 0.0f)
inline operator fun minus(v: Float3) = Float3(x - v.x, y - v.y, z - v.z)
inline operator fun times(v: Float3) = Float3(x * v.x, y * v.y, z * v.z)
inline operator fun div(v: Float3) = Float3(x / v.x, y / v.y, z / v.z)
inline fun compareTo(v: Float3, delta: Float = 0.0f) = Float3(
x.compareTo(v.x, delta),
y.compareTo(v.y, delta),
z.compareTo(v.z, delta)
)
inline fun equals(v: Float3, delta: Float = 0.0f) =
x.equals(v.x, delta) && y.equals(v.y, delta) && z.equals(v.z, delta)
inline fun transform(block: (Float) -> Float): Float3 {
x = block(x)
@@ -534,6 +564,15 @@ data class Float4(
inline operator fun minus(v: Float) = Float4(x - v, y - v, z - v, w - v)
inline operator fun times(v: Float) = Float4(x * v, y * v, z * v, w * v)
inline operator fun div(v: Float) = Float4(x / v, y / v, z / v, w / v)
inline fun compareTo(v: Float, delta: Float = 0.0f) = Float4(
x.compareTo(v, delta),
y.compareTo(v, delta),
z.compareTo(v, delta),
w.compareTo(v, delta)
)
inline fun equals(v: Float, delta: Float = 0.0f) =
x.equals(v, delta) && y.equals(v, delta) && z.equals(v, delta) && w.equals(v, delta)
inline operator fun plus(v: Float2) = Float4(x + v.x, y + v.y, z, w)
inline operator fun minus(v: Float2) = Float4(x - v.x, y - v.y, z, w)
@@ -549,6 +588,15 @@ data class Float4(
inline operator fun minus(v: Float4) = Float4(x - v.x, y - v.y, z - v.z, w - v.w)
inline operator fun times(v: Float4) = Float4(x * v.x, y * v.y, z * v.z, w * v.w)
inline operator fun div(v: Float4) = Float4(x / v.x, y / v.y, z / v.z, w / v.w)
inline fun compareTo(v: Float4, delta: Float = 0.0f) = Float4(
x.compareTo(v.x, delta),
y.compareTo(v.y, delta),
z.compareTo(v.z, delta),
w.compareTo(v.w, delta)
)
inline fun equals(v: Float4, delta: Float = 0.0f) =
x.equals(v.x, delta) && y.equals(v.y, delta) && z.equals(v.z, delta) && w.equals(v.w, delta)
inline fun transform(block: (Float) -> Float): Float4 {
x = block(x)
@@ -566,6 +614,12 @@ inline operator fun Float.minus(v: Float2) = Float2(this - v.x, this - v.y)
inline operator fun Float.times(v: Float2) = Float2(this * v.x, this * v.y)
inline operator fun Float.div(v: Float2) = Float2(this / v.x, this / v.y)
inline fun Float.compareTo(v: Float, delta: Float): Float = when {
equals(v, delta) -> 0.0f
else -> compareTo(v).toFloat()
}
inline fun Float.equals(v: Float, delta: Float) = (this - v).absoluteValue < delta
inline fun abs(v: Float2) = Float2(abs(v.x), abs(v.y))
inline fun length(v: Float2) = sqrt(v.x * v.x + v.y * v.y)
inline fun length2(v: Float2) = v.x * v.x + v.y * v.y
@@ -583,6 +637,11 @@ fun refract(i: Float2, n: Float2, eta: Float): Float2 {
return if (k < 0.0f) Float2(0.0f) else eta * i - (eta * d + sqrt(k)) * n
}
inline fun angle(a: Float2, b: Float2): Float {
val l = length(a) * length(b)
return if (l == 0.0f) 0.0f else acos(clamp(dot(a, b) / l, -1.0f, 1.0f))
}
inline fun clamp(v: Float2, min: Float, max: Float): Float2 {
return Float2(
clamp(v.x, min, max),
@@ -626,10 +685,25 @@ inline fun greaterThan(a: Float2, b: Float) = Bool2(a.x > b, a.y > b)
inline fun greaterThan(a: Float2, b: Float2) = Bool2(a.x > b.y, a.y > b.y)
inline fun greaterThanEqual(a: Float2, b: Float) = Bool2(a.x >= b, a.y >= b)
inline fun greaterThanEqual(a: Float2, b: Float2) = Bool2(a.x >= b.x, a.y >= b.y)
inline fun equal(a: Float2, b: Float) = Bool2(a.x == b, a.y == b)
inline fun equal(a: Float2, b: Float2) = Bool2(a.x == b.x, a.y == b.y)
inline fun notEqual(a: Float2, b: Float) = Bool2(a.x != b, a.y != b)
inline fun notEqual(a: Float2, b: Float2) = Bool2(a.x != b.x, a.y != b.y)
inline fun equal(a: Float2, b: Float, delta: Float = 0.0f) = Bool2(
a.x.equals(b, delta),
a.y.equals(b, delta)
)
inline fun equal(a: Float2, b: Float2, delta: Float = 0.0f) = Bool2(
a.x.equals(b.x, delta),
a.y.equals(b.y, delta)
)
inline fun notEqual(a: Float2, b: Float, delta: Float = 0.0f) = Bool2(
!a.x.equals(b, delta),
!a.y.equals(b, delta)
)
inline fun notEqual(a: Float2, b: Float2, delta: Float = 0.0f) = Bool2(
!a.x.equals(b.x, delta),
!a.y.equals(b.y, delta)
)
inline infix fun Float2.lt(b: Float) = Bool2(x < b, y < b)
inline infix fun Float2.lt(b: Float2) = Bool2(x < b.x, y < b.y)
@@ -675,6 +749,11 @@ fun refract(i: Float3, n: Float3, eta: Float): Float3 {
return if (k < 0.0f) Float3(0.0f) else eta * i - (eta * d + sqrt(k)) * n
}
inline fun angle(a: Float3, b: Float3): Float {
val l = length(a) * length(b)
return if (l == 0.0f) 0.0f else acos(clamp(dot(a, b) / l, -1.0f, 1.0f))
}
inline fun clamp(v: Float3, min: Float, max: Float): Float3 {
return Float3(
clamp(v.x, min, max),
@@ -722,10 +801,29 @@ inline fun greaterThan(a: Float3, b: Float) = Bool3(a.x > b, a.y > b, a.z > b)
inline fun greaterThan(a: Float3, b: Float3) = Bool3(a.x > b.y, a.y > b.y, a.z > b.z)
inline fun greaterThanEqual(a: Float3, b: Float) = Bool3(a.x >= b, a.y >= b, a.z >= b)
inline fun greaterThanEqual(a: Float3, b: Float3) = Bool3(a.x >= b.x, a.y >= b.y, a.z >= b.z)
inline fun equal(a: Float3, b: Float) = Bool3(a.x == b, a.y == b, a.z == b)
inline fun equal(a: Float3, b: Float3) = Bool3(a.x == b.x, a.y == b.y, a.z == b.z)
inline fun notEqual(a: Float3, b: Float) = Bool3(a.x != b, a.y != b, a.z != b)
inline fun notEqual(a: Float3, b: Float3) = Bool3(a.x != b.x, a.y != b.y, a.z != b.z)
inline fun equal(a: Float3, b: Float, delta: Float = 0.0f) = Bool3(
a.x.equals(b, delta),
a.y.equals(b, delta),
a.z.equals(b, delta)
)
inline fun equal(a: Float3, b: Float3, delta: Float = 0.0f) = Bool3(
a.x.equals(b.x, delta),
a.y.equals(b.y, delta),
a.z.equals(b.z, delta)
)
inline fun notEqual(a: Float3, b: Float, delta: Float = 0.0f) = Bool3(
!a.x.equals(b, delta),
!a.y.equals(b, delta),
!a.z.equals(b, delta)
)
inline fun notEqual(a: Float3, b: Float3, delta: Float = 0.0f) = Bool3(
!a.x.equals(b.x, delta),
!a.y.equals(b.y, delta),
!a.z.equals(b.z, delta)
)
inline infix fun Float3.lt(b: Float) = Bool3(x < b, y < b, z < b)
inline infix fun Float3.lt(b: Float3) = Bool3(x < b.x, y < b.y, z < b.z)
@@ -807,17 +905,44 @@ inline fun transform(v: Float4, block: (Float) -> Float) = v.copy().transform(bl
inline fun lessThan(a: Float4, b: Float) = Bool4(a.x < b, a.y < b, a.z < b, a.w < b)
inline fun lessThan(a: Float4, b: Float4) = Bool4(a.x < b.x, a.y < b.y, a.z < b.z, a.w < b.w)
inline fun lessThanEqual(a: Float4, b: Float) = Bool4(a.x <= b, a.y <= b, a.z <= b, a.w <= b)
inline fun lessThanEqual(a: Float4, b: Float4) = Bool4(a.x <= b.x, a.y <= b.y, a.z <= b.z, a.w <= b.w)
inline fun lessThanEqual(a: Float4, b: Float4) =
Bool4(a.x <= b.x, a.y <= b.y, a.z <= b.z, a.w <= b.w)
inline fun greaterThan(a: Float4, b: Float) = Bool4(a.x > b, a.y > b, a.z > b, a.w > b)
inline fun greaterThan(a: Float4, b: Float4) = Bool4(a.x > b.y, a.y > b.y, a.z > b.z, a.w > b.w)
inline fun greaterThanEqual(a: Float4, b: Float) = Bool4(a.x >= b, a.y >= b, a.z >= b, a.w >= b)
inline fun greaterThanEqual(a: Float4, b: Float4) = Bool4(a.x >= b.x, a.y >= b.y, a.z >= b.z, a.w >= b.w)
inline fun equal(a: Float4, b: Float) = Bool4(a.x == b, a.y == b, a.z == b, a.w == b)
inline fun equal(a: Float4, b: Float4) = Bool4(a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w)
inline fun notEqual(a: Float4, b: Float) = Bool4(a.x != b, a.y != b, a.z != b, a.w != b)
inline fun notEqual(a: Float4, b: Float4) = Bool4(a.x != b.x, a.y != b.y, a.z != b.z, a.w != b.w)
inline fun greaterThanEqual(a: Float4, b: Float4) =
Bool4(a.x >= b.x, a.y >= b.y, a.z >= b.z, a.w >= b.w)
inline infix fun Float4.lt(b: Float) = Bool4(x < b, y < b, z < b, a < b)
inline fun equal(a: Float4, b: Float, delta: Float = 0.0f) = Bool4(
a.x.equals(b, delta),
a.y.equals(b, delta),
a.z.equals(b, delta),
a.w.equals(b, delta)
)
inline fun equal(a: Float4, b: Float4, delta: Float = 0.0f) = Bool4(
a.x.equals(b.x, delta),
a.y.equals(b.y, delta),
a.z.equals(b.z, delta),
a.w.equals(b.w, delta)
)
inline fun notEqual(a: Float4, b: Float, delta: Float = 0.0f) = Bool4(
!a.x.equals(b, delta),
!a.y.equals(b, delta),
!a.z.equals(b, delta),
!a.w.equals(b, delta)
)
inline fun notEqual(a: Float4, b: Float4, delta: Float = 0.0f) = Bool4(
!a.x.equals(b.x, delta),
!a.y.equals(b.y, delta),
!a.z.equals(b.z, delta),
!a.w.equals(b.w, delta)
)
inline infix fun Float4.lt(b: Float) = Bool4(x < b, y < b, z < b, w < b)
inline infix fun Float4.lt(b: Float4) = Bool4(x < b.x, y < b.y, z < b.z, w < b.w)
inline infix fun Float4.lte(b: Float) = Bool4(x <= b, y <= b, z <= b, w <= b)
inline infix fun Float4.lte(b: Float4) = Bool4(x <= b.x, y <= b.y, z <= b.z, w <= b.w)
@@ -1277,3 +1402,753 @@ data class Bool4(
set(index4, v)
}
}
data class Half2(var x: Half = Half.POSITIVE_ZERO, var y: Half = Half.POSITIVE_ZERO) {
constructor(v: Half) : this(v, v)
constructor(v: Half2) : this(v.x, v.y)
inline var r: Half
get() = x
set(value) {
x = value
}
inline var g: Half
get() = y
set(value) {
y = value
}
inline var s: Half
get() = x
set(value) {
x = value
}
inline var t: Half
get() = y
set(value) {
y = value
}
inline var xy: Half2
get() = Half2(x, y)
set(value) {
x = value.x
y = value.y
}
inline var rg: Half2
get() = Half2(x, y)
set(value) {
x = value.x
y = value.y
}
inline var st: Half2
get() = Half2(x, y)
set(value) {
x = value.x
y = value.y
}
operator fun get(index: VectorComponent) = when (index) {
VectorComponent.X, VectorComponent.R, VectorComponent.S -> x
VectorComponent.Y, VectorComponent.G, VectorComponent.T -> y
else -> throw IllegalArgumentException("index must be X, Y, R, G, S or T")
}
operator fun get(index1: VectorComponent, index2: VectorComponent): Half2 {
return Half2(get(index1), get(index2))
}
operator fun get(index: Int) = when (index) {
0 -> x
1 -> y
else -> throw IllegalArgumentException("index must be in 0..1")
}
operator fun get(index1: Int, index2: Int) = Half2(get(index1), get(index2))
inline operator fun invoke(index: Int) = get(index - 1)
operator fun set(index: Int, v: Half) = when (index) {
0 -> x = v
1 -> y = v
else -> throw IllegalArgumentException("index must be in 0..1")
}
operator fun set(index1: Int, index2: Int, v: Half) {
set(index1, v)
set(index2, v)
}
operator fun set(index: VectorComponent, v: Half) = when (index) {
VectorComponent.X, VectorComponent.R, VectorComponent.S -> x = v
VectorComponent.Y, VectorComponent.G, VectorComponent.T -> y = v
else -> throw IllegalArgumentException("index must be X, Y, R, G, S or T")
}
operator fun set(index1: VectorComponent, index2: VectorComponent, v: Half) {
set(index1, v)
set(index2, v)
}
operator fun unaryMinus() = Half2(-x, -y)
operator fun inc() = Half2(x++, y++)
operator fun dec() = Half2(x--, y--)
inline operator fun plus(v: Half) = Half2(x + v, y + v)
inline operator fun minus(v: Half) = Half2(x - v, y - v)
inline operator fun times(v: Half) = Half2(x * v, y * v)
inline operator fun div(v: Half) = Half2(x / v, y / v)
inline operator fun plus(v: Half2) = Half2(x + v.x, y + v.y)
inline operator fun minus(v: Half2) = Half2(x - v.x, y - v.y)
inline operator fun times(v: Half2) = Half2(x * v.x, y * v.y)
inline operator fun div(v: Half2) = Half2(x / v.x, y / v.y)
inline fun transform(block: (Half) -> Half): Half2 {
x = block(x)
y = block(y)
return this
}
fun toFloatArray() = floatArrayOf(x.toFloat(), y.toFloat())
}
data class Half3(
var x: Half = Half.POSITIVE_ZERO,
var y: Half = Half.POSITIVE_ZERO,
var z: Half = Half.POSITIVE_ZERO
) {
constructor(v: Half) : this(v, v, v)
constructor(v: Half2, z: Half = Half.POSITIVE_ZERO) : this(v.x, v.y, z)
constructor(v: Half3) : this(v.x, v.y, v.z)
inline var r: Half
get() = x
set(value) {
x = value
}
inline var g: Half
get() = y
set(value) {
y = value
}
inline var b: Half
get() = z
set(value) {
z = value
}
inline var s: Half
get() = x
set(value) {
x = value
}
inline var t: Half
get() = y
set(value) {
y = value
}
inline var p: Half
get() = z
set(value) {
z = value
}
inline var xy: Half2
get() = Half2(x, y)
set(value) {
x = value.x
y = value.y
}
inline var rg: Half2
get() = Half2(x, y)
set(value) {
x = value.x
y = value.y
}
inline var st: Half2
get() = Half2(x, y)
set(value) {
x = value.x
y = value.y
}
inline var rgb: Half3
get() = Half3(x, y, z)
set(value) {
x = value.x
y = value.y
z = value.z
}
inline var xyz: Half3
get() = Half3(x, y, z)
set(value) {
x = value.x
y = value.y
z = value.z
}
inline var stp: Half3
get() = Half3(x, y, z)
set(value) {
x = value.x
y = value.y
z = value.z
}
operator fun get(index: VectorComponent) = when (index) {
VectorComponent.X, VectorComponent.R, VectorComponent.S -> x
VectorComponent.Y, VectorComponent.G, VectorComponent.T -> y
VectorComponent.Z, VectorComponent.B, VectorComponent.P -> z
else -> throw IllegalArgumentException("index must be X, Y, Z, R, G, B, S, T or P")
}
operator fun get(index1: VectorComponent, index2: VectorComponent): Half2 {
return Half2(get(index1), get(index2))
}
operator fun get(
index1: VectorComponent, index2: VectorComponent, index3: VectorComponent): Half3 {
return Half3(get(index1), get(index2), get(index3))
}
operator fun get(index: Int) = when (index) {
0 -> x
1 -> y
2 -> z
else -> throw IllegalArgumentException("index must be in 0..2")
}
operator fun get(index1: Int, index2: Int) = Half2(get(index1), get(index2))
operator fun get(index1: Int, index2: Int, index3: Int): Half3 {
return Half3(get(index1), get(index2), get(index3))
}
inline operator fun invoke(index: Int) = get(index - 1)
operator fun set(index: Int, v: Half) = when (index) {
0 -> x = v
1 -> y = v
2 -> z = v
else -> throw IllegalArgumentException("index must be in 0..2")
}
operator fun set(index1: Int, index2: Int, v: Half) {
set(index1, v)
set(index2, v)
}
operator fun set(index1: Int, index2: Int, index3: Int, v: Half) {
set(index1, v)
set(index2, v)
set(index3, v)
}
operator fun set(index: VectorComponent, v: Half) = when (index) {
VectorComponent.X, VectorComponent.R, VectorComponent.S -> x = v
VectorComponent.Y, VectorComponent.G, VectorComponent.T -> y = v
VectorComponent.Z, VectorComponent.B, VectorComponent.P -> z = v
else -> throw IllegalArgumentException("index must be X, Y, Z, R, G, B, S, T or P")
}
operator fun set(index1: VectorComponent, index2: VectorComponent, v: Half) {
set(index1, v)
set(index2, v)
}
operator fun set(
index1: VectorComponent, index2: VectorComponent, index3: VectorComponent, v: Half) {
set(index1, v)
set(index2, v)
set(index3, v)
}
operator fun unaryMinus() = Half3(-x, -y, -z)
operator fun inc() = Half3(x++, y++, z++)
operator fun dec() = Half3(x--, y--, z--)
inline operator fun plus(v: Half) = Half3(x + v, y + v, z + v)
inline operator fun minus(v: Half) = Half3(x - v, y - v, z - v)
inline operator fun times(v: Half) = Half3(x * v, y * v, z * v)
inline operator fun div(v: Half) = Half3(x / v, y / v, z / v)
inline operator fun plus(v: Half2) = Half3(x + v.x, y + v.y, z)
inline operator fun minus(v: Half2) = Half3(x - v.x, y - v.y, z)
inline operator fun times(v: Half2) = Half3(x * v.x, y * v.y, z)
inline operator fun div(v: Half2) = Half3(x / v.x, y / v.y, z)
inline operator fun plus(v: Half3) = Half3(x + v.x, y + v.y, z + v.z)
inline operator fun minus(v: Half3) = Half3(x - v.x, y - v.y, z - v.z)
inline operator fun times(v: Half3) = Half3(x * v.x, y * v.y, z * v.z)
inline operator fun div(v: Half3) = Half3(x / v.x, y / v.y, z / v.z)
inline fun transform(block: (Half) -> Half): Half3 {
x = block(x)
y = block(y)
z = block(z)
return this
}
fun toFloatArray() = floatArrayOf(x.toFloat(), y.toFloat(), z.toFloat())
}
data class Half4(
var x: Half = Half.POSITIVE_ZERO,
var y: Half = Half.POSITIVE_ZERO,
var z: Half = Half.POSITIVE_ZERO,
var w: Half = Half.POSITIVE_ZERO
) {
constructor(v: Half) : this(v, v, v, v)
constructor(v: Half2, z: Half = Half.POSITIVE_ZERO, w: Half = Half.POSITIVE_ZERO) : this(v.x, v.y, z, w)
constructor(v: Half3, w: Half = Half.POSITIVE_ZERO) : this(v.x, v.y, v.z, w)
constructor(v: Half4) : this(v.x, v.y, v.z, v.w)
inline var r: Half
get() = x
set(value) {
x = value
}
inline var g: Half
get() = y
set(value) {
y = value
}
inline var b: Half
get() = z
set(value) {
z = value
}
inline var a: Half
get() = w
set(value) {
w = value
}
inline var s: Half
get() = x
set(value) {
x = value
}
inline var t: Half
get() = y
set(value) {
y = value
}
inline var p: Half
get() = z
set(value) {
z = value
}
inline var q: Half
get() = w
set(value) {
w = value
}
inline var xy: Half2
get() = Half2(x, y)
set(value) {
x = value.x
y = value.y
}
inline var rg: Half2
get() = Half2(x, y)
set(value) {
x = value.x
y = value.y
}
inline var st: Half2
get() = Half2(x, y)
set(value) {
x = value.x
y = value.y
}
inline var rgb: Half3
get() = Half3(x, y, z)
set(value) {
x = value.x
y = value.y
z = value.z
}
inline var xyz: Half3
get() = Half3(x, y, z)
set(value) {
x = value.x
y = value.y
z = value.z
}
inline var stp: Half3
get() = Half3(x, y, z)
set(value) {
x = value.x
y = value.y
z = value.z
}
inline var rgba: Half4
get() = Half4(x, y, z, w)
set(value) {
x = value.x
y = value.y
z = value.z
w = value.w
}
inline var xyzw: Half4
get() = Half4(x, y, z, w)
set(value) {
x = value.x
y = value.y
z = value.z
w = value.w
}
inline var stpq: Half4
get() = Half4(x, y, z, w)
set(value) {
x = value.x
y = value.y
z = value.z
w = value.w
}
operator fun get(index: VectorComponent) = when (index) {
VectorComponent.X, VectorComponent.R, VectorComponent.S -> x
VectorComponent.Y, VectorComponent.G, VectorComponent.T -> y
VectorComponent.Z, VectorComponent.B, VectorComponent.P -> z
VectorComponent.W, VectorComponent.A, VectorComponent.Q -> w
}
operator fun get(index1: VectorComponent, index2: VectorComponent): Half2 {
return Half2(get(index1), get(index2))
}
operator fun get(
index1: VectorComponent,
index2: VectorComponent,
index3: VectorComponent): Half3 {
return Half3(get(index1), get(index2), get(index3))
}
operator fun get(
index1: VectorComponent,
index2: VectorComponent,
index3: VectorComponent,
index4: VectorComponent): Half4 {
return Half4(get(index1), get(index2), get(index3), get(index4))
}
operator fun get(index: Int) = when (index) {
0 -> x
1 -> y
2 -> z
3 -> w
else -> throw IllegalArgumentException("index must be in 0..3")
}
operator fun get(index1: Int, index2: Int) = Half2(get(index1), get(index2))
operator fun get(index1: Int, index2: Int, index3: Int): Half3 {
return Half3(get(index1), get(index2), get(index3))
}
operator fun get(index1: Int, index2: Int, index3: Int, index4: Int): Half4 {
return Half4(get(index1), get(index2), get(index3), get(index4))
}
inline operator fun invoke(index: Int) = get(index - 1)
operator fun set(index: Int, v: Half) = when (index) {
0 -> x = v
1 -> y = v
2 -> z = v
3 -> w = v
else -> throw IllegalArgumentException("index must be in 0..3")
}
operator fun set(index1: Int, index2: Int, v: Half) {
set(index1, v)
set(index2, v)
}
operator fun set(index1: Int, index2: Int, index3: Int, v: Half) {
set(index1, v)
set(index2, v)
set(index3, v)
}
operator fun set(index1: Int, index2: Int, index3: Int, index4: Int, v: Half) {
set(index1, v)
set(index2, v)
set(index3, v)
set(index4, v)
}
operator fun set(index: VectorComponent, v: Half) = when (index) {
VectorComponent.X, VectorComponent.R, VectorComponent.S -> x = v
VectorComponent.Y, VectorComponent.G, VectorComponent.T -> y = v
VectorComponent.Z, VectorComponent.B, VectorComponent.P -> z = v
VectorComponent.W, VectorComponent.A, VectorComponent.Q -> w = v
}
operator fun set(index1: VectorComponent, index2: VectorComponent, v: Half) {
set(index1, v)
set(index2, v)
}
operator fun set(
index1: VectorComponent, index2: VectorComponent, index3: VectorComponent, v: Half) {
set(index1, v)
set(index2, v)
set(index3, v)
}
operator fun set(
index1: VectorComponent, index2: VectorComponent,
index3: VectorComponent, index4: VectorComponent, v: Half) {
set(index1, v)
set(index2, v)
set(index3, v)
set(index4, v)
}
operator fun unaryMinus() = Half4(-x, -y, -z, -w)
operator fun inc() = Half4(x++, y++, z++, w++)
operator fun dec() = Half4(x--, y--, z--, w--)
inline operator fun plus(v: Half) = Half4(x + v, y + v, z + v, w + v)
inline operator fun minus(v: Half) = Half4(x - v, y - v, z - v, w - v)
inline operator fun times(v: Half) = Half4(x * v, y * v, z * v, w * v)
inline operator fun div(v: Half) = Half4(x / v, y / v, z / v, w / v)
inline operator fun plus(v: Half2) = Half4(x + v.x, y + v.y, z, w)
inline operator fun minus(v: Half2) = Half4(x - v.x, y - v.y, z, w)
inline operator fun times(v: Half2) = Half4(x * v.x, y * v.y, z, w)
inline operator fun div(v: Half2) = Half4(x / v.x, y / v.y, z, w)
inline operator fun plus(v: Half3) = Half4(x + v.x, y + v.y, z + v.z, w)
inline operator fun minus(v: Half3) = Half4(x - v.x, y - v.y, z - v.z, w)
inline operator fun times(v: Half3) = Half4(x * v.x, y * v.y, z * v.z, w)
inline operator fun div(v: Half3) = Half4(x / v.x, y / v.y, z / v.z, w)
inline operator fun plus(v: Half4) = Half4(x + v.x, y + v.y, z + v.z, w + v.w)
inline operator fun minus(v: Half4) = Half4(x - v.x, y - v.y, z - v.z, w - v.w)
inline operator fun times(v: Half4) = Half4(x * v.x, y * v.y, z * v.z, w * v.w)
inline operator fun div(v: Half4) = Half4(x / v.x, y / v.y, z / v.z, w / v.w)
inline fun transform(block: (Half) -> Half): Half4 {
x = block(x)
y = block(y)
z = block(z)
w = block(w)
return this
}
fun toFloatArray() = floatArrayOf(x.toFloat(), y.toFloat(), z.toFloat(), w.toFloat())
}
inline fun min(v: Half2) = min(v.x, v.y)
inline fun min(a: Half2, b: Half2) = Half2(min(a.x, b.x), min(a.y, b.y))
inline fun max(v: Half2) = max(v.x, v.y)
inline fun max(a: Half2, b: Half2) = Half2(max(a.x, b.x), max(a.y, b.y))
inline fun transform(v: Half2, block: (Half) -> Half) = v.copy().transform(block)
inline fun lessThan(a: Half2, b: Half) = Bool2(a.x < b, a.y < b)
inline fun lessThan(a: Half2, b: Half2) = Bool2(a.x < b.x, a.y < b.y)
inline fun lessThanEqual(a: Half2, b: Half) = Bool2(a.x <= b, a.y <= b)
inline fun lessThanEqual(a: Half2, b: Half2) = Bool2(a.x <= b.x, a.y <= b.y)
inline fun greaterThan(a: Half2, b: Half) = Bool2(a.x > b, a.y > b)
inline fun greaterThan(a: Half2, b: Half2) = Bool2(a.x > b.y, a.y > b.y)
inline fun greaterThanEqual(a: Half2, b: Half) = Bool2(a.x >= b, a.y >= b)
inline fun greaterThanEqual(a: Half2, b: Half2) = Bool2(a.x >= b.x, a.y >= b.y)
inline fun equal(a: Half2, b: Half) = Bool2(a.x == b, a.y == b)
inline fun equal(a: Half2, b: Half2) = Bool2(a.x == b.x, a.y == b.y)
inline fun notEqual(a: Half2, b: Half) = Bool2(a.x != b, a.y != b)
inline fun notEqual(a: Half2, b: Half2) = Bool2(a.x != b.x, a.y != b.y)
inline infix fun Half2.lt(b: Half) = Bool2(x < b, y < b)
inline infix fun Half2.lt(b: Half2) = Bool2(x < b.x, y < b.y)
inline infix fun Half2.lte(b: Half) = Bool2(x <= b, y <= b)
inline infix fun Half2.lte(b: Half2) = Bool2(x <= b.x, y <= b.y)
inline infix fun Half2.gt(b: Half) = Bool2(x > b, y > b)
inline infix fun Half2.gt(b: Half2) = Bool2(x > b.x, y > b.y)
inline infix fun Half2.gte(b: Half) = Bool2(x >= b, y >= b)
inline infix fun Half2.gte(b: Half2) = Bool2(x >= b.x, y >= b.y)
inline infix fun Half2.eq(b: Half) = Bool2(x == b, y == b)
inline infix fun Half2.eq(b: Half2) = Bool2(x == b.x, y == b.y)
inline infix fun Half2.neq(b: Half) = Bool2(x != b, y != b)
inline infix fun Half2.neq(b: Half2) = Bool2(x != b.x, y != b.y)
inline operator fun Half.plus(v: Half3) = Half3(this + v.x, this + v.y, this + v.z)
inline operator fun Half.minus(v: Half3) = Half3(this - v.x, this - v.y, this - v.z)
inline operator fun Half.times(v: Half3) = Half3(this * v.x, this * v.y, this * v.z)
inline operator fun Half.div(v: Half3) = Half3(this / v.x, this / v.y, this / v.z)
inline fun abs(v: Half3) = Half3(abs(v.x), abs(v.y), abs(v.z))
inline fun length(v: Half3) = sqrt(v.x * v.x + v.y * v.y + v.z * v.z)
inline fun length2(v: Half3) = v.x * v.x + v.y * v.y + v.z * v.z
inline fun distance(a: Half3, b: Half3) = length(a - b)
inline fun dot(a: Half3, b: Half3) = a.x * b.x + a.y * b.y + a.z * b.z
inline fun cross(a: Half3, b: Half3): Half3 {
return Half3(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x)
}
inline infix fun Half3.x(v: Half3): Half3 {
return Half3(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x)
}
fun normalize(v: Half3): Half3 {
val l = HALF_ONE / length(v)
return Half3(v.x * l, v.y * l, v.z * l)
}
inline fun reflect(i: Half3, n: Half3) = i - HALF_TWO * dot(n, i) * n
fun refract(i: Half3, n: Half3, eta: Half): Half3 {
val d = dot(n, i)
val k = HALF_ONE - eta * eta * (HALF_ONE - sqr(d))
return if (k < Half.POSITIVE_ZERO) Half3() else eta * i - (eta * d + sqrt(k)) * n
}
inline fun clamp(v: Half3, min: Half, max: Half): Half3 {
return Half3(
clamp(v.x, min, max),
clamp(v.y, min, max),
clamp(v.z, min, max)
)
}
inline fun clamp(v: Half3, min: Half3, max: Half3): Half3 {
return Half3(
clamp(v.x, min.x, max.x),
clamp(v.y, min.y, max.y),
clamp(v.z, min.z, max.z)
)
}
inline fun mix(a: Half3, b: Half3, x: Half): Half3 {
return Half3(
mix(a.x, b.x, x),
mix(a.y, b.y, x),
mix(a.z, b.z, x)
)
}
inline fun mix(a: Half3, b: Half3, x: Half3): Half3 {
return Half3(
mix(a.x, b.x, x.x),
mix(a.y, b.y, x.y),
mix(a.z, b.z, x.z)
)
}
inline fun min(v: Half3) = min(v.x, min(v.y, v.z))
inline fun min(a: Half3, b: Half3) = Half3(min(a.x, b.x), min(a.y, b.y), min(a.z, b.z))
inline fun max(v: Half3) = max(v.x, max(v.y, v.z))
inline fun max(a: Half3, b: Half3) = Half3(max(a.x, b.x), max(a.y, b.y), max(a.z, b.z))
inline fun transform(v: Half3, block: (Half) -> Half) = v.copy().transform(block)
inline fun lessThan(a: Half3, b: Half) = Bool3(a.x < b, a.y < b, a.z < b)
inline fun lessThan(a: Half3, b: Half3) = Bool3(a.x < b.x, a.y < b.y, a.z < b.z)
inline fun lessThanEqual(a: Half3, b: Half) = Bool3(a.x <= b, a.y <= b, a.z <= b)
inline fun lessThanEqual(a: Half3, b: Half3) = Bool3(a.x <= b.x, a.y <= b.y, a.z <= b.z)
inline fun greaterThan(a: Half3, b: Half) = Bool3(a.x > b, a.y > b, a.z > b)
inline fun greaterThan(a: Half3, b: Half3) = Bool3(a.x > b.y, a.y > b.y, a.z > b.z)
inline fun greaterThanEqual(a: Half3, b: Half) = Bool3(a.x >= b, a.y >= b, a.z >= b)
inline fun greaterThanEqual(a: Half3, b: Half3) = Bool3(a.x >= b.x, a.y >= b.y, a.z >= b.z)
inline fun equal(a: Half3, b: Half) = Bool3(a.x == b, a.y == b, a.z == b)
inline fun equal(a: Half3, b: Half3) = Bool3(a.x == b.x, a.y == b.y, a.z == b.z)
inline fun notEqual(a: Half3, b: Half) = Bool3(a.x != b, a.y != b, a.z != b)
inline fun notEqual(a: Half3, b: Half3) = Bool3(a.x != b.x, a.y != b.y, a.z != b.z)
inline infix fun Half3.lt(b: Half) = Bool3(x < b, y < b, z < b)
inline infix fun Half3.lt(b: Half3) = Bool3(x < b.x, y < b.y, z < b.z)
inline infix fun Half3.lte(b: Half) = Bool3(x <= b, y <= b, z <= b)
inline infix fun Half3.lte(b: Half3) = Bool3(x <= b.x, y <= b.y, z <= b.z)
inline infix fun Half3.gt(b: Half) = Bool3(x > b, y > b, z > b)
inline infix fun Half3.gt(b: Half3) = Bool3(x > b.x, y > b.y, z > b.z)
inline infix fun Half3.gte(b: Half) = Bool3(x >= b, y >= b, z >= b)
inline infix fun Half3.gte(b: Half3) = Bool3(x >= b.x, y >= b.y, z >= b.z)
inline infix fun Half3.eq(b: Half) = Bool3(x == b, y == b, z == b)
inline infix fun Half3.eq(b: Half3) = Bool3(x == b.x, y == b.y, z == b.z)
inline infix fun Half3.neq(b: Half) = Bool3(x != b, y != b, z != b)
inline infix fun Half3.neq(b: Half3) = Bool3(x != b.x, y != b.y, z != b.z)
inline operator fun Half.plus(v: Half4) = Half4(this + v.x, this + v.y, this + v.z, this + v.w)
inline operator fun Half.minus(v: Half4) = Half4(this - v.x, this - v.y, this - v.z, this - v.w)
inline operator fun Half.times(v: Half4) = Half4(this * v.x, this * v.y, this * v.z, this * v.w)
inline operator fun Half.div(v: Half4) = Half4(this / v.x, this / v.y, this / v.z, this / v.w)
inline fun abs(v: Half4) = Half4(abs(v.x), abs(v.y), abs(v.z), abs(v.w))
inline fun length(v: Half4) = sqrt(v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w)
inline fun length2(v: Half4) = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w
inline fun distance(a: Half4, b: Half4) = length(a - b)
inline fun dot(a: Half4, b: Half4) = a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w
fun normalize(v: Half4): Half4 {
val l = HALF_ONE / length(v)
return Half4(v.x * l, v.y * l, v.z * l, v.w * l)
}
inline fun clamp(v: Half4, min: Half, max: Half): Half4 {
return Half4(
clamp(v.x, min, max),
clamp(v.y, min, max),
clamp(v.z, min, max),
clamp(v.w, min, max)
)
}
inline fun clamp(v: Half4, min: Half4, max: Half4): Half4 {
return Half4(
clamp(v.x, min.x, max.x),
clamp(v.y, min.y, max.y),
clamp(v.z, min.z, max.z),
clamp(v.w, min.z, max.w)
)
}
inline fun mix(a: Half4, b: Half4, x: Half): Half4 {
return Half4(
mix(a.x, b.x, x),
mix(a.y, b.y, x),
mix(a.z, b.z, x),
mix(a.w, b.w, x)
)
}
inline fun mix(a: Half4, b: Half4, x: Half4): Half4 {
return Half4(
mix(a.x, b.x, x.x),
mix(a.y, b.y, x.y),
mix(a.z, b.z, x.z),
mix(a.w, b.w, x.w))
}
inline fun min(v: Half4) = min(v.x, min(v.y, min(v.z, v.w)))
inline fun min(a: Half4, b: Half4): Half4 {
return Half4(min(a.x, b.x), min(a.y, b.y), min(a.z, b.z), min(a.w, b.w))
}
inline fun max(v: Half4) = max(v.x, max(v.y, max(v.z, v.w)))
inline fun max(a: Half4, b: Half4): Half4 {
return Half4(max(a.x, b.x), max(a.y, b.y), max(a.z, b.z), max(a.w, b.w))
}
inline fun transform(v: Half4, block: (Half) -> Half) = v.copy().transform(block)
inline fun lessThan(a: Half4, b: Half) = Bool4(a.x < b, a.y < b, a.z < b, a.w < b)
inline fun lessThan(a: Half4, b: Half4) = Bool4(a.x < b.x, a.y < b.y, a.z < b.z, a.w < b.w)
inline fun lessThanEqual(a: Half4, b: Half) = Bool4(a.x <= b, a.y <= b, a.z <= b, a.w <= b)
inline fun lessThanEqual(a: Half4, b: Half4) = Bool4(a.x <= b.x, a.y <= b.y, a.z <= b.z, a.w <= b.w)
inline fun greaterThan(a: Half4, b: Half) = Bool4(a.x > b, a.y > b, a.z > b, a.w > b)
inline fun greaterThan(a: Half4, b: Half4) = Bool4(a.x > b.y, a.y > b.y, a.z > b.z, a.w > b.w)
inline fun greaterThanEqual(a: Half4, b: Half) = Bool4(a.x >= b, a.y >= b, a.z >= b, a.w >= b)
inline fun greaterThanEqual(a: Half4, b: Half4) = Bool4(a.x >= b.x, a.y >= b.y, a.z >= b.z, a.w >= b.w)
inline fun equal(a: Half4, b: Half) = Bool4(a.x == b, a.y == b, a.z == b, a.w == b)
inline fun equal(a: Half4, b: Half4) = Bool4(a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w)
inline fun notEqual(a: Half4, b: Half) = Bool4(a.x != b, a.y != b, a.z != b, a.w != b)
inline fun notEqual(a: Half4, b: Half4) = Bool4(a.x != b.x, a.y != b.y, a.z != b.z, a.w != b.w)
inline infix fun Half4.lt(b: Half) = Bool4(x < b, y < b, z < b, a < b)
inline infix fun Half4.lt(b: Half4) = Bool4(x < b.x, y < b.y, z < b.z, w < b.w)
inline infix fun Half4.lte(b: Half) = Bool4(x <= b, y <= b, z <= b, w <= b)
inline infix fun Half4.lte(b: Half4) = Bool4(x <= b.x, y <= b.y, z <= b.z, w <= b.w)
inline infix fun Half4.gt(b: Half) = Bool4(x > b, y > b, z > b, w > b)
inline infix fun Half4.gt(b: Half4) = Bool4(x > b.x, y > b.y, z > b.z, w > b.w)
inline infix fun Half4.gte(b: Half) = Bool4(x >= b, y >= b, z >= b, w >= b)
inline infix fun Half4.gte(b: Half4) = Bool4(x >= b.x, y >= b.y, z >= b.z, w >= b.w)
inline infix fun Half4.eq(b: Half) = Bool4(x == b, y == b, z == b, w == b)
inline infix fun Half4.eq(b: Half4) = Bool4(x == b.x, y == b.y, z == b.z, w == b.w)
inline infix fun Half4.neq(b: Half) = Bool4(x != b, y != b, z != b, w != b)
inline infix fun Half4.neq(b: Half4) = Bool4(x != b.x, y != b.y, z != b.z, w != b.w)

View File

@@ -16,6 +16,13 @@ android {
excludes += ['lib/*/libfilament-jni.so']
}
}
publishing {
singleVariant("fullRelease") {
withSourcesJar()
withJavadocJar()
}
}
}
dependencies {

View File

@@ -28,47 +28,81 @@ import com.google.android.filament.proguard.UsedByNative;
@UsedByNative("AssetLoader.cpp")
public interface MaterialProvider {
/**
* MaterialKey specifies the requirements for a requested glTF material.
* The provider creates Filament materials that fulfill these requirements.
*/
@UsedByNative("MaterialKey.cpp")
public static class MaterialKey {
@UsedByNative("MaterialKey.cpp")
public boolean doubleSided;
@UsedByNative("MaterialKey.cpp")
public boolean unlit;
@UsedByNative("MaterialKey.cpp")
public boolean hasVertexColors;
@UsedByNative("MaterialKey.cpp")
public boolean hasBaseColorTexture;
@UsedByNative("MaterialKey.cpp")
public boolean hasNormalTexture;
@UsedByNative("MaterialKey.cpp")
public boolean hasOcclusionTexture;
@UsedByNative("MaterialKey.cpp")
public boolean hasEmissiveTexture;
@UsedByNative("MaterialKey.cpp")
public boolean useSpecularGlossiness;
@UsedByNative("MaterialKey.cpp")
public int alphaMode; // 0 = OPAQUE, 1 = MASK, 2 = BLEND
@UsedByNative("MaterialKey.cpp")
public boolean enableDiagnostics;
@UsedByNative("MaterialKey.cpp")
public boolean hasMetallicRoughnessTexture; // piggybacks with specularRoughness
@UsedByNative("MaterialKey.cpp")
public int metallicRoughnessUV; // piggybacks with specularRoughness
@UsedByNative("MaterialKey.cpp")
public int baseColorUV;
@UsedByNative("MaterialKey.cpp")
public boolean hasClearCoatTexture;
@UsedByNative("MaterialKey.cpp")
public int clearCoatUV;
@UsedByNative("MaterialKey.cpp")
public boolean hasClearCoatRoughnessTexture;
@UsedByNative("MaterialKey.cpp")
public int clearCoatRoughnessUV;
@UsedByNative("MaterialKey.cpp")
public boolean hasClearCoatNormalTexture;
@UsedByNative("MaterialKey.cpp")
public int clearCoatNormalUV;
@UsedByNative("MaterialKey.cpp")
public boolean hasClearCoat;
@UsedByNative("MaterialKey.cpp")
public boolean hasTransmission;
@UsedByNative("MaterialKey.cpp")
public boolean hasTextureTransforms;
@UsedByNative("MaterialKey.cpp")
public int emissiveUV;
@UsedByNative("MaterialKey.cpp")
public int aoUV;
@UsedByNative("MaterialKey.cpp")
public int normalUV;
@UsedByNative("MaterialKey.cpp")
public boolean hasTransmissionTexture;
@UsedByNative("MaterialKey.cpp")
public int transmissionUV;
@UsedByNative("MaterialKey.cpp")
public boolean hasSheenColorTexture;
@UsedByNative("MaterialKey.cpp")
public int sheenColorUV;
@UsedByNative("MaterialKey.cpp")
public boolean hasSheenRoughnessTexture;
@UsedByNative("MaterialKey.cpp")
public int sheenRoughnessUV;
@UsedByNative("MaterialKey.cpp")
public boolean hasVolumeThicknessTexture;
@UsedByNative("MaterialKey.cpp")
public int volumeThicknessUV;
@UsedByNative("MaterialKey.cpp")
public boolean hasSheen;
@UsedByNative("MaterialKey.cpp")
public boolean hasIOR;
public MaterialKey() {}

View File

@@ -20,6 +20,7 @@ import com.google.android.filament.Engine;
import com.google.android.filament.MaterialInstance;
import com.google.android.filament.Material;
import com.google.android.filament.VertexBuffer;
import com.google.android.filament.proguard.UsedByNative;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -94,6 +95,7 @@ public class UbershaderProvider implements MaterialProvider {
nDestroyMaterials(mNativeObject);
}
@UsedByNative("AssetLoader.cpp")
public long getNativeObject() {
return mNativeObject;
}

View File

@@ -1,5 +1,5 @@
GROUP=com.google.android.filament
VERSION_NAME=1.28.2
VERSION_NAME=1.40.4
POM_DESCRIPTION=Real-time physically based rendering engine for Android.
@@ -18,7 +18,12 @@ POM_DEVELOPER_NAME=Filament Team
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
com.google.android.filament.tools-dir=../../../out/release/filament
com.google.android.filament.dist-dir=../out/android-release/filament
com.google.android.filament.abis=all
#com.google.android.filament.matdbg
#com.google.android.filament.matnopt

View File

@@ -86,63 +86,10 @@ afterEvaluate { project ->
}
}
if (project.getPlugins().hasPlugin('com.android.application') ||
project.getPlugins().hasPlugin('com.android.library')) {
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.source
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
excludes = ['**/*.kt']
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.source
}
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
if (JavaVersion.current().isJava9Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addBooleanOption('html5', true)
}
}
}
artifacts {
if (project.getPlugins().hasPlugin('com.android.application') ||
project.getPlugins().hasPlugin('com.android.library')) {
archives androidSourcesJar
archives androidJavadocsJar
}
}
android.libraryVariants.all { variant ->
tasks.androidJavadocs.doFirst {
classpath += files(variant.javaCompileProvider.get().classpath.files.join(File.pathSeparator))
}
}
publishing.publications.all { publication ->
publication.groupId = GROUP
publication.version = VERSION_NAME
publication.artifact androidSourcesJar
publication.artifact androidJavadocsJar
configurePom(publication.pom)
}

View File

@@ -1,6 +1,6 @@
#Wed Nov 17 10:40:18 PST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -40,6 +40,11 @@ android {
dependenciesInfo {
includeInApk = false
}
compileOptions {
sourceCompatibility versions.jdk
targetCompatibility versions.jdk
}
}
dependencies {

View File

@@ -356,6 +356,8 @@ class MainActivity : Activity() {
automation.applySettings(modelViewer.engine, json, viewerContent)
modelViewer.view.colorGrading = automation.getColorGrading(modelViewer.engine)
modelViewer.cameraFocalLength = automation.viewerOptions.cameraFocalLength
modelViewer.cameraNear = automation.viewerOptions.cameraNear
modelViewer.cameraFar = automation.viewerOptions.cameraFar
updateRootTransform()
}

View File

@@ -6,6 +6,10 @@ plugins {
project.ext.isSample = true
kotlin {
jvmToolchain(versions.jdk)
}
filamentTools {
materialInputDir = project.layout.projectDirectory.dir("src/main/materials")
materialOutputDir = project.layout.projectDirectory.dir("src/main/assets/materials")
@@ -36,6 +40,11 @@ android {
aaptOptions {
noCompress 'filamat', 'ktx'
}
compileOptions {
sourceCompatibility versions.jdk
targetCompatibility versions.jdk
}
}
dependencies {

View File

@@ -30,6 +30,7 @@ import com.google.android.filament.*
import com.google.android.filament.RenderableManager.*
import com.google.android.filament.VertexBuffer.*
import com.google.android.filament.android.DisplayHelper
import com.google.android.filament.android.FilamentHelper
import com.google.android.filament.android.UiHelper
import java.nio.ByteBuffer
@@ -401,6 +402,8 @@ class MainActivity : Activity(), ActivityCompat.OnRequestPermissionsResultCallba
camera.setProjection(45.0, aspect, 0.1, 20.0, Camera.Fov.VERTICAL)
view.viewport = Viewport(0, 0, width, height)
FilamentHelper.synchronizePendingFrames(engine)
}
}

View File

@@ -6,6 +6,10 @@ plugins {
project.ext.isSample = true
kotlin {
jvmToolchain(versions.jdk)
}
filamentTools {
materialInputDir = project.layout.projectDirectory.dir("src/main/materials")
materialOutputDir = project.layout.projectDirectory.dir("src/main/assets/materials")
@@ -36,6 +40,11 @@ android {
aaptOptions {
noCompress 'filamat', 'ktx'
}
compileOptions {
sourceCompatibility versions.jdk
targetCompatibility versions.jdk
}
}
dependencies {

View File

@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"

View File

@@ -29,6 +29,7 @@ import com.google.android.filament.RenderableManager.PrimitiveType
import com.google.android.filament.VertexBuffer.AttributeType
import com.google.android.filament.VertexBuffer.VertexAttribute
import com.google.android.filament.android.DisplayHelper
import com.google.android.filament.android.FilamentHelper
import com.google.android.filament.android.UiHelper
import java.nio.ByteBuffer
import java.nio.ByteOrder
@@ -119,8 +120,13 @@ class MainActivity : Activity() {
private fun setupView() {
scene.skybox = Skybox.Builder().color(0.035f, 0.035f, 0.035f, 1.0f).build(engine)
// NOTE: Try to disable post-processing (tone-mapping, etc.) to see the difference
// view.isPostProcessingEnabled = false
if (engine.activeFeatureLevel == Engine.FeatureLevel.FEATURE_LEVEL_0) {
// post-processing is not supported at feature level 0
view.isPostProcessingEnabled = false
} else {
// NOTE: Try to disable post-processing (tone-mapping, etc.) to see the difference
// view.isPostProcessingEnabled = false
}
// Tell the view which camera we want to use
view.camera = camera
@@ -154,7 +160,11 @@ class MainActivity : Activity() {
}
private fun loadMaterial() {
readUncompressedAsset("materials/baked_color.filamat").let {
var name = "materials/baked_color.filamat"
if (engine.activeFeatureLevel == Engine.FeatureLevel.FEATURE_LEVEL_0) {
name = "materials/baked_color_es2.filamat"
}
readUncompressedAsset(name).let {
material = Material.Builder().payload(it, it.remaining()).build(engine)
}
}
@@ -304,7 +314,17 @@ class MainActivity : Activity() {
inner class SurfaceCallback : UiHelper.RendererCallback {
override fun onNativeWindowChanged(surface: Surface) {
swapChain?.let { engine.destroySwapChain(it) }
swapChain = engine.createSwapChain(surface, uiHelper.swapChainFlags)
// at feature level 0, we don't have post-processing, so we need to set
// the colorspace to sRGB (FIXME: it's not supported everywhere!)
var flags = uiHelper.swapChainFlags
if (engine.activeFeatureLevel == Engine.FeatureLevel.FEATURE_LEVEL_0) {
if (SwapChain.isSRGBSwapChainSupported(engine)) {
flags = flags or SwapChain.CONFIG_SRGB_COLORSPACE
}
}
swapChain = engine.createSwapChain(surface, flags)
displayHelper.attach(renderer, surfaceView.display);
}
@@ -327,6 +347,8 @@ class MainActivity : Activity() {
-aspect * zoom, aspect * zoom, -zoom, zoom, 0.0, 10.0)
view.viewport = Viewport(0, 0, width, height)
FilamentHelper.synchronizePendingFrames(engine)
}
}

View File

@@ -17,7 +17,7 @@ material {
],
// This material disables all lighting
shadingModel : unlit,
shadingModel : unlit
}
fragment {

View File

@@ -0,0 +1,33 @@
// Simple unlit material that uses the colors associated with each vertex.
//
// This source material must be compiled to a binary material using the matc tool.
// The command used to compile this material is:
// matc -p mobile -a opengl -o app/src/main/assets/baked_color.filamat app/src/materials/baked_color.mat
//
// See build.gradle for an example of how to compile materials automatically
// Please refer to the documentation for more information about matc and the materials system.
material {
name : baked_color,
// Lists the required vertex attributes
// Here we only need a color (RGBA)
requires : [
color
],
// This material disables all lighting
shadingModel : unlit,
featureLevel : 0
}
fragment {
void material(inout MaterialInputs material) {
// You must always call the prepareMaterial() function
prepareMaterial(material);
// We set the material's color to the color interpolated from
// the model's vertices
material.baseColor = getColor();
}
}

View File

@@ -6,6 +6,10 @@ plugins {
project.ext.isSample = true
kotlin {
jvmToolchain(versions.jdk)
}
filamentTools {
materialInputDir = project.layout.projectDirectory.dir("src/main/materials")
materialOutputDir = project.layout.projectDirectory.dir("src/main/assets/materials")
@@ -42,6 +46,11 @@ android {
aaptOptions {
noCompress 'filamat', 'ktx'
}
compileOptions {
sourceCompatibility versions.jdk
targetCompatibility versions.jdk
}
}
dependencies {

View File

@@ -26,6 +26,7 @@ import android.view.animation.LinearInterpolator
import com.google.android.filament.*
import com.google.android.filament.android.DisplayHelper
import com.google.android.filament.android.FilamentHelper
import com.google.android.filament.android.UiHelper
import java.nio.ByteBuffer
@@ -303,6 +304,8 @@ class MainActivity : Activity() {
camera.setProjection(45.0, aspect, 0.1, 20.0, Camera.Fov.VERTICAL)
view.viewport = Viewport(0, 0, width, height)
FilamentHelper.synchronizePendingFrames(engine)
}
}

View File

@@ -6,6 +6,10 @@ plugins {
project.ext.isSample = true
kotlin {
jvmToolchain(versions.jdk)
}
filamentTools {
materialInputDir = project.layout.projectDirectory.dir("src/main/materials")
materialOutputDir = project.layout.projectDirectory.dir("src/main/assets/materials")
@@ -35,6 +39,11 @@ android {
aaptOptions {
noCompress 'filamat', 'ktx'
}
compileOptions {
sourceCompatibility versions.jdk
targetCompatibility versions.jdk
}
}
dependencies {

View File

@@ -29,6 +29,7 @@ import com.google.android.filament.*
import com.google.android.filament.RenderableManager.*
import com.google.android.filament.VertexBuffer.*
import com.google.android.filament.android.DisplayHelper
import com.google.android.filament.android.FilamentHelper
import com.google.android.filament.android.UiHelper
import java.nio.ByteBuffer
@@ -413,6 +414,8 @@ class MainActivity : Activity() {
camera.setProjection(45.0, aspect, 0.1, 20.0, Camera.Fov.VERTICAL)
view.viewport = Viewport(0, 0, width, height)
FilamentHelper.synchronizePendingFrames(engine)
}
}

View File

@@ -3,6 +3,10 @@ apply plugin: 'kotlin-android'
project.ext.isSample = true
kotlin {
jvmToolchain(versions.jdk)
}
android {
namespace 'com.google.android.filament.livewallpaper'
@@ -18,6 +22,11 @@ android {
dependenciesInfo {
includeInApk = false
}
compileOptions {
sourceCompatibility versions.jdk
targetCompatibility versions.jdk
}
}
dependencies {

View File

@@ -31,6 +31,7 @@ import android.view.animation.LinearInterpolator
import androidx.annotation.RequiresApi
import com.google.android.filament.*
import com.google.android.filament.android.DisplayHelper
import com.google.android.filament.android.FilamentHelper
import com.google.android.filament.android.UiHelper
class FilamentLiveWallpaper : WallpaperService() {
@@ -226,6 +227,8 @@ class FilamentLiveWallpaper : WallpaperService() {
camera.setProjection(45.0, aspect, 0.1, 20.0, Camera.Fov.VERTICAL)
view.viewport = Viewport(0, 0, width, height)
FilamentHelper.synchronizePendingFrames(engine)
}
}
}

View File

@@ -6,6 +6,10 @@ plugins {
project.ext.isSample = true
kotlin {
jvmToolchain(versions.jdk)
}
filamentTools {
meshInputFile = project.layout.projectDirectory.file("../../../third_party/models/shader_ball/shader_ball.obj")
meshOutputDir = project.layout.projectDirectory.dir("src/main/assets/models")
@@ -46,6 +50,11 @@ android {
aaptOptions {
noCompress 'filamat'
}
compileOptions {
sourceCompatibility versions.jdk
targetCompatibility versions.jdk
}
}
dependencies {

View File

@@ -26,6 +26,7 @@ import android.view.animation.LinearInterpolator
import com.google.android.filament.*
import com.google.android.filament.android.DisplayHelper
import com.google.android.filament.android.FilamentHelper
import com.google.android.filament.android.UiHelper
import com.google.android.filament.filamat.MaterialBuilder
@@ -343,6 +344,8 @@ class MainActivity : Activity() {
camera.setProjection(45.0, aspect, 0.1, 20.0, Camera.Fov.VERTICAL)
view.viewport = Viewport(0, 0, width, height)
FilamentHelper.synchronizePendingFrames(engine)
}
}
}

View File

@@ -1,3 +1,3 @@
<resources>
<string name="app_name">Image-Based Lighting</string>
<string name="app_name">Material Builder</string>
</resources>

View File

@@ -6,6 +6,10 @@ plugins {
project.ext.isSample = true
kotlin {
jvmToolchain(versions.jdk)
}
filamentTools {
materialInputDir = project.layout.projectDirectory.dir("src/main/materials")
materialOutputDir = project.layout.projectDirectory.dir("src/main/assets/materials")
@@ -35,6 +39,11 @@ android {
aaptOptions {
noCompress 'filamat', 'ktx'
}
compileOptions {
sourceCompatibility versions.jdk
targetCompatibility versions.jdk
}
}
dependencies {

View File

@@ -27,8 +27,10 @@ import android.view.animation.LinearInterpolator
import com.google.android.filament.*
import com.google.android.filament.RenderableManager.*
import com.google.android.filament.Renderer.ClearOptions
import com.google.android.filament.VertexBuffer.*
import com.google.android.filament.android.DisplayHelper
import com.google.android.filament.android.FilamentHelper
import com.google.android.filament.android.UiHelper
import java.nio.ByteBuffer
@@ -64,7 +66,6 @@ class MainActivity : Activity() {
private lateinit var view0: View
private lateinit var view1: View
private lateinit var view2: View
private lateinit var view3: View
private lateinit var view4: View
// We need skybox to set the background color
private lateinit var skybox: Skybox
@@ -119,15 +120,19 @@ class MainActivity : Activity() {
view0 = engine.createView()
view1 = engine.createView()
view2 = engine.createView()
view3 = engine.createView()
view4 = engine.createView()
view0.setName("view0");
view1.setName("view1");
view2.setName("view2");
view3.setName("view3");
view4.setName("view4");
// Useful for debugging issues
// view0.isPostProcessingEnabled = false
// view1.isPostProcessingEnabled = false
// view2.isPostProcessingEnabled = false
// view4.isPostProcessingEnabled = false
view4.blendMode = View.BlendMode.TRANSLUCENT;
skybox = Skybox.Builder().build(engine);
@@ -140,13 +145,11 @@ class MainActivity : Activity() {
view0.camera = camera
view1.camera = camera
view2.camera = camera
view3.camera = camera
view4.camera = camera
view0.scene = scene
view1.scene = scene
view2.scene = scene
view3.scene = scene
view4.scene = scene
}
@@ -379,7 +382,6 @@ class MainActivity : Activity() {
engine.destroyView(view0)
engine.destroyView(view1)
engine.destroyView(view2)
engine.destroyView(view3)
engine.destroyView(view4)
engine.destroySkybox(skybox)
engine.destroyScene(scene)
@@ -407,19 +409,18 @@ class MainActivity : Activity() {
// If beginFrame() returns false you should skip the frame
// This means you are sending frames too quickly to the GPU
if (renderer.beginFrame(swapChain!!, frameTimeNanos)) {
skybox.setColor(0.035f, 0.035f, 0.035f, 1.0f);
scene.skybox = skybox
skybox.setColor(0.35f, 0.35f, 0.35f, 1.0f);
renderer.render(view0)
skybox.setColor(1.0f, 0.0f, 0.0f, 1.0f);
skybox.setColor(1.0f, 1.0f, 0.0f, 1.0f);
renderer.render(view1)
skybox.setColor(0.0f, 1.0f, 0.0f, 1.0f);
scene.skybox = null
renderer.render(view2)
skybox.setColor(0.0f, 0.0f, 1.0f, 1.0f);
renderer.render(view3)
skybox.setColor(0.0f, 0.0f, 0.0f, 0.0f);
renderer.render(view4)
renderer.endFrame()
@@ -433,6 +434,10 @@ class MainActivity : Activity() {
swapChain?.let { engine.destroySwapChain(it) }
swapChain = engine.createSwapChain(surface)
renderer.setDisplayInfo(DisplayHelper.getDisplayInfo(surfaceView.display, Renderer.DisplayInfo()))
renderer.clearOptions = renderer.clearOptions.apply {
clear = true
clearColor = floatArrayOf( 0.0f, 0.0f, 1.0f, 0.0f )
}
}
override fun onDetachedFromSurface() {
@@ -453,8 +458,9 @@ class MainActivity : Activity() {
view0.viewport = Viewport(0, 0, width / 2, height / 2)
view1.viewport = Viewport(width / 2, 0, width / 2, height / 2)
view2.viewport = Viewport(0, height / 2, width / 2, height / 2)
view3.viewport = Viewport(width / 2, height / 2, width / 2, height / 2)
view4.viewport = Viewport(width / 4, height / 4, width / 2, height / 2)
FilamentHelper.synchronizePendingFrames(engine)
}
}

View File

@@ -6,6 +6,10 @@ plugins {
project.ext.isSample = true
kotlin {
jvmToolchain(versions.jdk)
}
filamentTools {
iblInputFile = project.layout.projectDirectory.file("../../../third_party/environments/studio_small_02_2k.hdr")
iblOutputDir = project.layout.projectDirectory.dir("src/main/assets/envs")
@@ -38,6 +42,11 @@ android {
aaptOptions {
noCompress 'filamat'
}
compileOptions {
sourceCompatibility versions.jdk
targetCompatibility versions.jdk
}
}
dependencies {

View File

@@ -37,6 +37,7 @@ import com.google.android.filament.Camera;
import com.google.android.filament.Engine;
import com.google.android.filament.Entity;
import com.google.android.filament.EntityManager;
import com.google.android.filament.Fence;
import com.google.android.filament.Filament;
import com.google.android.filament.IndirectLight;
import com.google.android.filament.LightManager;
@@ -49,6 +50,7 @@ import com.google.android.filament.TransformManager;
import com.google.android.filament.Viewport;
import com.google.android.filament.android.DisplayHelper;
import com.google.android.filament.android.FilamentHelper;
import com.google.android.filament.android.TextureHelper;
import com.google.android.filament.android.UiHelper;
@@ -107,6 +109,7 @@ public class MainActivity extends Activity
mCamera.setProjection(60.0, aspect, 1.0, 2000.0, Camera.Fov.HORIZONTAL);
}
mView.setViewport(new Viewport(0, 0, width, height));
FilamentHelper.synchronizePendingFrames(mEngine);
}
@Override

View File

@@ -6,6 +6,10 @@ plugins {
project.ext.isSample = true
kotlin {
jvmToolchain(versions.jdk)
}
filamentTools {
materialInputDir = project.layout.projectDirectory.dir("src/main/materials")
materialOutputDir = project.layout.projectDirectory.dir("src/main/assets/materials")
@@ -36,6 +40,11 @@ android {
aaptOptions {
noCompress 'filamat', 'ktx'
}
compileOptions {
sourceCompatibility versions.jdk
targetCompatibility versions.jdk
}
}
dependencies {

View File

@@ -38,6 +38,7 @@ import android.os.Build
import android.view.MotionEvent
import androidx.annotation.RequiresApi
import com.google.android.filament.android.DisplayHelper
import com.google.android.filament.android.FilamentHelper
class MainActivity : Activity(), ActivityCompat.OnRequestPermissionsResultCallback {
@@ -401,6 +402,8 @@ class MainActivity : Activity(), ActivityCompat.OnRequestPermissionsResultCallba
camera.setProjection(45.0, aspect, 0.1, 20.0, Camera.Fov.VERTICAL)
view.viewport = Viewport(0, 0, width, height)
FilamentHelper.synchronizePendingFrames(engine)
}
}

View File

@@ -6,6 +6,10 @@ plugins {
project.ext.isSample = true
kotlin {
jvmToolchain(versions.jdk)
}
filamentTools {
materialInputDir = project.layout.projectDirectory.dir("src/main/materials")
materialOutputDir = project.layout.projectDirectory.dir("src/main/assets/materials")
@@ -36,6 +40,11 @@ android {
aaptOptions {
noCompress 'filamat', 'ktx'
}
compileOptions {
sourceCompatibility versions.jdk
targetCompatibility versions.jdk
}
}
dependencies {

View File

@@ -29,6 +29,7 @@ import com.google.android.filament.RenderableManager.PrimitiveType
import com.google.android.filament.VertexBuffer.AttributeType
import com.google.android.filament.VertexBuffer.VertexAttribute
import com.google.android.filament.android.DisplayHelper
import com.google.android.filament.android.FilamentHelper
import com.google.android.filament.android.UiHelper
import java.nio.ByteBuffer
import java.nio.ByteOrder
@@ -327,6 +328,8 @@ class MainActivity : Activity() {
-aspect * zoom, aspect * zoom, -zoom, zoom, 0.0, 10.0)
view.viewport = Viewport(0, 0, width, height)
FilamentHelper.synchronizePendingFrames(engine)
}
}

View File

@@ -6,6 +6,10 @@ plugins {
project.ext.isSample = true
kotlin {
jvmToolchain(versions.jdk)
}
filamentTools {
materialInputDir = project.layout.projectDirectory.dir("src/main/materials")
materialOutputDir = project.layout.projectDirectory.dir("src/main/assets/materials")
@@ -43,6 +47,11 @@ android {
aaptOptions {
noCompress 'filamat', 'ktx'
}
compileOptions {
sourceCompatibility versions.jdk
targetCompatibility versions.jdk
}
}
dependencies {

View File

@@ -26,6 +26,7 @@ import android.view.animation.LinearInterpolator
import com.google.android.filament.*
import com.google.android.filament.android.DisplayHelper
import com.google.android.filament.android.FilamentHelper
import com.google.android.filament.utils.*
import com.google.android.filament.android.UiHelper
@@ -230,7 +231,7 @@ class MainActivity : Activity() {
animator.repeatCount = ValueAnimator.INFINITE
animator.addUpdateListener { a ->
val v = (a.animatedValue as Float)
camera.lookAt(cos(v) * 4.5, 1.5, sin(v) * 4.5, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
camera.lookAt(cos(v) * 5.5, 1.5, sin(v) * 5.5, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
}
animator.start()
}
@@ -252,7 +253,7 @@ class MainActivity : Activity() {
// Stop the animation and any pending frame
choreographer.removeFrameCallback(frameScheduler)
animator.cancel();
animator.cancel()
// Always detach the surface before destroying the engine
uiHelper.detach()
@@ -323,6 +324,8 @@ class MainActivity : Activity() {
camera.setProjection(45.0, aspect, 0.1, 20.0, Camera.Fov.VERTICAL)
view.viewport = Viewport(0, 0, width, height)
FilamentHelper.synchronizePendingFrames(engine)
}
}

View File

@@ -6,6 +6,10 @@ plugins {
project.ext.isSample = true
kotlin {
jvmToolchain(versions.jdk)
}
filamentTools {
materialInputDir = project.layout.projectDirectory.dir("src/main/materials")
materialOutputDir = project.layout.projectDirectory.dir("src/main/assets/materials")
@@ -36,6 +40,11 @@ android {
aaptOptions {
noCompress 'filamat', 'ktx'
}
compileOptions {
sourceCompatibility versions.jdk
targetCompatibility versions.jdk
}
}
dependencies {

View File

@@ -33,6 +33,7 @@ import com.google.android.filament.*
import com.google.android.filament.RenderableManager.*
import com.google.android.filament.VertexBuffer.*
import com.google.android.filament.android.DisplayHelper
import com.google.android.filament.android.FilamentHelper
import com.google.android.filament.android.UiHelper
import java.nio.ByteBuffer
@@ -139,9 +140,9 @@ class MainActivity : Activity() {
camera = engine.createCamera(engine.entityManager.create())
// clear the swapchain with transparent pixels
val options = renderer.clearOptions
options.clear = true
renderer.clearOptions = options
renderer.clearOptions = renderer.clearOptions.apply {
clear = true
}
}
private fun setupView() {
@@ -350,6 +351,8 @@ class MainActivity : Activity() {
-aspect * zoom, aspect * zoom, -zoom, zoom, 0.0, 10.0)
view.viewport = Viewport(0, 0, width, height)
FilamentHelper.synchronizePendingFrames(engine)
}
}

View File

Before

Width:  |  Height:  |  Size: 848 KiB

After

Width:  |  Height:  |  Size: 848 KiB

View File

@@ -22,9 +22,11 @@ function print_help {
echo " All (and only) git-ignored files under android/ are deleted."
echo " This is sometimes needed instead of -c (which still misses some clean steps)."
echo " -d"
echo " Enable matdbg and disable material optimization."
echo " Enable matdbg."
echo " -f"
echo " Always invoke CMake before incremental builds."
echo " -g"
echo " Disable material optimization."
echo " -i"
echo " Install build output"
echo " -m"
@@ -56,6 +58,9 @@ function print_help {
echo " When building for Android, also build select sample APKs."
echo " sampleN is an Android sample, e.g., sample-gltf-viewer."
echo " This automatically performs a partial desktop build and install."
echo " -b"
echo " Enable Address and Undefined Behavior Sanitizers (asan/ubsan) for debugging."
echo " This is only for the desktop build."
echo ""
echo "Build types:"
echo " release"
@@ -85,8 +90,8 @@ function print_help {
echo " Desktop matc target, release build:"
echo " \$ ./$self_name release matc"
echo ""
echo " Build gltf_viewer then immediately run it with no arguments:"
echo " \$ ./$self_name release run_gltf_viewer"
echo " Build gltf_viewer:"
echo " \$ ./$self_name release gltf_viewer"
echo ""
}
@@ -162,6 +167,11 @@ EGL_ON_LINUX_OPTION="-DFILAMENT_SUPPORTS_EGL_ON_LINUX=OFF"
MATDBG_OPTION="-DFILAMENT_ENABLE_MATDBG=OFF"
MATDBG_GRADLE_OPTION=""
MATOPT_OPTION=""
MATOPT_GRADLE_OPTION=""
ASAN_UBSAN_OPTION=""
IOS_BUILD_SIMULATOR=false
BUILD_UNIVERSAL_LIBRARIES=false
@@ -221,6 +231,8 @@ function build_desktop_target {
${SWIFTSHADER_OPTION} \
${EGL_ON_LINUX_OPTION} \
${MATDBG_OPTION} \
${MATOPT_OPTION} \
${ASAN_UBSAN_OPTION} \
${deployment_target} \
${architectures} \
../..
@@ -347,6 +359,7 @@ function build_android_target {
-DCMAKE_INSTALL_PREFIX="../android-${lc_target}/filament" \
-DCMAKE_TOOLCHAIN_FILE="../../build/toolchain-${arch}-linux-android.cmake" \
${MATDBG_OPTION} \
${MATOPT_OPTION} \
${VULKAN_ANDROID_OPTION} \
../..
fi
@@ -463,6 +476,7 @@ function build_android {
-Pcom.google.android.filament.abis=${ABI_GRADLE_OPTION} \
${VULKAN_ANDROID_GRADLE_OPTION} \
${MATDBG_GRADLE_OPTION} \
${MATOPT_GRADLE_OPTION} \
:filament-android:assembleDebug \
:gltfio-android:assembleDebug \
:filament-utils-android:assembleDebug
@@ -477,6 +491,7 @@ function build_android {
./gradlew \
-Pcom.google.android.filament.dist-dir=../out/android-debug/filament \
-Pcom.google.android.filament.abis=${ABI_GRADLE_OPTION} \
${MATOPT_GRADLE_OPTION} \
:samples:${sample}:assembleDebug
done
fi
@@ -510,6 +525,7 @@ function build_android {
-Pcom.google.android.filament.abis=${ABI_GRADLE_OPTION} \
${VULKAN_ANDROID_GRADLE_OPTION} \
${MATDBG_GRADLE_OPTION} \
${MATOPT_GRADLE_OPTION} \
:filament-android:assembleRelease \
:gltfio-android:assembleRelease \
:filament-utils-android:assembleRelease
@@ -524,6 +540,7 @@ function build_android {
./gradlew \
-Pcom.google.android.filament.dist-dir=../out/android-release/filament \
-Pcom.google.android.filament.abis=${ABI_GRADLE_OPTION} \
${MATOPT_GRADLE_OPTION} \
:samples:${sample}:assembleRelease
done
fi
@@ -576,6 +593,7 @@ function build_ios_target {
-DIOS=1 \
-DCMAKE_TOOLCHAIN_FILE=../../third_party/clang/iOS.cmake \
${MATDBG_OPTION} \
${MATOPT_OPTION} \
../..
fi
@@ -740,7 +758,7 @@ function run_tests {
pushd "$(dirname "$0")" > /dev/null
while getopts ":hacCfijmp:q:uvslwtedk:" opt; do
while getopts ":hacCfgijmp:q:uvslwtedk:b" opt; do
case ${opt} in
h)
print_help
@@ -758,12 +776,16 @@ while getopts ":hacCfijmp:q:uvslwtedk:" opt; do
;;
d)
PRINT_MATDBG_HELP=true
MATDBG_OPTION="-DFILAMENT_ENABLE_MATDBG=ON, -DFILAMENT_DISABLE_MATOPT=ON, -DFILAMENT_BUILD_FILAMAT=ON"
MATDBG_OPTION="-DFILAMENT_ENABLE_MATDBG=ON, -DFILAMENT_BUILD_FILAMAT=ON"
MATDBG_GRADLE_OPTION="-Pcom.google.android.filament.matdbg"
;;
f)
ISSUE_CMAKE_ALWAYS=true
;;
g)
MATOPT_OPTION="-DFILAMENT_DISABLE_MATOPT=ON"
MATOPT_GRADLE_OPTION="-Pcom.google.android.filament.matnopt"
;;
i)
INSTALL_COMMAND=install
;;
@@ -863,6 +885,9 @@ while getopts ":hacCfijmp:q:uvslwtedk:" opt; do
BUILD_ANDROID_SAMPLES=true
ANDROID_SAMPLES=$(echo "${OPTARG}" | tr ',' '\n')
;;
b) ASAN_UBSAN_OPTION="-DFILAMENT_ENABLE_ASAN_UBSAN=ON"
echo "Enabled ASAN/UBSAN"
;;
\?)
echo "Invalid option: -${OPTARG}" >&2
echo ""

View File

@@ -44,13 +44,20 @@ elif [[ "$LC_UNAME" == "darwin" ]]; then
fi
source `dirname $0`/../common/build-common.sh
if [[ "$GITHUB_WORKFLOW" ]]; then
java_version=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1)
if [[ "$java_version" < 17 ]]; then
echo "Android builds require Java 17, found version ${java_version} instead"
exit 0
fi
fi
# Unless explicitly specified, NDK version will be set to match exactly the required one
FILAMENT_NDK_VERSION=${FILAMENT_NDK_VERSION:-$(cat `dirname $0`/ndk.version)}
# Install the required NDK version specifically (if not present)
if [[ ! -d "${ANDROID_HOME}/ndk/$FILAMENT_NDK_VERSION" ]]; then
# NOTE: We MUST use Java 1.8 to run sdkmanager currently, it fails starting with Java 11
JAVA_HOME=${JAVA_HOME_8_X64} ${ANDROID_HOME}/tools/bin/sdkmanager "ndk;$FILAMENT_NDK_VERSION" > /dev/null
${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager "ndk;$FILAMENT_NDK_VERSION" > /dev/null
fi
# Only build 1 64 bit target during presubmit to cut down build times during presubmit

View File

@@ -2,6 +2,11 @@
set -e
case "$(uname -s)" in
Darwin*) IS_DARWIN=1;;
*) ;;
esac
function print_help {
local SELF_NAME
SELF_NAME=$(basename "$0")
@@ -45,7 +50,11 @@ function replace {
FIND_STR="${1//\{\{VERSION\}\}/${VERSION_REGEX}}"
REPLACE_STR="${1//\{\{VERSION\}\}/${NEW_VERSION}}"
local FILE_NAME="$2"
sed -i '' -E "s/${FIND_STR}/${REPLACE_STR}/" "${FILE_NAME}"
if [ IS_DARWIN ]; then
sed -i '' -E "s/${FIND_STR}/${REPLACE_STR}/" "${FILE_NAME}"
else
sed -i -E "s/${FIND_STR}/${REPLACE_STR}/" "${FILE_NAME}"
fi
}
# The following are the canonical locations where the Filament version number is referenced.

View File

@@ -44,6 +44,10 @@ FILAMENT_HEADERS="$1"
includes=()
pushd "$FILAMENT_HEADERS" >/dev/null
for f in $(find . -name '*.h'); do
# Ignore platform headers. These may contain platform-specific includes.
if [[ "$f" == *backend/platforms/* ]]; then
continue
fi
include_path="${f#./}" # strip leading ./
includes+=("${include_path}")
done

View File

@@ -3,12 +3,4 @@
if [[ "$GITHUB_WORKFLOW" ]]; then
echo "Running workflow $GITHUB_WORKFLOW (event: $GITHUB_EVENT_NAME, action: $GITHUB_ACTION)"
CONTINUOUS_INTEGRATION=true
# Force Java to be Java 11 minimum, it defaults to 8 in GitHub runners for some platforms
export JAVA_HOME=${JAVA_HOME_11_X64}
java_version=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1)
if [[ "$java_version" < 11 ]]; then
echo "Android builds require Java 11, found version ${java_version} instead"
exit 0
fi
fi

View File

@@ -1,14 +0,0 @@
setuptools==58.0.4
wheel==0.37.1
certifi==2022.9.24
cffi==1.15.1
charset-normalizer==2.1.1
Deprecated==1.2.13
idna==3.4
pycparser==2.21
PyGithub==1.56
PyJWT==2.6.0
PyNaCl==1.5.0
requests==2.28.1
urllib3==1.26.12
wrapt==1.14.1

View File

@@ -1,93 +0,0 @@
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# requirements.txt created via:
#
# pip3 install virtualenv
# python3 -m venv env
# pip3 install PyGithub
# pip3 install wheel
# --all includes wheel and setuputils, which is needed for GitHub Actions
# pip3 freeze --all > requirements.txt
# Manually move 'setuptools' and 'wheel' lines to the beginning of the file.
# Manually remove the 'pip' line.
#
# Requirements are installed in GitHub Actions via:
# xargs -L 1 sudo pip3 install < build/common/requirements.txt
# xargs must be used because the ordering of the dependencies matters (namely, setuptools).
# sudo must be used to uninstall non-matching versions of packages.
# pip is removed to avoid conflicts with the pre-installed pip version on Actions.
# This technique does not work with Windows, unfortunately.
from github import Github
import os, sys
def print_usage():
print('Upload assets to a Filament GitHub release.')
print()
print('Usage:')
print(' upload-assets.py <tag> <asset>...')
print()
print('Notes:')
print(' The GitHub release must already be created prior to running this script. This is typically done')
print(' through the GitHub web UI.')
print()
print(' <tag> is the Git tag for the desired release to attach assets to, for example, "v1.4.2".')
print()
print(' <asset> is a path to the asset file to upload. The file name will be used as the name of the')
print(' asset.')
print()
print(' The GITHUB_API_KEY environment variable must be set to a valid authentication token for a')
print(' collaborator account of the Filament repository.')
# The first argument is the path to this script.
if len(sys.argv) < 3:
print_usage()
sys.exit(1)
tag = sys.argv[1]
assets = sys.argv[2:]
authentication_token = os.environ.get('GITHUB_API_KEY')
if not authentication_token:
sys.stderr.write('Error: the GITHUB_API_KEY is not set.\n')
sys.exit(1)
g = Github(authentication_token)
FILAMENT_REPO = "google/filament"
filament = g.get_repo(FILAMENT_REPO)
def find_release_from_tag(repo, tag):
""" Find a release in the repo for the given Git tag string. """
releases = repo.get_releases()
for r in releases:
if r.tag_name == tag:
return r
return None
release = find_release_from_tag(filament, tag)
if not release:
sys.stderr.write(f"Error: Could not find release with tag '{tag}'.\n")
sys.exit(1)
print(f"Found release with tag '{tag}'.")
for asset_path in assets:
sys.stdout.write(f'Uploding asset: {asset_path}... ')
asset_name = os.path.basename(asset_path)
asset = release.upload_asset(asset_path, name=asset_name)
if asset:
sys.stdout.write('Success!\n')

View File

@@ -0,0 +1,78 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const uploadReleaseAssets = async ({github, context}, assetPathsToUpload, releaseTag) => {
const fs = require('fs/promises');
const path = require('path');
const filesToUpload = assetPathsToUpload.map(assetPath => ({
buffer: fs.readFile(assetPath),
assetName: path.basename(assetPath)
}));
const findReleaseMatchingTag = async tag => {
const { data: releases } = await github.rest.repos.listReleases(context.repo);
const release = releases.find(release => release.tag_name === releaseTag);
if (!release) {
throw new Error(`Could not locate release with tag '${releaseTag}'`);
}
return release;
};
const release = await findReleaseMatchingTag(releaseTag);
console.log(`Found release named '${release.name}' matching tag '${release.tag_name}'.`);
const uploadPromises = [];
for (const file of filesToUpload) {
console.log(`Uploading asset ${file.assetName}.`);
const p = github.rest.repos.uploadReleaseAsset({
...context.repo,
release_id: release.id,
name: file.assetName,
data: await file.buffer
});
uploadPromises.push(p);
}
await Promise.all(uploadPromises);
console.log("Done!");
}
module.exports = uploadReleaseAssets;
////////////////////////////////////////////////////////////////////////////////////////////////////
// To test this script locally, uncomment the code below and run:
//
// npm install
// node index.js
// const { Octokit } = require("@octokit/rest");
// const glob = require("@actions/glob");
// (async () => {
// const github = new Octokit({
// auth: "" // <-- paste GitHub auth token here
// });
// const context = {
// repo: {
// owner: "bejado",
// repo: "filament",
// },
// };
// const globber = await glob.create('*.txt');
// await uploadReleaseAssets({ github, context }, await globber.glob(), 'vtest-28');
// })();

View File

@@ -0,0 +1,546 @@
{
"name": "upload-release-assets",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "1.0.0",
"license": "Apache-2.0",
"dependencies": {
"@actions/glob": "^0.3.0",
"@octokit/rest": "^19.0.5"
}
},
"node_modules/@actions/core": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
"dependencies": {
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
}
},
"node_modules/@actions/glob": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.3.0.tgz",
"integrity": "sha512-tJP1ZhF87fd6LBnaXWlahkyvdgvsLl7WnreW1EZaC8JWjpMXmzqWzQVe/IEYslrkT9ymibVrKyJN4UMD7uQM2w==",
"dependencies": {
"@actions/core": "^1.2.6",
"minimatch": "^3.0.4"
}
},
"node_modules/@actions/http-client": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
"dependencies": {
"tunnel": "^0.0.6"
}
},
"node_modules/@octokit/auth-token": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-3.0.2.tgz",
"integrity": "sha512-pq7CwIMV1kmzkFTimdwjAINCXKTajZErLB4wMLYapR2nuB/Jpr66+05wOTZMSCBXP6n4DdDWT2W19Bm17vU69Q==",
"dependencies": {
"@octokit/types": "^8.0.0"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/@octokit/core": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-4.1.0.tgz",
"integrity": "sha512-Czz/59VefU+kKDy+ZfDwtOIYIkFjExOKf+HA92aiTZJ6EfWpFzYQWw0l54ji8bVmyhc+mGaLUbSUmXazG7z5OQ==",
"dependencies": {
"@octokit/auth-token": "^3.0.0",
"@octokit/graphql": "^5.0.0",
"@octokit/request": "^6.0.0",
"@octokit/request-error": "^3.0.0",
"@octokit/types": "^8.0.0",
"before-after-hook": "^2.2.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/@octokit/endpoint": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-7.0.3.tgz",
"integrity": "sha512-57gRlb28bwTsdNXq+O3JTQ7ERmBTuik9+LelgcLIVfYwf235VHbN9QNo4kXExtp/h8T423cR5iJThKtFYxC7Lw==",
"dependencies": {
"@octokit/types": "^8.0.0",
"is-plain-object": "^5.0.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/@octokit/graphql": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.4.tgz",
"integrity": "sha512-amO1M5QUQgYQo09aStR/XO7KAl13xpigcy/kI8/N1PnZYSS69fgte+xA4+c2DISKqUZfsh0wwjc2FaCt99L41A==",
"dependencies": {
"@octokit/request": "^6.0.0",
"@octokit/types": "^8.0.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/@octokit/openapi-types": {
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-14.0.0.tgz",
"integrity": "sha512-HNWisMYlR8VCnNurDU6os2ikx0s0VyEjDYHNS/h4cgb8DeOxQ0n72HyinUtdDVxJhFy3FWLGl0DJhfEWk3P5Iw=="
},
"node_modules/@octokit/plugin-paginate-rest": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-5.0.1.tgz",
"integrity": "sha512-7A+rEkS70pH36Z6JivSlR7Zqepz3KVucEFVDnSrgHXzG7WLAzYwcHZbKdfTXHwuTHbkT1vKvz7dHl1+HNf6Qyw==",
"dependencies": {
"@octokit/types": "^8.0.0"
},
"engines": {
"node": ">= 14"
},
"peerDependencies": {
"@octokit/core": ">=4"
}
},
"node_modules/@octokit/plugin-request-log": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz",
"integrity": "sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==",
"peerDependencies": {
"@octokit/core": ">=3"
}
},
"node_modules/@octokit/plugin-rest-endpoint-methods": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-6.7.0.tgz",
"integrity": "sha512-orxQ0fAHA7IpYhG2flD2AygztPlGYNAdlzYz8yrD8NDgelPfOYoRPROfEyIe035PlxvbYrgkfUZIhSBKju/Cvw==",
"dependencies": {
"@octokit/types": "^8.0.0",
"deprecation": "^2.3.1"
},
"engines": {
"node": ">= 14"
},
"peerDependencies": {
"@octokit/core": ">=3"
}
},
"node_modules/@octokit/request": {
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-6.2.2.tgz",
"integrity": "sha512-6VDqgj0HMc2FUX2awIs+sM6OwLgwHvAi4KCK3mT2H2IKRt6oH9d0fej5LluF5mck1lRR/rFWN0YIDSYXYSylbw==",
"dependencies": {
"@octokit/endpoint": "^7.0.0",
"@octokit/request-error": "^3.0.0",
"@octokit/types": "^8.0.0",
"is-plain-object": "^5.0.0",
"node-fetch": "^2.6.7",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/@octokit/request-error": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-3.0.2.tgz",
"integrity": "sha512-WMNOFYrSaX8zXWoJg9u/pKgWPo94JXilMLb2VManNOby9EZxrQaBe/QSC4a1TzpAlpxofg2X/jMnCyZgL6y7eg==",
"dependencies": {
"@octokit/types": "^8.0.0",
"deprecation": "^2.0.0",
"once": "^1.4.0"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/@octokit/rest": {
"version": "19.0.5",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-19.0.5.tgz",
"integrity": "sha512-+4qdrUFq2lk7Va+Qff3ofREQWGBeoTKNqlJO+FGjFP35ZahP+nBenhZiGdu8USSgmq4Ky3IJ/i4u0xbLqHaeow==",
"dependencies": {
"@octokit/core": "^4.1.0",
"@octokit/plugin-paginate-rest": "^5.0.0",
"@octokit/plugin-request-log": "^1.0.4",
"@octokit/plugin-rest-endpoint-methods": "^6.7.0"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/@octokit/types": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-8.0.0.tgz",
"integrity": "sha512-65/TPpOJP1i3K4lBJMnWqPUJ6zuOtzhtagDvydAWbEXpbFYA0oMKKyLb95NFZZP0lSh/4b6K+DQlzvYQJQQePg==",
"dependencies": {
"@octokit/openapi-types": "^14.0.0"
}
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"node_modules/before-after-hook": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="
},
"node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
},
"node_modules/deprecation": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
"integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="
},
"node_modules/is-plain-object": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/node-fetch": {
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": {
"node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
}
},
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dependencies": {
"wrappy": "1"
}
},
"node_modules/tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
},
"node_modules/tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
"engines": {
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
}
},
"node_modules/universal-user-agent": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
"integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w=="
},
"node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
},
"node_modules/whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"dependencies": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
}
},
"dependencies": {
"@actions/core": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
"requires": {
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
}
},
"@actions/glob": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.3.0.tgz",
"integrity": "sha512-tJP1ZhF87fd6LBnaXWlahkyvdgvsLl7WnreW1EZaC8JWjpMXmzqWzQVe/IEYslrkT9ymibVrKyJN4UMD7uQM2w==",
"requires": {
"@actions/core": "^1.2.6",
"minimatch": "^3.0.4"
}
},
"@actions/http-client": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
"requires": {
"tunnel": "^0.0.6"
}
},
"@octokit/auth-token": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-3.0.2.tgz",
"integrity": "sha512-pq7CwIMV1kmzkFTimdwjAINCXKTajZErLB4wMLYapR2nuB/Jpr66+05wOTZMSCBXP6n4DdDWT2W19Bm17vU69Q==",
"requires": {
"@octokit/types": "^8.0.0"
}
},
"@octokit/core": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-4.1.0.tgz",
"integrity": "sha512-Czz/59VefU+kKDy+ZfDwtOIYIkFjExOKf+HA92aiTZJ6EfWpFzYQWw0l54ji8bVmyhc+mGaLUbSUmXazG7z5OQ==",
"requires": {
"@octokit/auth-token": "^3.0.0",
"@octokit/graphql": "^5.0.0",
"@octokit/request": "^6.0.0",
"@octokit/request-error": "^3.0.0",
"@octokit/types": "^8.0.0",
"before-after-hook": "^2.2.0",
"universal-user-agent": "^6.0.0"
}
},
"@octokit/endpoint": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-7.0.3.tgz",
"integrity": "sha512-57gRlb28bwTsdNXq+O3JTQ7ERmBTuik9+LelgcLIVfYwf235VHbN9QNo4kXExtp/h8T423cR5iJThKtFYxC7Lw==",
"requires": {
"@octokit/types": "^8.0.0",
"is-plain-object": "^5.0.0",
"universal-user-agent": "^6.0.0"
}
},
"@octokit/graphql": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.4.tgz",
"integrity": "sha512-amO1M5QUQgYQo09aStR/XO7KAl13xpigcy/kI8/N1PnZYSS69fgte+xA4+c2DISKqUZfsh0wwjc2FaCt99L41A==",
"requires": {
"@octokit/request": "^6.0.0",
"@octokit/types": "^8.0.0",
"universal-user-agent": "^6.0.0"
}
},
"@octokit/openapi-types": {
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-14.0.0.tgz",
"integrity": "sha512-HNWisMYlR8VCnNurDU6os2ikx0s0VyEjDYHNS/h4cgb8DeOxQ0n72HyinUtdDVxJhFy3FWLGl0DJhfEWk3P5Iw=="
},
"@octokit/plugin-paginate-rest": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-5.0.1.tgz",
"integrity": "sha512-7A+rEkS70pH36Z6JivSlR7Zqepz3KVucEFVDnSrgHXzG7WLAzYwcHZbKdfTXHwuTHbkT1vKvz7dHl1+HNf6Qyw==",
"requires": {
"@octokit/types": "^8.0.0"
}
},
"@octokit/plugin-request-log": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz",
"integrity": "sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==",
"requires": {}
},
"@octokit/plugin-rest-endpoint-methods": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-6.7.0.tgz",
"integrity": "sha512-orxQ0fAHA7IpYhG2flD2AygztPlGYNAdlzYz8yrD8NDgelPfOYoRPROfEyIe035PlxvbYrgkfUZIhSBKju/Cvw==",
"requires": {
"@octokit/types": "^8.0.0",
"deprecation": "^2.3.1"
}
},
"@octokit/request": {
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-6.2.2.tgz",
"integrity": "sha512-6VDqgj0HMc2FUX2awIs+sM6OwLgwHvAi4KCK3mT2H2IKRt6oH9d0fej5LluF5mck1lRR/rFWN0YIDSYXYSylbw==",
"requires": {
"@octokit/endpoint": "^7.0.0",
"@octokit/request-error": "^3.0.0",
"@octokit/types": "^8.0.0",
"is-plain-object": "^5.0.0",
"node-fetch": "^2.6.7",
"universal-user-agent": "^6.0.0"
}
},
"@octokit/request-error": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-3.0.2.tgz",
"integrity": "sha512-WMNOFYrSaX8zXWoJg9u/pKgWPo94JXilMLb2VManNOby9EZxrQaBe/QSC4a1TzpAlpxofg2X/jMnCyZgL6y7eg==",
"requires": {
"@octokit/types": "^8.0.0",
"deprecation": "^2.0.0",
"once": "^1.4.0"
}
},
"@octokit/rest": {
"version": "19.0.5",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-19.0.5.tgz",
"integrity": "sha512-+4qdrUFq2lk7Va+Qff3ofREQWGBeoTKNqlJO+FGjFP35ZahP+nBenhZiGdu8USSgmq4Ky3IJ/i4u0xbLqHaeow==",
"requires": {
"@octokit/core": "^4.1.0",
"@octokit/plugin-paginate-rest": "^5.0.0",
"@octokit/plugin-request-log": "^1.0.4",
"@octokit/plugin-rest-endpoint-methods": "^6.7.0"
}
},
"@octokit/types": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-8.0.0.tgz",
"integrity": "sha512-65/TPpOJP1i3K4lBJMnWqPUJ6zuOtzhtagDvydAWbEXpbFYA0oMKKyLb95NFZZP0lSh/4b6K+DQlzvYQJQQePg==",
"requires": {
"@octokit/openapi-types": "^14.0.0"
}
},
"balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"before-after-hook": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
},
"deprecation": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
"integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="
},
"is-plain-object": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
},
"minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"requires": {
"brace-expansion": "^1.1.7"
}
},
"node-fetch": {
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"requires": {
"whatwg-url": "^5.0.0"
}
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"requires": {
"wrappy": "1"
}
},
"tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
},
"tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="
},
"universal-user-agent": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
"integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w=="
},
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
},
"webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
},
"whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"requires": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
}
}
}

View File

@@ -0,0 +1,15 @@
{
"name": "upload-release-assets",
"version": "1.0.0",
"description": "Upload Filament release assets",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Google",
"license": "Apache-2.0",
"dependencies": {
"@actions/glob": "^0.3.0",
"@octokit/rest": "^19.0.5"
}
}

View File

@@ -1,7 +1,7 @@
#!/bin/bash
# version of clang we want to use
GITHUB_CLANG_VERSION=8
GITHUB_CLANG_VERSION=14
# version of CMake to use instead of the default one
CMAKE_VERSION=3.19.5
# version of ninja to use

Some files were not shown because too many files have changed in this diff Show More