Skip to content

Commit

Permalink
Merge branch 'rc/1.40.4' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado committed Aug 1, 2023
2 parents 4142e7a + 7436611 commit 71f60de
Show file tree
Hide file tree
Showing 42 changed files with 804 additions and 237 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repositories {
}
dependencies {
implementation 'com.google.android.filament:filament-android:1.40.3'
implementation 'com.google.android.filament:filament-android:1.40.4'
}
```

Expand All @@ -50,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.40.3'
pod 'Filament', '~> 1.40.4'
```

### Snapshots
Expand Down
8 changes: 8 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ A new header is inserted each time a *tag* is created.
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
Expand Down
2 changes: 1 addition & 1 deletion android/Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```


Expand Down
14 changes: 7 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ buildscript {
'minSdk': 19,
'targetSdk': 33,
'compileSdk': 33,
'kotlin': '1.8.20',
'kotlin_coroutines': '1.7.1',
'buildTools': '33.0.2',
'kotlin': '1.9.0',
'kotlin_coroutines': '1.7.2',
'buildTools': '34.0.0',
'ndk': '25.1.8937393',
'androidx_core': '1.10.0',
'androidx_annotations': '1.3.0'
'androidx_core': '1.10.1',
'androidx_annotations': '1.6.0'
]

ext.deps = [
Expand All @@ -104,7 +104,7 @@ buildscript {
]

dependencies {
classpath 'com.android.tools.build:gradle:8.0.2'
classpath 'com.android.tools.build:gradle:8.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
}

Expand Down Expand Up @@ -152,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
Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GROUP=com.google.android.filament
VERSION_NAME=1.40.3
VERSION_NAME=1.40.4

POM_DESCRIPTION=Real-time physically based rendering engine for Android.

Expand Down
2 changes: 2 additions & 0 deletions filament/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ if (FILAMENT_SUPPORTS_VULKAN)
src/vulkan/VulkanStagePool.h
src/vulkan/VulkanSwapChain.cpp
src/vulkan/VulkanSwapChain.h
src/vulkan/VulkanReadPixels.cpp
src/vulkan/VulkanReadPixels.h
src/vulkan/VulkanTexture.cpp
src/vulkan/VulkanTexture.h
src/vulkan/VulkanUtility.cpp
Expand Down
1 change: 1 addition & 0 deletions filament/backend/include/private/backend/DriverAPI.inc
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ DECL_DRIVER_API_N(endTimerQuery,
backend::TimerQueryHandle, query)

DECL_DRIVER_API_N(compilePrograms,
backend::CompilerPriorityQueue, priority,
backend::CallbackHandler*, handler,
backend::CallbackHandler::Callback, callback,
void*, user)
Expand Down
4 changes: 2 additions & 2 deletions filament/backend/src/metal/MetalDriver.mm
Original file line number Diff line number Diff line change
Expand Up @@ -975,8 +975,8 @@
scheduleDestroy(std::move(data));
}

void MetalDriver::compilePrograms(CallbackHandler* handler,
CallbackHandler::Callback callback, void* user) {
void MetalDriver::compilePrograms(CompilerPriorityQueue priority,
CallbackHandler* handler, CallbackHandler::Callback callback, void* user) {
if (callback) {
scheduleCallback(handler, user, callback);
}
Expand Down
4 changes: 2 additions & 2 deletions filament/backend/src/noop/NoopDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ void NoopDriver::updateSamplerGroup(Handle<HwSamplerGroup> sbh,
scheduleDestroy(std::move(data));
}

void NoopDriver::compilePrograms(CallbackHandler* handler,
CallbackHandler::Callback callback, void* user) {
void NoopDriver::compilePrograms(CompilerPriorityQueue priority,
CallbackHandler* handler, CallbackHandler::Callback callback, void* user) {
if (callback) {
scheduleCallback(handler, user, callback);
}
Expand Down
6 changes: 6 additions & 0 deletions filament/backend/src/opengl/OpenGLContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,10 @@ void OpenGLContext::setDefaultState() noexcept {
glClipControlEXT(GL_LOWER_LEFT_EXT, GL_ZERO_TO_ONE_EXT);
#endif
}

if (ext.EXT_clip_cull_distance) {
glEnable(GL_CLIP_DISTANCE0);
}
}

#ifdef BACKEND_OPENGL_VERSION_GLES
Expand All @@ -469,6 +473,7 @@ void OpenGLContext::initExtensionsGLES() noexcept {
using namespace std::literals;
ext.APPLE_color_buffer_packed_float = exts.has("GL_APPLE_color_buffer_packed_float"sv);
ext.EXT_clip_control = exts.has("GL_EXT_clip_control"sv);
ext.EXT_clip_cull_distance = exts.has("GL_EXT_clip_cull_distance"sv);
ext.EXT_color_buffer_float = exts.has("GL_EXT_color_buffer_float"sv);
ext.EXT_color_buffer_half_float = exts.has("GL_EXT_color_buffer_half_float"sv);
ext.EXT_debug_marker = exts.has("GL_EXT_debug_marker"sv);
Expand Down Expand Up @@ -537,6 +542,7 @@ void OpenGLContext::initExtensionsGL() noexcept {
ext.ARB_shading_language_packing = exts.has("GL_ARB_shading_language_packing"sv);
ext.EXT_color_buffer_float = true; // Assumes core profile.
ext.EXT_color_buffer_half_float = true; // Assumes core profile.
ext.EXT_clip_cull_distance = true;
ext.EXT_debug_marker = exts.has("GL_EXT_debug_marker"sv);
ext.EXT_discard_framebuffer = false;
ext.EXT_disjoint_timer_query = true;
Expand Down
1 change: 1 addition & 0 deletions filament/backend/src/opengl/OpenGLContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ class OpenGLContext {
bool APPLE_color_buffer_packed_float;
bool ARB_shading_language_packing;
bool EXT_clip_control;
bool EXT_clip_cull_distance;
bool EXT_color_buffer_float;
bool EXT_color_buffer_half_float;
bool EXT_debug_marker;
Expand Down
6 changes: 3 additions & 3 deletions filament/backend/src/opengl/OpenGLDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2607,10 +2607,10 @@ SyncStatus OpenGLDriver::getSyncStatus(Handle<HwSync> sh) {
}
}

void OpenGLDriver::compilePrograms(CallbackHandler* handler,
CallbackHandler::Callback callback, void* user) {
void OpenGLDriver::compilePrograms(CompilerPriorityQueue priority,
CallbackHandler* handler, CallbackHandler::Callback callback, void* user) {
if (callback) {
getShaderCompilerService().notifyWhenAllProgramsAreReady(handler, callback, user);
getShaderCompilerService().notifyWhenAllProgramsAreReady(priority, handler, callback, user);
}
}

Expand Down
33 changes: 16 additions & 17 deletions filament/backend/src/opengl/ShaderCompilerService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,7 @@ ShaderCompilerService::program_token_t ShaderCompilerService::createProgram(
binary.program = glProgram;
if (token->key) {
// Attempt to cache. This calls glGetProgramBinary.
OpenGLBlobCache::insert(mDriver.mPlatform,
token->key, token->gl.program);
OpenGLBlobCache::insert(mDriver.mPlatform, token->key, glProgram);
}
}
#ifndef FILAMENT_SILENCE_NOT_SUPPORTED_BY_ES2
Expand Down Expand Up @@ -305,7 +304,7 @@ ShaderCompilerService::program_token_t ShaderCompilerService::createProgram(

}

runAtNextTick(token, [this, token]() {
runAtNextTick(token->priorityQueue, token, [this, token]() {
if (mShaderCompilerThreadCount) {
if (!token->gl.program) {
// TODO: see if we could completely eliminate this callback here
Expand Down Expand Up @@ -425,20 +424,21 @@ void ShaderCompilerService::tick() {
executeTickOps();
}

void ShaderCompilerService::notifyWhenAllProgramsAreReady(CallbackHandler* handler,
CallbackHandler::Callback callback, void* user) {
void ShaderCompilerService::notifyWhenAllProgramsAreReady(CompilerPriorityQueue priority,
CallbackHandler* handler, CallbackHandler::Callback callback, void* user) {

if (KHR_parallel_shader_compile || mShaderCompilerThreadCount) {
// list all programs up to this point
// list all programs up to this point, both low and high priority
utils::FixedCapacityVector<program_token_t, std::allocator<program_token_t>, false> tokens;
tokens.reserve(mRunAtNextTickOps.size());
for (auto& [token, _] : mRunAtNextTickOps) {
for (auto& [priority_, token, fn_] : mRunAtNextTickOps) {
if (token) {
tokens.push_back(token);
}
}

runAtNextTick(nullptr, [this, tokens = std::move(tokens), handler, user, callback]() {
runAtNextTick(priority, nullptr,
[this, tokens = std::move(tokens), handler, user, callback]() {
for (auto const& token : tokens) {
assert_invariant(token);
if (!isProgramReady(token)) {
Expand All @@ -459,7 +459,7 @@ void ShaderCompilerService::notifyWhenAllProgramsAreReady(CallbackHandler* handl

// we don't have KHR_parallel_shader_compile

runAtNextTick(nullptr, [this, handler, user, callback]() {
runAtNextTick(priority, nullptr, [this, handler, user, callback]() {
mDriver.scheduleCallback(handler, user, callback);
return true;
});
Expand Down Expand Up @@ -747,17 +747,15 @@ GLuint ShaderCompilerService::linkProgram(OpenGLContext& context,

// ------------------------------------------------------------------------------------------------

void ShaderCompilerService::runAtNextTick(
void ShaderCompilerService::runAtNextTick(CompilerPriorityQueue priority,
const program_token_t& token, std::function<bool()> fn) noexcept {
// insert items in order of priority and at the end of the range
auto& ops = mRunAtNextTickOps;
using ContainerType = std::pair<program_token_t, std::function<bool()>>;
auto const pos = std::lower_bound(ops.begin(), ops.end(),
token->priorityQueue,
auto const pos = std::lower_bound(ops.begin(), ops.end(), priority,
[](ContainerType const& lhs, CompilerPriorityQueue priorityQueue) {
return lhs.first->priorityQueue < priorityQueue;
return std::get<0>(lhs) < priorityQueue;
});
ops.emplace(pos, token, std::move(fn));
ops.emplace(pos, priority, token, std::move(fn));

SYSTRACE_CONTEXT();
SYSTRACE_VALUE32("ShaderCompilerService Jobs", mRunAtNextTickOps.size());
Expand All @@ -768,7 +766,7 @@ void ShaderCompilerService::cancelTickOp(program_token_t token) noexcept {
auto& ops = mRunAtNextTickOps;
auto pos = std::find_if(ops.begin(), ops.end(),
[&](const auto& item) {
return item.first == token;
return std::get<1>(item) == token;
});
if (pos != ops.end()) {
ops.erase(pos);
Expand All @@ -781,7 +779,8 @@ void ShaderCompilerService::executeTickOps() noexcept {
auto& ops = mRunAtNextTickOps;
auto it = ops.begin();
while (it != ops.end()) {
bool const remove = it->second();
auto fn = std::get<2>(*it);
bool const remove = fn();
if (remove) {
it = ops.erase(it);
} else {
Expand Down
10 changes: 6 additions & 4 deletions filament/backend/src/opengl/ShaderCompilerService.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class ShaderCompilerService {
static void* getUserData(const program_token_t& token) noexcept;

// call the callback when all active programs are ready
void notifyWhenAllProgramsAreReady(CallbackHandler* handler,
CallbackHandler::Callback callback, void* user);
void notifyWhenAllProgramsAreReady(CompilerPriorityQueue priority,
CallbackHandler* handler, CallbackHandler::Callback callback, void* user);

private:
class CompilerThreadPool {
Expand Down Expand Up @@ -143,11 +143,13 @@ class ShaderCompilerService {

static bool checkProgramStatus(program_token_t const& token) noexcept;

void runAtNextTick(const program_token_t& token, std::function<bool()> fn) noexcept;
void runAtNextTick(CompilerPriorityQueue priority,
const program_token_t& token, std::function<bool()> fn) noexcept;
void executeTickOps() noexcept;
void cancelTickOp(program_token_t token) noexcept;
// order of insertion is important
std::vector<std::pair<program_token_t, std::function<bool()>>> mRunAtNextTickOps;
using ContainerType = std::tuple<CompilerPriorityQueue, program_token_t, std::function<bool()>>;
std::vector<ContainerType> mRunAtNextTickOps;
};

} // namespace filament::backend
Expand Down
6 changes: 6 additions & 0 deletions filament/backend/src/opengl/gl_headers.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ using namespace glext;
# define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009
#endif

#if defined(GL_EXT_clip_cull_distance)
# define GL_CLIP_DISTANCE0 GL_CLIP_DISTANCE0_EXT
#else
# define GL_CLIP_DISTANCE0 0x3000
#endif

#if defined(GL_KHR_debug)
# define GL_DEBUG_OUTPUT GL_DEBUG_OUTPUT_KHR
# define GL_DEBUG_OUTPUT_SYNCHRONOUS GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR
Expand Down
Loading

0 comments on commit 71f60de

Please sign in to comment.