Skip to content

Commit

Permalink
Merge branch 'rc/1.32.1' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado committed Mar 21, 2023
2 parents 2a579c4 + 7bd00d2 commit 732628a
Show file tree
Hide file tree
Showing 37 changed files with 572 additions and 896 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repositories {
}
dependencies {
implementation 'com.google.android.filament:filament-android:1.32.0'
implementation 'com.google.android.filament:filament-android:1.32.1'
}
```

Expand All @@ -51,7 +51,7 @@ Here are all the libraries available in the group `com.google.android.filament`:
iOS projects can use CocoaPods to install the latest release:

```
pod 'Filament', '~> 1.32.0'
pod 'Filament', '~> 1.32.1'
```

### Snapshots
Expand Down
71 changes: 13 additions & 58 deletions RELEASE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,7 @@ Before starting, ensure that each of these branches is up-to-date with origin:

It should have the version corresponding to its name, $RELEASE.

## 1. Update RELEASE_NOTES.md on the rc branch.

Checkout the rc/$RELEASE branch. In RELEASE_NOTES.md, locate the header corresponding to $RELEASE
and write release notes. To see which commits make up the release, run:

```
build/common/release.sh -c rc/$RELEASE
```

Commit the changes to rc/$RELEASE with the title:

```
Update RELEASE_NOTES for $RELEASE
```

## 2. Bump versions on main to $RELEASE.
## 1. Bump versions on main to $RELEASE.

Checkout main and run the following command to bump Filament's version to $RELEASE:

Expand All @@ -44,49 +29,19 @@ Release Filament $RELEASE

Do not push to origin yet.

## 3. Cherry-pick RELEASE_NOTES change from rc branch to main.

```
git cherry-pick rc/$RELEASE
```
## 2. Update RELEASE_NOTES.md on main.

Update the headers. The "main branch" header becomes a header for $NEXT_RELEASE, and a new "main
branch" header is added.

For example, this:

```
## main branch
- foo
- bar
## v1.9.3
- baz
- bat
```

becomes:

```
## main branch
## v1.9.4
- foo
- bar
## v1.9.3
- baz
- bat
```
Create a new header in RELEASE_NOTES.md for $NEXT_RELEASE. Copy the release notes in
NEW_RELEASE_NOTES.md to RELEASE_NOTES.md under the new header. Clear NEW_RELEASE_NOTES.md.

Ammend these changes to the cherry-picked change.
Amend these changes to the "Release Filament $RELEASE" commit.

```
git add -u
git commit --amend --no-edit
```

## 4. Run release script.
## 3. Run release script.

```
build/common/release.sh rc/$RELEASE rc/$NEXT_RELEASE
Expand All @@ -95,26 +50,26 @@ build/common/release.sh rc/$RELEASE rc/$NEXT_RELEASE
This script will merge rc/$RELEASE into release, delete the rc branch, and create a new rc
branch called rc/$NEXT_RELEASE. Verify that everything looks okay locally.

## 5. Push the release branch.
## 4. Push the release branch.

```
git push origin release
```

## 6. Create the GitHub release.
## 5. Create the GitHub release.

Use the GitHub UI to create a GitHub release corresponding to $RELEASE version.
Make sure the target is set to the release branch.

## 7. Delete the old rc branch (optional).
## 6. Delete the old rc branch (optional).

This step is optional. The old rc branch may be left alive for a few weeks for posterity.

```
git push origin --delete rc/$RELEASE
```

## 8. Bump the version on the new rc branch to $NEXT_RELEASE.
## 7. Bump the version on the new rc branch to $NEXT_RELEASE.

```
git checkout rc/$NEXT_RELEASE
Expand All @@ -127,19 +82,19 @@ Commit the changes to rc/$NEXT_RELEASE with the title:
Bump version to $NEXT_RELEASE
```

## 9. Push main.
## 8. Push main.

```
git push origin main
```

## 10. Push the new rc branch.
## 9. Push the new rc branch.

```
git push origin -u rc/$NEXT_RELEASE
```

## 11. Rebuild the GitHub release (if failed).
## 10. Rebuild the GitHub release (if failed).

Sometimes the GitHub release job will fail. In this case, you can manually re-run the release job.

Expand Down
2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ 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.32.1

## v1.32.0

- fog: fixed fog height falloff and computation precision on mobile [⚠️ **Recompile Materials**]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.android.filament.textured
package com.google.android.filament.utils

import android.content.res.Resources
import android.graphics.Bitmap
Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GROUP=com.google.android.filament
VERSION_NAME=1.32.0
VERSION_NAME=1.32.1

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

Expand Down
2 changes: 1 addition & 1 deletion docs/remote/filament.js

Large diffs are not rendered by default.

