FidelityFX FSR v2.2.0a

This commit is contained in:
Rys Sommefeldt 2023-02-22 17:14:52 +00:00
parent e812d9e4c4
commit 149cf26e12
6 changed files with 7 additions and 893 deletions

View File

@ -1,6 +1,6 @@
# FidelityFX Super Resolution 2.2 (FSR 2.2)
Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved.
Copyright (c) 2023 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
@ -53,7 +53,7 @@ You can find the binaries for FidelityFX FSR in the release section on GitHub.
- [Mipmap biasing](#mipmap-biasing)
- [Frame Time Delta Input](#frame-time-delta-input)
- [HDR support](#hdr-support)
- [Falling back to 32bit floating point](#falling-back-to-32bit-floating-point)
- [Falling back to 32-bit floating point](#falling-back-to-32-bit-floating-point)
- [64-wide wavefronts](#64-wide-wavefronts)
- [API Debug Checker](#debug-checker)
- [The technique](#the-technique)

View File

@ -1,3 +1,8 @@
2023-02-23 | FidelityFX Super Resolution 2.2a
-------
- Minor updates to the documentation
- Removal of a handful of files from the prior release that are no longer part of FSR 2.2.
2023-02-16 | FidelityFX Super Resolution 2.2
-------
- Introduction of API debug checker.

View File

@ -1,677 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="438.67917mm"
height="228.07083mm"
viewBox="0 0 438.67917 228.07083"
version="1.1"
id="svg1944"
inkscape:version="1.1.2 (b8e25be833, 2022-02-05)"
sodipodi:docname="reproject-and-accumulate-structure.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1946"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="0.77771465"
inkscape:cx="2185.8917"
inkscape:cy="1044.0847"
inkscape:window-width="3699"
inkscape:window-height="2126"
inkscape:window-x="130"
inkscape:window-y="-11"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs1941">
<clipPath
id="clip0">
<rect
x="167"
y="101"
width="1658"
height="870"
id="rect1948" />
</clipPath>
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(473.13339,127.98387)">
<g
clip-path="url(#clip0)"
transform="matrix(0.26458333,0,0,0.26458333,-517.31881,-154.70679)"
id="g2159">
<rect
x="300"
y="479"
width="16"
height="19"
id="rect1953" />
<path
d="m 0,-3 h 159.594 v 61.457 h -6 V 0 l 3,3 H 0 Z m 165.594,58.457 -9,18 -9,-18 z"
transform="matrix(1,0,0,-1,316,444.457)"
id="path1955" />
<rect
x="300"
y="435"
width="16"
height="18"
id="rect1957" />
<rect
x="892"
y="560"
width="21"
height="20"
stroke="#2f528f"
stroke-width="2"
stroke-miterlimit="8"
fill="#4472c4"
id="rect1959" />
<rect
x="776"
y="560"
width="21"
height="21"
stroke="#2f528f"
stroke-width="2"
stroke-miterlimit="8"
fill="#4472c4"
id="rect1961" />
<rect
x="967"
y="611"
width="20"
height="20"
stroke="#2f528f"
stroke-width="2"
stroke-miterlimit="8"
fill="#4472c4"
id="rect1963" />
<rect
x="1075"
y="611"
width="20"
height="20"
stroke="#2f528f"
stroke-width="2"
stroke-miterlimit="8"
fill="#4472c4"
id="rect1965" />
<rect
x="965"
y="560"
width="20"
height="21"
stroke="#2f528f"
stroke-width="2"
stroke-miterlimit="8"
fill="#4472c4"
id="rect1967" />
<rect
x="1074"
y="560"
width="20"
height="20"
stroke="#2f528f"
stroke-width="2"
stroke-miterlimit="8"
fill="#4472c4"
id="rect1969" />
<rect
x="787"
y="560"
width="16"
height="18"
id="rect1971" />
<rect
x="1495"
y="835"
width="61"
height="31"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
id="rect1973" />
<text
fill="#ffffff"
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="16px"
transform="translate(1511.06,856)"
id="text1975">Pass</text>
<rect
x="1567"
y="835"
width="61"
height="31"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
fill="#ffffff"
id="rect1977" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="12px"
transform="translate(1582.31,854)"
id="text1979">Buffer</text>
<rect
x="399"
y="299"
width="148"
height="72"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
id="rect1981" />
<text
fill="#ffffff"
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(440.758,318)"
id="text1987">Shading <tspan
font-size="20px"
x="2.8699999"
y="24"
id="tspan1983">change</tspan><tspan
font-size="20px"
x="-6.8800001"
y="48"
id="tspan1985">detection</tspan></text>
<rect
x="771"
y="560"
width="147"
height="71"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
id="rect1989" />
<text
fill="#ffffff"
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(790.107,603)"
id="text1991">Update Locks</text>
<rect
x="168"
y="430"
width="147"
height="72"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
fill="#ffffff"
id="rect1993" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(196.474,473)"
id="text1995">Lock status</text>
<rect
x="168"
y="807"
width="147"
height="71"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
fill="#ffffff"
id="rect1997" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(191.349,838)"
id="text2001">Disocclusion <tspan
font-size="20px"
x="29"
y="24"
id="tspan1999">mask</tspan></text>
<path
d="m 0,-3 h 532.183 v 199.427 h -6 V 0 l 3,3 H 0 Z m 538.183,196.427 -9,18 -9,-18 z"
transform="matrix(1,0,0,-1,315,842.427)"
id="path2003" />
<rect
x="956"
y="560"
width="148"
height="71"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
id="rect2005" />
<text
fill="#ffffff"
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(979.694,603)"
id="text2007">Rectify color</text>
<path
d="m 0,-3 h 772.861 v 199.801 h -6 V 0 l 3,3 H 0 Z m 778.861,196.801 -9,18 -9,-18 z"
transform="matrix(1,0,0,-1,315,842.801)"
id="path2009" />
<rect
x="1318"
y="560"
width="147"
height="72"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
id="rect2011" />
<text
fill="#ffffff"
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(1343.48,603)"
id="text2013">Accumulate</text>
<rect
x="1318"
y="429"
width="147"
height="71"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
id="rect2015" />
<text
fill="#ffffff"
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(1353.23,472)"
id="text2017">Tonemap</text>
<rect
x="1134"
y="560"
width="148"
height="71"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
id="rect2019" />
<text
fill="#ffffff"
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(1169.49,603)"
id="text2021">Tonemap</text>
<rect
x="1498"
y="560"
width="146"
height="72"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
id="rect2023" />
<text
fill="#ffffff"
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(1541.26,591)"
id="text2027">Inverse <tspan
font-size="20px"
x="-7.25"
y="24"
id="tspan2025">tonemap</tspan></text>
<path
d="m 918,593 h 23.061 v 6 H 918 Z m 20.061,-6 18,9 -18,9 z"
id="path2029" />
<path
d="m 1104,593 h 15.02 v 6 H 1104 Z m 12.02,-6 18,9 -18,9 z"
id="path2031" />
<path
d="M 1.44131e-5,-3 17.7786,-2.99991 v 6 L -1.44131e-5,3 Z M 14.7786,-8.99993 32.7786,1.5748e-4 14.7785,9.00007 Z"
transform="matrix(1,0,0,-1,1465,596)"
id="path2033" />
<path
d="m 1282.04,593 21.09,0.259 -0.08,6 -21.09,-0.259 z m 18.16,-5.777 17.89,9.22 -18.11,8.778 z"
id="path2035" />
<path
d="m 1395,500 v 44.932 h -6 V 500 Z m 6,41.932 -9,18 -9,-18 z"
id="path2037" />
<rect
x="1006"
y="195"
width="148"
height="72"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
id="rect2039" />
<text
fill="#ffffff"
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(1039.53,238)"
id="text2041">Upsample</text>
<rect
x="169"
y="254"
width="147"
height="71"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
fill="#ffffff"
id="rect2043" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(189.971,296)"
id="text2045">Luma history</text>
<rect
x="168"
y="342"
width="147"
height="72"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
fill="#ffffff"
id="rect2047" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(210.224,373)"
id="text2051">Current <tspan
font-size="20px"
x="-11"
y="24"
id="tspan2049">luminance</tspan></text>
<rect
x="168"
y="102"
width="147"
height="72"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
fill="#ffffff"
id="rect2053" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(182.599,145)"
id="text2057">Adjusted <tspan
font-size="20px"
x="76.75"
y="0"
id="tspan2055">color</tspan></text>
<path
d="m 316,286 h 44.378 v 48.587 l -3,-3 h 26.377 v 6 H 354.378 V 289 l 3,3 H 316 Z m 64.755,39.587 18,9 -18,9 z"
id="path2059" />
<path
d="m 0,-3 h 44.8764 v 45.9532 l -3,-3 h 26.8764 v 6 H 38.8764 V 0 l 3,3 H 0 Z m 65.7528,36.9532 18,9 -18,9 z"
transform="matrix(1,0,0,-1,315,377.953)"
id="path2061" />
<rect
x="168"
y="685"
width="147"
height="72"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
fill="#ffffff"
id="rect2063" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(185.099,728)"
id="text2065">Output buffer</text>
<path
d="m 1154,228 h 240.51 v 186.13 h -6 V 231 l 3,3 H 1154 Z m 246.51,183.13 -9,18 -9,-18 z"
id="path2067" />
<rect
x="168"
y="891"
width="147"
height="71"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
fill="#ffffff"
id="rect2069" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(183.599,934)"
id="text2071">Reactive mask</text>
<path
d="m 0,-3 h 1079.31 v 282.927 h -6 V 0 l 3,3 H 0 Z m 1085.31,279.927 -9,18 -9,-18 z"
transform="matrix(1,0,0,-1,315,926.927)"
id="path2073" />
<rect
x="168"
y="559"
width="147"
height="71"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
fill="#ffffff"
id="rect2075" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(212.474,578)"
id="text2081">Dilated <tspan
font-size="20px"
x="-0.369995"
y="24"
id="tspan2077">motion</tspan><tspan
font-size="20px"
x="-0.75"
y="48"
id="tspan2079">vectors</tspan></text>
<rect
x="399"
y="559"
width="148"
height="72"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
id="rect2083" />
<text
fill="#ffffff"
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(433.503,602)"
id="text2085">Reproject</text>
<path
d="M 470,299.432 V 228 h 521.572 v 6 H 473 l 3,-3 v 68.432 z M 988.572,222 l 17.998,9 -17.998,9 z"
id="path2087" />
<path
d="m 547,332 h 358.9 v 212.638 h -6 V 335 l 3,3 H 547 Z m 364.9,209.638 -9,18 -9,-18 z"
id="path2089" />
<path
d="m 315,135 h 767.98 v 45.19 h -6 V 138 l 3,3 H 315 Z m 773.98,42.19 -9,18 -9,-18 z"
id="path2091" />
<rect
x="581"
y="559"
width="147"
height="72"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
fill="#ffffff"
id="rect2093" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(604.788,590)"
id="text2097">Reprojected <tspan
font-size="20px"
x="6.6199999"
y="24"
id="tspan2095">lock status</tspan></text>
<rect
x="1676"
y="560"
width="148"
height="72"
stroke="#000000"
stroke-width="2"
stroke-miterlimit="8"
fill="#ffffff"
id="rect2099" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(1721.04,603)"
id="text2101">Output</text>
<path
d="M 1.44131e-5,-3 17.7786,-2.99991 v 6 L -1.44131e-5,3 Z M 14.7786,-8.99993 32.7786,1.5748e-4 14.7785,9.00007 Z"
transform="matrix(1,0,0,-1,1644,596)"
id="path2103" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(326.589,130)"
id="text2105">5x5 Lanczos</text>
<path
d="m 547,332 h 431.611 v 213.338 h -6 V 335 l 3,3 H 547 Z m 437.611,210.338 -9,18 -9,-18 z"
id="path2107" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(487.278,413)"
id="text2109">Y (Luminance)</text>
<path
d="m 547,592 h 18.884 v 6 H 547 Z m 15.884,-6 18,9 -18,9 z"
id="path2111" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(484.471,284)"
id="text2117">1<tspan
font-size="20px"
x="75.349503"
y="30"
id="tspan2113">1</tspan><tspan
font-size="20px"
x="610.20502"
y="12"
id="tspan2115">Clamping box</tspan></text>
<path
d="m 0,-3 h 44.8764 v 128.778 l -3,-3 h 26.8764 v 6 H 38.8764 V 0 l 3,3 H 0 Z m 65.7528,119.778 18,9 -18,9 z"
transform="matrix(1,0,0,-1,315,720.778)"
id="path2119" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(330.697,870)"
id="text2125">2x2<tspan
font-size="20px"
x="33.75"
y="0"
id="tspan2121">bilinea</tspan><tspan
font-size="20px"
x="87.75"
y="0"
id="tspan2123">r</tspan></text>
<path
d="m 316,485 h 159.594 v 58.919 h -6 V 488 l 3,3 H 316 Z m 165.594,55.919 -9,18 -9,-18 z"
id="path2127" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(320.814,473)"
id="text2137">2x2<tspan
font-size="20px"
x="33.75"
y="0"
id="tspan2129">bilinea</tspan>r<tspan
font-size="20px"
x="5.4096098"
y="111"
id="tspan2131">1</tspan><tspan
font-size="20px"
x="4.4811101"
y="275"
id="tspan2133">5x5 Lanczos</tspan><tspan
font-size="20px"
x="417.24301"
y="114"
id="tspan2135">1</tspan></text>
<path
d="M 0,-3 H 18 V 3 H 0 Z m 24,0 h 15.6321 v 8.36787 h -6 V 0 l 3,3 H 24 Z m 15.6321,14.3679 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18.0001 h -6 V 83.3679 Z m 0,24.0001 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 18 h -6 v -18 z m 0,24 v 15.495 h -8.5049 v -6 h 5.5049 l -3,3 v -12.495 z m -14.5049,15.495 h -9.4951 v -6 h 9.4951 z m -6.4951,6 -17.999974,-9 17.999974,-9 z"
transform="matrix(0,1,1,0,473,631)"
id="path2139" />
<text
font-family="Calibri, Calibri_MSFontService, sans-serif"
font-weight="400"
font-size="20px"
transform="translate(328.288,280)"
id="text2149">2x2<tspan
font-size="20px"
x="33.75"
y="0"
id="tspan2141">bilinea</tspan>r<tspan
font-size="20px"
x="1.15607"
y="128"
id="tspan2143">2x2 bilinear</tspan><tspan
font-size="20px"
x="-0.508362"
y="674"
id="tspan2145">2x2</tspan><tspan
font-size="20px"
x="33.2416"
y="674"
id="tspan2147">bilinea</tspan>r</text>
<path
d="m 728.039,592 27.418,0.353 -0.077,6 L 727.961,598 Z m 24.496,-5.685 17.882,9.231 -18.114,8.767 z"
id="path2151" />
<path
d="m 1083,266.965 3.28,278.31 -6,0.071 -3.28,-278.311 z m 9.25,275.24 -8.79,18.104 -9.21,-17.892 z"
id="path2153" />
<path
d="m 315.011,592 68.753,0.258 -0.022,6 L 314.989,598 Z m 65.776,-5.754 17.966,9.068 -18.034,8.932 z"
id="path2155" />
<path
d="m 0,-3 h 40.0282 v 138.078 h -24 v -6 h 21 l -3,3 V 0 l 3,3 H 0 Z m 19.0282,144.078 -18.00001,-9 18.00001,-9 z"
transform="matrix(0,-1,-1,0,786.078,560.028)"
id="path2157" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 20 KiB

View File

@ -1,88 +0,0 @@
// This file is part of the FidelityFX SDK.
//
// Copyright (c) 2022 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.
#ifndef FFX_FSR2_PREPARE_INPUT_COLOR_H
#define FFX_FSR2_PREPARE_INPUT_COLOR_H
//TODO: Move to common location & share with Accumulate
void ClearResourcesForNextFrame(in FfxInt32x2 iPxHrPos)
{
if (all(FFX_LESS_THAN(iPxHrPos, FfxInt32x2(RenderSize()))))
{
#if FFX_FSR2_OPTION_INVERTED_DEPTH
const FfxUInt32 farZ = 0x0;
#else
const FfxUInt32 farZ = 0x3f800000;
#endif
SetReconstructedDepth(iPxHrPos, farZ);
}
}
void ComputeLumaStabilityFactor(FfxInt32x2 iPxLrPos, FfxFloat32 fCurrentFrameLuma)
{
FfxFloat32x4 fCurrentFrameLumaHistory = LoadRwLumaHistory(iPxLrPos);
fCurrentFrameLumaHistory.a = FfxFloat32(0);
if (FrameIndex() > 3) {
FfxFloat32 fDiffs0 = MinDividedByMax(fCurrentFrameLumaHistory[2], fCurrentFrameLuma);
FfxFloat32 fDiffs1 = ffxMax(MinDividedByMax(fCurrentFrameLumaHistory[0], fCurrentFrameLuma), MinDividedByMax(fCurrentFrameLumaHistory[1], fCurrentFrameLuma));
fCurrentFrameLumaHistory.a = ffxSaturate(fDiffs1 - fDiffs0);
}
//move history
fCurrentFrameLumaHistory[0] = fCurrentFrameLumaHistory[1];
fCurrentFrameLumaHistory[1] = fCurrentFrameLumaHistory[2];
fCurrentFrameLumaHistory[2] = fCurrentFrameLuma;
StoreLumaHistory(iPxLrPos, fCurrentFrameLumaHistory);
}
void PrepareInputColor(FfxInt32x2 iPxLrPos)
{
//We assume linear data. if non-linear input (sRGB, ...),
//then we should convert to linear first and back to sRGB on output.
FfxFloat32x3 fRgb = ffxMax(FfxFloat32x3(0, 0, 0), LoadInputColor(iPxLrPos));
fRgb *= Exposure();
#if FFX_FSR2_OPTION_HDR_COLOR_INPUT
// Tonemap color, used in lockstatus and luma stability computations
fRgb = Tonemap(fRgb);
#endif
FfxFloat32x4 fYCoCg;
fYCoCg.xyz = RGBToYCoCg(fRgb);
const FfxFloat32 fPerceivedLuma = RGBToPerceivedLuma(fRgb);
ComputeLumaStabilityFactor(iPxLrPos, fPerceivedLuma);
//compute luma used to lock pixels, if used elsewhere the ffxPow must be moved!
fYCoCg.w = ffxPow(fPerceivedLuma, FfxFloat32(1.0 / 6.0));
StorePreparedInputColor(iPxLrPos, fYCoCg);
ClearResourcesForNextFrame(iPxLrPos);
}
#endif // FFX_FSR2_PREPARE_INPUT_COLOR_H

View File

@ -1,62 +0,0 @@
// This file is part of the FidelityFX SDK.
//
// Copyright (c) 2022 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.
// FSR2 pass 1
// SRV 1 : m_HDR : r_input_color_jittered
// SRV 4 : FSR2_Exposure : r_exposure
// UAV 7 : FSR2_ReconstructedPrevNearestDepth : rw_reconstructed_previous_nearest_depth
// UAV 13 : FSR2_PreparedInputColor : rw_prepared_input_color
// UAV 14 : FSR2_LumaHistory : rw_luma_history
// CB 0 : cbFSR2
#version 450
#extension GL_GOOGLE_include_directive : require
#extension GL_EXT_samplerless_texture_functions : require
#define FSR2_BIND_SRV_INPUT_COLOR 0
#define FSR2_BIND_SRV_EXPOSURE 1
#define FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH 2
#define FSR2_BIND_UAV_PREPARED_INPUT_COLOR 3
#define FSR2_BIND_UAV_LUMA_HISTORY 4
#define FSR2_BIND_CB_FSR2 5
#include "ffx_fsr2_callbacks_glsl.h"
#include "ffx_fsr2_common.h"
#include "ffx_fsr2_prepare_input_color.h"
#ifndef FFX_FSR2_THREAD_GROUP_WIDTH
#define FFX_FSR2_THREAD_GROUP_WIDTH 8
#endif // #ifndef FFX_FSR2_THREAD_GROUP_WIDTH
#ifndef FFX_FSR2_THREAD_GROUP_HEIGHT
#define FFX_FSR2_THREAD_GROUP_HEIGHT 8
#endif // #ifndef FFX_FSR2_THREAD_GROUP_HEIGHT
#ifndef FFX_FSR2_THREAD_GROUP_DEPTH
#define FFX_FSR2_THREAD_GROUP_DEPTH 1
#endif // #ifndef FFX_FSR2_THREAD_GROUP_DEPTH
#ifndef FFX_FSR2_NUM_THREADS
#define FFX_FSR2_NUM_THREADS layout (local_size_x = FFX_FSR2_THREAD_GROUP_WIDTH, local_size_y = FFX_FSR2_THREAD_GROUP_HEIGHT, local_size_z = FFX_FSR2_THREAD_GROUP_DEPTH) in;
#endif // #ifndef FFX_FSR2_NUM_THREADS
FFX_FSR2_NUM_THREADS
void main()
{
PrepareInputColor(ivec2(gl_GlobalInvocationID.xy));
}

View File

@ -1,64 +0,0 @@
// This file is part of the FidelityFX SDK.
//
// Copyright (c) 2022 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.
// FSR2 pass 1
// SRV 1 : m_HDR : r_input_color_jittered
// SRV 4 : FSR2_Exposure : r_exposure
// UAV 7 : FSR2_ReconstructedPrevNearestDepth : rw_reconstructed_previous_nearest_depth
// UAV 13 : FSR2_PreparedInputColor : rw_prepared_input_color
// UAV 14 : FSR2_LumaHistory : rw_luma_history
// CB 0 : cbFSR2
#define FSR2_BIND_SRV_INPUT_COLOR 0
#define FSR2_BIND_SRV_EXPOSURE 1
#define FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH 0
#define FSR2_BIND_UAV_PREPARED_INPUT_COLOR 1
#define FSR2_BIND_UAV_LUMA_HISTORY 2
#define FSR2_BIND_CB_FSR2 0
#include "ffx_fsr2_callbacks_hlsl.h"
#include "ffx_fsr2_common.h"
#include "ffx_fsr2_prepare_input_color.h"
#ifndef FFX_FSR2_THREAD_GROUP_WIDTH
#define FFX_FSR2_THREAD_GROUP_WIDTH 8
#endif // #ifndef FFX_FSR2_THREAD_GROUP_WIDTH
#ifndef FFX_FSR2_THREAD_GROUP_HEIGHT
#define FFX_FSR2_THREAD_GROUP_HEIGHT 8
#endif // #ifndef FFX_FSR2_THREAD_GROUP_HEIGHT
#ifndef FFX_FSR2_THREAD_GROUP_DEPTH
#define FFX_FSR2_THREAD_GROUP_DEPTH 1
#endif // #ifndef FFX_FSR2_THREAD_GROUP_DEPTH
#ifndef FFX_FSR2_NUM_THREADS
#define FFX_FSR2_NUM_THREADS [numthreads(FFX_FSR2_THREAD_GROUP_WIDTH, FFX_FSR2_THREAD_GROUP_HEIGHT, FFX_FSR2_THREAD_GROUP_DEPTH)]
#endif // #ifndef FFX_FSR2_NUM_THREADS
FFX_FSR2_NUM_THREADS
FFX_FSR2_EMBED_ROOTSIG_CONTENT
void CS(
uint2 uGroupId : SV_GroupID,
uint2 uDispatchThreadId : SV_DispatchThreadID,
uint2 uGroupThreadId : SV_GroupThreadID,
uint uGroupIndex : SV_GroupIndex
)
{
PrepareInputColor(uDispatchThreadId);
}