Skip to content

Commit

Permalink
Merge branch 'rc/1.51.6' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado committed Apr 29, 2024
2 parents 53af1fd + b57fbfb commit 996e2a2
Show file tree
Hide file tree
Showing 45 changed files with 1,313 additions and 312 deletions.
2 changes: 0 additions & 2 deletions NEW_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ for next branch cut* header.
appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md).

## Release notes for next branch cut

- Add new matedit tool
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.51.5'
implementation 'com.google.android.filament:filament-android:1.51.6'
}
```

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

```shell
pod 'Filament', '~> 1.51.5'
pod 'Filament', '~> 1.51.6'
```

### Snapshots
Expand Down
5 changes: 5 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ 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.51.6

- Add new matedit tool
- filagui: Support rendering `GL_TEXTURE_EXTERNAL_OES` textures.

## v1.51.5


Expand Down
15 changes: 15 additions & 0 deletions android/filament-android/src/main/cpp/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,21 @@ Java_com_google_android_filament_Engine_nIsValidMaterial(JNIEnv*, jclass,
return (jboolean)engine->isValid((Material*)nativeMaterial);
}

extern "C" JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_Engine_nIsValidMaterialInstance(JNIEnv*, jclass,
jlong nativeEngine, jlong nativeMaterial, jlong nativeMaterialInstance) {
Engine* engine = (Engine *)nativeEngine;
return (jboolean)engine->isValid((Material*)nativeMaterial,
(MaterialInstance*)nativeMaterialInstance);
}

extern "C" JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_Engine_nIsValidExpensiveMaterialInstance(JNIEnv*, jclass,
jlong nativeEngine, jlong nativeMaterialInstance) {
Engine* engine = (Engine *)nativeEngine;
return (jboolean)engine->isValidExpensive((MaterialInstance*)nativeMaterialInstance);
}

extern "C" JNIEXPORT jboolean JNICALL
Java_com_google_android_filament_Engine_nIsValidSkybox(JNIEnv*, jclass,
jlong nativeEngine, jlong nativeSkybox) {
Expand Down
6 changes: 6 additions & 0 deletions android/filament-android/src/main/cpp/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Java_com_google_android_filament_View_nSetCamera(JNIEnv*, jclass,
view->setCamera(camera);
}

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

extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_View_nSetColorGrading(JNIEnv*, jclass,
jlong nativeView, jlong nativeColorGrading) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,24 @@ public boolean isValidMaterial(@NonNull Material object) {
return nIsValidMaterial(getNativeObject(), object.getNativeObject());
}

/**
* Returns whether the object is valid.
* @param object Object to check for validity
* @return returns true if the specified object is valid.
*/
public boolean isValidMaterialInstance(@NonNull Material ma, MaterialInstance mi) {
return nIsValidMaterialInstance(getNativeObject(), ma.getNativeObject(), mi.getNativeObject());
}

/**
* Returns whether the object is valid.
* @param object Object to check for validity
* @return returns true if the specified object is valid.
*/
public boolean isValidExpensiveMaterialInstance(@NonNull MaterialInstance object) {
return nIsValidExpensiveMaterialInstance(getNativeObject(), object.getNativeObject());
}

/**
* Returns whether the object is valid.
* @param object Object to check for validity
Expand Down Expand Up @@ -1291,6 +1309,8 @@ private static void assertDestroy(boolean success) {
private static native boolean nIsValidSkinningBuffer(long nativeEngine, long nativeSkinningBuffer);
private static native boolean nIsValidIndirectLight(long nativeEngine, long nativeIndirectLight);
private static native boolean nIsValidMaterial(long nativeEngine, long nativeMaterial);
private static native boolean nIsValidMaterialInstance(long nativeEngine, long nativeMaterial, long nativeMaterialInstance);
private static native boolean nIsValidExpensiveMaterialInstance(long nativeEngine, long nativeMaterialInstance);
private static native boolean nIsValidSkybox(long nativeEngine, long nativeSkybox);
private static native boolean nIsValidColorGrading(long nativeEngine, long nativeColorGrading);
private static native boolean nIsValidTexture(long nativeEngine, long nativeTexture);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,15 @@ public void setCamera(@Nullable Camera camera) {
nSetCamera(getNativeObject(), camera == null ? 0 : camera.getNativeObject());
}

/**
* Query whether a camera is set.
* @return true if a camera is set, false otherwise
* @see #setCamera
*/
public boolean hasCamera() {
return nHasCamera(getNativeObject());
}

/**
* Gets this View's associated Camera, or null if none has been assigned.
*
Expand Down Expand Up @@ -1238,6 +1247,7 @@ void clearNativeObject() {
private static native void nSetName(long nativeView, String name);
private static native void nSetScene(long nativeView, long nativeScene);
private static native void nSetCamera(long nativeView, long nativeCamera);
private static native boolean nHasCamera(long nativeView);
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 nSetShadowingEnabled(long nativeView, boolean enabled);
Expand Down
3 changes: 3 additions & 0 deletions android/gltfio-android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ set(GLTFIO_SRCS
${GLTFIO_DIR}/src/Wireframe.cpp
${GLTFIO_DIR}/src/Wireframe.h
${GLTFIO_DIR}/src/downcast.h
${GLTFIO_DIR}/src/extended/AssetLoaderExtended.cpp
${GLTFIO_DIR}/src/extended/AssetLoaderExtended.h
${GLTFIO_DIR}/src/extended/ResourceLoaderExtended.cpp
${GLTFIO_DIR}/src/extended/ResourceLoaderExtended.h
${GLTFIO_DIR}/src/extended/TangentsJobExtended.cpp
${GLTFIO_DIR}/src/extended/TangentsJobExtended.h
${GLTFIO_DIR}/src/extended/TangentSpaceMeshWrapper.cpp
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.51.5
VERSION_NAME=1.51.6

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class MainActivity : Activity() {
var flags = uiHelper.swapChainFlags
if (engine.activeFeatureLevel == Engine.FeatureLevel.FEATURE_LEVEL_0) {
if (SwapChain.isSRGBSwapChainSupported(engine)) {
flags = flags or SwapChain.CONFIG_SRGB_COLORSPACE
flags = flags or SwapChainFlags.CONFIG_SRGB_COLORSPACE
}
}

Expand Down
2 changes: 1 addition & 1 deletion filament/backend/include/backend/DriverEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ enum class TextureUsage : uint16_t {
SUBPASS_INPUT = 0x0020, //!< Texture can be used as a subpass input
BLIT_SRC = 0x0040, //!< Texture can be used the source of a blit()
BLIT_DST = 0x0080, //!< Texture can be used the destination of a blit()
PROTECTED = 0x0100, //!< Texture can be used the destination of a blit()
PROTECTED = 0x0100, //!< Texture can be used for protected content
DEFAULT = UPLOADABLE | SAMPLEABLE //!< Default texture usage
};

Expand Down
1 change: 1 addition & 0 deletions filament/backend/src/vulkan/platform/VulkanPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ VkInstance createInstance(ExtensionSet const& requiredExts) {
// Create the Vulkan instance.
VkApplicationInfo appInfo = {};
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
appInfo.pEngineName = "Filament";
appInfo.apiVersion
= VK_MAKE_API_VERSION(0, FVK_REQUIRED_VERSION_MAJOR, FVK_REQUIRED_VERSION_MINOR, 0);
instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
Expand Down
2 changes: 1 addition & 1 deletion filament/backend/src/vulkan/spirv/VulkanSpirvUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ std::tuple<uint32_t,uint32_t, uint32_t> getProgramBindings(Program::ShaderBlob c
constexpr uint32_t IATTACHMENT = 2;
uint32_t ubo = 0, sampler = 0, inputAttachment = 0;

for (auto const [target, setId]: targetToSet) {
for (auto const& [target, setId]: targetToSet) {
uint32_t const binding = targetToBinding[target];
assert_invariant(binding < 32);
switch(setId) {
Expand Down
63 changes: 45 additions & 18 deletions filament/include/filament/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -800,24 +800,51 @@ class UTILS_PUBLIC Engine {
bool destroy(const InstanceBuffer* UTILS_NULLABLE p); //!< Destroys an InstanceBuffer object.
void destroy(utils::Entity e); //!< Destroys all filament-known components from this entity

bool isValid(const BufferObject* UTILS_NULLABLE p); //!< Tells whether a BufferObject object is valid
bool isValid(const VertexBuffer* UTILS_NULLABLE p); //!< Tells whether an VertexBuffer object is valid
bool isValid(const Fence* UTILS_NULLABLE p); //!< Tells whether a Fence object is valid
bool isValid(const IndexBuffer* UTILS_NULLABLE p); //!< Tells whether an IndexBuffer object is valid
bool isValid(const SkinningBuffer* UTILS_NULLABLE p); //!< Tells whether a SkinningBuffer object is valid
bool isValid(const MorphTargetBuffer* UTILS_NULLABLE p); //!< Tells whether a MorphTargetBuffer object is valid
bool isValid(const IndirectLight* UTILS_NULLABLE p); //!< Tells whether an IndirectLight object is valid
bool isValid(const Material* UTILS_NULLABLE p); //!< Tells whether an IndirectLight object is valid
bool isValid(const Renderer* UTILS_NULLABLE p); //!< Tells whether a Renderer object is valid
bool isValid(const Scene* UTILS_NULLABLE p); //!< Tells whether a Scene object is valid
bool isValid(const Skybox* UTILS_NULLABLE p); //!< Tells whether a SkyBox object is valid
bool isValid(const ColorGrading* UTILS_NULLABLE p); //!< Tells whether a ColorGrading object is valid
bool isValid(const SwapChain* UTILS_NULLABLE p); //!< Tells whether a SwapChain object is valid
bool isValid(const Stream* UTILS_NULLABLE p); //!< Tells whether a Stream object is valid
bool isValid(const Texture* UTILS_NULLABLE p); //!< Tells whether a Texture object is valid
bool isValid(const RenderTarget* UTILS_NULLABLE p); //!< Tells whether a RenderTarget object is valid
bool isValid(const View* UTILS_NULLABLE p); //!< Tells whether a View object is valid
bool isValid(const InstanceBuffer* UTILS_NULLABLE p); //!< Tells whether an InstanceBuffer object is valid
/** Tells whether a BufferObject object is valid */
bool isValid(const BufferObject* UTILS_NULLABLE p) const;
/** Tells whether an VertexBuffer object is valid */
bool isValid(const VertexBuffer* UTILS_NULLABLE p) const;
/** Tells whether a Fence object is valid */
bool isValid(const Fence* UTILS_NULLABLE p) const;
/** Tells whether an IndexBuffer object is valid */
bool isValid(const IndexBuffer* UTILS_NULLABLE p) const;
/** Tells whether a SkinningBuffer object is valid */
bool isValid(const SkinningBuffer* UTILS_NULLABLE p) const;
/** Tells whether a MorphTargetBuffer object is valid */
bool isValid(const MorphTargetBuffer* UTILS_NULLABLE p) const;
/** Tells whether an IndirectLight object is valid */
bool isValid(const IndirectLight* UTILS_NULLABLE p) const;
/** Tells whether an Material object is valid */
bool isValid(const Material* UTILS_NULLABLE p) const;
/** Tells whether an MaterialInstance object is valid. Use this if you already know
* which Material this MaterialInstance belongs to. DO NOT USE getMaterial(), this would
* defeat the purpose of validating the MaterialInstance.
*/
bool isValid(const Material* UTILS_NONNULL m, const MaterialInstance* UTILS_NULLABLE p) const;
/** Tells whether an MaterialInstance object is valid. Use this if the Material the
* MaterialInstance belongs to is not known. This method can be expensive.
*/
bool isValidExpensive(const MaterialInstance* UTILS_NULLABLE p) const;
/** Tells whether a Renderer object is valid */
bool isValid(const Renderer* UTILS_NULLABLE p) const;
/** Tells whether a Scene object is valid */
bool isValid(const Scene* UTILS_NULLABLE p) const;
/** Tells whether a SkyBox object is valid */
bool isValid(const Skybox* UTILS_NULLABLE p) const;
/** Tells whether a ColorGrading object is valid */
bool isValid(const ColorGrading* UTILS_NULLABLE p) const;
/** Tells whether a SwapChain object is valid */
bool isValid(const SwapChain* UTILS_NULLABLE p) const;
/** Tells whether a Stream object is valid */
bool isValid(const Stream* UTILS_NULLABLE p) const;
/** Tells whether a Texture object is valid */
bool isValid(const Texture* UTILS_NULLABLE p) const;
/** Tells whether a RenderTarget object is valid */
bool isValid(const RenderTarget* UTILS_NULLABLE p) const;
/** Tells whether a View object is valid */
bool isValid(const View* UTILS_NULLABLE p) const;
/** Tells whether an InstanceBuffer object is valid */
bool isValid(const InstanceBuffer* UTILS_NULLABLE p) const;

/**
* Kicks the hardware thread (e.g. the OpenGL, Vulkan or Metal thread) and blocks until
Expand Down
7 changes: 7 additions & 0 deletions filament/include/filament/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ class UTILS_PUBLIC View : public FilamentAPI {
*/
void setCamera(Camera* UTILS_NONNULL camera) noexcept;

/**
* Returns whether a Camera is set.
* @return true if a camera is set.
* @see setCamera()
*/
bool hasCamera() const noexcept;

/**
* Returns the Camera currently associated with this View.
* @return A reference to the Camera associated to this View.
Expand Down
51 changes: 32 additions & 19 deletions filament/src/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,25 @@
#include "details/Texture.h"
#include "details/VertexBuffer.h"
#include "details/View.h"
#include "filament/Engine.h"

#include <filament/Engine.h>

#include <backend/DriverEnums.h>

#include <utils/compiler.h>
#include <utils/Panic.h>

#include <stddef.h>
#include <stdint.h>

using namespace utils;

namespace filament {

namespace backend {
class Platform;
}

using namespace math;
using namespace backend;

Expand Down Expand Up @@ -196,58 +203,64 @@ void Engine::destroy(Entity e) {
downcast(this)->destroy(e);
}

bool Engine::isValid(const BufferObject* p) {
bool Engine::isValid(const BufferObject* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const VertexBuffer* p) {
bool Engine::isValid(const VertexBuffer* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const Fence* p) {
bool Engine::isValid(const Fence* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const IndexBuffer* p) {
bool Engine::isValid(const IndexBuffer* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const SkinningBuffer* p) {
bool Engine::isValid(const SkinningBuffer* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const MorphTargetBuffer* p) {
bool Engine::isValid(const MorphTargetBuffer* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const IndirectLight* p) {
bool Engine::isValid(const IndirectLight* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const Material* p) {
bool Engine::isValid(const Material* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const Renderer* p) {
bool Engine::isValid(const Material* m, const MaterialInstance* p) const {
return downcast(this)->isValid(downcast(m), downcast(p));
}
bool Engine::isValidExpensive(const MaterialInstance* p) const {
return downcast(this)->isValidExpensive(downcast(p));
}
bool Engine::isValid(const Renderer* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const Scene* p) {
bool Engine::isValid(const Scene* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const Skybox* p) {
bool Engine::isValid(const Skybox* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const ColorGrading* p) {
bool Engine::isValid(const ColorGrading* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const SwapChain* p) {
bool Engine::isValid(const SwapChain* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const Stream* p) {
bool Engine::isValid(const Stream* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const Texture* p) {
bool Engine::isValid(const Texture* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const RenderTarget* p) {
bool Engine::isValid(const RenderTarget* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const View* p) {
bool Engine::isValid(const View* p) const {
return downcast(this)->isValid(downcast(p));
}
bool Engine::isValid(const InstanceBuffer* p) {
bool Engine::isValid(const InstanceBuffer* p) const {
return downcast(this)->isValid(downcast(p));
}

Expand Down
Loading

0 comments on commit 996e2a2

Please sign in to comment.