Binary file modified docs/remote/filament.wasm
Binary file not shown.
Binary file modified docs/webgl/albedo.ktx2
Binary file not shown.
Binary file modified docs/webgl/ao.ktx2
Binary file not shown.
Binary file modified docs/webgl/default_env/default_env_ibl.ktx
Binary file not shown.
Binary file modified docs/webgl/default_env/default_env_skybox.ktx
Binary file not shown.
Binary file modified docs/webgl/default_env/default_env_skybox_tiny.ktx
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/webgl/filament.js

Large diffs are not rendered by default.

Binary file modified docs/webgl/filament.wasm
Binary file not shown.
Binary file modified docs/webgl/metallic.ktx2
Binary file not shown.
Binary file modified docs/webgl/normal.ktx2
Binary file not shown.
Binary file modified docs/webgl/parquet.filamat
Binary file not shown.
Binary file modified docs/webgl/plastic.filamat
Binary file not shown.
Binary file modified docs/webgl/roughness.ktx2
Binary file not shown.
Binary file modified docs/webgl/suzanne.filamesh
Binary file not shown.
Binary file modified docs/webgl/textured.filamat
Binary file not shown.
Binary file modified docs/webgl/triangle.filamat
Binary file not shown.
332 changes: 166 additions & 166 deletions docs/webgl/tutorial_redball.html

Large diffs are not rendered by default.

248 changes: 124 additions & 124 deletions docs/webgl/tutorial_suzanne.html

Large diffs are not rendered by default.

186 changes: 93 additions & 93 deletions docs/webgl/tutorial_triangle.html

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions filament/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,12 @@ if (FILAMENT_SUPPORTS_VULKAN)
src/vulkan/VulkanPipelineCache.cpp
src/vulkan/VulkanPipelineCache.h
src/vulkan/VulkanPlatform.cpp
src/vulkan/VulkanReadPixels.cpp
src/vulkan/VulkanReadPixels.h
src/vulkan/VulkanSamplerCache.cpp
src/vulkan/VulkanSamplerCache.h
src/vulkan/VulkanStagePool.cpp
src/vulkan/VulkanStagePool.h
src/vulkan/VulkanSwapChain.cpp
src/vulkan/VulkanSwapChain.h
src/vulkan/VulkanTaskHandler.h
src/vulkan/VulkanTexture.cpp
src/vulkan/VulkanTexture.h
src/vulkan/VulkanUtility.cpp
Expand Down
2 changes: 2 additions & 0 deletions filament/backend/src/vulkan/VulkanCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <utils/Condition.h>
#include <utils/Mutex.h>

#include <atomic>

