Compare commits

..

12 Commits

Author SHA1 Message Date
Powei Feng
3ee82dc43f DRAFT testing mdbook installation 2025-07-16 15:55:24 -07:00
Ben Doherty
33da5fa38e Add documentation and flags for generating code coverage report (#8959) 2025-07-16 15:14:08 -07:00
Powei Feng
d136d85402 renderdiff: fix compare.py 2025-07-16 15:03:44 -07:00
Ben Doherty
a44f6d9498 Update renderdiff README.md (#8961) 2025-07-16 14:56:20 -07:00
Powei Feng
b5aeee3dfd renderdiff: upload artifact even when comparison fails (#8960)
Previously, if a comparison fails then the artifacts are not
uploaded.  This is defeats the puprpose of having artifacts. We
fix that by moving the test logic into presubmit.yml.

local_test.sh is the way to repro a run from local machine.
2025-07-16 14:45:51 -07:00
Sungun Park
d5ee54ff7e gl: Move program cache retrieval to the thread pool (#8957)
This commit refactors the ShaderCompilerService to move the logic for
retrieving compiled programs from the cache off the main thread and into
the compiler thread pool.

Previously, the cache lookup was performed on the main thread before a
compilation job was created. If the cache was slow or contained a large
number of entries, this could cause a noticeable stall, impacting
application responsiveness.

By moving the cache retrieval into the compilation task, the lookup now
happens on the background thread. This alleviates the main thread stall.

BUGS=[430628799]
2025-07-16 00:59:03 +00:00
rafadevai
cfd75743a2 vk: Fix pipeline binds (#8952)
When flushing a VulkanCommandBufffer the last bound pipeline in VulkanPipelineCache is not reset, so when starting a new VulkanCommandBuffer recording if the next binded pipeline is the same as the current one the vkCmdBindPipeline is not recorded, causing undefined behavior.

By the spec, the vkCmdBindPipeline only affects the commands in the same vkCommandBuffer. https://registry.khronos.org/vulkan/specs/latest/man/html/vkCmdBindPipeline.html#_description

BUGS=429105603,361822355
2025-07-15 22:56:10 +00:00
Mathias Agopian
6fd4f94418 better UBO invalidation
Only invalidate UBOs when the data actually changes. It turns out it's
a fairly common case for application to update MaterialInstance
parameters with the same value; we now check for this before
marking the UBO "dirty".

The overhead of this check should be very small but it could save
many very expensive buffer updates.
2025-07-15 11:24:01 -07:00
Mathias Agopian
e155fad7ef better UBO invalidation
Only invalidate UBOs when the data actually changes. It turns out it's
a fairly common case for application to update MaterialInstance
parameters with the same value; we now check for this before
marking the UBO "dirty".

The overhead of this check should be very small but it could save
many very expensive buffer updates.
2025-07-15 11:24:01 -07:00
Mathias Agopian
3683f94704 move postfx materials into their own cpp
eventually, we'll move postfx materials into their own .a and we'll
have a way to manually register them.
2025-07-15 11:23:36 -07:00
Mathias Agopian
34e2b81855 internal materials are now generated in different resources
instead of using a single resource binary for all materials, each
postfx set of materials (e.g. dof, bloom) gets its own resource file
based on the directory it is in.
2025-07-15 11:23:36 -07:00
Mathias Agopian
edebd8eed8 fix typo missing MaterialInstance::getParameter<mat4f>() 2025-07-15 11:16:25 -07:00
47 changed files with 1172 additions and 269 deletions

View File

@@ -130,13 +130,30 @@ jobs:
run: |
bash build/common/get-mesa.sh
pip install tifffile numpy
- name: Run Test
- name: Render
run: |
echo "${{ steps.get_commit_msg.outputs.msg }}" | bash test/renderdiff/test.sh
TEST_DIR=test/renderdiff
source ${TEST_DIR}/src/preamble.sh
start_
GOLDEN_BRANCH=$(echo "${{ steps.get_commit_msg.outputs.msg }}" | python3 ${TEST_DIR}/src/commit_msg.py)
bash ${TEST_DIR}/generate.sh && \
python3 ${TEST_DIR}/src/golden_manager.py \
--branch=${GOLDEN_BRANCH} \
--output=${GOLDEN_OUTPUT_DIR}
# Note that we need to upload the output even if comparison fails
- uses: actions/upload-artifact@v4
with:
name: presubmit-renderdiff-result
path: ./out/renderdiff
- name: Compare output
run: |
TEST_DIR=test/renderdiff
source ${TEST_DIR}/src/preamble.sh
python3 ${TEST_DIR}/src/compare.py \
--src=${GOLDEN_OUTPUT_DIR} \
--dest=${RENDER_OUTPUT_DIR} \
--out=${DIFF_OUTPUT_DIR}
end_
validate-wgsl-webgpu:
name: validate-wgsl-webgpu
@@ -171,3 +188,17 @@ jobs:
./build.sh -p desktop debug gltf_viewer
- name: Run test
run: bash test/code-correctness/test.sh
test-mdbook:
name: test-mdbook
runs-on: 'ubuntu-24.04-4core'
steps:
- uses: actions/checkout@v4.1.6
with:
fetch-depth: 0
- uses: ./.github/actions/linux-prereq
- name: Run build script
run: |
bash docs_src/build/install_mdbook.sh && source ~/.bashrc
mdbook --version

View File

@@ -41,6 +41,8 @@ option(FILAMENT_ENABLE_ASAN_UBSAN "Enable Address and Undefined Behavior Sanitiz
option(FILAMENT_ENABLE_TSAN "Enable Thread Sanitizer" OFF)
option(FILAMENT_ENABLE_COVERAGE "Enable LLVM code coverage" OFF)
option(FILAMENT_ENABLE_FEATURE_LEVEL_0 "Enable Feature Level 0" ON)
option(FILAMENT_ENABLE_MULTIVIEW "Enable multiview for Filament" OFF)
@@ -460,6 +462,10 @@ if (NOT MSVC AND NOT WEBGL)
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${EXTRA_SANITIZE_OPTIONS}")
if (FILAMENT_ENABLE_COVERAGE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-instr-generate -fcoverage-mapping")
endif()
# Disable the stack check for macOS to workaround a known issue in clang 11.0.0.
# See: https://forums.developer.apple.com/thread/121887
if (APPLE)

View File

@@ -31,7 +31,7 @@ repositories {
}
dependencies {
implementation 'com.google.android.filament:filament-android:1.62.2'
implementation 'com.google.android.filament:filament-android:1.62.1'
}
```
@@ -51,7 +51,7 @@ Here are all the libraries available in the group `com.google.android.filament`:
iOS projects can use CocoaPods to install the latest release:
```shell
pod 'Filament', '~> 1.62.2'
pod 'Filament', '~> 1.62.1'
```
## Documentation

View File

@@ -1,5 +1,5 @@
GROUP=com.google.android.filament
VERSION_NAME=1.62.2
VERSION_NAME=1.62.1
POM_DESCRIPTION=Real-time physically based rendering engine for Android.

View File

@@ -63,6 +63,9 @@ function print_help {
echo " -b"
echo " Enable Address and Undefined Behavior Sanitizers (asan/ubsan) for debugging."
echo " This is only for the desktop build."
echo " -V"
echo " Enable LLVM code coverage for debug builds."
echo " This is only for the desktop build."
echo " -x value"
echo " Define a preprocessor flag FILAMENT_BACKEND_DEBUG_FLAG with [value]. This is useful for"
echo " enabling debug paths in the backend from the build script. For example, make a"
@@ -208,6 +211,7 @@ MATOPT_OPTION=""
MATOPT_GRADLE_OPTION=""
ASAN_UBSAN_OPTION=""
COVERAGE_OPTION=""
BACKEND_DEBUG_FLAG_OPTION=""
@@ -275,6 +279,7 @@ function build_desktop_target {
${MATDBG_OPTION} \
${MATOPT_OPTION} \
${ASAN_UBSAN_OPTION} \
${COVERAGE_OPTION} \
${BACKEND_DEBUG_FLAG_OPTION} \
${STEREOSCOPIC_OPTION} \
${OSMESA_OPTION} \
@@ -835,7 +840,7 @@ function check_debug_release_build {
pushd "$(dirname "$0")" > /dev/null
while getopts ":hacCfgimp:q:uvWslwedtk:bx:S:X:" opt; do
while getopts ":hacCfgimp:q:uvWslwedtk:bVx:S:X:" opt; do
case ${opt} in
h)
print_help
@@ -983,6 +988,9 @@ while getopts ":hacCfgimp:q:uvWslwedtk:bx:S:X:" opt; do
b) ASAN_UBSAN_OPTION="-DFILAMENT_ENABLE_ASAN_UBSAN=ON"
echo "Enabled ASAN/UBSAN"
;;
V) COVERAGE_OPTION="-DFILAMENT_ENABLE_COVERAGE=ON"
echo "Enabled coverage"
;;
x) BACKEND_DEBUG_FLAG_OPTION="-DFILAMENT_BACKEND_DEBUG_FLAG=${OPTARG}"
;;
S) case $(echo "${OPTARG}" | tr '[:upper:]' '[:lower:]') in

View File

@@ -21,7 +21,7 @@ LINUX_ARM=4
function add_cargo_path() {
local BASH_P="${HOME}/.bashrc"
local PATH_LINE='export PATH=${PATH}:~/.cargo/bin'
local PATH_LINE='export PATH=${PATH}:${HOME}/.cargo/bin'
local TYPE=$1
if [ ${TYPE} == ${DARWIN_ARM} ] || [ ${TYPE} == ${DARWIN_X86} ]; then
BASH_P="${HOME}/.bash_profile"
@@ -77,10 +77,10 @@ print(get_type())
if [ ${TYPE} == ${LINUX_X86} ]; then
DL_URL='https://github.com/rust-lang/mdBook/releases/download/v0.4.43/mdbook-v0.4.43-x86_64-unknown-linux-gnu.tar.gz'
fi
curl -L -o ~/Downloads/mdbook.tar.gz ${DL_URL}
curl -L -o /tmp/mdbook.tar.gz ${DL_URL}
mkdir -p /tmp/mdbook
tar -xvzf ~/Downloads/mdbook.tar.gz -C /tmp/mdbook >/dev/null 2>&1
mv /tmp/mdbook/mdbook ~/.cargo/bin/
tar -xvzf /tmp/mdbook.tar.gz -C /tmp/mdbook >/dev/null 2>&1
mv /tmp/mdbook/mdbook ${HOME}/.cargo/bin/
fi
add_cargo_path ${TYPE}
}

View File

@@ -0,0 +1,114 @@
# Generating Backend Code Coverage
Code coverage analysis helps visualize which parts of the backend are exercised by backend tests.
This guide outlines the process for generating an HTML coverage report for Filament's backend on
macOS.
## 1\. Prerequisites: Install Clang and LLVM tools
You'll need a recent version of **Clang** and its corresponding **LLVM tools** for code coverage.
You can install these using Homebrew or MacPorts.
### Using Homebrew
Install the `llvm` package:
```bash
brew install llvm
```
This typically installs the tools in a location like `/usr/local/opt/llvm/bin`. You may need to add
this to your `PATH` environment variable.
### Using MacPorts
Install a specific version of Clang (e.g., version 18):
```bash
sudo port install clang-18
```
MacPorts often adds version suffixes to the tool names (e.g., `llvm-cov-mp-18`).
### Required Tools
Ensure you can locate the following tools from your installation:
* `clang` and `clang++` (The C/C++ compilers)
* `llvm-profdata` (For merging coverage data)
* `llvm-cov` (For generating reports)
The rest of this guide assumes your tools are in your `PATH`. If not, you'll need to use the full
path to each executable.
## 2\. Build Filament with Coverage Enabled
Compile the `backend_test_mac` target with coverage instrumentation. This is done by setting the
`CC` and `CXX` environment variables to point to your Clang compiler and using the `-V` flag in the
build script.
```bash
CC=clang CXX=clang++ ./build.sh -V -p desktop debug backend_test_mac
```
*If your Clang executables aren't in your `PATH` or have version suffixes, provide the full name or
path (e.g., `CC=/opt/local/bin/clang CXX=/opt/local/bin/clang++`).*
## 3\. Run the Backend Tests
Running the test suite will generate the raw coverage data needed for the report.
1. Navigate to the build output directory:
```bash
cd out/cmake-debug/filament/backend
```
2. Run the tests for a specific backend (e.g., Metal):
```bash
./backend_test_mac --api metal
```
This command creates a `default.profraw` file in the current directory, which contains the raw
execution profile data.
## 4\. Generate the Coverage Report
Finally, process the raw data and generate an HTML report.
1. **Merge the raw profile data** into a single file using `llvm-profdata`.
```bash
llvm-profdata merge -sparse default.profraw -o filament.profdata
```
*Remember to use the version-specific tool name if required (e.g., `llvm-profdata-mp-18`).*
2. **Generate the HTML report** using `llvm-cov`. This command creates a report for the entire
`backend_test_mac` executable.
```bash
llvm-cov show ./backend_test_mac \
-instr-profile=filament.profdata \
-format=html \
-show-line-counts-or-regions > coverage.html
```
*To view coverage for a **specific source file**, add its path at the end of the command:*
```bash
llvm-cov show ./backend_test_mac \
-instr-profile=filament.profdata \
-format=html \
-show-line-counts-or-regions \
-- ../../../../filament/backend/src/metal/MetalDriver.mm > coverage.html
```
3. **Open the report** in your browser:
```bash
open coverage.html
```
In the report, code paths that were not executed during the test run will be highlighted in red.

View File

@@ -50,6 +50,15 @@ set(PUBLIC_HDRS
)
set(SRCS
src/materials/antiAliasing/fxaa/fxaa.cpp
src/materials/antiAliasing/taa/taa.cpp
src/materials/bloom/bloom.cpp
src/materials/colorGrading/colorGrading.cpp
src/materials/dof/dof.cpp
src/materials/flare/flare.cpp
src/materials/fsr/fsr.cpp
src/materials/sgsr/sgsr.cpp
src/materials/ssao/ssao.cpp
src/AtlasAllocator.cpp
src/BufferObject.cpp
src/Camera.cpp
@@ -143,6 +152,7 @@ set(SRCS
)
set(PRIVATE_HDRS
src/materials/StaticMaterialInfo.h
src/Allocators.h
src/Bimap.h
src/BufferPoolAllocator.h
@@ -224,8 +234,8 @@ set(PRIVATE_HDRS
)
set(MATERIAL_SRCS
src/materials/antiAliasing/fxaa.mat
src/materials/antiAliasing/taa.mat
src/materials/antiAliasing/fxaa/fxaa.mat
src/materials/antiAliasing/taa/taa.mat
src/materials/blitDepth.mat
src/materials/blitLow.mat
src/materials/blitArray.mat
@@ -282,11 +292,6 @@ set(MATERIAL_MULTIVIEW_SRCS
src/materials/skybox.mat
)
# Embed the binary resource blob for materials.
get_resgen_vars(${RESOURCE_DIR} materials)
list(APPEND PRIVATE_HDRS ${RESGEN_HEADER})
list(APPEND SRCS ${RESGEN_SOURCE})
# ==================================================================================================
# Configuration
# ==================================================================================================
@@ -346,48 +351,93 @@ if (CMAKE_CROSSCOMPILING)
include(${IMPORT_EXECUTABLES})
endif()
set(MATERIAL_BINS)
file(MAKE_DIRECTORY ${MATERIAL_DIR})
file(MAKE_DIRECTORY ${RESOURCE_DIR})
foreach (mat_src ${MATERIAL_SRCS})
get_filename_component(localname "${mat_src}" NAME_WE)
get_filename_component(fullname "${mat_src}" ABSOLUTE)
set(output_path "${MATERIAL_DIR}/${localname}.filamat")
set(GENERATED_RESOURCE_HDRS)
set(GENERATED_RESOURCE_SRCS)
# Get all unique directories containing materials
set(MATERIAL_DIRS)
foreach(mat_src ${MATERIAL_SRCS})
get_filename_component(mat_dir ${mat_src} DIRECTORY)
list(APPEND MATERIAL_DIRS ${mat_dir})
endforeach()
list(REMOVE_DUPLICATES MATERIAL_DIRS)
# For each directory, generate a single resource package
foreach(mat_dir ${MATERIAL_DIRS})
get_filename_component(package_name ${mat_dir} NAME)
set(MATERIALS_IN_DIR)
foreach(mat_src ${MATERIAL_SRCS})
get_filename_component(current_mat_dir ${mat_src} DIRECTORY)
if(current_mat_dir STREQUAL mat_dir)
list(APPEND MATERIALS_IN_DIR ${mat_src})
endif()
endforeach()
set(FILAMAT_FILES_FOR_GROUP)
set(FILAMAT_TARGETS_FOR_GROUP)
# Compile each material in the group
foreach(mat_src ${MATERIALS_IN_DIR})
get_filename_component(localname "${mat_src}" NAME_WE)
get_filename_component(fullname "${mat_src}" ABSOLUTE)
# --- Base material ---
set(output_path "${MATERIAL_DIR}/${localname}.filamat")
add_custom_command(
OUTPUT ${output_path}
COMMAND matc ${MATC_BASE_FLAGS} -o ${output_path} ${fullname}
MAIN_DEPENDENCY ${fullname}
DEPENDS matc
COMMENT "Compiling material ${fullname}"
)
list(APPEND FILAMAT_FILES_FOR_GROUP ${output_path})
list(APPEND FILAMAT_TARGETS_FOR_GROUP ${output_path})
# --- Feature Level 0 variant ---
list(FIND MATERIAL_FL0_SRCS ${mat_src} index)
if (${index} GREATER -1 AND FILAMENT_ENABLE_FEATURE_LEVEL_0)
string(REGEX REPLACE "[.]filamat$" "_fl0.filamat" output_path_fl0 ${output_path})
add_custom_command(
OUTPUT ${output_path_fl0}
COMMAND matc ${MATC_BASE_FLAGS} -PfeatureLevel=0 -o ${output_path_fl0} ${fullname}
MAIN_DEPENDENCY ${fullname}
DEPENDS matc
COMMENT "Compiling material ${fullname} (FL0)"
)
list(APPEND FILAMAT_FILES_FOR_GROUP ${output_path_fl0})
list(APPEND FILAMAT_TARGETS_FOR_GROUP ${output_path_fl0})
endif()
# --- Multiview variant ---
list(FIND MATERIAL_MULTIVIEW_SRCS ${mat_src} index)
if (${index} GREATER -1 AND FILAMENT_ENABLE_MULTIVIEW)
string(REGEX REPLACE "[.]filamat$" "_multiview.filamat" output_path_multiview ${output_path})
add_custom_command(
OUTPUT ${output_path_multiview}
COMMAND matc ${MATC_BASE_FLAGS} -PstereoscopicType=multiview -o ${output_path_multiview} ${fullname}
MAIN_DEPENDENCY ${fullname}
DEPENDS matc
COMMENT "Compiling material ${fullname} (Multiview)"
)
list(APPEND FILAMAT_FILES_FOR_GROUP ${output_path_multiview})
list(APPEND FILAMAT_TARGETS_FOR_GROUP ${output_path_multiview})
endif()
endforeach()
# Generate a single resource file for the whole group
get_resgen_vars(${RESOURCE_DIR} ${package_name})
add_custom_command(
OUTPUT ${output_path}
COMMAND matc ${MATC_BASE_FLAGS} -o ${output_path} ${fullname}
MAIN_DEPENDENCY ${fullname}
DEPENDS matc
COMMENT "Compiling material ${fullname} to ${output_path}"
OUTPUT ${RESGEN_OUTPUTS}
COMMAND resgen ${RESGEN_FLAGS} ${FILAMAT_FILES_FOR_GROUP}
DEPENDS resgen ${FILAMAT_TARGETS_FOR_GROUP}
COMMENT "Generating resource package for ${package_name}"
)
list(APPEND MATERIAL_BINS ${output_path})
list(FIND MATERIAL_FL0_SRCS ${mat_src} index)
if (${index} GREATER -1 AND FILAMENT_ENABLE_FEATURE_LEVEL_0)
string(REGEX REPLACE "[.]filamat$" "_fl0.filamat" output_path_fl0 ${output_path})
add_custom_command(
OUTPUT ${output_path_fl0}
COMMAND matc ${MATC_BASE_FLAGS} -PfeatureLevel=0 -o ${output_path_fl0} ${fullname}
MAIN_DEPENDENCY ${fullname}
DEPENDS matc
COMMENT "Compiling material ${fullname} to ${output_path_fl0}"
)
list(APPEND MATERIAL_BINS ${output_path_fl0})
endif ()
list(FIND MATERIAL_MULTIVIEW_SRCS ${mat_src} index)
if (${index} GREATER -1 AND FILAMENT_ENABLE_MULTIVIEW)
string(REGEX REPLACE "[.]filamat$" "_multiview.filamat" output_path_multiview ${output_path})
add_custom_command(
OUTPUT ${output_path_multiview}
COMMAND matc ${MATC_BASE_FLAGS} -PstereoscopicType=multiview -o ${output_path_multiview} ${fullname}
MAIN_DEPENDENCY ${fullname}
DEPENDS matc
COMMENT "Compiling material ${fullname} to ${output_path_multiview}"
)
list(APPEND MATERIAL_BINS ${output_path_multiview})
endif ()
list(APPEND GENERATED_RESOURCE_HDRS ${RESGEN_HEADER})
list(APPEND GENERATED_RESOURCE_SRCS ${RESGEN_SOURCE})
endforeach()
# Additional dependencies on included files for materials
@@ -410,7 +460,7 @@ add_custom_command(
add_custom_command(
OUTPUT "${MATERIAL_DIR}/fxaa.filamat"
DEPENDS src/materials/antiAliasing/fxaa.fs
DEPENDS src/materials/antiAliasing/fxaa/fxaa.fs
APPEND
)
@@ -551,15 +601,12 @@ add_custom_command(
APPEND
)
add_custom_command(
OUTPUT ${RESGEN_OUTPUTS}
COMMAND resgen ${RESGEN_FLAGS} ${MATERIAL_BINS}
DEPENDS resgen ${MATERIAL_BINS}
COMMENT "Aggregating compiled materials"
)
# Add the generated resource files to the source and header lists.
list(APPEND PRIVATE_HDRS ${GENERATED_RESOURCE_HDRS})
list(APPEND SRCS ${GENERATED_RESOURCE_SRCS})
if (DEFINED RESGEN_SOURCE_FLAGS)
set_source_files_properties(${RESGEN_SOURCE} PROPERTIES COMPILE_FLAGS ${RESGEN_SOURCE_FLAGS})
set_source_files_properties(${GENERATED_RESOURCE_SRCS} PROPERTIES COMPILE_FLAGS ${RESGEN_SOURCE_FLAGS})
endif()
file(MAKE_DIRECTORY "${GENERATION_ROOT}/generated/data/")

View File

@@ -262,22 +262,20 @@ ShaderCompilerService::program_token_t ShaderCompilerService::createProgram(
token->attributes = std::move(program.getAttributes());
}
// Try retrieving the cached program blob if available.
token->gl.program = mBlobCache.retrieve(&token->key, mDriver.mPlatform, program);
if (token->gl.program) {
token->retrievedFromBlobCache = true;
return token;
}
// Initiate program compilation.
CompilerPriorityQueue const priorityQueue = program.getPriorityQueue();
switch (mMode) {
case Mode::THREAD_POOL: {
mCompilerThreadPool.queue(priorityQueue, token,
[this, &gl, program = std::move(program), token]() mutable {
compileShaders(gl, std::move(program.getShadersSource()),
program.getSpecializationConstants(), program.isMultiview(), token);
linkProgram(gl, token);
// Try retrieving the program from the cache first. If no program found,
// a normal compilation/linking process is performed.
if (!tryRetrievingProgram(mBlobCache, mDriver.mPlatform, program, token)) {
compileShaders(gl, std::move(program.getShadersSource()),
program.getSpecializationConstants(), program.isMultiview(),
token);
linkProgram(gl, token);
}
// Now `token->gl.program` must be populated, so we signal the completion
// of the linking. We don't need to check the result of the program here
// because it'll be done in the engine thread.
@@ -292,29 +290,33 @@ ShaderCompilerService::program_token_t ShaderCompilerService::createProgram(
case Mode::SYNCHRONOUS:
case Mode::ASYNCHRONOUS: {
compileShaders(gl, std::move(program.getShadersSource()),
program.getSpecializationConstants(), program.isMultiview(), token);
// Try retrieving the program from the cache first. If no program found,
// a normal compilation/linking process is performed.
if (!tryRetrievingProgram(mBlobCache, mDriver.mPlatform, program, token)) {
compileShaders(gl, std::move(program.getShadersSource()),
program.getSpecializationConstants(), program.isMultiview(), token);
runAtNextTick(priorityQueue, token, [this, token](Job const&) {
assert_invariant(mMode != Mode::THREAD_POOL);
if (mMode == Mode::ASYNCHRONOUS) {
// Check link completion if link was initiated.
if (token->gl.program) {
return isLinkCompleted(token);
}
// Link hasn't been initiated, then check compile completion.
if (!isCompileCompleted(token)) {
return false;
}
}
if (!token->gl.program) {
linkProgram(mDriver.getContext(), token);
runAtNextTick(priorityQueue, token, [this, token](Job const&) {
assert_invariant(mMode != Mode::THREAD_POOL);
if (mMode == Mode::ASYNCHRONOUS) {
return false;// Wait until the link finishes.
// Check link completion if link was initiated.
if (token->gl.program) {
return isLinkCompleted(token);
}
// Link hasn't been initiated, then check compile completion.
if (!isCompileCompleted(token)) {
return false;
}
}
}
return true;
});
if (!token->gl.program) {
linkProgram(mDriver.getContext(), token);
if (mMode == Mode::ASYNCHRONOUS) {
return false; // Wait until the link finishes.
}
}
return true;
});
}
break;
}
@@ -345,14 +347,12 @@ GLuint ShaderCompilerService::getProgram(program_token_t& token) {
assert_invariant(token);// This function should be called when the token is still alive.
// Finalize any pending shader compilation tasks only when the token was created without cache.
if (!token->retrievedFromBlobCache) {
if (token->compiler.mMode == Mode::THREAD_POOL) {
auto const job = token->compiler.mCompilerThreadPool.dequeue(token);
if (!job) {
// It's likely that the job was already completed. But it may be still being
// executed at this moment. Just try waiting for it to avoid a race.
token->wait();
}
if (token->compiler.mMode == Mode::THREAD_POOL) {
auto const job = token->compiler.mCompilerThreadPool.dequeue(token);
if (!job) {
// It's likely that the job was already completed. But it may be still being
// executed at this moment. Just try waiting for it to avoid a race.
token->wait();
}
}
@@ -722,11 +722,24 @@ void ShaderCompilerService::executeTickOps() noexcept {
return linked;
}
/* static */ bool ShaderCompilerService::tryRetrievingProgram(OpenGLBlobCache& cache,
OpenGLPlatform& platform, Program const& program, program_token_t const& token) noexcept {
token->gl.program = cache.retrieve(&token->key, platform, program);
if (!token->gl.program) {
return false;
}
token->retrievedFromBlobCache = true;
return true;
}
/* static */ void ShaderCompilerService::tryCachingProgram(OpenGLBlobCache& cache,
OpenGLPlatform& platform, program_token_t const& token) noexcept {
if (!token->key || !token->gl.program) {
return; // Invalid params
}
if (token->retrievedFromBlobCache) {
return; // Don't store in the cache if it's loaded from the cache.
}
GLint status = GL_FALSE;
glGetProgramiv(token->gl.program, GL_LINK_STATUS, &status);
if (status == GL_FALSE) {

View File

@@ -171,6 +171,10 @@ private:
// Also cleanup shaders regardless of the result.
static bool checkLinkStatusAndCleanupShaders(program_token_t const& token) noexcept;
// Try retrieving the program from the cache. Return `true` if it's loaded from the cache.
static bool tryRetrievingProgram(OpenGLBlobCache& cache, OpenGLPlatform& platform,
Program const& program, program_token_t const& token) noexcept;
// Try caching the program if we haven't done it yet. Cache it only when the program is valid.
static void tryCachingProgram(OpenGLBlobCache& cache, OpenGLPlatform& platform,
program_token_t const& token) noexcept;

View File

@@ -422,7 +422,7 @@ void VulkanDriver::setPresentationTime(int64_t monotonic_clock_ns) {
void VulkanDriver::endFrame(uint32_t frameId) {
FVK_PROFILE_MARKER(PROFILE_NAME_ENDFRAME);
mCommands.flush();
endCommandRecording();
collectGarbage();
}
@@ -462,13 +462,13 @@ void VulkanDriver::updateDescriptorSetTexture(
void VulkanDriver::flush(int) {
FVK_SYSTRACE_SCOPE();
mCommands.flush();
endCommandRecording();
}
void VulkanDriver::finish(int dummy) {
FVK_SYSTRACE_SCOPE();
mCommands.flush();
endCommandRecording();
mCommands.wait();
mReadPixels.runUntilComplete();
@@ -1635,7 +1635,7 @@ void VulkanDriver::stopCapture(int) {}
void VulkanDriver::readPixels(Handle<HwRenderTarget> src, uint32_t x, uint32_t y, uint32_t width,
uint32_t height, PixelBufferDescriptor&& pbd) {
auto srcTarget = resource_ptr<VulkanRenderTarget>::cast(&mResourceManager, src);
mCommands.flush();
endCommandRecording();
mReadPixels.run(
srcTarget, x, y, width, height, mPlatform->getGraphicsQueueFamilyIndex(),
std::move(pbd),
@@ -2058,6 +2058,11 @@ void VulkanDriver::setDebugTag(HandleBase::HandleId handleId, utils::CString tag
mResourceManager.associateHandle(handleId, std::move(tag));
}
void VulkanDriver::endCommandRecording() {
mCommands.flush();
mPipelineCache.resetBoundPipeline();
}
// explicit instantiation of the Dispatcher
template class ConcreteDispatcher<VulkanDriver>;

View File

@@ -125,6 +125,9 @@ private:
void bindPipelineImpl(PipelineState const& pipelineState, VkPipelineLayout pipelineLayout,
fvkutils::DescriptorSetMask descriptorSetMask);
// Flush the current command buffer and reset the pipeline state.
void endCommandRecording();
VulkanPlatform* mPlatform = nullptr;
fvkmemory::ResourceManager mResourceManager;

View File

@@ -273,12 +273,16 @@ void VulkanPipelineCache::bindVertexArray(VkVertexInputAttributeDescription cons
}
}
void VulkanPipelineCache::resetBoundPipeline() {
mBoundPipeline = {};
}
void VulkanPipelineCache::terminate() noexcept {
for (auto& iter : mPipelines) {
vkDestroyPipeline(mDevice, iter.second.handle, VKALLOC);
}
mPipelines.clear();
mBoundPipeline = {};
resetBoundPipeline();
vkDestroyPipelineCache(mDevice, mPipelineCache, VKALLOC);
}
@@ -292,7 +296,7 @@ void VulkanPipelineCache::gc() noexcept {
// The Vulkan spec says: "When a command buffer begins recording, all state in that command
// buffer is undefined." Therefore, we need to clear all bindings at this time.
mBoundPipeline = {};
resetBoundPipeline();
// NOTE: Due to robin_map restrictions, we cannot use auto or range-based loops.

View File

@@ -101,6 +101,9 @@ public:
void bindVertexArray(VkVertexInputAttributeDescription const* attribDesc,
VkVertexInputBindingDescription const* bufferDesc, uint8_t count);
// Set the current bindings for the pipeline and descriptor sets back to empty.
void resetBoundPipeline();
// Destroys all managed Vulkan objects. This should be called before changing the VkDevice.
void terminate() noexcept;
void gc() noexcept;

View File

@@ -228,6 +228,7 @@ template UTILS_PUBLIC uint4 MaterialInstance::getParameter<uint4> (const ch
template UTILS_PUBLIC float2 MaterialInstance::getParameter<float2> (const char* name, size_t nameLength) const;
template UTILS_PUBLIC float3 MaterialInstance::getParameter<float3> (const char* name, size_t nameLength) const;
template UTILS_PUBLIC float4 MaterialInstance::getParameter<float4> (const char* name, size_t nameLength) const;
template UTILS_PUBLIC mat4f MaterialInstance::getParameter<mat4f> (const char* name, size_t nameLength) const;
template UTILS_PUBLIC mat3f MaterialInstance::getParameter<mat3f> (const char* name, size_t nameLength) const;
// ------------------------------------------------------------------------------------------------

View File

@@ -24,6 +24,16 @@
#include "PostProcessManager.h"
#include "materials/antiAliasing/fxaa/fxaa.h"
#include "materials/antiAliasing/taa/taa.h"
#include "materials/bloom/bloom.h"
#include "materials/colorGrading/colorGrading.h"
#include "materials/dof/dof.h"
#include "materials/flare/flare.h"
#include "materials/fsr/fsr.h"
#include "materials/sgsr/sgsr.h"
#include "materials/ssao/ssao.h"
#include "details/Engine.h"
#include "ds/SsrPassDescriptorSet.h"
@@ -272,68 +282,35 @@ PostProcessManager::PostProcessMaterial& PostProcessManager::getPostProcessMater
// we ensure it's trivially destructible
static_assert(std::is_trivially_destructible_v<PostProcessManager::StaticMaterialInfo::ConstantInfo>);
#define MATERIAL(n) MATERIALS_ ## n ## _DATA, size_t(MATERIALS_ ## n ## _SIZE)
#define MATERIAL(p, n) p ## _ ## n ## _DATA, size_t(p ## _ ## n ## _SIZE)
static const PostProcessManager::StaticMaterialInfo sMaterialListFeatureLevel0[] = {
{ "blitLow", MATERIAL(BLITLOW) },
{ "blitLow", MATERIAL(MATERIALS, BLITLOW) },
};
static const PostProcessManager::StaticMaterialInfo sMaterialList[] = {
{ "bilateralBlur", MATERIAL(BILATERALBLUR) },
{ "bilateralBlurBentNormals", MATERIAL(BILATERALBLURBENTNORMALS) },
{ "blitArray", MATERIAL(BLITARRAY) },
{ "blitDepth", MATERIAL(BLITDEPTH) },
{ "bloomDownsample", MATERIAL(BLOOMDOWNSAMPLE) },
{ "bloomDownsample2x", MATERIAL(BLOOMDOWNSAMPLE2X) },
{ "bloomDownsample9", MATERIAL(BLOOMDOWNSAMPLE9) },
{ "bloomUpsample", MATERIAL(BLOOMUPSAMPLE) },
{ "colorGrading", MATERIAL(COLORGRADING) },
{ "colorGradingAsSubpass", MATERIAL(COLORGRADINGASSUBPASS) },
{ "customResolveAsSubpass", MATERIAL(CUSTOMRESOLVEASSUBPASS) },
{ "dof", MATERIAL(DOF) },
{ "dofCoc", MATERIAL(DOFCOC) },
{ "dofCombine", MATERIAL(DOFCOMBINE) },
{ "dofDilate", MATERIAL(DOFDILATE) },
{ "dofDownsample", MATERIAL(DOFDOWNSAMPLE) },
{ "dofMedian", MATERIAL(DOFMEDIAN) },
{ "dofMipmap", MATERIAL(DOFMIPMAP) },
{ "dofTiles", MATERIAL(DOFTILES) },
{ "dofTilesSwizzle", MATERIAL(DOFTILESSWIZZLE) },
{ "flare", MATERIAL(FLARE) },
{ "fxaa", MATERIAL(FXAA) },
{ "mipmapDepth", MATERIAL(MIPMAPDEPTH) },
{ "sao", MATERIAL(SAO) },
{ "saoBentNormals", MATERIAL(SAOBENTNORMALS) },
#ifndef FILAMENT_DISABLE_GTAO
{ "gtao", MATERIAL(GTAO) },
{ "gtaoBentNormals", MATERIAL(GTAOBENTNORMALS) },
#endif
{ "separableGaussianBlur1", MATERIAL(SEPARABLEGAUSSIANBLUR),
{ "blitArray", MATERIAL(MATERIALS, BLITARRAY) },
{ "blitDepth", MATERIAL(MATERIALS, BLITDEPTH) },
{ "separableGaussianBlur1", MATERIAL(MATERIALS, SEPARABLEGAUSSIANBLUR),
{ {"arraySampler", false}, {"componentCount", 1} } },
{ "separableGaussianBlur1L", MATERIAL(SEPARABLEGAUSSIANBLUR),
{ "separableGaussianBlur1L", MATERIAL(MATERIALS, SEPARABLEGAUSSIANBLUR),
{ {"arraySampler", true }, {"componentCount", 1} } },
{ "separableGaussianBlur2", MATERIAL(SEPARABLEGAUSSIANBLUR),
{ "separableGaussianBlur2", MATERIAL(MATERIALS, SEPARABLEGAUSSIANBLUR),
{ {"arraySampler", false}, {"componentCount", 2} } },
{ "separableGaussianBlur2L", MATERIAL(SEPARABLEGAUSSIANBLUR),
{ "separableGaussianBlur2L", MATERIAL(MATERIALS, SEPARABLEGAUSSIANBLUR),
{ {"arraySampler", true }, {"componentCount", 2} } },
{ "separableGaussianBlur3", MATERIAL(SEPARABLEGAUSSIANBLUR),
{ "separableGaussianBlur3", MATERIAL(MATERIALS, SEPARABLEGAUSSIANBLUR),
{ {"arraySampler", false}, {"componentCount", 3} } },
{ "separableGaussianBlur3L", MATERIAL(SEPARABLEGAUSSIANBLUR),
{ "separableGaussianBlur3L", MATERIAL(MATERIALS, SEPARABLEGAUSSIANBLUR),
{ {"arraySampler", true }, {"componentCount", 3} } },
{ "separableGaussianBlur4", MATERIAL(SEPARABLEGAUSSIANBLUR),
{ "separableGaussianBlur4", MATERIAL(MATERIALS, SEPARABLEGAUSSIANBLUR),
{ {"arraySampler", false}, {"componentCount", 4} } },
{ "separableGaussianBlur4L", MATERIAL(SEPARABLEGAUSSIANBLUR),
{ "separableGaussianBlur4L", MATERIAL(MATERIALS, SEPARABLEGAUSSIANBLUR),
{ {"arraySampler", true }, {"componentCount", 4} } },
{ "taa", MATERIAL(TAA) },
{ "vsmMipmap", MATERIAL(VSMMIPMAP) },
{ "fsr_easu", MATERIAL(FSR_EASU) },
{ "fsr_easu_mobile", MATERIAL(FSR_EASU_MOBILE) },
{ "fsr_easu_mobileF", MATERIAL(FSR_EASU_MOBILEF) },
{ "fsr_rcas", MATERIAL(FSR_RCAS) },
{ "sgsr1", MATERIAL(SGSR1) },
{ "debugShadowCascades", MATERIAL(DEBUGSHADOWCASCADES) },
{ "resolveDepth", MATERIAL(RESOLVEDEPTH) },
{ "shadowmap", MATERIAL(SHADOWMAP) },
{ "vsmMipmap", MATERIAL(MATERIALS, VSMMIPMAP) },
{ "debugShadowCascades", MATERIAL(MATERIALS, DEBUGSHADOWCASCADES) },
{ "resolveDepth", MATERIAL(MATERIALS, RESOLVEDEPTH) },
{ "shadowmap", MATERIAL(MATERIALS, SHADOWMAP) },
};
void PostProcessManager::init() noexcept {
@@ -368,6 +345,33 @@ void PostProcessManager::init() noexcept {
for (auto const& info: sMaterialList) {
registerPostProcessMaterial(info.name, info);
}
for (auto const& info: getBloomMaterialList()) {
registerPostProcessMaterial(info.name, info);
}
for (auto const& info: getFlareMaterialList()) {
registerPostProcessMaterial(info.name, info);
}
for (auto const& info: getDofMaterialList()) {
registerPostProcessMaterial(info.name, info);
}
for (auto const& info: getColorGradingMaterialList()) {
registerPostProcessMaterial(info.name, info);
}
for (auto const& info: getFsrMaterialList()) {
registerPostProcessMaterial(info.name, info);
}
for (auto const& info: getSgsrMaterialList()) {
registerPostProcessMaterial(info.name, info);
}
for (auto const& info: getFxaaMaterialList()) {
registerPostProcessMaterial(info.name, info);
}
for (auto const& info: getTaaMaterialList()) {
registerPostProcessMaterial(info.name, info);
}
for (auto const& info: getSsaoMaterialList()) {
registerPostProcessMaterial(info.name, info);
}
}
if (engine.hasFeatureLevel(FeatureLevel::FEATURE_LEVEL_1)) {

View File

@@ -25,7 +25,7 @@
#include "ds/SsrPassDescriptorSet.h"
#include "ds/TypedUniformBuffer.h"
#include <private/filament/Variant.h>
#include "materials/StaticMaterialInfo.h"
#include <fg/FrameGraphId.h>
#include <fg/FrameGraphResources.h>
@@ -48,10 +48,8 @@
#include <tsl/robin_map.h>
#include <array>
#include <initializer_list>
#include <random>
#include <string_view>
#include <variant>
#include <stddef.h>
#include <stdint.h>
@@ -70,20 +68,7 @@ struct CameraInfo;
class PostProcessManager {
public:
// This is intended to be used only to hold the static material data
struct StaticMaterialInfo {
struct ConstantInfo {
std::string_view name;
std::variant<int32_t, float, bool> value;
};
std::string_view name;
uint8_t const* data;
size_t size;
// the life-time of objects pointed to by this initializer_list<> is extended to the
// life-time of the initializer_list
std::initializer_list<ConstantInfo> constants;
};
using StaticMaterialInfo = filament::StaticMaterialInfo;
struct ColorGradingConfig {
bool asSubpass{};

View File

@@ -16,6 +16,17 @@
#include "UniformBuffer.h"
#include <utils/Allocator.h>
#include <utils/compiler.h>
#include <utils/debug.h>
#include <utils/ostream.h>
#include <math/mat3.h>
#include <utility>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
@@ -94,7 +105,11 @@ void UniformBuffer::free(void* addr, size_t) noexcept {
template<size_t Size>
void UniformBuffer::setUniformUntyped(size_t const offset, void const* UTILS_RESTRICT v) noexcept{
setUniformUntyped<Size>(invalidateUniforms(offset, Size), 0ul, v);
if (UTILS_LIKELY(invalidateNeeded<Size>(offset, v))) {
void* const addr = getUniformAddress(offset);
setUniformUntyped<Size>(addr, v);
invalidateUniforms(offset, Size);
}
}
template
@@ -111,11 +126,8 @@ void UniformBuffer::setUniformUntyped<64ul>(size_t offset, void const* UTILS_RES
template<size_t Size>
void UniformBuffer::setUniformArrayUntyped(size_t const offset, void const* UTILS_RESTRICT begin, size_t const count) noexcept {
constexpr size_t stride = (Size + 0xFu) & ~0xFu;
size_t arraySize = stride * count - stride + Size;
void* UTILS_RESTRICT p = invalidateUniforms(offset, arraySize);
for (size_t i = 0; i < count; i++) {
setUniformUntyped<Size>(p, 0ul, static_cast<const char *>(begin) + i * Size);
p = utils::pointermath::add(p, stride);
setUniformUntyped<Size>(offset + i * stride, static_cast<const char *>(begin) + i * Size);
}
}
@@ -130,37 +142,6 @@ void UniformBuffer::setUniformArrayUntyped<16ul>(size_t offset, void const* UTIL
template
void UniformBuffer::setUniformArrayUntyped<64ul>(size_t offset, void const* UTILS_RESTRICT begin, size_t count) noexcept;
// specialization for mat3f (which has a different alignment, see std140 layout rules)
template<>
UTILS_NOINLINE
void UniformBuffer::setUniform(void* addr, size_t const offset, const mat3f& v) noexcept {
struct mat43 {
float v[3][4];
};
addr = static_cast<char*>(addr) + offset;
mat43& temp = *static_cast<mat43*>(addr);
temp.v[0][0] = v[0][0];
temp.v[0][1] = v[0][1];
temp.v[0][2] = v[0][2];
temp.v[1][0] = v[1][0];
temp.v[1][1] = v[1][1];
temp.v[1][2] = v[1][2];
temp.v[2][0] = v[2][0];
temp.v[2][1] = v[2][1];
temp.v[2][2] = v[2][2];
// don't store anything in temp.v[][3] because there could be uniforms packed there
}
template<>
void UniformBuffer::setUniform(size_t const offset, const mat3f& v) noexcept {
setUniform(invalidateUniforms(offset, sizeof(v)), 0, v);
}
#if !defined(NDEBUG)
utils::io::ostream& operator<<(utils::io::ostream& out, const UniformBuffer& rhs) {

View File

@@ -17,20 +17,23 @@
#ifndef TNT_FILAMENT_UNIFORMBUFFER_H
#define TNT_FILAMENT_UNIFORMBUFFER_H
#include <algorithm>
#include "private/backend/DriverApi.h"
#include <utils/Allocator.h>
#include <utils/compiler.h>
#include <utils/Log.h>
#include <utils/debug.h>
#include <backend/BufferDescriptor.h>
#include <utils/compiler.h>
#include <utils/debug.h>
#include <math/mat3.h>
#include <math/mat4.h>
#include <math/quat.h>
#include <math/vec2.h>
#include <math/vec3.h>
#include <math/vec4.h>
#include <type_traits>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
@@ -52,7 +55,7 @@ public:
// can be moved
UniformBuffer(UniformBuffer&& rhs) noexcept;
// can be moved (e.g. assigned from a temporary)
// Can be moved (e.g. assigned from a temporary)
UniformBuffer& operator=(UniformBuffer&& rhs) noexcept;
~UniformBuffer() noexcept {
@@ -66,15 +69,22 @@ public:
UniformBuffer& setUniforms(const UniformBuffer& rhs) noexcept;
// invalidate a range of uniforms and return a pointer to it. offset and size given in bytes
void* invalidateUniforms(size_t const offset, size_t const size) {
assert_invariant(offset + size <= mSize);
mSomethingDirty = true;
return static_cast<char*>(mBuffer) + offset;
// Checks if a range needs to be invalidated by comparing the current value.
template<size_t Size>
bool invalidateNeeded(size_t const offset, void const* UTILS_RESTRICT v) const {
assert_invariant(offset + Size <= mSize);
void* const UTILS_RESTRICT addr = getUniformAddress(offset);
return bool(memcmp(addr, v, Size)); // inlined
}
void* invalidate() noexcept {
return invalidateUniforms(0, mSize);
// Invalidate a range of uniforms and return a pointer to it. offset and size given in bytes
void invalidateUniforms(size_t const offset, size_t const size) const {
assert_invariant(offset + size <= mSize);
mSomethingDirty = true;
}
void invalidate() const noexcept {
invalidateUniforms(0, mSize);
}
// pointer to the uniform buffer
@@ -99,23 +109,23 @@ public:
// (e.g. bool and bool vectors)
template <typename T>
struct is_supported_type {
using type = typename std::enable_if<
std::is_same<float, T>::value ||
std::is_same<int32_t, T>::value ||
std::is_same<uint32_t, T>::value ||
std::is_same<math::quatf, T>::value ||
std::is_same<math::int2, T>::value ||
std::is_same<math::int3, T>::value ||
std::is_same<math::int4, T>::value ||
std::is_same<math::uint2, T>::value ||
std::is_same<math::uint3, T>::value ||
std::is_same<math::uint4, T>::value ||
std::is_same<math::float2, T>::value ||
std::is_same<math::float3, T>::value ||
std::is_same<math::float4, T>::value ||
std::is_same<math::mat3f, T>::value ||
std::is_same<math::mat4f, T>::value
>::type;
using type = std::enable_if_t<
std::is_same_v<float, T> ||
std::is_same_v<int32_t, T> ||
std::is_same_v<uint32_t, T> ||
std::is_same_v<math::quatf, T> ||
std::is_same_v<math::int2, T> ||
std::is_same_v<math::int3, T> ||
std::is_same_v<math::int4, T> ||
std::is_same_v<math::uint2, T> ||
std::is_same_v<math::uint3, T> ||
std::is_same_v<math::uint4, T> ||
std::is_same_v<math::float2, T> ||
std::is_same_v<math::float3, T> ||
std::is_same_v<math::float4, T> ||
std::is_same_v<math::mat3f, T> ||
std::is_same_v<math::mat4f, T>
>;
};
// Invalidates an array of uniforms and returns a pointer to the first element.
@@ -141,14 +151,14 @@ public:
// (see specialization for mat3f below)
template<typename T, typename = typename is_supported_type<T>::type>
UTILS_ALWAYS_INLINE
static inline void setUniform(void* addr, size_t const offset, const T& v) noexcept {
static void setUniform(void* addr, const T& v) noexcept {
static_assert(!std::is_same_v<T, math::mat3f>);
setUniformUntyped<sizeof(T)>(addr, offset, &v);
setUniformUntyped<sizeof(T)>(addr, &v);
}
template<typename T, typename = typename is_supported_type<T>::type>
UTILS_ALWAYS_INLINE
inline void setUniform(size_t const offset, const T& v) noexcept {
void setUniform(size_t const offset, const T& v) noexcept {
static_assert(!std::is_same_v<T, math::mat3f>);
setUniformUntyped<sizeof(T)>(offset, &v);
}
@@ -185,6 +195,7 @@ public:
void setUniformArrayUntyped(size_t offset, void const* UTILS_RESTRICT begin, size_t count) noexcept;
private:
#if !defined(NDEBUG)
friend utils::io::ostream& operator<<(utils::io::ostream& out, const UniformBuffer& rhs);
#endif
@@ -194,24 +205,34 @@ private:
template<size_t Size, std::enable_if_t<
Size == 4 || Size == 8 || Size == 12 || Size == 16 || Size == 64, bool> = true>
UTILS_ALWAYS_INLINE
static void setUniformUntyped(void* addr, size_t const offset, void const* v) noexcept {
memcpy(static_cast<char*>(addr) + offset, v, Size); // inlined
static void setUniformUntyped(void* UTILS_RESTRICT addr, void const* v) noexcept {
memcpy(addr, v, Size); // inlined
}
inline bool isLocalStorage() const noexcept { return mBuffer == mStorage; }
bool isLocalStorage() const noexcept { return mBuffer == mStorage; }
char mStorage[96];
void* getUniformAddress(size_t const offset) const noexcept {
return static_cast<char*>(mBuffer) + offset;
}
char mStorage[96]; // 6 lines (6 x vec4 x 4)
void *mBuffer = nullptr;
uint32_t mSize = 0;
mutable bool mSomethingDirty = false;
// we have 3 padding bytes here
};
// specialization for mat3f (which has a different alignment, see std140 layout rules)
// Specialization for mat3f (which has a different alignment, see std140 layout rules), we declare it
// but don't define it, so that we are sure it's never called.
template<>
void UniformBuffer::setUniform(void* addr, size_t offset, const math::mat3f& v) noexcept;
void UniformBuffer::setUniform(void* addr, const math::mat3f& v) noexcept;
// The specialization for mat3f (which has a different alignment, see std140 layout rules) is handled as
// an array of three float3 (which therefore have an alignment of 16)
template<>
void UniformBuffer::setUniform(size_t offset, const math::mat3f& v) noexcept;
inline void UniformBuffer::setUniform(size_t const offset, const math::mat3f& v) noexcept {
setUniformArrayUntyped<sizeof(math::float3)>(offset, &v, 3);
}
template<>
inline void UniformBuffer::setUniformArray(

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
#include <initializer_list>
#include <string_view>
#include <variant>
#include <stddef.h>
#include <stdint.h>
namespace filament {
// This is intended to be used only to hold the static material data
struct StaticMaterialInfo {
struct ConstantInfo {
std::string_view name;
std::variant<int32_t, float, bool> value;
};
std::string_view name;
uint8_t const* data;
size_t size;
// the life-time of objects pointed to by this initializer_list<> is extended to the
// life-time of the initializer_list
std::initializer_list<ConstantInfo> constants;
};
#define MATERIAL(p, n) p ## _ ## n ## _DATA, size_t(p ## _ ## n ## _SIZE)
} // namespace filament

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2025 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.
*/
#include "fxaa.h"
#include "generated/resources/fxaa.h"
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
#include <iterator>
#include <stddef.h>
namespace filament {
static const StaticMaterialInfo sMaterialList[] = {
{ "fxaa", MATERIAL(FXAA, FXAA) },
};
utils::Slice<StaticMaterialInfo> getFxaaMaterialList() noexcept {
return { std::begin(sMaterialList), std::end(sMaterialList) };
}
} // namespace filament

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
namespace filament {
utils::Slice<StaticMaterialInfo> getFxaaMaterialList() noexcept;
} // namespace filament

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2025 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.
*/
#include "taa.h"
#include "generated/resources/taa.h"
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
#include <iterator>
#include <stddef.h>
namespace filament {
static const StaticMaterialInfo sMaterialList[] = {
{ "taa", MATERIAL(TAA, TAA) },
};
utils::Slice<StaticMaterialInfo> getTaaMaterialList() noexcept {
return { std::begin(sMaterialList), std::end(sMaterialList) };
}
} // namespace filament

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
namespace filament {
utils::Slice<StaticMaterialInfo> getTaaMaterialList() noexcept;
} // namespace filament

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2025 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.
*/
#include "bloom.h"
#include "generated/resources/bloom.h"
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
#include <iterator>
#include <stddef.h>
namespace filament {
static const StaticMaterialInfo sMaterialList[] = {
{ "bloomDownsample", MATERIAL(BLOOM, BLOOMDOWNSAMPLE) },
{ "bloomDownsample2x", MATERIAL(BLOOM, BLOOMDOWNSAMPLE2X) },
{ "bloomDownsample9", MATERIAL(BLOOM, BLOOMDOWNSAMPLE9) },
{ "bloomUpsample", MATERIAL(BLOOM, BLOOMUPSAMPLE) },
};
utils::Slice<StaticMaterialInfo> getBloomMaterialList() noexcept {
return { std::begin(sMaterialList), std::end(sMaterialList) };
}
} // namespace filament

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
namespace filament {
utils::Slice<StaticMaterialInfo> getBloomMaterialList() noexcept;
} // namespace filament

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2025 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.
*/
#include "colorGrading.h"
#include "generated/resources/colorGrading.h"
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
#include <iterator>
#include <stddef.h>
namespace filament {
static const StaticMaterialInfo sMaterialList[] = {
{ "colorGrading", MATERIAL(COLORGRADING, COLORGRADING) },
{ "colorGradingAsSubpass", MATERIAL(COLORGRADING, COLORGRADINGASSUBPASS) },
{ "customResolveAsSubpass", MATERIAL(COLORGRADING, CUSTOMRESOLVEASSUBPASS) },
};
utils::Slice<StaticMaterialInfo> getColorGradingMaterialList() noexcept {
return { std::begin(sMaterialList), std::end(sMaterialList) };
}
} // namespace filament

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
namespace filament {
utils::Slice<StaticMaterialInfo> getColorGradingMaterialList() noexcept;
} // namespace filament

View File

@@ -0,0 +1,47 @@
/*
* Copyright (C) 2025 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.
*/
#include "dof.h"
#include "generated/resources/dof.h"
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
#include <iterator>
#include <stddef.h>
namespace filament {
static const StaticMaterialInfo sMaterialList[] = {
{ "dof", MATERIAL(DOF, DOF) },
{ "dofCoc", MATERIAL(DOF, DOFCOC) },
{ "dofCombine", MATERIAL(DOF, DOFCOMBINE) },
{ "dofDilate", MATERIAL(DOF, DOFDILATE) },
{ "dofDownsample", MATERIAL(DOF, DOFDOWNSAMPLE) },
{ "dofMedian", MATERIAL(DOF, DOFMEDIAN) },
{ "dofMipmap", MATERIAL(DOF, DOFMIPMAP) },
{ "dofTiles", MATERIAL(DOF, DOFTILES) },
{ "dofTilesSwizzle", MATERIAL(DOF, DOFTILESSWIZZLE) },
};
utils::Slice<StaticMaterialInfo> getDofMaterialList() noexcept {
return { std::begin(sMaterialList), std::end(sMaterialList) };
}
} // namespace filament

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
namespace filament {
utils::Slice<StaticMaterialInfo> getDofMaterialList() noexcept;
} // namespace filament

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2025 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.
*/
#include "flare.h"
#include "generated/resources/flare.h"
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
#include <iterator>
#include <stddef.h>
namespace filament {
static const StaticMaterialInfo sMaterialList[] = {
{ "flare", MATERIAL(FLARE, FLARE) },
};
utils::Slice<StaticMaterialInfo> getFlareMaterialList() noexcept {
return { std::begin(sMaterialList), std::end(sMaterialList) };
}
} // namespace filament

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
namespace filament {
utils::Slice<StaticMaterialInfo> getFlareMaterialList() noexcept;
} // namespace filament

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2025 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.
*/
#include "fsr.h"
#include "generated/resources/fsr.h"
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
#include <iterator>
#include <stddef.h>
namespace filament {
static const StaticMaterialInfo sMaterialList[] = {
{ "fsr_easu", MATERIAL(FSR, FSR_EASU) },
{ "fsr_easu_mobile", MATERIAL(FSR, FSR_EASU_MOBILE) },
{ "fsr_easu_mobileF", MATERIAL(FSR, FSR_EASU_MOBILEF) },
{ "fsr_rcas", MATERIAL(FSR, FSR_RCAS) },
};
utils::Slice<StaticMaterialInfo> getFsrMaterialList() noexcept {
return { std::begin(sMaterialList), std::end(sMaterialList) };
}
} // namespace filament

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
namespace filament {
utils::Slice<StaticMaterialInfo> getFsrMaterialList() noexcept;
} // namespace filament

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2025 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.
*/
#include "fsr.h"
#include "generated/resources/sgsr.h"
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
#include <iterator>
#include <stddef.h>
namespace filament {
static const StaticMaterialInfo sMaterialList[] = {
{ "sgsr1", MATERIAL(SGSR, SGSR1) },
};
utils::Slice<StaticMaterialInfo> getSgsrMaterialList() noexcept {
return { std::begin(sMaterialList), std::end(sMaterialList) };
}
} // namespace filament

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
namespace filament {
utils::Slice<StaticMaterialInfo> getSgsrMaterialList() noexcept;
} // namespace filament

View File

@@ -0,0 +1,47 @@
/*
* Copyright (C) 2025 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.
*/
#include "ssao.h"
#include "generated/resources/ssao.h"
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
#include <iterator>
#include <stddef.h>
namespace filament {
static const StaticMaterialInfo sMaterialList[] = {
{ "bilateralBlur", MATERIAL(SSAO, BILATERALBLUR) },
{ "bilateralBlurBentNormals", MATERIAL(SSAO, BILATERALBLURBENTNORMALS) },
{ "mipmapDepth", MATERIAL(SSAO, MIPMAPDEPTH) },
{ "sao", MATERIAL(SSAO, SAO) },
{ "saoBentNormals", MATERIAL(SSAO, SAOBENTNORMALS) },
#ifndef FILAMENT_DISABLE_GTAO
{ "gtao", MATERIAL(SSAO, GTAO) },
{ "gtaoBentNormals", MATERIAL(SSAO, GTAOBENTNORMALS) },
#endif
};
utils::Slice<StaticMaterialInfo> getSsaoMaterialList() noexcept {
return { std::begin(sMaterialList), std::end(sMaterialList) };
}
} // namespace filament

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
#include <materials/StaticMaterialInfo.h>
#include <utils/Slice.h>
namespace filament {
utils::Slice<StaticMaterialInfo> getSsaoMaterialList() noexcept;
} // namespace filament

View File

@@ -1,12 +1,12 @@
Pod::Spec.new do |spec|
spec.name = "Filament"
spec.version = "1.62.2"
spec.version = "1.62.1"
spec.license = { :type => "Apache 2.0", :file => "LICENSE" }
spec.homepage = "https://google.github.io/filament"
spec.authors = "Google LLC."
spec.summary = "Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WASM/WebGL."
spec.platform = :ios, "11.0"
spec.source = { :http => "https://github.com/google/filament/releases/download/v1.62.2/filament-v1.62.2-ios.tgz" }
spec.source = { :http => "https://github.com/google/filament/releases/download/v1.62.1/filament-v1.62.1-ios.tgz" }
# Fix linking error with Xcode 12; we do not yet support the simulator on Apple silicon.
spec.pod_target_xcconfig = {

View File

@@ -14,16 +14,19 @@ In the `test` directory is a list of test descriptions that are specified in jso
`sample.json` to parse the structure.
## Running the test locally
- To run the same presbumit as [`test-renderdiff`][presubmit-renderdiff], you can do
- To run the same presbumit as [`test-renderdiff`](presubmit-renderdiff), you can do
```
bash test/renderdiff/test.sh
bash test/renderdiff/test.sh
```
- This script will generate the renderings based on the current state of your repo.
Additionally, it will also compare the generated images with corresponding images in the
golden repo.
- To just render without running the test, you could use the following script
```
bash test/renderdiff/generate.sh
bash test/renderdiff/generate.sh
```
## Update the golden images
@@ -39,32 +42,42 @@ in the following fashion
### Using a script to update the golden repo
- Run interactive mode in the `update_golden.py` script.
```
python3 test/renderdiff/src/update_golden.py
python3 test/renderdiff/src/update_golden.py
```
- This will guide you through a series of steps to push the changes to a remote branch
on `filament-assets`.
### Manually updating the golden repo
- Check out the golden repo
```
git clone git@github.com:google/filament-assets.git
git clone git@github.com:google/filament-assets.git
```
- Create a branch on the golden repo
```
cd filament-assets
git switch -c my-pr-branch-golden
cd filament-assets
git switch -c my-pr-branch-golden
```
- Copy the new images to their appropriate place in `filament-assets`
- Push the `filament-assets` working branch to remote
```
git push origin my-pr-branch-golden
git push origin my-pr-branch-golden
```
- In the commit message of your working branch on `filament`, add the following line
```
RDIFF_BBRANCH=my-pr-branch-golden
RDIFF_BBRANCH=my-pr-branch-golden
```
### Manually updating the golden repo
Doing the above has multiple effects:

View File

@@ -19,9 +19,8 @@ source `dirname $0`/src/preamble.sh
start_
if [[ "$GITHUB_WORKFLOW" ]]; then
# The commit message would have been piped as stdin to this script
COMMIT_MSG=$(cat)
GOLDEN_BRANCH=$(echo "${COMMIT_MSG}" | python3 test/renderdiff/src/commit_msg.py)
echo "This is meant to run locally (not part of the CI)"
exit 1
else
GOLDEN_BRANCH=$(git log -1 | python3 test/renderdiff/src/commit_msg.py)
fi

View File

@@ -45,8 +45,8 @@ def _compare_goldens(base_dir, comparison_dir, out_dir=None):
output_fname = os.path.join(output_test_dir, "compare_results.json")
results_meta = {
'results': results,
'base_dir': os.path.relpath(output_fname, base_test_dir),
'comparison_dir': os.path.relpath(output_fname, comp_test_dir),
'base_dir': os.path.relpath(output_test_dir, base_test_dir),
'comparison_dir': os.path.relpath(output_test_dir, comp_test_dir),
}
with open(output_fname, 'w') as f:
f.write(json.dumps(results_meta, indent=2))

View File

@@ -190,7 +190,6 @@ int main(int argc, char* argv[]) {
std::string packageFile = g_packageName;
std::string packagePrefix = std::string(g_packageName) + "_";
transform(packageFile.begin(), packageFile.end(), packageFile.begin(), ::tolower);
transform(packagePrefix.begin(), packagePrefix.end(), packagePrefix.begin(), ::toupper);
std::string package = packagePrefix + "PACKAGE";

View File

@@ -1,6 +1,6 @@
{
"name": "filament",
"version": "1.62.2",
"version": "1.62.1",
"description": "Real-time physically based rendering engine",
"main": "filament.js",
"module": "filament.js",