Compare commits

..
Author SHA1 Message Date
Benjamin Doherty 791f51dcb4 Update glslang to e3bca2a 2022-05-04 12:29:21 -07:00
Benjamin Doherty 4621f3ec5d Filament specific changes 2022-05-04 12:06:26 -07:00
Benjamin Doherty ab9c09d0d9 Update spirv-tools to 46492aa 2022-05-04 12:00:04 -07:00
Benjamin Doherty dbf51c1c7d Update SPIRV-Cross to 0c8a79b 2022-05-04 11:07:15 -07:00
1282 changed files with 60475 additions and 10934 deletions
+2 -2
View File
@@ -31,7 +31,7 @@ repositories {
}
dependencies {
implementation 'com.google.android.filament:filament-android:1.22.1'
implementation 'com.google.android.filament:filament-android:1.21.3'
}
```
@@ -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.22.1'
pod 'Filament', '~> 1.21.3'
```
### Snapshots
+1 -12
View File
@@ -3,23 +3,12 @@
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.
## v1.22.2 (currently main branch)
## v1.22.1
- Metal: Shaders now use `half` floating-point arithmetic when possible for improved performance. [⚠️ **Recompile Materials**]
- engine: add support for presentation time in `Renderer`
- engine: added guard bands support for screen-space effects
- gltfio: Add multi-scene support.
- gltfio: Various glTF-related cleanup and enhancements.
- gltfio: Add support for KHR_texture_basisu.
## v1.22.1 (currently main branch)
## v1.22.0
- engine: Changed UBOs layout [⚠️ **Material breakage**].
- engine: Improve effects relying on mipmapping
- engine: Fix assert seen with VSM shadows.
- WebGL: Fix `isTextureFormatSupported` for ETC2 formats.
## v1.21.3
+4 -4
View File
@@ -81,10 +81,10 @@ buildscript {
'minSdk': 19,
'targetSdk': 31,
'compileSdk': 31,
'kotlin': '1.6.21',
'kotlin_coroutines': '1.6.1',
'kotlin': '1.6.10',
'kotlin_coroutines': '1.6.0',
'buildTools': '32.0.0',
'ndk': '24.0.8215888'
'ndk': '23.1.7779620'
]
ext.deps = [
@@ -101,7 +101,7 @@ buildscript {
dependencies {
// NOTE: See TODO in gradle.properties once we move to Gradle 7.4
classpath 'com.android.tools.build:gradle:7.2.0'
classpath 'com.android.tools.build:gradle:7.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
}
+1
View File
@@ -1,3 +1,4 @@
plugins {
id 'groovy-gradle-plugin'
}
-2
View File
@@ -1,6 +1,4 @@
android {
namespace 'com.google.android.filament.filamat'
flavorDimensions "functionality"
productFlavors {
full {
-4
View File
@@ -1,7 +1,3 @@
android {
namespace 'com.google.android.filament'
}
dependencies {
implementation deps.androidx.annotations
}
@@ -156,9 +156,12 @@ Java_com_google_android_filament_Renderer_nResetUserTime(JNIEnv*, jclass, jlong
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_Renderer_nSetDisplayInfo(JNIEnv*, jclass, jlong nativeRenderer, jfloat refreshRate) {
Java_com_google_android_filament_Renderer_nSetDisplayInfo(JNIEnv*, jclass, jlong nativeRenderer,
jfloat refreshRate, jlong presentationDeadlineNanos, jlong vsyncOffsetNanos) {
Renderer *renderer = (Renderer *) nativeRenderer;
renderer->setDisplayInfo({ .refreshRate = refreshRate });
renderer->setDisplayInfo({ .refreshRate = refreshRate,
.presentationDeadlineNanos = (uint64_t)presentationDeadlineNanos,
.vsyncOffsetNanos = (uint64_t)vsyncOffsetNanos });
}
extern "C" JNIEXPORT void JNICALL
@@ -180,10 +183,3 @@ Java_com_google_android_filament_Renderer_nSetClearOptions(JNIEnv *, jclass ,
.clear = (bool) clear,
.discard = (bool) discard});
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_Renderer_nSetPresentationTime(JNIEnv *, jclass ,
jlong nativeRenderer, jlong monotonicClockNanos) {
Renderer *renderer = (Renderer *) nativeRenderer;
renderer->setPresentationTime(monotonicClockNanos);
}
@@ -461,11 +461,3 @@ Java_com_google_android_filament_View_nPick(JNIEnv* env, jclass,
JniCallback::postToJavaAndDestroy(callback);
}, callback->getHandler());
}
extern "C"
JNIEXPORT void JNICALL
Java_com_google_android_filament_View_nSetGuardBandOptions(JNIEnv *, jclass,
jlong nativeView, jboolean enabled) {
View* view = (View*) nativeView;
view->setGuardBandOptions({ .enabled = (bool)enabled });
}
@@ -61,17 +61,13 @@ public class Renderer {
/**
* How far in advance a buffer must be queued for presentation at a given time in ns
* On Android you can use {@link android.view.Display#getPresentationDeadlineNanos()}.
* @deprecated this value is ignored
*/
@Deprecated
public long presentationDeadlineNanos = 0;
/**
* Offset by which vsyncSteadyClockTimeNano provided in beginFrame() is offset in ns
* On Android you can use {@link android.view.Display#getAppVsyncOffsetNanos()}.
* @deprecated this value is ignored
*/
@Deprecated
public long vsyncOffsetNanos = 0;
};
@@ -179,7 +175,8 @@ public class Renderer {
*/
public void setDisplayInfo(@NonNull DisplayInfo info) {
mDisplayInfo = info;
nSetDisplayInfo(getNativeObject(), info.refreshRate);
nSetDisplayInfo(getNativeObject(),
info.refreshRate, info.presentationDeadlineNanos, info.vsyncOffsetNanos);
}
/**
@@ -250,23 +247,6 @@ public class Renderer {
return mEngine;
}
/**
* Set the time at which the frame must be presented to the display.
* <p>
* This must be called between {@link #beginFrame} and {@link #endFrame}.
* </p>
*
* @param monotonicClockNanos The time in nanoseconds corresponding to the system monotonic
* up-time clock. The presentation time is typically set in the
* middle of the period of interest and cannot be too far in the
* future as it is limited by how many buffers are available in
* the display sub-system. Typically it is set to 1 or 2 vsync
* periods away.
*/
public void setPresentationTime(long monotonicClockNanos) {
nSetPresentationTime(getNativeObject(), monotonicClockNanos);
}
/**
* Sets up a frame for this <code>Renderer</code>.
* <p><code>beginFrame</code> manages frame pacing, and returns whether or not a frame should be
@@ -684,7 +664,6 @@ public class Renderer {
mNativeObject = 0;
}
private static native void nSetPresentationTime(long nativeObject, long monotonicClockNanos);
private static native boolean nBeginFrame(long nativeRenderer, long nativeSwapChain, long frameTimeNanos);
private static native void nEndFrame(long nativeRenderer);
private static native void nRender(long nativeRenderer, long nativeView);
@@ -706,7 +685,8 @@ public class Renderer {
Object handler, Runnable callback);
private static native double nGetUserTime(long nativeRenderer);
private static native void nResetUserTime(long nativeRenderer);
private static native void nSetDisplayInfo(long nativeRenderer, float refreshRate);
private static native void nSetDisplayInfo(long nativeRenderer,
float refreshRate, long presentationDeadlineNanos, long vsyncOffsetNanos);
private static native void nSetFrameRateOptions(long nativeRenderer,
float interval, float headRoomRatio, float scaleRate, int history);
private static native void nSetClearOptions(long nativeRenderer,
@@ -83,7 +83,6 @@ public class View {
private MultiSampleAntiAliasingOptions mMultiSampleAntiAliasingOptions;
private VsmShadowOptions mVsmShadowOptions;
private SoftShadowOptions mSoftShadowOptions;
private GuardBandOptions mGuardBandOptions;
/**
* Generic quality level.
@@ -358,19 +357,6 @@ public class View {
public boolean enabled = false;
};
/**
* Options for the screen-space guard band.
* A guard band can be enabled to avoid some artifacts towards the edge of the screen when
* using screen-space effects such as SSAO.
* Enabling the guard band reduces performance slightly.
* Currently the guard band can only be enabled or disabled.
*
* @see View#setGuardBandOptions
*/
public static class GuardBandOptions {
/** enables or disables the guard band */
public boolean enabled = false;
};
/**
* Options for controlling the Bloom effect
@@ -1222,6 +1208,17 @@ public class View {
options.feedback, options.filterWidth, options.enabled);
}
/**
* Enables or disable screen-space reflections. Disabled by default.
*
* @param options screen-space reflections options
*/
public void setScreenSpaceReflectionsOptions(@NonNull ScreenSpaceReflectionsOptions options) {
mScreenSpaceReflectionsOptions = options;
nSetScreenSpaceReflectionsOptions(getNativeObject(), options.thickness, options.bias,
options.maxDistance, options.stride, options.enabled);
}
/**
* Returns temporal anti-aliasing options.
*
@@ -1235,17 +1232,6 @@ public class View {
return mTemporalAntiAliasingOptions;
}
/**
* Enables or disable screen-space reflections. Disabled by default.
*
* @param options screen-space reflections options
*/
public void setScreenSpaceReflectionsOptions(@NonNull ScreenSpaceReflectionsOptions options) {
mScreenSpaceReflectionsOptions = options;
nSetScreenSpaceReflectionsOptions(getNativeObject(), options.thickness, options.bias,
options.maxDistance, options.stride, options.enabled);
}
/**
* Returns screen-space reflections options.
*
@@ -1259,30 +1245,6 @@ public class View {
return mScreenSpaceReflectionsOptions;
}
/**
* Enables or disable screen-space guard band. Disabled by default.
*
* @param options guard band options
*/
public void setGuardBandOptions(@NonNull GuardBandOptions options) {
mGuardBandOptions = options;
nSetGuardBandOptions(getNativeObject(), options.enabled);
}
/**
* Returns screen-space guard band options.
*
* @return guard band options
*/
@NonNull
public GuardBandOptions getGuardBandOptions() {
if (mGuardBandOptions == null) {
mGuardBandOptions = new GuardBandOptions();
}
return mGuardBandOptions;
}
/**
* Enables or disables tone-mapping in the post-processing stage. Enabled by default.
*
@@ -1871,7 +1833,6 @@ public class View {
private static native void nSetMultiSampleAntiAliasingOptions(long nativeView, boolean enabled, int sampleCount, boolean customResolve);
private static native boolean nIsShadowingEnabled(long nativeView);
private static native void nSetScreenSpaceRefractionEnabled(long nativeView, boolean enabled);
private static native void nSetGuardBandOptions(long nativeView, boolean enabled);
private static native boolean nIsScreenSpaceRefractionEnabled(long nativeView);
private static native void nPick(long nativeView, int x, int y, Object handler, InternalOnPickCallback internalCallback);
}
@@ -157,6 +157,8 @@ public class DisplayHelper {
info = new Renderer.DisplayInfo();
}
info.refreshRate = DisplayHelper.getRefreshRate(display);
info.presentationDeadlineNanos = DisplayHelper.getPresentationDeadlineNanos(display);
info.vsyncOffsetNanos = DisplayHelper.getAppVsyncOffsetNanos(display);
return info;
}
+7 -9
View File
@@ -1,8 +1,6 @@
apply plugin: 'kotlin-android'
android {
namespace 'com.google.android.filament.utils'
sourceSets {
main {
kotlin.srcDirs += "src/main/java"
@@ -12,14 +10,14 @@ android {
defaultConfig {
missingDimensionStrategy 'functionality', 'full'
}
// No need to package up the following shared libs, which arise as a side effect of our
// externalNativeBuild dependencies. When clients pick and choose from project-level gradle
// dependencies, these shared libs already get pulled in, so we need to avoid the error:
// "More than one file was found with OS independent path ..."
packagingOptions {
// No need to package up the following shared libs, which arise as a side effect of our
// externalNativeBuild dependencies. When clients pick and choose from project-level gradle
// dependencies, these shared libs already get pulled in, so we need to avoid the error:
// "More than one file was found with OS independent path ..."
jniLibs {
excludes += ['lib/*/libfilament-jni.so', 'lib/*/libgltfio-jni.so']
}
exclude 'lib/*/libfilament-jni.so'
exclude 'lib/*/libgltfio-jni.so'
}
}
+6 -9
View File
@@ -40,33 +40,30 @@ set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,
set(GLTFIO_SRCS
${GLTFIO_DIR}/include/gltfio/Animator.h
${GLTFIO_DIR}/include/gltfio/AssetLoader.h
${GLTFIO_DIR}/include/gltfio/MaterialProvider.h
${GLTFIO_DIR}/include/gltfio/ResourceLoader.h
${GLTFIO_DIR}/include/gltfio/FilamentAsset.h
${GLTFIO_DIR}/include/gltfio/FilamentInstance.h
${GLTFIO_DIR}/include/gltfio/MaterialProvider.h
${GLTFIO_DIR}/include/gltfio/NodeManager.h
${GLTFIO_DIR}/include/gltfio/ResourceLoader.h
${GLTFIO_DIR}/include/gltfio/TextureProvider.h
${GLTFIO_DIR}/include/gltfio/math.h
${GLTFIO_DIR}/src/Animator.cpp
${GLTFIO_DIR}/src/AssetLoader.cpp
${GLTFIO_DIR}/src/DependencyGraph.cpp
${GLTFIO_DIR}/src/DependencyGraph.h
${GLTFIO_DIR}/src/DracoCache.cpp
${GLTFIO_DIR}/src/DracoCache.h
${GLTFIO_DIR}/src/DependencyGraph.cpp
${GLTFIO_DIR}/src/DependencyGraph.h
${GLTFIO_DIR}/src/FFilamentAsset.h
${GLTFIO_DIR}/src/FFilamentInstance.h
${GLTFIO_DIR}/src/FilamentAsset.cpp
${GLTFIO_DIR}/src/FFilamentInstance.h
${GLTFIO_DIR}/src/FilamentInstance.cpp
${GLTFIO_DIR}/src/FNodeManager.h
${GLTFIO_DIR}/src/GltfEnums.h
${GLTFIO_DIR}/src/Ktx2Provider.cpp
${GLTFIO_DIR}/src/MaterialProvider.cpp
${GLTFIO_DIR}/src/NodeManager.cpp
${GLTFIO_DIR}/src/ResourceLoader.cpp
${GLTFIO_DIR}/src/StbProvider.cpp
${GLTFIO_DIR}/src/TangentsJob.cpp
${GLTFIO_DIR}/src/TangentsJob.h
${GLTFIO_DIR}/src/TangentsJob.cpp
${GLTFIO_DIR}/src/UbershaderLoader.cpp
${GLTFIO_DIR}/src/Wireframe.cpp
${GLTFIO_DIR}/src/Wireframe.h
+6 -9
View File
@@ -1,6 +1,4 @@
android {
namespace 'com.google.android.filament.gltfio'
flavorDimensions "functionality"
productFlavors {
full {
@@ -17,14 +15,13 @@ android {
}
}
}
// No need to package up the following shared libs, which arise as a side effect of our
// externalNativeBuild dependencies. When clients pick and choose from project-level gradle
// dependencies, these shared libs already get pulled in, so we need to avoid the error:
// "More than one file was found with OS independent path ..."
packagingOptions {
// No need to package up the following shared libs, which arise as a side effect of our
// externalNativeBuild dependencies. When clients pick and choose from project-level gradle
// dependencies, these shared libs already get pulled in, so we need to avoid the error:
// "More than one file was found with OS independent path ..."
jniLibs {
excludes += ['lib/*/libfilament-jni.so']
}
exclude 'lib/*/libfilament-jni.so'
}
}
@@ -120,34 +120,10 @@ extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_gltfio_FilamentAsset_nGetLightEntities(JNIEnv* env, jclass,
jlong nativeAsset, jintArray result) {
FilamentAsset* asset = (FilamentAsset*) nativeAsset;
const jsize available = env->GetArrayLength(result);
const size_t minCount = std::min(available, (jsize) asset->getLightEntityCount());
if (minCount == 0) {
return;
}
jsize available = env->GetArrayLength(result);
Entity* entities = (Entity*) env->GetIntArrayElements(result, nullptr);
std::copy_n(asset->getLightEntities(), minCount, entities);
env->ReleaseIntArrayElements(result, (jint*) entities, 0);
}
extern "C" JNIEXPORT jint JNICALL
Java_com_google_android_filament_gltfio_FilamentAsset_nGetRenderableEntityCount(JNIEnv*, jclass,
jlong nativeAsset) {
FilamentAsset* asset = (FilamentAsset*) nativeAsset;
return asset->getRenderableEntityCount();
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_gltfio_FilamentAsset_nGetRenderableEntities(JNIEnv* env, jclass,
jlong nativeAsset, jintArray result) {
FilamentAsset* asset = (FilamentAsset*) nativeAsset;
const jsize available = env->GetArrayLength(result);
const size_t minCount = std::min(available, (jsize) asset->getRenderableEntityCount());
if (minCount == 0) {
return;
}
Entity* entities = (Entity*) env->GetIntArrayElements(result, nullptr);
std::copy_n(asset->getRenderableEntities(), minCount, entities);
std::copy_n(asset->getLightEntities(),
std::min(available, (jsize) asset->getLightEntityCount()), entities);
env->ReleaseIntArrayElements(result, (jint*) entities, 0);
}
@@ -155,13 +131,10 @@ extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_gltfio_FilamentAsset_nGetCameraEntities(JNIEnv* env, jclass,
jlong nativeAsset, jintArray result) {
FilamentAsset* asset = (FilamentAsset*) nativeAsset;
const jsize available = env->GetArrayLength(result);
const size_t minCount = std::min(available, (jsize) asset->getCameraEntityCount());
if (minCount == 0) {
return;
}
jsize available = env->GetArrayLength(result);
Entity* entities = (Entity*) env->GetIntArrayElements(result, nullptr);
std::copy_n(asset->getCameraEntities(), minCount, entities);
std::copy_n(asset->getCameraEntities(),
std::min(available, (jsize) asset->getCameraEntityCount()), entities);
env->ReleaseIntArrayElements(result, (jint*) entities, 0);
}
@@ -30,9 +30,9 @@ import com.google.android.filament.MaterialInstance;
*
* <p>For usage instructions, see the documentation for {@link AssetLoader}.</p>
*
* <p>This class owns a hierarchy of entities that have been loaded from a glTF asset. Every entity
* has a <code>TransformManager</code> component, and some entities also have compnents managed by
* <code>NameComponentManager</code>, <code>RenderableManager</code>, and others.</p>
* <p>This class owns a hierarchy of entities that have been loaded from a glTF asset. Every entity has
* a <code>TransformManager</code> component, and some entities also have
* <code>NameComponentManager</code> and/or <code>RenderableManager</code> components.</p>
*
* <p>In addition to the aforementioned entities, an asset has strong ownership over a list of
* <code>VertexBuffer</code>, <code>IndexBuffer</code>, <code>MaterialInstance</code>, and
@@ -113,15 +113,6 @@ public class FilamentAsset {
return result;
}
/**
* Gets only the entities that have renderable components.
*/
public @NonNull @Entity int[] getRenderableEntities() {
int[] result = new int[nGetRenderableEntityCount(mNativeObject)];
nGetRenderableEntities(mNativeObject, result);
return result;
}
/**
* Gets only the entities that have camera components.
*
@@ -330,9 +321,6 @@ public class FilamentAsset {
private static native int nGetLightEntityCount(long nativeAsset);
private static native void nGetLightEntities(long nativeAsset, int[] result);
private static native int nGetRenderableEntityCount(long nativeAsset);
private static native void nGetRenderableEntities(long nativeAsset, int[] result);
private static native int nGetCameraEntityCount(long nativeAsset);
private static native void nGetCameraEntities(long nativeAsset, int[] result);
+1 -1
View File
@@ -1,5 +1,5 @@
GROUP=com.google.android.filament
VERSION_NAME=1.22.1
VERSION_NAME=1.21.3
POM_DESCRIPTION=Real-time physically based rendering engine for Android.
+1 -1
View File
@@ -1,6 +1,6 @@
#Wed Nov 17 10:40:18 PST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
@@ -25,8 +25,6 @@ clean.doFirst {
}
android {
namespace 'com.google.android.filament.gltf'
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.google.android.filament.gltf"
@@ -34,7 +32,6 @@ android {
targetSdkVersion versions.targetSdk
missingDimensionStrategy 'functionality', 'full'
}
// NOTE: This is a workaround required because the AGP task collectReleaseDependencies
// is not configuration-cache friendly yet; this is only useful for Play publication
dependenciesInfo {
@@ -16,8 +16,6 @@ clean.doFirst {
}
android {
namespace 'com.google.android.filament.hellocam'
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.google.android.filament.hellocamera"
@@ -16,8 +16,6 @@ clean.doFirst {
}
android {
namespace 'com.google.android.filament.hellotriangle'
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.google.android.filament.hellotriangle"
@@ -22,8 +22,6 @@ clean.doFirst {
}
android {
namespace 'com.google.android.filament.ibl'
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.google.android.filament.ibl"
@@ -15,8 +15,6 @@ clean.doFirst {
delete "src/main/assets"
}
android {
namespace 'com.google.android.filament.litcube'
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.google.android.filament.litcube"
@@ -4,8 +4,6 @@ apply plugin: 'kotlin-android'
project.ext.isSample = true
android {
namespace 'com.google.android.filament.livewallpaper'
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.google.android.filament.livewallpaper"
@@ -19,8 +19,6 @@ clean.doFirst {
}
android {
namespace 'com.google.android.filament.material_builder'
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.google.android.filament.material_builder"
@@ -15,8 +15,6 @@ clean.doFirst {
delete "src/main/assets"
}
android {
namespace 'com.google.android.filament.multiview'
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.google.android.filament.multiview"
@@ -18,8 +18,6 @@ clean.doFirst {
}
android {
namespace 'com.google.android.filament.pagecurl'
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.google.android.filament.pagecurl"
@@ -16,8 +16,6 @@ clean.doFirst {
}
android {
namespace 'com.google.android.filament.streamtest'
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.google.android.filament.streamtest"
@@ -16,8 +16,6 @@ clean.doFirst {
}
android {
namespace 'com.google.android.filament.textureview'
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.google.android.filament.textureview"
@@ -22,8 +22,6 @@ clean.doFirst {
}
android {
namespace 'com.google.android.filament.textured'
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.google.android.filament.textured"
@@ -16,8 +16,6 @@ clean.doFirst {
}
android {
namespace 'com.google.android.filament.transparentrendering'
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.google.android.filament.textureview"
+1 -2
View File
@@ -49,8 +49,7 @@ FILAMENT_NDK_VERSION=${FILAMENT_NDK_VERSION:-$(cat `dirname $0`/ndk.version)}
# Install the required NDK version specifically (if not present)
if [[ ! -d "${ANDROID_HOME}/ndk/$FILAMENT_NDK_VERSION" ]]; then
# NOTE: We MUST use Java 1.8 to run sdkmanager currently, it fails starting with Java 11
JAVA_HOME=${JAVA_HOME_8_X64} ${ANDROID_HOME}/tools/bin/sdkmanager "ndk;$FILAMENT_NDK_VERSION" > /dev/null
${ANDROID_HOME}/tools/bin/sdkmanager "ndk;$FILAMENT_NDK_VERSION" > /dev/null
fi
# Only build 1 64 bit target during presubmit to cut down build times during presubmit
+1 -1
View File
@@ -1 +1 @@
24.0.8215888
23.1.7779620
+10 -12
View File
@@ -1633,21 +1633,19 @@ void VulkanDriver::blit(TargetBufferFlags buffers, Handle<HwRenderTarget> dst, V
VkFilter vkfilter = filter == SamplerMagFilter::NEAREST ? VK_FILTER_NEAREST : VK_FILTER_LINEAR;
// The Y inversion below makes it so that Vk matches GL and Metal.
const VkExtent2D srcExtent = srcTarget->getExtent();
const int32_t srcLeft = srcRect.left;
const int32_t srcTop = srcExtent.height - srcRect.bottom - srcRect.height;
const int32_t srcRight = srcRect.left + srcRect.width;
const int32_t srcBottom = srcTop + srcRect.height;
const VkOffset3D srcOffsets[2] = { { srcLeft, srcTop, 0 }, { srcRight, srcBottom, 1 }};
const int32_t srcLeft = std::min(srcRect.left, (int32_t) srcExtent.width);
const int32_t srcBottom = std::min(srcRect.bottom, (int32_t) srcExtent.height);
const int32_t srcRight = std::min(srcRect.left + srcRect.width, srcExtent.width);
const int32_t srcTop = std::min(srcRect.bottom + srcRect.height, srcExtent.height);
const VkOffset3D srcOffsets[2] = { { srcLeft, srcBottom, 0 }, { srcRight, srcTop, 1 }};
const VkExtent2D dstExtent = dstTarget->getExtent();
const int32_t dstLeft = dstRect.left;
const int32_t dstTop = dstExtent.height - dstRect.bottom - dstRect.height;
const int32_t dstRight = dstRect.left + dstRect.width;
const int32_t dstBottom = dstTop + dstRect.height;
const VkOffset3D dstOffsets[2] = { { dstLeft, dstTop, 0 }, { dstRight, dstBottom, 1 }};
const int32_t dstLeft = std::min(dstRect.left, (int32_t) dstExtent.width);
const int32_t dstBottom = std::min(dstRect.bottom, (int32_t) dstExtent.height);
const int32_t dstRight = std::min(dstRect.left + dstRect.width, dstExtent.width);
const int32_t dstTop = std::min(dstRect.bottom + dstRect.height, dstExtent.height);
const VkOffset3D dstOffsets[2] = { { dstLeft, dstBottom, 0 }, { dstRight, dstTop, 1 }};
if (any(buffers & TargetBufferFlags::DEPTH) && srcTarget->hasDepth() && dstTarget->hasDepth()) {
mBlitter.blitDepth({dstTarget, dstOffsets, srcTarget, srcOffsets});
@@ -546,7 +546,6 @@ void transitionImageLayout(VkCommandBuffer cmdbuffer, VulkanLayoutTransition tra
if (transition.oldLayout == transition.newLayout) {
return;
}
assert_invariant(transition.image != VK_NULL_HANDLE && "Please call bindToSwapChain.");
VkImageMemoryBarrier barrier = {};
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
barrier.oldLayout = transition.oldLayout;
-153
View File
@@ -866,157 +866,4 @@ TEST_F(BackendTest, Blit2DTextureArray) {
api.stopCapture(0);
}
TEST_F(BackendTest, BlitRegion) {
auto& api = getDriverApi();
constexpr int kSrcTexWidth = 1024;
constexpr int kSrcTexHeight = 1024;
constexpr auto kSrcTexFormat = TextureFormat::RGBA8;
constexpr int kDstTexWidth = 384;
constexpr int kDstTexHeight = 384;
constexpr auto kDstTexFormat = TextureFormat::RGBA8;
constexpr int kNumLevels = 3;
// Create a SwapChain and make it current. We don't really use it so the res doesn't matter.
auto swapChain = api.createSwapChainHeadless(256, 256, 0);
api.makeCurrent(swapChain, swapChain);
// Create a source texture.
Handle<HwTexture> srcTexture = api.createTexture(
SamplerType::SAMPLER_2D, kNumLevels, kSrcTexFormat, 1, kSrcTexWidth, kSrcTexHeight, 1,
TextureUsage::SAMPLEABLE | TextureUsage::UPLOADABLE | TextureUsage::COLOR_ATTACHMENT);
const bool flipY = sBackend == Backend::OPENGL;
createBitmap(api, srcTexture, kSrcTexWidth, kSrcTexHeight, 0, float3(0.5, 0, 0), flipY);
createBitmap(api, srcTexture, kSrcTexWidth, kSrcTexHeight, 1, float3(0, 0, 0.5), flipY);
// Create a destination texture.
Handle<HwTexture> dstTexture = api.createTexture(
SamplerType::SAMPLER_2D, kNumLevels, kDstTexFormat, 1, kDstTexWidth, kDstTexHeight, 1,
TextureUsage::SAMPLEABLE | TextureUsage::COLOR_ATTACHMENT);
// Create a RenderTarget for each texture's miplevel.
Handle<HwRenderTarget> srcRenderTargets[kNumLevels];
Handle<HwRenderTarget> dstRenderTargets[kNumLevels];
for (uint8_t level = 0; level < kNumLevels; level++) {
srcRenderTargets[level] = api.createRenderTarget( TargetBufferFlags::COLOR,
kSrcTexWidth >> level, kSrcTexHeight >> level, 1, { srcTexture, level, 0 }, {}, {});
dstRenderTargets[level] = api.createRenderTarget( TargetBufferFlags::COLOR,
kDstTexWidth >> level, kDstTexHeight >> level, 1, { dstTexture, level, 0 }, {}, {});
}
// Blit one-quarter of src level 1 to dst level 0.
const int srcLevel = 1;
Viewport srcRect = {
.left = (kSrcTexWidth >> srcLevel) / 2,
.bottom = (kSrcTexHeight >> srcLevel) / 2,
.width = (kSrcTexWidth >> srcLevel) / 2,
.height = (kSrcTexHeight >> srcLevel) / 2,
};
Viewport dstRect = {
.left = 10,
.bottom = 10,
.width = kDstTexWidth - 10,
.height = kDstTexHeight - 10,
};
api.blit(TargetBufferFlags::COLOR0, dstRenderTargets[0],
dstRect, srcRenderTargets[srcLevel],
srcRect, SamplerMagFilter::LINEAR);
// Push through an empty frame to allow the texture to upload and the blit to execute.
api.beginFrame(0, 0);
api.commit(swapChain);
api.endFrame(0);
// Grab a screenshot.
ScreenshotParams params { kDstTexWidth, kDstTexHeight, "BlitRegion.png" };
api.beginFrame(0, 0);
dumpScreenshot(api, dstRenderTargets[0], &params);
api.commit(swapChain);
api.endFrame(0);
// Wait for the ReadPixels result to come back.
api.finish();
executeCommands();
getDriver().purge();
// Cleanup.
api.destroyTexture(srcTexture);
api.destroyTexture(dstTexture);
api.destroySwapChain(swapChain);
for (auto rt : srcRenderTargets) api.destroyRenderTarget(rt);
for (auto rt : dstRenderTargets) api.destroyRenderTarget(rt);
executeCommands();
}
TEST_F(BackendTest, BlitRegionToSwapChain) {
auto& api = getDriverApi();
constexpr int kSrcTexWidth = 1024;
constexpr int kSrcTexHeight = 1024;
constexpr auto kSrcTexFormat = TextureFormat::RGBA8;
constexpr int kDstTexWidth = 512;
constexpr int kDstTexHeight = 512;
constexpr int kNumLevels = 3;
// Create a SwapChain and make it current.
auto swapChain = createSwapChain();
Handle<HwRenderTarget> dstRenderTarget = api.createDefaultRenderTarget();
api.makeCurrent(swapChain, swapChain);
// Create a source texture.
Handle<HwTexture> srcTexture = api.createTexture(
SamplerType::SAMPLER_2D, kNumLevels, kSrcTexFormat, 1, kSrcTexWidth, kSrcTexHeight, 1,
TextureUsage::SAMPLEABLE | TextureUsage::UPLOADABLE | TextureUsage::COLOR_ATTACHMENT);
const bool flipY = sBackend == Backend::OPENGL;
createBitmap(api, srcTexture, kSrcTexWidth, kSrcTexHeight, 0, float3(0.5, 0, 0), flipY);
createBitmap(api, srcTexture, kSrcTexWidth, kSrcTexHeight, 1, float3(0, 0, 0.5), flipY);
// Create a RenderTarget for each texture's miplevel.
Handle<HwRenderTarget> srcRenderTargets[kNumLevels];
for (uint8_t level = 0; level < kNumLevels; level++) {
srcRenderTargets[level] = api.createRenderTarget( TargetBufferFlags::COLOR,
kSrcTexWidth >> level, kSrcTexHeight >> level, 1, { srcTexture, level, 0 }, {}, {});
}
// Blit one-quarter of src level 1 to dst level 0.
const int srcLevel = 1;
Viewport srcRect = {
.left = (kSrcTexWidth >> srcLevel) / 2,
.bottom = (kSrcTexHeight >> srcLevel) / 2,
.width = (kSrcTexWidth >> srcLevel) / 2,
.height = (kSrcTexHeight >> srcLevel) / 2,
};
Viewport dstRect = {
.left = 10,
.bottom = 10,
.width = kDstTexWidth - 10,
.height = kDstTexHeight - 10,
};
api.beginFrame(0, 0);
api.blit(TargetBufferFlags::COLOR0, dstRenderTarget,
dstRect, srcRenderTargets[srcLevel],
srcRect, SamplerMagFilter::LINEAR);
ScreenshotParams params { kDstTexWidth, kDstTexHeight, "BlitRegionToSwapChain.png" };
dumpScreenshot(api, dstRenderTarget, &params);
api.commit(swapChain);
api.endFrame(0);
// Wait for the ReadPixels result to come back.
api.finish();
executeCommands();
getDriver().purge();
// Cleanup.
api.destroyTexture(srcTexture);
api.destroySwapChain(swapChain);
for (auto rt : srcRenderTargets) api.destroyRenderTarget(rt);
executeCommands();
}
} // namespace test
-10
View File
@@ -328,16 +328,6 @@ struct ScreenSpaceReflectionsOptions {
bool enabled = false;
};
/**
* Options for the screen-space guard band.
* A guard band can be enabled to avoid some artifacts towards the edge of the screen when
* using screen-space effects such as SSAO. Enabling the guard band reduces performance slightly.
* Currently the guard band can only be enabled or disabled.
*/
struct GuardBandOptions {
bool enabled = false;
};
/**
* List of available post-processing anti-aliasing techniques.
* @see setAntiAliasing, getAntiAliasing, setSampleCount
+5 -16
View File
@@ -80,8 +80,11 @@ public:
// refresh-rate of the display in Hz. set to 0 for offscreen or turn off frame-pacing.
float refreshRate = 60.0f;
[[deprecated]] uint64_t presentationDeadlineNanos = 0;
[[deprecated]] uint64_t vsyncOffsetNanos = 0;
// how far in advance a buffer must be queued for presentation at a given time in ns
uint64_t presentationDeadlineNanos = 0;
// offset by which vsyncSteadyClockTimeNano provided in beginFrame() is offset in ns
uint64_t vsyncOffsetNanos = 0;
};
/**
@@ -240,20 +243,6 @@ public:
bool beginFrame(SwapChain* swapChain,
uint64_t vsyncSteadyClockTimeNano = 0u);
/**
* Set the time at which the frame must be presented to the display.
*
* This must be called between beginFrame() and endFrame().
*
* @param monotonic_clock_ns the time in nanoseconds corresponding to the system monotonic up-time clock.
* the presentation time is typically set in the middle of the period
* of interest. The presentation time cannot be too far in the
* future because it is limited by how many buffers are available in
* the display sub-system. Typically it is set to 1 or 2 vsync periods
* away.
*/
void setPresentationTime(int64_t monotonic_clock_ns);
/**
* Render a View into this renderer's window.
*
-15
View File
@@ -84,7 +84,6 @@ public:
using VsmShadowOptions = VsmShadowOptions;
using SoftShadowOptions = SoftShadowOptions;
using ScreenSpaceReflectionsOptions = ScreenSpaceReflectionsOptions;
using GuardBandOptions = GuardBandOptions;
/**
* Sets the View's name. Only useful for debugging.
@@ -346,20 +345,6 @@ public:
*/
ScreenSpaceReflectionsOptions const& getScreenSpaceReflectionsOptions() const noexcept;
/**
* Enables or disable screen-space guard band. Disabled by default.
*
* @param options guard band options
*/
void setGuardBandOptions(GuardBandOptions options) noexcept;
/**
* Returns screen-space guard band options.
*
* @return guard band options
*/
GuardBandOptions const& getGuardBandOptions() const noexcept;
/**
* Enables or disable multi-sample anti-aliasing (MSAA). Disabled by default.
*
-4
View File
@@ -32,10 +32,6 @@ void Renderer::render(View const* view) {
upcast(this)->render(upcast(view));
}
void Renderer::setPresentationTime(int64_t monotonic_clock_ns) {
upcast(this)->setPresentationTime(monotonic_clock_ns);
}
bool Renderer::beginFrame(SwapChain* swapChain, uint64_t vsyncSteadyClockTimeNano) {
return upcast(this)->beginFrame(upcast(swapChain), vsyncSteadyClockTimeNano);
}
+2 -2
View File
@@ -22,6 +22,7 @@
#include "details/Engine.h"
#include "details/Scene.h"
#include "details/View.h"
#include <backend/DriverEnums.h>
@@ -30,11 +31,10 @@
#include <limits>
using namespace filament::math;
using namespace utils;
namespace filament {
using namespace math;
using namespace backend;
// do this only if depth-clamp is available
+2 -36
View File
@@ -30,43 +30,9 @@
namespace filament {
class FView;
class RenderPass;
// The value of the 'VISIBLE_MASK' after culling. Each bit represents visibility in a frustum
// (either camera or light).
//
// 1
// bits 5 ... 7 6 5 4 3 2 1 0
// +------------------------------------------------------+
// VISIBLE_RENDERABLE X
// VISIBLE_DIR_SHADOW_RENDERABLE X
// VISIBLE_SPOT_SHADOW_RENDERABLE_0 X
// VISIBLE_SPOT_SHADOW_RENDERABLE_1 X
// ...
// A "shadow renderable" is a renderable rendered to the shadow map during a shadow pass:
// PCF shadows: only shadow casters
// VSM shadows: both shadow casters and shadow receivers
static constexpr size_t VISIBLE_RENDERABLE_BIT = 0u;
static constexpr size_t VISIBLE_DIR_SHADOW_RENDERABLE_BIT = 1u;
static constexpr size_t VISIBLE_SPOT_SHADOW_RENDERABLE_N_BIT(size_t n) { return n + 2; }
static constexpr Culler::result_type VISIBLE_DIR_SHADOW_RENDERABLE = 1u << VISIBLE_DIR_SHADOW_RENDERABLE_BIT;
static constexpr Culler::result_type VISIBLE_SPOT_SHADOW_RENDERABLE_N(size_t n) {
return 1u << VISIBLE_SPOT_SHADOW_RENDERABLE_N_BIT(n);
}
// ORing of all the VISIBLE_SPOT_SHADOW_RENDERABLE bits
static constexpr Culler::result_type VISIBLE_SPOT_SHADOW_RENDERABLE =
(0xFFu >> (sizeof(Culler::result_type) * 8u - CONFIG_MAX_SHADOW_CASTING_SPOTS)) << 2u;
// Because we're using a uint16_t for the visibility mask, we're limited to 14 spot light shadows.
// (2 of the bits are used for visible renderables + directional light shadow casters).
static_assert(CONFIG_MAX_SHADOW_CASTING_SPOTS <= sizeof(Culler::result_type) * 8 - 2,
"CONFIG_MAX_SHADOW_CASTING_SPOTS cannot be higher than 14.");
class ShadowMap {
public:
explicit ShadowMap(FEngine& engine) noexcept;
@@ -141,7 +107,7 @@ public:
SceneInfo& sceneInfo) noexcept;
void render(FScene const& scene, utils::Range<uint32_t> range,
FScene::VisibleMaskType visibilityMask, RenderPass* pass) noexcept;
FScene::VisibleMaskType visibilityMask, RenderPass* const pass) noexcept;
// Do we have visible shadows. Valid after calling update().
bool hasVisibleShadows() const noexcept { return mHasVisibleShadows; }
+4 -1
View File
@@ -24,6 +24,8 @@
#include <fg/FrameGraph.h>
#include <private/filament/SibGenerator.h>
#include <utils/debug.h>
#include <utils/FixedCapacityVector.h>
@@ -115,7 +117,8 @@ void ShadowMapManager::addSpotShadowMap(size_t lightIndex,
mSpotShadowMaps.emplace_back(shadowMap, lightIndex, options);
}
FrameGraphId<FrameGraphTexture> ShadowMapManager::render(FrameGraph& fg, FEngine& engine,
FrameGraphId<FrameGraphTexture> ShadowMapManager::render(FrameGraph& fg,
FEngine& engine, backend::DriverApi& driver,
RenderPass const& pass, FView& view) noexcept {
constexpr size_t MAX_SHADOW_LAYERS =
+4 -1
View File
@@ -29,6 +29,7 @@
#include <private/backend/DriverApi.h>
#include <private/backend/DriverApiForward.h>
#include <private/backend/SamplerGroup.h>
#include <backend/DriverEnums.h>
#include <backend/Handle.h>
@@ -39,11 +40,13 @@
#include <array>
#include <memory>
#include <vector>
namespace filament {
class FView;
class FrameGraph;
class ShadowMap;
class RenderPass;
struct ShadowMappingUniforms {
@@ -86,7 +89,7 @@ public:
FScene::RenderableSoa& renderableData, FScene::LightSoa& lightData) noexcept;
// Renders all the shadow maps.
FrameGraphId<FrameGraphTexture> render(FrameGraph& fg, FEngine& engine,
FrameGraphId<FrameGraphTexture> render(FrameGraph& fg, FEngine& engine, backend::DriverApi& driver,
RenderPass const& pass, FView& view) noexcept;
ShadowMap* getCascadeShadowMap(size_t cascade) noexcept {
-8
View File
@@ -123,14 +123,6 @@ const View::ScreenSpaceReflectionsOptions& View::getScreenSpaceReflectionsOption
return upcast(this)->getScreenSpaceReflectionsOptions();
}
void View::setGuardBandOptions(GuardBandOptions options) noexcept {
upcast(this)->setGuardBandOptions(options);
}
GuardBandOptions const& View::getGuardBandOptions() const noexcept {
return upcast(this)->getGuardBandOptions();
}
void View::setColorGrading(ColorGrading* colorGrading) noexcept {
return upcast(this)->setColorGrading(upcast(colorGrading));
}
+7
View File
@@ -477,6 +477,13 @@ public:
float dzn = -1.0f;
float dzf = 1.0f;
} shadowmap;
struct {
bool enabled = true;
int sampleCount = 7;
int spiralTurns = 1;
int kernelSize = 23;
float stddev = 8.0f;
} ssao;
struct {
bool camera_at_origin = true;
struct {
+49 -28
View File
@@ -66,6 +66,8 @@ FRenderer::FRenderer(FEngine& engine) :
mPerRenderPassArena(engine.getPerRenderPassAllocator())
{
FDebugRegistry& debugRegistry = engine.getDebugRegistry();
debugRegistry.registerProperty("d.ssao.enabled",
&engine.debug.ssao.enabled);
debugRegistry.registerProperty("d.renderer.doFrameCapture",
&engine.debug.renderer.doFrameCapture);
@@ -175,10 +177,6 @@ void FRenderer::initializeClearFlags() {
| TargetBufferFlags::DEPTH_AND_STENCIL;
}
void FRenderer::setPresentationTime(int64_t monotonic_clock_ns) {
FEngine::DriverApi& driver = mEngine.getDriverApi();
driver.setPresentationTime(monotonic_clock_ns);
}
bool FRenderer::beginFrame(FSwapChain* swapChain, uint64_t vsyncSteadyClockTimeNano) {
assert_invariant(swapChain);
@@ -192,6 +190,7 @@ bool FRenderer::beginFrame(FSwapChain* swapChain, uint64_t vsyncSteadyClockTimeN
const time_point<steady_clock> appVsync(vsyncSteadyClockTimeNano ? userVsync : now);
mFrameId++;
mViewRenderedCount = 0;
{ // scope for frame id trace
char buf[64];
@@ -231,7 +230,7 @@ bool FRenderer::beginFrame(FSwapChain* swapChain, uint64_t vsyncSteadyClockTimeN
* to ignore the return value and render the frame anyways -- which is perfectly fine.
* The remaining work will be done when the first render() call is made.
*/
auto beginFrameInternal = [this, appVsync]() {
auto beginFrameInternal = [this, appVsync, vsyncSteadyClockTimeNano]() {
FEngine& engine = mEngine;
FEngine::DriverApi& driver = engine.getDriverApi();
@@ -244,6 +243,38 @@ bool FRenderer::beginFrame(FSwapChain* swapChain, uint64_t vsyncSteadyClockTimeN
.historySize = mFrameRateOptions.history
}, mFrameId);
if (false && vsyncSteadyClockTimeNano) { // work in progress
const size_t interval = mFrameRateOptions.interval; // user requested swap-interval;
const steady_clock::duration refreshPeriod(uint64_t(1e9 / mDisplayInfo.refreshRate));
const steady_clock::duration presentationDeadline(mDisplayInfo.presentationDeadlineNanos);
const steady_clock::duration vsyncOffset(mDisplayInfo.vsyncOffsetNanos);
// hardware vsync timestamp
steady_clock::time_point hwVsync = appVsync - vsyncOffset;
// compute our desired presentation time. We can't pick a desired presentation time
// that's too far, or we won't be able to dequeue buffers.
steady_clock::time_point desiredPresentationTime = hwVsync + 2 * interval * refreshPeriod;
// Compute the deadline. This deadline is when the GPU must be finished.
// The deadline has 1ms backed in it on Android.
UTILS_UNUSED_IN_RELEASE
steady_clock::time_point deadline = desiredPresentationTime - presentationDeadline;
// one important thing is to make sure that the deadline is comfortably later than
// when the gpu will finish, otherwise we'll have inconsistent latency/frames.
// TODO: evaluate if we can make it in time, and if not why.
// If the problem is cpu+gpu latency we can try to push the desired presentation time
// further away, but this has limits, as only 2 buffers are dequeuable.
// If the problem is the gpu is overwhelmed, then we need to
// - see if there is more headroom in dynamic resolution
// - or start skipping frames. Ideally lower the framerate to
// presentation time is set to the middle of the period we're interested in
steady_clock::time_point presentationTime = desiredPresentationTime - refreshPeriod / 2;
driver.setPresentationTime(presentationTime.time_since_epoch().count());
}
// ask the engine to do what it needs to (e.g. updates light buffer, materials...)
engine.prepare();
};
@@ -420,9 +451,13 @@ void FRenderer::render(FView const* view) {
}
if (UTILS_LIKELY(view && view->getScene())) {
// NOTE: in the past we tried to kick the GPU here with a flush (b2cdf9f), but this
// was problematic on certain devices. b/232224942
if (mViewRenderedCount) {
// this is a good place to kick the GPU, since we've rendered a View before
// and we're about to render another one.
mEngine.getDriverApi().flush();
}
renderInternal(view);
mViewRenderedCount++;
}
}
@@ -469,7 +504,6 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) {
auto vignetteOptions = view.getVignetteOptions();
auto colorGrading = view.getColorGrading();
auto ssReflectionsOptions = view.getScreenSpaceReflectionsOptions();
auto guardBandOptions = view.getGuardBandOptions();
const uint8_t msaaSampleCount = msaaOptions.enabled ? msaaOptions.sampleCount : 1u;
if (!hasPostProcess) {
// disable all effects that are part of post-processing
@@ -532,15 +566,12 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) {
CameraInfo cameraInfo = view.computeCameraInfo(engine);
// when colorgrading-as-subpass is active, we know that many other effects are disabled
// such as dof, bloom. Moreover, if fxaa and scaling are not enabled, we're essentially in
// such as dof, bloom. Moreover if fxaa and scaling are not enabled, we're essentially in
// a very fast rendering path -- in this case, we would need an extra blit to "resolve" the
// buffer padding (because there are no other pass that can do it as a side effect).
// In this case, it is better to skip the padding, which won't be helping much.
const bool noBufferPadding = colorGradingConfig.asSubpass && !hasFXAA && !scaled;
// guardBand must be a multiple of 16 to guarantee the same exact rendering up to 4 mip levels.
float guardBand = guardBandOptions.enabled ? 16.0f : 0.0f;
if (hasPostProcess && !noBufferPadding) {
// We always pad the rendering viewport to dimensions multiple of 16, this guarantees
// that up to 4 mipmap levels are possible with an exact 1:2 scale. This also helps
@@ -555,14 +586,10 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) {
// Without post-processing, we usually draw directly into
// the SwapChain, and we might want to keep it this way.
auto round = [](uint32_t x) {
constexpr uint32_t rounding = 16u;
return (x + (rounding - 1u)) & ~(rounding - 1u);
};
// compute the new rendering width and height, multiple of 16.
const float width = float(round(svp.width )) + 2.0f * guardBand;
const float height = float(round(svp.height)) + 2.0f * guardBand;
constexpr uint32_t rounding = 16u;
const float width = float( (svp.width + (rounding - 1u)) & ~(rounding - 1u) );
const float height = float( (svp.height + (rounding - 1u)) & ~(rounding - 1u) );
// scale the field-of-view up, so it covers exactly the extra pixels
const float3 clipSpaceScaling{
@@ -577,8 +604,8 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) {
// note: this creates an asymmetric frustum -- but we eventually copy only the
// left/bottom part, which is a symmetric region.
const float2 clipSpaceTranslation{
1.0f - clipSpaceScaling.x - 2.0f * guardBand / width,
1.0f - clipSpaceScaling.y - 2.0f * guardBand / height
1.0f - clipSpaceScaling.x,
1.0f - clipSpaceScaling.y
};
mat4f ts = mat4f::scaling(clipSpaceScaling);
@@ -590,8 +617,6 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) {
// adjust svp to the new, larger, rendering dimensions
svp.width = uint32_t(width);
svp.height = uint32_t(height);
xvp.left = int32_t(guardBand);
xvp.bottom = int32_t(guardBand);
}
view.prepare(engine, driver, arena, svp, cameraInfo, getShaderUserTime(), needsAlphaChannel);
@@ -960,7 +985,7 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) {
// --------------------------------------------------------------------------------------------
// Post Processing...
UTILS_UNUSED_IN_RELEASE auto const& inputDesc = fg.getDescriptor(input);
auto const& inputDesc = fg.getDescriptor(input);
assert_invariant(inputDesc.width == svp.width);
assert_invariant(inputDesc.height == svp.height);
@@ -992,7 +1017,6 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) {
bloomOptions, vignetteOptions);
// the padded buffer is resolved now
xvp.left = xvp.bottom = 0;
svp = xvp;
}
}
@@ -1001,7 +1025,6 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) {
!hasColorGrading || needsAlphaChannel);
// the padded buffer is resolved now
xvp.left = xvp.bottom = 0;
svp = xvp;
}
if (scaled) {
mightNeedFinalBlit = false;
@@ -1015,8 +1038,6 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) {
.width = viewport.width, .height = viewport.height,
.format = colorGradingConfig.ldrFormat });
}
xvp.left = xvp.bottom = 0;
svp = xvp;
}
}
+2 -4
View File
@@ -75,9 +75,6 @@ public:
// renders a single standalone view. The view must have a a custom rendertarget.
void renderStandaloneView(FView const* view);
void setPresentationTime(int64_t monotonic_clock_ns);
// start a frame
bool beginFrame(FSwapChain* swapChain, uint64_t vsyncSteadyClockTimeNano);
@@ -102,7 +99,7 @@ public:
void setDisplayInfo(DisplayInfo const& info) noexcept {
mDisplayInfo.refreshRate = info.refreshRate;
mDisplayInfo = info;
}
void setFrameRateOptions(FrameRateOptions const& options) noexcept {
@@ -164,6 +161,7 @@ private:
FSwapChain* mSwapChain = nullptr;
size_t mCommandsHighWatermark = 0;
uint32_t mFrameId = 0;
uint32_t mViewRenderedCount = 0;
FrameInfoManager mFrameInfoManager;
backend::TextureFormat mHdrTranslucent;
backend::TextureFormat mHdrQualityMedium;
+2 -5
View File
@@ -17,6 +17,7 @@
#include "details/View.h"
#include "Culler.h"
#include "DFG.h"
#include "Froxelizer.h"
#include "RenderPrimitive.h"
#include "ResourceAllocator.h"
@@ -886,7 +887,7 @@ void FView::updatePrimitivesLod(FEngine& engine, const CameraInfo&,
FrameGraphId<FrameGraphTexture> FView::renderShadowMaps(FrameGraph& fg, FEngine& engine,
FEngine::DriverApi& driver,
RenderPass const& pass) noexcept {
return mShadowMapManager.render(fg, engine, pass, *this);
return mShadowMapManager.render(fg, engine, driver, pass, *this);
}
void FView::commitFrameHistory(FEngine& engine) noexcept {
@@ -953,10 +954,6 @@ void FView::setScreenSpaceReflectionsOptions(ScreenSpaceReflectionsOptions optio
mScreenSpaceReflectionsOptions = options;
}
void FView::setGuardBandOptions(GuardBandOptions options) noexcept {
mGuardBandOptions = options;
}
void FView::setAmbientOcclusionOptions(AmbientOcclusionOptions options) noexcept {
options.radius = math::max(0.0f, options.radius);
options.power = std::max(0.0f, options.power);
+33 -7
View File
@@ -73,7 +73,40 @@ class FMaterialInstance;
class FRenderer;
class FScene;
// The value of the 'VISIBLE_MASK' after culling. Each bit represents visibility in a frustum
// (either camera or light).
//
// 1
// bits 5 ... 7 6 5 4 3 2 1 0
// +------------------------------------------------------+
// VISIBLE_RENDERABLE X
// VISIBLE_DIR_SHADOW_RENDERABLE X
// VISIBLE_SPOT_SHADOW_RENDERABLE_0 X
// VISIBLE_SPOT_SHADOW_RENDERABLE_1 X
// ...
// A "shadow renderable" is a renderable rendered to the shadow map during a shadow pass:
// PCF shadows: only shadow casters
// VSM shadows: both shadow casters and shadow receivers
static constexpr size_t VISIBLE_RENDERABLE_BIT = 0u;
static constexpr size_t VISIBLE_DIR_SHADOW_RENDERABLE_BIT = 1u;
static constexpr size_t VISIBLE_SPOT_SHADOW_RENDERABLE_N_BIT(size_t n) { return n + 2; }
static constexpr Culler::result_type VISIBLE_RENDERABLE = 1u << VISIBLE_RENDERABLE_BIT;
static constexpr Culler::result_type VISIBLE_DIR_SHADOW_RENDERABLE = 1u << VISIBLE_DIR_SHADOW_RENDERABLE_BIT;
static constexpr Culler::result_type VISIBLE_SPOT_SHADOW_RENDERABLE_N(size_t n) {
return 1u << VISIBLE_SPOT_SHADOW_RENDERABLE_N_BIT(n);
}
// ORing of all the VISIBLE_SPOT_SHADOW_RENDERABLE bits
static constexpr Culler::result_type VISIBLE_SPOT_SHADOW_RENDERABLE =
(0xFFu >> (sizeof(Culler::result_type) * 8u - CONFIG_MAX_SHADOW_CASTING_SPOTS)) << 2u;
// Because we're using a uint16_t for the visibility mask, we're limited to 14 spot light shadows.
// (2 of the bits are used for visible renderables + directional light shadow casters).
static_assert(CONFIG_MAX_SHADOW_CASTING_SPOTS <= sizeof(Culler::result_type) * 8 - 2,
"CONFIG_MAX_SHADOW_CASTING_SPOTS cannot be higher than 14.");
// ------------------------------------------------------------------------------------------------
@@ -232,12 +265,6 @@ public:
return mScreenSpaceReflectionsOptions;
}
void setGuardBandOptions(GuardBandOptions options) noexcept;
GuardBandOptions const& getGuardBandOptions() const noexcept {
return mGuardBandOptions;
}
void setColorGrading(FColorGrading* colorGrading) noexcept {
mColorGrading = colorGrading == nullptr ? mDefaultColorGrading : colorGrading;
}
@@ -500,7 +527,6 @@ private:
TemporalAntiAliasingOptions mTemporalAntiAliasingOptions;
MultiSampleAntiAliasingOptions mMultiSampleAntiAliasingOptions;
ScreenSpaceReflectionsOptions mScreenSpaceReflectionsOptions;
GuardBandOptions mGuardBandOptions;
BlendMode mBlendMode = BlendMode::OPAQUE;
const FColorGrading* mColorGrading = nullptr;
const FColorGrading* mDefaultColorGrading = nullptr;
-5
View File
@@ -215,11 +215,6 @@ void FrameGraph::execute(backend::DriverApi& driver) noexcept {
driver.popGroupMarker();
}
// NOTE: in the past we tried to make this flush conditional (b2cdf9f), but this
// was problematic on certain devices. b/232224942
driver.flush();
driver.popGroupMarker();
}
+2 -2
View File
@@ -1,12 +1,12 @@
Pod::Spec.new do |spec|
spec.name = "Filament"
spec.version = "1.22.1"
spec.version = "1.21.3"
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.22.1/filament-v1.22.1-ios.tgz" }
spec.source = { :http => "https://github.com/google/filament/releases/download/v1.21.3/filament-v1.21.3-ios.tgz" }
# Fix linking error with Xcode 12; we do not yet support the simulator on Apple silicon.
spec.pod_target_xcconfig = {
@@ -233,7 +233,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -291,7 +291,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -165,7 +165,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -262,7 +262,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -366,7 +366,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -505,7 +505,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -219,7 +219,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -281,7 +281,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -336,7 +336,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -495,7 +495,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -345,7 +345,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -448,7 +448,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -507,7 +507,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -602,7 +602,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -232,7 +232,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -390,7 +390,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -452,7 +452,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -507,7 +507,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -212,7 +212,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -403,7 +403,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -454,7 +454,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -549,7 +549,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -236,7 +236,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -375,7 +375,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -426,7 +426,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -517,7 +517,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -186,7 +186,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -237,7 +237,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -296,7 +296,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -507,7 +507,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
-7
View File
@@ -441,13 +441,6 @@ std::shared_ptr<spvtools::Optimizer> GLSLPostProcessor::createOptimizer(
registerSizePasses(*optimizer, config);
} else if (optimization == MaterialBuilder::Optimization::PERFORMANCE) {
registerPerformancePasses(*optimizer, config);
// Metal doesn't support relaxed precision, but does have support for float16 math operations.
if (config.targetApi == MaterialBuilder::TargetApi::METAL) {
optimizer->RegisterPass(CreateConvertRelaxedToHalfPass());
optimizer->RegisterPass(CreateSimplificationPass());
optimizer->RegisterPass(CreateRedundancyEliminationPass());
optimizer->RegisterPass(CreateAggressiveDCEPass());
}
}
return optimizer;
-1
View File
@@ -51,7 +51,6 @@ public:
struct Config {
filament::Variant variant;
MaterialBuilder::TargetApi targetApi;
filament::backend::ShaderType shaderType;
filament::backend::ShaderModel shaderModel;
filament::MaterialDomain domain;
-1
View File
@@ -727,7 +727,6 @@ bool MaterialBuilder::generateShaders(JobSystem& jobSystem, const std::vector<Va
#ifndef FILAMAT_LITE
GLSLPostProcessor::Config config{
.variant = v.variant,
.targetApi = targetApi,
.shaderType = v.stage,
.shaderModel = shaderModel,
.domain = mMaterialDomain,
+5 -8
View File
@@ -10,11 +10,10 @@ set(PUBLIC_HDR_DIR include)
set(PUBLIC_HDRS
include/gltfio/Animator.h
include/gltfio/AssetLoader.h
include/gltfio/MaterialProvider.h
include/gltfio/ResourceLoader.h
include/gltfio/FilamentAsset.h
include/gltfio/FilamentInstance.h
include/gltfio/MaterialProvider.h
include/gltfio/NodeManager.h
include/gltfio/ResourceLoader.h
include/gltfio/TextureProvider.h
include/gltfio/math.h
)
@@ -24,21 +23,19 @@ set(SRCS
src/AssetLoader.cpp
src/DependencyGraph.cpp
src/DependencyGraph.h
src/DracoCache.cpp
src/DracoCache.h
src/DracoCache.cpp
src/FFilamentAsset.h
src/FFilamentInstance.h
src/FilamentAsset.cpp
src/FFilamentInstance.h
src/FilamentInstance.cpp
src/FNodeManager.h
src/GltfEnums.h
src/Ktx2Provider.cpp
src/MaterialProvider.cpp
src/NodeManager.cpp
src/ResourceLoader.cpp
src/StbProvider.cpp
src/TangentsJob.cpp
src/TangentsJob.h
src/TangentsJob.cpp
src/UbershaderLoader.cpp
src/Wireframe.cpp
src/Wireframe.h
+2 -7
View File
@@ -36,8 +36,6 @@ namespace utils {
*/
namespace gltfio {
class NodeManager;
/**
* \struct AssetConfiguration AssetLoader.h gltfio/AssetLoader.h
* \brief Construction parameters for AssetLoader.
@@ -72,8 +70,7 @@ struct AssetConfiguration {
* object, which is a bundle of Filament entities, material instances, textures, vertex buffers,
* and index buffers.
*
* Clients must use AssetLoader to create and destroy FilamentAsset objects. This is similar to
* how filament::Engine is used to create and destroy core objects like VertexBuffer.
* Clients must use AssetLoader to create and destroy FilamentAsset objects.
*
* AssetLoader does not fetch external buffer data or create textures on its own. Clients can use
* ResourceLoader for this, which obtains the URI list from the asset. This is demonstrated in the
@@ -229,9 +226,7 @@ public:
utils::NameComponentManager* getNames() const noexcept;
NodeManager& getNodeManager() noexcept;
MaterialProvider& getMaterialProvider() noexcept;
MaterialProvider* getMaterialProvider() const noexcept;
/*! \cond PRIVATE */
protected:
+17 -54
View File
@@ -20,8 +20,6 @@
#include <filament/Box.h>
#include <filament/TextureSampler.h>
#include <gltfio/NodeManager.h>
#include <utils/compiler.h>
#include <utils/Entity.h>
@@ -29,7 +27,6 @@ namespace filament {
class Camera;
class Engine;
class MaterialInstance;
class Scene;
}
namespace gltfio {
@@ -45,7 +42,7 @@ class FilamentInstance;
*
* This class owns a hierarchy of entities that have been loaded from a glTF asset. Every entity has
* a filament::TransformManager component, and some entities also have \c Name, \c Renderable,
* \c Light, \c Camera, or \c Node components.
* \c Light, or \c Camera components.
*
* In addition to the aforementioned entities, an asset has strong ownership over a list of
* filament::VertexBuffer, filament::IndexBuffer, filament::MaterialInstance, filament::Texture,
@@ -58,14 +55,12 @@ class FilamentInstance;
*/
class UTILS_PUBLIC FilamentAsset {
public:
using Entity = utils::Entity;
using SceneMask = NodeManager::SceneMask;
/**
* Gets the list of entities, one for each glTF node. All of these have a Transform component.
* Some of the returned entities may also have a Renderable component and/or a Light component.
*/
const Entity* getEntities() const noexcept;
const utils::Entity* getEntities() const noexcept;
/**
* Gets the number of entities returned by getEntities().
@@ -75,23 +70,13 @@ public:
/**
* Gets the list of entities in the scene representing lights. All of these have a Light component.
*/
const Entity* getLightEntities() const noexcept;
const utils::Entity* getLightEntities() const noexcept;
/**
* Gets the number of entities returned by getLightEntities().
*/
size_t getLightEntityCount() const noexcept;
/**
* Gets the list of entities in the asset that have renderable components.
*/
const utils::Entity* getRenderableEntities() const noexcept;
/**
* Gets the number of entities returned by getRenderableEntities().
*/
size_t getRenderableEntityCount() const noexcept;
/**
* Gets the list of entities in the scene representing cameras. All of these have a \c Camera
* component.
@@ -110,7 +95,7 @@ public:
*
* @see filament::Camera::setScaling
*/
const Entity* getCameraEntities() const noexcept;
const utils::Entity* getCameraEntities() const noexcept;
/**
* Gets the number of entities returned by getCameraEntities().
@@ -124,7 +109,7 @@ public:
* assets, this is a "super root" where each of its children is a root in a particular instance.
* This allows users to transform all instances en masse if they wish to do so.
*/
Entity getRoot() const noexcept;
utils::Entity getRoot() const noexcept;
/**
* Pops a ready renderable off the queue, or returns 0 if no renderables have become ready.
@@ -137,12 +122,12 @@ public:
* textures gradually become ready through asynchronous loading. For example, on every frame
* progressive applications can do something like this:
*
* while (Entity e = popRenderable()) { scene.addEntity(e); }
* while (utils::Entity e = popRenderable()) { scene.addEntity(e); }
*
* \see ResourceLoader#asyncBeginLoad
* \see popRenderables()
*/
Entity popRenderable() noexcept;
utils::Entity popRenderable() noexcept;
/**
* Pops up to "count" ready renderables off the queue, or returns the available number.
@@ -153,7 +138,7 @@ public:
*
* \see ResourceLoader#asyncBeginLoad
*/
size_t popRenderables(Entity* entities, size_t count) noexcept;
size_t popRenderables(utils::Entity* entities, size_t count) noexcept;
/** Gets all material instances. These are already bound to renderables. */
const filament::MaterialInstance* const* getMaterialInstances() const noexcept;
@@ -174,10 +159,10 @@ public:
filament::Aabb getBoundingBox() const noexcept;
/** Gets the NameComponentManager label for the given entity, if it exists. */
const char* getName(Entity) const noexcept;
const char* getName(utils::Entity) const noexcept;
/** Returns the first entity with the given name, or 0 if none exist. */
Entity getFirstEntityByName(const char* name) noexcept;
utils::Entity getFirstEntityByName(const char* name) noexcept;
/**
* Gets a list of entities with the given name.
@@ -189,7 +174,7 @@ public:
* @return If entities is non-null, the number of entities written to the entity pointer.
* Otherwise this returns the number of entities with the given name.
*/
size_t getEntitiesByName(const char* name, Entity* entities,
size_t getEntitiesByName(const char* name, utils::Entity* entities,
size_t maxCount) const noexcept;
/**
@@ -202,11 +187,11 @@ public:
* @return If entities is non-null, the number of entities written to the entity pointer.
* Otherwise this returns the number of entities with the given prefix.
*/
size_t getEntitiesByPrefix(const char* prefix, Entity* entities,
size_t getEntitiesByPrefix(const char* prefix, utils::Entity* entities,
size_t maxCount) const noexcept;
/** Gets the glTF extras string for a specific node, or for the asset, if it exists. */
const char* getExtras(Entity entity = {}) const noexcept;
const char* getExtras(utils::Entity entity = {}) const noexcept;
/**
* Returns the animation engine.
@@ -236,17 +221,17 @@ public:
/**
* Gets joints at skin index.
*/
const Entity* getJointsAt(size_t skinIndex) const noexcept;
const utils::Entity* getJointsAt(size_t skinIndex) const noexcept;
/**
* Gets the morph target name at the given index in the given entity.
*/
const char* getMorphTargetNameAt(Entity entity, size_t targetIndex) const noexcept;
const char* getMorphTargetNameAt(utils::Entity entity, size_t targetIndex) const noexcept;
/**
* Returns the number of morph targets in the given entity.
*/
size_t getMorphTargetCountAt(Entity entity) const noexcept;
size_t getMorphTargetCountAt(utils::Entity entity) const noexcept;
/**
* Returns the number of material variants in the asset.
@@ -276,7 +261,7 @@ public:
* Lazily creates a single LINES renderable that draws the transformed bounding-box hierarchy
* for diagnostic purposes. The wireframe is owned by the asset so clients should not delete it.
*/
Entity getWireframe() noexcept;
utils::Entity getWireframe() noexcept;
/**
* Returns the Filament engine associated with the AssetLoader that created this asset.
@@ -297,28 +282,6 @@ public:
*/
const void* getSourceAsset() noexcept;
/**
* Returns the number of scenes in the asset.
*/
size_t getSceneCount() const noexcept;
/**
* Returns the name of the given scene.
*
* Returns null if the given scene does not have a name or is out of bounds.
*/
const char* getSceneName(size_t sceneIndex) const noexcept;
/**
* Adds entities to a Filament scene only if they belong to at least one of the given glTF
* scenes.
*
* This is just a helper that provides an alternative to directly calling scene->addEntities()
* and provides filtering functionality.
*/
void addEntitiesToScene(filament::Scene& targetScene, const Entity* entities, size_t count,
SceneMask sceneFilter);
/*! \cond PRIVATE */
FilamentInstance** getAssetInstances() noexcept;
-110
View File
@@ -1,110 +0,0 @@
/*
* Copyright (C) 2022 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 GLTFIO_NODEMANAGER_H
#define GLTFIO_NODEMANAGER_H
#include <filament/FilamentAPI.h>
#include <utils/bitset.h>
#include <utils/compiler.h>
#include <utils/CString.h>
#include <utils/EntityInstance.h>
#include <utils/FixedCapacityVector.h>
namespace utils {
class Entity;
} // namespace utils
namespace gltfio {
class FNodeManager;
/**
* NodeManager is used to add annotate entities with glTF-specific information.
*
* Node components are created by gltfio and exposed to users to allow inspection.
*
* Nodes do not store the glTF hierarchy or names; see TransformManager and NameComponentManager.
*/
class UTILS_PUBLIC NodeManager {
public:
using Instance = utils::EntityInstance<NodeManager>;
using Entity = utils::Entity;
using CString = utils::CString;
using SceneMask = utils::bitset32;
static constexpr size_t MAX_SCENE_COUNT = 32;
/**
* Returns whether a particular Entity is associated with a component of this NodeManager
* @param e An Entity.
* @return true if this Entity has a component associated with this manager.
*/
bool hasComponent(Entity e) const noexcept;
/**
* Gets an Instance representing the node component associated with the given Entity.
* @param e An Entity.
* @return An Instance object, which represents the node component associated with the Entity e.
* @note Use Instance::isValid() to make sure the component exists.
* @see hasComponent()
*/
Instance getInstance(Entity e) const noexcept;
/**
* Creates a node component and associates it with the given entity.
* @param entity An Entity to associate a node component with.
*
* If this component already exists on the given entity, it is first destroyed as if
* destroy(Entity e) was called.
*
* @see destroy()
*/
void create(Entity entity);
/**
* Destroys this component from the given entity.
* @param e An entity.
*
* @see create()
*/
void destroy(Entity e) noexcept;
void setMorphTargetNames(Instance ci, utils::FixedCapacityVector<CString> names) noexcept;
const utils::FixedCapacityVector<CString>& getMorphTargetNames(Instance ci) const noexcept;
void setExtras(Instance ci, CString extras) noexcept;
const CString& getExtras(Instance ci) const noexcept;
void setSceneMembership(Instance ci, SceneMask scenes) noexcept;
SceneMask getSceneMembership(Instance ci) const noexcept;
protected:
NodeManager() noexcept = default;
~NodeManager() = default;
public:
NodeManager(NodeManager const&) = delete;
NodeManager(NodeManager&&) = delete;
NodeManager& operator=(NodeManager const&) = delete;
NodeManager& operator=(NodeManager&&) = delete;
};
} // namespace gltfio
#endif // GLTFIO_NODEMANAGER_H
+52 -85
View File
@@ -20,7 +20,6 @@
#include <gltfio/math.h>
#include "FFilamentAsset.h"
#include "FNodeManager.h"
#include "GltfEnums.h"
#include <filament/Box.h>
@@ -61,8 +60,6 @@ using namespace utils;
namespace gltfio {
using SceneMask = NodeManager::SceneMask;
void importSkins(const cgltf_data* gltf, const NodeMap& nodeMap, SkinVector& dstSkins);
static const auto FREE_CALLBACK = [](void* mem, size_t, void*) { free(mem); };
@@ -96,8 +93,8 @@ struct FAssetLoader : public AssetLoader {
mRenderableManager(config.engine->getRenderableManager()),
mNameManager(config.names),
mTransformManager(config.engine->getTransformManager()),
mMaterials(*config.materials),
mEngine(*config.engine),
mMaterials(config.materials),
mEngine(config.engine),
mDefaultNodeName(config.defaultNodeName) {}
FFilamentAsset* createAssetFromJson(const uint8_t* bytes, uint32_t nbytes);
@@ -116,25 +113,22 @@ struct FAssetLoader : public AssetLoader {
}
size_t getMaterialsCount() const noexcept {
return mMaterials.getMaterialsCount();
return mMaterials->getMaterialsCount();
}
NameComponentManager* getNames() const noexcept {
return mNameManager;
}
NodeManager& getNodeManager() noexcept {
return mNodeManager;
}
const Material* const* getMaterials() const noexcept {
return mMaterials.getMaterials();
return mMaterials->getMaterials();
}
void createAsset(const cgltf_data* srcAsset, size_t numInstances);
FFilamentInstance* createInstance(FFilamentAsset* primary, const cgltf_data* srcAsset);
void createEntity(const cgltf_data* srcAsset, const cgltf_node* node, SceneMask scenes,
Entity parent, bool enableLight, FFilamentInstance* instance);
FFilamentInstance* createInstance(FFilamentAsset* primary, const cgltf_data* srcAsset,
const cgltf_scene* scene);
void createEntity(const cgltf_data* srcAsset, const cgltf_node* node, Entity parent,
bool enableLight, FFilamentInstance* instance);
void createRenderable(const cgltf_data* srcAsset, const cgltf_node* node, Entity entity,
const char* name);
bool createPrimitive(const cgltf_primitive* inPrim, Primitive* outPrim, const UvMap& uvmap,
@@ -153,15 +147,13 @@ struct FAssetLoader : public AssetLoader {
EntityManager& mEntityManager;
RenderableManager& mRenderableManager;
NameComponentManager* const mNameManager;
NameComponentManager* mNameManager;
TransformManager& mTransformManager;
MaterialProvider& mMaterials;
Engine& mEngine;
FNodeManager mNodeManager;
MaterialProvider* mMaterials;
Engine* mEngine;
// Transient state used only for the asset currently being loaded:
FFilamentAsset* mResult;
tsl::robin_map<cgltf_node*, SceneMask> mRootNodes;
const char* mDefaultNodeName;
bool mError = false;
bool mDiagnosticsEnabled = false;
@@ -248,11 +240,12 @@ FilamentInstance* FAssetLoader::createInstance(FFilamentAsset* primary) {
return nullptr;
}
const cgltf_data* srcAsset = primary->mSourceAsset->hierarchy;
if (srcAsset->scenes == nullptr) {
const cgltf_scene* scene = srcAsset->scene ? srcAsset->scene : srcAsset->scenes;
if (!scene) {
slog.e << "There is no scene in the asset." << io::endl;
return nullptr;
}
FFilamentInstance* instance = createInstance(primary, srcAsset);
FFilamentInstance* instance = createInstance(primary, srcAsset, scene);
// Import the skin data. This is normally done by ResourceLoader but dynamically created
// instances are a bit special.
@@ -277,12 +270,13 @@ void FAssetLoader::createAsset(const cgltf_data* srcAsset, size_t numInstances)
}
#endif
mResult = new FFilamentAsset(&mEngine, mNameManager, &mEntityManager, &mNodeManager, srcAsset);
mResult = new FFilamentAsset(mEngine, mNameManager, &mEntityManager, srcAsset);
mDummyBufferObject = nullptr;
// If there is no default scene specified, then the default is the first one.
// It is not an error for a glTF file to have zero scenes.
mResult->mScenes.clear();
if (srcAsset->scenes == nullptr) {
const cgltf_scene* scene = srcAsset->scene ? srcAsset->scene : srcAsset->scenes;
if (!scene) {
return;
}
@@ -305,46 +299,24 @@ void FAssetLoader::createAsset(const cgltf_data* srcAsset, size_t numInstances)
}
}
// Build a mapping of root nodes to scene membership sets.
auto& nm = mNodeManager;
assert_invariant(srcAsset->scenes_count <= NodeManager::MAX_SCENE_COUNT);
mRootNodes.clear();
const size_t sic = std::min(srcAsset->scenes_count, NodeManager::MAX_SCENE_COUNT);
mResult->mScenes.reserve(sic);
for (size_t si = 0; si < sic; ++si) {
const cgltf_scene& scene = srcAsset->scenes[si];
mResult->mScenes.emplace_back(scene.name);
for (size_t ni = 0, nic = scene.nodes_count; ni < nic; ++ni) {
mRootNodes[scene.nodes[ni]].set(si);
}
}
mResult->mRenderableCount = 0;
if (numInstances == 0) {
// For each scene root, recursively create all entities.
for (const auto& pair : mRootNodes) {
createEntity(srcAsset, pair.first, pair.second, mResult->mRoot, true, nullptr);
for (cgltf_size i = 0, len = scene->nodes_count; i < len; ++i) {
cgltf_node** nodes = scene->nodes;
createEntity(srcAsset, nodes[i], mResult->mRoot, true, nullptr);
}
} else {
// Create a separate entity hierarchy for each instance. Note that MeshCache (vertex
// buffers and index buffers) and MatInstanceCache (materials and textures) help avoid
// needless duplication of resources.
for (size_t index = 0; index < numInstances; ++index) {
if (createInstance(mResult, srcAsset) == nullptr) {
if (createInstance(mResult, srcAsset, scene) == nullptr) {
mError = true;
break;
}
}
}
// Sort the entities so that the renderable ones come first. This allows us to expose
// a "renderables only" pointer without storing a separate list.
const auto& rm = mEngine.getRenderableManager();
std::partition(mResult->mEntities.begin(), mResult->mEntities.end(), [&rm](Entity a) {
return rm.hasComponent(a);
});
// Find every unique resource URI and store a pointer to any of the cgltf-owned cstrings
// that match the URI. These strings get freed during releaseSourceData().
tsl::robin_map<std::string, const char*> resourceUris;
@@ -372,7 +344,7 @@ void FAssetLoader::createAsset(const cgltf_data* srcAsset, size_t numInstances)
}
FFilamentInstance* FAssetLoader::createInstance(FFilamentAsset* primary,
const cgltf_data* srcAsset) {
const cgltf_data* srcAsset, const cgltf_scene* scene) {
auto rootTransform = mTransformManager.getInstance(primary->mRoot);
Entity instanceRoot = mEntityManager.create();
mTransformManager.create(instanceRoot, rootTransform);
@@ -392,19 +364,16 @@ FFilamentInstance* FAssetLoader::createInstance(FFilamentAsset* primary,
}
// For each scene root, recursively create all entities.
for (const auto& pair : mRootNodes) {
createEntity(srcAsset, pair.first, pair.second, instanceRoot, false, instance);
for (cgltf_size i = 0, len = scene->nodes_count; i < len; ++i) {
cgltf_node** nodes = scene->nodes;
createEntity(srcAsset, nodes[i], instanceRoot, false, instance);
}
return instance;
}
void FAssetLoader::createEntity(const cgltf_data* srcAsset, const cgltf_node* node,
SceneMask scenes, Entity parent, bool enableLight, FFilamentInstance* instance) {
NodeManager& nm = mNodeManager;
const Entity entity = mEntityManager.create();
nm.create(entity);
const auto nodeInstance = nm.getInstance(entity);
nm.setSceneMembership(nodeInstance, scenes);
void FAssetLoader::createEntity(const cgltf_data* srcAsset, const cgltf_node* node, Entity parent,
bool enableLight, FFilamentInstance* instance) {
Entity entity = mEntityManager.create();
// Always create a transform component to reflect the original hierarchy.
mat4f localTransform;
@@ -424,8 +393,8 @@ void FAssetLoader::createEntity(const cgltf_data* srcAsset, const cgltf_node* no
const cgltf_size extras_size = node->extras.end_offset - node->extras.start_offset;
if (extras_size > 0) {
const cgltf_data* srcAsset = mResult->mSourceAsset->hierarchy;
mNodeManager.setExtras(mNodeManager.getInstance(entity),
{srcAsset->json + node->extras.start_offset, extras_size});
mResult->mNodeExtras[entity] = CString(
srcAsset->json + node->extras.start_offset, extras_size);
}
// Update the asset's entity list and private node mapping.
@@ -467,7 +436,7 @@ void FAssetLoader::createEntity(const cgltf_data* srcAsset, const cgltf_node* no
}
for (cgltf_size i = 0, len = node->children_count; i < len; ++i) {
createEntity(srcAsset, node->children[i], scenes, entity, enableLight, instance);
createEntity(srcAsset, node->children[i], entity, enableLight, instance);
}
}
@@ -547,12 +516,12 @@ void FAssetLoader::createRenderable(const cgltf_data* srcAsset, const cgltf_node
}
}
FixedCapacityVector<CString> morphTargetNames(numMorphTargets);
auto& morphTargetNames = mResult->mMorphTargetNames[entity];
assert_invariant(morphTargetNames.empty());
morphTargetNames = FixedCapacityVector<CString>(numMorphTargets);
for (cgltf_size i = 0, c = mesh->target_names_count; i < c; ++i) {
morphTargetNames[i] = CString(mesh->target_names[i]);
morphTargetNames[i] = StaticString::make(mesh->target_names[i]);
}
auto& nm = mNodeManager;
nm.setMorphTargetNames(nm.getInstance(entity), std::move(morphTargetNames));
const Aabb transformed = aabb.transform(worldTransform);
@@ -578,7 +547,7 @@ void FAssetLoader::createRenderable(const cgltf_data* srcAsset, const cgltf_node
.culling(true)
.castShadows(true)
.receiveShadows(true)
.build(mEngine, entity);
.build(*mEngine, entity);
// According to the spec, the mesh may or may not specify default weights, regardless of whether
// it actually has morph targets. If it has morphing enabled then the default weights are 0. If
@@ -595,8 +564,6 @@ void FAssetLoader::createRenderable(const cgltf_data* srcAsset, const cgltf_node
}
mRenderableManager.setMorphWeights(renderable, weights.data(), size);
}
++mResult->mRenderableCount;
}
void FAssetLoader::createMaterialVariants(const cgltf_data* srcAsset, const cgltf_mesh* mesh,
@@ -652,7 +619,7 @@ bool FAssetLoader::createPrimitive(const cgltf_primitive* inPrim, Primitive* out
indices = IndexBuffer::Builder()
.indexCount(accessor->count)
.bufferType(indexType)
.build(mEngine);
.build(*mEngine);
BufferSlot slot = { accessor };
slot.indexBuffer = indices;
@@ -664,7 +631,7 @@ bool FAssetLoader::createPrimitive(const cgltf_primitive* inPrim, Primitive* out
indices = IndexBuffer::Builder()
.indexCount(vertexCount)
.bufferType(IndexBuffer::IndexType::UINT)
.build(mEngine);
.build(*mEngine);
const size_t indexDataSize = vertexCount * sizeof(uint32_t);
uint32_t* indexData = (uint32_t*) malloc(indexDataSize);
@@ -672,7 +639,7 @@ bool FAssetLoader::createPrimitive(const cgltf_primitive* inPrim, Primitive* out
indexData[i] = i;
}
IndexBuffer::BufferDescriptor bd(indexData, indexDataSize, FREE_CALLBACK);
indices->setBuffer(mEngine, std::move(bd));
indices->setBuffer(*mEngine, std::move(bd));
}
mResult->mIndexBuffers.push_back(indices);
@@ -844,21 +811,21 @@ bool FAssetLoader::createPrimitive(const cgltf_primitive* inPrim, Primitive* out
// the sizes match.
bool needsDummyData = false;
if (mMaterials.needsDummyData(VertexAttribute::UV0) && !hasUv0) {
if (mMaterials->needsDummyData(VertexAttribute::UV0) && !hasUv0) {
needsDummyData = true;
hasUv0 = true;
vbb.attribute(VertexAttribute::UV0, slot, VertexBuffer::AttributeType::USHORT2);
vbb.normalized(VertexAttribute::UV0);
}
if (mMaterials.needsDummyData(VertexAttribute::UV1) && !hasUv1) {
if (mMaterials->needsDummyData(VertexAttribute::UV1) && !hasUv1) {
hasUv1 = true;
needsDummyData = true;
vbb.attribute(VertexAttribute::UV1, slot, VertexBuffer::AttributeType::USHORT2);
vbb.normalized(VertexAttribute::UV1);
}
if (mMaterials.needsDummyData(VertexAttribute::COLOR) && !hasVertexColor) {
if (mMaterials->needsDummyData(VertexAttribute::COLOR) && !hasVertexColor) {
needsDummyData = true;
vbb.attribute(VertexAttribute::COLOR, slot, VertexBuffer::AttributeType::UBYTE4);
vbb.normalized(VertexAttribute::COLOR);
@@ -881,7 +848,7 @@ bool FAssetLoader::createPrimitive(const cgltf_primitive* inPrim, Primitive* out
vbb.bufferCount(needsDummyData ? slot + 1 : slot);
VertexBuffer* vertices = vbb.build(mEngine);
VertexBuffer* vertices = vbb.build(*mEngine);
outPrim->indices = indices;
outPrim->vertices = vertices;
@@ -896,7 +863,7 @@ bool FAssetLoader::createPrimitive(const cgltf_primitive* inPrim, Primitive* out
MorphTargetBuffer* targets = MorphTargetBuffer::Builder()
.vertexCount(vertexCount)
.count(targetsCount)
.build(mEngine);
.build(*mEngine);
outPrim->targets = targets;
mResult->mMorphTargetBuffers.push_back(targets);
const cgltf_accessor* previous = nullptr;
@@ -924,14 +891,14 @@ bool FAssetLoader::createPrimitive(const cgltf_primitive* inPrim, Primitive* out
if (needsDummyData) {
const uint32_t requiredSize = sizeof(ubyte4) * vertexCount;
if (mDummyBufferObject == nullptr || requiredSize > mDummyBufferObject->getByteCount()) {
mDummyBufferObject = BufferObject::Builder().size(requiredSize).build(mEngine);
mDummyBufferObject = BufferObject::Builder().size(requiredSize).build(*mEngine);
mResult->mBufferObjects.push_back(mDummyBufferObject);
uint32_t* dummyData = (uint32_t*) malloc(requiredSize);
memset(dummyData, 0xff, requiredSize);
VertexBuffer::BufferDescriptor bd(dummyData, requiredSize, FREE_CALLBACK);
mDummyBufferObject->setBuffer(mEngine, std::move(bd));
mDummyBufferObject->setBuffer(*mEngine, std::move(bd));
}
vertices->setBufferObjectAt(mEngine, slot, mDummyBufferObject);
vertices->setBufferObjectAt(*mEngine, slot, mDummyBufferObject);
}
return true;
@@ -969,12 +936,12 @@ void FAssetLoader::createLight(const cgltf_light* light, Entity entity) {
builder.falloff(light->range);
}
builder.build(mEngine, entity);
builder.build(*mEngine, entity);
mResult->mLightEntities.push_back(entity);
}
void FAssetLoader::createCamera(const cgltf_camera* camera, Entity entity) {
Camera* filamentCamera = mEngine.createCamera(entity);
Camera* filamentCamera = mEngine->createCamera(entity);
if (camera->type == cgltf_camera_type_perspective) {
auto& projection = camera->data.perspective;
@@ -1137,7 +1104,7 @@ MaterialInstance* FAssetLoader::createMaterialInstance(const cgltf_data* srcAsse
// This not only creates a material instance, it modifies the material key according to our
// rendering constraints. For example, Filament only supports 2 sets of texture coordinates.
MaterialInstance* mi = mMaterials.createMaterialInstance(&matkey, uvmap, inputMat->name,
MaterialInstance* mi = mMaterials->createMaterialInstance(&matkey, uvmap, inputMat->name,
extras.c_str());
if (!mi) {
slog.e << "No material with the specified requirements exists." << io::endl;
@@ -1442,7 +1409,7 @@ const Material* const* AssetLoader::getMaterials() const noexcept {
return upcast(this)->getMaterials();
}
MaterialProvider& AssetLoader::getMaterialProvider() noexcept {
MaterialProvider* AssetLoader::getMaterialProvider() const noexcept {
return upcast(this)->mMaterials;
}
+8 -31
View File
@@ -18,7 +18,6 @@
#define GLTFIO_FFILAMENTASSET_H
#include <gltfio/FilamentAsset.h>
#include <gltfio/NodeManager.h>
#include <filament/Engine.h>
#include <filament/IndexBuffer.h>
@@ -117,10 +116,8 @@ using MatInstanceCache = tsl::robin_map<intptr_t, MaterialEntry>;
struct FFilamentAsset : public FilamentAsset {
FFilamentAsset(filament::Engine* engine, utils::NameComponentManager* names,
utils::EntityManager* entityManager, NodeManager* nodeManager,
const cgltf_data* srcAsset) :
mEngine(engine), mNameManager(names), mEntityManager(entityManager),
mNodeManager(nodeManager) {
utils::EntityManager* entityManager, const cgltf_data* srcAsset) :
mEngine(engine), mNameManager(names), mEntityManager(entityManager) {
mSourceAsset.reset(new SourceAsset {(cgltf_data*)srcAsset});
}
@@ -142,14 +139,6 @@ struct FFilamentAsset : public FilamentAsset {
return mLightEntities.size();
}
const utils::Entity* getRenderableEntities() const noexcept {
return (mRenderableCount == 0) ? nullptr : mEntities.data();
}
size_t getRenderableEntityCount() const noexcept {
return mRenderableCount;
}
const utils::Entity* getCameraEntities() const noexcept {
return mCameraEntities.empty() ? nullptr : mCameraEntities.data();
}
@@ -242,17 +231,6 @@ struct FFilamentAsset : public FilamentAsset {
return mInstances.size();
}
size_t getSceneCount() const noexcept { return mScenes.size(); }
const char* getSceneName(size_t sceneIndex) const noexcept {
return mScenes[sceneIndex].c_str();
}
void addEntitiesToScene(filament::Scene& targetScene, const Entity* entities, size_t count,
SceneMask sceneFilter);
// end public API
void takeOwnership(filament::Texture* texture) {
mTextures.push_back(texture);
}
@@ -269,14 +247,12 @@ struct FFilamentAsset : public FilamentAsset {
void createAnimators();
filament::Engine* const mEngine;
utils::NameComponentManager* const mNameManager;
utils::EntityManager* const mEntityManager;
NodeManager* const mNodeManager;
std::vector<utils::Entity> mEntities; // sorted such that renderables come first
filament::Engine* mEngine;
utils::NameComponentManager* mNameManager;
utils::EntityManager* mEntityManager;
std::vector<utils::Entity> mEntities;
std::vector<utils::Entity> mLightEntities;
std::vector<utils::Entity> mCameraEntities;
size_t mRenderableCount = 0;
std::vector<filament::MaterialInstance*> mMaterialInstances;
std::vector<filament::VertexBuffer*> mVertexBuffers;
std::vector<filament::BufferObject*> mBufferObjects;
@@ -284,7 +260,6 @@ struct FFilamentAsset : public FilamentAsset {
std::vector<filament::MorphTargetBuffer*> mMorphTargetBuffers;
std::vector<filament::Texture*> mTextures;
utils::FixedCapacityVector<Variant> mVariants;
utils::FixedCapacityVector<utils::CString> mScenes;
filament::Aabb mBoundingBox;
utils::Entity mRoot;
std::vector<FFilamentInstance*> mInstances;
@@ -294,6 +269,8 @@ struct FFilamentAsset : public FilamentAsset {
bool mResourcesLoaded = false;
DependencyGraph mDependencyGraph;
tsl::htrie_map<char, std::vector<utils::Entity>> mNameToEntity;
tsl::robin_map<utils::Entity, utils::CString> mNodeExtras;
tsl::robin_map<utils::Entity, utils::FixedCapacityVector<utils::CString>> mMorphTargetNames;
utils::CString mAssetExtras;
// Sentinels for situations where ResourceLoader needs to generate data.
-139
View File
@@ -1,139 +0,0 @@
/*
* Copyright (C) 2022 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 GLTFIO_FNODEMANAGER_H
#define GLTFIO_FNODEMANAGER_H
#include "upcast.h"
#include <gltfio/NodeManager.h>
#include <utils/compiler.h>
#include <utils/SingleInstanceComponentManager.h>
#include <utils/Entity.h>
#include <utils/Slice.h>
namespace gltfio {
class UTILS_PRIVATE FNodeManager : public NodeManager {
public:
using Instance = NodeManager::Instance;
FNodeManager() noexcept {}
~FNodeManager() noexcept {
assert_invariant(mManager.getComponentCount() == 0);
}
void terminate() noexcept;
bool hasComponent(utils::Entity e) const noexcept {
return mManager.hasComponent(e);
}
Instance getInstance(utils::Entity e) const noexcept {
return Instance(mManager.getInstance(e));
}
void create(utils::Entity entity) {
if (UTILS_UNLIKELY(mManager.hasComponent(entity))) {
destroy(entity);
}
Instance ci = mManager.addComponent(entity);
assert_invariant(ci);
}
void destroy(utils::Entity e) noexcept {
if (Instance ci = mManager.getInstance(e); ci) {
mManager.removeComponent(e);
}
}
void gc(utils::EntityManager& em) noexcept {
mManager.gc(em);
}
void setMorphTargetNames(Instance ci, utils::FixedCapacityVector<CString> names) noexcept {
assert_invariant(ci.isValid());
mManager[ci].morphTargetNames = std::move(names);
}
const utils::FixedCapacityVector<CString>& getMorphTargetNames(Instance ci) const noexcept {
return mManager[ci].morphTargetNames;
}
void setExtras(Instance ci, CString extras) noexcept {
mManager[ci].extras = std::move(extras);
}
const CString& getExtras(Instance ci) const noexcept {
return mManager[ci].extras;
}
void setSceneMembership(Instance ci, SceneMask scenes) noexcept {
mManager[ci].scenes = scenes;
}
SceneMask getSceneMembership(Instance ci) const noexcept {
return mManager[ci].scenes;
}
private:
enum {
MORPH_TARGET_NAMES,
EXTRAS_STRING,
SCENE_MEMBERSHIP,
};
using Base = utils::SingleInstanceComponentManager< // 28 bytes
utils::FixedCapacityVector<CString>, // 16
CString, // 8
SceneMask>; // 4
struct Sim : public Base {
using Base::gc;
using Base::swap;
typename Base::SoA& getSoA() { return mData; }
struct Proxy {
UTILS_ALWAYS_INLINE
Proxy(Base& sim, utils::EntityInstanceBase::Type i) noexcept :
morphTargetNames{ sim, i } { }
union {
Field<MORPH_TARGET_NAMES> morphTargetNames;
Field<EXTRAS_STRING> extras;
Field<SCENE_MEMBERSHIP> scenes;
};
};
UTILS_ALWAYS_INLINE Proxy operator[](Instance i) noexcept {
return { *this, i };
}
UTILS_ALWAYS_INLINE const Proxy operator[](Instance i) const noexcept {
return { const_cast<Sim&>(*this), i };
}
};
Sim mManager;
};
FILAMENT_UPCAST(NodeManager)
} // namespace gltfio
#endif // GLTFIO_FNODEMANAGER_H
+16 -42
View File
@@ -19,7 +19,6 @@
#include <gltfio/Animator.h>
#include <filament/RenderableManager.h>
#include <filament/Scene.h>
#include <utils/EntityManager.h>
#include <utils/Log.h>
@@ -55,8 +54,6 @@ FFilamentAsset::~FFilamentAsset() {
if (mNameManager) {
mNameManager->removeComponent(entity);
}
// Destroy the node component.
mNodeManager->destroy(entity);
// Destroy the actual entity.
mEntityManager->destroy(entity);
}
@@ -84,7 +81,8 @@ const char* FFilamentAsset::getExtras(utils::Entity entity) const noexcept {
if (entity.isNull()) {
return mAssetExtras.c_str();
}
return mNodeManager->getExtras(mNodeManager->getInstance(entity)).c_str();
const auto iter = mNodeExtras.find(entity);
return iter == mNodeExtras.cend() ? nullptr : iter->second.c_str();
}
void FFilamentAsset::createAnimators() {
@@ -126,12 +124,17 @@ const char* FFilamentAsset::getMorphTargetNameAt(utils::Entity entity,
return nullptr;
}
const auto& names = mNodeManager->getMorphTargetNames(mNodeManager->getInstance(entity));
if (targetIndex >= names.size()) {
const auto iter = mMorphTargetNames.find(entity);
if (iter == mMorphTargetNames.end()) {
return nullptr;
}
return names[targetIndex].c_str();
const auto& morphTargetNames = iter->second;
if (targetIndex >= morphTargetNames.size()) {
return nullptr;
}
return morphTargetNames[targetIndex].c_str();
}
size_t FFilamentAsset::getMorphTargetCountAt(utils::Entity entity) const noexcept {
@@ -139,8 +142,12 @@ size_t FFilamentAsset::getMorphTargetCountAt(utils::Entity entity) const noexcep
return 0;
}
const auto& names = mNodeManager->getMorphTargetNames(mNodeManager->getInstance(entity));
return names.size();
const auto iter = mMorphTargetNames.find(entity);
if (iter == mMorphTargetNames.end()) {
return 0;
}
return iter->second.size();
}
size_t FFilamentAsset::getMaterialVariantCount() const noexcept {
@@ -257,18 +264,6 @@ size_t FFilamentAsset::getEntitiesByPrefix(const char* prefix, Entity* entities,
return count;
}
void FFilamentAsset::addEntitiesToScene(Scene& targetScene, const Entity* entities,
size_t count, SceneMask sceneFilter) {
auto& nm = *mNodeManager;
for (size_t ei = 0; ei < count; ++ei) {
const Entity entity = entities[ei];
NodeManager::SceneMask mask = nm.getSceneMembership(nm.getInstance(entity));
if ((mask & sceneFilter).any()) {
targetScene.addEntity(entity);
}
}
}
size_t FilamentAsset::getEntityCount() const noexcept {
return upcast(this)->getEntityCount();
}
@@ -285,14 +280,6 @@ size_t FilamentAsset::getLightEntityCount() const noexcept {
return upcast(this)->getLightEntityCount();
}
const Entity* FilamentAsset::getRenderableEntities() const noexcept {
return upcast(this)->getRenderableEntities();
}
size_t FilamentAsset::getRenderableEntityCount() const noexcept {
return upcast(this)->getRenderableEntityCount();
}
const utils::Entity* FilamentAsset::getCameraEntities() const noexcept {
return upcast(this)->getCameraEntities();
}
@@ -426,17 +413,4 @@ size_t FilamentAsset::getAssetInstanceCount() const noexcept {
return upcast(this)->getAssetInstanceCount();
}
size_t FilamentAsset::getSceneCount() const noexcept {
return upcast(this)->getSceneCount();
}
const char* FilamentAsset::getSceneName(size_t sceneIndex) const noexcept {
return upcast(this)->getSceneName(sceneIndex);
}
void FilamentAsset::addEntitiesToScene(Scene& targetScene, const Entity* entities, size_t count,
SceneMask sceneFilter) {
upcast(this)->addEntitiesToScene(targetScene, entities, count, sceneFilter);
}
} // namespace gltfio
-83
View File
@@ -1,83 +0,0 @@
/*
* Copyright (C) 2017 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 "FNodeManager.h"
#include <utils/Log.h>
#include "upcast.h"
using namespace utils;
namespace gltfio {
using Instance = NodeManager::Instance;
void FNodeManager::terminate() noexcept {
auto& manager = mManager;
if (!manager.empty()) {
#ifndef NDEBUG
utils::slog.d << "cleaning up " << manager.getComponentCount()
<< " leaked node components" << utils::io::endl;
#endif
while (!manager.empty()) {
Instance ci = manager.end() - 1;
manager.removeComponent(manager.getEntity(ci));
}
}
}
bool NodeManager::hasComponent(Entity e) const noexcept {
return upcast(this)->hasComponent(e);
}
Instance NodeManager::getInstance(Entity e) const noexcept {
return upcast(this)->getInstance(e);
}
void NodeManager::create(Entity entity) {
upcast(this)->create(entity);
}
void NodeManager::destroy(Entity e) noexcept {
upcast(this)->destroy(e);
}
void NodeManager::setMorphTargetNames(Instance ci, FixedCapacityVector<CString> names) noexcept {
upcast(this)->setMorphTargetNames(ci, std::move(names));
}
const FixedCapacityVector<CString>& NodeManager::getMorphTargetNames(Instance ci) const noexcept {
return upcast(this)->getMorphTargetNames(ci);
}
void NodeManager::setExtras(Instance ci, CString extras) noexcept {
return upcast(this)->setExtras(ci, std::move(extras));
}
const CString& NodeManager::getExtras(Instance ci) const noexcept {
return upcast(this)->getExtras(ci);
}
void NodeManager::setSceneMembership(Instance ci, SceneMask scenes) noexcept {
upcast(this)->setSceneMembership(ci, scenes);
}
bitset32 NodeManager::getSceneMembership(Instance ci) const noexcept {
return upcast(this)->getSceneMembership(ci);
}
} // namespace gltfio
-2
View File
@@ -72,7 +72,6 @@ using MultiSampleAntiAliasingOptions = filament::View::MultiSampleAntiAliasingOp
using TemporalAntiAliasingOptions = filament::View::TemporalAntiAliasingOptions;
using VignetteOptions = filament::View::VignetteOptions;
using VsmShadowOptions = filament::View::VsmShadowOptions;
using GuardBandOptions = filament::View::GuardBandOptions;
using LightManager = filament::LightManager;
// These functions push all editable property values to their respective Filament objects.
@@ -172,7 +171,6 @@ struct ViewSettings {
TemporalAntiAliasingOptions taa;
VignetteOptions vignette;
VsmShadowOptions vsmShadowOptions;
GuardBandOptions guardBand;
// Custom View Options
ColorGradingSettings colorGrading;
+2 -18
View File
@@ -26,7 +26,6 @@
#include <gltfio/Animator.h>
#include <gltfio/FilamentAsset.h>
#include <gltfio/NodeManager.h>
#include <viewer/Settings.h>
@@ -77,25 +76,15 @@ public:
~ViewerGui();
/**
* Sets the viewer's current asset.
* Adds the asset's ready-to-render entities into the scene.
*
* The viewer does not claim ownership over the asset or its entities. Clients should use
* AssetLoader and ResourceLoader to load an asset before passing it in.
*
* This method does not add renderables to the scene; see populateScene().
*
* @param asset The asset to view.
* @param instanceToAnimate Optional instance from which to get the animator.
*/
void setAsset(FilamentAsset* asset, FilamentInstance* instanceToAnimate = nullptr);
/**
* Adds the asset's ready-to-render entities into the scene.
*
* This is used for asychronous loading. It can be called once per frame to gradually add
* entities into the scene as their textures are loaded.
*/
void populateScene();
void populateScene(FilamentAsset* asset, FilamentInstance* instanceToAnimate = nullptr);
/**
* Removes the current asset from the viewer.
@@ -229,14 +218,10 @@ public:
int getCurrentCamera() const { return mCurrentCamera; }
private:
using SceneMask = gltfio::NodeManager::SceneMask;
void updateIndirectLight();
bool isRemoteMode() const { return mAsset == nullptr; }
void sceneSelectionUI();
// Immutable properties set from the constructor.
filament::Engine* const mEngine;
filament::Scene* const mScene;
@@ -263,7 +248,6 @@ private:
uint32_t mFlags;
utils::Entity mCurrentMorphingEntity;
std::vector<float> mMorphWeights;
SceneMask mVisibleScenes;
bool mShowingRestPose = false;
// 0 is the default "free camera". Additional cameras come from the gltf file (1-based index).
+6 -4
View File
@@ -35,8 +35,10 @@ using std::vector;
static const bool VERBOSE = false;
namespace filament::viewer {
namespace filament {
namespace viewer {
// The default spec generates 66 test cases.
static const char* DEFAULT_AUTOMATION = R"TXT([
{
"name": "ppoff",
@@ -61,8 +63,7 @@ static const char* DEFAULT_AUTOMATION = R"TXT([
"view.ssao.enabled": [false, true],
"view.screenSpaceReflections.enabled": [false, true]
"view.bloom.enabled": [false, true],
"view.dof.enabled": [false, true],
"view.guardBand.enabled": [false, true]
"view.dof.enabled": [false, true]
}
}
]
@@ -334,4 +335,5 @@ size_t AutomationSpec::size() const { return mImpl->cases.size(); }
AutomationSpec::AutomationSpec(Impl* impl) : mImpl(impl) {}
AutomationSpec::~AutomationSpec() { delete mImpl; }
} // namespace filament::viewer
} // namespace viewer
} // namespace filament
-31
View File
@@ -247,27 +247,6 @@ static int parse(jsmntok_t const* tokens, int i, const char* jsonChunk,
return i;
}
static int parse(jsmntok_t const* tokens, int i, const char* jsonChunk,
GuardBandOptions* out) {
CHECK_TOKTYPE(tokens[i], JSMN_OBJECT);
int size = tokens[i++].size;
for (int j = 0; j < size; ++j) {
const jsmntok_t tok = tokens[i];
CHECK_KEY(tok);
if (0 == compare(tok, jsonChunk, "enabled")) {
i = parse(tokens, i + 1, jsonChunk, &out->enabled);
} else {
slog.w << "Invalid guard band options key: '" << STR(tok, jsonChunk) << "'" << io::endl;
i = parse(tokens, i + 1);
}
if (i < 0) {
slog.e << "Invalid guard band options value: '" << STR(tok, jsonChunk) << "'" << io::endl;
return i;
}
}
return i;
}
static int parse(jsmntok_t const* tokens, int i, const char* jsonChunk,
DynamicResolutionOptions* out) {
CHECK_TOKTYPE(tokens[i], JSMN_OBJECT);
@@ -804,8 +783,6 @@ static int parse(jsmntok_t const* tokens, int i, const char* jsonChunk, ViewSett
i = parse(tokens, i + 1, jsonChunk, &out->dynamicLighting);
} else if (compare(tok, jsonChunk, "shadowType") == 0) {
i = parse(tokens, i + 1, jsonChunk, &out->shadowType);
} else if (compare(tok, jsonChunk, "guardBand") == 0) {
i = parse(tokens, i + 1, jsonChunk, &out->guardBand);
} else if (compare(tok, jsonChunk, "vsmShadowOptions") == 0) {
i = parse(tokens, i + 1, jsonChunk, &out->vsmShadowOptions);
} else if (compare(tok, jsonChunk, "postProcessingEnabled") == 0) {
@@ -1074,7 +1051,6 @@ void applySettings(const ViewSettings& settings, View* dest) {
settings.dynamicLighting.zLightFar);
dest->setShadowType(settings.shadowType);
dest->setVsmShadowOptions(settings.vsmShadowOptions);
dest->setGuardBandOptions(settings.guardBand);
dest->setPostProcessingEnabled(settings.postProcessingEnabled);
}
@@ -1575,12 +1551,6 @@ static std::ostream& operator<<(std::ostream& out, const VsmShadowOptions& in) {
<< "}";
}
static std::ostream& operator<<(std::ostream& out, const GuardBandOptions& in) {
return out << "{\n"
<< "\"enabled\": " << to_string(in.enabled) << "\n"
<< "}";
}
static std::ostream& operator<<(std::ostream& out, const ViewSettings& in) {
return out << "{\n"
<< "\"antiAliasing\": " << in.antiAliasing << ",\n"
@@ -1599,7 +1569,6 @@ static std::ostream& operator<<(std::ostream& out, const ViewSettings& in) {
<< "\"dynamicLighting\": " << (in.dynamicLighting) << ",\n"
<< "\"shadowType\": " << (in.shadowType) << ",\n"
<< "\"vsmShadowOptions\": " << (in.vsmShadowOptions) << ",\n"
<< "\"guardBand\": " << (in.guardBand) << ",\n"
<< "\"postProcessingEnabled\": " << to_string(in.postProcessingEnabled) << "\n"
<< "}";
}
+12 -51
View File
@@ -34,6 +34,7 @@
#include <string>
#include <vector>
#include <sstream>
using namespace filagui;
using namespace filament::math;
@@ -393,34 +394,30 @@ ViewerGui::~ViewerGui() {
delete mImGuiHelper;
}
void ViewerGui::setAsset(FilamentAsset* asset, FilamentInstance* instanceToAnimate) {
void ViewerGui::populateScene(FilamentAsset* asset, FilamentInstance* instanceToAnimate) {
if (mAsset != asset) {
removeAsset();
mAsset = asset;
mVisibleScenes.reset();
mVisibleScenes.set(0);
mCurrentCamera = 0;
if (!asset) {
mAnimator = nullptr;
return;
}
mAnimator = instanceToAnimate ? instanceToAnimate->getAnimator() : asset->getAnimator();
assert_invariant(mAnimator && "Call loadResources or asyncBeginLoad before setAsset.");
updateRootTransform();
mScene->addEntities(asset->getLightEntities(), asset->getLightEntityCount());
auto& tcm = mEngine->getRenderableManager();
for (size_t i = 0, n = asset->getRenderableEntityCount(); i < n; i++) {
auto ri = tcm.getInstance(asset->getRenderableEntities()[i]);
tcm.setScreenSpaceContactShadows(ri, true);
}
}
}
void ViewerGui::populateScene() {
auto& tcm = mEngine->getRenderableManager();
static constexpr int kNumAvailable = 128;
utils::Entity renderables[kNumAvailable];
while (size_t numWritten = mAsset->popRenderables(renderables, kNumAvailable)) {
mAsset->addEntitiesToScene(*mScene, renderables, numWritten, mVisibleScenes);
for (size_t i = 0; i < numWritten; i++) {
auto ri = tcm.getInstance(renderables[i]);
tcm.setScreenSpaceContactShadows(ri, true);
}
mScene->addEntities(renderables, numWritten);
}
}
@@ -470,34 +467,6 @@ void ViewerGui::updateIndirectLight() {
}
}
void ViewerGui::sceneSelectionUI() {
// Build a list of checkboxes, one for each glTF scene.
bool changed = false;
for (size_t i = 0, n = mAsset->getSceneCount(); i < n; ++i) {
bool isVisible = mVisibleScenes.test(i);
const char* name = mAsset->getSceneName(i);
if (name) {
changed = ImGui::Checkbox(name, &isVisible) || changed;
} else {
char label[16];
snprintf(label, 16, "Scene %zu", i);
changed = ImGui::Checkbox(label, &isVisible) || changed;
}
if (isVisible) {
mVisibleScenes.set(i);
} else {
mVisibleScenes.unset(i);
}
}
// If any checkboxes have been toggled, rebuild the scene list.
if (changed) {
const utils::Entity* entities = mAsset->getRenderableEntities();
const size_t entityCount = mAsset->getRenderableEntityCount();
mScene->removeEntities(entities, entityCount);
mAsset->addEntitiesToScene(*mScene, entities, entityCount, mVisibleScenes);
}
}
void ViewerGui::applyAnimation(double currentTime) {
assert_invariant(!isRemoteMode());
static double startTime = 0;
@@ -785,8 +754,6 @@ void ViewerGui::updateUserInterface() {
ImGui::SliderFloat("Stride", &ssrefl.stride, 1.0, 10.0f);
}
ImGui::Unindent();
ImGui::Checkbox("Screen-space Guard Band", &mSettings.view.guardBand.enabled);
}
if (ImGui::CollapsingHeader("Dynamic Resolution")) {
@@ -880,24 +847,18 @@ void ViewerGui::updateUserInterface() {
if (ImGui::CollapsingHeader("Scene")) {
ImGui::Indent();
if (ImGui::Checkbox("Scale to unit cube", &mSettings.viewer.autoScaleEnabled)) {
updateRootTransform();
}
ImGui::Checkbox("Scale to unit cube", &mSettings.viewer.autoScaleEnabled);
updateRootTransform();
ImGui::Checkbox("Show skybox", &mSettings.viewer.skyboxEnabled);
ImGui::ColorEdit3("Background color", &mSettings.viewer.backgroundColor.r);
// We do not yet support ground shadow or scene selection in remote mode.
// We do not yet support ground shadow in remote mode,
if (!isRemoteMode()) {
ImGui::Checkbox("Ground shadow", &mSettings.viewer.groundPlaneEnabled);
ImGui::Indent();
ImGui::SliderFloat("Strength", &mSettings.viewer.groundShadowStrength, 0.0f, 1.0f);
ImGui::Unindent();
if (mAsset->getSceneCount() > 1) {
ImGui::Separator();
sceneSelectionUI();
}
}
ImGui::Unindent();
+5 -15
View File
@@ -27,7 +27,6 @@
#include <gltfio/AssetLoader.h>
#include <gltfio/FilamentAsset.h>
#include <gltfio/ResourceLoader.h>
#include <gltfio/TextureProvider.h>
#include <viewer/ViewerGui.h>
@@ -67,8 +66,6 @@ struct App {
MaterialProvider* materials;
MaterialSource materialSource = GENERATE_SHADERS;
ResourceLoader* resourceLoader = nullptr;
gltfio::TextureProvider* stbDecoder = nullptr;
gltfio::TextureProvider* ktxDecoder = nullptr;
int instanceToAnimate = -1;
std::vector<FilamentInstance*> instances;
};
@@ -213,11 +210,6 @@ int main(int argc, char** argv) {
configuration.recomputeBoundingBoxes = false;
if (!app.resourceLoader) {
app.resourceLoader = new gltfio::ResourceLoader(configuration);
app.stbDecoder = createStbProvider(app.engine);
app.ktxDecoder = createKtx2Provider(app.engine);
app.resourceLoader->addTextureProvider("image/png", app.stbDecoder);
app.resourceLoader->addTextureProvider("image/jpeg", app.stbDecoder);
app.resourceLoader->addTextureProvider("image/ktx2", app.ktxDecoder);
}
app.resourceLoader->asyncBeginLoad(app.asset);
@@ -262,12 +254,8 @@ int main(int argc, char** argv) {
loadAsset(filename);
}
FilamentInstance* const instance = app.instanceToAnimate > -1 ?
app.instances[app.instanceToAnimate] : nullptr;
arrangeIntoCircle();
loadResources(filename);
app.viewer->setAsset(app.asset, instance);
};
auto cleanup = [&app](Engine* engine, View*, Scene*) {
@@ -277,16 +265,18 @@ int main(int argc, char** argv) {
delete app.viewer;
delete app.materials;
delete app.names;
delete app.stbDecoder;
delete app.ktxDecoder;
AssetLoader::destroy(&app.loader);
};
auto animate = [&app, arrangeIntoCircle](Engine* engine, View* view, double now) {
app.resourceLoader->asyncUpdateLoad();
FilamentInstance* instance = nullptr;
if (app.instanceToAnimate > -1) {
instance = app.instances[app.instanceToAnimate];
}
app.viewer->updateRootTransform();
app.viewer->populateScene();
app.viewer->populateScene(app.asset, instance);
app.viewer->applyAnimation(now);
// Add a new instance every second until reaching 100 instances.
+2 -4
View File
@@ -507,7 +507,6 @@ int main(int argc, char** argv) {
}
loadResources(filename);
app.viewer->setAsset(app.asset);
createGroundPlane(engine, scene, app);
@@ -666,8 +665,8 @@ int main(int argc, char** argv) {
// Optionally fit the model into a unit cube at the origin.
app.viewer->updateRootTransform();
// Gradually add renderables to the scene as their textures become ready.
app.viewer->populateScene();
// Add renderables to the scene as they become ready.
app.viewer->populateScene(app.asset);
app.viewer->applyAnimation(now);
};
@@ -767,7 +766,6 @@ int main(int argc, char** argv) {
app.assetLoader->destroyAsset(app.asset);
loadAsset(path);
loadResources(path);
app.viewer->setAsset(app.asset);
});
filamentApp.run(app.config, setup, cleanup, gui, preRender, postRender);
@@ -0,0 +1,168 @@
# NOTE: This workflow was ported from Travis.
# Travis was using Ubuntu 14.04. Ubuntu 14.04 is not supportted by GitHub workflows. Ubuntu 20.04 is recommended.
# Travis was using Clang 3.6. The earliest version support by Ubuntu 20.04 is Clang 6.0.
# Travis was caching the clang package. APT package caching is not natively supported by GitHub actions/cache.
# Travis was using Mac OS X 10.13.6 / Xcode 9.4.1 / LLVM 9.1.0
# NOTE: The following documentation may be useful to maintainers of this workflow.
# Github actions: https://docs.github.com/en/actions
# Github github-script action: https://github.com/actions/github-script
# GitHub REST API: https://docs.github.com/en/rest
# Octokit front-end to the GitHub REST API: https://octokit.github.io/rest.js/v18
# Octokit endpoint methods: https://github.com/octokit/plugin-rest-endpoint-methods.js/tree/master/docs/repos
# TODO: Use actions/upload-artifact and actions/download-artifact to simplify deployment.
# TODO: Use composite actions to refactor redundant code.
name: Continuous Deployment
on:
workflow_dispatch:
push:
branches:
- master
jobs:
linux:
runs-on: ${{matrix.os.genus}}
strategy:
fail-fast: false
matrix:
os: [{genus: ubuntu-20.04, family: linux}]
compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}]
cmake_build_type: [Debug, Release]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install Ubuntu Package Dependencies
run: |
sudo apt-get -qq update
sudo apt-get install -y clang-6.0
- name: Install GoogleTest
run: |
# check out pre-breakage version of googletest; can be deleted when
# issue 3128 is fixed
# git clone --depth=1 https://github.com/google/googletest.git External/googletest
mkdir -p External/googletest
cd External/googletest
git init
git remote add origin https://github.com/google/googletest.git
git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725
git reset --hard FETCH_HEAD
cd ../..
- name: Update Glslang Sources
run: |
./update_glslang_sources.py
- name: Build
env:
CC: ${{matrix.compiler.cc}}
CXX: ${{matrix.compiler.cxx}}
run: |
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install ..
make -j4 install
- name: Test
run: |
cd build
ctest --output-on-failure &&
cd ../Test && ./runtests
- name: Zip
if: ${{ matrix.compiler.cc == 'clang' }}
env:
ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip
run: |
cd build/install
zip ${ARCHIVE} \
bin/glslangValidator \
include/glslang/* \
lib/libGenericCodeGen${SUFFIX}.a \
lib/libglslang${SUFFIX}.a \
lib/libglslang-default-resource-limits${SUFFIX}.a \
lib/libHLSL${SUFFIX}.a \
lib/libMachineIndependent${SUFFIX}.a \
lib/libOGLCompiler${SUFFIX}.a \
lib/libOSDependent${SUFFIX}.a \
lib/libSPIRV${SUFFIX}.a \
lib/libSPVRemapper${SUFFIX}.a \
lib/libSPIRV-Tools${SUFFIX}.a \
lib/libSPIRV-Tools-opt${SUFFIX}.a
- name: Deploy
if: ${{ matrix.compiler.cc == 'clang' }}
env:
ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip
uses: actions/github-script@v5
with:
script: |
const script = require('.github/workflows/deploy.js')
await script({github, context, core})
macos:
runs-on: ${{matrix.os.genus}}
strategy:
fail-fast: false
matrix:
os: [{genus: macos-10.15, family: osx}]
compiler: [{cc: clang, cxx: clang++}]
cmake_build_type: [Debug, Release]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install GoogleTest
run: |
# check out pre-breakage version of googletest; can be deleted when
# issue 3128 is fixed
# git clone --depth=1 https://github.com/google/googletest.git External/googletest
mkdir -p External/googletest
cd External/googletest
git init
git remote add origin https://github.com/google/googletest.git
git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725
git reset --hard FETCH_HEAD
cd ../..
- name: Update Glslang Sources
run: |
./update_glslang_sources.py
- name: Build
env:
CC: ${{matrix.compiler.cc}}
CXX: ${{matrix.compiler.cxx}}
run: |
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install ..
make -j4 install
- name: Test
run: |
cd build
ctest --output-on-failure &&
cd ../Test && ./runtests
- name: Zip
env:
ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip
run: |
cd build/install
zip ${ARCHIVE} \
bin/glslangValidator \
include/glslang/* \
lib/libGenericCodeGen${SUFFIX}.a \
lib/libglslang${SUFFIX}.a \
lib/libglslang-default-resource-limits${SUFFIX}.a \
lib/libHLSL${SUFFIX}.a \
lib/libMachineIndependent${SUFFIX}.a \
lib/libOGLCompiler${SUFFIX}.a \
lib/libOSDependent${SUFFIX}.a \
lib/libSPIRV${SUFFIX}.a \
lib/libSPVRemapper${SUFFIX}.a \
lib/libSPIRV-Tools${SUFFIX}.a \
lib/libSPIRV-Tools-opt${SUFFIX}.a
- name: Deploy
env:
ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip
uses: actions/github-script@v5
with:
script: |
const script = require('.github/workflows/deploy.js')
await script({github, context, core})
@@ -0,0 +1,157 @@
# NOTE: This workflow was ported from Travis.
# Travis was using Ubuntu 14.04. Ubuntu 14.04 is not supportted by GitHub workflows. Ubuntu 20.04 is recommended.
# Travis was using Clang 3.6. The earliest version support by Ubuntu 20.04 is Clang 6.0.
# Travis was caching the clang package. APT package caching is not natively supported by GitHub actions/cache.
# Travis was using Mac OS X 10.13.6 / Xcode 9.4.1 / LLVM 9.1.0
#
name: Continuous Integration
on:
workflow_dispatch:
pull_request:
branches:
- master
jobs:
linux:
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}]
cmake_build_type: [Debug, Release]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install Ubuntu Package Dependencies
run: |
sudo apt-get -qq update
sudo apt-get install -y clang-6.0
- name: Install GoogleTest
run: |
# check out pre-breakage version of googletest; can be deleted when
# issue 3128 is fixed
# git clone --depth=1 https://github.com/google/googletest.git External/googletest
mkdir -p External/googletest
cd External/googletest
git init
git remote add origin https://github.com/google/googletest.git
git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725
git reset --hard FETCH_HEAD
cd ../..
- name: Update Glslang Sources
run: |
./update_glslang_sources.py
- name: Build
env:
CC: ${{matrix.compiler.cc}}
CXX: ${{matrix.compiler.cxx}}
run: |
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install ..
make -j4 install
- name: Test
run: |
cd build
ctest --output-on-failure &&
cd ../Test && ./runtests
macos:
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [macos-10.15]
compiler: [{cc: clang, cxx: clang++}]
cmake_build_type: [Debug, Release]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install GoogleTest
run: |
# check out pre-breakage version of googletest; can be deleted when
# issue 3128 is fixed
# git clone --depth=1 https://github.com/google/googletest.git External/googletest
mkdir -p External/googletest
cd External/googletest
git init
git remote add origin https://github.com/google/googletest.git
git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725
git reset --hard FETCH_HEAD
cd ../..
- name: Update Glslang Sources
run: |
./update_glslang_sources.py
- name: Build
env:
CC: ${{matrix.compiler.cc}}
CXX: ${{matrix.compiler.cxx}}
run: |
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install ..
make -j4 install
- name: Test
run: |
cd build
ctest --output-on-failure &&
cd ../Test && ./runtests
android:
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
compiler: [{cc: clang, cxx: clang++}]
cmake_build_type: [Release]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install Ubuntu Package Dependencies
if: ${{matrix.os == 'ubuntu-20.04'}}
run: |
sudo apt-get -qq update
sudo apt-get install -y clang-6.0
- name: Install Android NDK
run: |
export ANDROID_NDK=$HOME/android-ndk
git init $ANDROID_NDK
pushd $ANDROID_NDK
git remote add dneto0 https://github.com/dneto0/android-ndk.git
git fetch --depth=1 dneto0 r17b-strip
git checkout FETCH_HEAD
popd
- name: Install GoogleTest
run: |
# check out pre-breakage version of googletest; can be deleted when
# issue 3128 is fixed
# git clone --depth=1 https://github.com/google/googletest.git External/googletest
mkdir -p External/googletest
cd External/googletest
git init
git remote add origin https://github.com/google/googletest.git
git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725
git reset --hard FETCH_HEAD
cd ../..
- name: Update Glslang Sources
run: |
./update_glslang_sources.py
- name: Build
env:
CC: ${{matrix.compiler.cc}}
CXX: ${{matrix.compiler.cxx}}
run: |
export ANDROID_NDK=$HOME/android-ndk
export TOOLCHAIN_PATH=$ANDROID_NDK/build/cmake/android.toolchain.cmake
echo $ANDROID_NDK
echo $TOOLCHAIN_PATH
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_PATH} -DANDROID_NATIVE_API_LEVEL=android-14 -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DANDROID_ABI="armeabi-v7a with NEON" -DBUILD_TESTING=OFF ..
make -j4
+73
View File
@@ -0,0 +1,73 @@
module.exports = async ({github, context, core}) => {
try {
await github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/master-tot',
sha: context.sha
})
} catch (error) {
core.setFailed(`upload master-tot tag; ${error.name}; ${error.message}`)
}
let release
try {
release = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: 'master-tot'
})
} catch (error) {
core.setFailed(`get the master release; ${error.name}; ${error.message}`)
}
try {
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id
})
} catch (error) {
core.setFailed(`update the master release; ${error.name}; ${error.message}`)
}
let release_assets
try {
release_assets = await github.rest.repos.listReleaseAssets({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id
})
} catch (error) {
core.setFailed(`list release assets; ${error.name}; ${error.message}`)
}
const { ARCHIVE } = process.env
for (const release_asset of release_assets.data) {
if (release_asset.name === `${ ARCHIVE }`) {
try {
await github.rest.repos.deleteReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
asset_id: release_asset.id
})
} catch (error) {
core.setFailed(`delete ${ ARCHIVE }; ${error.name}; ${error.message}`)
}
}
}
try {
const asset_path = `./build/install/${ ARCHIVE }`
const fs = require("fs")
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: `${ ARCHIVE }`,
data: fs.readFileSync(asset_path)
})
} catch (error) {
core.setFailed(`upload ${ ARCHIVE }; ${error.name}; ${error.message}`)
}
}
+4
View File
@@ -18,3 +18,7 @@ out/
third_party/
buildtools/
tools/
# Random OS stuff
.DS_Store
._*
-141
View File
@@ -1,141 +0,0 @@
# Linux and Mac Build Configuration for Travis
language: cpp
os:
- linux
- osx
# Use Ubuntu 14.04 LTS (Trusty) as the Linux testing environment.
sudo: false
dist: trusty
env:
global:
- secure: aGFrgzyKp+84hKrGkxVWg8cHV61uqrKEHT38gfSQK6+WS4GfLOyH83p7WnsEBb7AMhzU7LMNFdvOFr6+NaMpVnqRvc40CEG1Q+lNg9Pq9mhIZLowvDrfqTL9kQ+8Nbw5Q6/dg6CTvY7fvRfpfCEmKIUZBRkoKUuHeuM1uy3IupFcdNuL5bSYn3Beo+apSJginh9DI4BLDXFUgBzTRSLLyCX5g3cpaeGGOCr8quJlYx75W6HRck5g9SZuLtUoH9GFEV3l+ZEWB8noErW+J56L03bwNwFuuAh321evw++oQk5KFa8rlDvar3SJ3b1RHB8u/eq5DBYMyaK/fS8+Q7QbGr8diF/wDe68bKO7U9IhpNfExXmczCpExjHomW5TQv4rYdGhygPMfW97aIsPRYyNKcl4fkmb7NDrM8w0Jscdq2g5c2Kz0ItyZoBri/NXLwFQQjaVCs7Pf97TjuMA7mK0GJmDTRzi6SrDYlWMt5BQL3y0CCojyfLIRcTh0CQjQI29s97bLfQrYAxt9GNNFR+HTXRLLrkaAlJkPGEPwUywlSfEThnvHLesNxYqemolAYpQT4ithoL4GehGIHmaxsW295aKVhuRf8K9eBODNqrfblvM42UHhjntT+92ZnQ/Gkq80GqaMxnxi4PO5FyPIxt0r981b54YBkWi8YA4P7w5pNI=
matrix:
- GLSLANG_BUILD_TYPE=Release
- GLSLANG_BUILD_TYPE=Debug
compiler:
- clang
- gcc
matrix:
fast_finish: true # Show final status immediately if a test fails.
exclude:
# Skip GCC builds on Mac OS X.
- os: osx
compiler: gcc
include:
# Additional build using Android NDK.
- env: BUILD_NDK=ON
cache:
apt: true
branches:
only:
- master
addons:
apt:
packages:
- clang-3.6
install:
# Make sure that clang-3.6 is selected on Linux.
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$CC" == "clang" ]]; then
export CC=clang-3.6 CXX=clang++-3.6;
fi
# Download a recent Android NDK and use its android.toolchain.cmake file.
- if [[ "$BUILD_NDK" == "ON" ]]; then
export ANDROID_NDK=$HOME/android-ndk;
git init $ANDROID_NDK;
pushd $ANDROID_NDK;
git remote add dneto0 https://github.com/dneto0/android-ndk.git;
git fetch --depth=1 dneto0 r17b-strip;
git checkout FETCH_HEAD;
popd;
export TOOLCHAIN_PATH=$ANDROID_NDK/build/cmake/android.toolchain.cmake;
fi
before_script:
# check out pre-breakage version of googletest; can be deleted when
# issue 3128 is fixed
# git clone --depth=1 https://github.com/google/googletest.git External/googletest
- mkdir -p External/googletest
- cd External/googletest
- git init
- git remote add origin https://github.com/google/googletest.git
- git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725
- git reset --hard FETCH_HEAD
- cd ../..
# get spirv-tools and spirv-headers
- ./update_glslang_sources.py
script:
- mkdir build && cd build
# For Android, do release building using NDK without testing.
# Use android-14, the oldest native API level supporeted by NDK r17b.
# We can use newer API levels if we want.
# For Linux and macOS, do debug/release building with testing.
- if [[ "$BUILD_NDK" == "ON" ]]; then
cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_PATH}
-DANDROID_NATIVE_API_LEVEL=android-14
-DCMAKE_BUILD_TYPE=Release
-DANDROID_ABI="armeabi-v7a with NEON"
-DBUILD_TESTING=OFF ..;
make -j4;
else
cmake -DCMAKE_BUILD_TYPE=${GLSLANG_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=`pwd`/install ..;
make -j4 install;
ctest --output-on-failure &&
cd ../Test && ./runtests;
fi
after_success:
# For debug build, the generated dll has a postfix "d" in its name.
- if [[ "${GLSLANG_BUILD_TYPE}" == "Debug" ]]; then
export SUFFIX="d";
else
export SUFFIX="";
fi
# Create tarball for deployment
- if [[ ${CC} == clang* && "${BUILD_NDK}" != "ON" ]]; then
cd ../build/install;
export TARBALL=glslang-master-${TRAVIS_OS_NAME}-${GLSLANG_BUILD_TYPE}.zip;
zip ${TARBALL}
bin/glslangValidator
include/glslang/*
lib/libGenericCodeGen${SUFFIX}.a
lib/libglslang${SUFFIX}.a
lib/libglslang-default-resource-limits${SUFFIX}.a
lib/libHLSL${SUFFIX}.a
lib/libMachineIndependent${SUFFIX}.a
lib/libOGLCompiler${SUFFIX}.a
lib/libOSDependent${SUFFIX}.a
lib/libSPIRV${SUFFIX}.a
lib/libSPVRemapper${SUFFIX}.a
lib/libSPIRV-Tools${SUFFIX}.a
lib/libSPIRV-Tools-opt${SUFFIX}.a;
fi
before_deploy:
# Tag the current top of the tree as "master-tot".
# Travis CI replies on the tag name to properly push to GitHub Releases.
- git config --global user.name "Travis CI"
- git config --global user.email "builds@travis-ci.org"
- git tag -f master-tot
- git push -q -f https://${glslangtoken}@github.com/KhronosGroup/glslang --tags
deploy:
provider: releases
api_key: ${glslangtoken}
on:
branch: master
condition: ${CC} == clang* && ${BUILD_NDK} != ON
file: ${TARBALL}
skip_cleanup: true
overwrite: true
+9
View File
@@ -74,6 +74,15 @@ action("glslang_extension_headers") {
out_file = "${target_gen_dir}/include/glslang/glsl_intrinsic_header.h"
# Fuchsia GN build rules require all GN actions to be hermetic and they
# should correctly and fully state their inputs and outpus (see
# https://fuchsia.dev/fuchsia-src/development/build/hermetic_actions
# for details). All input files of the script should be added to the
# |sources| list.
sources = [
"glslang/ExtensionHeaders/GL_EXT_shader_realtime_clock.glsl",
]
inputs = [
script
]
+20
View File
@@ -3,6 +3,26 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).
## 11.9.0 2022-04-06
### Other changes
* Add GLSL version override functionality
* Add eliminate-dead-input-components to -Os
* Add enhanced-msgs option
* Explicitly use Python 3 for builds
## 11.8.0 2022-01-27
### Other changes
* Add support for SPIR-V 1.6
* Add support for Vulkan 1.3
* Add --hlsl-dx-position-w option
## 11.7.0 2021-11-11
### Other changes
* Add support for targeting Vulkan 1.2 in the C API
## 11.6.0 2021-08-25
### Other changes
+10 -3
View File
@@ -106,10 +106,17 @@ CMAKE_DEPENDENT_OPTION(ENABLE_HLSL
option(ENABLE_RTTI "Enables RTTI" OFF)
option(ENABLE_EXCEPTIONS "Enables Exceptions" OFF)
option(ENABLE_OPT "Enables spirv-opt capability if present" ON)
option(ENABLE_PCH "Enables Precompiled header" ON)
if(MINGW OR (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU"))
# Workaround for CMake behavior on Mac OS with gcc, cmake generates -Xarch_* arguments
# which gcc rejects
option(ENABLE_PCH "Enables Precompiled header" OFF)
else()
option(ENABLE_PCH "Enables Precompiled header" ON)
endif()
option(ENABLE_CTEST "Enables testing" ON)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
if(ENABLE_GLSLANG_INSTALL AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "..." FORCE)
endif()
@@ -163,7 +170,7 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
add_compile_options(-Werror=deprecated-copy)
endif()
if(NOT CMAKE_VERSION VERSION_LESS "3.13")
if(NOT CMAKE_VERSION VERSION_LESS "3.13" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# Error if there's symbols that are not found at link time.
# add_link_options() was added in CMake 3.13 - if using an earlier
# version don't set this - it should be caught by presubmits anyway.
+656 -24
View File
@@ -303,41 +303,647 @@ APACHE LICENSE, VERSION 2.0
GPL 3 with special bison exception
--------------------------------------------------------------------------------
Bison implementation for Yacc-like parsers in C
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Preamble
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
Bison Exception
As a special exception, you may create a larger work that contains part or all
of the Bison parser skeleton and distribute that work under terms of your
choice, so long as that work isn't itself a parser generator using the skeleton
or a modified version thereof as a parser skeleton. Alternatively, if you
modify or redistribute the parser skeleton itself, you may (at your option)
remove this special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public License without
this special exception.
This special exception was added by the Free Software Foundation in version
2.2 of Bison.
END OF TERMS AND CONDITIONS
--------------------------------------------------------------------------------
================================================================================
--------------------------------------------------------------------------------
The preprocessor has the core licenses stated above, plus an additional licence:
The preprocessor has the core licenses stated above, plus additional licences:
/****************************************************************************\
Copyright (c) 2002, NVIDIA Corporation.
@@ -382,3 +988,29 @@ NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\****************************************************************************/
/*
** Copyright (c) 2014-2016 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and/or associated documentation files (the "Materials"),
** to deal in the Materials without restriction, including without limitation
** the rights to use, copy, modify, merge, publish, distribute, sublicense,
** and/or sell copies of the Materials, and to permit persons to whom the
** Materials are furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in
** all copies or substantial portions of the Materials.
**
** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
** IN THE MATERIALS.
*/
+13 -5
View File
@@ -19,8 +19,8 @@ See issue #1964.
If people are only using this location to get spirv.hpp, I recommend they get that from [SPIRV-Headers](https://github.com/KhronosGroup/SPIRV-Headers) instead.
[![Build Status](https://travis-ci.org/KhronosGroup/glslang.svg?branch=master)](https://travis-ci.org/KhronosGroup/glslang)
[![Build status](https://ci.appveyor.com/api/projects/status/q6fi9cb0qnhkla68/branch/master?svg=true)](https://ci.appveyor.com/project/Khronoswebmaster/glslang/branch/master)
[![appveyor status](https://ci.appveyor.com/api/projects/status/q6fi9cb0qnhkla68/branch/master?svg=true)](https://ci.appveyor.com/project/Khronoswebmaster/glslang/branch/master)
![Continuous Deployment](https://github.com/KhronosGroup/glslang/actions/workflows/continuous_deployment.yml/badge.svg)
# Glslang Components and Status
@@ -85,7 +85,15 @@ The applied stage-specific rules are based on the file extension:
* `.frag` for a fragment shader
* `.comp` for a compute shader
There is also a non-shader extension
For ray tracing pipeline shaders:
* `.rgen` for a ray generation shader
* `.rint` for a ray intersection shader
* `.rahit` for a ray any-hit shader
* `.rchit` for a ray closest-hit shader
* `.rmiss` for a ray miss shader
* `.rcall` for a callable shader
There is also a non-shader extension:
* `.conf` for a configuration file of limits, see usage statement for example
## Building (CMake)
@@ -161,8 +169,8 @@ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(pwd)/install" $SOURCE
For building on Android:
```bash
cmake $SOURCE_DIR -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release -DANDROID_STL=c++_static -DANDROID_PLATFORM=android-24 -DCMAKE_SYSTEM_NAME=Android -DANDROID_TOOLCHAIN=clang -DANDROID_ARM_MODE=arm -DCMAKE_MAKE_PROGRAM=$ANDROID_NDK_ROOT/prebuilt/linux-x86_64/bin/make -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake
# If on Windows will be -DCMAKE_MAKE_PROGRAM=%ANDROID_NDK_ROOT%\prebuilt\windows-x86_64\bin\make.exe
cmake $SOURCE_DIR -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release -DANDROID_STL=c++_static -DANDROID_PLATFORM=android-24 -DCMAKE_SYSTEM_NAME=Android -DANDROID_TOOLCHAIN=clang -DANDROID_ARM_MODE=arm -DCMAKE_MAKE_PROGRAM=$ANDROID_NDK_HOME/prebuilt/linux-x86_64/bin/make -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake
# If on Windows will be -DCMAKE_MAKE_PROGRAM=%ANDROID_NDK_HOME%\prebuilt\windows-x86_64\bin\make.exe
# -G is needed for building on Windows
# -DANDROID_ABI can also be armeabi-v7a for 32 bit
```
+2 -1
View File
@@ -113,7 +113,8 @@ if(ENABLE_GLSLANG_INSTALL)
if (ENABLE_SPVREMAPPER)
install(TARGETS SPVRemapper EXPORT SPVRemapperTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
install(TARGETS SPIRV EXPORT SPIRVTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+89 -26
View File
@@ -1256,8 +1256,10 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T
if (type.getBasicType() == glslang::EbtRayQuery)
return spv::StorageClassPrivate;
#ifndef GLSLANG_WEB
if (type.getQualifier().isSpirvByReference())
return spv::StorageClassFunction;
if (type.getQualifier().isSpirvByReference()) {
if (type.getQualifier().isParamInput() || type.getQualifier().isParamOutput())
return spv::StorageClassFunction;
}
#endif
if (type.getQualifier().isPipeInput())
return spv::StorageClassInput;
@@ -1662,9 +1664,22 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
case EShLangCompute:
builder.addCapability(spv::CapabilityShader);
builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
glslangIntermediate->getLocalSize(1),
glslangIntermediate->getLocalSize(2));
if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6) {
std::vector<spv::Id> dimConstId;
for (int dim = 0; dim < 3; ++dim) {
bool specConst = (glslangIntermediate->getLocalSizeSpecId(dim) != glslang::TQualifier::layoutNotSet);
dimConstId.push_back(builder.makeUintConstant(glslangIntermediate->getLocalSize(dim), specConst));
if (specConst) {
builder.addDecoration(dimConstId.back(), spv::DecorationSpecId,
glslangIntermediate->getLocalSizeSpecId(dim));
}
}
builder.addExecutionModeId(shaderEntry, spv::ExecutionModeLocalSizeId, dimConstId);
} else {
builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
glslangIntermediate->getLocalSize(1),
glslangIntermediate->getLocalSize(2));
}
if (glslangIntermediate->getLayoutDerivativeModeNone() == glslang::LayoutDerivativeGroupQuads) {
builder.addCapability(spv::CapabilityComputeDerivativeGroupQuadsNV);
builder.addExecutionMode(shaderEntry, spv::ExecutionModeDerivativeGroupQuadsNV);
@@ -1768,9 +1783,22 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
case EShLangMeshNV:
builder.addCapability(spv::CapabilityMeshShadingNV);
builder.addExtension(spv::E_SPV_NV_mesh_shader);
builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
glslangIntermediate->getLocalSize(1),
glslangIntermediate->getLocalSize(2));
if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6) {
std::vector<spv::Id> dimConstId;
for (int dim = 0; dim < 3; ++dim) {
bool specConst = (glslangIntermediate->getLocalSizeSpecId(dim) != glslang::TQualifier::layoutNotSet);
dimConstId.push_back(builder.makeUintConstant(glslangIntermediate->getLocalSize(dim), specConst));
if (specConst) {
builder.addDecoration(dimConstId.back(), spv::DecorationSpecId,
glslangIntermediate->getLocalSizeSpecId(dim));
}
}
builder.addExecutionModeId(shaderEntry, spv::ExecutionModeLocalSizeId, dimConstId);
} else {
builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
glslangIntermediate->getLocalSize(1),
glslangIntermediate->getLocalSize(2));
}
if (glslangIntermediate->getStage() == EShLangMeshNV) {
builder.addExecutionMode(shaderEntry, spv::ExecutionModeOutputVertices,
glslangIntermediate->getVertices());
@@ -3777,7 +3805,16 @@ bool TGlslangToSpvTraverser::visitBranch(glslang::TVisit /* visit */, glslang::T
switch (node->getFlowOp()) {
case glslang::EOpKill:
builder.makeStatementTerminator(spv::OpKill, "post-discard");
if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6) {
if (glslangIntermediate->getSource() == glslang::EShSourceHlsl) {
builder.addCapability(spv::CapabilityDemoteToHelperInvocation);
builder.createNoResultOp(spv::OpDemoteToHelperInvocationEXT);
} else {
builder.makeStatementTerminator(spv::OpTerminateInvocation, "post-terminate-invocation");
}
} else {
builder.makeStatementTerminator(spv::OpKill, "post-discard");
}
break;
case glslang::EOpTerminateInvocation:
builder.addExtension(spv::E_SPV_KHR_terminate_invocation);
@@ -4148,23 +4185,23 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
const auto& spirvType = type.getSpirvType();
const auto& spirvInst = spirvType.spirvInst;
std::vector<spv::Id> operands;
std::vector<spv::IdImmediate> operands;
for (const auto& typeParam : spirvType.typeParams) {
// Constant expression
if (typeParam.constant->isLiteral()) {
if (typeParam.constant->getBasicType() == glslang::EbtFloat) {
float floatValue = static_cast<float>(typeParam.constant->getConstArray()[0].getDConst());
unsigned literal = *reinterpret_cast<unsigned*>(&floatValue);
operands.push_back(literal);
operands.push_back({false, literal});
} else if (typeParam.constant->getBasicType() == glslang::EbtInt) {
unsigned literal = typeParam.constant->getConstArray()[0].getIConst();
operands.push_back(literal);
operands.push_back({false, literal});
} else if (typeParam.constant->getBasicType() == glslang::EbtUint) {
unsigned literal = typeParam.constant->getConstArray()[0].getUConst();
operands.push_back(literal);
operands.push_back({false, literal});
} else if (typeParam.constant->getBasicType() == glslang::EbtBool) {
unsigned literal = typeParam.constant->getConstArray()[0].getBConst();
operands.push_back(literal);
operands.push_back({false, literal});
} else if (typeParam.constant->getBasicType() == glslang::EbtString) {
auto str = typeParam.constant->getConstArray()[0].getSConst()->c_str();
unsigned literal = 0;
@@ -4176,7 +4213,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
*(literalPtr++) = ch;
++charCount;
if (charCount == 4) {
operands.push_back(literal);
operands.push_back({false, literal});
literalPtr = reinterpret_cast<char*>(&literal);
charCount = 0;
}
@@ -4186,20 +4223,17 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
if (charCount > 0) {
for (; charCount < 4; ++charCount)
*(literalPtr++) = 0;
operands.push_back(literal);
operands.push_back({false, literal});
}
} else
assert(0); // Unexpected type
} else
operands.push_back(createSpvConstant(*typeParam.constant));
operands.push_back({true, createSpvConstant(*typeParam.constant)});
}
if (spirvInst.set == "")
spvType = builder.createOp(static_cast<spv::Op>(spirvInst.id), spv::NoType, operands);
else {
spvType = builder.createBuiltinCall(
spv::NoType, getExtBuiltins(spirvInst.set.c_str()), spirvInst.id, operands);
}
assert(spirvInst.set == ""); // Currently, couldn't be extended instructions.
spvType = builder.makeGenericType(static_cast<spv::Op>(spirvInst.id), operands);
break;
}
#endif
@@ -8717,8 +8751,18 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
builder.addDecoration(id, spv::DecorationOffset, symbol->getQualifier().layoutOffset);
}
if (symbol->getQualifier().hasLocation())
builder.addDecoration(id, spv::DecorationLocation, symbol->getQualifier().layoutLocation);
if (symbol->getQualifier().hasLocation()) {
if (!(glslangIntermediate->isRayTracingStage() && glslangIntermediate->IsRequestedExtension(glslang::E_GL_EXT_ray_tracing)
&& (builder.getStorageClass(id) == spv::StorageClassRayPayloadKHR ||
builder.getStorageClass(id) == spv::StorageClassIncomingRayPayloadKHR ||
builder.getStorageClass(id) == spv::StorageClassCallableDataKHR ||
builder.getStorageClass(id) == spv::StorageClassIncomingCallableDataKHR))) {
// Location values are used to link TraceRayKHR and ExecuteCallableKHR to corresponding variables
// but are not valid in SPIRV since they are supported only for Input/Output Storage classes.
builder.addDecoration(id, spv::DecorationLocation, symbol->getQualifier().layoutLocation);
}
}
builder.addDecoration(id, TranslateInvariantDecoration(symbol->getType().getQualifier()));
if (symbol->getQualifier().hasStream() && glslangIntermediate->isMultiStream()) {
builder.addCapability(spv::CapabilityGeometryStreams);
@@ -8752,7 +8796,16 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
// add built-in variable decoration
if (builtIn != spv::BuiltInMax) {
builder.addDecoration(id, spv::DecorationBuiltIn, (int)builtIn);
// WorkgroupSize deprecated in spirv1.6
if (glslangIntermediate->getSpv().spv < glslang::EShTargetSpv_1_6 ||
builtIn != spv::BuiltInWorkgroupSize)
builder.addDecoration(id, spv::DecorationBuiltIn, (int)builtIn);
}
// Add volatile decoration to HelperInvocation for spirv1.6 and beyond
if (builtIn == spv::BuiltInHelperInvocation &&
glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6) {
builder.addDecoration(id, spv::DecorationVolatile);
}
#ifndef GLSLANG_WEB
@@ -9025,15 +9078,19 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla
break;
#ifndef GLSLANG_WEB
case glslang::EbtInt8:
builder.addCapability(spv::CapabilityInt8);
spvConsts.push_back(builder.makeInt8Constant(zero ? 0 : consts[nextConst].getI8Const()));
break;
case glslang::EbtUint8:
builder.addCapability(spv::CapabilityInt8);
spvConsts.push_back(builder.makeUint8Constant(zero ? 0 : consts[nextConst].getU8Const()));
break;
case glslang::EbtInt16:
builder.addCapability(spv::CapabilityInt16);
spvConsts.push_back(builder.makeInt16Constant(zero ? 0 : consts[nextConst].getI16Const()));
break;
case glslang::EbtUint16:
builder.addCapability(spv::CapabilityInt16);
spvConsts.push_back(builder.makeUint16Constant(zero ? 0 : consts[nextConst].getU16Const()));
break;
case glslang::EbtInt64:
@@ -9046,6 +9103,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla
spvConsts.push_back(builder.makeDoubleConstant(zero ? 0.0 : consts[nextConst].getDConst()));
break;
case glslang::EbtFloat16:
builder.addCapability(spv::CapabilityFloat16);
spvConsts.push_back(builder.makeFloat16Constant(zero ? 0.0F : (float)consts[nextConst].getDConst()));
break;
#endif
@@ -9074,15 +9132,19 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla
break;
#ifndef GLSLANG_WEB
case glslang::EbtInt8:
builder.addCapability(spv::CapabilityInt8);
scalar = builder.makeInt8Constant(zero ? 0 : consts[nextConst].getI8Const(), specConstant);
break;
case glslang::EbtUint8:
builder.addCapability(spv::CapabilityInt8);
scalar = builder.makeUint8Constant(zero ? 0 : consts[nextConst].getU8Const(), specConstant);
break;
case glslang::EbtInt16:
builder.addCapability(spv::CapabilityInt16);
scalar = builder.makeInt16Constant(zero ? 0 : consts[nextConst].getI16Const(), specConstant);
break;
case glslang::EbtUint16:
builder.addCapability(spv::CapabilityInt16);
scalar = builder.makeUint16Constant(zero ? 0 : consts[nextConst].getU16Const(), specConstant);
break;
case glslang::EbtInt64:
@@ -9095,6 +9157,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla
scalar = builder.makeDoubleConstant(zero ? 0.0 : consts[nextConst].getDConst(), specConstant);
break;
case glslang::EbtFloat16:
builder.addCapability(spv::CapabilityFloat16);
scalar = builder.makeFloat16Constant(zero ? 0.0F : (float)consts[nextConst].getDConst(), specConstant);
break;
case glslang::EbtReference:
+12 -6
View File
@@ -297,15 +297,21 @@ namespace spv {
std::string spirvbin_t::literalString(unsigned word) const
{
std::string literal;
const spirword_t * pos = spv.data() + word;
literal.reserve(16);
const char* bytes = reinterpret_cast<const char*>(spv.data() + word);
while (bytes && *bytes)
literal += *bytes++;
return literal;
do {
spirword_t word = *pos;
for (int i = 0; i < 4; i++) {
char c = word & 0xff;
if (c == '\0')
return literal;
literal += c;
word >>= 8;
}
pos++;
} while (true);
}
void spirvbin_t::applyMap()
+31
View File
@@ -427,6 +427,37 @@ Id Builder::makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols)
return type->getResultId();
}
Id Builder::makeGenericType(spv::Op opcode, std::vector<spv::IdImmediate>& operands)
{
// try to find it
Instruction* type;
for (int t = 0; t < (int)groupedTypes[opcode].size(); ++t) {
type = groupedTypes[opcode][t];
if (static_cast<size_t>(type->getNumOperands()) != operands.size())
continue; // Number mismatch, find next
bool match = true;
for (int op = 0; match && op < (int)operands.size(); ++op) {
match = (operands[op].isId ? type->getIdOperand(op) : type->getImmediateOperand(op)) == operands[op].word;
}
if (match)
return type->getResultId();
}
// not found, make it
type = new Instruction(getUniqueId(), NoType, opcode);
for (size_t op = 0; op < operands.size(); ++op) {
if (operands[op].isId)
type->addIdOperand(operands[op].word);
else
type->addImmediateOperand(operands[op].word);
}
groupedTypes[opcode].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
return type->getResultId();
}
// TODO: performance: track arrays per stride
// If a stride is supplied (non-zero) make an array.
+1
View File
@@ -181,6 +181,7 @@ public:
Id makeSamplerType();
Id makeSampledImageType(Id imageType);
Id makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols);
Id makeGenericType(spv::Op opcode, std::vector<spv::IdImmediate>& operands);
// accelerationStructureNV type
Id makeAccelerationStructureType();
+3
View File
@@ -68,6 +68,8 @@ spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLog
}
case glslang::EShTargetVulkan_1_2:
return spv_target_env::SPV_ENV_VULKAN_1_2;
case glslang::EShTargetVulkan_1_3:
return spv_target_env::SPV_ENV_VULKAN_1_3;
default:
break;
}
@@ -210,6 +212,7 @@ void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector
optimizer.RegisterPass(spvtools::CreateInterpolateFixupPass());
if (options->optimizeSize) {
optimizer.RegisterPass(spvtools::CreateRedundancyEliminationPass());
optimizer.RegisterPass(spvtools::CreateEliminateDeadInputComponentsPass());
}
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass());
optimizer.RegisterPass(spvtools::CreateCFGCleanupPass());
+31 -16
View File
@@ -43,6 +43,7 @@
#include <stack>
#include <sstream>
#include <cstring>
#include <utility>
#include "disassemble.h"
#include "doc.h"
@@ -100,6 +101,7 @@ protected:
void outputMask(OperandClass operandClass, unsigned mask);
void disassembleImmediates(int numOperands);
void disassembleIds(int numOperands);
std::pair<int, std::string> decodeString();
int disassembleString();
void disassembleInstruction(Id resultId, Id typeId, Op opCode, int numOperands);
@@ -290,31 +292,44 @@ void SpirvStream::disassembleIds(int numOperands)
}
}
// return the number of operands consumed by the string
int SpirvStream::disassembleString()
// decode string from words at current position (non-consuming)
std::pair<int, std::string> SpirvStream::decodeString()
{
int startWord = word;
out << " \"";
const char* wordString;
std::string res;
int wordPos = word;
char c;
bool done = false;
do {
unsigned int content = stream[word];
wordString = (const char*)&content;
unsigned int content = stream[wordPos];
for (int charCount = 0; charCount < 4; ++charCount) {
if (*wordString == 0) {
c = content & 0xff;
content >>= 8;
if (c == '\0') {
done = true;
break;
}
out << *(wordString++);
res += c;
}
++word;
} while (! done);
++wordPos;
} while(! done);
return std::make_pair(wordPos - word, res);
}
// return the number of operands consumed by the string
int SpirvStream::disassembleString()
{
out << " \"";
std::pair<int, std::string> decoderes = decodeString();
out << decoderes.second;
out << "\"";
return word - startWord;
word += decoderes.first;
return decoderes.first;
}
void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, int numOperands)
@@ -331,7 +346,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
nextNestedControl = 0;
}
} else if (opCode == OpExtInstImport) {
idDescriptor[resultId] = (const char*)(&stream[word]);
idDescriptor[resultId] = decodeString().second;
}
else {
if (resultId != 0 && idDescriptor[resultId].size() == 0) {
@@ -428,7 +443,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
--numOperands;
// Get names for printing "(XXX)" for readability, *after* this id
if (opCode == OpName)
idDescriptor[stream[word - 1]] = (const char*)(&stream[word]);
idDescriptor[stream[word - 1]] = decodeString().second;
break;
case OperandVariableIds:
disassembleIds(numOperands);
+6
View File
@@ -900,6 +900,12 @@ const char* CapabilityString(int info)
case CapabilityDeviceGroup: return "DeviceGroup";
case CapabilityMultiView: return "MultiView";
case CapabilityDenormPreserve: return "DenormPreserve";
case CapabilityDenormFlushToZero: return "DenormFlushToZero";
case CapabilitySignedZeroInfNanPreserve: return "SignedZeroInfNanPreserve";
case CapabilityRoundingModeRTE: return "RoundingModeRTE";
case CapabilityRoundingModeRTZ: return "RoundingModeRTZ";
case CapabilityStencilExportEXT: return "StencilExportEXT";
case CapabilityFloat16ImageAMD: return "Float16ImageAMD";
+2509 -2314
View File
File diff suppressed because it is too large Load Diff
+9 -13
View File
@@ -111,27 +111,23 @@ public:
void addStringOperand(const char* str)
{
unsigned int word;
char* wordString = (char*)&word;
char* wordPtr = wordString;
int charCount = 0;
unsigned int word = 0;
unsigned int shiftAmount = 0;
char c;
do {
c = *(str++);
*(wordPtr++) = c;
++charCount;
if (charCount == 4) {
word |= ((unsigned int)c) << shiftAmount;
shiftAmount += 8;
if (shiftAmount == 32) {
addImmediateOperand(word);
wordPtr = wordString;
charCount = 0;
word = 0;
shiftAmount = 0;
}
} while (c != 0);
// deal with partial last word
if (charCount > 0) {
// pad with 0s
for (; charCount < 4; ++charCount)
*(wordPtr++) = 0;
if (shiftAmount > 0) {
addImmediateOperand(word);
}
}
+113 -8
View File
@@ -177,6 +177,8 @@ const char* shaderStageName = nullptr;
const char* variableName = nullptr;
bool HlslEnable16BitTypes = false;
bool HlslDX9compatible = false;
bool HlslDxPositionW = false;
bool EnhancedMsgs = false;
bool DumpBuiltinSymbols = false;
std::vector<std::string> IncludeDirectoryList;
@@ -190,6 +192,9 @@ glslang::EShTargetClientVersion ClientVersion; // not valid until Client i
glslang::EShTargetLanguage TargetLanguage = glslang::EShTargetNone;
glslang::EShTargetLanguageVersion TargetVersion; // not valid until TargetLanguage is set
// GLSL version
int GlslVersion = 0; // GLSL version specified on CLI, overrides #version in shader source
std::vector<std::string> Processes; // what should be recorded by OpModuleProcessed, or equivalent
// Per descriptor-set binding base data
@@ -652,6 +657,48 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
lowerword == "flatten-uniform-array" ||
lowerword == "fua") {
Options |= EOptionFlattenUniformArrays;
} else if (lowerword == "glsl-version") {
if (argc > 1) {
if (strcmp(argv[1], "100") == 0) {
GlslVersion = 100;
} else if (strcmp(argv[1], "110") == 0) {
GlslVersion = 110;
} else if (strcmp(argv[1], "120") == 0) {
GlslVersion = 120;
} else if (strcmp(argv[1], "130") == 0) {
GlslVersion = 130;
} else if (strcmp(argv[1], "140") == 0) {
GlslVersion = 140;
} else if (strcmp(argv[1], "150") == 0) {
GlslVersion = 150;
} else if (strcmp(argv[1], "300es") == 0) {
GlslVersion = 300;
} else if (strcmp(argv[1], "310es") == 0) {
GlslVersion = 310;
} else if (strcmp(argv[1], "320es") == 0) {
GlslVersion = 320;
} else if (strcmp(argv[1], "330") == 0) {
GlslVersion = 330;
} else if (strcmp(argv[1], "400") == 0) {
GlslVersion = 400;
} else if (strcmp(argv[1], "410") == 0) {
GlslVersion = 410;
} else if (strcmp(argv[1], "420") == 0) {
GlslVersion = 420;
} else if (strcmp(argv[1], "430") == 0) {
GlslVersion = 430;
} else if (strcmp(argv[1], "440") == 0) {
GlslVersion = 440;
} else if (strcmp(argv[1], "450") == 0) {
GlslVersion = 450;
} else if (strcmp(argv[1], "460") == 0) {
GlslVersion = 460;
} else
Error("--glsl-version expected one of: 100, 110, 120, 130, 140, 150,\n"
"300es, 310es, 320es, 330\n"
"400, 410, 420, 430, 440, 450, 460");
}
bumpArg();
} else if (lowerword == "hlsl-offsets") {
Options |= EOptionHlslOffsets;
} else if (lowerword == "hlsl-iomap" ||
@@ -662,6 +709,10 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
HlslEnable16BitTypes = true;
} else if (lowerword == "hlsl-dx9-compatible") {
HlslDX9compatible = true;
} else if (lowerword == "hlsl-dx-position-w") {
HlslDxPositionW = true;
} else if (lowerword == "enhanced-msgs") {
EnhancedMsgs = true;
} else if (lowerword == "auto-sampled-textures") {
autoSampledTextures = true;
} else if (lowerword == "invert-y" || // synonyms
@@ -764,6 +815,9 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
} else if (strcmp(argv[1], "vulkan1.2") == 0) {
setVulkanSpv();
ClientVersion = glslang::EShTargetVulkan_1_2;
} else if (strcmp(argv[1], "vulkan1.3") == 0) {
setVulkanSpv();
ClientVersion = glslang::EShTargetVulkan_1_3;
} else if (strcmp(argv[1], "opengl") == 0) {
setOpenGlSpv();
ClientVersion = glslang::EShTargetOpenGL_450;
@@ -785,9 +839,13 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
} else if (strcmp(argv[1], "spirv1.5") == 0) {
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_5;
} else if (strcmp(argv[1], "spirv1.6") == 0) {
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_6;
} else
Error("--target-env expected one of: vulkan1.0, vulkan1.1, vulkan1.2, opengl,\n"
"spirv1.0, spirv1.1, spirv1.2, spirv1.3, spirv1.4, or spirv1.5");
Error("--target-env expected one of: vulkan1.0, vulkan1.1, vulkan1.2,\n"
"vulkan1.3, opengl, spirv1.0, spirv1.1, spirv1.2, spirv1.3,\n"
"spirv1.4, spirv1.5 or spirv1.6");
}
bumpArg();
} else if (lowerword == "undef-macro" ||
@@ -1012,6 +1070,10 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_5;
break;
case glslang::EShTargetVulkan_1_3:
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_6;
break;
case glslang::EShTargetOpenGL_450:
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_0;
@@ -1059,6 +1121,8 @@ void SetMessageOptions(EShMessages& messages)
messages = (EShMessages)(messages | EShMsgHlslDX9Compatible);
if (DumpBuiltinSymbols)
messages = (EShMessages)(messages | EShMsgBuiltinSymbolTable);
if (EnhancedMsgs)
messages = (EShMessages)(messages | EShMsgEnhanced);
}
//
@@ -1149,6 +1213,27 @@ struct ShaderCompUnit {
}
};
// Writes a string into a depfile, escaping some special characters following the Makefile rules.
static void writeEscapedDepString(std::ofstream& file, const std::string& str)
{
for (char c : str) {
switch (c) {
case ' ':
case ':':
case '#':
case '[':
case ']':
case '\\':
file << '\\';
break;
case '$':
file << '$';
break;
}
file << c;
}
}
// Writes a depfile similar to gcc -MMD foo.c
bool writeDepFile(std::string depfile, std::vector<std::string>& binaryFiles, const std::vector<std::string>& sources)
{
@@ -1156,10 +1241,12 @@ bool writeDepFile(std::string depfile, std::vector<std::string>& binaryFiles, co
if (file.fail())
return false;
for (auto it = binaryFiles.begin(); it != binaryFiles.end(); it++) {
file << *it << ":";
for (auto it = sources.begin(); it != sources.end(); it++) {
file << " " << *it;
for (auto binaryFile = binaryFiles.begin(); binaryFile != binaryFiles.end(); binaryFile++) {
writeEscapedDepString(file, *binaryFile);
file << ":";
for (auto sourceFile = sources.begin(); sourceFile != sources.end(); sourceFile++) {
file << " ";
writeEscapedDepString(file, *sourceFile);
}
file << std::endl;
}
@@ -1209,6 +1296,8 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
shader->setSourceEntryPoint(sourceEntryPointName);
}
shader->setOverrideVersion(GlslVersion);
std::string intrinsicString = getIntrinsic(compUnit.text, compUnit.count);
PreambleString = "";
@@ -1284,6 +1373,12 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
if (Options & EOptionInvertY)
shader->setInvertY(true);
if (HlslDxPositionW)
shader->setDxPositionW(true);
if (EnhancedMsgs)
shader->setEnhancedMsgs();
// Set up the environment, some subsettings take precedence over earlier
// ways of setting things.
if (Options & EOptionSpv) {
@@ -1840,6 +1935,11 @@ void usage()
" -dumpfullversion | -dumpversion print bare major.minor.patchlevel\n"
" --flatten-uniform-arrays | --fua flatten uniform texture/sampler arrays to\n"
" scalars\n"
" --glsl-version {100 | 110 | 120 | 130 | 140 | 150 |\n"
" 300es | 310es | 320es | 330\n"
" 400 | 410 | 420 | 430 | 440 | 450 | 460}\n"
" set GLSL version, overrides #version\n"
" in shader sourcen\n"
" --hlsl-offsets allow block offsets to follow HLSL rules\n"
" works independently of source language\n"
" --hlsl-iomap perform IO mapping in HLSL register space\n"
@@ -1847,7 +1947,10 @@ void usage()
" --hlsl-dx9-compatible interprets sampler declarations as a\n"
" texture/sampler combo like DirectX9 would,\n"
" and recognizes DirectX9-specific semantics\n"
" --hlsl-dx-position-w W component of SV_Position in HLSL fragment\n"
" shaders compatible with DirectX\n"
" --invert-y | --iy invert position.Y output in vertex shader\n"
" --enhanced-msgs print more readable error messages (GLSL only)\n"
" --keep-uncalled | --ku don't eliminate uncalled functions\n"
" --nan-clamp favor non-NaN operand in min, max, and clamp\n"
" --no-storage-format | --nsf use Unknown image format\n"
@@ -1922,8 +2025,9 @@ void usage()
" --sep synonym for --source-entrypoint\n"
" --stdin read from stdin instead of from a file;\n"
" requires providing the shader stage using -S\n"
" --target-env {vulkan1.0 | vulkan1.1 | vulkan1.2 | opengl | \n"
" spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3 | spirv1.4 | spirv1.5}\n"
" --target-env {vulkan1.0 | vulkan1.1 | vulkan1.2 | vulkan1.3 | opengl |\n"
" spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3 | spirv1.4 |\n"
" spirv1.5 | spirv1.6}\n"
" Set the execution environment that the\n"
" generated code will be executed in.\n"
" Defaults to:\n"
@@ -1932,6 +2036,7 @@ void usage()
" * spirv1.0 under --target-env vulkan1.0\n"
" * spirv1.3 under --target-env vulkan1.1\n"
" * spirv1.5 under --target-env vulkan1.2\n"
" * spirv1.6 under --target-env vulkan1.3\n"
" Multiple --target-env can be specified.\n"
" --variable-name <name>\n"
" --vn <name> creates a C header file that contains a\n"

Some files were not shown because too many files have changed in this diff Show More