namespace filament::backend {

// Wrapper to enable use of shared_ptr for implementing shared ownership of low-level Vulkan fences.
Expand Down
161 changes: 145 additions & 16 deletions filament/backend/src/vulkan/VulkanDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ VulkanDriver::VulkanDriver(VulkanPlatform* platform,
mContext.commands->setObserver(&mPipelineCache);
mPipelineCache.setDevice(mContext.device, mContext.allocator);
mPipelineCache.setDummyTexture(mContext.emptyTexture->getPrimaryImageView());

mReadPixels.initialize(mContext.device);
}

VulkanDriver::~VulkanDriver() noexcept = default;
Expand Down Expand Up @@ -136,9 +134,6 @@ void VulkanDriver::terminate() {

void VulkanDriver::tick(int) {
mContext.commands->updateFences();

// Handle any posted tasks
runTaskHandler();
}

// Garbage collection should not occur too frequently, only about once per frame. Internally, the
Expand Down Expand Up @@ -1330,18 +1325,152 @@ void VulkanDriver::stopCapture(int) {

}

void VulkanDriver::readPixels(Handle<HwRenderTarget> src, uint32_t x, uint32_t y, uint32_t width,
uint32_t height, PixelBufferDescriptor&& pbd) {
void VulkanDriver::readPixels(Handle<HwRenderTarget> src, uint32_t x, uint32_t y,
uint32_t width, uint32_t height, PixelBufferDescriptor&& pbd) {
const VkDevice device = mContext.device;
VulkanRenderTarget* srcTarget = handle_cast<VulkanRenderTarget*>(src);
mReadPixels.run(
srcTarget, x, y, width, height, mContext.graphicsQueueFamilyIndex, std::move(pbd),
getTaskHandler(),
[&context = mContext](uint32_t reqs, VkFlags flags) {
return context.selectMemoryType(reqs, flags);
},
[this](PixelBufferDescriptor&& pbd) {
this->scheduleDestroy(std::move(pbd));
});
VulkanTexture* srcTexture = srcTarget->getColor(0).texture;
assert_invariant(srcTexture);
const VkFormat srcFormat = srcTexture->getVkFormat();
const bool swizzle = srcFormat == VK_FORMAT_B8G8R8A8_UNORM;

// Create a host visible, linearly tiled image as a staging area.

VkImageCreateInfo imageInfo {
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
.imageType = VK_IMAGE_TYPE_2D,
.format = srcFormat,
.extent = { width, height, 1 },
.mipLevels = 1,
.arrayLayers = 1,
.samples = VK_SAMPLE_COUNT_1_BIT,
.tiling = VK_IMAGE_TILING_LINEAR,
.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT,
.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
};

VkImage stagingImage;
vkCreateImage(device, &imageInfo, VKALLOC, &stagingImage);

VkMemoryRequirements memReqs;
VkDeviceMemory stagingMemory;
vkGetImageMemoryRequirements(device, stagingImage, &memReqs);
VkMemoryAllocateInfo allocInfo = {
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
.allocationSize = memReqs.size,
.memoryTypeIndex = mContext.selectMemoryType(memReqs.memoryTypeBits,
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
VK_MEMORY_PROPERTY_HOST_CACHED_BIT)
};

vkAllocateMemory(device, &allocInfo, nullptr, &stagingMemory);
vkBindImageMemory(device, stagingImage, stagingMemory, 0);

// TODO: don't flush/wait here, this should be asynchronous

mContext.commands->flush();
mContext.commands->wait();

// Transition the staging image layout.

const VkCommandBuffer cmdbuffer = mContext.commands->get().cmdbuffer;

transitionImageLayout(cmdbuffer, {
.image = stagingImage,
.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
.newLayout = VK_IMAGE_LAYOUT_GENERAL,
.subresources = {
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = 0,
.levelCount = 1,
.baseArrayLayer = 0,
.layerCount = 1,
},
.srcStage = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
.srcAccessMask = 0,
.dstStage = VK_PIPELINE_STAGE_TRANSFER_BIT,
.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
});

const VulkanAttachment srcAttachment = srcTarget->getColor(0);

VkImageCopy imageCopyRegion = {
.srcSubresource = {
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.mipLevel = srcAttachment.level,
.baseArrayLayer = srcAttachment.layer,
.layerCount = 1,
},
.srcOffset = {
.x = (int32_t) x,
.y = (int32_t) (srcTarget->getExtent().height - (height + y)),
},
.dstSubresource = {
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.layerCount = 1,
},
.extent = {
.width = width,
.height = height,
.depth = 1,
},
};

// Transition the source image layout (which might be the swap chain)

const VkImageSubresourceRange srcRange = {
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = srcAttachment.level,
.levelCount = 1,
.baseArrayLayer = srcAttachment.layer,
.layerCount = 1,
};

srcTexture->transitionLayout(cmdbuffer, srcRange, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);

// Perform the copy into the staging area. At this point we know that the src layout is
// TRANSFER_SRC_OPTIMAL and the staging area is GENERAL.

UTILS_UNUSED_IN_RELEASE VkExtent2D srcExtent = srcAttachment.getExtent2D();
assert_invariant(imageCopyRegion.srcOffset.x + imageCopyRegion.extent.width <= srcExtent.width);
assert_invariant(imageCopyRegion.srcOffset.y + imageCopyRegion.extent.height <= srcExtent.height);

vkCmdCopyImage(cmdbuffer, srcAttachment.getImage(),
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, stagingImage, VK_IMAGE_LAYOUT_GENERAL,
1, &imageCopyRegion);

// Restore the source image layout. Between driver API calls, color images are always kept in
// UNDEFINED layout or in their "usage default" layout (see comment for getDefaultImageLayout).

srcTexture->transitionLayout(cmdbuffer, srcRange,
getDefaultImageLayout(TextureUsage::COLOR_ATTACHMENT));

// TODO: don't flush/wait here -- we should do this asynchronously

// Flush and wait.
mContext.commands->flush();
mContext.commands->wait();

VkImageSubresource subResource { .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT };
VkSubresourceLayout subResourceLayout;
vkGetImageSubresourceLayout(device, stagingImage, &subResource, &subResourceLayout);

// Map image memory so we can start copying from it.

const uint8_t* srcPixels;
vkMapMemory(device, stagingMemory, 0, VK_WHOLE_SIZE, 0, (void**) &srcPixels);
srcPixels += subResourceLayout.offset;

if (!DataReshaper::reshapeImage(&pbd, getComponentType(srcFormat), getComponentCount(srcFormat),
srcPixels, subResourceLayout.rowPitch, width, height, swizzle)) {
utils::slog.e << "Unsupported PixelDataFormat or PixelDataType" << utils::io::endl;
}

vkUnmapMemory(device, stagingMemory);
vkDestroyImage(device, stagingImage, nullptr);
vkFreeMemory(device, stagingMemory, nullptr);

scheduleDestroy(std::move(pbd));
}

void VulkanDriver::readBufferSubData(backend::BufferObjectHandle boh,
Expand Down
Loading

0 comments on commit 732628a

Please sign in to comment.