Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37d0bd71db |
@@ -31,7 +31,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.google.android.filament:filament-android:1.68.1'
|
||||
implementation 'com.google.android.filament:filament-android:1.67.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.68.1'
|
||||
pod 'Filament', '~> 1.67.1'
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
@@ -7,9 +7,6 @@ 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.68.1
|
||||
|
||||
|
||||
## v1.68.0
|
||||
|
||||
- engine: add `View::getLastDynamicResolutionScale()` (b/457753622)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
GROUP=com.google.android.filament
|
||||
VERSION_NAME=1.68.1
|
||||
VERSION_NAME=1.67.1
|
||||
|
||||
POM_DESCRIPTION=Real-time physically based rendering engine for Android.
|
||||
|
||||
|
||||
@@ -206,8 +206,6 @@ if (FILAMENT_SUPPORTS_VULKAN)
|
||||
src/vulkan/VulkanDriverFactory.h
|
||||
src/vulkan/VulkanExternalImageManager.cpp
|
||||
src/vulkan/VulkanExternalImageManager.h
|
||||
src/vulkan/VulkanStreamedImageManager.cpp
|
||||
src/vulkan/VulkanStreamedImageManager.h
|
||||
src/vulkan/VulkanFboCache.cpp
|
||||
src/vulkan/VulkanFboCache.h
|
||||
src/vulkan/VulkanHandles.cpp
|
||||
|
||||
@@ -74,9 +74,6 @@ public:
|
||||
ExternalImageHandle& operator=(ExternalImageHandle const& rhs) noexcept;
|
||||
ExternalImageHandle& operator=(ExternalImageHandle&& rhs) noexcept;
|
||||
|
||||
bool operator==(const ExternalImageHandle& rhs) const noexcept {
|
||||
return mTarget == rhs.mTarget;
|
||||
}
|
||||
explicit operator bool() const noexcept { return mTarget != nullptr; }
|
||||
|
||||
ExternalImage* UTILS_NULLABLE get() noexcept { return mTarget; }
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#include <math/mat3.h>
|
||||
|
||||
#include "AndroidNativeWindow.h"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
@@ -178,30 +178,20 @@ void PlatformEGLAndroid::beginFrame(
|
||||
int64_t const monotonic_clock_ns,
|
||||
int64_t refreshIntervalNs,
|
||||
uint32_t const frameId) noexcept {
|
||||
// if frameId is 0, it means we're not associated to a particular frame, which is the case
|
||||
// for standalone views. And in this case we skip the performance hint (since we wouldn't get
|
||||
// the right timing anyway as well as the frame info timing collections)
|
||||
// associate the user frameid with the system frame id
|
||||
setPresentFrameId(mCurrentDrawSwapChain, frameId);
|
||||
|
||||
// associate the user frameid with the system frame id.
|
||||
if (frameId && mCurrentDrawSwapChain) {
|
||||
// mCurrentDrawSwapChain could be null if we're called from renderStandaloneView
|
||||
setPresentFrameId(mCurrentDrawSwapChain, frameId);
|
||||
}
|
||||
|
||||
if (frameId && mPerformanceHintSession.isValid()) {
|
||||
if (mPerformanceHintSession.isValid()) {
|
||||
if (refreshIntervalNs <= 0) {
|
||||
// we're not provided with a target time, use the display period, if everything fails,
|
||||
// assume 16.67ms
|
||||
refreshIntervalNs = 16'666'667;
|
||||
|
||||
if (mCurrentDrawSwapChain) {
|
||||
// mCurrentDrawSwapChain could be null if we're called from renderStandaloneView
|
||||
CompositorTiming compositorTiming{};
|
||||
bool const hasCompositorTiming =
|
||||
queryCompositorTiming(mCurrentDrawSwapChain, &compositorTiming);
|
||||
if (hasCompositorTiming && compositorTiming.compositeInterval > 0) {
|
||||
refreshIntervalNs = compositorTiming.compositeInterval;
|
||||
}
|
||||
CompositorTiming compositorTiming{};
|
||||
bool const hasCompositorTiming =
|
||||
queryCompositorTiming(mCurrentDrawSwapChain, &compositorTiming);
|
||||
if (hasCompositorTiming && compositorTiming.compositeInterval > 0) {
|
||||
refreshIntervalNs = compositorTiming.compositeInterval;
|
||||
}
|
||||
}
|
||||
mStartTimeOfActualWork = clock::time_point(std::chrono::nanoseconds(monotonic_clock_ns));
|
||||
@@ -450,10 +440,6 @@ Platform::SwapChain* PlatformEGLAndroid::createSwapChain(
|
||||
void PlatformEGLAndroid::destroySwapChain(SwapChain* swapChain) noexcept {
|
||||
if (swapChain) {
|
||||
SwapChainEGLAndroid* const sc = static_cast<SwapChainEGLAndroid*>(swapChain);
|
||||
if (mCurrentDrawSwapChain == sc) {
|
||||
// don't keep a dangling pointer around
|
||||
mCurrentDrawSwapChain = nullptr;
|
||||
}
|
||||
sc->terminate(*this);
|
||||
delete sc;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "VulkanCommands.h"
|
||||
#include "VulkanHandles.h"
|
||||
#include "VulkanConstants.h"
|
||||
#include "utils/compiler.h"
|
||||
|
||||
#include <utils/FixedCapacityVector.h>
|
||||
#include <utils/Panic.h>
|
||||
@@ -32,18 +31,6 @@ namespace filament::backend {
|
||||
|
||||
namespace {
|
||||
|
||||
using Bitmask = fvkutils::UniformBufferBitmask;
|
||||
static_assert(sizeof(Bitmask) * 8 == fvkutils::MAX_DESCRIPTOR_SET_BITMASK_BITS);
|
||||
|
||||
Bitmask foldBitsInHalf(Bitmask bitset) {
|
||||
Bitmask outBitset;
|
||||
bitset.forEachSetBit([&](size_t index) {
|
||||
constexpr size_t BITMASK_LOWER_BITS_LEN = sizeof(outBitset) * 4;
|
||||
outBitset.set(index % BITMASK_LOWER_BITS_LEN);
|
||||
});
|
||||
return outBitset;
|
||||
}
|
||||
|
||||
using DescriptorSetLayoutArray = VulkanDescriptorSetCache::DescriptorSetLayoutArray;
|
||||
using DescriptorCount = VulkanDescriptorSetCache::DescriptorCount;
|
||||
|
||||
@@ -317,7 +304,8 @@ void VulkanDescriptorSetCache::commit(VulkanCommandBuffer* commands,
|
||||
// This code actually binds the descriptor sets.
|
||||
auto set = updateSets[index];
|
||||
VkCommandBuffer const cmdbuffer = commands->buffer();
|
||||
VkDescriptorSet const vkset = set->getVkSet();
|
||||
VkDescriptorSet vkset = useExternalSamplers[index] ? set->getExternalSamplerVkSet() :
|
||||
set->getVkSet();
|
||||
commands->acquire(set);
|
||||
vkCmdBindDescriptorSets(cmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, index,
|
||||
1, &vkset, set->uniqueDynamicUboCount, set->getOffsets()->data());
|
||||
@@ -353,39 +341,17 @@ void VulkanDescriptorSetCache::updateBuffer(fvkmemory::resource_ptr<VulkanDescri
|
||||
.pBufferInfo = &info,
|
||||
};
|
||||
vkUpdateDescriptorSets(mDevice, 1, &descriptorWrite, 0, nullptr);
|
||||
|
||||
if (auto externalSamplerSet = set->getExternalSamplerVkSet();
|
||||
externalSamplerSet != VK_NULL_HANDLE) {
|
||||
descriptorWrite.dstSet = externalSamplerSet;
|
||||
vkUpdateDescriptorSets(mDevice, 1, &descriptorWrite, 0, nullptr);
|
||||
}
|
||||
set->acquire(bufferObject);
|
||||
}
|
||||
|
||||
void VulkanDescriptorSetCache::updateSampler(fvkmemory::resource_ptr<VulkanDescriptorSet> set,
|
||||
uint8_t binding, fvkmemory::resource_ptr<VulkanTexture> texture,
|
||||
VkSampler sampler, VkDescriptorSetLayout externalSamplerLayout) noexcept {
|
||||
|
||||
// We have to update a bound set for two use cases
|
||||
// - streaming API (a changing feed of AHardwareBuffer)
|
||||
// - external samplers - potential changing of dataspace per-frame
|
||||
if (UTILS_UNLIKELY(set->isBound())) {
|
||||
auto layout = set->getLayout();
|
||||
// Build a new descriptor set from the new layout
|
||||
auto genLayout = externalSamplerLayout != VK_NULL_HANDLE ?
|
||||
externalSamplerLayout : layout->getVkLayout();
|
||||
VkDescriptorSet const newSet = getVkSet(layout->count, genLayout);
|
||||
Bitmask const ubo = layout->bitmask.ubo | layout->bitmask.dynamicUbo;
|
||||
Bitmask samplers = layout->bitmask.sampler;
|
||||
samplers.unset(binding);
|
||||
|
||||
// Each bitmask denotes a binding index, and separated into two stages - vertex and buffer
|
||||
// We fold the two stages into just the lower half of the bits to denote a combined set of
|
||||
// bindings.
|
||||
Bitmask const copyBindings = foldBitsInHalf(ubo | samplers);
|
||||
VkDescriptorSet const srcSet = set->getVkSet();
|
||||
copySet(srcSet, newSet, copyBindings);
|
||||
set->addNewSet(newSet,
|
||||
[this, layoutCount = layout->count, genLayout, newSet](VulkanDescriptorSet*) {
|
||||
this->manualRecycle(layoutCount, genLayout, newSet);
|
||||
});
|
||||
}
|
||||
|
||||
VkDescriptorSet const vkset = set->getVkSet();
|
||||
void VulkanDescriptorSetCache::updateSamplerImpl(VkDescriptorSet vkset, uint8_t binding,
|
||||
fvkmemory::resource_ptr<VulkanTexture> texture, VkSampler sampler) noexcept {
|
||||
VkImageSubresourceRange range = texture->getPrimaryViewRange();
|
||||
VkImageViewType const expectedType = texture->getViewType();
|
||||
if (any(texture->usage & TextureUsage::DEPTH_ATTACHMENT) &&
|
||||
@@ -410,6 +376,19 @@ void VulkanDescriptorSetCache::updateSampler(fvkmemory::resource_ptr<VulkanDescr
|
||||
.pImageInfo = &info,
|
||||
};
|
||||
vkUpdateDescriptorSets(mDevice, 1, &descriptorWrite, 0, nullptr);
|
||||
}
|
||||
|
||||
void VulkanDescriptorSetCache::updateSampler(fvkmemory::resource_ptr<VulkanDescriptorSet> set,
|
||||
uint8_t binding, fvkmemory::resource_ptr<VulkanTexture> texture,
|
||||
VkSampler sampler) noexcept {
|
||||
updateSamplerImpl(set->getVkSet(), binding, texture, sampler);
|
||||
set->acquire(texture);
|
||||
}
|
||||
|
||||
void VulkanDescriptorSetCache::updateSamplerForExternalSamplerSet(
|
||||
fvkmemory::resource_ptr<VulkanDescriptorSet> set, uint8_t binding,
|
||||
fvkmemory::resource_ptr<VulkanTexture> texture) noexcept {
|
||||
updateSamplerImpl(set->getExternalSamplerVkSet(), binding, texture, VK_NULL_HANDLE);
|
||||
set->acquire(texture);
|
||||
}
|
||||
|
||||
@@ -426,7 +405,7 @@ fvkmemory::resource_ptr<VulkanDescriptorSet> VulkanDescriptorSetCache::createSet
|
||||
auto const& count = layout->count;
|
||||
auto const vklayout = layout->getVkLayout();
|
||||
auto set = fvkmemory::resource_ptr<VulkanDescriptorSet>::make(
|
||||
mResourceManager, handle, layout,
|
||||
mResourceManager, handle, layout->bitmask.dynamicUbo, layout->count.dynamicUbo,
|
||||
[vkSet, count, vklayout, this](
|
||||
VulkanDescriptorSet*) { this->manualRecycle(count, vklayout, vkSet); },
|
||||
vkSet);
|
||||
@@ -449,22 +428,4 @@ void VulkanDescriptorSetCache::manualRecycle(VulkanDescriptorSetLayout::Count co
|
||||
|
||||
void VulkanDescriptorSetCache::gc() { mStashedSets = {}; }
|
||||
|
||||
void VulkanDescriptorSetCache::copySet(VkDescriptorSet srcSet, VkDescriptorSet dstSet,
|
||||
fvkutils::SamplerBitmask bindings) const {
|
||||
// TODO: fix the size for better memory management
|
||||
std::vector<VkCopyDescriptorSet> copies;
|
||||
bindings.forEachSetBit([&](size_t index) {
|
||||
copies.push_back({
|
||||
.sType = VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET,
|
||||
.srcSet = srcSet,
|
||||
.srcBinding = (uint32_t) index,
|
||||
.dstSet = dstSet,
|
||||
.dstBinding = (uint32_t) index,
|
||||
.descriptorCount = 1,
|
||||
});
|
||||
});
|
||||
vkUpdateDescriptorSets(mDevice, 0, nullptr, copies.size(), copies.data());
|
||||
}
|
||||
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -55,8 +55,7 @@ public:
|
||||
VkDeviceSize size) noexcept;
|
||||
|
||||
void updateSampler(fvkmemory::resource_ptr<VulkanDescriptorSet> set, uint8_t binding,
|
||||
fvkmemory::resource_ptr<VulkanTexture> texture, VkSampler sampler,
|
||||
VkDescriptorSetLayout externalSamplerLayout = VK_NULL_HANDLE) noexcept;
|
||||
fvkmemory::resource_ptr<VulkanTexture> texture, VkSampler sampler) noexcept;
|
||||
|
||||
void updateSamplerForExternalSamplerSet(fvkmemory::resource_ptr<VulkanDescriptorSet> set, uint8_t binding,
|
||||
fvkmemory::resource_ptr<VulkanTexture> texture) noexcept;
|
||||
@@ -91,8 +90,8 @@ public:
|
||||
void resetCachedState() noexcept { mLastBoundInfo = {}; }
|
||||
|
||||
private:
|
||||
void copySet(VkDescriptorSet srcSet, VkDescriptorSet destSet,
|
||||
fvkutils::SamplerBitmask copyBindings) const;
|
||||
void updateSamplerImpl(VkDescriptorSet set, uint8_t binding,
|
||||
fvkmemory::resource_ptr<VulkanTexture> texture, VkSampler sampler) noexcept;
|
||||
|
||||
class DescriptorInfinitePool;
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "vulkan/memory/ResourcePointer.h"
|
||||
#include "vulkan/utils/Conversion.h"
|
||||
#include "vulkan/utils/Definitions.h"
|
||||
#include "vulkan/utils/Image.h"
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
#include <backend/platforms/VulkanPlatform.h>
|
||||
@@ -150,31 +149,6 @@ static CallbackHandler::Callback syncCallbackWrapper = [](void* userData) {
|
||||
cbData->cb(cbData->sync, cbData->userData);
|
||||
};
|
||||
|
||||
// This needs to be discussed because Vulkan has different default Matrix formats
|
||||
// right now this is following GL.
|
||||
static void copyMat3f(void* addr, size_t const offset, const math::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
|
||||
}
|
||||
|
||||
}// anonymous namespace
|
||||
|
||||
#if FVK_ENABLED(FVK_DEBUG_DEBUG_UTILS)
|
||||
@@ -270,7 +244,6 @@ VulkanDriver::VulkanDriver(VulkanPlatform* platform, VulkanContext& context,
|
||||
mQueryManager(mPlatform->getDevice()),
|
||||
mExternalImageManager(platform, &mSamplerCache, &mYcbcrConversionCache, &mDescriptorSetCache,
|
||||
&mDescriptorSetLayoutCache),
|
||||
mStreamedImageManager(&mExternalImageManager),
|
||||
mIsSRGBSwapChainSupported(mPlatform->getCustomization().isSRGBSwapChainSupported),
|
||||
mIsMSAASwapChainSupported(false), // TODO: support MSAA swapchain
|
||||
mStereoscopicType(driverConfig.stereoscopicType) {
|
||||
@@ -447,14 +420,12 @@ void VulkanDriver::beginFrame(int64_t monotonic_clock_ns,
|
||||
int64_t refreshIntervalNs, uint32_t frameId) {
|
||||
FVK_PROFILE_MARKER(PROFILE_NAME_BEGINFRAME);
|
||||
|
||||
// if frameId is 0, it means we're not associated to a particular frame, which is the case
|
||||
// for standalone views. And in this case we skip the frame info timing collection.
|
||||
if (frameId && mCurrentSwapChain) { // This should be guaranteed
|
||||
if (mCurrentSwapChain) { // This should be guaranteed
|
||||
mPlatform->setPresentFrameId(mCurrentSwapChain->swapChain, frameId);
|
||||
}
|
||||
|
||||
// Check if any command have finished and reset all its used resources. The resources
|
||||
// won't be destroyed but their reference count will be decreased if the command is already
|
||||
// wont be destroyed but their reference count will decreased if the command is already
|
||||
// completed.
|
||||
//
|
||||
// This will let us check if any VulkanBuffer is currently in flight or not.
|
||||
@@ -508,9 +479,6 @@ void VulkanDriver::updateDescriptorSetTexture(
|
||||
if (UTILS_UNLIKELY(mExternalImageManager.isExternallySampledTexture(texture))) {
|
||||
mExternalImageManager.bindExternallySampledTexture(set, binding, texture, params);
|
||||
mAppState.hasBoundExternalImages = true;
|
||||
} else if (bool(texture->getStream())) {
|
||||
mStreamedImageManager.bindStreamedTexture(set, binding, texture, params);
|
||||
mAppState.hasBoundExternalImages = true;
|
||||
} else {
|
||||
VulkanSamplerCache::Params cacheParams = {
|
||||
.sampler = params,
|
||||
@@ -518,7 +486,6 @@ void VulkanDriver::updateDescriptorSetTexture(
|
||||
VkSampler const vksampler = mSamplerCache.getSampler(cacheParams);
|
||||
mDescriptorSetCache.updateSampler(set, binding, texture, vksampler);
|
||||
mExternalImageManager.clearTextureBinding(set, binding);
|
||||
mStreamedImageManager.unbindStreamedTexture(set, binding);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1141,12 +1108,6 @@ void VulkanDriver::destroySwapChain(Handle<HwSwapChain> sch) {
|
||||
}
|
||||
|
||||
void VulkanDriver::destroyStream(Handle<HwStream> sh) {
|
||||
FVK_SYSTRACE_SCOPE();
|
||||
if (!sh) {
|
||||
return;
|
||||
}
|
||||
auto stream = resource_ptr<VulkanStream>::cast(&mResourceManager, sh);
|
||||
stream.dec();
|
||||
}
|
||||
|
||||
void VulkanDriver::destroySync(Handle<HwSync> sh) {
|
||||
@@ -1184,39 +1145,18 @@ void VulkanDriver::destroyDescriptorSet(Handle<HwDescriptorSet> dsh) {
|
||||
}
|
||||
|
||||
Handle<HwStream> VulkanDriver::createStreamNative(void* nativeStream, utils::ImmutableCString tag) {
|
||||
FILAMENT_CHECK_PRECONDITION(false) << "createStreamNative not supported in Vulkan.";
|
||||
return {};
|
||||
}
|
||||
|
||||
Handle<HwStream> VulkanDriver::createStreamAcquired(utils::ImmutableCString tag) {
|
||||
// @TODO This is still not thread-safe. We might have to revisit this question.
|
||||
FVK_SYSTRACE_SCOPE();
|
||||
auto handle = mResourceManager.allocHandle<VulkanStream>();
|
||||
auto stream = resource_ptr<VulkanStream>::make(&mResourceManager, handle);
|
||||
stream.inc();
|
||||
return handle;
|
||||
return {};
|
||||
}
|
||||
|
||||
void VulkanDriver::setAcquiredImage(Handle<HwStream> sh, void* image, const math::mat3f& transform,
|
||||
CallbackHandler* handler, StreamCallback cb, void* userData) {
|
||||
FVK_SYSTRACE_SCOPE();
|
||||
auto stream = resource_ptr<VulkanStream>::cast(&mResourceManager, sh);
|
||||
assert_invariant(stream->streamType == StreamType::ACQUIRED);
|
||||
assert_invariant(image != nullptr);
|
||||
// This covers the case where setAcquiredImage is called back to back (no updateStreams in between)
|
||||
if (stream->previousNeedsRelease()) {
|
||||
scheduleRelease(stream->takePrevious());
|
||||
}
|
||||
stream->acquire({ image, cb, userData, handler});
|
||||
stream->setFrontEndTransform(transform);
|
||||
mStreamsWithPendingAcquiredImage.push_back(stream);
|
||||
}
|
||||
|
||||
void VulkanDriver::setStreamDimensions(Handle<HwStream> sh, uint32_t width, uint32_t height) {
|
||||
FVK_SYSTRACE_SCOPE();
|
||||
auto stream = resource_ptr<VulkanStream>::cast(&mResourceManager, sh);
|
||||
stream->width = width;
|
||||
stream->height = height;
|
||||
}
|
||||
|
||||
int64_t VulkanDriver::getStreamTimestamp(Handle<HwStream> sh) {
|
||||
@@ -1224,72 +1164,6 @@ int64_t VulkanDriver::getStreamTimestamp(Handle<HwStream> sh) {
|
||||
}
|
||||
|
||||
void VulkanDriver::updateStreams(CommandStream* driver) {
|
||||
FVK_SYSTRACE_SCOPE();
|
||||
if (UTILS_UNLIKELY(!mStreamsWithPendingAcquiredImage.empty())) {
|
||||
for (auto& stream: mStreamsWithPendingAcquiredImage) {
|
||||
if (stream->previousNeedsRelease()) {
|
||||
scheduleRelease(stream->takePrevious());
|
||||
}
|
||||
|
||||
// This executes on the backend thread (updateStreams is synchonous which means it
|
||||
// executes on the user thread) Note: stream is captured by copy which is fine, this is
|
||||
// a copy of a resource_ptr<VulkanStream>. We only need it find the associated stream
|
||||
// inside the mStreamedImageManager texture bindings
|
||||
driver->queueCommand([this, stream, s = stream.get(),
|
||||
image = stream->getAcquired().image,
|
||||
transform = stream->getFrontEndTransform()]() {
|
||||
auto texture = s->getTexture(image);
|
||||
s->setBackendTransform(transform);
|
||||
if (!texture) {
|
||||
auto externalImage = fvkutils::createExternalImageFromRaw(mPlatform, image, false);
|
||||
auto metadata = mPlatform->extractExternalImageMetadata(externalImage);
|
||||
auto imgData = mPlatform->createVkImageFromExternal(externalImage);
|
||||
|
||||
assert_invariant(imgData.internal.valid() || imgData.external.valid());
|
||||
|
||||
VkFormat vkformat = metadata.format;
|
||||
VkImage vkimage = VK_NULL_HANDLE;
|
||||
VkDeviceMemory memory = VK_NULL_HANDLE;
|
||||
if (imgData.internal.valid()) {
|
||||
metadata.externalFormat = 0;
|
||||
vkimage = imgData.internal.image;
|
||||
memory = imgData.internal.memory;
|
||||
} else {
|
||||
vkformat = VK_FORMAT_UNDEFINED;
|
||||
vkimage = imgData.external.image;
|
||||
memory = imgData.external.memory;
|
||||
}
|
||||
|
||||
VkSamplerYcbcrConversion const conversion =
|
||||
mExternalImageManager.getVkSamplerYcbcrConversion(metadata);
|
||||
|
||||
auto newTexture = resource_ptr<VulkanTexture>::construct(&mResourceManager,
|
||||
mContext, mPlatform->getDevice(), mAllocator, &mResourceManager,
|
||||
&mCommands, vkimage, memory, vkformat, conversion, metadata.samples,
|
||||
metadata.width, metadata.height, metadata.layers,
|
||||
metadata.filamentUsage, mStagePool);
|
||||
|
||||
auto& commands = mCommands.get();
|
||||
// Unlike uploaded textures or swapchains, we need to explicit transition this
|
||||
// texture into the read layout.
|
||||
newTexture->transitionLayout(&commands, newTexture->getPrimaryViewRange(),
|
||||
VulkanLayout::FRAG_READ);
|
||||
|
||||
if (imgData.external.valid()) {
|
||||
mExternalImageManager.addExternallySampledTexture(newTexture,
|
||||
externalImage);
|
||||
// Cache the AHB backed image. Acquires the image here.
|
||||
s->pushImage(image, newTexture);
|
||||
}
|
||||
|
||||
texture = newTexture;
|
||||
}
|
||||
|
||||
mStreamedImageManager.onStreamAcquireImage(texture, stream);
|
||||
});
|
||||
}
|
||||
mStreamsWithPendingAcquiredImage.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanDriver::destroyFence(Handle<HwFence> fh) {
|
||||
@@ -1587,9 +1461,7 @@ void VulkanDriver::updateIndexBuffer(Handle<HwIndexBuffer> ibh, BufferDescriptor
|
||||
|
||||
void VulkanDriver::registerBufferObjectStreams(Handle<HwBufferObject> boh,
|
||||
BufferObjectStreamDescriptor&& streams) {
|
||||
|
||||
auto bo = resource_ptr<VulkanBufferObject>::cast(&mResourceManager, boh);
|
||||
mStreamUniformDescriptors[bo.get()] = std::move(streams);
|
||||
// Noop
|
||||
}
|
||||
|
||||
void VulkanDriver::updateBufferObject(Handle<HwBufferObject> boh, BufferDescriptor&& bd,
|
||||
@@ -1598,34 +1470,6 @@ void VulkanDriver::updateBufferObject(Handle<HwBufferObject> boh, BufferDescript
|
||||
|
||||
auto bo = resource_ptr<VulkanBufferObject>::cast(&mResourceManager, boh);
|
||||
commands.acquire(bo);
|
||||
|
||||
if (UTILS_UNLIKELY(!mStreamUniformDescriptors.empty())) {
|
||||
auto streamDescriptors = mStreamUniformDescriptors.find(bo.get());
|
||||
if (streamDescriptors != mStreamUniformDescriptors.end()) {
|
||||
for (auto const& [offset, streamHandle, associationType]:
|
||||
streamDescriptors->second.mStreams) {
|
||||
if (associationType == BufferObjectStreamAssociationType::TRANSFORM_MATRIX) {
|
||||
math::mat3f transform;
|
||||
if (streamHandle) {
|
||||
auto stream =
|
||||
resource_ptr<VulkanStream>::cast(&mResourceManager, streamHandle);
|
||||
if (stream->streamType == StreamType::NATIVE) {
|
||||
FILAMENT_CHECK_PRECONDITION(false)
|
||||
<< "Native Stream not supported in Vulkan.";
|
||||
} else {
|
||||
// Backend call since getStreamTransformMatrix is called from async
|
||||
// updateBufferObject.
|
||||
transform = stream->getBackEndTransform();
|
||||
}
|
||||
}
|
||||
|
||||
copyMat3f(bd.buffer, offset, transform);
|
||||
}
|
||||
}
|
||||
mStreamUniformDescriptors.erase(streamDescriptors);
|
||||
}
|
||||
}
|
||||
|
||||
bo->loadFromCpu(commands, bd.buffer, byteOffset, bd.size);
|
||||
|
||||
scheduleDestroy(std::move(bd));
|
||||
@@ -1693,12 +1537,6 @@ TimerQueryResult VulkanDriver::getTimerQueryValue(Handle<HwTimerQuery> tqh, uint
|
||||
}
|
||||
|
||||
void VulkanDriver::setExternalStream(Handle<HwTexture> th, Handle<HwStream> sh) {
|
||||
FVK_SYSTRACE_SCOPE();
|
||||
auto t = resource_ptr<VulkanTexture>::cast(&mResourceManager, th);
|
||||
assert_invariant(t);
|
||||
auto s = resource_ptr<VulkanStream>::cast(&mResourceManager, sh);
|
||||
assert_invariant(s);
|
||||
t->setStream(s);
|
||||
}
|
||||
|
||||
void VulkanDriver::generateMipmaps(Handle<HwTexture> th) {
|
||||
|
||||
@@ -34,14 +34,12 @@
|
||||
#include "vulkan/VulkanDescriptorSetCache.h"
|
||||
#include "vulkan/VulkanDescriptorSetLayoutCache.h"
|
||||
#include "vulkan/VulkanExternalImageManager.h"
|
||||
#include "vulkan/VulkanStreamedImageManager.h"
|
||||
#include "vulkan/VulkanPipelineLayoutCache.h"
|
||||
#include "vulkan/memory/ResourceManager.h"
|
||||
#include "vulkan/memory/ResourcePointer.h"
|
||||
#include "vulkan/utils/Definitions.h"
|
||||
|
||||
#include "backend/DriverEnums.h"
|
||||
#include "backend/BufferObjectStreamDescriptor.h"
|
||||
|
||||
#include "DriverBase.h"
|
||||
#include "private/backend/Driver.h"
|
||||
@@ -159,12 +157,6 @@ private:
|
||||
VulkanDescriptorSetCache mDescriptorSetCache;
|
||||
VulkanQueryManager mQueryManager;
|
||||
VulkanExternalImageManager mExternalImageManager;
|
||||
VulkanStreamedImageManager mStreamedImageManager;
|
||||
|
||||
// Stream transforms
|
||||
std::unordered_map<VulkanBufferObject*, BufferObjectStreamDescriptor> mStreamUniformDescriptors;
|
||||
math::mat3f getStreamTransformMatrix(Handle<HwStream> sh);
|
||||
|
||||
|
||||
// This maps a VulkanSwapchain to a native swapchain. VulkanSwapchain should have a copy of the
|
||||
// Platform::Swapchain pointer, but queryFrameTimestamps() and queryCompositorTiming() are
|
||||
@@ -210,10 +202,6 @@ private:
|
||||
bool const mIsSRGBSwapChainSupported;
|
||||
bool const mIsMSAASwapChainSupported;
|
||||
backend::StereoscopicType const mStereoscopicType;
|
||||
|
||||
// setAcquiredImage is a DECL_DRIVER_API_SYNCHRONOUS_N which means we don't necessarily have the
|
||||
// data to process it at call time. So we store it and process it during updateStreams.
|
||||
std::vector<resource_ptr<VulkanStream>> mStreamsWithPendingAcquiredImage;
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -31,6 +31,9 @@ namespace filament::backend {
|
||||
|
||||
namespace {
|
||||
|
||||
using Bitmask = fvkutils::UniformBufferBitmask;
|
||||
static_assert(sizeof(Bitmask) * 8 == fvkutils::MAX_DESCRIPTOR_SET_BITMASK_BITS);
|
||||
|
||||
template<typename T>
|
||||
void erasep(std::vector<T>& v, std::function<bool(T const&)> f) {
|
||||
auto newEnd = std::remove_if(v.begin(), v.end(), f);
|
||||
@@ -47,6 +50,31 @@ ImageData& findImage(std::vector<ImageData>& images,
|
||||
return *itr;
|
||||
}
|
||||
|
||||
void copySet(VkDevice device, VkDescriptorSet srcSet, VkDescriptorSet dstSet, Bitmask bindings) {
|
||||
// TODO: fix the size for better memory management
|
||||
std::vector<VkCopyDescriptorSet> copies;
|
||||
bindings.forEachSetBit([&](size_t index) {
|
||||
copies.push_back({
|
||||
.sType = VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET,
|
||||
.srcSet = srcSet,
|
||||
.srcBinding = (uint32_t) index,
|
||||
.dstSet = dstSet,
|
||||
.dstBinding = (uint32_t) index,
|
||||
.descriptorCount = 1,
|
||||
});
|
||||
});
|
||||
vkUpdateDescriptorSets(device, 0, nullptr, copies.size(), copies.data());
|
||||
}
|
||||
|
||||
Bitmask foldBitsInHalf(Bitmask bitset) {
|
||||
Bitmask outBitset;
|
||||
bitset.forEachSetBit([&](size_t index) {
|
||||
constexpr size_t BITMASK_LOWER_BITS_LEN = sizeof(outBitset) * 4;
|
||||
outBitset.set(index % BITMASK_LOWER_BITS_LEN);
|
||||
});
|
||||
return outBitset;
|
||||
}
|
||||
|
||||
}// namespace
|
||||
|
||||
VulkanExternalImageManager::VulkanExternalImageManager(VulkanPlatform* platform,
|
||||
@@ -113,9 +141,6 @@ void VulkanExternalImageManager::updateSetAndLayout(
|
||||
continue;
|
||||
}
|
||||
auto& imageData = findImage(mImages, bindingInfo.image);
|
||||
// For non YUV images (some ext images are NOT ext FMT)
|
||||
// getVkSamplerYcbcrConversion(metadata) will return NULL, and image->conversion will be
|
||||
// null
|
||||
updateImage(&imageData);
|
||||
|
||||
auto samplerParams = bindingInfo.samplerParams;
|
||||
@@ -147,14 +172,38 @@ void VulkanExternalImageManager::updateSetAndLayout(
|
||||
std::for_each(samplerAndBindings.begin(), samplerAndBindings.end(),
|
||||
[&](auto const& b) { outSamplers.push_back(std::get<1>(b)); });
|
||||
|
||||
VkDescriptorSetLayout const oldLayout = layout->getExternalSamplerVkLayout();
|
||||
VkDescriptorSetLayout const newLayout = mDescriptorSetLayoutCache->getVkLayout(layout->bitmask,
|
||||
actualExternalSamplers, outSamplers);
|
||||
layout->setExternalSamplerVkLayout(newLayout);
|
||||
|
||||
// Need to copy the set
|
||||
VkDescriptorSet const oldSet = set->getExternalSamplerVkSet();
|
||||
if (oldLayout != newLayout || oldSet == VK_NULL_HANDLE) {
|
||||
// Build a new descriptor set from the new layout
|
||||
VkDescriptorSet const newSet = mDescriptorSetCache->getVkSet(layout->count, newLayout);
|
||||
auto const ubo = layout->bitmask.ubo | layout->bitmask.dynamicUbo;
|
||||
auto const samplers = layout->bitmask.sampler & (~actualExternalSamplers);
|
||||
|
||||
// Each bitmask denotes a binding index, and separated into two stages - vertex and buffer
|
||||
// We fold the two stages into just the lower half of the bits to denote a combined set of
|
||||
// bindings.
|
||||
Bitmask const copyBindings = foldBitsInHalf(ubo | samplers);
|
||||
VkDescriptorSet const srcSet = oldSet != VK_NULL_HANDLE ? oldSet : set->getVkSet();
|
||||
copySet(mPlatform->getDevice(), srcSet, newSet, copyBindings);
|
||||
|
||||
set->setExternalSamplerVkSet(newSet,
|
||||
[&descriptorSetCache = mDescriptorSetCache, layoutCount = layout->count, newLayout,
|
||||
newSet](VulkanDescriptorSet*) {
|
||||
descriptorSetCache->manualRecycle(layoutCount, newLayout, newSet);
|
||||
});
|
||||
if (oldLayout != newLayout) {
|
||||
layout->setExternalSamplerVkLayout(newLayout);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the external samplers in the set
|
||||
for (auto& [binding, sampler, image]: samplerAndBindings) {
|
||||
// We cannot call updateSamplerForExternalSamplerSet because some samplers are non NULL
|
||||
// (RGB) and we cannot do a combined update with a NULL sampler.
|
||||
mDescriptorSetCache->updateSampler(set, binding, image, sampler, newLayout);
|
||||
mDescriptorSetCache->updateSamplerForExternalSamplerSet(set, binding, image);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,25 +261,13 @@ void VulkanExternalImageManager::bindExternallySampledTexture(
|
||||
fvkmemory::resource_ptr<VulkanTexture> image, SamplerParams samplerParams) {
|
||||
// Should we do duplicate validation here?
|
||||
auto& imageData = findImage(mImages, image);
|
||||
auto itr = std::find_if(mSetBindings.begin(), mSetBindings.end(),
|
||||
[&](SetBindingInfo const& binding) {
|
||||
return (binding.set == set && binding.binding == bindingPoint);
|
||||
});
|
||||
if (itr == mSetBindings.end()) {
|
||||
mSetBindings.push_back({ bindingPoint, imageData.image, set, samplerParams });
|
||||
} else {
|
||||
// override the image data in the binding point
|
||||
itr->image = image;
|
||||
itr->samplerParams = samplerParams;
|
||||
}
|
||||
mSetBindings.push_back({ bindingPoint, imageData.image, set, samplerParams });
|
||||
}
|
||||
|
||||
void VulkanExternalImageManager::addExternallySampledTexture(
|
||||
fvkmemory::resource_ptr<VulkanTexture> image,
|
||||
Platform::ExternalImageHandleRef platformHandleRef) {
|
||||
// By passing VK_NULL_HANDLE which is already there by default.
|
||||
// We make it clear that all default images do NOT have a chroma conversion.
|
||||
mImages.push_back({ image, platformHandleRef, false, VK_NULL_HANDLE });
|
||||
mImages.push_back({ image, platformHandleRef, false });
|
||||
}
|
||||
|
||||
void VulkanExternalImageManager::removeExternallySampledTexture(
|
||||
|
||||
@@ -31,7 +31,7 @@ class VulkanSamplerCache;
|
||||
class VulkanDescriptorSetLayoutCache;
|
||||
class VulkanDescriptorSetCache;
|
||||
|
||||
// Manages the logic of external images and their quirks wrt Vulkan.
|
||||
// Manages the logic of external images and their quirks wrt Vulikan.
|
||||
class VulkanExternalImageManager {
|
||||
public:
|
||||
|
||||
|
||||
@@ -40,11 +40,6 @@ namespace filament::backend {
|
||||
|
||||
namespace {
|
||||
|
||||
// We don't have a good estimate for this magic number. This is used to remove empty
|
||||
// slots from a descriptor set (a VulkanDescriptorset is backed by multiple
|
||||
// VkDescriptorSet.
|
||||
size_t DESCRIPTOR_SET_GC_LIMIT = 10;
|
||||
|
||||
inline VulkanBufferBinding getBufferObjectBinding(BufferObjectBinding bindingType) noexcept {
|
||||
switch (bindingType) {
|
||||
case BufferObjectBinding::VERTEX:
|
||||
@@ -197,70 +192,15 @@ VulkanDescriptorSetLayout::Bitmask VulkanDescriptorSetLayout::Bitmask::fromLayou
|
||||
return fromBackendLayout(layout);
|
||||
}
|
||||
|
||||
VulkanDescriptorSet::~VulkanDescriptorSet() {
|
||||
for (auto setBundle: mSets) {
|
||||
if (setBundle.onRecycleFn) {
|
||||
setBundle.onRecycleFn(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VulkanDescriptorSet::VulkanDescriptorSet(fvkmemory::resource_ptr<VulkanDescriptorSetLayout> layout,
|
||||
OnRecycle&& onRecycleFn, VkDescriptorSet vkSet)
|
||||
: dynamicUboMask(layout->bitmask.dynamicUbo),
|
||||
uniqueDynamicUboCount(layout->count.dynamicUbo),
|
||||
mLayout(layout),
|
||||
mCurrentSetIndex(0) {
|
||||
addNewSet(vkSet, std::move(onRecycleFn));
|
||||
}
|
||||
|
||||
// This method will store an age associated with this command buffer into the VulkanBuffer, which
|
||||
// will allow us to determine whether a barrier is necessary or not.
|
||||
void VulkanDescriptorSet::referencedBy(VulkanCommandBuffer& commands) {
|
||||
// This will store an age associated with this command buffer into the VulkanBuffer, which
|
||||
// will allow us to determine whether a barrier is necessary or not.
|
||||
mUboMask.forEachSetBit([this, &commands](size_t index) {
|
||||
auto& res = mResources[index];
|
||||
fvkmemory::resource_ptr<VulkanBufferObject> bo =
|
||||
fvkmemory::resource_ptr<VulkanBufferObject>::cast((VulkanBufferObject*) res.get());
|
||||
bo->referencedBy(commands);
|
||||
});
|
||||
mSets[mCurrentSetIndex].fenceStatus = commands.getFenceStatus();
|
||||
}
|
||||
|
||||
void VulkanDescriptorSet::gc() {
|
||||
size_t empty = 0;
|
||||
for (auto& setBundle: mSets) {
|
||||
assert_invariant(setBundle.onRecycleFn);
|
||||
if (setBundle.vkSet == VK_NULL_HANDLE) {
|
||||
empty++;
|
||||
continue;
|
||||
}
|
||||
if (setBundle.fenceStatus && setBundle.fenceStatus->getStatus() == VK_SUCCESS) {
|
||||
setBundle.onRecycleFn(this);
|
||||
setBundle.vkSet = VK_NULL_HANDLE;
|
||||
setBundle.fenceStatus = {};
|
||||
empty++;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty > DESCRIPTOR_SET_GC_LIMIT) {
|
||||
std::vector<InternalVkSet> retainedSets;
|
||||
for (auto& setBundle: mSets) {
|
||||
if (setBundle.vkSet != VK_NULL_HANDLE) {
|
||||
retainedSets.push_back({
|
||||
setBundle.vkSet,
|
||||
std::move(setBundle.onRecycleFn),
|
||||
std::move(setBundle.fenceStatus)
|
||||
});
|
||||
}
|
||||
}
|
||||
std::swap(mSets, retainedSets);
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanDescriptorSet::addNewSet(VkDescriptorSet vkSet, OnRecycle&& onRecycleFn) {
|
||||
gc();
|
||||
mCurrentSetIndex = mSets.size();
|
||||
mSets.push_back({ vkSet, std::move(onRecycleFn) });
|
||||
}
|
||||
|
||||
PushConstantDescription::PushConstantDescription(backend::Program const& program) {
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "VulkanTexture.h"
|
||||
#include "vulkan/VulkanCommands.h"
|
||||
#include "vulkan/memory/Resource.h"
|
||||
#include "vulkan/memory/ResourcePointer.h"
|
||||
#include "vulkan/utils/Definitions.h"
|
||||
#include "vulkan/utils/StaticVector.h"
|
||||
|
||||
@@ -58,8 +57,6 @@ inline uint8_t collapsedCount(Bitmask const& mask) {
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
class VulkanDescriptorSetCache;
|
||||
|
||||
struct VulkanBufferObject;
|
||||
|
||||
struct VulkanDescriptorSetLayout : public HwDescriptorSetLayout, fvkmemory::Resource {
|
||||
@@ -162,14 +159,38 @@ public:
|
||||
using OnRecycle = std::function<void(VulkanDescriptorSet*)>;
|
||||
|
||||
VulkanDescriptorSet(
|
||||
fvkmemory::resource_ptr<VulkanDescriptorSetLayout> layout,
|
||||
OnRecycle&& onRecycleFn, VkDescriptorSet vkSet);
|
||||
fvkutils::UniformBufferBitmask const& dynamicUboMask,
|
||||
uint8_t uniqueDynamicUboCount,
|
||||
OnRecycle&& onRecycleFn, VkDescriptorSet vkSet)
|
||||
: dynamicUboMask(dynamicUboMask),
|
||||
uniqueDynamicUboCount(uniqueDynamicUboCount),
|
||||
mVkSet(vkSet),
|
||||
mOnRecycleFn(std::move(onRecycleFn)) {}
|
||||
|
||||
// NOLINTNEXTLINE(bugprone-exception-escape)
|
||||
~VulkanDescriptorSet();
|
||||
~VulkanDescriptorSet() {
|
||||
if (mOnRecycleFn) {
|
||||
mOnRecycleFn(this);
|
||||
}
|
||||
if (mOnRecycleExternalSamplerFn) {
|
||||
mOnRecycleExternalSamplerFn(this);
|
||||
}
|
||||
}
|
||||
|
||||
VkDescriptorSet getVkSet() const noexcept {
|
||||
return mSets[mCurrentSetIndex].vkSet;
|
||||
return mVkSet;
|
||||
}
|
||||
|
||||
VkDescriptorSet getExternalSamplerVkSet() const noexcept {
|
||||
return mExternalSamplerVkSet;
|
||||
}
|
||||
|
||||
void setExternalSamplerVkSet(VkDescriptorSet vkset, OnRecycle onRecycle) {
|
||||
mExternalSamplerVkSet = vkset;
|
||||
if (mOnRecycleExternalSamplerFn) {
|
||||
mOnRecycleExternalSamplerFn(this);
|
||||
}
|
||||
mOnRecycleExternalSamplerFn = onRecycle;
|
||||
}
|
||||
|
||||
void setOffsets(backend::DescriptorSetOffsetArray&& offsets) noexcept {
|
||||
@@ -190,33 +211,17 @@ public:
|
||||
|
||||
void referencedBy(VulkanCommandBuffer& commands);
|
||||
|
||||
bool isBound() const {
|
||||
return bool(mSets[mCurrentSetIndex].fenceStatus);
|
||||
}
|
||||
|
||||
fvkmemory::resource_ptr<VulkanDescriptorSetLayout> getLayout() const { return mLayout; }
|
||||
|
||||
fvkutils::UniformBufferBitmask const& dynamicUboMask;
|
||||
fvkutils::UniformBufferBitmask const dynamicUboMask;
|
||||
uint8_t const uniqueDynamicUboCount;
|
||||
|
||||
private:
|
||||
friend class VulkanDescriptorSetCache;
|
||||
VkDescriptorSet const mVkSet;
|
||||
VkDescriptorSet mExternalSamplerVkSet = VK_NULL_HANDLE;
|
||||
|
||||
void addNewSet(VkDescriptorSet vkSet, OnRecycle&& onRecycleFn);
|
||||
|
||||
void gc();
|
||||
|
||||
struct InternalVkSet {
|
||||
VkDescriptorSet vkSet = {};
|
||||
OnRecycle onRecycleFn;
|
||||
std::shared_ptr<VulkanCmdFence> fenceStatus;
|
||||
};
|
||||
|
||||
fvkmemory::resource_ptr<VulkanDescriptorSetLayout> mLayout;
|
||||
backend::DescriptorSetOffsetArray mOffsets;
|
||||
std::vector<fvkmemory::resource_ptr<fvkmemory::Resource>> mResources;
|
||||
uint8_t mCurrentSetIndex;
|
||||
std::vector<InternalVkSet> mSets;
|
||||
OnRecycle mOnRecycleFn;
|
||||
OnRecycle mOnRecycleExternalSamplerFn;
|
||||
fvkutils::UniformBufferBitmask mUboMask;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* 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 "VulkanStreamedImageManager.h"
|
||||
|
||||
#include "VulkanDescriptorSetCache.h"
|
||||
#include "VulkanExternalImageManager.h"
|
||||
#include "VulkanDescriptorSetLayoutCache.h"
|
||||
#include "VulkanSamplerCache.h"
|
||||
|
||||
namespace filament::backend {
|
||||
VulkanStreamedImageManager::VulkanStreamedImageManager(VulkanExternalImageManager* manager)
|
||||
: mExternalImageManager(manager) {}
|
||||
|
||||
VulkanStreamedImageManager::~VulkanStreamedImageManager() = default;
|
||||
|
||||
void VulkanStreamedImageManager::terminate() { mStreamedTexturesBindings.clear(); }
|
||||
|
||||
void VulkanStreamedImageManager::bindStreamedTexture(
|
||||
fvkmemory::resource_ptr<VulkanDescriptorSet> set,
|
||||
uint8_t bindingPoint, fvkmemory::resource_ptr<VulkanTexture> image,
|
||||
SamplerParams samplerParams) {
|
||||
mStreamedTexturesBindings.push_back({ bindingPoint, image, set, samplerParams });
|
||||
}
|
||||
|
||||
void VulkanStreamedImageManager::unbindStreamedTexture(
|
||||
fvkmemory::resource_ptr<VulkanDescriptorSet> set,
|
||||
uint8_t bindingPoint) {
|
||||
auto iter = std::remove_if(mStreamedTexturesBindings.begin(), mStreamedTexturesBindings.end(),
|
||||
[&](StreamedTextureBinding& binding) {
|
||||
return ((binding.set == set) && (binding.binding == bindingPoint));
|
||||
});
|
||||
mStreamedTexturesBindings.erase(iter, mStreamedTexturesBindings.end());
|
||||
}
|
||||
|
||||
void VulkanStreamedImageManager::onStreamAcquireImage(fvkmemory::resource_ptr<VulkanTexture> image,
|
||||
fvkmemory::resource_ptr<VulkanStream> stream) {
|
||||
for (StreamedTextureBinding const& data: mStreamedTexturesBindings) {
|
||||
// Find the right stream
|
||||
if (data.image->getStream() == stream) {
|
||||
mExternalImageManager->bindExternallySampledTexture(data.set, data.binding, image,
|
||||
data.samplerParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace filament::backend
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_CACHING_VULKANSTREAMEDIMAGEMANAGER_H
|
||||
#define TNT_FILAMENT_BACKEND_CACHING_VULKANSTREAMEDIMAGEMANAGER_H
|
||||
|
||||
#include "VulkanHandles.h"
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
class VulkanExternalImageManager;
|
||||
class VulkanDescriptorSetCache;
|
||||
class VulkanSamplerCache;
|
||||
|
||||
// Manages the logic of streamed images.
|
||||
class VulkanStreamedImageManager {
|
||||
public:
|
||||
VulkanStreamedImageManager(
|
||||
VulkanExternalImageManager* manager);
|
||||
~VulkanStreamedImageManager();
|
||||
void terminate();
|
||||
|
||||
public:
|
||||
void bindStreamedTexture(fvkmemory::resource_ptr<VulkanDescriptorSet> set, uint8_t bindingPoint,
|
||||
fvkmemory::resource_ptr<VulkanTexture> image, SamplerParams samplerParams);
|
||||
void unbindStreamedTexture(fvkmemory::resource_ptr<VulkanDescriptorSet> set,
|
||||
uint8_t bindingPoint);
|
||||
void onStreamAcquireImage(fvkmemory::resource_ptr<VulkanTexture> image,
|
||||
fvkmemory::resource_ptr<VulkanStream> stream);
|
||||
|
||||
private:
|
||||
struct StreamedTextureBinding {
|
||||
uint8_t binding = 0;
|
||||
fvkmemory::resource_ptr<VulkanTexture> image;
|
||||
fvkmemory::resource_ptr<VulkanDescriptorSet> set;
|
||||
SamplerParams samplerParams;
|
||||
};
|
||||
// keep track of all the stream bindings
|
||||
std::vector<StreamedTextureBinding> mStreamedTexturesBindings;
|
||||
|
||||
VulkanExternalImageManager* mExternalImageManager;
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_CACHING_VULKANSTREAMEDIMAGEMANAGER_H
|
||||
@@ -36,49 +36,6 @@ namespace filament::backend {
|
||||
|
||||
struct VulkanTexture;
|
||||
|
||||
struct VulkanStream : public HwStream, fvkmemory::Resource {
|
||||
|
||||
//-- These methods are only called from the frontend
|
||||
void acquire(const AcquiredImage& image) {
|
||||
user_thread.mPrevious = user_thread.mAcquired;
|
||||
user_thread.mAcquired = image;
|
||||
}
|
||||
bool previousNeedsRelease() const { return (user_thread.mPrevious.image != nullptr); }
|
||||
// this function will null the previous once the caller takes it.
|
||||
// It ensures we don't schedule for release twice.
|
||||
AcquiredImage takePrevious() {
|
||||
AcquiredImage previous = user_thread.mPrevious;
|
||||
user_thread.mPrevious = {};
|
||||
return previous;
|
||||
}
|
||||
const AcquiredImage& getAcquired() const { return user_thread.mAcquired; }
|
||||
void setFrontEndTransform(const math::mat3f& transform) { user_thread.mTransform = transform; }
|
||||
const math::mat3f& getFrontEndTransform() const { return user_thread.mTransform; }
|
||||
|
||||
//-- These methods are only called from the backend thread
|
||||
void setBackendTransform(const math::mat3f& transform) { mTransform = transform; }
|
||||
const math::mat3f& getBackEndTransform() const { return mTransform; }
|
||||
fvkmemory::resource_ptr<VulkanTexture> getTexture(void* ahb) {
|
||||
if (auto itr = mTextures.find(ahb); itr != mTextures.end()) {
|
||||
return itr->second;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
void pushImage(void* ahb, fvkmemory::resource_ptr<VulkanTexture> tex) { mTextures[ahb] = tex; }
|
||||
|
||||
private:
|
||||
// These are only called from the frontend
|
||||
struct {
|
||||
AcquiredImage mAcquired;
|
||||
AcquiredImage mPrevious;
|
||||
math::mat3f mTransform;
|
||||
} user_thread;
|
||||
|
||||
// #TODO b/442937292
|
||||
math::mat3f mTransform;
|
||||
std::unordered_map<void*, fvkmemory::resource_ptr<VulkanTexture>> mTextures;
|
||||
};
|
||||
|
||||
struct VulkanTextureState : public fvkmemory::Resource {
|
||||
VulkanTextureState(VulkanStagePool& stagePool, VulkanCommands* commands, VmaAllocator allocator,
|
||||
VkDevice device, VkImage image, VkDeviceMemory deviceMemory, VkFormat format,
|
||||
@@ -117,8 +74,6 @@ private:
|
||||
|
||||
// The texture with the sidecar owns the sidecar.
|
||||
fvkmemory::resource_ptr<VulkanTexture> mSidecarMSAA;
|
||||
// The stream this texture is associated with.
|
||||
fvkmemory::resource_ptr<VulkanStream> mStream;
|
||||
|
||||
VkImage const mTextureImage;
|
||||
VkDeviceMemory const mTextureImageMemory;
|
||||
@@ -150,7 +105,6 @@ private:
|
||||
using ImageViewHash = utils::hash::MurmurHashFn<ImageViewKey>;
|
||||
std::unordered_map<ImageViewKey, VkImageView, ImageViewHash> mCachedImageViews;
|
||||
|
||||
|
||||
friend struct VulkanTexture;
|
||||
};
|
||||
|
||||
@@ -228,14 +182,6 @@ struct VulkanTexture : public HwTexture, fvkmemory::Resource {
|
||||
return mState->mSidecarMSAA;
|
||||
}
|
||||
|
||||
void setStream(fvkmemory::resource_ptr<VulkanStream> stream) {
|
||||
mState->mStream = stream;
|
||||
}
|
||||
|
||||
fvkmemory::resource_ptr<VulkanStream> getStream() const {
|
||||
return mState->mStream;
|
||||
}
|
||||
|
||||
bool isTransientAttachment() const {
|
||||
return mState->mUsage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ template ResourceType getTypeEnum<VulkanBuffer>() noexcept;
|
||||
template ResourceType getTypeEnum<VulkanSync>() noexcept;
|
||||
template ResourceType getTypeEnum<VulkanMemoryMappedBuffer>() noexcept;
|
||||
template ResourceType getTypeEnum<VulkanSemaphore>() noexcept;
|
||||
template ResourceType getTypeEnum<VulkanStream>() noexcept;
|
||||
|
||||
template<typename D>
|
||||
ResourceType getTypeEnum() noexcept {
|
||||
@@ -105,9 +104,6 @@ ResourceType getTypeEnum() noexcept {
|
||||
if constexpr (std::is_same_v<D, VulkanSemaphore>) {
|
||||
return ResourceType::SEMAPHORE;
|
||||
}
|
||||
if constexpr (std::is_same_v<D, VulkanStream>) {
|
||||
return ResourceType::STREAM;
|
||||
}
|
||||
return ResourceType::UNDEFINED_TYPE;
|
||||
}
|
||||
|
||||
@@ -153,8 +149,6 @@ std::string_view getTypeStr(ResourceType type) {
|
||||
return "VulkanMemoryMappedBuffer";
|
||||
case ResourceType::SEMAPHORE:
|
||||
return "Semaphore";
|
||||
case ResourceType::STREAM:
|
||||
return "VulkanStream";
|
||||
case ResourceType::UNDEFINED_TYPE:
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -55,8 +55,7 @@ enum class ResourceType : uint8_t {
|
||||
SYNC = 17,
|
||||
MEMORY_MAPPED_BUFFER = 18,
|
||||
SEMAPHORE = 19,
|
||||
STREAM = 20,
|
||||
UNDEFINED_TYPE = 21, // Must be the last enum because we use it for iterating over the enums.
|
||||
UNDEFINED_TYPE = 20, // Must be the last enum because we use it for iterating over the enums.
|
||||
};
|
||||
|
||||
template<typename D>
|
||||
|
||||
@@ -123,9 +123,6 @@ void ResourceManager::destroyWithType(ResourceType type, HandleId id) {
|
||||
case ResourceType::SEMAPHORE:
|
||||
destruct<VulkanSemaphore>(Handle<VulkanSemaphore>(id));
|
||||
break;
|
||||
case ResourceType::STREAM:
|
||||
destruct<VulkanStream>(Handle<VulkanStream>(id));
|
||||
break;
|
||||
case ResourceType::UNDEFINED_TYPE:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -18,12 +18,6 @@
|
||||
|
||||
#include "vulkan/VulkanTexture.h"
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#include "backend/platforms/VulkanPlatformAndroid.h"
|
||||
#include <android/hardware_buffer.h>
|
||||
#include <android/native_window.h>
|
||||
#endif
|
||||
|
||||
#include <utils/Panic.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/debug.h>
|
||||
@@ -240,19 +234,6 @@ uint8_t reduceSampleCount(uint8_t sampleCount, VkSampleCountFlags mask) {
|
||||
return mostSignificantBit((sampleCount - 1) & mask);
|
||||
}
|
||||
|
||||
filament::backend::Platform::ExternalImageHandle createExternalImageFromRaw(
|
||||
filament::backend::VulkanPlatform* platform, void* image, bool sRGB) {
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
if (__builtin_available(android 26, *)) {
|
||||
return static_cast<filament::backend::VulkanPlatformAndroid*>(platform)
|
||||
->createExternalImage(reinterpret_cast<AHardwareBuffer const*>(image), sRGB);
|
||||
}
|
||||
#endif
|
||||
return {};
|
||||
|
||||
}
|
||||
|
||||
} // namespace filament::backend::fvkutils
|
||||
|
||||
bool operator<(const VkImageSubresourceRange& a, const VkImageSubresourceRange& b) {
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#define TNT_FILAMENT_BACKEND_VULKAN_UTILS_IMAGE_H
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
#include <backend/platforms/VulkanPlatform.h>
|
||||
|
||||
#include <utils/Log.h>
|
||||
|
||||
@@ -107,9 +106,6 @@ VkImageAspectFlags getImageAspect(VkFormat format);
|
||||
|
||||
uint8_t reduceSampleCount(uint8_t sampleCount, VkSampleCountFlags mask);
|
||||
|
||||
Platform::ExternalImageHandle createExternalImageFromRaw(filament::backend::VulkanPlatform* platform,
|
||||
void* image,
|
||||
bool sRGB);
|
||||
} // namespace fvkutils
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -780,7 +780,7 @@ public:
|
||||
bool assert_texture_can_generate_mipmap = CORRECTNESS_ASSERTION_DEFAULT;
|
||||
} debug;
|
||||
struct {
|
||||
bool disable_gpu_frame_complete_metric = true;
|
||||
bool disable_gpu_frame_complete_metric = false;
|
||||
} frame_info;
|
||||
} engine;
|
||||
struct {
|
||||
|
||||
@@ -571,6 +571,7 @@ void FRenderer::renderStandaloneView(FView const* view) {
|
||||
|
||||
if (UTILS_LIKELY(view->getScene())) {
|
||||
mPreviousRenderTargets.clear();
|
||||
mFrameId++;
|
||||
|
||||
// ask the engine to do what it needs to (e.g. updates light buffer, materials...)
|
||||
FEngine& engine = mEngine;
|
||||
@@ -580,7 +581,8 @@ void FRenderer::renderStandaloneView(FView const* view) {
|
||||
driver.beginFrame(
|
||||
steady_clock::now().time_since_epoch().count(),
|
||||
mDisplayInfo.refreshRate == 0.0 ? 0 : int64_t(
|
||||
1'000'000'000.0 / mDisplayInfo.refreshRate), 0);
|
||||
1'000'000'000.0 / mDisplayInfo.refreshRate),
|
||||
mFrameId);
|
||||
|
||||
// because we don't have a "present" call, we use flush so the driver can submit
|
||||
// the command buffer; we do this before driver.endFrame() to mimic what would
|
||||
@@ -589,7 +591,7 @@ void FRenderer::renderStandaloneView(FView const* view) {
|
||||
|
||||
engine.submitFrame();
|
||||
|
||||
driver.endFrame(0);
|
||||
driver.endFrame(mFrameId);
|
||||
|
||||
// engine.flush() has already been called by renderInternal(), but we need an extra one
|
||||
// for endFrame() above. This operation in actually not too heavy, it just kicks the
|
||||
|
||||
@@ -209,7 +209,7 @@ private:
|
||||
backend::Handle<backend::HwRenderTarget> mRenderTargetHandle;
|
||||
FSwapChain* mSwapChain = nullptr;
|
||||
size_t mCommandsHighWatermark = 0;
|
||||
uint32_t mFrameId = 1; // id 0 is reserved for standalone views
|
||||
uint32_t mFrameId = 0;
|
||||
FrameInfoManager mFrameInfoManager;
|
||||
backend::TextureFormat mHdrTranslucent;
|
||||
backend::TextureFormat mHdrQualityMedium;
|
||||
|
||||
@@ -39,7 +39,7 @@ using allocation_size_t = BufferAllocator::allocation_size_t;
|
||||
// FenceManager
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
void UboManager::FenceManager::track(DriverApi& driver, AllocationIdContainer&& allocationIds) {
|
||||
void UboManager::FenceManager::track(DriverApi& driver, std::unordered_set<AllocationId>&& allocationIds) {
|
||||
if (allocationIds.empty()) {
|
||||
return;
|
||||
}
|
||||
@@ -159,16 +159,15 @@ void UboManager::finishBeginFrame(DriverApi& driver) {
|
||||
}
|
||||
|
||||
void UboManager::endFrame(DriverApi& driver) {
|
||||
auto allocationIds =
|
||||
FenceManager::AllocationIdContainer::with_capacity(mManagedInstances.size());
|
||||
for (const auto* mi: mManagedInstances) {
|
||||
std::unordered_set<AllocationId> allocationIds;
|
||||
for (const auto* mi : mManagedInstances) {
|
||||
const AllocationId id = mi->getAllocationId();
|
||||
if (UTILS_UNLIKELY(!BufferAllocator::isValid(id))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mAllocator.acquireGpu(id);
|
||||
allocationIds.push_back(id);
|
||||
allocationIds.insert(id);
|
||||
}
|
||||
|
||||
mFenceManager.track(driver, std::move(allocationIds));
|
||||
|
||||
@@ -55,7 +55,6 @@ public:
|
||||
class FenceManager {
|
||||
public:
|
||||
using AllocationId = BufferAllocator::AllocationId;
|
||||
using AllocationIdContainer = utils::FixedCapacityVector<AllocationId>;
|
||||
|
||||
FenceManager() = default;
|
||||
~FenceManager() = default;
|
||||
@@ -66,7 +65,7 @@ public:
|
||||
|
||||
// Creates a new fence to track a set of allocation IDs for the current frame.
|
||||
// This marks the beginning of GPU's usage of these resources.
|
||||
void track(backend::DriverApi& driver, AllocationIdContainer&& allocationIds);
|
||||
void track(backend::DriverApi& driver, std::unordered_set<AllocationId>&& allocationIds);
|
||||
|
||||
|
||||
// Checks all tracked fences and invokes a callback for resources associated with
|
||||
@@ -81,7 +80,7 @@ public:
|
||||
private:
|
||||
// Not ideal, but we need to know which slots to decrement gpuUseCount for each frame.
|
||||
using FenceAndAllocations =
|
||||
std::pair<backend::Handle<backend::HwFence>, AllocationIdContainer>;
|
||||
std::pair<backend::Handle<backend::HwFence>, std::unordered_set<AllocationId>>;
|
||||
std::vector<FenceAndAllocations> mFenceAllocationList;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = "Filament"
|
||||
spec.version = "1.68.1"
|
||||
spec.version = "1.67.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.68.1/filament-v1.68.1-ios.tgz" }
|
||||
spec.source = { :http => "https://github.com/google/filament/releases/download/v1.67.1/filament-v1.67.1-ios.tgz" }
|
||||
|
||||
# Fix linking error with Xcode 12; we do not yet support the simulator on Apple silicon.
|
||||
spec.pod_target_xcconfig = {
|
||||
|
||||
@@ -37,13 +37,10 @@ set(SRCS
|
||||
src/IcoSphere.cpp
|
||||
src/MeshAssimp.cpp
|
||||
src/Sphere.cpp
|
||||
src/VulkanPlatformHelper.cpp
|
||||
src/KeyInputConversion.h
|
||||
)
|
||||
|
||||
if (FILAMENT_SUPPORTS_VULKAN)
|
||||
list(APPEND SRCS src/VulkanPlatformHelper.cpp)
|
||||
endif()
|
||||
|
||||
set(LIBS
|
||||
assimp
|
||||
camutils
|
||||
@@ -83,11 +80,7 @@ endif()
|
||||
|
||||
if (WIN32)
|
||||
list(APPEND SRCS src/NativeWindowHelperWindows.cpp)
|
||||
|
||||
if (FILAMENT_SUPPORTS_VULKAN)
|
||||
list(APPEND SRCS src/VulkanPlatformHelperWindows.cpp)
|
||||
endif()
|
||||
|
||||
list(APPEND SRCS src/VulkanPlatformHelperWindows.cpp)
|
||||
list(APPEND LIBS sdl2main)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -290,12 +290,12 @@ void FilamentApp::run(const Config& config, SetupCallback setupCallback,
|
||||
case SDL_KEYDOWN: {
|
||||
SDL_Scancode const scancode = event->key.keysym.scancode;
|
||||
SDL_Keycode const keycode = event->key.keysym.sym;
|
||||
io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
|
||||
io.KeyAlt = ((SDL_GetModState() & KMOD_ALT) != 0);
|
||||
io.KeyCtrl = ((SDL_GetModState() & KMOD_CTRL) != 0);
|
||||
io.KeySuper = ((SDL_GetModState() & KMOD_GUI) != 0);
|
||||
|
||||
auto modState = SDL_GetModState();
|
||||
io.AddKeyEvent(ImGuiMod_Ctrl, (modState & KMOD_CTRL) != 0);
|
||||
io.AddKeyEvent(ImGuiMod_Shift, (modState & KMOD_SHIFT) != 0);
|
||||
io.AddKeyEvent(ImGuiMod_Alt, (modState & KMOD_ALT) != 0);
|
||||
io.AddKeyEvent(ImGuiMod_Super, (modState & KMOD_GUI) != 0);
|
||||
utils::slog.e <<"control=" << io.KeyCtrl << utils::io::endl;
|
||||
io.AddKeyEvent(
|
||||
filamentapp_utils::ImGui_ImplSDL2_KeyEventToImGuiKey(keycode, scancode),
|
||||
event->type == SDL_KEYDOWN);
|
||||
|
||||
@@ -65,7 +65,6 @@ public:
|
||||
// Creates an Invocable that does not contain a functor.
|
||||
// Will evaluate to false.
|
||||
Invocable() = default;
|
||||
Invocable(std::nullptr_t) noexcept {}
|
||||
|
||||
~Invocable() noexcept;
|
||||
|
||||
@@ -78,7 +77,6 @@ public:
|
||||
|
||||
Invocable& operator=(const Invocable&) = delete;
|
||||
Invocable& operator=(Invocable&& rhs) noexcept;
|
||||
Invocable& operator=(std::nullptr_t) noexcept;
|
||||
|
||||
// Invokes the invocable with the args passed in.
|
||||
// If the Invocable is empty, this will assert.
|
||||
@@ -143,17 +141,6 @@ Invocable<R(Args...)>& Invocable<R(Args...)>::operator=(Invocable&& rhs) noexcep
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename R, typename... Args>
|
||||
Invocable<R(Args...)>& Invocable<R(Args...)>::operator=(std::nullptr_t) noexcept {
|
||||
if (mDeleter) {
|
||||
mDeleter(mInvocable);
|
||||
}
|
||||
mInvocable = nullptr;
|
||||
mDeleter = nullptr;
|
||||
mInvoker = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename R, typename... Args>
|
||||
template<typename... OperatorArgs>
|
||||
R Invocable<R(Args...)>::operator()(OperatorArgs&& ... args) {
|
||||
|
||||
@@ -55,10 +55,7 @@ AsyncJobQueue::AsyncJobQueue(const char* name, Priority priority) {
|
||||
}
|
||||
|
||||
AsyncJobQueue::~AsyncJobQueue() noexcept {
|
||||
// wait for all pending callbacks to be called & terminate the thread
|
||||
drainAndExit();
|
||||
#if !defined(__EMSCRIPTEN__)
|
||||
assert_invariant(!mThread.joinable());
|
||||
assert_invariant(mQueue.empty());
|
||||
#endif
|
||||
}
|
||||
@@ -97,9 +94,6 @@ bool AsyncJobQueue::isValid() const noexcept {
|
||||
void AsyncJobQueue::drainAndExit() {
|
||||
#if !defined(__EMSCRIPTEN__)
|
||||
std::unique_lock lock(mLock);
|
||||
if (mExitRequested) {
|
||||
return;
|
||||
}
|
||||
// we request the service thread to exit, but we're guaranteed that it'll only exit
|
||||
// after all current callbacks are processed. In addition, once mExitRequested is set,
|
||||
// no new jobs can be added, so we can join the thread.
|
||||
|
||||
@@ -618,7 +618,7 @@ void ViewerGui::mouseEvent(float mouseX, float mouseY, bool mouseButton, float m
|
||||
io.MouseDown[0] = mouseButton != 0;
|
||||
io.MouseDown[1] = false;
|
||||
io.MouseDown[2] = false;
|
||||
io.AddKeyEvent(ImGuiMod_Ctrl, control);
|
||||
io.KeyCtrl = control;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,4 +10,4 @@ MarkupSafe==3.0.2
|
||||
requests==2.32.5
|
||||
urllib3==2.5.0
|
||||
waitress==3.0.2
|
||||
Werkzeug==3.1.4
|
||||
Werkzeug==3.1.3
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "filament",
|
||||
"version": "1.68.1",
|
||||
"version": "1.67.1",
|
||||
"description": "Real-time physically based rendering engine",
|
||||
"main": "filament.js",
|
||||
"module": "filament.js",
|
||||
|
||||
Reference in New Issue
Block a user