Skip to content

Commit

Permalink
Merge branch 'rc/1.40.0' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado committed Jun 26, 2023
2 parents 11fbace + 1432c59 commit a445c4e
Show file tree
Hide file tree
Showing 4,225 changed files with 253,236 additions and 974 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -372,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.
Expand Down
1 change: 1 addition & 0 deletions NEW_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ for next branch cut* header.
appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md).

## Release notes for next branch cut

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.39.0'
implementation 'com.google.android.filament:filament-android:1.40.0'
}
```

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.39.0'
pod 'Filament', '~> 1.40.0'
```

### Snapshots
Expand Down
9 changes: 8 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ 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.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**]
- UiHelper: fix jank when a `TextureView` is resized (fixes b\282220665)

## v1.38.0

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.39.0
VERSION_NAME=1.40.0

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 @@ -82,6 +82,8 @@ if (FILAMENT_SUPPORTS_OPENGL AND NOT FILAMENT_USE_EXTERNAL_GLES3 AND NOT FILAMEN
src/opengl/OpenGLPlatform.cpp
src/opengl/OpenGLTimerQuery.cpp
src/opengl/OpenGLTimerQuery.h
src/opengl/ShaderCompilerService.cpp
src/opengl/ShaderCompilerService.h
)
if (EGL)
list(APPEND SRCS src/opengl/platforms/PlatformEGL.cpp)
Expand Down
8 changes: 8 additions & 0 deletions filament/backend/include/backend/DriverEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,14 @@ enum class Precision : uint8_t {
DEFAULT
};

/**
* Shader compiler priority queue
*/
enum class CompilerPriorityQueue : uint8_t {
HIGH,
LOW
};

