Skip to content

Commit

Permalink
Merge branch 'rc/1.9.3' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado committed Oct 5, 2020
2 parents defee76 + 16dfadb commit 826e8d1
Show file tree
Hide file tree
Showing 49 changed files with 589 additions and 159 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repositories {
}
dependencies {
implementation 'com.google.android.filament:filament-android:1.9.2'
implementation 'com.google.android.filament:filament-android:1.9.3'
}
```

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

```
pod 'Filament', '~> 1.9.2'
pod 'Filament', '~> 1.9.3'
```

### Snapshots
Expand Down
15 changes: 15 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
This file contains one line summaries of commits that are worthy of mentioning in release notes.
A new header is inserted each time a *tag* is created.

## Next release (v1.9.4)

## v1.9.3

- engine: Added new APIs to enable/disable screen space refraction
- engine: Fix, flip the shading normal when det < 0.
- gltfio: Fix animation by clamping the per-channel interpolant.
- gltfio: add async cancellation API
- gltfio: Fix "uniform not found" errors.
- gltfio: Disable clear coat layer IOR change in glTF files (#3104)
- Vulkan: fix final image barrier used for swap chain.
- matdbg: Various improvements
- JavaScript bindings: fix TextureUsage bitmask.
- cmgen / mipgen: add opt-in for ASTC / ETC support.

## v1.9.2

- Fixes / improvements for contact shadows, fog, and DOF
Expand Down
30 changes: 29 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@
// Example:
// ./gradlew -Pfilament_dist_dir=../dist-android-release assembleRelease -Pfilament_abis=x86

// Publishing to Maven Central:
// - Build and upload artifacts with ./gradlew publish
// - Close and release staging repo on Nexus with ./gradlew closeAndReleaseRepository
//
// The following is needed in ~/gradle/gradle.properties:
//
// SONATYPE_NEXUS_USERNAME=nexus_user
// SONATYPE_NEXUS_PASSWORD=nexus_password
//
// nexusUsername=nexus_user
// nexusPassword=nexus_password
//
// signing.keyId=pgp_key_id
// signing.password=pgp_key_password
// signing.secretKeyRingFile=/Users/user/.gnupg/maven_signing.key
//

buildscript {
def filamentPath = file("../out/android-release/filament").absolutePath
if (project.hasProperty("filament_dist_dir")) {
Expand All @@ -47,7 +64,7 @@ buildscript {
'minSdk': 19,
'targetSdk': 29,
'compileSdk': 29,
'kotlin': '1.3.72',
'kotlin': '1.4.10',
'buildTools': '30.0.1',
'ndk': '21.3.6528147'
]
Expand Down Expand Up @@ -103,6 +120,17 @@ buildscript {
}
}

plugins {
id 'io.codearte.nexus-staging' version '0.22.0'
}

// Nexus Staging configuration
// See https://github.com/Codearte/gradle-nexus-staging-plugin/
nexusStaging {
packageGroup = 'com.google.android'
stagingProfileId = '9a75a224a4f17b'
}

subprojects {
group = GROUP
version = VERSION_NAME
Expand Down
27 changes: 25 additions & 2 deletions android/filament-android/src/main/cpp/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ Java_com_google_android_filament_View_nSetVisibleLayers(JNIEnv*, jclass, jlong n
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_View_nSetShadowsEnabled(JNIEnv*, jclass, jlong nativeView, jboolean enabled) {
Java_com_google_android_filament_View_nSetShadowingEnabled(JNIEnv*, jclass, jlong nativeView, jboolean enabled) {
View* view = (View*) nativeView;
view->setShadowsEnabled(enabled);
view->setShadowingEnabled(enabled);
}

extern "C" JNIEXPORT void JNICALL
Expand Down Expand Up @@ -286,3 +286,26 @@ Java_com_google_android_filament_View_nSetTemporalAntiAliasingOptions(JNIEnv *,
view->setTemporalAntiAliasingOptions({
.filterWidth = filterWidth, .feedback = feedback, .enabled = (bool) enabled});
}

extern "C"
JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_View_nIsShadowingEnabled(JNIEnv *, jclass, jlong nativeView) {
View* view = (View*) nativeView;
return (jboolean)view->isShadowingEnabled();
}

extern "C"
JNIEXPORT void JNICALL
Java_com_google_android_filament_View_nSetScreenSpaceRefractionEnabled(JNIEnv *, jclass,
jlong nativeView, jboolean enabled) {
View* view = (View*) nativeView;
view->setScreenSpaceRefractionEnabled((bool)enabled);
}

extern "C"
JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_View_nIsScreenSpaceRefractionEnabled(JNIEnv *, jclass,
jlong nativeView) {
View* view = (View*) nativeView;
return (jboolean)view->isScreenSpaceRefractionEnabled();
}
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,41 @@ public void setVisibleLayers(
* @see RenderableManager.Builder#receiveShadows
* @see RenderableManager.Builder#castShadows
*/
public void setShadowingEnabled(boolean enabled) {
nSetShadowingEnabled(getNativeObject(), enabled);
}

/**
* Enables or disables shadow mapping. Enabled by default.
*
* @deprecated Use {@link #setShadowingEnabled}
*/
@Deprecated
public void setShadowsEnabled(boolean enabled) {
nSetShadowsEnabled(getNativeObject(), enabled);
setShadowingEnabled(enabled);
}

/**
* @return whether shadowing is enabled
*/
boolean isShadowingEnabled() {
return nIsShadowingEnabled(getNativeObject());
}

/**
* Enables or disables screen space refraction. Enabled by default.
*
* @param enabled true enables screen space refraction, false disables it.
*/
public void setScreenSpaceRefractionEnabled(boolean enabled) {
nSetScreenSpaceRefractionEnabled(getNativeObject(), enabled);
}

/**
* @return whether screen space refraction is enabled
*/
boolean isScreenSpaceRefractionEnabled() {
return nIsScreenSpaceRefractionEnabled(getNativeObject());
}

/**
Expand Down Expand Up @@ -1223,7 +1256,7 @@ void clearNativeObject() {
private static native void nSetCamera(long nativeView, long nativeCamera);
private static native void nSetViewport(long nativeView, int left, int bottom, int width, int height);
private static native void nSetVisibleLayers(long nativeView, int select, int value);
private static native void nSetShadowsEnabled(long nativeView, boolean enabled);
private static native void nSetShadowingEnabled(long nativeView, boolean enabled);
private static native void nSetRenderTarget(long nativeView, long nativeRenderTarget);
private static native void nSetSampleCount(long nativeView, int count);
private static native int nGetSampleCount(long nativeView);
Expand All @@ -1248,4 +1281,7 @@ void clearNativeObject() {
private static native void nSetDepthOfFieldOptions(long nativeView, float focusDistance, float cocScale, float maxApertureDiameter, boolean enabled);
private static native void nSetVignetteOptions(long nativeView, float midPoint, float roundness, float feather, float r, float g, float b, float a, boolean enabled);
private static native void nSetTemporalAntiAliasingOptions(long nativeView, float feedback, float filterWidth, boolean enabled);
private static native boolean nIsShadowingEnabled(long nativeView);
private static native void nSetScreenSpaceRefractionEnabled(long nativeView, boolean enabled);
private static native boolean nIsScreenSpaceRefractionEnabled(long nativeView);
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ class ModelViewer(val engine: Engine) : android.view.View.OnTouchListener {
*/
fun destroyModel() {
fetchResourcesJob?.cancel()
resourceLoader.asyncCancelLoad()
asset?.let { asset ->
this.scene.removeEntities(asset.entities)
assetLoader.destroyAsset(asset)
Expand Down
7 changes: 7 additions & 0 deletions android/gltfio-android/src/main/cpp/ResourceLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,10 @@ Java_com_google_android_filament_gltfio_ResourceLoader_nAsyncUpdateLoad(JNIEnv*,
ResourceLoader* loader = (ResourceLoader*) nativeLoader;
loader->asyncUpdateLoad();
}

extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_gltfio_ResourceLoader_nAsyncCancelLoad(JNIEnv*, jclass,
jlong nativeLoader) {
ResourceLoader* loader = (ResourceLoader*) nativeLoader;
loader->asyncCancelLoad();
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ public void asyncUpdateLoad() {
nAsyncUpdateLoad(mNativeObject);
}

/**
* Cancels pending decoder jobs and frees all CPU-side texel data.
*
* Calling this is only necessary if the asyncBeginLoad API was used
* and cancellation is required before progress reaches 100%.
*/
public void asyncCancelLoad() {
nAsyncCancelLoad(mNativeObject);
}

private static native long nCreateResourceLoader(long nativeEngine,
boolean normalizeSkinningWeights, boolean recomputeBoundingBoxes);
private static native void nDestroyResourceLoader(long nativeLoader);
Expand All @@ -156,4 +166,5 @@ private static native void nAddResourceData(long nativeLoader, String url, Buffe
private static native boolean nAsyncBeginLoad(long nativeLoader, long nativeAsset);
private static native float nAsyncGetLoadProgress(long nativeLoader);
private static native void nAsyncUpdateLoad(long nativeLoader);
private static native void nAsyncCancelLoad(long nativeLoader);
}
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GROUP=com.google.android.filament
VERSION_NAME=1.9.2
VERSION_NAME=1.9.3

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

Expand Down
2 changes: 1 addition & 1 deletion android/gradle/gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ version = VERSION_NAME
group = GROUP

def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
return !VERSION_NAME.contains("SNAPSHOT")
}

def getReleaseRepositoryUrl() {
Expand Down
21 changes: 16 additions & 5 deletions filament/backend/src/vulkan/VulkanContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,12 +491,22 @@ void destroySwapChain(VulkanContext& context, VulkanSurfaceContext& surfaceConte
vkFreeMemory(context.device, surfaceContext.depth.memory, VKALLOC);
}

void transitionSwapChain(VulkanContext& context) {
// makeSwapChainPresentable()
//
// Near the end of the frame, we transition the swap chain to VK_IMAGE_LAYOUT_PRESENT_SRC_KHR using
// an image barrier rather than a render pass because each render pass does not know whether or not
// it is the last pass in the frame. (This seems to be an atypical way of achieving the transition,
// but I see nothing wrong with it.)
//
// Note however that we *do* use a render pass to transition the swap chain back to
// VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL on the subsequent frame that writes to it.
void makeSwapChainPresentable(VulkanContext& context) {
VulkanSurfaceContext& surface = *context.currentSurface;
SwapContext& swapContext = surface.swapContexts[surface.currentSwapIndex];
VkImageMemoryBarrier barrier {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
.dstAccessMask = 0,
.newLayout = swapContext.attachment.layout,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
Expand All @@ -507,8 +517,9 @@ void transitionSwapChain(VulkanContext& context) {
.layerCount = 1,
},
};
vkCmdPipelineBarrier(context.currentCommands->cmdbuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier);
vkCmdPipelineBarrier(context.currentCommands->cmdbuffer,
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier);
}

uint32_t selectMemoryType(VulkanContext& context, uint32_t flags, VkFlags reqs) {
Expand Down Expand Up @@ -614,7 +625,7 @@ void flushCommandBuffer(VulkanContext& context) {
VulkanSurfaceContext& surface = *context.currentSurface;
SwapContext& swapContext = surface.swapContexts[surface.currentSwapIndex];

transitionSwapChain(context);
makeSwapChainPresentable(context);

// Submit the command buffer.
VkResult error = vkEndCommandBuffer(context.currentCommands->cmdbuffer);
Expand Down
2 changes: 1 addition & 1 deletion filament/backend/src/vulkan/VulkanContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void getPresentationQueue(VulkanContext& context, VulkanSurfaceContext& sc);

void createSwapChain(VulkanContext& context, VulkanSurfaceContext& sc);
void destroySwapChain(VulkanContext& context, VulkanSurfaceContext& sc, VulkanDisposer& disposer);
void transitionSwapChain(VulkanContext& context);
void makeSwapChainPresentable(VulkanContext& context);

uint32_t selectMemoryType(VulkanContext& context, uint32_t flags, VkFlags reqs);
SwapContext& getSwapContext(VulkanContext& context);
Expand Down
2 changes: 1 addition & 1 deletion filament/backend/src/vulkan/VulkanDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ void VulkanDriver::commit(Handle<HwSwapChain> sch) {

// Before swapping, transition the current swap chain image to the PRESENT layout. This cannot
// be done as part of the render pass because it does not know if it is last pass in the frame.
transitionSwapChain(mContext);
makeSwapChainPresentable(mContext);

// Finalize the command buffer and set the cmdbuffer pointer to null.
VkResult result = vkEndCommandBuffer(mContext.currentCommands->cmdbuffer);
Expand Down
2 changes: 1 addition & 1 deletion filament/backend/src/vulkan/VulkanHandles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,12 +682,12 @@ void VulkanTexture::transitionImageLayout(VkCommandBuffer cmd, VkImage image,
break;
case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:
case VK_IMAGE_LAYOUT_GENERAL:
case VK_IMAGE_LAYOUT_PRESENT_SRC_KHR:
barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
sourceStage = VK_PIPELINE_STAGE_TRANSFER_BIT;
destinationStage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
break;
case VK_IMAGE_LAYOUT_PRESENT_SRC_KHR:
default:
PANIC_POSTCONDITION("Unsupported layout transition.");
}
Expand Down
Loading

0 comments on commit 826e8d1

Please sign in to comment.