add metal fx sr
This commit is contained in:
parent
b56f5d0576
commit
392791caf8
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
|
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
|
||||||
m_Name: Bloom
|
m_Name: Bloom
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
active: 0
|
active: 1
|
||||||
skipIterations:
|
skipIterations:
|
||||||
m_OverrideState: 0
|
m_OverrideState: 0
|
||||||
m_Value: 1
|
m_Value: 1
|
||||||
|
|||||||
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
|
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
|
||||||
m_Name: Bloom
|
m_Name: Bloom
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
active: 0
|
active: 1
|
||||||
skipIterations:
|
skipIterations:
|
||||||
m_OverrideState: 0
|
m_OverrideState: 0
|
||||||
m_Value: 1
|
m_Value: 1
|
||||||
|
|||||||
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: f62c9c65cf3354c93be831c8bc075510, type: 3}
|
m_Script: {fileID: 11500000, guid: f62c9c65cf3354c93be831c8bc075510, type: 3}
|
||||||
m_Name: ScreenSpaceAmbientOcclusion
|
m_Name: ScreenSpaceAmbientOcclusion
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Active: 1
|
m_Active: 0
|
||||||
m_Settings:
|
m_Settings:
|
||||||
AOMethod: 1
|
AOMethod: 1
|
||||||
Downsample: 1
|
Downsample: 1
|
||||||
@ -180,8 +180,9 @@ MonoBehaviour:
|
|||||||
quality: 3
|
quality: 3
|
||||||
v1settings:
|
v1settings:
|
||||||
EnableEdgeDirection: 1
|
EnableEdgeDirection: 1
|
||||||
Mode: 1
|
Mode: 4
|
||||||
Sharp: 0.666
|
Sharp: 0.942
|
||||||
|
MipMapBias: -1.76
|
||||||
GSRV1Material: {fileID: 2100000, guid: d57e64d5723127243b429034bed82c7d, type: 2}
|
GSRV1Material: {fileID: 2100000, guid: d57e64d5723127243b429034bed82c7d, type: 2}
|
||||||
v2settings:
|
v2settings:
|
||||||
UseCompute2Pass: 0
|
UseCompute2Pass: 0
|
||||||
|
|||||||
29
NativeRenderPlugin/.vscode/compile_commands.json
vendored
29
NativeRenderPlugin/.vscode/compile_commands.json
vendored
@ -1,36 +1,31 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"directory": "G:\\TJURP\\NativeRenderPlugin",
|
"directory": "g:\\TJURP\\NativeRenderPlugin",
|
||||||
"arguments": ["C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX64\\x64\\cl.exe", "/c", "/nologo", "/std:c++20", "/Igl3w", "/IUnity", "/IC:\\VulkanSDK\\1.3.283.0\\Include", "/Iexternal\\include", "/Ifeatures", "/DNOMINMAX", "/DSUPPORT_D3D11=1", "/DSUPPORT_D3D12=1", "/DSUPPORT_VULKAN=1", "/EHsc", "/Fobuild\\.objs\\GfxPluginNativeRender\\windows\\x64\\release\\features\\xess1\\xess.cpp.obj", "features\\xess1\\xess.cpp"],
|
"arguments": ["C:\\Users\\xinyt\\AppData\\Local\\OpenHarmony\\Sdk\\12\\native\\llvm\\bin\\clang.exe", "-c", "-Qunused-arguments", "-D__MUSL__", "--target=aarch64-linux-ohos", "--sysroot=C:/Users/xinyt/AppData/Local/OpenHarmony/Sdk/12/native/sysroot", "-fPIC", "-std=c++20", "-Igl3w", "-IUnity", "-DSUPPORT_OPENGL_UNIFIED=1", "-DSUPPORT_OPENGL_ES=1", "-DOHOS=1", "-IC:\\Program Files\\Huawei\\DevEco Studio\\sdk\\default\\hms\\native\\sysroot\\usr\\include", "-DMYCLANG", "-DOHOS_STL=c++_shared", "-o", "build\\.objs\\GfxPluginNativeRender\\harmonyos\\aarch64\\debug\\RenderAPI.cpp.o", "RenderAPI.cpp"],
|
||||||
"file": "features\\xess1\\xess.cpp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"directory": "G:\\TJURP\\NativeRenderPlugin",
|
|
||||||
"arguments": ["C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX64\\x64\\cl.exe", "/c", "/nologo", "/std:c++20", "/Igl3w", "/IUnity", "/IC:\\VulkanSDK\\1.3.283.0\\Include", "/Iexternal\\include", "/Ifeatures", "/DNOMINMAX", "/DSUPPORT_D3D11=1", "/DSUPPORT_D3D12=1", "/DSUPPORT_VULKAN=1", "/EHsc", "/Fobuild\\.objs\\GfxPluginNativeRender\\windows\\x64\\release\\RenderAPI.cpp.obj", "RenderAPI.cpp"],
|
|
||||||
"file": "RenderAPI.cpp"
|
"file": "RenderAPI.cpp"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "G:\\TJURP\\NativeRenderPlugin",
|
"directory": "g:\\TJURP\\NativeRenderPlugin",
|
||||||
"arguments": ["C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX64\\x64\\cl.exe", "/c", "/nologo", "/std:c++20", "/Igl3w", "/IUnity", "/IC:\\VulkanSDK\\1.3.283.0\\Include", "/Iexternal\\include", "/Ifeatures", "/DNOMINMAX", "/DSUPPORT_D3D11=1", "/DSUPPORT_D3D12=1", "/DSUPPORT_VULKAN=1", "/EHsc", "/Fobuild\\.objs\\GfxPluginNativeRender\\windows\\x64\\release\\RenderAPI_D3D11.cpp.obj", "RenderAPI_D3D11.cpp"],
|
"arguments": ["C:\\Users\\xinyt\\AppData\\Local\\OpenHarmony\\Sdk\\12\\native\\llvm\\bin\\clang.exe", "-c", "-Qunused-arguments", "-D__MUSL__", "--target=aarch64-linux-ohos", "--sysroot=C:/Users/xinyt/AppData/Local/OpenHarmony/Sdk/12/native/sysroot", "-fPIC", "-std=c++20", "-Igl3w", "-IUnity", "-DSUPPORT_OPENGL_UNIFIED=1", "-DSUPPORT_OPENGL_ES=1", "-DOHOS=1", "-IC:\\Program Files\\Huawei\\DevEco Studio\\sdk\\default\\hms\\native\\sysroot\\usr\\include", "-DMYCLANG", "-DOHOS_STL=c++_shared", "-o", "build\\.objs\\GfxPluginNativeRender\\harmonyos\\aarch64\\debug\\RenderAPI_D3D11.cpp.o", "RenderAPI_D3D11.cpp"],
|
||||||
"file": "RenderAPI_D3D11.cpp"
|
"file": "RenderAPI_D3D11.cpp"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "G:\\TJURP\\NativeRenderPlugin",
|
"directory": "g:\\TJURP\\NativeRenderPlugin",
|
||||||
"arguments": ["C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX64\\x64\\cl.exe", "/c", "/nologo", "/std:c++20", "/Igl3w", "/IUnity", "/IC:\\VulkanSDK\\1.3.283.0\\Include", "/Iexternal\\include", "/Ifeatures", "/DNOMINMAX", "/DSUPPORT_D3D11=1", "/DSUPPORT_D3D12=1", "/DSUPPORT_VULKAN=1", "/EHsc", "/Fobuild\\.objs\\GfxPluginNativeRender\\windows\\x64\\release\\RenderAPI_D3D12.cpp.obj", "RenderAPI_D3D12.cpp"],
|
"arguments": ["C:\\Users\\xinyt\\AppData\\Local\\OpenHarmony\\Sdk\\12\\native\\llvm\\bin\\clang.exe", "-c", "-Qunused-arguments", "-D__MUSL__", "--target=aarch64-linux-ohos", "--sysroot=C:/Users/xinyt/AppData/Local/OpenHarmony/Sdk/12/native/sysroot", "-fPIC", "-std=c++20", "-Igl3w", "-IUnity", "-DSUPPORT_OPENGL_UNIFIED=1", "-DSUPPORT_OPENGL_ES=1", "-DOHOS=1", "-IC:\\Program Files\\Huawei\\DevEco Studio\\sdk\\default\\hms\\native\\sysroot\\usr\\include", "-DMYCLANG", "-DOHOS_STL=c++_shared", "-o", "build\\.objs\\GfxPluginNativeRender\\harmonyos\\aarch64\\debug\\RenderAPI_D3D12.cpp.o", "RenderAPI_D3D12.cpp"],
|
||||||
"file": "RenderAPI_D3D12.cpp"
|
"file": "RenderAPI_D3D12.cpp"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "G:\\TJURP\\NativeRenderPlugin",
|
"directory": "g:\\TJURP\\NativeRenderPlugin",
|
||||||
"arguments": ["C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX64\\x64\\cl.exe", "/c", "/nologo", "/std:c++20", "/Igl3w", "/IUnity", "/IC:\\VulkanSDK\\1.3.283.0\\Include", "/Iexternal\\include", "/Ifeatures", "/DNOMINMAX", "/DSUPPORT_D3D11=1", "/DSUPPORT_D3D12=1", "/DSUPPORT_VULKAN=1", "/EHsc", "/Fobuild\\.objs\\GfxPluginNativeRender\\windows\\x64\\release\\RenderAPI_OpenGLCoreES.cpp.obj", "RenderAPI_OpenGLCoreES.cpp"],
|
"arguments": ["C:\\Users\\xinyt\\AppData\\Local\\OpenHarmony\\Sdk\\12\\native\\llvm\\bin\\clang.exe", "-c", "-Qunused-arguments", "-D__MUSL__", "--target=aarch64-linux-ohos", "--sysroot=C:/Users/xinyt/AppData/Local/OpenHarmony/Sdk/12/native/sysroot", "-fPIC", "-std=c++20", "-Igl3w", "-IUnity", "-DSUPPORT_OPENGL_UNIFIED=1", "-DSUPPORT_OPENGL_ES=1", "-DOHOS=1", "-IC:\\Program Files\\Huawei\\DevEco Studio\\sdk\\default\\hms\\native\\sysroot\\usr\\include", "-DMYCLANG", "-DOHOS_STL=c++_shared", "-o", "build\\.objs\\GfxPluginNativeRender\\harmonyos\\aarch64\\debug\\RenderAPI_OpenGLCoreES.cpp.o", "RenderAPI_OpenGLCoreES.cpp"],
|
||||||
"file": "RenderAPI_OpenGLCoreES.cpp"
|
"file": "RenderAPI_OpenGLCoreES.cpp"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "G:\\TJURP\\NativeRenderPlugin",
|
"directory": "g:\\TJURP\\NativeRenderPlugin",
|
||||||
"arguments": ["C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX64\\x64\\cl.exe", "/c", "/nologo", "/std:c++20", "/Igl3w", "/IUnity", "/IC:\\VulkanSDK\\1.3.283.0\\Include", "/Iexternal\\include", "/Ifeatures", "/DNOMINMAX", "/DSUPPORT_D3D11=1", "/DSUPPORT_D3D12=1", "/DSUPPORT_VULKAN=1", "/EHsc", "/Fobuild\\.objs\\GfxPluginNativeRender\\windows\\x64\\release\\RenderAPI_Vulkan.cpp.obj", "RenderAPI_Vulkan.cpp"],
|
"arguments": ["C:\\Users\\xinyt\\AppData\\Local\\OpenHarmony\\Sdk\\12\\native\\llvm\\bin\\clang.exe", "-c", "-Qunused-arguments", "-D__MUSL__", "--target=aarch64-linux-ohos", "--sysroot=C:/Users/xinyt/AppData/Local/OpenHarmony/Sdk/12/native/sysroot", "-fPIC", "-std=c++20", "-Igl3w", "-IUnity", "-DSUPPORT_OPENGL_UNIFIED=1", "-DSUPPORT_OPENGL_ES=1", "-DOHOS=1", "-IC:\\Program Files\\Huawei\\DevEco Studio\\sdk\\default\\hms\\native\\sysroot\\usr\\include", "-DMYCLANG", "-DOHOS_STL=c++_shared", "-o", "build\\.objs\\GfxPluginNativeRender\\harmonyos\\aarch64\\debug\\RenderAPI_Vulkan.cpp.o", "RenderAPI_Vulkan.cpp"],
|
||||||
"file": "RenderAPI_Vulkan.cpp"
|
"file": "RenderAPI_Vulkan.cpp"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"directory": "G:\\TJURP\\NativeRenderPlugin",
|
"directory": "g:\\TJURP\\NativeRenderPlugin",
|
||||||
"arguments": ["C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX64\\x64\\cl.exe", "/c", "/nologo", "/std:c++20", "/Igl3w", "/IUnity", "/IC:\\VulkanSDK\\1.3.283.0\\Include", "/Iexternal\\include", "/Ifeatures", "/DNOMINMAX", "/DSUPPORT_D3D11=1", "/DSUPPORT_D3D12=1", "/DSUPPORT_VULKAN=1", "/EHsc", "/Fobuild\\.objs\\GfxPluginNativeRender\\windows\\x64\\release\\RenderingPlugin.cpp.obj", "RenderingPlugin.cpp"],
|
"arguments": ["C:\\Users\\xinyt\\AppData\\Local\\OpenHarmony\\Sdk\\12\\native\\llvm\\bin\\clang.exe", "-c", "-Qunused-arguments", "-D__MUSL__", "--target=aarch64-linux-ohos", "--sysroot=C:/Users/xinyt/AppData/Local/OpenHarmony/Sdk/12/native/sysroot", "-fPIC", "-std=c++20", "-Igl3w", "-IUnity", "-DSUPPORT_OPENGL_UNIFIED=1", "-DSUPPORT_OPENGL_ES=1", "-DOHOS=1", "-IC:\\Program Files\\Huawei\\DevEco Studio\\sdk\\default\\hms\\native\\sysroot\\usr\\include", "-DMYCLANG", "-DOHOS_STL=c++_shared", "-o", "build\\.objs\\GfxPluginNativeRender\\harmonyos\\aarch64\\debug\\RenderingPlugin.cpp.o", "RenderingPlugin.cpp"],
|
||||||
"file": "RenderingPlugin.cpp"
|
"file": "RenderingPlugin.cpp"
|
||||||
}]
|
}]
|
||||||
|
|||||||
@ -88,7 +88,7 @@ public:
|
|||||||
virtual void postFGExtrapolation() {}
|
virtual void postFGExtrapolation() {}
|
||||||
virtual void disableFGExtrapolation() {}
|
virtual void disableFGExtrapolation() {}
|
||||||
|
|
||||||
virtual void spatialUpScale(void* src, void* data, void* dst) {}
|
virtual void spatialUpScale(void* data) {}
|
||||||
|
|
||||||
virtual bool getFeatureSupport(GraphicsFeature feature);
|
virtual bool getFeatureSupport(GraphicsFeature feature);
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ public:
|
|||||||
|
|
||||||
virtual void initSupportFeature();
|
virtual void initSupportFeature();
|
||||||
|
|
||||||
virtual void spatialUpScale(void* src, void*data, void* dst);
|
virtual void spatialUpScale(void*data);
|
||||||
private:
|
private:
|
||||||
id <MTLFXSpatialScaler> mfx_spatial_scaler;
|
id <MTLFXSpatialScaler> mfx_spatial_scaler;
|
||||||
IUnityGraphicsMetal* metal_graphics;
|
IUnityGraphicsMetal* metal_graphics;
|
||||||
@ -64,12 +64,19 @@ void RenderAPI_Metal::initSupportFeature()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderAPI_Metal::spatialUpScale(void* src, void* data, void* dst)
|
void RenderAPI_Metal::spatialUpScale(void* data)
|
||||||
{
|
{
|
||||||
if (@available(iOS 16.0, macOS 13.0, *))
|
if (@available(iOS 16.0, macOS 13.0, *))
|
||||||
{
|
{
|
||||||
id<MTLTexture> srctex = (__bridge id<MTLTexture>)src;
|
struct DataPack
|
||||||
id<MTLTexture> dsttex = (__bridge id<MTLTexture>)dst;
|
{
|
||||||
|
void* src;
|
||||||
|
void* dst;
|
||||||
|
};
|
||||||
|
DataPack* data_pack = static_cast<DataPack*>(data);
|
||||||
|
|
||||||
|
id<MTLTexture> srctex = (__bridge id<MTLTexture>)data_pack->src;
|
||||||
|
id<MTLTexture> dsttex = (__bridge id<MTLTexture>)data_pack->dst;
|
||||||
|
|
||||||
id<MTLDevice> _device = metal_graphics->MetalDevice();
|
id<MTLDevice> _device = metal_graphics->MetalDevice();
|
||||||
id<MTLCommandBuffer> cmd = (id<MTLCommandBuffer>)metal_graphics->CurrentCommandBuffer();
|
id<MTLCommandBuffer> cmd = (id<MTLCommandBuffer>)metal_graphics->CurrentCommandBuffer();
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public:
|
|||||||
virtual void postFGExtrapolation() override;
|
virtual void postFGExtrapolation() override;
|
||||||
virtual void disableFGExtrapolation() override;
|
virtual void disableFGExtrapolation() override;
|
||||||
|
|
||||||
virtual void spatialUpScale(void *src, void *data, void *dst) override;
|
virtual void spatialUpScale(void *data) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void initSupportFeature() override;
|
virtual void initSupportFeature() override;
|
||||||
@ -396,18 +396,26 @@ void RenderAPI_OpenGLCoreES::disableFGExtrapolation()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderAPI_OpenGLCoreES::spatialUpScale(void *src, void *data, void *dst)
|
void RenderAPI_OpenGLCoreES::spatialUpScale(void *data)
|
||||||
{
|
{
|
||||||
#if OHOS
|
#if OHOS
|
||||||
|
struct DataPack
|
||||||
|
{
|
||||||
|
void* src;
|
||||||
|
void* data;
|
||||||
|
void* dst;
|
||||||
|
};
|
||||||
|
|
||||||
struct HWSpatialSRParam
|
struct HWSpatialSRParam
|
||||||
{
|
{
|
||||||
float sharpness;
|
float sharpness;
|
||||||
uint32_t render_width;
|
uint32_t render_width;
|
||||||
uint32_t render_height;
|
uint32_t render_height;
|
||||||
};
|
};
|
||||||
if (data != NULL)
|
DataPack* data_pack = static_cast<DataPack*>(data);
|
||||||
|
if (data_pack->data != NULL)
|
||||||
{
|
{
|
||||||
HWSpatialSRParam* param = (HWSpatialSRParam*) data;
|
HWSpatialSRParam* param = (HWSpatialSRParam*) data_pack->data;
|
||||||
float m_sharpness = param->sharpness;
|
float m_sharpness = param->sharpness;
|
||||||
|
|
||||||
HMS_XEG_SpatialUpscaleParameter(XEG_SPATIAL_UPSCALE_SHARPNESS, &m_sharpness);
|
HMS_XEG_SpatialUpscaleParameter(XEG_SPATIAL_UPSCALE_SHARPNESS, &m_sharpness);
|
||||||
@ -415,10 +423,10 @@ void RenderAPI_OpenGLCoreES::spatialUpScale(void *src, void *data, void *dst)
|
|||||||
int upscaleScissor[4] = {0, 0, static_cast<int>(param->render_width), static_cast<int>(param->render_height)};
|
int upscaleScissor[4] = {0, 0, static_cast<int>(param->render_width), static_cast<int>(param->render_height)};
|
||||||
HMS_XEG_SpatialUpscaleParameter(XEG_SPATIAL_UPSCALE_SCISSOR, upscaleScissor);
|
HMS_XEG_SpatialUpscaleParameter(XEG_SPATIAL_UPSCALE_SCISSOR, upscaleScissor);
|
||||||
}
|
}
|
||||||
GLuint gl_srctex = (GLuint)(size_t)(src);
|
GLuint gl_srctex = (GLuint)(size_t)(data_pack->src);
|
||||||
|
|
||||||
// TODO: 测试由上层设置
|
// TODO: 测试由上层设置
|
||||||
// GLuint gl_dsttex = (GLuint)(size_t)(dst);
|
// GLuint gl_dsttex = (GLuint)(size_t)(data_pack->dst);
|
||||||
// // upscaleFBO为用户自定义创建的framebuffer
|
// // upscaleFBO为用户自定义创建的framebuffer
|
||||||
// glBindFramebuffer(GL_FRAMEBUFFER, gl_dsttex);
|
// glBindFramebuffer(GL_FRAMEBUFFER, gl_dsttex);
|
||||||
// glViewport(0, 0, upscale_width, upscale_height);
|
// glViewport(0, 0, upscale_width, upscale_height);
|
||||||
|
|||||||
@ -105,7 +105,7 @@ enum NativeRenderingEvent
|
|||||||
DoFGExtrapolation,
|
DoFGExtrapolation,
|
||||||
PostFGExtrapolation,
|
PostFGExtrapolation,
|
||||||
DisableFGExtrapolation,
|
DisableFGExtrapolation,
|
||||||
// SpatialUpScale,
|
SpatialUpScale,
|
||||||
EnableXESS1,
|
EnableXESS1,
|
||||||
DoXESS1,
|
DoXESS1,
|
||||||
UpdateXESS1Config,
|
UpdateXESS1Config,
|
||||||
@ -147,7 +147,11 @@ static void UNITY_INTERFACE_API OnRenderEventAndData(int eventID, void *data)
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case NativeRenderingEvent::SpatialUpScale:
|
||||||
|
{
|
||||||
|
s_current_api->spatialUpScale(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case NativeRenderingEvent::DoFGExtrapolation:
|
case NativeRenderingEvent::DoFGExtrapolation:
|
||||||
{
|
{
|
||||||
AFMEParam *param = (AFMEParam *)data;
|
AFMEParam *param = (AFMEParam *)data;
|
||||||
|
|||||||
@ -51,7 +51,7 @@ namespace X.Rendering.Feature
|
|||||||
DoFGExtrapolation,
|
DoFGExtrapolation,
|
||||||
PostFGExtrapolation,
|
PostFGExtrapolation,
|
||||||
DisableFGExtrapolation,
|
DisableFGExtrapolation,
|
||||||
// SpatialUpScale,
|
SpatialUpScale,
|
||||||
EnableXESS1,
|
EnableXESS1,
|
||||||
DoXESS1,
|
DoXESS1,
|
||||||
UpdateXESS1Config,
|
UpdateXESS1Config,
|
||||||
|
|||||||
@ -0,0 +1,76 @@
|
|||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Rendering;
|
||||||
|
using UnityEngine.Rendering.Universal;
|
||||||
|
|
||||||
|
namespace X.Rendering.Feature
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
internal unsafe class MetalFxSpatialUpScale : ScriptableRendererFeature, ISuperResolutionFeature
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
SrQuality quality;
|
||||||
|
private ProfilingSampler profiler;
|
||||||
|
|
||||||
|
struct DataPack
|
||||||
|
{
|
||||||
|
public IntPtr src;
|
||||||
|
public IntPtr dst;
|
||||||
|
};
|
||||||
|
IntPtr dataPtr;
|
||||||
|
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Create()
|
||||||
|
{
|
||||||
|
dataPtr = Marshal.AllocHGlobal(sizeof(DataPack));
|
||||||
|
profiler = new ProfilingSampler("MetalFx.SpatialUpScale");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
base.Dispose(disposing);
|
||||||
|
Marshal.FreeHGlobal(dataPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoSR(CommandBuffer cmd, RTHandle source, RTHandle destination, RTHandle motionVector, ref RenderingData renderingData)
|
||||||
|
{
|
||||||
|
using var scp = new ProfilingScope(cmd, profiler);
|
||||||
|
DataPack * ptr = (DataPack*) dataPtr.ToPointer();
|
||||||
|
ptr->src = source.rt.GetNativeTexturePtr();
|
||||||
|
ptr->dst = destination.rt.GetNativeTexturePtr();
|
||||||
|
cmd.IssuePluginEventAndData(RenderingPlugin.GetRenderEventAndDataFunc(), (int)RenderingPlugin.NativeRenderingEvent.UpdateXESS1Config, dataPtr);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public float GetRenderScale()
|
||||||
|
{
|
||||||
|
switch (quality)
|
||||||
|
{
|
||||||
|
case SrQuality.None:
|
||||||
|
case SrQuality.NativeAA:
|
||||||
|
return 1.0f;
|
||||||
|
case SrQuality.UltraQuality:
|
||||||
|
return 1 / 1.2f;
|
||||||
|
case SrQuality.Quality:
|
||||||
|
return 1 / 1.5f;
|
||||||
|
case SrQuality.Balanced:
|
||||||
|
return 1 / 1.7f;
|
||||||
|
case SrQuality.Performance:
|
||||||
|
return 1 / 2.0f;
|
||||||
|
case SrQuality.UltraPerformance:
|
||||||
|
return 1 / 3.0f;
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(GsrQuality));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetSR(ESuperResolution resolution)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 74dc463bb029b6b41a2fe66db031c2ae
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -30,6 +30,17 @@ namespace X.Rendering.Feature
|
|||||||
XESS13,
|
XESS13,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum SrQuality
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
NativeAA = 1,
|
||||||
|
UltraQuality,
|
||||||
|
Quality,
|
||||||
|
Balanced,
|
||||||
|
Performance,
|
||||||
|
UltraPerformance,
|
||||||
|
}
|
||||||
|
|
||||||
public class SuperResolutionParamSets
|
public class SuperResolutionParamSets
|
||||||
{
|
{
|
||||||
private static SuperResolutionParamSets instance;
|
private static SuperResolutionParamSets instance;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user