Skip to content

Commit

Permalink
Merge branch 'rc/1.9.15' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado committed Mar 8, 2021
2 parents 0bd41e8 + cb823b1 commit d9a6e2e
Show file tree
Hide file tree
Showing 17 changed files with 232 additions and 27 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.9.14'
implementation 'com.google.android.filament:filament-android:1.9.15'
}
```

Expand Down Expand Up @@ -63,7 +63,7 @@ A much smaller alternative to `filamat-android` that can only generate OpenGL sh
iOS projects can use CocoaPods to install the latest release:

```
pod 'Filament', '~> 1.9.14'
pod 'Filament', '~> 1.9.15'
```

### Snapshots
Expand Down
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ A new header is inserted each time a *tag* is created.

## Next release (main branch)

## v1.9.15

filamat / matc: fix sporatic crash.

## v1.9.14

- Improve bloom/emissive with glTF files.
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.9.14
VERSION_NAME=1.9.15

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

Expand Down
143 changes: 143 additions & 0 deletions docs/qrcode/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<!DOCTYPE html>
<html lang="en">

<head>
<title>Filament Remote</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1">
<link href="../favicon.png" rel="icon" type="image/x-icon" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet">
<style>
html,
body {
height: 100%;
}

body {
margin: 0;
overflow: hidden;
}

.container {
font-family: "Open Sans";
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}

a { text-decoration: none;}
a:visited { color: rgb(26, 65, 78);}

.central-area {
flex-direction: column;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
max-width: 512px;
max-height: 512px;
background: rgb(160, 190, 200);
border: solid 2px black;
}

.warn {
display: flex;
justify-content: center;
align-items: center;
max-width: 400px;
width: 100%;
margin-bottom: 50px;
font-size: 14px;
}

.bad {
background: lightcoral;
}

.good {
background: lightgreen;
}
</style>
<script src="https://unpkg.com/[email protected]/dist/qrious.js"></script>
</head>

<body>

<div class="container">
<div id="central" class="central-area">
<div>
<p>Drop a <b>glb</b> file here.</p>
</div>
</div>
</div>

<script>

const central = document.getElementById("central");
const pipeId = generatePipeId();

['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
central.addEventListener(eventName, e => { e.preventDefault(); e.stopPropagation() }, false)
})

central.addEventListener("dragover", dragEvent => {
central.classList.add("bad");
if (!event.dataTransfer) return;
if (event.dataTransfer.items[0].kind !== "file") return;
central.classList.remove("bad");
central.classList.add("good");
}, false);

central.addEventListener("dragleave", () => {
central.classList.remove("good", "bad");
}, false);

central.addEventListener("drop", dragEvent => {
central.classList.remove("good", "bad");
if (!event.dataTransfer) return;
if (event.dataTransfer.items[0].kind !== "file") return;
const file = event.dataTransfer.items[0].getAsFile();
if (!file.name.match(/\.(glb)$/i)) return;
console.info(`Uploading ${file.name} to ${getPipeUrl()}`)

const files = event.dataTransfer.files;
([...files]).forEach(uploadFile);

central.innerHTML = `
<div class="warn">
<p>
This uses a third-party <a href="https://github.com/nwtgck/piping-server">piping server</a>
to deploy to your mobile device. This server does not store data. We use this server: https://ppng.io/
</p>
</div>
`;
const image = new Image();
central.appendChild(image);

new QRious({element: image, value: getPipeUrl(), size: 200});

}, false);

function uploadFile(file) {
const formData = new FormData();
formData.append('file', file);
fetch(getPipeUrl(), { method: 'POST', body: formData })
.then(() => { /* Done. Inform the user */ })
.catch(() => { /* Error. Inform the user */ });
}

function generatePipeId() {
return Math.floor(Math.random() * Math.floor(1e+20)).toString(16);
}

function getPipeUrl() {
return `https://ppng.io/filament-qrcode-${pipeId}`;
}

</script>
</body>

</html>
4 changes: 4 additions & 0 deletions filament/backend/src/metal/MetalContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <Metal/Metal.h>
#include <QuartzCore/QuartzCore.h>

#include <stack>

#include <tsl/robin_set.h>

