Browse Source

Use a constant to determine the highest mip level that SPD can use on OpenGL Core, and ensure storing the pyramid values use the correct mip level

fsr3.1.1
Nico de Poel 1 year ago
parent
commit
b014f056ed
  1. 10
      Shaders/shaders/fsr3upscaler/ffx_fsr3upscaler_luma_pyramid.h
  2. 12
      Shaders/shaders/fsr3upscaler/ffx_fsr3upscaler_shading_change_pyramid.h

10
Shaders/shaders/fsr3upscaler/ffx_fsr3upscaler_luma_pyramid.h

@ -47,6 +47,12 @@ FFX_STATIC const FfxInt32 LOG_LUMA = 0;
FFX_STATIC const FfxInt32 LUMA = 1;
FFX_STATIC const FfxInt32 DEPTH_IN_METERS = 2;
#ifdef SHADER_API_GLCORE
FFX_STATIC const FfxInt32 MAX_MIP = 4;
#else
FFX_STATIC const FfxInt32 MAX_MIP = 5;
#endif
FfxFloat32x4 SpdLoadSourceImage(FfxFloat32x2 iPxPos, FfxUInt32 slice)
{
//We assume linear data. if non-linear input (sRGB, ...),
@ -67,7 +73,7 @@ FfxFloat32x4 SpdLoadSourceImage(FfxFloat32x2 iPxPos, FfxUInt32 slice)
FfxFloat32x4 SpdLoad(FfxInt32x2 tex, FfxUInt32 slice)
{
return FfxFloat32x4(RWLoadPyramid(tex, 5), 0, 0);
return FfxFloat32x4(RWLoadPyramid(tex, MAX_MIP), 0, 0);
}
FfxFloat32x4 SpdReduce4(FfxFloat32x4 v0, FfxFloat32x4 v1, FfxFloat32x4 v2, FfxFloat32x4 v3)
@ -77,7 +83,7 @@ FfxFloat32x4 SpdReduce4(FfxFloat32x4 v0, FfxFloat32x4 v1, FfxFloat32x4 v2, FfxFl
void SpdStore(FfxInt32x2 pix, FfxFloat32x4 outValue, FfxUInt32 index, FfxUInt32 slice)
{
if (index == 5)
if (index == MAX_MIP)
{
StorePyramid(pix, outValue.xy, index);
}

12
Shaders/shaders/fsr3upscaler/ffx_fsr3upscaler_shading_change_pyramid.h

@ -47,6 +47,12 @@ FFX_STATIC const FfxInt32 DIFFERENCE = 0;
FFX_STATIC const FfxInt32 SIGN_SUM = 1;
FFX_STATIC const FfxInt32 MIP0_INDICATOR = 2;
#ifdef SHADER_API_GLCORE
FFX_STATIC const FfxInt32 MAX_MIP = 4;
#else
FFX_STATIC const FfxInt32 MAX_MIP = 5;
#endif
FfxFloat32x2 Sort2(FfxFloat32x2 v)
{
return FfxFloat32x2(ffxMin(v.x, v.y), ffxMax(v.x, v.y));
@ -200,11 +206,7 @@ FfxFloat32x4 SpdLoadSourceImage(FfxFloat32x2 iPxPos, FfxUInt32 slice)
FfxFloat32x4 SpdLoad(FfxInt32x2 tex, FfxUInt32 slice)
{
#ifdef SHADER_API_GLCORE
return FfxFloat32x4(RWLoadPyramid(tex, 4), 0, 0);
#else
return FfxFloat32x4(RWLoadPyramid(tex, 5), 0, 0);
#endif
return FfxFloat32x4(RWLoadPyramid(tex, MAX_MIP), 0, 0);
}
FfxFloat32x4 SpdReduce4(FfxFloat32x4 v0, FfxFloat32x4 v1, FfxFloat32x4 v2, FfxFloat32x4 v3)

Loading…
Cancel
Save