forked from LeenkxTeam/LNXSDK
57 lines
1.3 KiB
Haxe
57 lines
1.3 KiB
Haxe
package leenkx.renderpath;
|
|
|
|
import iron.RenderPath;
|
|
|
|
/**
|
|
* AMD FidelityFX Super Resolution (FSR V1) - Spatial Upscaling
|
|
* MIT License -
|
|
* Quality sharpness values:
|
|
* - Ultra_Quality: 0.0
|
|
* - Quality: 0.25
|
|
* - Balanced: 0.5
|
|
* - Performance: 0.75
|
|
*/
|
|
class FSR1 {
|
|
|
|
static var path: RenderPath;
|
|
|
|
public static inline var ULTRA_QUALITY: Float = 0.0;
|
|
public static inline var QUALITY: Float = 0.25;
|
|
public static inline var BALANCED: Float = 0.5;
|
|
public static inline var PERFORMANCE: Float = 0.75;
|
|
|
|
public static function init(_path: RenderPath) {
|
|
path = _path;
|
|
|
|
#if rp_fsr1
|
|
path.loadShader("shader_datas/fsr1_easu_pass/fsr1_easu_pass");
|
|
path.loadShader("shader_datas/fsr1_rcas_pass/fsr1_rcas_pass");
|
|
#end
|
|
}
|
|
|
|
public static function getSharpnessFromPreset(preset: String): Float {
|
|
return switch(preset) {
|
|
case "Ultra_Quality": ULTRA_QUALITY;
|
|
case "Quality": QUALITY;
|
|
case "Balanced": BALANCED;
|
|
case "Performance": PERFORMANCE;
|
|
default: QUALITY;
|
|
};
|
|
}
|
|
|
|
public static function applyRCAS(inputTarget: String, outputTarget: String = null) {
|
|
#if rp_fsr1
|
|
if (path == null) return;
|
|
|
|
if (outputTarget != null) {
|
|
path.setTarget(outputTarget);
|
|
} else {
|
|
path.setTarget("");
|
|
}
|
|
|
|
path.bindTarget(inputTarget, "tex");
|
|
path.drawShader("shader_datas/fsr1_rcas_pass/fsr1_rcas_pass");
|
|
#end
|
|
}
|
|
}
|