Skip to content

Commit

Permalink
Merge branch 'rc/1.54.4' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
poweifeng committed Sep 17, 2024
2 parents 3e55658 + 429fd7a commit 65aed71
Show file tree
Hide file tree
Showing 18 changed files with 471 additions and 29 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.54.3'
implementation 'com.google.android.filament:filament-android:1.54.4'
}
```

Expand All @@ -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.54.3'
pod 'Filament', '~> 1.54.4'
```

## Documentation
Expand Down
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ 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.54.4

- Add support for multi-layered render target with array textures.

## v1.54.3


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.54.3
VERSION_NAME=1.54.4

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

Expand Down
10 changes: 8 additions & 2 deletions filament/backend/src/CommandStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@
#include <utils/CallStack.h>
#endif

#include <utils/compiler.h>
#include <utils/Log.h>
#include <utils/ostream.h>
#include <utils/Profiler.h>
#include <utils/Systrace.h>

#include <cstddef>
#include <functional>
#include <string>
#include <utility>

#ifdef __ANDROID__
#include <sys/system_properties.h>
Expand Down Expand Up @@ -74,8 +79,8 @@ CommandStream::CommandStream(Driver& driver, CircularBuffer& buffer) noexcept
}

void CommandStream::execute(void* buffer) {
SYSTRACE_CALL();
SYSTRACE_CONTEXT();
// NOTE: we can't use SYSTRACE_CALL() or similar here because, execute() below, also
// uses systrace BEGIN/END and the END is not guaranteed to be happening in this scope.

Profiler profiler;

Expand All @@ -100,6 +105,7 @@ void CommandStream::execute(void* buffer) {
// we want to remove all this when tracing is completely disabled
profiler.stop();
UTILS_UNUSED Profiler::Counters const counters = profiler.readCounters();
SYSTRACE_CONTEXT();
SYSTRACE_VALUE32("GLThread (I)", counters.getInstructions());
SYSTRACE_VALUE32("GLThread (C)", counters.getCpuCycles());
SYSTRACE_VALUE32("GLThread (CPI x10)", counters.getCPI() * 10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ VkPipelineLayout VulkanPipelineLayoutCache::getLayout(
}

// build the push constant layout key
uint32_t pushConstantRangeCount = program->getPushConstantRangeCount();
auto const& pushConstantRanges = program->getPushConstantRanges();
uint32_t const pushConstantRangeCount = program->getPushConstantRangeCount();
auto const& pushConstantRanges = program->getPushConstantRanges();
if (pushConstantRangeCount > 0) {
assert_invariant(pushConstantRangeCount <= Program::SHADER_TYPE_COUNT);
for (uint8_t i = 0; i < pushConstantRangeCount; ++i) {
Expand All @@ -52,8 +52,8 @@ VkPipelineLayout VulkanPipelineLayoutCache::getLayout(
}
}

if (PipelineLayoutMap::iterator iter = mPipelineLayouts.find(key); iter != mPipelineLayouts.end()) {
PipelineLayoutCacheEntry& entry = iter.value();
if (auto iter = mPipelineLayouts.find(key); iter != mPipelineLayouts.end()) {
PipelineLayoutCacheEntry& entry = iter->second;
entry.lastUsed = mTimestamp++;
return entry.handle;
}
Expand Down
10 changes: 5 additions & 5 deletions filament/backend/src/vulkan/caching/VulkanPipelineLayoutCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <utils/Hash.h>

#include <tsl/robin_map.h>
#include <unordered_map>

namespace filament::backend {

Expand All @@ -36,8 +36,8 @@ class VulkanPipelineLayoutCache {
void terminate() noexcept;

struct PushConstantKey {
uint8_t stage;// We have one set of push constant per shader stage (fragment, vertex, etc).
uint8_t size;
uint8_t stage = 0;// We have one set of push constant per shader stage (fragment, vertex, etc).
uint8_t size = 0;
// Note that there is also an offset parameter for push constants, but
// we always assume our update range will have the offset 0.
};
Expand Down Expand Up @@ -73,7 +73,7 @@ class VulkanPipelineLayoutCache {
}
};

using PipelineLayoutMap = tsl::robin_map<PipelineLayoutKey, PipelineLayoutCacheEntry,
using PipelineLayoutMap = std::unordered_map<PipelineLayoutKey, PipelineLayoutCacheEntry,
PipelineLayoutKeyHashFn, PipelineLayoutKeyEqual>;

VkDevice mDevice;
Expand All @@ -82,6 +82,6 @@ class VulkanPipelineLayoutCache {
PipelineLayoutMap mPipelineLayouts;
};

}
} // filament::backend

#endif // TNT_FILAMENT_BACKEND_VULKANPIPELINECACHE_H
7 changes: 7 additions & 0 deletions filament/include/filament/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,13 @@ class UTILS_PUBLIC View : public FilamentAPI {
*/
void setShadowType(ShadowType shadow) noexcept;

/**
* Returns the shadow mapping technique used by this View.
*
* @return value set by setShadowType().
*/
ShadowType getShadowType() const noexcept;

/**
* Sets VSM shadowing options that apply across the entire View.
*
Expand Down
3 changes: 1 addition & 2 deletions filament/src/FrameSkipper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ using namespace utils;
using namespace backend;

FrameSkipper::FrameSkipper(size_t latency) noexcept
: mLast(std::max(latency, MAX_FRAME_LATENCY) - 1) {
assert_invariant(latency <= MAX_FRAME_LATENCY);
: mLast(std::clamp(latency, size_t(1), MAX_FRAME_LATENCY) - 1) {
}

FrameSkipper::~FrameSkipper() noexcept = default;
Expand Down
13 changes: 12 additions & 1 deletion filament/src/FrameSkipper.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,18 @@ namespace filament {
* outrun the GPU.
*/
class FrameSkipper {
static constexpr size_t MAX_FRAME_LATENCY = 3;
/*
* The maximum frame latency acceptable on ANDROID is 2 because higher latencies will be
* throttled anyway in BufferQueueProducer::dequeueBuffer(), because ANDROID is generally
* triple-buffered no more; that case is actually pretty bad because the GL thread can block
* anywhere (usually inside the first draw command that touches the swapchain).
*
* A frame latency of 1 has the benefit of reducing render latency,
* but the drawback of preventing CPU / GPU overlap.
*
* Generally a frame latency of 2 is the best compromise.
*/
static constexpr size_t MAX_FRAME_LATENCY = 2;
public:
/*
* The latency parameter defines how many unfinished frames we want to accept before we start
Expand Down
4 changes: 4 additions & 0 deletions filament/src/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ void View::setShadowType(View::ShadowType shadow) noexcept {
downcast(this)->setShadowType(shadow);
}

View::ShadowType View::getShadowType() const noexcept {
return downcast(this)->getShadowType();
}

void View::setVsmShadowOptions(VsmShadowOptions const& options) noexcept {
downcast(this)->setVsmShadowOptions(options);
}
Expand Down
12 changes: 9 additions & 3 deletions filament/src/details/RenderTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct RenderTarget::BuilderDetails {
uint32_t mWidth{};
uint32_t mHeight{};
uint8_t mSamples = 1; // currently not settable in the public facing API
uint8_t mLayerCount = 0;// currently not settable in the public facing API
uint8_t mLayerCount = 1;
};

using BuilderType = RenderTarget;
Expand Down Expand Up @@ -91,22 +91,28 @@ RenderTarget* RenderTarget::Builder::build(Engine& engine) {
uint32_t maxWidth = 0;
uint32_t minHeight = std::numeric_limits<uint32_t>::max();
uint32_t maxHeight = 0;
uint32_t minDepth = std::numeric_limits<uint32_t>::max();
uint32_t maxDepth = 0;
for (auto const& attachment : mImpl->mAttachments) {
if (attachment.texture) {
const uint32_t w = attachment.texture->getWidth(attachment.mipLevel);
const uint32_t h = attachment.texture->getHeight(attachment.mipLevel);
const uint32_t d = attachment.texture->getDepth(attachment.mipLevel);
minWidth = std::min(minWidth, w);
minHeight = std::min(minHeight, h);
minDepth = std::min(minDepth, d);
maxWidth = std::max(maxWidth, w);
maxHeight = std::max(maxHeight, h);
maxDepth = std::max(maxDepth, d);
}
}

FILAMENT_CHECK_PRECONDITION(minWidth == maxWidth && minHeight == maxHeight)
<< "All attachments dimensions must match";
FILAMENT_CHECK_PRECONDITION(minWidth == maxWidth && minHeight == maxHeight
&& minDepth == maxDepth) << "All attachments dimensions must match";

mImpl->mWidth = minWidth;
mImpl->mHeight = minHeight;
mImpl->mLayerCount = minDepth;
return downcast(engine).createRenderTarget(*this);
}

Expand Down
5 changes: 1 addition & 4 deletions filament/src/fg/FrameGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,11 @@ FrameGraph& FrameGraph::compile() noexcept {

void FrameGraph::execute(backend::DriverApi& driver) noexcept {

SYSTRACE_CALL();

bool const useProtectedMemory = mMode == Mode::PROTECTED;
auto const& passNodes = mPassNodes;
auto& resourceAllocator = mResourceAllocator;

SYSTRACE_NAME("FrameGraph");
driver.pushGroupMarker("FrameGraph");

auto first = passNodes.begin();
Expand All @@ -211,7 +210,6 @@ void FrameGraph::execute(backend::DriverApi& driver) noexcept {
assert_invariant(!node->isCulled());

SYSTRACE_NAME(node->getName());

driver.pushGroupMarker(node->getName());

// devirtualize resourcesList
Expand All @@ -229,7 +227,6 @@ void FrameGraph::execute(backend::DriverApi& driver) noexcept {
assert_invariant(resource->last == node);
resource->destroy(resourceAllocator);
}

driver.popGroupMarker();
}
driver.popGroupMarker();
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.54.3"
spec.version = "1.54.4"
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.54.3/filament-v1.54.3-ios.tgz" }
spec.source = { :http => "https://github.com/google/filament/releases/download/v1.54.4/filament-v1.54.4-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/memalign.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ class STLAlignedAllocator {
using const_pointer = const TYPE*;
using reference = TYPE&;
using const_reference = const TYPE&;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using size_type = ::size_t;
using difference_type = ::ptrdiff_t;
using propagate_on_container_move_assignment = std::true_type;
using is_always_equal = std::true_type;

Expand Down
3 changes: 3 additions & 0 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ set(MATERIAL_SRCS
materials/bakedTexture.mat
materials/pointSprites.mat
materials/aoPreview.mat
materials/arrayTexture.mat
materials/groundShadow.mat
materials/heightfield.mat
materials/image.mat
Expand Down Expand Up @@ -252,6 +253,7 @@ if (NOT ANDROID)
add_demo(helloskinning)
add_demo(helloskinningbuffer)
add_demo(helloskinningbuffer_morebones)
add_demo(hellostereo)
add_demo(image_viewer)
add_demo(lightbulb)
add_demo(material_sandbox)
Expand All @@ -274,6 +276,7 @@ if (NOT ANDROID)
target_link_libraries(gltf_viewer PRIVATE gltf-demo-resources uberarchive gltfio viewer)
target_link_libraries(gltf_instances PRIVATE gltf-demo-resources uberarchive gltfio viewer)
target_link_libraries(hellopbr PRIVATE filameshio suzanne-resources)
target_link_libraries(hellostereo PRIVATE filameshio suzanne-resources)
target_link_libraries(image_viewer PRIVATE viewer imageio)
target_link_libraries(multiple_windows PRIVATE filameshio suzanne-resources)
target_link_libraries(rendertarget PRIVATE filameshio suzanne-resources)
Expand Down
Loading

0 comments on commit 65aed71

Please sign in to comment.