Compare commits

..

10 Commits

Author SHA1 Message Date
Benjamin Doherty
29612a684e Merge branch 'rc/1.12.3' into release 2021-09-08 11:03:53 -07:00
Benjamin Doherty
e6d5807399 Bump version to 1.12.3 2021-08-30 11:46:51 -07:00
Benjamin Doherty
b04c398202 Update RELEASE_NOTES for 1.12.2 2021-08-30 11:43:20 -07:00
Benjamin Doherty
fe8e1d0734 Release Filament 1.12.2 2021-08-30 11:42:07 -07:00
Ben Doherty
9f5d6e79da Fix regression with clipSpaceTransform (#4552) 2021-08-26 14:14:23 -07:00
Ben Doherty
9b06ab6084 Fix Metal STREAM buffers (#4543) 2021-08-25 09:48:07 -07:00
Ben Doherty
76d4fc08f1 Fix missing bookkeeping in bindUniformBufferRange (#4538) 2021-08-24 09:51:05 -07:00
Mathias Agopian
90548a148b Add FFX FSR as a dynamic resolution setting 2021-08-23 18:10:02 -07:00
Mathias Agopian
270bbe4218 FidelityFX-FSR initial commit 2021-08-23 18:10:02 -07:00
Mathias Agopian
3f26c8b893 Move definitions of operator<< overload in their own cpp
also always include these definitions on debug builds
2021-08-23 15:23:56 -07:00
32 changed files with 4904 additions and 566 deletions

View File

@@ -31,7 +31,7 @@ repositories {
}
dependencies {
implementation 'com.google.android.filament:filament-android:1.12.2'
implementation 'com.google.android.filament:filament-android:1.12.3'
}
```
@@ -52,7 +52,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.12.2'
pod 'Filament', '~> 1.12.3'
```
### Snapshots

View File

@@ -3,7 +3,11 @@
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.12.3 (currently main branch)
## v1.12.4 (currently main branch)
## v1.12.3
- engine: Support AMD FidelityFX Super Resolution for dynamic resolution scaling
## v1.12.2

View File

@@ -119,13 +119,14 @@ Java_com_google_android_filament_View_nGetDithering(JNIEnv*, jclass,
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_View_nSetDynamicResolutionOptions(JNIEnv*, jclass, jlong nativeView,
jboolean enabled, jboolean homogeneousScaling,
jfloat minScale, jfloat maxScale, jint quality) {
jfloat minScale, jfloat maxScale, jfloat sharpness, jint quality) {
View* view = (View*)nativeView;
View::DynamicResolutionOptions options;
options.enabled = enabled;
options.homogeneousScaling = homogeneousScaling;
options.minScale = filament::math::float2{ minScale };
options.maxScale = filament::math::float2{ maxScale };
options.sharpness = sharpness;
options.quality = (View::QualityLevel)quality;
view->setDynamicResolutionOptions(options);
}

View File

@@ -131,8 +131,20 @@ public class View {
public float maxScale = 1.0f;
/**
* Upscaling quality. LOW: 1 bilinear tap, MEDIUM: 4 bilinear taps, HIGH: 9 bilinear taps.
* If minScale needs to be very low, it might help to use MEDIUM or HIGH here.
* Sharpness when QualityLevel.ULTRA is used [0, 2].
* 0 is the sharpest setting, 2 is the smoothest setting.
* The default is set to 0.2
*/
public float sharpness = 0.2f;
/**
* Upscaling quality
* LOW: bilinear filtered blit. Fastest, poor quality
* MEDIUM: 16-tap optimized tent filter.
* HIGH: 36-tap optimized tent filter.
* ULTRA: AMD FidelityFX FSR1. Slowest, very high quality.
* Requires a well anti-aliased (MSAA or TAA), noise free scene.
*
* The default upscaling quality is set to LOW.
*/
@NonNull
@@ -1188,6 +1200,7 @@ public class View {
options.homogeneousScaling,
options.minScale,
options.maxScale,
options.sharpness,
options.quality.ordinal());
}
@@ -1560,7 +1573,7 @@ public class View {
private static native int nGetAntiAliasing(long nativeView);
private static native void nSetDithering(long nativeView, int dithering);
private static native int nGetDithering(long nativeView);
private static native void nSetDynamicResolutionOptions(long nativeView, boolean enabled, boolean homogeneousScaling, float minScale, float maxScale, int quality);
private static native void nSetDynamicResolutionOptions(long nativeView, boolean enabled, boolean homogeneousScaling, float minScale, float maxScale, float sharpness, int quality);
private static native void nSetRenderQuality(long nativeView, int hdrColorBufferQuality);
private static native void nSetDynamicLightingOptions(long nativeView, float zLightNear, float zLightFar);
private static native void nSetShadowType(long nativeView, int type);

View File

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

View File

@@ -27,6 +27,7 @@ import android.widget.Toast
import com.google.android.filament.Fence
import com.google.android.filament.IndirectLight
import com.google.android.filament.Skybox
import com.google.android.filament.View
import com.google.android.filament.utils.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -97,6 +98,10 @@ class MainActivity : Activity() {
val view = modelViewer.view
view.dynamicResolutionOptions = view.dynamicResolutionOptions.apply {
enabled = true
quality = View.QualityLevel.ULTRA
homogeneousScaling = true
minScale = 0.5f
maxScale = 0.5f
}
view.ambientOcclusionOptions = view.ambientOcclusionOptions.apply {

View File

@@ -63,6 +63,7 @@ set(SRCS
src/FrameSkipper.cpp
src/Froxelizer.cpp
src/Frustum.cpp
src/fsr.cpp
src/IndexBuffer.cpp
src/IndirectLight.cpp
src/Material.cpp
@@ -161,10 +162,15 @@ set(PRIVATE_HDRS
src/fg2/details/Resource.h
src/fg2/details/ResourceNode.h
src/fg2/details/Utilities.h
src/fsr.h
src/materials/fsr/ffx_a.h
src/materials/fsr/ffx_fsr1.h
src/upcast.h
)
set(MATERIAL_SRCS
src/materials/fsr/fsr_easu.mat
src/materials/fsr/fsr_rcas.mat
src/materials/colorGrading/colorGrading.mat
src/materials/colorGrading/colorGradingAsSubpass.mat
src/materials/defaultMaterial.mat
@@ -352,6 +358,20 @@ add_custom_command(
APPEND
)
add_custom_command(
OUTPUT "${MATERIAL_DIR}/fsr_easu.filamat"
DEPENDS src/materials/fsr/ffx_a.h
DEPENDS src/materials/fsr/ffx_fsr1.h
APPEND
)
add_custom_command(
OUTPUT "${MATERIAL_DIR}/fsr_rcas.filamat"
DEPENDS src/materials/fsr/ffx_a.h
DEPENDS src/materials/fsr/ffx_fsr1.h
APPEND
)
add_custom_command(
OUTPUT ${RESGEN_OUTPUTS}
COMMAND resgen ${RESGEN_FLAGS} ${MATERIAL_BINS}

View File

@@ -27,6 +27,7 @@ set(SRCS
src/Driver.cpp
src/Handle.cpp
src/HandleAllocator.cpp
src/ostream.cpp
src/noop/NoopDriver.cpp
src/noop/PlatformNoop.cpp
src/Platform.cpp

View File

@@ -20,12 +20,12 @@
#define TNT_FILAMENT_BACKEND_BUFFERDESCRIPTOR_H
#include <utils/compiler.h>
#include <utils/ostream.h>
#include <stddef.h>
#include <stdint.h>
namespace filament {
namespace backend {
namespace filament::backend {
/**
* A CPU memory-buffer descriptor, typically used to transfer data from the CPU to the GPU.
@@ -126,7 +126,10 @@ private:
void* user = nullptr;
};
} // namespace backend
} // namespace filament
} // namespace filament::backend
#if !defined(NDEBUG)
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::BufferDescriptor& b);
#endif
#endif // TNT_FILAMENT_BACKEND_BUFFERDESCRIPTOR_H

View File

@@ -24,6 +24,8 @@
#include <backend/PresentCallable.h>
#include <utils/ostream.h>
#include <math/vec4.h>
#include <array> // FIXME: STL headers are not allowed in public headers
@@ -926,4 +928,36 @@ template<> struct utils::EnableBitMaskOperators<filament::backend::TargetBufferF
template<> struct utils::EnableBitMaskOperators<filament::backend::TextureUsage>
: public std::true_type {};
#if !defined(NDEBUG)
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::BufferUsage usage);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::CullingMode mode);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::ElementType type);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::PixelDataFormat format);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::PixelDataType type);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::Precision precision);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::PrimitiveType type);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TargetBufferFlags f);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerCompareFunc func);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerCompareMode mode);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerFormat format);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerMagFilter filter);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerMinFilter filter);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerParams params);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerType type);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerWrapMode wrap);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::ShaderModel model);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TextureCubemapFace face);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TextureFormat format);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TextureUsage usage);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::BufferObjectBinding binding);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TextureSwizzle swizzle);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::AttributeArray& type);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::FaceOffsets& type);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::PolygonOffset& po);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::RasterState& rs);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::RenderPassParams& b);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::Viewport& v);
#endif
#endif // TNT_FILAMENT_BACKEND_DRIVERENUMS_H

View File

@@ -24,8 +24,7 @@
#include <stdint.h>
namespace filament {
namespace backend {
namespace filament::backend {
//! \privatesection
@@ -39,8 +38,10 @@ struct PipelineState {
};
};
} // namespace filament::backend
} // namespace backend
} // namespace filament
#if !defined(NDEBUG)
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::PipelineState& ps);
#endif
#endif //TNT_FILAMENT_BACKEND_PIPELINESTATE_H

View File

@@ -213,4 +213,8 @@ public:
} // namespace backend
} // namespace filament
#if !defined(NDEBUG)
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::PixelBufferDescriptor& b);
#endif
#endif // TNT_FILAMENT_BACKEND_PIXELBUFFERDESCRIPTOR_H

View File

@@ -104,4 +104,9 @@ public:
} // namespace backend
} // namespace filament
#if !defined(NDEBUG)
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::TargetBufferInfo& tbi);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::MRT& mrt);
#endif
#endif //TNT_FILAMENT_BACKEND_TARGETBUFFERINFO_H

View File

@@ -18,6 +18,7 @@
#define TNT_FILAMENT_BACKEND_PRIVATE_DRIVER_H
#include <backend/BufferDescriptor.h>
#include <backend/DriverEnums.h>
#include <backend/Handle.h>
#include <backend/PipelineState.h>
#include <backend/PixelBufferDescriptor.h>
@@ -28,8 +29,6 @@
#include "private/backend/Program.h"
#include "private/backend/SamplerGroup.h"
#include <backend/DriverEnums.h>
#include <utils/compiler.h>
#include <utils/Log.h>
@@ -104,43 +103,4 @@ public:
} // namespace backend
} // namespace filament
#if !defined(NDEBUG)
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::BufferUsage usage);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::CullingMode mode);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::ElementType type);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::PixelDataFormat format);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::PixelDataType type);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::Precision precision);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::PrimitiveType type);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TargetBufferFlags f);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerCompareFunc func);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerCompareMode mode);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerFormat format);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerMagFilter filter);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerMinFilter filter);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerParams params);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerType type);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerWrapMode wrap);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::ShaderModel model);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TextureCubemapFace face);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TextureFormat format);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TextureUsage usage);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::BufferObjectBinding binding);
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TextureSwizzle swizzle);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::AttributeArray& type);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::FaceOffsets& type);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::PolygonOffset& po);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::PipelineState& ps);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::RasterState& rs);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::TargetBufferInfo& tbi);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::BufferDescriptor& b);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::PixelBufferDescriptor& b);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::RenderPassParams& b);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::Viewport& v);
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::MRT& mrt);
#endif
#endif // TNT_FILAMENT_BACKEND_PRIVATE_DRIVER_H

View File

@@ -154,488 +154,3 @@ void CustomCommand::execute(Driver&, CommandBase* base, intptr_t* next) noexcept
} // namespace backend
} // namespace filament
// ------------------------------------------------------------------------------------------------
// Stream operators for all types in DriverEnums.h
// (These must live outside of the filament namespace)
// ------------------------------------------------------------------------------------------------
using namespace filament;
using namespace backend;
#if !defined(NDEBUG) && (DEBUG_COMMAND_STREAM != false)
#define CASE(ENUM, VALUE) \
case ENUM::VALUE: { \
out << #VALUE; \
break; \
}
io::ostream& operator<<(io::ostream& out, ShaderModel model) {
switch (model) {
CASE(ShaderModel, UNKNOWN)
CASE(ShaderModel, GL_ES_30)
CASE(ShaderModel, GL_CORE_41)
}
return out;
}
io::ostream& operator<<(io::ostream& out, PrimitiveType type) {
switch (type) {
CASE(PrimitiveType, TRIANGLES)
CASE(PrimitiveType, LINES)
CASE(PrimitiveType, POINTS)
CASE(PrimitiveType, NONE)
}
return out;
}
io::ostream& operator<<(io::ostream& out, ElementType type) {
switch (type) {
CASE(ElementType, BYTE)
CASE(ElementType, BYTE2)
CASE(ElementType, BYTE3)
CASE(ElementType, BYTE4)
CASE(ElementType, UBYTE)
CASE(ElementType, UBYTE2)
CASE(ElementType, UBYTE3)
CASE(ElementType, UBYTE4)
CASE(ElementType, SHORT)
CASE(ElementType, SHORT2)
CASE(ElementType, SHORT3)
CASE(ElementType, SHORT4)
CASE(ElementType, USHORT)
CASE(ElementType, USHORT2)
CASE(ElementType, USHORT3)
CASE(ElementType, USHORT4)
CASE(ElementType, INT)
CASE(ElementType, UINT)
CASE(ElementType, FLOAT)
CASE(ElementType, FLOAT2)
CASE(ElementType, FLOAT3)
CASE(ElementType, FLOAT4)
CASE(ElementType, HALF)
CASE(ElementType, HALF2)
CASE(ElementType, HALF3)
CASE(ElementType, HALF4)
}
return out;
}
io::ostream& operator<<(io::ostream& out, BufferUsage usage) {
switch (usage) {
CASE(BufferUsage, STATIC)
CASE(BufferUsage, DYNAMIC)
CASE(BufferUsage, STREAM)
}
return out;
}
io::ostream& operator<<(io::ostream& out, CullingMode mode) {
switch (mode) {
CASE(CullingMode, NONE)
CASE(CullingMode, FRONT)
CASE(CullingMode, BACK)
CASE(CullingMode, FRONT_AND_BACK)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerType type) {
switch (type) {
CASE(SamplerType, SAMPLER_2D)
CASE(SamplerType, SAMPLER_2D_ARRAY)
CASE(SamplerType, SAMPLER_3D)
CASE(SamplerType, SAMPLER_CUBEMAP)
CASE(SamplerType, SAMPLER_EXTERNAL)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerFormat type) {
switch (type) {
CASE(SamplerFormat, INT)
CASE(SamplerFormat, UINT)
CASE(SamplerFormat, FLOAT)
CASE(SamplerFormat, SHADOW)
}
return out;
}
io::ostream& operator<<(io::ostream& out, Precision precision) {
switch (precision) {
CASE(Precision, LOW)
CASE(Precision, MEDIUM)
CASE(Precision, HIGH)
CASE(Precision, DEFAULT)
}
return out;
}
io::ostream& operator<<(io::ostream& out, PixelDataFormat format) {
switch (format) {
CASE(PixelDataFormat, R)
CASE(PixelDataFormat, R_INTEGER)
CASE(PixelDataFormat, RG)
CASE(PixelDataFormat, RG_INTEGER)
CASE(PixelDataFormat, RGB)
CASE(PixelDataFormat, RGB_INTEGER)
CASE(PixelDataFormat, RGBA)
CASE(PixelDataFormat, RGBA_INTEGER)
CASE(PixelDataFormat, DEPTH_COMPONENT)
CASE(PixelDataFormat, DEPTH_STENCIL)
CASE(PixelDataFormat, ALPHA)
CASE(PixelDataFormat, UNUSED)
}
return out;
}
io::ostream& operator<<(io::ostream& out, PixelDataType format) {
switch (format) {
CASE(PixelDataType, UBYTE)
CASE(PixelDataType, BYTE)
CASE(PixelDataType, USHORT)
CASE(PixelDataType, SHORT)
CASE(PixelDataType, UINT)
CASE(PixelDataType, INT)
CASE(PixelDataType, HALF)
CASE(PixelDataType, FLOAT)
CASE(PixelDataType, COMPRESSED)
CASE(PixelDataType, UINT_10F_11F_11F_REV)
CASE(PixelDataType, USHORT_565)
CASE(PixelDataType, UINT_2_10_10_10_REV)
}
return out;
}
io::ostream& operator<<(io::ostream& out, TextureFormat format) {
switch (format) {
CASE(TextureFormat, R8)
CASE(TextureFormat, R8_SNORM)
CASE(TextureFormat, R16F)
CASE(TextureFormat, R32F)
CASE(TextureFormat, R8UI)
CASE(TextureFormat, R8I)
CASE(TextureFormat, STENCIL8)
CASE(TextureFormat, R16UI)
CASE(TextureFormat, R16I)
CASE(TextureFormat, R32UI)
CASE(TextureFormat, R32I)
CASE(TextureFormat, RG8)
CASE(TextureFormat, RG8_SNORM)
CASE(TextureFormat, RG16F)
CASE(TextureFormat, RG32F)
CASE(TextureFormat, RG8UI)
CASE(TextureFormat, RG8I)
CASE(TextureFormat, RG16UI)
CASE(TextureFormat, RG16I)
CASE(TextureFormat, RG32UI)
CASE(TextureFormat, RG32I)
CASE(TextureFormat, RGB8)
CASE(TextureFormat, SRGB8)
CASE(TextureFormat, RGB565)
CASE(TextureFormat, RGB8_SNORM)
CASE(TextureFormat, R11F_G11F_B10F)
CASE(TextureFormat, RGB9_E5)
CASE(TextureFormat, RGB16F)
CASE(TextureFormat, RGB32F)
CASE(TextureFormat, RGB8UI)
CASE(TextureFormat, RGB8I)
CASE(TextureFormat, RGB16UI)
CASE(TextureFormat, RGB16I)
CASE(TextureFormat, RGB32UI)
CASE(TextureFormat, RGB32I)
CASE(TextureFormat, RGBA8)
CASE(TextureFormat, SRGB8_A8)
CASE(TextureFormat, RGBA8_SNORM)
CASE(TextureFormat, RGB5_A1)
CASE(TextureFormat, RGBA4)
CASE(TextureFormat, RGB10_A2)
CASE(TextureFormat, RGBA16F)
CASE(TextureFormat, RGBA32F)
CASE(TextureFormat, RGBA8UI)
CASE(TextureFormat, RGBA8I)
CASE(TextureFormat, RGBA16UI)
CASE(TextureFormat, RGBA16I)
CASE(TextureFormat, RGBA32UI)
CASE(TextureFormat, RGBA32I)
CASE(TextureFormat, DEPTH16)
CASE(TextureFormat, DEPTH24)
CASE(TextureFormat, DEPTH32F)
CASE(TextureFormat, DEPTH24_STENCIL8)
CASE(TextureFormat, DEPTH32F_STENCIL8)
// compressed formats...
CASE(TextureFormat, EAC_R11)
CASE(TextureFormat, EAC_R11_SIGNED)
CASE(TextureFormat, EAC_RG11)
CASE(TextureFormat, EAC_RG11_SIGNED)
CASE(TextureFormat, ETC2_RGB8)
CASE(TextureFormat, ETC2_SRGB8)
CASE(TextureFormat, ETC2_RGB8_A1)
CASE(TextureFormat, ETC2_SRGB8_A1)
CASE(TextureFormat, ETC2_EAC_RGBA8)
CASE(TextureFormat, ETC2_EAC_SRGBA8)
CASE(TextureFormat, DXT1_RGB)
CASE(TextureFormat, DXT1_SRGB)
CASE(TextureFormat, DXT1_RGBA)
CASE(TextureFormat, DXT1_SRGBA)
CASE(TextureFormat, DXT3_RGBA)
CASE(TextureFormat, DXT3_SRGBA)
CASE(TextureFormat, DXT5_RGBA)
CASE(TextureFormat, DXT5_SRGBA)
CASE(TextureFormat, UNUSED)
CASE(TextureFormat, RGBA_ASTC_4x4)
CASE(TextureFormat, RGBA_ASTC_5x4)
CASE(TextureFormat, RGBA_ASTC_5x5)
CASE(TextureFormat, RGBA_ASTC_6x5)
CASE(TextureFormat, RGBA_ASTC_6x6)
CASE(TextureFormat, RGBA_ASTC_8x5)
CASE(TextureFormat, RGBA_ASTC_8x6)
CASE(TextureFormat, RGBA_ASTC_8x8)
CASE(TextureFormat, RGBA_ASTC_10x5)
CASE(TextureFormat, RGBA_ASTC_10x6)
CASE(TextureFormat, RGBA_ASTC_10x8)
CASE(TextureFormat, RGBA_ASTC_10x10)
CASE(TextureFormat, RGBA_ASTC_12x10)
CASE(TextureFormat, RGBA_ASTC_12x12)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_4x4)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_5x4)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_5x5)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_6x5)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_6x6)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_8x5)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_8x6)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_8x8)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_10x5)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_10x6)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_10x8)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_10x10)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_12x10)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_12x12)
}
return out;
}
io::ostream& operator<<(io::ostream& out, TextureUsage usage) {
switch (usage) {
CASE(TextureUsage, NONE)
CASE(TextureUsage, DEFAULT)
CASE(TextureUsage, COLOR_ATTACHMENT)
CASE(TextureUsage, DEPTH_ATTACHMENT)
CASE(TextureUsage, STENCIL_ATTACHMENT)
CASE(TextureUsage, UPLOADABLE)
CASE(TextureUsage, SAMPLEABLE)
CASE(TextureUsage, SUBPASS_INPUT)
}
return out;
}
io::ostream& operator<<(io::ostream& out, TextureCubemapFace face) {
switch (face) {
CASE(TextureCubemapFace, NEGATIVE_X)
CASE(TextureCubemapFace, POSITIVE_X)
CASE(TextureCubemapFace, NEGATIVE_Y)
CASE(TextureCubemapFace, POSITIVE_Y)
CASE(TextureCubemapFace, NEGATIVE_Z)
CASE(TextureCubemapFace, POSITIVE_Z)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerWrapMode wrap) {
switch (wrap) {
CASE(SamplerWrapMode, REPEAT)
CASE(SamplerWrapMode, CLAMP_TO_EDGE)
CASE(SamplerWrapMode, MIRRORED_REPEAT)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerMinFilter filter) {
switch (filter) {
CASE(SamplerMinFilter, NEAREST)
CASE(SamplerMinFilter, LINEAR)
CASE(SamplerMinFilter, NEAREST_MIPMAP_NEAREST)
CASE(SamplerMinFilter, LINEAR_MIPMAP_NEAREST)
CASE(SamplerMinFilter, NEAREST_MIPMAP_LINEAR)
CASE(SamplerMinFilter, LINEAR_MIPMAP_LINEAR)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerMagFilter filter) {
switch (filter) {
CASE(SamplerMagFilter, NEAREST)
CASE(SamplerMagFilter, LINEAR)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerCompareMode mode) {
switch (mode) {
CASE(SamplerCompareMode, NONE)
CASE(SamplerCompareMode, COMPARE_TO_TEXTURE)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerCompareFunc func) {
switch (func) {
CASE(SamplerCompareFunc, LE)
CASE(SamplerCompareFunc, GE)
CASE(SamplerCompareFunc, L)
CASE(SamplerCompareFunc, G)
CASE(SamplerCompareFunc, E)
CASE(SamplerCompareFunc, NE)
CASE(SamplerCompareFunc, A)
CASE(SamplerCompareFunc, N)
}
return out;
}
io::ostream& operator<<(io::ostream& out, BufferObjectBinding binding) {
switch (binding) {
CASE(BufferObjectBinding, VERTEX)
}
return out;
}
io::ostream& operator<<(io::ostream& out, TextureSwizzle swizzle) {
switch (swizzle) {
CASE(TextureSwizzle, SUBSTITUTE_ZERO)
CASE(TextureSwizzle, SUBSTITUTE_ONE)
CASE(TextureSwizzle, CHANNEL_0)
CASE(TextureSwizzle, CHANNEL_1)
CASE(TextureSwizzle, CHANNEL_2)
CASE(TextureSwizzle, CHANNEL_3)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerParams params) {
out << "SamplerParams{ "
<< params.filterMin << ", "
<< params.filterMag << ", "
<< params.wrapS << ", "
<< params.wrapT << ", "
<< params.wrapR << ", "
<< (1u << params.anisotropyLog2) << ", "
<< params.compareMode << ", "
<< params.compareFunc
<< " }";
return out;
}
io::ostream& operator<<(io::ostream& out, const AttributeArray& type) {
return out << "AttributeArray[" << type.max_size() << "]{}";
}
io::ostream& operator<<(io::ostream& out, const FaceOffsets& type) {
return out << "FaceOffsets{"
<< type[0] << ", "
<< type[1] << ", "
<< type[2] << ", "
<< type[3] << ", "
<< type[4] << ", "
<< type[5] << "}";
}
io::ostream& operator<<(io::ostream& out, const RasterState& rs) {
// TODO: implement decoding of enums
return out << "RasterState{"
<< rs.culling << ", "
<< uint8_t(rs.blendEquationRGB) << ", "
<< uint8_t(rs.blendEquationAlpha) << ", "
<< uint8_t(rs.blendFunctionSrcRGB) << ", "
<< uint8_t(rs.blendFunctionSrcAlpha) << ", "
<< uint8_t(rs.blendFunctionDstRGB) << ", "
<< uint8_t(rs.blendFunctionDstAlpha) << "}";
}
io::ostream& operator<<(io::ostream& out, const TargetBufferInfo& tbi) {
return out << "TargetBufferInfo{"
<< "h=" << tbi.handle << ", "
<< "level=" << tbi.level << ", "
<< "face=" << tbi.face << "}";
}
io::ostream& operator<<(io::ostream& out, const PolygonOffset& po) {
return out << "PolygonOffset{"
<< "slope=" << po.slope << ", "
<< "constant=" << po.constant << "}";
}
io::ostream& operator<<(io::ostream& out, const PipelineState& ps) {
return out << "PipelineState{"
<< "program=" << ps.program << ", "
<< "rasterState=" << ps.rasterState << ", "
<< "polygonOffset=" << ps.polygonOffset << "}";
}
UTILS_PRIVATE
io::ostream& operator<<(io::ostream& out, BufferDescriptor const& b) {
out << "BufferDescriptor { buffer=" << b.buffer
<< ", size=" << b.size
<< ", callback=" << b.getCallback()
<< ", user=" << b.getUser() << " }";
return out;
}
UTILS_PRIVATE
io::ostream& operator<<(io::ostream& out, PixelBufferDescriptor const& b) {
BufferDescriptor const& base = static_cast<BufferDescriptor const&>(b);
out << "PixelBufferDescriptor { " << base
<< ", left=" << b.left
<< ", top=" << b.top
<< ", stride=" << b.stride
<< ", format=" << b.format
<< ", type=" << b.type
<< ", alignment=" << b.alignment << " }";
return out;
}
UTILS_PRIVATE
io::ostream& operator<<(io::ostream& out, filament::backend::Viewport const& viewport) {
out << "Viewport{"
<< ", left=" << viewport.left
<< ", bottom=" << viewport.bottom
<< ", width=" << viewport.width
<< ", height=" << viewport.height << "}";
return out;
}
UTILS_PRIVATE
io::ostream& operator<<(io::ostream& out, TargetBufferFlags flags) {
// TODO: implement decoding of enum
out << uint8_t(flags);
return out;
}
UTILS_PRIVATE
io::ostream& operator<<(io::ostream& out, RenderPassParams const& params) {
out << "RenderPassParams{"
<< "clear=" << params.flags.clear
<< ", discardStart=" << params.flags.discardStart
<< ", discardEnd=" << params.flags.discardEnd
<< ", left=" << params.viewport.left
<< ", bottom=" << params.viewport.bottom
<< ", width=" << params.viewport.width
<< ", height=" << params.viewport.height
<< ", clearColor=" << params.clearColor
<< ", clearDepth=" << params.clearDepth
<< ", clearStencil=" << params.clearStencil << "}";
return out;
}
UTILS_PRIVATE
io::ostream& operator<<(io::ostream& out, MRT const& mrt) {
// TODO: implement decoding of enum
out << "MRT{...}";
return out;
}
#undef CASE
#endif // !NDEBUG

View File

@@ -81,8 +81,8 @@ OpenGLProgram::OpenGLProgram(OpenGLDriver* gl, const Program& programBuilder) no
std::string unpackHalf2x16{ R"(
// these don't handle denormals, NaNs or inf
float u16tofp32(highp uint v) {
// this doesn't handle denormals, NaNs or inf
v <<= 16u;
highp uint s = v & 0x80000000u;
highp uint n = v & 0x7FFFFFFFu;
@@ -92,7 +92,28 @@ float u16tofp32(highp uint v) {
vec2 unpackHalf2x16(highp uint v) {
return vec2(u16tofp32(v&0xFFFFu), u16tofp32(v>>16u));
}
uint fp32tou16(float val) {
uint f32 = floatBitsToUint(val);
uint f16 = 0u;
uint sign = (f32 >> 16) & 0x8000u;
int exponent = int((f32 >> 23) & 0xFFu) - 127;
uint mantissa = f32 & 0x007FFFFFu;
if (exponent > 15) {
f16 = sign | (0x1Fu << 10);
} else if (exponent > -15) {
exponent += 15;
mantissa >>= 13;
f16 = sign | uint(exponent << 10) | mantissa;
} else {
f16 = sign;
}
return f16;
}
highp uint packHalf2x16(vec2 v) {
highp uint x = fp32tou16(v.x);
highp uint y = fp32tou16(v.y);
return (y << 16) | x;
}
)"};
// a good point for insertion is just before the first occurrence of an uniform block
auto pos = temp.find("layout(std140)");

View File

@@ -0,0 +1,500 @@
/*
* Copyright (C) 2021 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 <backend/BufferDescriptor.h>
#include <backend/DriverEnums.h>
#include <backend/PipelineState.h>
#include <backend/PixelBufferDescriptor.h>
#include <backend/TargetBufferInfo.h>
#include <utils/ostream.h>
using namespace filament;
using namespace backend;
using namespace utils;
// ------------------------------------------------------------------------------------------------
// Stream operators for all types in DriverEnums.h
// (These must live outside of the filament namespace)
// ------------------------------------------------------------------------------------------------
#if !defined(NDEBUG)
#define CASE(ENUM, VALUE) \
case ENUM::VALUE: { \
out << #VALUE; \
break; \
}
io::ostream& operator<<(io::ostream& out, ShaderModel model) {
switch (model) {
CASE(ShaderModel, UNKNOWN)
CASE(ShaderModel, GL_ES_30)
CASE(ShaderModel, GL_CORE_41)
}
return out;
}
io::ostream& operator<<(io::ostream& out, PrimitiveType type) {
switch (type) {
CASE(PrimitiveType, TRIANGLES)
CASE(PrimitiveType, LINES)
CASE(PrimitiveType, POINTS)
CASE(PrimitiveType, NONE)
}
return out;
}
io::ostream& operator<<(io::ostream& out, ElementType type) {
switch (type) {
CASE(ElementType, BYTE)
CASE(ElementType, BYTE2)
CASE(ElementType, BYTE3)
CASE(ElementType, BYTE4)
CASE(ElementType, UBYTE)
CASE(ElementType, UBYTE2)
CASE(ElementType, UBYTE3)
CASE(ElementType, UBYTE4)
CASE(ElementType, SHORT)
CASE(ElementType, SHORT2)
CASE(ElementType, SHORT3)
CASE(ElementType, SHORT4)
CASE(ElementType, USHORT)
CASE(ElementType, USHORT2)
CASE(ElementType, USHORT3)
CASE(ElementType, USHORT4)
CASE(ElementType, INT)
CASE(ElementType, UINT)
CASE(ElementType, FLOAT)
CASE(ElementType, FLOAT2)
CASE(ElementType, FLOAT3)
CASE(ElementType, FLOAT4)
CASE(ElementType, HALF)
CASE(ElementType, HALF2)
CASE(ElementType, HALF3)
CASE(ElementType, HALF4)
}
return out;
}
io::ostream& operator<<(io::ostream& out, BufferUsage usage) {
switch (usage) {
CASE(BufferUsage, STATIC)
CASE(BufferUsage, DYNAMIC)
CASE(BufferUsage, STREAM)
}
return out;
}
io::ostream& operator<<(io::ostream& out, CullingMode mode) {
switch (mode) {
CASE(CullingMode, NONE)
CASE(CullingMode, FRONT)
CASE(CullingMode, BACK)
CASE(CullingMode, FRONT_AND_BACK)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerType type) {
switch (type) {
CASE(SamplerType, SAMPLER_2D)
CASE(SamplerType, SAMPLER_2D_ARRAY)
CASE(SamplerType, SAMPLER_3D)
CASE(SamplerType, SAMPLER_CUBEMAP)
CASE(SamplerType, SAMPLER_EXTERNAL)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerFormat type) {
switch (type) {
CASE(SamplerFormat, INT)
CASE(SamplerFormat, UINT)
CASE(SamplerFormat, FLOAT)
CASE(SamplerFormat, SHADOW)
}
return out;
}
io::ostream& operator<<(io::ostream& out, Precision precision) {
switch (precision) {
CASE(Precision, LOW)
CASE(Precision, MEDIUM)
CASE(Precision, HIGH)
CASE(Precision, DEFAULT)
}
return out;
}
io::ostream& operator<<(io::ostream& out, PixelDataFormat format) {
switch (format) {
CASE(PixelDataFormat, R)
CASE(PixelDataFormat, R_INTEGER)
CASE(PixelDataFormat, RG)
CASE(PixelDataFormat, RG_INTEGER)
CASE(PixelDataFormat, RGB)
CASE(PixelDataFormat, RGB_INTEGER)
CASE(PixelDataFormat, RGBA)
CASE(PixelDataFormat, RGBA_INTEGER)
CASE(PixelDataFormat, DEPTH_COMPONENT)
CASE(PixelDataFormat, DEPTH_STENCIL)
CASE(PixelDataFormat, ALPHA)
CASE(PixelDataFormat, UNUSED)
}
return out;
}
io::ostream& operator<<(io::ostream& out, PixelDataType format) {
switch (format) {
CASE(PixelDataType, UBYTE)
CASE(PixelDataType, BYTE)
CASE(PixelDataType, USHORT)
CASE(PixelDataType, SHORT)
CASE(PixelDataType, UINT)
CASE(PixelDataType, INT)
CASE(PixelDataType, HALF)
CASE(PixelDataType, FLOAT)
CASE(PixelDataType, COMPRESSED)
CASE(PixelDataType, UINT_10F_11F_11F_REV)
CASE(PixelDataType, USHORT_565)
CASE(PixelDataType, UINT_2_10_10_10_REV)
}
return out;
}
io::ostream& operator<<(io::ostream& out, TextureFormat format) {
switch (format) {
CASE(TextureFormat, R8)
CASE(TextureFormat, R8_SNORM)
CASE(TextureFormat, R16F)
CASE(TextureFormat, R32F)
CASE(TextureFormat, R8UI)
CASE(TextureFormat, R8I)
CASE(TextureFormat, STENCIL8)
CASE(TextureFormat, R16UI)
CASE(TextureFormat, R16I)
CASE(TextureFormat, R32UI)
CASE(TextureFormat, R32I)
CASE(TextureFormat, RG8)
CASE(TextureFormat, RG8_SNORM)
CASE(TextureFormat, RG16F)
CASE(TextureFormat, RG32F)
CASE(TextureFormat, RG8UI)
CASE(TextureFormat, RG8I)
CASE(TextureFormat, RG16UI)
CASE(TextureFormat, RG16I)
CASE(TextureFormat, RG32UI)
CASE(TextureFormat, RG32I)
CASE(TextureFormat, RGB8)
CASE(TextureFormat, SRGB8)
CASE(TextureFormat, RGB565)
CASE(TextureFormat, RGB8_SNORM)
CASE(TextureFormat, R11F_G11F_B10F)
CASE(TextureFormat, RGB9_E5)
CASE(TextureFormat, RGB16F)
CASE(TextureFormat, RGB32F)
CASE(TextureFormat, RGB8UI)
CASE(TextureFormat, RGB8I)
CASE(TextureFormat, RGB16UI)
CASE(TextureFormat, RGB16I)
CASE(TextureFormat, RGB32UI)
CASE(TextureFormat, RGB32I)
CASE(TextureFormat, RGBA8)
CASE(TextureFormat, SRGB8_A8)
CASE(TextureFormat, RGBA8_SNORM)
CASE(TextureFormat, RGB5_A1)
CASE(TextureFormat, RGBA4)
CASE(TextureFormat, RGB10_A2)
CASE(TextureFormat, RGBA16F)
CASE(TextureFormat, RGBA32F)
CASE(TextureFormat, RGBA8UI)
CASE(TextureFormat, RGBA8I)
CASE(TextureFormat, RGBA16UI)
CASE(TextureFormat, RGBA16I)
CASE(TextureFormat, RGBA32UI)
CASE(TextureFormat, RGBA32I)
CASE(TextureFormat, DEPTH16)
CASE(TextureFormat, DEPTH24)
CASE(TextureFormat, DEPTH32F)
CASE(TextureFormat, DEPTH24_STENCIL8)
CASE(TextureFormat, DEPTH32F_STENCIL8)
// compressed formats...
CASE(TextureFormat, EAC_R11)
CASE(TextureFormat, EAC_R11_SIGNED)
CASE(TextureFormat, EAC_RG11)
CASE(TextureFormat, EAC_RG11_SIGNED)
CASE(TextureFormat, ETC2_RGB8)
CASE(TextureFormat, ETC2_SRGB8)
CASE(TextureFormat, ETC2_RGB8_A1)
CASE(TextureFormat, ETC2_SRGB8_A1)
CASE(TextureFormat, ETC2_EAC_RGBA8)
CASE(TextureFormat, ETC2_EAC_SRGBA8)
CASE(TextureFormat, DXT1_RGB)
CASE(TextureFormat, DXT1_SRGB)
CASE(TextureFormat, DXT1_RGBA)
CASE(TextureFormat, DXT1_SRGBA)
CASE(TextureFormat, DXT3_RGBA)
CASE(TextureFormat, DXT3_SRGBA)
CASE(TextureFormat, DXT5_RGBA)
CASE(TextureFormat, DXT5_SRGBA)
CASE(TextureFormat, UNUSED)
CASE(TextureFormat, RGBA_ASTC_4x4)
CASE(TextureFormat, RGBA_ASTC_5x4)
CASE(TextureFormat, RGBA_ASTC_5x5)
CASE(TextureFormat, RGBA_ASTC_6x5)
CASE(TextureFormat, RGBA_ASTC_6x6)
CASE(TextureFormat, RGBA_ASTC_8x5)
CASE(TextureFormat, RGBA_ASTC_8x6)
CASE(TextureFormat, RGBA_ASTC_8x8)
CASE(TextureFormat, RGBA_ASTC_10x5)
CASE(TextureFormat, RGBA_ASTC_10x6)
CASE(TextureFormat, RGBA_ASTC_10x8)
CASE(TextureFormat, RGBA_ASTC_10x10)
CASE(TextureFormat, RGBA_ASTC_12x10)
CASE(TextureFormat, RGBA_ASTC_12x12)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_4x4)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_5x4)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_5x5)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_6x5)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_6x6)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_8x5)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_8x6)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_8x8)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_10x5)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_10x6)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_10x8)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_10x10)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_12x10)
CASE(TextureFormat, SRGB8_ALPHA8_ASTC_12x12)
}
return out;
}
io::ostream& operator<<(io::ostream& out, TextureUsage usage) {
switch (usage) {
CASE(TextureUsage, NONE)
CASE(TextureUsage, DEFAULT)
CASE(TextureUsage, COLOR_ATTACHMENT)
CASE(TextureUsage, DEPTH_ATTACHMENT)
CASE(TextureUsage, STENCIL_ATTACHMENT)
CASE(TextureUsage, UPLOADABLE)
CASE(TextureUsage, SAMPLEABLE)
CASE(TextureUsage, SUBPASS_INPUT)
}
return out;
}
io::ostream& operator<<(io::ostream& out, TextureCubemapFace face) {
switch (face) {
CASE(TextureCubemapFace, NEGATIVE_X)
CASE(TextureCubemapFace, POSITIVE_X)
CASE(TextureCubemapFace, NEGATIVE_Y)
CASE(TextureCubemapFace, POSITIVE_Y)
CASE(TextureCubemapFace, NEGATIVE_Z)
CASE(TextureCubemapFace, POSITIVE_Z)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerWrapMode wrap) {
switch (wrap) {
CASE(SamplerWrapMode, REPEAT)
CASE(SamplerWrapMode, CLAMP_TO_EDGE)
CASE(SamplerWrapMode, MIRRORED_REPEAT)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerMinFilter filter) {
switch (filter) {
CASE(SamplerMinFilter, NEAREST)
CASE(SamplerMinFilter, LINEAR)
CASE(SamplerMinFilter, NEAREST_MIPMAP_NEAREST)
CASE(SamplerMinFilter, LINEAR_MIPMAP_NEAREST)
CASE(SamplerMinFilter, NEAREST_MIPMAP_LINEAR)
CASE(SamplerMinFilter, LINEAR_MIPMAP_LINEAR)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerMagFilter filter) {
switch (filter) {
CASE(SamplerMagFilter, NEAREST)
CASE(SamplerMagFilter, LINEAR)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerCompareMode mode) {
switch (mode) {
CASE(SamplerCompareMode, NONE)
CASE(SamplerCompareMode, COMPARE_TO_TEXTURE)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerCompareFunc func) {
switch (func) {
CASE(SamplerCompareFunc, LE)
CASE(SamplerCompareFunc, GE)
CASE(SamplerCompareFunc, L)
CASE(SamplerCompareFunc, G)
CASE(SamplerCompareFunc, E)
CASE(SamplerCompareFunc, NE)
CASE(SamplerCompareFunc, A)
CASE(SamplerCompareFunc, N)
}
return out;
}
io::ostream& operator<<(io::ostream& out, BufferObjectBinding binding) {
switch (binding) {
CASE(BufferObjectBinding, VERTEX)
CASE(BufferObjectBinding, UNIFORM)
}
return out;
}
io::ostream& operator<<(io::ostream& out, TextureSwizzle swizzle) {
switch (swizzle) {
CASE(TextureSwizzle, SUBSTITUTE_ZERO)
CASE(TextureSwizzle, SUBSTITUTE_ONE)
CASE(TextureSwizzle, CHANNEL_0)
CASE(TextureSwizzle, CHANNEL_1)
CASE(TextureSwizzle, CHANNEL_2)
CASE(TextureSwizzle, CHANNEL_3)
}
return out;
}
io::ostream& operator<<(io::ostream& out, SamplerParams params) {
out << "SamplerParams{ "
<< params.filterMin << ", "
<< params.filterMag << ", "
<< params.wrapS << ", "
<< params.wrapT << ", "
<< params.wrapR << ", "
<< (1u << params.anisotropyLog2) << ", "
<< params.compareMode << ", "
<< params.compareFunc
<< " }";
return out;
}
io::ostream& operator<<(io::ostream& out, const AttributeArray& type) {
return out << "AttributeArray[" << type.max_size() << "]{}";
}
io::ostream& operator<<(io::ostream& out, const FaceOffsets& type) {
return out << "FaceOffsets{"
<< type[0] << ", "
<< type[1] << ", "
<< type[2] << ", "
<< type[3] << ", "
<< type[4] << ", "
<< type[5] << "}";
}
io::ostream& operator<<(io::ostream& out, const RasterState& rs) {
// TODO: implement decoding of enums
return out << "RasterState{"
<< rs.culling << ", "
<< uint8_t(rs.blendEquationRGB) << ", "
<< uint8_t(rs.blendEquationAlpha) << ", "
<< uint8_t(rs.blendFunctionSrcRGB) << ", "
<< uint8_t(rs.blendFunctionSrcAlpha) << ", "
<< uint8_t(rs.blendFunctionDstRGB) << ", "
<< uint8_t(rs.blendFunctionDstAlpha) << "}";
}
io::ostream& operator<<(io::ostream& out, const TargetBufferInfo& tbi) {
return out << "TargetBufferInfo{"
<< "h=" << tbi.handle
<< ", level=" << tbi.level
<< ", face=" << tbi.face << "}";
}
io::ostream& operator<<(io::ostream& out, const PolygonOffset& po) {
return out << "PolygonOffset{"
<< "slope=" << po.slope
<< ", constant=" << po.constant << "}";
}
io::ostream& operator<<(io::ostream& out, const PipelineState& ps) {
return out << "PipelineState{"
<< "program=" << ps.program
<< ", rasterState=" << ps.rasterState
<< ", polygonOffset=" << ps.polygonOffset << "}";
}
io::ostream& operator<<(io::ostream& out, BufferDescriptor const& b) {
return out << "BufferDescriptor{ buffer=" << b.buffer
<< ", size=" << b.size
<< ", callback=" << b.getCallback()
<< ", user=" << b.getUser() << " }";
}
io::ostream& operator<<(io::ostream& out, PixelBufferDescriptor const& b) {
BufferDescriptor const& base = static_cast<BufferDescriptor const&>(b);
return out << "PixelBufferDescriptor{ " << base
<< "left=" << b.left
<< ", top=" << b.top
<< ", stride=" << b.stride
<< ", format=" << b.format
<< ", type=" << b.type
<< ", alignment=" << b.alignment << " }";
}
io::ostream& operator<<(io::ostream& out, filament::backend::Viewport const& viewport) {
return out << "Viewport{"
<< "left=" << viewport.left
<< ", bottom=" << viewport.bottom
<< ", width=" << viewport.width
<< ", height=" << viewport.height << "}";
}
io::ostream& operator<<(io::ostream& out, TargetBufferFlags flags) {
// TODO: implement decoding of enum
out << uint8_t(flags);
return out;
}
io::ostream& operator<<(io::ostream& out, RenderPassParams const& params) {
out << "RenderPassParams{"
<< "clear=" << params.flags.clear
<< ", discardStart=" << params.flags.discardStart
<< ", discardEnd=" << params.flags.discardEnd
<< ", left=" << params.viewport.left
<< ", bottom=" << params.viewport.bottom
<< ", width=" << params.viewport.width
<< ", height=" << params.viewport.height
<< ", clearColor=" << params.clearColor
<< ", clearDepth=" << params.clearDepth
<< ", clearStencil=" << params.clearStencil << "}";
return out;
}
io::ostream& operator<<(io::ostream& out, MRT const& mrt) {
// TODO: implement decoding of enum
out << "MRT{...}";
return out;
}
#undef CASE
#endif // !NDEBUG

View File

@@ -71,9 +71,21 @@ enum class BlendMode : uint8_t {
struct DynamicResolutionOptions {
math::float2 minScale = math::float2(0.5f); //!< minimum scale factors in x and y
math::float2 maxScale = math::float2(1.0f); //!< maximum scale factors in x and y
float sharpness = 0.2f; //!< sharpness when QualityLevel::ULTRA is used [0 (sharpest), 2 (smoothest)]
bool enabled = false; //!< enable or disable dynamic resolution
bool homogeneousScaling = false; //!< set to true to force homogeneous scaling
QualityLevel quality = QualityLevel::LOW; //!< Upscaling quality
/**
* Upscaling quality
* LOW: bilinear filtered blit. Fastest, poor quality
* MEDIUM: 16-tap optimized tent filter.
* HIGH: 36-tap optimized tent filter.
* ULTRA: AMD FidelityFX FSR1. Slowest, very high quality.
* Requires a well anti-aliased (MSAA or TAA), noise free scene.
*
* The default upscaling quality is set to LOW.
*/
QualityLevel quality = QualityLevel::LOW;
};
/**

View File

@@ -29,6 +29,7 @@
#include "fg2/FrameGraph.h"
#include "fg2/FrameGraphResources.h"
#include "fsr.h"
#include "RenderPass.h"
#include "details/Camera.h"
@@ -226,6 +227,8 @@ static const MaterialInfo sMaterialList[] = {
{ "separableGaussianBlur", MATERIAL(SEPARABLEGAUSSIANBLUR) },
{ "taa", MATERIAL(TAA) },
{ "vsmMipmap", MATERIAL(VSMMIPMAP) },
{ "fsr_easu", MATERIAL(FSR_EASU) },
{ "fsr_rcas", MATERIAL(FSR_RCAS) },
};
void PostProcessManager::init() noexcept {
@@ -2267,12 +2270,17 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::opaqueBlit(FrameGraph& fg,
}
FrameGraphId<FrameGraphTexture> PostProcessManager::blendBlit(
FrameGraph& fg, bool translucent, QualityLevel quality,
FrameGraph& fg, bool translucent, DynamicResolutionOptions dsrOptions,
FrameGraphId<FrameGraphTexture> input,
FrameGraphTexture::Descriptor const& outDesc) noexcept {
Handle<HwRenderPrimitive> fullScreenRenderPrimitive = mEngine.getFullScreenRenderPrimitive();
if (translucent && dsrOptions.quality == QualityLevel::ULTRA) {
// FidelityFX-FSR doesn't support the alpha channel currently
dsrOptions.quality = QualityLevel::MEDIUM;
}
struct QuadBlitData {
FrameGraphId<FrameGraphTexture> input;
FrameGraphId<FrameGraphTexture> output;
@@ -2289,23 +2297,41 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::blendBlit(
auto color = resources.getTexture(data.input);
auto out = resources.getRenderPassInfo();
auto const& desc = resources.getDescriptor(data.input);
auto const& inputDesc = resources.getDescriptor(data.input);
auto const& outputDesc = resources.getDescriptor(data.output);
const StaticString blitterNames[3] = { "blitLow", "blitMedium", "blitHigh" };
unsigned index = std::min(2u, (unsigned)quality);
const StaticString blitterNames[4] = { "blitLow", "blitMedium", "blitHigh", "fsr_easu" };
unsigned index = std::min(3u, (unsigned)dsrOptions.quality);
auto& material = getPostProcessMaterial(blitterNames[index]);
FMaterialInstance* const mi = material.getMaterialInstance();
if (dsrOptions.quality == QualityLevel::ULTRA) {
FSRUniforms uniforms;
FSR_ScalingSetup(&uniforms, {
.inputWidth = inputDesc.width,
.inputHeight = inputDesc.height,
.outputWidth = outputDesc.width,
.outputHeight = outputDesc.height,
});
mi->setParameter("EasuCon0", uniforms.EasuCon0);
mi->setParameter("EasuCon1", uniforms.EasuCon1);
mi->setParameter("EasuCon2", uniforms.EasuCon2);
mi->setParameter("EasuCon3", uniforms.EasuCon3);
}
mi->setParameter("color", color, {
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR
.filterMag = SamplerMagFilter::LINEAR,
.filterMin = SamplerMinFilter::LINEAR
});
mi->setParameter("resolution",
float4{ desc.width, desc.height, 1.0f / desc.width, 1.0f / desc.height });
float4{ outputDesc.width, outputDesc.height,
1.0f / outputDesc.width, 1.0f / outputDesc.height });
mi->commit(driver);
mi->use(driver);
PipelineState pipeline(material.getPipelineState());
if (translucent) {
assert_invariant(dsrOptions.quality != QualityLevel::ULTRA);
pipeline.rasterState.blendFunctionSrcRGB = BlendFunction::ONE;
pipeline.rasterState.blendFunctionSrcAlpha = BlendFunction::ONE;
pipeline.rasterState.blendFunctionDstRGB = BlendFunction::ONE_MINUS_SRC_ALPHA;
@@ -2316,8 +2342,48 @@ FrameGraphId<FrameGraphTexture> PostProcessManager::blendBlit(
driver.endRenderPass();
});
auto output = ppQuadBlit->output;
if (dsrOptions.quality == QualityLevel::ULTRA) {
auto& ppFsrRcas = fg.addPass<QuadBlitData>("FidelityFX FSR1 Rcas",
[&](FrameGraph::Builder& builder, auto& data) {
data.input = builder.sample(output);
data.output = builder.createTexture("FFX FSR1 Rcas output", outDesc);
data.output = builder.declareRenderPass(data.output);
},
[=](FrameGraphResources const& resources,
auto const& data, DriverApi& driver) {
auto color = resources.getTexture(data.input);
auto out = resources.getRenderPassInfo();
auto const& outputDesc = resources.getDescriptor(data.output);
auto& material = getPostProcessMaterial("fsr_rcas");
FMaterialInstance* const mi = material.getMaterialInstance();
FSRUniforms uniforms;
FSR_SharpeningSetup(&uniforms, { .sharpness = dsrOptions.sharpness });
mi->setParameter("RcasCon", uniforms.RcasCon);
mi->setParameter("color", color, { }); // uses texelFetch
mi->setParameter("resolution", float4{
outputDesc.width, outputDesc.height,
1.0f / outputDesc.width, 1.0f / outputDesc.height });
mi->commit(driver);
mi->use(driver);
PipelineState pipeline(material.getPipelineState());
assert_invariant(!translucent);
driver.beginRenderPass(out.target, out.params);
driver.draw(pipeline, fullScreenRenderPrimitive);
driver.endRenderPass();
});
output = ppFsrRcas->output;
}
// we rely on automatic culling of unused render passes
return ppQuadBlit->output;
return output;
}
FrameGraphId<FrameGraphTexture> PostProcessManager::resolve(FrameGraph& fg,

View File

@@ -122,7 +122,7 @@ public:
backend::SamplerMagFilter filter = backend::SamplerMagFilter::LINEAR) noexcept;
FrameGraphId<FrameGraphTexture> blendBlit(
FrameGraph& fg, bool translucent, QualityLevel quality,
FrameGraph& fg, bool translucent, DynamicResolutionOptions dsrOptions,
FrameGraphId<FrameGraphTexture> input,
FrameGraphTexture::Descriptor const& outDesc) noexcept;

View File

@@ -231,7 +231,7 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) {
bool hasFXAA = view.getAntiAliasing() == AntiAliasing::FXAA;
uint8_t msaaSampleCount = view.getSampleCount();
float2 scale = view.updateScale(mFrameInfoManager.getLastFrameInfo());
const QualityLevel upscalingQuality = view.getDynamicResolutionOptions().quality;
auto dsrOptions = view.getDynamicResolutionOptions();
auto bloomOptions = view.getBloomOptions();
auto dofOptions = view.getDepthOfFieldOptions();
auto aoOptions = view.getAmbientOcclusionOptions();
@@ -550,11 +550,14 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) {
}
if (scaled) {
mightNeedFinalBlit = false;
if (UTILS_LIKELY(!blending && upscalingQuality == QualityLevel::LOW)) {
input = ppm.opaqueBlit(fg, input, { .format = colorGradingConfig.ldrFormat });
if (UTILS_LIKELY(!blending && dsrOptions.quality == QualityLevel::LOW)) {
input = ppm.opaqueBlit(fg, input, {
.width = vp.width, .height = vp.height,
.format = colorGradingConfig.ldrFormat }, SamplerMagFilter::LINEAR);
} else {
input = ppm.blendBlit(fg, true, upscalingQuality, input,
{ .format = colorGradingConfig.ldrFormat });
input = ppm.blendBlit(fg, blending, dsrOptions, input, {
.width = vp.width, .height = vp.height,
.format = colorGradingConfig.ldrFormat });
}
}
}
@@ -574,11 +577,14 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) {
if (mightNeedFinalBlit &&
((outputIsSwapChain && (msaaSampleCount > 1 || colorGradingConfig.asSubpass)) ||
blending)) {
if (UTILS_LIKELY(!blending && upscalingQuality == QualityLevel::LOW)) {
input = ppm.opaqueBlit(fg, input, { .format = colorGradingConfig.ldrFormat });
if (UTILS_LIKELY(!blending && dsrOptions.quality == QualityLevel::LOW)) {
input = ppm.opaqueBlit(fg, input, {
.width = vp.width, .height = vp.height,
.format = colorGradingConfig.ldrFormat }, SamplerMagFilter::LINEAR);
} else {
input = ppm.blendBlit(fg, true, upscalingQuality, input,
{ .format = colorGradingConfig.ldrFormat });
input = ppm.blendBlit(fg, blending, dsrOptions, input, {
.width = vp.width, .height = vp.height,
.format = colorGradingConfig.ldrFormat });
}
}

View File

@@ -115,6 +115,8 @@ void FView::setDynamicResolutionOptions(DynamicResolutionOptions const& options)
// clamp maxScale to 2x because we're doing bilinear filtering, so super-sampling
// is not useful above that.
dynamicResolution.maxScale = min(dynamicResolution.maxScale, float2(2.0f));
dynamicResolution.sharpness = clamp(dynamicResolution.sharpness, 0.0f, 2.0f);
}
}

58
filament/src/fsr.cpp Normal file
View File

@@ -0,0 +1,58 @@
/*
* Copyright (C) 2021 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 "fsr.h"
#include <math/vec4.h>
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
namespace filament {
using namespace math;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-function"
#pragma clang diagnostic ignored "-Wignored-qualifiers"
#define A_CPU 1
#include "materials/fsr/ffx_a.h"
#define FSR_EASU_F 1
#define FSR_RCAS_F 1
#include "materials/fsr/ffx_fsr1.h"
#pragma clang diagnostic pop
void FSR_ScalingSetup(FSRUniforms* outUniforms, FSRScalingConfig config) noexcept {
FsrEasuCon( outUniforms->EasuCon0.v, outUniforms->EasuCon1.v,
outUniforms->EasuCon2.v, outUniforms->EasuCon3.v,
// Viewport size (top left aligned) in the input image which is to be scaled.
config.inputWidth, config.inputHeight,
// The size of the input image.
config.inputWidth, config.inputHeight,
// The output resolution.
config.outputWidth, config.outputHeight);
}
void FSR_SharpeningSetup(FSRUniforms* outUniforms, FSRSharpeningConfig config) noexcept {
FsrRcasCon(outUniforms->RcasCon.v, config.sharpness);
}
} // namespace filament

52
filament/src/fsr.h Normal file
View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2021 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 TNT_FILAMENT_FSR_H
#define TNT_FILAMENT_FSR_H
#include <math/vec4.h>
#include <stdint.h>
namespace filament {
struct FSRScalingConfig {
uint32_t inputWidth;
uint32_t inputHeight;
uint32_t outputWidth;
uint32_t outputHeight;
};
struct FSRSharpeningConfig {
// The scale is {0.0 := maximum sharpness, to N>0, where N is the number of stops (halving)
// of the reduction of sharpness}.
float sharpness;
};
struct FSRUniforms {
math::uint4 EasuCon0;
math::uint4 EasuCon1;
math::uint4 EasuCon2;
math::uint4 EasuCon3;
math::uint4 RcasCon;
};
void FSR_ScalingSetup(FSRUniforms* inoutUniforms, FSRScalingConfig config) noexcept;
void FSR_SharpeningSetup(FSRUniforms* inoutUniforms, FSRSharpeningConfig config) noexcept;
} // namespace filament
#endif // TNT_FILAMENT_FSR_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,114 @@
material {
name : fsr_easu,
parameters : [
{
type : sampler2d,
name : color,
precision: medium
},
{
type : float4,
name : resolution,
precision: high
},
{
type : uint4,
name : EasuCon0,
precision: high
},
{
type : uint4,
name : EasuCon1,
precision: high
},
{
type : uint4,
name : EasuCon2,
precision: high
},
{
type : uint4,
name : EasuCon3,
precision: high
}
],
variables : [
vertex
],
depthWrite : false,
depthCulling : false,
domain: postprocess
}
vertex {
void postProcessVertex(inout PostProcessVertexInputs postProcess) {
postProcess.vertex.xy = postProcess.normalizedUV * materialParams.resolution.xy;
}
}
fragment {
precision mediump float;
precision highp int;
#define A_GPU 1
#define A_GLSL 1
#include "ffx_a.h"
#define FSR_EASU_F 1
#include "ffx_fsr1.h"
#if defined(FILAMENT_HAS_FEATURE_TEXTURE_GATHER)
AF4 FsrEasuRF(AF2 p) {
return textureGather(materialParams_color, p, 0);
}
AF4 FsrEasuGF(AF2 p) {
return textureGather(materialParams_color, p, 1);
}
AF4 FsrEasuBF(AF2 p) {
return textureGather(materialParams_color, p, 2);
}
#else
AF4 FsrEasuRF(AF2 p) {
vec4 d;
d[0] = textureLodOffset(materialParams_color, p, 0.0, ivec2(0, 1)).r;
d[1] = textureLodOffset(materialParams_color, p, 0.0, ivec2(1, 1)).r;
d[2] = textureLodOffset(materialParams_color, p, 0.0, ivec2(1, 0)).r;
d[3] = textureLodOffset(materialParams_color, p, 0.0, ivec2(0, 0)).r;
return AF4(d);
}
AF4 FsrEasuGF(AF2 p) {
vec4 d;
d[0] = textureLodOffset(materialParams_color, p, 0.0, ivec2(0, 1)).g;
d[1] = textureLodOffset(materialParams_color, p, 0.0, ivec2(1, 1)).g;
d[2] = textureLodOffset(materialParams_color, p, 0.0, ivec2(1, 0)).g;
d[3] = textureLodOffset(materialParams_color, p, 0.0, ivec2(0, 0)).g;
return AF4(d);
}
AF4 FsrEasuBF(AF2 p) {
vec4 d;
d[0] = textureLodOffset(materialParams_color, p, 0.0, ivec2(0, 1)).b;
d[1] = textureLodOffset(materialParams_color, p, 0.0, ivec2(1, 1)).b;
d[2] = textureLodOffset(materialParams_color, p, 0.0, ivec2(1, 0)).b;
d[3] = textureLodOffset(materialParams_color, p, 0.0, ivec2(0, 0)).b;
return AF4(d);
}
#endif
void postProcess(inout PostProcessInputs postProcess) {
highp uvec2 p = uvec2(variable_vertex.xy);
AF3 pix;
FsrEasuF(pix, p,
materialParams.EasuCon0,
materialParams.EasuCon1,
materialParams.EasuCon2,
materialParams.EasuCon3);
postProcess.color.rgb = pix;
postProcess.color.a = 1.0; // TODO: FSR doesn't support transparency.
}
}

View File

@@ -0,0 +1,59 @@
material {
name : fsr_rcas,
parameters : [
{
type : sampler2d,
name : color,
precision: medium
},
{
type : float4,
name : resolution,
precision: high
},
{
type : uint4,
name : RcasCon,
precision: high
}
],
variables : [
vertex
],
depthWrite : false,
depthCulling : false,
domain: postprocess
}
vertex {
void postProcessVertex(inout PostProcessVertexInputs postProcess) {
postProcess.vertex.xy = postProcess.normalizedUV * materialParams.resolution.xy;
}
}
fragment {
precision mediump float;
precision highp int;
#define A_GPU 1
#define A_GLSL 1
#include "ffx_a.h"
#define FSR_RCAS_F 1
#include "ffx_fsr1.h"
AF4 FsrRcasLoadF(ASU2 p) {
return texelFetch(materialParams_color, p, 0);
}
void FsrRcasInputF(inout AF1 r, inout AF1 g, inout AF1 b) { }
void postProcess(inout PostProcessInputs postProcess) {
highp uvec2 p = uvec2(variable_vertex.xy);
FsrRcasF(postProcess.color.r, postProcess.color.g, postProcess.color.b,
p, materialParams.RcasCon);
postProcess.color.a = 1.0; // TODO: FSR doesn't support transparency.
}
}

View File

@@ -0,0 +1,19 @@
Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
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 Software.
THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

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

View File

@@ -345,6 +345,8 @@ static void createGroundPlane(Engine* engine, Scene* scene, App& app) {
static float sGlobalScale = 1.0f;
static float sGlobalScaleAnamorphism = 0.0f;
static int sGlobalScaleQuality = 0;
static float sGlobalScaleSharpness = 0.2f;
int main(int argc, char** argv) {
App app;
@@ -575,6 +577,9 @@ int main(int argc, char** argv) {
}
ImGui::SliderFloat("scale", &sGlobalScale, 0.25f, 1.0f);
ImGui::SliderFloat("anamorphism", &sGlobalScaleAnamorphism, -1.0f, 1.0f);
ImGui::SliderInt("quality", &sGlobalScaleQuality, 0, 3);
ImGui::SliderFloat("sharpness", &sGlobalScaleSharpness, 0.0f, 2.0f);
}
if (ImGui::BeginPopupModal("MessageBox", NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
@@ -700,7 +705,9 @@ int main(int argc, char** argv) {
lerp(sGlobalScale, 1.0f,
sGlobalScaleAnamorphism <= 0.0f ? -sGlobalScaleAnamorphism : 0.0f),
},
.sharpness = sGlobalScaleSharpness,
.enabled = sGlobalScale != 1.0f,
.quality = (QualityLevel)sGlobalScaleQuality
});
};

View File

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