namespace filament {
Expand Down Expand Up @@ -92,6 +94,8 @@ struct MetalContext {
uint64_t signalId = 1;

TimerQueryInterface* timerQueryImpl;

std::stack<const char*> groupMarkers;
};

id<MTLCommandBuffer> getPendingCommandBuffer(MetalContext* context);
Expand Down
12 changes: 10 additions & 2 deletions filament/backend/src/metal/MetalDriver.mm
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@
mContext->currentDrawSwapChain->releaseDrawable();

CVMetalTextureCacheFlush(mContext->textureCache, 0);

assert_invariant(mContext->groupMarkers.empty());
}

void MetalDriver::flush(int) {
Expand Down Expand Up @@ -759,6 +761,11 @@

mContext->currentRenderPassEncoder =
[getPendingCommandBuffer(mContext) renderCommandEncoderWithDescriptor:descriptor];
if (!mContext->groupMarkers.empty()) {
mContext->currentRenderPassEncoder.label =
[NSString stringWithCString:mContext->groupMarkers.top()
encoding:NSUTF8StringEncoding];
}

// Flip the viewport, because Metal's screen space is vertically flipped that of Filament's.
NSInteger renderTargetHeight =
Expand Down Expand Up @@ -858,11 +865,12 @@
}

void MetalDriver::pushGroupMarker(const char* string, size_t len) {

mContext->groupMarkers.push(string);
}

void MetalDriver::popGroupMarker(int dummy) {

assert_invariant(!mContext->groupMarkers.empty());
mContext->groupMarkers.pop();
}