//! Texture sampler type
enum class SamplerType : uint8_t {
SAMPLER_2D, //!< 2D texture
Expand Down
5 changes: 5 additions & 0 deletions filament/backend/include/backend/Program.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class Program {

~Program() noexcept;

Program& priorityQueue(CompilerPriorityQueue priorityQueue) noexcept;

// sets the material name and variant for diagnostic purposes only
Program& diagnostics(utils::CString const& name,
utils::Invocable<utils::io::ostream&(utils::io::ostream& out)>&& logger);
Expand Down Expand Up @@ -138,6 +140,8 @@ class Program {

uint64_t getCacheId() const noexcept { return mCacheId; }

CompilerPriorityQueue getPriorityQueue() const noexcept { return mPriorityQueue; }

private:
friend utils::io::ostream& operator<<(utils::io::ostream& out, const Program& builder);

Expand All @@ -150,6 +154,7 @@ class Program {
utils::FixedCapacityVector<SpecializationConstant> mSpecializationConstants;
utils::FixedCapacityVector<std::pair<utils::CString, uint8_t>> mAttributes;
std::array<UniformInfo, Program::UNIFORM_BINDING_COUNT> mBindingUniformInfo;
CompilerPriorityQueue mPriorityQueue = CompilerPriorityQueue::HIGH;
};

} // namespace filament::backend
Expand Down
21 changes: 21 additions & 0 deletions filament/backend/include/backend/platforms/OpenGLPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,27 @@ class OpenGLPlatform : public Platform {
* @return Transformed image.
*/
virtual AcquiredImage transformAcquiredImage(AcquiredImage source) noexcept;

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

/**
* Returns true if additional OpenGL contexts can be created. Default: false.
* @return true if additional OpenGL contexts can be created.
* @see createContext
*/
virtual bool isExtraContextSupported() const noexcept;

/**
* Creates an OpenGL context with the same configuration than the main context and makes it
* current to the current thread. Must not be called from the main driver thread.
* createContext() is only supported if isExtraContextSupported() returns true.
* These additional contexts will be automatically terminated in terminate.
*
* @param shared whether the new context is shared with the main context.
* @see isExtraContextSupported()
* @see terminate()
*/
virtual void createContext(bool shared);
};

} // namespace filament
Expand Down
3 changes: 3 additions & 0 deletions filament/backend/include/backend/platforms/PlatformCocoaGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class PlatformCocoaGL : public OpenGLPlatform {
// --------------------------------------------------------------------------------------------
// OpenGLPlatform Interface

bool isExtraContextSupported() const noexcept override;
void createContext(bool shared) override;

void terminate() noexcept override;

SwapChain* createSwapChain(void* nativewindow, uint64_t flags) noexcept override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ class PlatformCocoaTouchGL : public OpenGLPlatform {

uint32_t createDefaultRenderTarget() noexcept override;

bool isExtraContextSupported() const noexcept override;
void createContext(bool shared) override;

SwapChain* createSwapChain(void* nativewindow, uint64_t flags) noexcept override;
SwapChain* createSwapChain(uint32_t width, uint32_t height, uint64_t flags) noexcept override;
void destroySwapChain(SwapChain* swapChain) noexcept override;
Expand Down
4 changes: 4 additions & 0 deletions filament/backend/include/backend/platforms/PlatformEGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class PlatformEGL : public OpenGLPlatform {
public:

PlatformEGL() noexcept;
bool isExtraContextSupported() const noexcept override;
void createContext(bool shared) override;

protected:

Expand Down Expand Up @@ -124,6 +126,8 @@ class PlatformEGL : public OpenGLPlatform {
EGLSurface mCurrentReadSurface = EGL_NO_SURFACE;
EGLSurface mEGLDummySurface = EGL_NO_SURFACE;
EGLConfig mEGLConfig = EGL_NO_CONFIG_KHR;
Config mContextAttribs;
std::vector<EGLContext> mAdditionalContexts;

// supported extensions detected at runtime
struct {
Expand Down
8 changes: 7 additions & 1 deletion filament/backend/include/backend/platforms/PlatformWGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
#include "utils/unwindows.h"

#include <backend/platforms/OpenGLPlatform.h>

#include <backend/DriverEnums.h>

#include <vector>

namespace filament::backend {

/**
Expand All @@ -46,6 +47,9 @@ class PlatformWGL : public OpenGLPlatform {

void terminate() noexcept override;

bool isExtraContextSupported() const noexcept override;
void createContext(bool shared) override;

SwapChain* createSwapChain(void* nativewindow, uint64_t flags) noexcept override;
SwapChain* createSwapChain(uint32_t width, uint32_t height, uint64_t flags) noexcept override;
void destroySwapChain(SwapChain* swapChain) noexcept override;
Expand All @@ -57,6 +61,8 @@ class PlatformWGL : public OpenGLPlatform {
HWND mHWnd = NULL;
HDC mWhdc = NULL;
PIXELFORMATDESCRIPTOR mPfd = {};
std::vector<HGLRC> mAdditionalContexts;
std::vector<int> mAttribs;
};

} // namespace filament::backend
Expand Down
9 changes: 9 additions & 0 deletions filament/backend/include/backend/platforms/VulkanPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ class VulkanPlatform : public Platform, utils::PrivateImplementation<VulkanPlatf
// -------- End platform customization options --------
// ----------------------------------------------------

/**
* Returns whether the platform supports sRGB swapchain. This is true by default, and the client
* needs to override this method to specify otherwise.
* @return Whether the platform supports sRGB swapchain.
*/
virtual bool isSRGBSwapChainSupported() const {
return true;
}

/**
* Get the images handles and format of the memory backing the swapchain. This should be called
* after createSwapChain() or after recreateIfResized().
Expand Down
5 changes: 5 additions & 0 deletions filament/backend/src/Program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ Program& Program::operator=(Program&& rhs) noexcept {

Program::~Program() noexcept = default;

Program& Program::priorityQueue(CompilerPriorityQueue priorityQueue) noexcept {
mPriorityQueue = priorityQueue;
return *this;
}

Program& Program::diagnostics(CString const& name,
Invocable<io::ostream&(io::ostream&)>&& logger) {
mName = name;
Expand Down
4 changes: 3 additions & 1 deletion filament/backend/src/metal/MetalDriver.mm
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,9 @@

void MetalDriver::compilePrograms(CallbackHandler* handler,
CallbackHandler::Callback callback, void* user) {
scheduleCallback(handler, user, callback);
if (callback) {
scheduleCallback(handler, user, callback);
}
}

void MetalDriver::beginRenderPass(Handle<HwRenderTarget> rth,
Expand Down
4 changes: 3 additions & 1 deletion filament/backend/src/noop/NoopDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ void NoopDriver::updateSamplerGroup(Handle<HwSamplerGroup> sbh,

void NoopDriver::compilePrograms(CallbackHandler* handler,
CallbackHandler::Callback callback, void* user) {
scheduleCallback(handler, user, callback);
if (callback) {
scheduleCallback(handler, user, callback);
}
}

void NoopDriver::beginRenderPass(Handle<HwRenderTarget> rth, const RenderPassParams& params) {
Expand Down
18 changes: 18 additions & 0 deletions filament/backend/src/opengl/OpenGLBlobCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ GLuint OpenGLBlobCache::retrieve(BlobCacheKey* outKey, Platform& platform,

GLuint programId = 0;

#ifndef FILAMENT_SILENCE_NOT_SUPPORTED_BY_ES2
BlobCacheKey key{ program.getCacheId(), program.getSpecializationConstants() };

// FIXME: use a static buffer to avoid systematic allocation
Expand Down Expand Up @@ -77,12 +78,14 @@ GLuint OpenGLBlobCache::retrieve(BlobCacheKey* outKey, Platform& platform,
using std::swap;
swap(*outKey, key);
}
#endif

return programId;
}

void OpenGLBlobCache::insert(Platform& platform,
BlobCacheKey const& key, GLuint program) noexcept {
#ifndef FILAMENT_SILENCE_NOT_SUPPORTED_BY_ES2
SYSTRACE_CALL();
if (platform.hasBlobFunc()) {
SYSTRACE_CONTEXT();
Expand All @@ -102,6 +105,21 @@ void OpenGLBlobCache::insert(Platform& platform,
}
}
}
#endif
}

void OpenGLBlobCache::insert(Platform& platform, BlobCacheKey const& key,
GLenum format, void* data, GLsizei programBinarySize) noexcept {
SYSTRACE_CALL();
if (platform.hasBlobFunc()) {
if (programBinarySize) {
size_t const size = sizeof(Blob) + programBinarySize;
std::unique_ptr<Blob, decltype(&::free)> blob{ (Blob*)malloc(size), &::free };
blob->format = format;
memcpy(blob->data, data, programBinarySize);
platform.insertBlob(key.data(), key.size(), blob.get(), size);
}
}
}

} // namespace filament::backend
3 changes: 3 additions & 0 deletions filament/backend/src/opengl/OpenGLBlobCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class OpenGLBlobCache {
static void insert(Platform& platform,
BlobCacheKey const& key, GLuint program) noexcept;

static void insert(Platform& platform, BlobCacheKey const& key,
GLenum format, void* data, GLsizei programBinarySize) noexcept;

private:
struct Blob;
};
Expand Down
7 changes: 7 additions & 0 deletions filament/backend/src/opengl/OpenGLContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ OpenGLContext::OpenGLContext() noexcept {
procs.invalidateFramebuffer = glInvalidateFramebuffer;
#endif // BACKEND_OPENGL_LEVEL_GLES30

// no-op if not supported
procs.maxShaderCompilerThreadsKHR = +[](GLuint) {};

#ifdef BACKEND_OPENGL_VERSION_GLES
initExtensionsGLES();
if (state.major == 3) {
Expand Down Expand Up @@ -173,6 +176,8 @@ OpenGLContext::OpenGLContext() noexcept {

procs.invalidateFramebuffer = glDiscardFramebufferEXT;

procs.maxShaderCompilerThreadsKHR = glMaxShaderCompilerThreadsKHR;

mFeatureLevel = FeatureLevel::FEATURE_LEVEL_0;
}
#endif // IOS
Expand All @@ -197,6 +202,8 @@ OpenGLContext::OpenGLContext() noexcept {
bugs.allow_read_only_ancillary_feedback_loop = true;
assert_invariant(gets.max_texture_image_units >= 16);
assert_invariant(gets.max_combined_texture_image_units >= 32);

procs.maxShaderCompilerThreadsKHR = glMaxShaderCompilerThreadsARB;
#endif

#ifdef GL_EXT_texture_filter_anisotropic
Expand Down
2 changes: 2 additions & 0 deletions filament/backend/src/opengl/OpenGLContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,8 @@ class OpenGLContext {
void (* getQueryObjectui64v)(GLuint id, GLenum pname, GLuint64* params);

void (* invalidateFramebuffer)(GLenum target, GLsizei numAttachments, const GLenum *attachments);

void (* maxShaderCompilerThreadsKHR)(GLuint count);
} procs{};

private:
Expand Down
Loading

0 comments on commit a445c4e

Please sign in to comment.