Skip to content

Commit

Permalink
minor fixes for #60
Browse files Browse the repository at this point in the history
  • Loading branch information
NicSavichev committed May 21, 2024
1 parent 1f7145c commit 6221a23
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion prog/3rdPartyLibs/SnapdragonSuperResolution/LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

SPDX-License-Identifier: BSD-3-Clause
SPDX-License-Identifier: BSD-3-Clause
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Snapdragon™ GSR
//
// Developed by Snapdragon Studios™ (https://www.qualcomm.com/snapdragon-studios)
//
//
//============================================================================================================
#pragma once
#include <shaders/dag_postFxRenderer.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Snapdragon™ GSR
//
// Developed by Snapdragon Studios™ (https://www.qualcomm.com/snapdragon-studios)
//
//
//============================================================================================================
//============================================================================================================
//
Expand Down Expand Up @@ -143,15 +143,15 @@ shader SnapdragonSuperResolution
xCenter = abs(uv.x+-0.5);
float yCenter;
yCenter = abs(uv.y+-0.5);

if ( mode!=4)
{
float2 imgCoord = ((uv.xy*con1.zw)+ float2(-0.5,0.5));
float2 imgCoordPixel = floor(imgCoord);
float2 coord = (imgCoordPixel*con1.xy);
half2 pl = (imgCoord+(-imgCoordPixel));
half4 left = SGSRH(coord, mode);

half edgeVote = abs(left.z - left.y) + abs(pix[mode] - left.y) + abs(pix[mode] - left.z) ;
if(edgeVote > edgeThreshold)
{
Expand All @@ -170,11 +170,11 @@ shader SnapdragonSuperResolution

half sum = (((((abs(left.x)+abs(left.y))+abs(left.z))+abs(left.w))+(((abs(right.x)+abs(right.y))+abs(right.z))+abs(right.w)))+(((abs(upDown.x)+abs(upDown.y))+abs(upDown.z))+abs(upDown.w)));
half std = half(2.181818)/sum;

half2 aWY = weightY(pl.x, pl.y+1.0, upDown.x,std);
aWY += weightY(pl.x-1.0, pl.y+1.0, upDown.y,std);
aWY += weightY(pl.x-1.0, pl.y-2.0, upDown.z,std);
aWY += weightY(pl.x, pl.y-2.0, upDown.w,std);
aWY += weightY(pl.x, pl.y-2.0, upDown.w,std);
aWY += weightY(pl.x+1.0, pl.y-1.0, left.x,std);
aWY += weightY(pl.x, pl.y-1.0, left.y,std);
aWY += weightY(pl.x, pl.y, left.z,std);
Expand All @@ -189,7 +189,7 @@ shader SnapdragonSuperResolution
half max4 = max(max(left.y,left.z),max(right.x,right.w));
half min4 = min(min(left.y,left.z),min(right.x,right.w));
finalY = clamp(edgeSharpness*finalY, min4, max4);

half deltaY = finalY -pix.w;

pix.x = saturate((pix.x+deltaY));
Expand All @@ -202,9 +202,9 @@ shader SnapdragonSuperResolution
}

// =====================================================================================
//
//
// SNAPDRAGON GAME SUPER RESOLUTION
//
//
// =====================================================================================
half4 SnapdragonSuperResolution_ps(VsOutput input) : SV_Target0
{
Expand All @@ -218,4 +218,3 @@ shader SnapdragonSuperResolution
compile("target_vs", "SnapdragonSuperResolution_vs");

}

10 changes: 4 additions & 6 deletions samples/testGI/prog/test_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ class DemoGameScene : public DagorGameScene, public IRenderDynamicCubeFace2, pub
set_shader_global_time(realTime);
static int taaFrame = 0;
bool renderTaa = taa.get() || enable_taa_override;
logwarn("[hmatthew] renderTaa = %s", renderTaa ? "TRUE" : "FALSE");
// logwarn("[hmatthew] renderTaa = %s", renderTaa ? "TRUE" : "FALSE");

Driver3dPerspective p;
d3d::getpersp(p);
Expand Down Expand Up @@ -2379,16 +2379,14 @@ void game_demo_init()
const DataBlock &blk = *dgs_get_settings();
::set_gameres_sys_ver(2);

DataBlock* global_settings_blk = new DataBlock;
global_settings_blk->load("settings.blk");
enable_taa_override = global_settings_blk->getBlockByNameEx("render")->getBool("taa", false);
enable_taa_override = dgs_get_settings()->getBlockByNameEx("render")->getBool("taa", false);

auto sgsrBlock = global_settings_blk->getBlockByNameEx("SnapdragonSuperResolution");
if (sgsrBlock)
if (auto *sgsrBlock = dgs_get_settings()->getBlockByName("SnapdragonSuperResolution"))
{
use_snapdragon_super_resolution = sgsrBlock->getBool("enable", false);
snapdragon_super_resolution_scale = ((float)sgsrBlock->getInt("scale", 75) / 100.f);
}
debug("[hmatthew] enable_taa_override=%d use_snapdragon_super_resolution=%d", enable_taa_override, use_snapdragon_super_resolution);

#define LOAD_RES_PATCH(LOC_NAME) \
if (dd_file_exists("content/patch/" LOC_NAME "/grp_hdr.vromfs.bin") && \
Expand Down

0 comments on commit 6221a23

Please sign in to comment.