void MetalDriver::startCapture(int) {
Expand Down
4 changes: 4 additions & 0 deletions filament/backend/src/opengl/OpenGLDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,10 @@ template<typename D, typename ... ARGS>
backend::Handle<D> OpenGLDriver::initHandle(ARGS&& ... args) noexcept {
static_assert(sizeof(D) <= 208, "Handle<> too large");
backend::Handle<D> h{ allocateHandle(sizeof(D)) };
registerHandleId(h.getId());

D* addr = handle_cast<D *>(h);

new(addr) D(std::forward<ARGS>(args)...);
#if !defined(NDEBUG) && UTILS_HAS_RTTI
addr->typeId = typeid(D).name();
Expand Down Expand Up @@ -401,6 +404,7 @@ void OpenGLDriver::destruct(Handle<B>& handle, D const* p) noexcept {
#endif
p->~D();
mHandleArena.free(const_cast<D*>(p), sizeof(D));
unregisterHandleId(handle.getId());
}
}

Expand Down
30 changes: 28 additions & 2 deletions filament/backend/src/opengl/OpenGLDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
#include <math/vec4.h>

#include <tsl/robin_map.h>

#include <set>
#include <tsl/robin_set.h>

#ifndef FILAMENT_OPENGL_HANDLE_ARENA_SIZE_IN_MB
# define FILAMENT_OPENGL_HANDLE_ARENA_SIZE_IN_MB 2
Expand Down Expand Up @@ -254,9 +253,35 @@ class OpenGLDriver final : public backend::DriverBase {
using HandleArena = utils::Arena<HandleAllocator,
utils::LockingPolicy::SpinLock,
utils::TrackingPolicy::Debug>;

utils::SpinLock mHandleSetLock;
tsl::robin_set<backend::HandleBase::HandleId> mHandleSet;
void registerHandleId(backend::HandleBase::HandleId id) noexcept {
mHandleSetLock.lock();
auto result = mHandleSet.insert(id);
assert_invariant(result.second);
mHandleSetLock.unlock();
}
void unregisterHandleId(backend::HandleBase::HandleId id) noexcept {
mHandleSetLock.lock();
assert_invariant(mHandleSet.find(id) != mHandleSet.cend() );
mHandleSet.erase(id);
mHandleSetLock.unlock();
}
void assertHandleId(backend::HandleBase::HandleId id) noexcept {
mHandleSetLock.lock();
assert_invariant(mHandleSet.find(id) != mHandleSet.cend() );
mHandleSetLock.unlock();
}

#else
using HandleArena = utils::Arena<HandleAllocator,
utils::LockingPolicy::SpinLock>;

inline void registerHandleId(backend::HandleBase::HandleId id) noexcept {}
inline void unregisterHandleId(backend::HandleBase::HandleId id) noexcept {}
inline void assertHandleId(backend::HandleBase::HandleId id) noexcept {}

#endif

HandleArena mHandleArena;
Expand Down Expand Up @@ -289,6 +314,7 @@ class OpenGLDriver final : public backend::DriverBase {
handle_cast(backend::Handle<B>& handle) noexcept {
assert_invariant(handle);
if (!handle) return nullptr; // better to get a NPE than random behavior/corruption
assertHandleId(handle.getId());
char* const base = (char *)mHandleArena.getArea().begin();
size_t offset = handle.getId() << HandleAllocator::MIN_ALIGNMENT_SHIFT;
// assert that this handle is even a valid one
Expand Down
5 changes: 5 additions & 0 deletions filament/backend/src/vulkan/VulkanDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugReportCallback(VkDebugReportFlagsEXT flags,
VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsCallback(VkDebugUtilsMessageSeverityFlagBitsEXT severity,
VkDebugUtilsMessageTypeFlagsEXT types, const VkDebugUtilsMessengerCallbackDataEXT* cbdata,
void* pUserData) {
// TODO: For now, we are silencing an error message relating to writes to the depth buffer
// and the fact that we are not using a read-only depth layout.
if (!strcmp(cbdata->pMessageIdName, "VUID-vkCmdDrawIndexed-None-04584")) {
return VK_FALSE;
}
// TODO: For now, we are silencing an error message relating to mutable comparison samplers.
// It is likely that the internal "depthSampleCompare" feature flag is mistakenly set to false
// by the Molten implementation. In my case, the GPU is an AMD Radeon Pro 5500M. See this bug:
Expand Down
4 changes: 2 additions & 2 deletions ios/CocoaPods/Filament.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Pod::Spec.new do |spec|
spec.name = "Filament"
spec.version = "1.9.14"
spec.version = "1.9.15"
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.9.14/filament-v1.9.14-ios.tgz" }
spec.source = { :http => "https://github.com/google/filament/releases/download/v1.9.15/filament-v1.9.15-ios.tgz" }

# Fix linking error with Xcode 12; we do not yet support the simulator on Apple silicon.
spec.pod_target_xcconfig = {
Expand Down
4 changes: 2 additions & 2 deletions libs/utils/include/utils/Panic.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ class UTILS_PUBLIC TPanic : public Panic {

namespace details {
// these are private, don't use
void logAndPanic(
void panicLog(
char const* function, char const* file, int line, const char* format, ...) noexcept;
} // namespace details

Expand Down Expand Up @@ -457,7 +457,7 @@ class UTILS_PUBLIC ArithmeticPanic : public TPanic<ArithmeticPanic> {
* @param format printf-style string describing the error in more details
*/
#define PANIC_LOG(format, ...) \
::utils::details::logAndPanic(__PRETTY_FUNCTION__, \
::utils::details::panicLog(__PRETTY_FUNCTION__, \
PANIC_FILE(__FILE__), __LINE__, format, ##__VA_ARGS__)

/**
Expand Down
2 changes: 1 addition & 1 deletion libs/utils/src/Panic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void TPanic<T>::panic(char const* function, char const* file, int line, const ch

namespace details {

void logAndPanic(char const* function, char const* file, int line, const char* format, ...) noexcept {
void panicLog(char const* function, char const* file, int line, const char* format, ...) noexcept {
va_list args;
va_start(args, format);
std::string reason(formatString(format, args));
Expand Down
10 changes: 10 additions & 0 deletions libs/utils/src/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,18 @@

namespace utils {

// we use a non-inlined, not marked as "no return" function for aborting so that we can set
// a breakpoint on the call to abort() in panic() below and skip over it in the debugger if
// needed.
UTILS_NOINLINE
void abort() noexcept {
std::abort();
}

void panic(const char *func, const char * file, int line, const char *assertion) noexcept {
PANIC_LOG("%s:%d: failed assertion `%s'\n", file, line, assertion);
abort(); // set a breakpoint here
return; // this line is needed to be able to move the cursor here in the debugger
}

} // namespace filament
2 changes: 1 addition & 1 deletion third_party/moltenvk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This folder contains prebuilt dylib files extracted from `macOS/lib` in the following LunarG SDK:

vulkansdk-macos-1.2.162.1.dmg
vulkansdk-macos-1.2.170.0.dmg

The purpose of these files is to allow Filament developers to avoid installing the LunarG SDK.
However, to enable validation you must install the SDK.
Expand Down
Binary file modified third_party/moltenvk/libMoltenVK.dylib
Binary file not shown.
Loading

0 comments on commit d9a6e2e

Please sign in to comment.