Compare commits

..

1 Commits

Author SHA1 Message Date
Run Yu
d105dc01b1 This is a test for pushing branch to github 2025-10-17 16:16:15 -04:00
28 changed files with 146 additions and 174 deletions

View File

@@ -31,7 +31,7 @@ repositories {
}
dependencies {
implementation 'com.google.android.filament:filament-android:1.66.2'
implementation 'com.google.android.filament:filament-android:1.66.0'
}
```
@@ -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.66.2'
pod 'Filament', '~> 1.66.0'
```
## Documentation

View File

@@ -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.66.2
## v1.66.1
- filamat: Removed a dependency on Glslang's deprecated SPIR-V remapper.

View File

@@ -1,5 +1,5 @@
GROUP=com.google.android.filament
VERSION_NAME=1.66.2
VERSION_NAME=1.66.0
POM_DESCRIPTION=Real-time physically based rendering engine for Android.

View File

@@ -32,27 +32,25 @@ namespace filament::backend {
FenceStatus VulkanCmdFence::wait(VkDevice device, uint64_t const timeout,
std::chrono::steady_clock::time_point const until) {
{
std::shared_lock l(mLock);
std::shared_lock l(mLock);
// If the vulkan fence has not been submitted yet, we need to wait for that before we
// can use vkWaitForFences()
if (mStatus == VK_INCOMPLETE) {
bool const success = mCond.wait_until(l, until, [this] {
// Internally we use the VK_INCOMPLETE status to mean "not yet submitted".
// When this fence gets submitted, its status changes to VK_NOT_READY.
return mStatus != VK_INCOMPLETE;
});
if (!success) {
// !success indicates a timeout
return FenceStatus::TIMEOUT_EXPIRED;
}
// If the vulkan fence has not been submitted yet, we need to wait for that before we
// can use vkWaitForFences()
if (mStatus == VK_INCOMPLETE) {
bool const success = mCond.wait_until(l, until, [this] {
// Internally we use the VK_INCOMPLETE status to mean "not yet submitted".
// When this fence gets submitted, its status changes to VK_NOT_READY.
return mStatus != VK_INCOMPLETE;
});
if (!success) {
// !success indicates a timeout
return FenceStatus::TIMEOUT_EXPIRED;
}
}
// The fence could have already signaled, avoid calling into vkWaitForFences()
if (mStatus == VK_SUCCESS) {
return FenceStatus::CONDITION_SATISFIED;
}
// The fence could have already signaled, avoid calling into vkWaitForFences()
if (mStatus == VK_SUCCESS) {
return FenceStatus::CONDITION_SATISFIED;
}
// If we're here, we know that vkQueueSubmit has been called (because it sets the status
@@ -62,17 +60,13 @@ FenceStatus VulkanCmdFence::wait(VkDevice device, uint64_t const timeout,
// place simultaneously. vkResetFence is only called once it knows the fence has signaled,
// which guaranties that vkResetFence won't have to wait too long, just enough for
// all the vkWaitForFences() to return.
VkResult status = vkWaitForFences(device, 1, &mFence, VK_TRUE, timeout);
if (status == VK_TIMEOUT) {
return FenceStatus::TIMEOUT_EXPIRED;
}
if (status == VK_SUCCESS) {
std::lock_guard const l(mLock);
mStatus = status;
mStatus = vkWaitForFences(device, 1, &mFence, VK_TRUE, timeout);
if (mStatus == VK_SUCCESS) {
return FenceStatus::CONDITION_SATISFIED;
}
if (mStatus == VK_TIMEOUT) {
return FenceStatus::TIMEOUT_EXPIRED;
}
return FenceStatus::ERROR; // not supported
}

View File

@@ -1171,12 +1171,7 @@ FenceStatus VulkanDriver::fenceWait(FenceHandle const fh, uint64_t const timeout
using namespace std::chrono;
auto const now = steady_clock::now();
steady_clock::time_point until = steady_clock::time_point::max();
using TimeoutType = decltype(timeout);
constexpr TimeoutType maxTimeout = std::numeric_limits<TimeoutType>::max();
constexpr nanoseconds maxNano = nanoseconds::max();
if (timeout < maxNano.count() && timeout < maxTimeout && // Need to account for overflow
now <= steady_clock::time_point::max() - nanoseconds(timeout)) {
if (now <= steady_clock::time_point::max() - nanoseconds(timeout)) {
until = now + nanoseconds(timeout);
}

View File

@@ -267,8 +267,8 @@ void VulkanPipelineCache::bindVertexArray(VkVertexInputAttributeDescription cons
mPipelineRequirements.vertexAttributes[i] = attribDesc[i];
mPipelineRequirements.vertexBuffers[i] = bufferDesc[i];
} else {
mPipelineRequirements.vertexAttributes[i] = VertexInputAttributeDescription{};
mPipelineRequirements.vertexBuffers[i] = VertexInputBindingDescription{};
mPipelineRequirements.vertexAttributes[i] = {};
mPipelineRequirements.vertexBuffers[i] = {};
}
}
}

View File

@@ -149,7 +149,7 @@ VulkanStage* VulkanStagePool::allocateNewStage(uint32_t capacity) {
return new VulkanStage(memory, buffer, capacity, pMapping);
}
void VulkanStagePool::destroyStage(VulkanStage const* stage) {
void VulkanStagePool::destroyStage(VulkanStage const*&& stage) {
assert(stage->isSafeToReset()); // Ensure all segments have been reset already.
vmaUnmapMemory(mAllocator, stage->memory());
vmaDestroyBuffer(mAllocator, stage->buffer(), stage->memory());
@@ -196,7 +196,7 @@ fvkmemory::resource_ptr<VulkanStageImage::Resource> VulkanStagePool::acquireImag
VkImage image;
VmaAllocation memory;
UTILS_UNUSED const VkResult result = vmaCreateImage(mAllocator, &imageInfo, &allocInfo,
const UTILS_UNUSED VkResult result = vmaCreateImage(mAllocator, &imageInfo, &allocInfo,
&image, &memory, nullptr);
assert_invariant(result == VK_SUCCESS);
@@ -239,7 +239,7 @@ void VulkanStagePool::gc() noexcept {
FVK_LOGD << "Destroying a staging buffer with hndl " << pair.second->buffer()
<< utils::io::endl;
#endif
destroyStage(pair.second);
destroyStage(std::move(pair.second));
continue;
}
@@ -276,7 +276,7 @@ void VulkanStagePool::gc() noexcept {
void VulkanStagePool::terminate() noexcept {
for (auto& pair : mStages) {
destroyStage(pair.second);
destroyStage(std::move(pair.second));
}
mStages.clear();

View File

@@ -245,7 +245,7 @@ private:
// unmapping memory, freeing the allocation, and deleting the VulkanStage
// object. Note: takes an r-value because after this call, `stage` won't
// exist.
void destroyStage(VulkanStage const* stage);
void destroyStage(VulkanStage const*&& stage);
// Use an ordered multimap for quick (capacity => stage) lookups using lower_bound().
std::multimap<uint32_t, VulkanStage*> mStages;

View File

@@ -446,6 +446,7 @@ void WebGPUDriver::createSwapChainHeadlessR(Handle<HwSwapChain> sch, uint32_t wi
void WebGPUDriver::createVertexBufferInfoR(Handle<HwVertexBufferInfo> vertexBufferInfoHandle,
const uint8_t bufferCount, const uint8_t attributeCount, const AttributeArray attributes,
utils::ImmutableCString&& tag) {
// Hello world! This is a test for pushing branch to Github
FWGPU_SYSTRACE_SCOPE();
constructHandle<WebGPUVertexBufferInfo>(vertexBufferInfoHandle, bufferCount, attributeCount,
attributes, mDeviceLimits);

View File

@@ -39,15 +39,9 @@ FenceStatus WebGPUFence::wait(uint64_t timeout) {
using namespace std::chrono;
auto now = steady_clock::now();
steady_clock::time_point until = steady_clock::time_point::max();
using TimeoutType = decltype(timeout);
constexpr TimeoutType maxTimeout = std::numeric_limits<TimeoutType>::max();
constexpr nanoseconds maxNano = nanoseconds::max();
if (timeout < maxNano.count() && timeout < maxTimeout && // Need to account for overflow
now <= steady_clock::time_point::max() - nanoseconds(timeout)) {
if (now <= steady_clock::time_point::max() - nanoseconds(timeout)) {
until = now + nanoseconds(timeout);
}
{
std::unique_lock<std::mutex> lock(mLock);
bool const success = mCond.wait_until(lock, until, [this] {

View File

@@ -179,7 +179,7 @@ TEST_F(BackendTest, FeedbackLoops) {
auto descriptorSet = shader.createDescriptorSet(api);
auto textureView = passCleanup.add(api.createTextureView(texture, sourceLevel, 1));
api.updateDescriptorSetTexture(descriptorSet, 0, textureView, SamplerParams{
api.updateDescriptorSetTexture(descriptorSet, 0, textureView, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST
});
@@ -216,7 +216,7 @@ TEST_F(BackendTest, FeedbackLoops) {
auto descriptorSet = shader.createDescriptorSet(api);
auto textureView = passCleanup.add(api.createTextureView(texture, sourceLevel, 1));
api.updateDescriptorSetTexture(descriptorSet, 0, textureView, SamplerParams{
api.updateDescriptorSetTexture(descriptorSet, 0, textureView, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST
});

View File

@@ -362,7 +362,7 @@ TEST_F(LoadImageTest, UpdateImage2D) {
}
DescriptorSetHandle descriptorSet = shader.createDescriptorSet(api);
api.updateDescriptorSetTexture(descriptorSet, 0, texture, SamplerParams{
api.updateDescriptorSetTexture(descriptorSet, 0, texture, {
.filterMag = SamplerMagFilter::NEAREST,
.filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
@@ -446,7 +446,7 @@ TEST_F(LoadImageTest, UpdateImageSRGB) {
// Update samplers.
DescriptorSetHandle descriptorSet = shader.createDescriptorSet(api);
api.updateDescriptorSetTexture(descriptorSet, 0, texture, SamplerParams{
api.updateDescriptorSetTexture(descriptorSet, 0, texture, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST
});
@@ -513,7 +513,7 @@ TEST_F(LoadImageTest, UpdateImageMipLevel) {
// Update samplers.
DescriptorSetHandle descriptorSet = shader.createDescriptorSet(api);
api.updateDescriptorSetTexture(descriptorSet, 0, texture, SamplerParams{
api.updateDescriptorSetTexture(descriptorSet, 0, texture, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST
});
@@ -602,9 +602,9 @@ TEST_F(LoadImageTest, UpdateImage3D) {
// Update samplers.
DescriptorSetHandle descriptorSet = shader.createDescriptorSet(api);
api.updateDescriptorSetTexture(descriptorSet, 0, texture, SamplerParams{
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST });
api.updateDescriptorSetTexture(descriptorSet, 0, texture,
{ .filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST });
api.bindDescriptorSet(descriptorSet, 0, {});

View File

@@ -163,7 +163,7 @@ TEST_F(BackendTest, TextureViewLod) {
params.viewport = getFullViewport();
DescriptorSetHandle descriptorSet13 = texturedShader.createDescriptorSet(api);
api.updateDescriptorSetTexture(descriptorSet13, 0, texture13, SamplerParams{
api.updateDescriptorSetTexture(descriptorSet13, 0, texture13, {
.filterMag = SamplerMagFilter::NEAREST,
.filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
@@ -185,7 +185,7 @@ TEST_F(BackendTest, TextureViewLod) {
auto texture22 = cleanup.add(api.createTextureView(texture, 2, 2));
DescriptorSetHandle descriptorSet22 = texturedShader.createDescriptorSet(api);
api.updateDescriptorSetTexture(descriptorSet22, 0, texture22, SamplerParams{
api.updateDescriptorSetTexture(descriptorSet22, 0, texture22, {
.filterMag = SamplerMagFilter::NEAREST,
.filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });

View File

@@ -643,7 +643,7 @@ PostProcessManager::StructurePassOutput PostProcessManager::structure(FrameGraph
for (size_t level = 0; level < levelCount - 1; level++) {
auto out = resources.getRenderPassInfo(level);
auto th = driver.createTextureView(in, level, 1);
mi->setParameter("depth", th, SamplerParams{
mi->setParameter("depth", th, {
.filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->commit(driver);
mi->use(driver);
@@ -1048,8 +1048,8 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::screenSpaceAmbientOcclusion(
// Set common material parameters
mi->setParameter("invRadiusSquared", 1.0f / (options.radius * options.radius));
mi->setParameter("depth", depth, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("depth", depth,
{ .filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("screenFromViewMatrix",
mat4f(screenFromClipMatrix * cameraInfo.projection));
mi->setParameter("resolution",
@@ -1372,11 +1372,11 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::gaussianBlurPass(FrameGraph&
auto setCommonParams = [&](FMaterialInstance* const mi) {
// Initialize the samplers with dummy textures because vulkan requires a sampler to
// be bound to a texture even if sampler might be unused.
mi->setParameter("sourceArray"sv, getZeroTextureArray(), SamplerParams{
mi->setParameter("sourceArray"sv, getZeroTextureArray(), {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST
});
mi->setParameter("source"sv, getZeroTexture(), SamplerParams{
mi->setParameter("source"sv, getZeroTexture(), {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST
});
@@ -1389,7 +1389,8 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::gaussianBlurPass(FrameGraph&
// horizontal pass
auto mi = getMaterialInstance(mEngine, separableGaussianBlur);
setCommonParams(mi);
mi->setParameter(sourceParameterName, hwIn, SamplerParams{
mi->setParameter(sourceParameterName, hwIn,
{
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST,
});
@@ -1412,7 +1413,8 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::gaussianBlurPass(FrameGraph&
assert_invariant(width == hwOutRT.params.viewport.width);
assert_invariant(height == hwOutRT.params.viewport.height);
mi->setParameter(sourceParameterName, hwTemp, SamplerParams{
mi->setParameter(sourceParameterName, hwTemp,
{
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR, /* level is always 0 */
});
@@ -1817,10 +1819,8 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::dof(FrameGraph& fg,
getPostProcessMaterial("dofDownsample");
FMaterialInstance* const mi = getMaterialInstance(mEngine, material);
mi->setParameter("color", color, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST });
mi->setParameter("depth", depth, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST });
mi->setParameter("color", color, { .filterMin = SamplerMinFilter::NEAREST });
mi->setParameter("depth", depth, { .filterMin = SamplerMinFilter::NEAREST });
mi->setParameter("cocParams", cocParams);
mi->setParameter("cocClamp", float2{
-(dofOptions.maxForegroundCOC ? dofOptions.maxForegroundCOC : DOF_DEFAULT_MAX_COC),
@@ -1889,10 +1889,8 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::dof(FrameGraph& fg,
auto inCoc = driver.createTextureView(inOutCoc, level, 1);
FMaterialInstance* const mi = getMaterialInstance(ma);
mi->setParameter("color", inColor, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("coc", inCoc, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("color", inColor, { .filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("coc", inCoc, { .filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("weightScale", 0.5f / float(1u << level)); // FIXME: halfres?
mi->setParameter("texelSize", float2{ 1.0f / w, 1.0f / h });
mi->commit(driver);
@@ -1958,8 +1956,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::dof(FrameGraph& fg,
getPostProcessMaterial("dofTilesSwizzle") :
getPostProcessMaterial("dofTiles");
FMaterialInstance* const mi = getMaterialInstance(mEngine, material);
mi->setParameter("cocMinMax", inCocMinMax, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST });
mi->setParameter("cocMinMax", inCocMinMax, { .filterMin = SamplerMinFilter::NEAREST });
mi->setParameter("texelSize", float2{ 1.0f / inputDesc.width, 1.0f / inputDesc.height });
commitAndRenderFullScreenQuad(driver, out, mi);
unbindAllDescriptorSets(driver);
@@ -1995,8 +1992,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::dof(FrameGraph& fg,
auto inTilesCocMinMax = resources.getTexture(data.inTilesCocMinMax);
auto const& material = getPostProcessMaterial("dofDilate");
FMaterialInstance* const mi = getMaterialInstance(mEngine, material);
mi->setParameter("tiles", inTilesCocMinMax, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST });
mi->setParameter("tiles", inTilesCocMinMax, { .filterMin = SamplerMinFilter::NEAREST });
commitAndRenderFullScreenQuad(driver, out, mi);
unbindAllDescriptorSets(driver);
});
@@ -2059,14 +2055,14 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::dof(FrameGraph& fg,
auto const& material = getPostProcessMaterial("dof");
FMaterialInstance* const mi = getMaterialInstance(mEngine, material);
// it's not safe to use bilinear filtering in the general case (causes artifacts around edges)
mi->setParameter("color", color, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("colorLinear", color, SamplerParams{
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST });
mi->setParameter("coc", coc, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("tiles", tilesCocMinMax, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST });
mi->setParameter("color", color,
{ .filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("colorLinear", color,
{ .filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST });
mi->setParameter("coc", coc,
{ .filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("tiles", tilesCocMinMax,
{ .filterMin = SamplerMinFilter::NEAREST });
mi->setParameter("cocToTexelScale", float2{
bokehScale.x / (inputDesc.width * dofResolution),
bokehScale.y / (inputDesc.height * dofResolution)
@@ -2122,12 +2118,9 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::dof(FrameGraph& fg,
auto const& material = getPostProcessMaterial("dofMedian");
FMaterialInstance* const mi = getMaterialInstance(mEngine, material);
mi->setParameter("dof", inColor, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("alpha", inAlpha, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("tiles", tilesCocMinMax, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST });
mi->setParameter("dof", inColor, { .filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("alpha", inAlpha, { .filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("tiles", tilesCocMinMax, { .filterMin = SamplerMinFilter::NEAREST });
commitAndRenderFullScreenQuad(driver, out, mi);
unbindAllDescriptorSets(driver);
});
@@ -2176,14 +2169,10 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::dof(FrameGraph& fg,
auto const& material = getPostProcessMaterial("dofCombine");
FMaterialInstance* const mi = getMaterialInstance(mEngine, material);
mi->setParameter("color", color, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST });
mi->setParameter("dof", dof, SamplerParams{
.filterMag = SamplerMagFilter::NEAREST });
mi->setParameter("alpha", alpha, SamplerParams{
.filterMag = SamplerMagFilter::NEAREST });
mi->setParameter("tiles", tilesCocMinMax, SamplerParams{
.filterMin = SamplerMinFilter::NEAREST });
mi->setParameter("color", color, { .filterMin = SamplerMinFilter::NEAREST });
mi->setParameter("dof", dof, { .filterMag = SamplerMagFilter::NEAREST });
mi->setParameter("alpha", alpha, { .filterMag = SamplerMagFilter::NEAREST });
mi->setParameter("tiles", tilesCocMinMax, { .filterMin = SamplerMinFilter::NEAREST });
commitAndRenderFullScreenQuad(driver, out, mi);
unbindAllDescriptorSets(driver);
});
@@ -2213,7 +2202,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::downscalePass(FrameGraph& fg
auto const& out = resources.getRenderPassInfo();
auto const& material = getPostProcessMaterial("bloomDownsample2x");
FMaterialInstance* const mi = getMaterialInstance(mEngine, material);
mi->setParameter("source", resources.getTexture(data.input), SamplerParams{
mi->setParameter("source", resources.getTexture(data.input), {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR
});
@@ -2373,7 +2362,7 @@ PostProcessManager::BloomPassOutput PostProcessManager::bloom(FrameGraph& fg,
auto vp = resources.getRenderPassInfo(data.outRT[i-1]).params.viewport;
auto* const mi = (vp.width & 1 || vp.height & 1) ? mi13 : mi9;
auto hwOutView = driver.createTextureView(hwOut, i - 1, 1);
mi->setParameter("source", hwOutView, SamplerParams{
mi->setParameter("source", hwOutView, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST });
commitAndRenderFullScreenQuad(driver, hwDstRT, mi);
@@ -2422,7 +2411,7 @@ PostProcessManager::BloomPassOutput PostProcessManager::bloom(FrameGraph& fg,
auto h = FTexture::valueForLevel(i - 1, outDesc.height);
auto hwOutView = driver.createTextureView(hwOut, i, 1);
mi->setParameter("resolution", float4{ w, h, 1.0f / w, 1.0f / h });
mi->setParameter("source", hwOutView, SamplerParams{
mi->setParameter("source", hwOutView, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST});
mi->commit(driver);
@@ -2470,7 +2459,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::flarePass(FrameGraph& fg,
FMaterialInstance* const mi =
getMaterialInstance(mEngine, material);
mi->setParameter("color", in, SamplerParams{
mi->setParameter("color", in, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST
});
@@ -2743,19 +2732,19 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::colorGrading(FrameGraph& fg,
vignetteOptions, output.width, output.height);
mi->setParameter("colorBuffer", colorTexture, { /* shader uses texelFetch */ });
mi->setParameter("bloomBuffer", bloomTexture, SamplerParams{
mi->setParameter("bloomBuffer", bloomTexture, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR /* always read base level in shader */
});
mi->setParameter("flareBuffer", flareTexture, SamplerParams{
mi->setParameter("flareBuffer", flareTexture, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR
});
mi->setParameter("dirtBuffer", dirtTexture, SamplerParams{
mi->setParameter("dirtBuffer", dirtTexture, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR
});
mi->setParameter("starburstBuffer", starburstTexture, SamplerParams{
mi->setParameter("starburstBuffer", starburstTexture, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR,
.wrapS = SamplerWrapMode::REPEAT,
@@ -2826,7 +2815,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::fxaa(FrameGraph& fg,
FMaterialInstance* const mi =
getMaterialInstance(mEngine, material, variant);
mi->setParameter("colorBuffer", texture, SamplerParams{
mi->setParameter("colorBuffer", texture, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR
});
@@ -2947,7 +2936,7 @@ FMaterialInstance* PostProcessManager::configureColorGradingMaterial(
: mFixedMaterialInstanceIndex.colorGradingOpaque;
std::tie(mi, fixedIndex) = mMaterialInstanceManager.getFixedMaterialInstance(ma);
const SamplerParams params = SamplerParams{
const SamplerParams params = {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR,
.wrapS = SamplerWrapMode::CLAMP_TO_EDGE,
@@ -3098,10 +3087,10 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::taa(FrameGraph& fg,
FMaterial const* const ma = material.getMaterial(mEngine, variant);
FMaterialInstance* mi = getMaterialInstance(ma);
mi->setParameter("color", color, SamplerParams{}); // nearest
mi->setParameter("depth", depth, SamplerParams{}); // nearest
mi->setParameter("color", color, {}); // nearest
mi->setParameter("depth", depth, {}); // nearest
mi->setParameter("alpha", taaOptions.feedback);
mi->setParameter("history", history, SamplerParams{
mi->setParameter("history", history, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR
});
@@ -3192,7 +3181,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::rcas(
FSRUniforms uniforms;
FSR_SharpeningSetup(&uniforms, { .sharpness = 2.0f - 2.0f * sharpness });
mi->setParameter("RcasCon", uniforms.RcasCon);
mi->setParameter("color", input, SamplerParams{}); // uses texelFetch
mi->setParameter("color", input, {}); // uses texelFetch
mi->setParameter("resolution", float4{
outputDesc.width, outputDesc.height,
1.0f / outputDesc.width, 1.0f / outputDesc.height });
@@ -3275,7 +3264,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::upscaleBilinear(FrameGraph&
auto& material = getPostProcessMaterial("blitLow");
FMaterialInstance* const mi =
getMaterialInstance(mEngine, material);
mi->setParameter("color", color, SamplerParams{
mi->setParameter("color", color, {
.filterMag = filter
});
@@ -3353,7 +3342,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::upscaleSGSR1(FrameGraph& fg,
FMaterialInstance* const mi =
getMaterialInstance(mEngine, material, variant);
mi->setParameter("color", color, SamplerParams{
mi->setParameter("color", color, {
// The SGSR documentation doesn't clarify if LINEAR or NEAREST should be used. The
// sample code uses NEAREST, but that doesn't seem right, since it would mean the
// LERP mode would not be a LERP, and the non-edges would be sampled as NEAREST.
@@ -3463,7 +3452,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::upscaleFSR1(FrameGraph& fg,
FMaterialInstance* const mi =
getMaterialInstance(mEngine, *splitEasuMaterial);
setEasuUniforms(mi, inputDesc, outputDesc);
mi->setParameter("color", color, SamplerParams{
mi->setParameter("color", color, {
.filterMag = SamplerMagFilter::LINEAR
});
mi->setParameter("resolution",
@@ -3482,7 +3471,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::upscaleFSR1(FrameGraph& fg,
setEasuUniforms(mi, inputDesc, outputDesc);
mi->setParameter("color", color, SamplerParams{
mi->setParameter("color", color, {
.filterMag = SamplerMagFilter::LINEAR
});
@@ -3568,7 +3557,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::blit(FrameGraph& fg, bool co
getPostProcessMaterial(layer ? "blitArray" : "blitLow");
FMaterial const* const ma = material.getMaterial(mEngine);
auto* mi = getMaterialInstance(ma);
mi->setParameter("color", color, SamplerParams{
mi->setParameter("color", color, {
.filterMag = filterMag,
.filterMin = filterMin
});
@@ -3668,7 +3657,8 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::blitDepth(FrameGraph& fg,
PostProcessMaterial const& material = getPostProcessMaterial("blitDepth");
FMaterialInstance* const mi =
getMaterialInstance(mEngine, material);
mi->setParameter("depth", depth, SamplerParams {
mi->setParameter("depth", depth,
{
.filterMag = SamplerMagFilter::NEAREST,
.filterMin = SamplerMinFilter::NEAREST,
});
@@ -3781,7 +3771,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::resolveDepth(FrameGraph& fg,
auto const& material = getPostProcessMaterial("resolveDepth");
FMaterialInstance* const mi =
getMaterialInstance(mEngine, material);
mi->setParameter("depth", input, SamplerParams{}); // NEAREST
mi->setParameter("depth", input, {}); // NEAREST
commitAndRenderFullScreenQuad(driver, resources.getRenderPassInfo(), mi);
unbindAllDescriptorSets(driver);
});
@@ -3834,7 +3824,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::vsmMipmapPass(FrameGraph& fg
backend::Viewport const scissor = { 1u, 1u, dim - 2u, dim - 2u };
FMaterialInstance* const mi = getMaterialInstance(ma);
mi->setParameter("color", in, SamplerParams{
mi->setParameter("color", in, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST
});
@@ -3879,8 +3869,8 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::debugShadowCascades(FrameGra
auto const& material = getPostProcessMaterial("debugShadowCascades");
FMaterialInstance* const mi =
getMaterialInstance(mEngine, material);
mi->setParameter("color", color, SamplerParams{}); // nearest
mi->setParameter("depth", depth, SamplerParams{}); // nearest
mi->setParameter("color", color, {}); // nearest
mi->setParameter("depth", depth, {}); // nearest
commitAndRenderFullScreenQuad(driver, out, mi);
unbindAllDescriptorSets(driver);
});
@@ -3932,7 +3922,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::debugCombineArrayTexture(Fra
// It should be ok to not move this getMaterialInstance to inside the loop, since
// this is a pass meant for debug.
auto* mi = getMaterialInstance(ma);
mi->setParameter("color", color, SamplerParams{
mi->setParameter("color", color, {
.filterMag = filterMag,
.filterMin = filterMin
});
@@ -4007,7 +3997,7 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::debugDisplayShadowTexture(
auto in = resources.getTexture(data.depth);
auto const& material = getPostProcessMaterial("shadowmap");
FMaterialInstance* const mi = getMaterialInstance(mEngine, material);
mi->setParameter("shadowmap", in, SamplerParams{
mi->setParameter("shadowmap", in, {
.filterMin = SamplerMinFilter::NEAREST_MIPMAP_NEAREST });
mi->setParameter("scale", s);
mi->setParameter("layer", (uint32_t)layer);

View File

@@ -79,13 +79,14 @@ public:
private:
// These first fields are dereferences from PrimitiveInfo, keep them together
FMaterialInstance const* mMaterialInstance = nullptr;
backend::Handle<backend::HwRenderPrimitive> mHandle = {};
backend::Handle<backend::HwVertexBufferInfo> mVertexBufferInfoHandle = {};
uint32_t mIndexOffset = 0;
uint32_t mIndexCount = 0;
uint32_t mMorphingBufferOffset = 0;
// End PrimitiveInfo fields.
struct {
FMaterialInstance const* mMaterialInstance = nullptr;
backend::Handle<backend::HwRenderPrimitive> mHandle = {};
backend::Handle<backend::HwVertexBufferInfo> mVertexBufferInfoHandle = {};
uint32_t mIndexOffset = 0;
uint32_t mIndexCount = 0;
uint32_t mMorphingBufferOffset = 0;
};
AttributeBitset mEnabledAttributes = {};
uint16_t mBlendOrder = 0;

View File

@@ -112,7 +112,7 @@ ColorPassDescriptorSet::ColorPassDescriptorSet(FEngine& engine, bool const vsm,
setSampler(+PerViewBindingPoints::IBL_DFG_LUT,
engine.getDFG().isValid() ?
engine.getDFG().getTexture() : engine.getZeroTexture(), SamplerParams{
engine.getDFG().getTexture() : engine.getZeroTexture(), {
.filterMag = SamplerMagFilter::LINEAR
});
}
@@ -236,7 +236,7 @@ void ColorPassDescriptorSet::prepareFog(FEngine& engine, const CameraInfo& camer
setSampler(+PerViewBindingPoints::FOG,
fogColorTextureHandle ?
fogColorTextureHandle : engine.getDummyCubemap()->getHwHandleForSampling(), SamplerParams{
fogColorTextureHandle : engine.getDummyCubemap()->getHwHandleForSampling(), {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_LINEAR
});
@@ -277,7 +277,7 @@ void ColorPassDescriptorSet::prepareSSAO(Handle<HwTexture> ssao,
&& options.resolution < 1.0f;
// LINEAR filtering is only needed when AO is enabled and low-quality upsampling is used.
setSampler(+PerViewBindingPoints::SSAO, ssao, SamplerParams{
setSampler(+PerViewBindingPoints::SSAO, ssao, {
.filterMag = options.enabled && !highQualitySampling ?
SamplerMagFilter::LINEAR : SamplerMagFilter::NEAREST
});
@@ -293,7 +293,7 @@ void ColorPassDescriptorSet::prepareMaterialGlobals(
}
void ColorPassDescriptorSet::prepareScreenSpaceRefraction(Handle<HwTexture> ssr) noexcept {
setSampler(+PerViewBindingPoints::SSR, ssr, SamplerParams{
setSampler(+PerViewBindingPoints::SSR, ssr, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_LINEAR
});
@@ -364,7 +364,7 @@ void ColorPassDescriptorSet::prepareAmbientLight(FEngine const& engine, FIndirec
reflection = engine.getDummyCubemap()->getHwHandle();
}
setSampler(+PerViewBindingPoints::IBL_SPECULAR,
reflection, SamplerParams{
reflection, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR_MIPMAP_LINEAR
});
@@ -390,7 +390,7 @@ void ColorPassDescriptorSet::prepareShadowVSM(Handle<HwTexture> texture,
filterMin = SamplerMinFilter::LINEAR_MIPMAP_LINEAR;
}
setSampler(+PerViewBindingPoints::SHADOW_MAP,
texture, SamplerParams{
texture, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = filterMin,
.anisotropyLog2 = options.anisotropy,
@@ -399,7 +399,7 @@ void ColorPassDescriptorSet::prepareShadowVSM(Handle<HwTexture> texture,
void ColorPassDescriptorSet::prepareShadowPCF(Handle<HwTexture> texture) noexcept {
setSampler(+PerViewBindingPoints::SHADOW_MAP,
texture, SamplerParams{
texture, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR,
.compareMode = SamplerCompareMode::COMPARE_TO_TEXTURE,
@@ -416,7 +416,7 @@ void ColorPassDescriptorSet::prepareShadowPCSS(Handle<HwTexture> texture) noexce
}
void ColorPassDescriptorSet::prepareShadowPCFDebug(Handle<HwTexture> texture) noexcept {
setSampler(+PerViewBindingPoints::SHADOW_MAP, texture, SamplerParams{
setSampler(+PerViewBindingPoints::SHADOW_MAP, texture, {
.filterMag = SamplerMagFilter::NEAREST,
.filterMin = SamplerMinFilter::NEAREST
});

View File

@@ -70,7 +70,7 @@ void SsrPassDescriptorSet::setFrameUniforms(FEngine const& engine,
void SsrPassDescriptorSet::prepareHistorySSR(FEngine const& engine, Handle<HwTexture> ssr) noexcept {
mDescriptorSet.setSampler(engine.getPerViewDescriptorSetLayoutSsrVariant(),
+PerViewBindingPoints::SSR_HISTORY, ssr, SamplerParams{
+PerViewBindingPoints::SSR_HISTORY, ssr, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR
});
@@ -80,7 +80,7 @@ void SsrPassDescriptorSet::prepareStructure(FEngine const& engine,
Handle<HwTexture> structure) noexcept {
// sampler must be NEAREST
mDescriptorSet.setSampler(engine.getPerViewDescriptorSetLayoutSsrVariant(),
+PerViewBindingPoints::STRUCTURE, structure, SamplerParams{});
+PerViewBindingPoints::STRUCTURE, structure, {});
}
void SsrPassDescriptorSet::commit(FEngine& engine) noexcept {

View File

@@ -23,7 +23,6 @@
#include <backend/TargetBufferInfo.h>
#include <filament/Viewport.h>
#include <utils/debug.h>
namespace filament {
@@ -34,20 +33,14 @@ namespace filament {
struct FrameGraphRenderPass {
static constexpr size_t ATTACHMENT_COUNT = backend::MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT + 2;
struct Attachments {
FrameGraphId<FrameGraphTexture> color[backend::MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT];
FrameGraphId<FrameGraphTexture> depth;
FrameGraphId<FrameGraphTexture> stencil;
FrameGraphId<FrameGraphTexture>& operator[](size_t index) noexcept {
assert_invariant(index < ATTACHMENT_COUNT);
if (index < backend::MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT) {
return color[index];
} else if (index == backend::MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT) {
return depth;
} else {
return stencil;
}
}
union {
FrameGraphId<FrameGraphTexture> array[ATTACHMENT_COUNT] = {};
struct {
FrameGraphId<FrameGraphTexture> color[backend::MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT];
FrameGraphId<FrameGraphTexture> depth;
FrameGraphId<FrameGraphTexture> stencil;
};
};
};
struct Descriptor {

View File

@@ -95,7 +95,7 @@ uint32_t RenderPassNode::declareRenderTarget(FrameGraph& fg, FrameGraph::Builder
for (size_t i = 0; i < RenderPassData::ATTACHMENT_COUNT; i++) {
FrameGraphId<FrameGraphTexture> const& handle =
data.descriptor.attachments[i];
data.descriptor.attachments.array[i];
if (handle) {
data.attachmentInfo[i] = handle;
@@ -150,7 +150,7 @@ void RenderPassNode::resolve() noexcept {
constexpr size_t STENCIL_INDEX = MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT + 1;
for (size_t i = 0; i < MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT + 2; i++) {
if (rt.descriptor.attachments[i]) {
if (rt.descriptor.attachments.array[i]) {
const TargetBufferFlags target = getTargetBufferFlagsAt(i);
rt.targetBufferFlags |= target;
@@ -174,7 +174,7 @@ void RenderPassNode::resolve() noexcept {
if (!rt.incoming[i] || !rt.incoming[i]->hasActiveWriters()) {
rt.backend.params.flags.discardStart |= target;
}
VirtualResource* pResource = mFrameGraph.getResource(rt.descriptor.attachments[i]);
VirtualResource* pResource = mFrameGraph.getResource(rt.descriptor.attachments.array[i]);
Resource<FrameGraphTexture>* pTextureResource = static_cast<Resource<FrameGraphTexture>*>(pResource);
pImportedRenderTarget = pImportedRenderTarget ?

View File

@@ -1,12 +1,12 @@
Pod::Spec.new do |spec|
spec.name = "Filament"
spec.version = "1.66.2"
spec.version = "1.66.0"
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.66.2/filament-v1.66.2-ios.tgz" }
spec.source = { :http => "https://github.com/google/filament/releases/download/v1.66.0/filament-v1.66.0-ios.tgz" }
# Fix linking error with Xcode 12; we do not yet support the simulator on Apple silicon.
spec.pod_target_xcconfig = {

View File

@@ -196,7 +196,10 @@ if (WEBGL_PTHREADS)
target_compile_definitions(gltfio_core PUBLIC -DFILAMENT_WASM_THREADS)
endif()
target_compile_options(gltfio_core PRIVATE ${FILAMENT_WARNINGS})
set(GLTFIO_WARNINGS -Wall -Werror)
if (NOT MSVC)
target_compile_options(gltfio_core PRIVATE ${GLTFIO_WARNINGS})
endif()
if (NOT WEBGL AND NOT ANDROID AND NOT IOS)

View File

@@ -67,6 +67,11 @@ struct TangentSpaceMeshWrapper {
short4* getQuats() noexcept;
uint3* getTriangles();
template<typename T>
using is_supported_aux_t = typename std::enable_if<
std::is_same<float2*, T>::value || std::is_same<float3*, T>::value ||
std::is_same<float4*, T>::value || std::is_same<ushort3*, T>::value ||
std::is_same<ushort4*, T>::value>::type;
template<typename T, typename = is_supported_aux_t<T>>
T getAux(AuxType attribute) noexcept;

View File

@@ -32,7 +32,7 @@ namespace utils {
inline void* aligned_alloc(size_t size, size_t align) noexcept {
// 'align' must be a power of two and a multiple of sizeof(void*)
align = (align < sizeof(void*)) ? sizeof(void*) : align;
assert(align && !(align & (align - 1)));
assert(align && !(align & align - 1));
assert((align % sizeof(void*)) == 0);
void* p = nullptr;

View File

@@ -17,7 +17,6 @@
#ifndef VIEWER_TIFF_EXPORT_H
#define VIEWER_TIFF_EXPORT_H
#include <cstdint>
#include <fstream>
void exportTIFF(void* buffer, uint32_t width, uint32_t height, std::ostream& outstream);

View File

@@ -54,7 +54,8 @@
"description": "transmission",
"apply_presets": ["base", "transmission_models"],
"rendering": {
"viewer.cameraFocalLength": 52.0
"viewer.cameraFocalLength": 52.0,
"view.screenSpaceReflections.enabled": true
}
},
{

View File

@@ -15,7 +15,6 @@
#ifndef DRACO_IO_FILE_UTILS_H_
#define DRACO_IO_FILE_UTILS_H_
#include <cstdint>
#include <string>
#include <vector>

View File

@@ -164,7 +164,7 @@ static float sq(float x) { return x * x; }
constexpr float PI_F = 3.141592653589793238f;
UTILS_UNUSED static float sphericalCapsIntersection(float cosCap1, float cosCap2, float cosDistance) {
static UTILS_UNUSED float sphericalCapsIntersection(float cosCap1, float cosCap2, float cosDistance) {
// Oat and Sander 2007, "Ambient Aperture Lighting"
float r1 = std::acos(cosCap1);
float r2 = std::acos(cosCap2);

View File

@@ -1,6 +1,6 @@
{
"name": "filament",
"version": "1.66.2",
"version": "1.66.0",
"description": "Real-time physically based rendering engine",
"main": "filament.js",
"module": "filament.js",