From b694b8a192f18fe3564f0e2821322b3c041819d7 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 18 Feb 2022 11:51:48 -0700 Subject: [PATCH] Semantic changes --- shaders/cBloom.fx | 108 +++++++++++----------- shaders/cBlur.fx | 10 +- shaders/cDualFilter.fx | 8 +- shaders/cHornSchunck.fx | 124 ++++++++++++------------- shaders/cInterpolation.fx | 104 ++++++++++----------- shaders/cMotionBlur.fx | 186 +++++++++++++++++++------------------- shaders/cOpticalFlow.fx | 178 ++++++++++++++++++------------------ 7 files changed, 359 insertions(+), 359 deletions(-) diff --git a/shaders/cBloom.fx b/shaders/cBloom.fx index 207d527..779f2cc 100644 --- a/shaders/cBloom.fx +++ b/shaders/cBloom.fx @@ -46,7 +46,7 @@ namespace SharedResources { namespace RGBA16F { - texture2D _RenderTemporary1 < pooled = true; > + texture2D _RenderCommon1 < pooled = true; > { Width = BUFFER_SIZE_1.x; Height = BUFFER_SIZE_1.y; @@ -54,49 +54,49 @@ namespace SharedResources MipLevels = 8; }; - texture2D _RenderTemporary2 < pooled = true; > + texture2D _RenderCommon2 < pooled = true; > { Width = BUFFER_SIZE_2.x; Height = BUFFER_SIZE_2.y; Format = RGBA16F; }; - texture2D _RenderTemporary3 < pooled = true; > + texture2D _RenderCommon3 < pooled = true; > { Width = BUFFER_SIZE_3.x; Height = BUFFER_SIZE_3.y; Format = RGBA16F; }; - texture2D _RenderTemporary4 < pooled = true; > + texture2D _RenderCommon4 < pooled = true; > { Width = BUFFER_SIZE_4.x; Height = BUFFER_SIZE_4.y; Format = RGBA16F; }; - texture2D _RenderTemporary5 < pooled = true; > + texture2D _RenderCommon5 < pooled = true; > { Width = BUFFER_SIZE_5.x; Height = BUFFER_SIZE_5.y; Format = RGBA16F; }; - texture2D _RenderTemporary6 < pooled = true; > + texture2D _RenderCommon6 < pooled = true; > { Width = BUFFER_SIZE_6.x; Height = BUFFER_SIZE_6.y; Format = RGBA16F; }; - texture2D _RenderTemporary7 < pooled = true; > + texture2D _RenderCommon7 < pooled = true; > { Width = BUFFER_SIZE_7.x; Height = BUFFER_SIZE_7.y; Format = RGBA16F; }; - texture2D _RenderTemporary8 < pooled = true; > + texture2D _RenderCommon8 < pooled = true; > { Width = BUFFER_SIZE_8.x; Height = BUFFER_SIZE_8.y; @@ -191,65 +191,65 @@ sampler2D _SampleColor #endif }; -sampler2D _SampleTemporary_RGBA16F_1 +sampler2D _SampleCommon_RGBA16F_1 { - Texture = SharedResources::RGBA16F::_RenderTemporary1; + Texture = SharedResources::RGBA16F::_RenderCommon1; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; -sampler2D _SampleTemporary_RGBA16F_2 +sampler2D _SampleCommon_RGBA16F_2 { - Texture = SharedResources::RGBA16F::_RenderTemporary2; + Texture = SharedResources::RGBA16F::_RenderCommon2; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; -sampler2D _SampleTemporary_RGBA16F_3 +sampler2D _SampleCommon_RGBA16F_3 { - Texture = SharedResources::RGBA16F::_RenderTemporary3; + Texture = SharedResources::RGBA16F::_RenderCommon3; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; -sampler2D _SampleTemporary_RGBA16F_4 +sampler2D _SampleCommon_RGBA16F_4 { - Texture = SharedResources::RGBA16F::_RenderTemporary4; + Texture = SharedResources::RGBA16F::_RenderCommon4; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; -sampler2D _SampleTemporary_RGBA16F_5 +sampler2D _SampleCommon_RGBA16F_5 { - Texture = SharedResources::RGBA16F::_RenderTemporary5; + Texture = SharedResources::RGBA16F::_RenderCommon5; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; -sampler2D _SampleTemporary_RGBA16F_6 +sampler2D _SampleCommon_RGBA16F_6 { - Texture = SharedResources::RGBA16F::_RenderTemporary6; + Texture = SharedResources::RGBA16F::_RenderCommon6; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; -sampler2D _SampleTemporary_RGBA16F_7 +sampler2D _SampleCommon_RGBA16F_7 { - Texture = SharedResources::RGBA16F::_RenderTemporary7; + Texture = SharedResources::RGBA16F::_RenderCommon7; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; -sampler2D _SampleTemporary_RGBA16F_8 +sampler2D _SampleCommon_RGBA16F_8 { - Texture = SharedResources::RGBA16F::_RenderTemporary8; + Texture = SharedResources::RGBA16F::_RenderCommon8; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; @@ -471,77 +471,77 @@ float3 RRTAndODTFit(float3 v) void DownsamplePS1(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - Downsample(_SampleTemporary_RGBA16F_1, TexCoord, OutputColor0); + Downsample(_SampleCommon_RGBA16F_1, TexCoord, OutputColor0); } void DownsamplePS2(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - Downsample(_SampleTemporary_RGBA16F_2, TexCoord, OutputColor0); + Downsample(_SampleCommon_RGBA16F_2, TexCoord, OutputColor0); } void DownsamplePS3(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - Downsample(_SampleTemporary_RGBA16F_3, TexCoord, OutputColor0); + Downsample(_SampleCommon_RGBA16F_3, TexCoord, OutputColor0); } void DownsamplePS4(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - Downsample(_SampleTemporary_RGBA16F_4, TexCoord, OutputColor0); + Downsample(_SampleCommon_RGBA16F_4, TexCoord, OutputColor0); } void DownsamplePS5(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - Downsample(_SampleTemporary_RGBA16F_5, TexCoord, OutputColor0); + Downsample(_SampleCommon_RGBA16F_5, TexCoord, OutputColor0); } void DownsamplePS6(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - Downsample(_SampleTemporary_RGBA16F_6, TexCoord, OutputColor0); + Downsample(_SampleCommon_RGBA16F_6, TexCoord, OutputColor0); } void DownsamplePS7(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - Downsample(_SampleTemporary_RGBA16F_7, TexCoord, OutputColor0); + Downsample(_SampleCommon_RGBA16F_7, TexCoord, OutputColor0); } void UpsamplePS7(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - Upsample(_SampleTemporary_RGBA16F_8, TexCoord, _Level6Weight, OutputColor0); + Upsample(_SampleCommon_RGBA16F_8, TexCoord, _Level6Weight, OutputColor0); } void UpsamplePS6(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - Upsample(_SampleTemporary_RGBA16F_7, TexCoord, _Level5Weight, OutputColor0); + Upsample(_SampleCommon_RGBA16F_7, TexCoord, _Level5Weight, OutputColor0); } void UpsamplePS5(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - Upsample(_SampleTemporary_RGBA16F_6, TexCoord, _Level4Weight, OutputColor0); + Upsample(_SampleCommon_RGBA16F_6, TexCoord, _Level4Weight, OutputColor0); } void UpsamplePS4(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - Upsample(_SampleTemporary_RGBA16F_5, TexCoord, _Level3Weight, OutputColor0); + Upsample(_SampleCommon_RGBA16F_5, TexCoord, _Level3Weight, OutputColor0); } void UpsamplePS3(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - Upsample(_SampleTemporary_RGBA16F_4, TexCoord, _Level2Weight, OutputColor0); + Upsample(_SampleCommon_RGBA16F_4, TexCoord, _Level2Weight, OutputColor0); } void UpsamplePS2(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - Upsample(_SampleTemporary_RGBA16F_3, TexCoord, _Level1Weight, OutputColor0); + Upsample(_SampleCommon_RGBA16F_3, TexCoord, _Level1Weight, OutputColor0); } void UpsamplePS1(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - Upsample(_SampleTemporary_RGBA16F_2, TexCoord, 0.0, OutputColor0); + Upsample(_SampleCommon_RGBA16F_2, TexCoord, 0.0, OutputColor0); } void CompositePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - float4 Src = tex2D(_SampleTemporary_RGBA16F_1, TexCoord); + float4 Src = tex2D(_SampleCommon_RGBA16F_1, TexCoord); Src *= _Intensity; Src = mul(ACESInputMat, Src.rgb); Src = RRTAndODTFit(Src.rgb); @@ -557,63 +557,63 @@ technique cBloom { VertexShader = PostProcessVS; PixelShader = PrefilterPS; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary1; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon1; } pass { VertexShader = DownsampleVS1; PixelShader = DownsamplePS1; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary2; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon2; } pass { VertexShader = DownsampleVS2; PixelShader = DownsamplePS2; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary3; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon3; } pass { VertexShader = DownsampleVS3; PixelShader = DownsamplePS3; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary4; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon4; } pass { VertexShader = DownsampleVS4; PixelShader = DownsamplePS4; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary5; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon5; } pass { VertexShader = DownsampleVS5; PixelShader = DownsamplePS5; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary6; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon6; } pass { VertexShader = DownsampleVS6; PixelShader = DownsamplePS6; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary7; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon7; } pass { VertexShader = DownsampleVS7; PixelShader = DownsamplePS7; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary8; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon8; } pass { VertexShader = UpsampleVS7; PixelShader = UpsamplePS7; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary7; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon7; ClearRenderTargets = FALSE; BlendEnable = TRUE; BlendOp = ADD; @@ -625,7 +625,7 @@ technique cBloom { VertexShader = UpsampleVS6; PixelShader = UpsamplePS6; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary6; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon6; ClearRenderTargets = FALSE; BlendEnable = TRUE; BlendOp = ADD; @@ -637,7 +637,7 @@ technique cBloom { VertexShader = UpsampleVS5; PixelShader = UpsamplePS5; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary5; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon5; ClearRenderTargets = FALSE; BlendEnable = TRUE; BlendOp = ADD; @@ -649,7 +649,7 @@ technique cBloom { VertexShader = UpsampleVS4; PixelShader = UpsamplePS4; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary4; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon4; ClearRenderTargets = FALSE; BlendEnable = TRUE; BlendOp = ADD; @@ -661,7 +661,7 @@ technique cBloom { VertexShader = UpsampleVS3; PixelShader = UpsamplePS3; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary3; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon3; ClearRenderTargets = FALSE; BlendEnable = TRUE; BlendOp = ADD; @@ -673,7 +673,7 @@ technique cBloom { VertexShader = UpsampleVS2; PixelShader = UpsamplePS2; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary2; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon2; ClearRenderTargets = FALSE; BlendEnable = TRUE; BlendOp = ADD; @@ -685,7 +685,7 @@ technique cBloom { VertexShader = UpsampleVS1; PixelShader = UpsamplePS1; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary1; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon1; } pass diff --git a/shaders/cBlur.fx b/shaders/cBlur.fx index 30998e0..3f138a0 100644 --- a/shaders/cBlur.fx +++ b/shaders/cBlur.fx @@ -37,7 +37,7 @@ namespace SharedResources { namespace RGBA8 { - texture2D _RenderTemporary1 < pooled = true; > + texture2D _RenderCommon1 < pooled = true; > { Width = BUFFER_WIDTH >> 1; Height = BUFFER_HEIGHT >> 1; @@ -78,9 +78,9 @@ sampler2D _SampleColor #endif }; -sampler2D _SampleTemporary_RGBA8_1 +sampler2D _SampleCommon_RGBA8_1 { - Texture = SharedResources::RGBA8::_RenderTemporary1; + Texture = SharedResources::RGBA8::_RenderCommon1; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; @@ -143,7 +143,7 @@ void BlitPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, ou void VogelConvolutionPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - VogelBlur(_SampleTemporary_RGBA8_1, TexCoord, uint2(BUFFER_WIDTH / 2, BUFFER_HEIGHT / 2), _Radius, _Samples, _Offset, OutputColor0); + VogelBlur(_SampleCommon_RGBA8_1, TexCoord, uint2(BUFFER_WIDTH / 2, BUFFER_HEIGHT / 2), _Radius, _Samples, _Offset, OutputColor0); } technique cBlur @@ -152,7 +152,7 @@ technique cBlur { VertexShader = PostProcessVS; PixelShader = BlitPS; - RenderTarget0 = SharedResources::RGBA8::_RenderTemporary1; + RenderTarget0 = SharedResources::RGBA8::_RenderCommon1; #if BUFFER_COLOR_BIT_DEPTH == 8 SRGBWriteEnable = TRUE; #endif diff --git a/shaders/cDualFilter.fx b/shaders/cDualFilter.fx index 5120592..dc20fce 100644 --- a/shaders/cDualFilter.fx +++ b/shaders/cDualFilter.fx @@ -42,7 +42,7 @@ namespace SharedResources { namespace RGBA16F { - texture2D _RenderTemporary1 < pooled = true; > + texture2D _RenderCommon1 < pooled = true; > { Width = BUFFER_SIZE_1.x; Height = BUFFER_SIZE_1.y; @@ -50,21 +50,21 @@ namespace SharedResources MipLevels = 8; }; - texture2D _RenderTemporary2 < pooled = true; > + texture2D _RenderCommon2 < pooled = true; > { Width = BUFFER_SIZE_2.x; Height = BUFFER_SIZE_2.y; Format = RGBA16F; }; - texture2D _RenderTemporary3 < pooled = true; > + texture2D _RenderCommon3 < pooled = true; > { Width = BUFFER_SIZE_3.x; Height = BUFFER_SIZE_3.y; Format = RGBA16F; }; - texture2D _RenderTemporary4 < pooled = true; > + texture2D _RenderCommon4 < pooled = true; > { Width = BUFFER_SIZE_4.x; Height = BUFFER_SIZE_4.y; diff --git a/shaders/cHornSchunck.fx b/shaders/cHornSchunck.fx index fca21a5..9f4e317 100644 --- a/shaders/cHornSchunck.fx +++ b/shaders/cHornSchunck.fx @@ -86,7 +86,7 @@ namespace HornSchunck #endif }; - texture2D _RenderTemporary1a < pooled = true; > + texture2D _RenderCommon1a < pooled = true; > { Width = SCREEN_SIZE.x / 2; Height = SCREEN_SIZE.y / 2; @@ -94,15 +94,15 @@ namespace HornSchunck MipLevels = 8; }; - sampler2D _SampleTemporary1a + sampler2D _SampleCommon1a { - Texture = _RenderTemporary1a; + Texture = _RenderCommon1a; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary1b < pooled = true; > + texture2D _RenderCommon1b < pooled = true; > { Width = SCREEN_SIZE.x / 2; Height = SCREEN_SIZE.y / 2; @@ -110,15 +110,15 @@ namespace HornSchunck MipLevels = 8; }; - sampler2D _SampleTemporary1b + sampler2D _SampleCommon1b { - Texture = _RenderTemporary1b; + Texture = _RenderCommon1b; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary1d < pooled = false; > + texture2D _RenderCommon1d < pooled = false; > { Width = SCREEN_SIZE.x / 2; Height = SCREEN_SIZE.y / 2; @@ -126,129 +126,129 @@ namespace HornSchunck MipLevels = 8; }; - sampler2D _SampleTemporary1d + sampler2D _SampleCommon1d { - Texture = _RenderTemporary1d; + Texture = _RenderCommon1d; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary8 < pooled = true; > + texture2D _RenderCommon8 < pooled = true; > { Width = SCREEN_SIZE.x / 256; Height = SCREEN_SIZE.y / 256; Format = RG16F; }; - sampler2D _SampleTemporary8 + sampler2D _SampleCommon8 { - Texture = _RenderTemporary8; + Texture = _RenderCommon8; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary7 < pooled = true; > + texture2D _RenderCommon7 < pooled = true; > { Width = SCREEN_SIZE.x / 128; Height = SCREEN_SIZE.y / 128; Format = RG16F; }; - sampler2D _SampleTemporary7 + sampler2D _SampleCommon7 { - Texture = _RenderTemporary7; + Texture = _RenderCommon7; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary6 < pooled = true; > + texture2D _RenderCommon6 < pooled = true; > { Width = SCREEN_SIZE.x / 64; Height = SCREEN_SIZE.y / 64; Format = RG16F; }; - sampler2D _SampleTemporary6 + sampler2D _SampleCommon6 { - Texture = _RenderTemporary6; + Texture = _RenderCommon6; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary5 < pooled = true; > + texture2D _RenderCommon5 < pooled = true; > { Width = SCREEN_SIZE.x / 32; Height = SCREEN_SIZE.y / 32; Format = RG16F; }; - sampler2D _SampleTemporary5 + sampler2D _SampleCommon5 { - Texture = _RenderTemporary5; + Texture = _RenderCommon5; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary4 < pooled = true; > + texture2D _RenderCommon4 < pooled = true; > { Width = SCREEN_SIZE.x / 16; Height = SCREEN_SIZE.y / 16; Format = RG16F; }; - sampler2D _SampleTemporary4 + sampler2D _SampleCommon4 { - Texture = _RenderTemporary4; + Texture = _RenderCommon4; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary3 < pooled = true; > + texture2D _RenderCommon3 < pooled = true; > { Width = SCREEN_SIZE.x / 8; Height = SCREEN_SIZE.y / 8; Format = RG16F; }; - sampler2D _SampleTemporary3 + sampler2D _SampleCommon3 { - Texture = _RenderTemporary3; + Texture = _RenderCommon3; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary2 < pooled = true; > + texture2D _RenderCommon2 < pooled = true; > { Width = SCREEN_SIZE.x / 4; Height = SCREEN_SIZE.y / 4; Format = RG16F; }; - sampler2D _SampleTemporary2 + sampler2D _SampleCommon2 { - Texture = _RenderTemporary2; + Texture = _RenderCommon2; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary1c + texture2D _RenderCommon1c { Width = SCREEN_SIZE.x / 2; Height = SCREEN_SIZE.y / 2; Format = RG16F; }; - sampler2D _SampleTemporary1c + sampler2D _SampleCommon1c { - Texture = _RenderTemporary1c; + Texture = _RenderCommon1c; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; @@ -298,11 +298,11 @@ namespace HornSchunck void OpticalFlow(in float2 TexCoord, in float2 UV, in float Level, out float2 DUV) { const float Alpha = max(ldexp(_Constraint * 1e-5, Level - MaxLevel), 1e-7); - float2 CurrentFrame = tex2D(_SampleTemporary1a, TexCoord).xy; - float2 PreviousFrame = tex2D(_SampleTemporary1d, TexCoord).xy; + float2 CurrentFrame = tex2D(_SampleCommon1a, TexCoord).xy; + float2 PreviousFrame = tex2D(_SampleCommon1d, TexCoord).xy; // SpatialI = - float4 SpatialI = tex2D(_SampleTemporary1b, TexCoord); + float4 SpatialI = tex2D(_SampleCommon1b, TexCoord); float2 TemporalI = CurrentFrame - PreviousFrame; /* @@ -356,17 +356,17 @@ namespace HornSchunck void DerivativesZPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { - float2 CurrentFrame = tex2D(_SampleTemporary1a, TexCoord).xy; - float2 PreviousFrame = tex2D(_SampleTemporary1d, TexCoord).xy; + float2 CurrentFrame = tex2D(_SampleCommon1a, TexCoord).xy; + float2 PreviousFrame = tex2D(_SampleCommon1d, TexCoord).xy; OutputColor0 = CurrentFrame - PreviousFrame; } void DerivativesXYPS(in float4 Position : SV_Position, in float4 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - float2 Sample0 = tex2D(_SampleTemporary1a, TexCoord.zy).xy; // (-x, +y) - float2 Sample1 = tex2D(_SampleTemporary1a, TexCoord.xy).xy; // (+x, +y) - float2 Sample2 = tex2D(_SampleTemporary1a, TexCoord.zw).xy; // (-x, -y) - float2 Sample3 = tex2D(_SampleTemporary1a, TexCoord.xw).xy; // (+x, -y) + float2 Sample0 = tex2D(_SampleCommon1a, TexCoord.zy).xy; // (-x, +y) + float2 Sample1 = tex2D(_SampleCommon1a, TexCoord.xy).xy; // (+x, +y) + float2 Sample2 = tex2D(_SampleCommon1a, TexCoord.zw).xy; // (-x, -y) + float2 Sample3 = tex2D(_SampleCommon1a, TexCoord.xw).xy; // (+x, -y) OutputColor0.xy = ((Sample3 + Sample1) - (Sample2 + Sample0)); OutputColor0.zw = ((Sample2 + Sample3) - (Sample0 + Sample1)); OutputColor0 = OutputColor0 * 4.0; @@ -379,47 +379,47 @@ namespace HornSchunck void EstimateLevel7PS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputEstimation : SV_Target0) { - OpticalFlow(TexCoord, tex2D(_SampleTemporary8, TexCoord).xy, 6.0, OutputEstimation); + OpticalFlow(TexCoord, tex2D(_SampleCommon8, TexCoord).xy, 6.0, OutputEstimation); } void EstimateLevel6PS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputEstimation : SV_Target0) { - OpticalFlow(TexCoord, tex2D(_SampleTemporary7, TexCoord).xy, 5.0, OutputEstimation); + OpticalFlow(TexCoord, tex2D(_SampleCommon7, TexCoord).xy, 5.0, OutputEstimation); } void EstimateLevel5PS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputEstimation : SV_Target0) { - OpticalFlow(TexCoord, tex2D(_SampleTemporary6, TexCoord).xy, 4.0, OutputEstimation); + OpticalFlow(TexCoord, tex2D(_SampleCommon6, TexCoord).xy, 4.0, OutputEstimation); } void EstimateLevel4PS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputEstimation : SV_Target0) { - OpticalFlow(TexCoord, tex2D(_SampleTemporary5, TexCoord).xy, 3.0, OutputEstimation); + OpticalFlow(TexCoord, tex2D(_SampleCommon5, TexCoord).xy, 3.0, OutputEstimation); } void EstimateLevel3PS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputEstimation : SV_Target0) { - OpticalFlow(TexCoord, tex2D(_SampleTemporary4, TexCoord).xy, 2.0, OutputEstimation); + OpticalFlow(TexCoord, tex2D(_SampleCommon4, TexCoord).xy, 2.0, OutputEstimation); } void EstimateLevel2PS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputEstimation : SV_Target0) { - OpticalFlow(TexCoord, tex2D(_SampleTemporary3, TexCoord).xy, 1.0, OutputEstimation); + OpticalFlow(TexCoord, tex2D(_SampleCommon3, TexCoord).xy, 1.0, OutputEstimation); } void EstimateLevel1PS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0, out float4 OutputColor1 : SV_Target1) { - OpticalFlow(TexCoord, tex2D(_SampleTemporary2, TexCoord).xy, 0.0, OutputColor0.xy); + OpticalFlow(TexCoord, tex2D(_SampleCommon2, TexCoord).xy, 0.0, OutputColor0.xy); OutputColor0.ba = (0.0, _Blend); // Copy current convolved result to use at next frame - OutputColor1 = tex2D(_SampleTemporary1a, TexCoord).rg; + OutputColor1 = tex2D(_SampleCommon1a, TexCoord).rg; OutputColor1.ba = 0.0; } void VelocityShadingPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target) { - float2 Velocity = tex2Dlod(_SampleTemporary1c, float4(TexCoord, 0.0, _MipBias)).xy; + float2 Velocity = tex2Dlod(_SampleCommon1c, float4(TexCoord, 0.0, _MipBias)).xy; if(_NormalizedShading) { @@ -442,7 +442,7 @@ namespace HornSchunck { VertexShader = PostProcessVS; PixelShader = NormalizePS; - RenderTarget0 = _RenderTemporary1a; + RenderTarget0 = _RenderCommon1a; } // Construct pyramids @@ -451,7 +451,7 @@ namespace HornSchunck { VertexShader = DerivativesVS; PixelShader = DerivativesXYPS; - RenderTarget0 = _RenderTemporary1b; + RenderTarget0 = _RenderCommon1b; } // Pyramidal estimation @@ -460,59 +460,59 @@ namespace HornSchunck { VertexShader = PostProcessVS; PixelShader = EstimateLevel8PS; - RenderTarget0 = _RenderTemporary8; + RenderTarget0 = _RenderCommon8; } pass { VertexShader = PostProcessVS; PixelShader = EstimateLevel7PS; - RenderTarget0 = _RenderTemporary7; + RenderTarget0 = _RenderCommon7; } pass { VertexShader = PostProcessVS; PixelShader = EstimateLevel6PS; - RenderTarget0 = _RenderTemporary6; + RenderTarget0 = _RenderCommon6; } pass { VertexShader = PostProcessVS; PixelShader = EstimateLevel5PS; - RenderTarget0 = _RenderTemporary5; + RenderTarget0 = _RenderCommon5; } pass { VertexShader = PostProcessVS; PixelShader = EstimateLevel4PS; - RenderTarget0 = _RenderTemporary4; + RenderTarget0 = _RenderCommon4; } pass { VertexShader = PostProcessVS; PixelShader = EstimateLevel3PS; - RenderTarget0 = _RenderTemporary3; + RenderTarget0 = _RenderCommon3; } pass { VertexShader = PostProcessVS; PixelShader = EstimateLevel2PS; - RenderTarget0 = _RenderTemporary2; + RenderTarget0 = _RenderCommon2; } pass { VertexShader = PostProcessVS; PixelShader = EstimateLevel1PS; - RenderTarget0 = _RenderTemporary1c; + RenderTarget0 = _RenderCommon1c; // Copy previous frame - RenderTarget1 = _RenderTemporary1d; + RenderTarget1 = _RenderCommon1d; ClearRenderTargets = FALSE; BlendEnable = TRUE; BlendOp = ADD; diff --git a/shaders/cInterpolation.fx b/shaders/cInterpolation.fx index 7399904..47f69cb 100644 --- a/shaders/cInterpolation.fx +++ b/shaders/cInterpolation.fx @@ -156,121 +156,121 @@ namespace Interpolation MipFilter = LINEAR; }; - texture2D _RenderTemporary7 + texture2D _RenderCommon7 { Width = BUFFER_SIZE.x / 128; Height = BUFFER_SIZE.y / 128; Format = RG16F; }; - sampler2D _SampleTemporary7 + sampler2D _SampleCommon7 { - Texture = _RenderTemporary7; + Texture = _RenderCommon7; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary6 + texture2D _RenderCommon6 { Width = BUFFER_SIZE.x / 64; Height = BUFFER_SIZE.y / 64; Format = RG16F; }; - sampler2D _SampleTemporary6 + sampler2D _SampleCommon6 { - Texture = _RenderTemporary6; + Texture = _RenderCommon6; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary5 + texture2D _RenderCommon5 { Width = BUFFER_SIZE.x / 32; Height = BUFFER_SIZE.y / 32; Format = RG16F; }; - sampler2D _SampleTemporary5 + sampler2D _SampleCommon5 { - Texture = _RenderTemporary5; + Texture = _RenderCommon5; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary4 + texture2D _RenderCommon4 { Width = BUFFER_SIZE.x / 16; Height = BUFFER_SIZE.y / 16; Format = RG16F; }; - sampler2D _SampleTemporary4 + sampler2D _SampleCommon4 { - Texture = _RenderTemporary4; + Texture = _RenderCommon4; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary3 + texture2D _RenderCommon3 { Width = BUFFER_SIZE.x / 8; Height = BUFFER_SIZE.y / 8; Format = RG16F; }; - sampler2D _SampleTemporary3 + sampler2D _SampleCommon3 { - Texture = _RenderTemporary3; + Texture = _RenderCommon3; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary2 + texture2D _RenderCommon2 { Width = BUFFER_SIZE.x / 4; Height = BUFFER_SIZE.y / 4; Format = RG16F; }; - sampler2D _SampleTemporary2 + sampler2D _SampleCommon2 { - Texture = _RenderTemporary2; + Texture = _RenderCommon2; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary1 + texture2D _RenderCommon1 { Width = BUFFER_SIZE.x / 2; Height = BUFFER_SIZE.y / 2; Format = RG16F; }; - sampler2D _SampleTemporary1 + sampler2D _SampleCommon1 { - Texture = _RenderTemporary1; + Texture = _RenderCommon1; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary0 + texture2D _RenderCommon0 { Width = BUFFER_SIZE.x / 1; Height = BUFFER_SIZE.y / 1; Format = RG16F; }; - sampler2D _SampleTemporary0 + sampler2D _SampleCommon0 { - Texture = _RenderTemporary0; + Texture = _RenderCommon0; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; @@ -553,17 +553,17 @@ namespace Interpolation void PreDownsample2PS(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Downsample(_SampleTemporary1, TexCoord); + OutputColor0 = Downsample(_SampleCommon1, TexCoord); } void PreUpsample1PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Upsample(_SampleTemporary2, TexCoord); + OutputColor0 = Upsample(_SampleCommon2, TexCoord); } void PreUpsample0PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Upsample(_SampleTemporary1, TexCoord); + OutputColor0 = Upsample(_SampleCommon1, TexCoord); } void DerivativesPS(in float4 Position : SV_Position, in float4 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) @@ -584,58 +584,58 @@ namespace Interpolation void EstimateLevel6PS(in float4 Position : SV_Position, in float4 UpsampleOffsets[3] : TEXCOORD0, out float2 OutputEstimation : SV_Target0) { - OpticalFlow(UpsampleOffsets[1].xz, Upsample(_SampleTemporary7, UpsampleOffsets).xy, 6.0, OutputEstimation); + OpticalFlow(UpsampleOffsets[1].xz, Upsample(_SampleCommon7, UpsampleOffsets).xy, 6.0, OutputEstimation); } void EstimateLevel5PS(in float4 Position : SV_Position, in float4 UpsampleOffsets[3] : TEXCOORD0, out float2 OutputEstimation : SV_Target0) { - OpticalFlow(UpsampleOffsets[1].xz, Upsample(_SampleTemporary6, UpsampleOffsets).xy, 5.0, OutputEstimation); + OpticalFlow(UpsampleOffsets[1].xz, Upsample(_SampleCommon6, UpsampleOffsets).xy, 5.0, OutputEstimation); } void EstimateLevel4PS(in float4 Position : SV_Position, in float4 UpsampleOffsets[3] : TEXCOORD0, out float2 OutputEstimation : SV_Target0) { - OpticalFlow(UpsampleOffsets[1].xz, Upsample(_SampleTemporary5, UpsampleOffsets).xy, 4.0, OutputEstimation); + OpticalFlow(UpsampleOffsets[1].xz, Upsample(_SampleCommon5, UpsampleOffsets).xy, 4.0, OutputEstimation); } void EstimateLevel3PS(in float4 Position : SV_Position, in float4 UpsampleOffsets[3] : TEXCOORD0, out float2 OutputEstimation : SV_Target0) { - OpticalFlow(UpsampleOffsets[1].xz, Upsample(_SampleTemporary4, UpsampleOffsets).xy, 3.0, OutputEstimation); + OpticalFlow(UpsampleOffsets[1].xz, Upsample(_SampleCommon4, UpsampleOffsets).xy, 3.0, OutputEstimation); } void EstimateLevel2PS(in float4 Position : SV_Position, in float4 UpsampleOffsets[3] : TEXCOORD0, out float2 OutputEstimation : SV_Target0) { - OpticalFlow(UpsampleOffsets[1].xz, Upsample(_SampleTemporary3, UpsampleOffsets).xy, 2.0, OutputEstimation); + OpticalFlow(UpsampleOffsets[1].xz, Upsample(_SampleCommon3, UpsampleOffsets).xy, 2.0, OutputEstimation); } void EstimateLevel1PS(in float4 Position : SV_Position, in float4 UpsampleOffsets[3] : TEXCOORD0, out float2 OutputEstimation : SV_Target0) { - OpticalFlow(UpsampleOffsets[1].xz, Upsample(_SampleTemporary2, UpsampleOffsets).xy, 1.0, OutputEstimation); + OpticalFlow(UpsampleOffsets[1].xz, Upsample(_SampleCommon2, UpsampleOffsets).xy, 1.0, OutputEstimation); } void EstimateLevel0PS(in float4 Position : SV_Position, in float4 UpsampleOffsets[3] : TEXCOORD0, out float4 OutputEstimation : SV_Target0) { - OpticalFlow(UpsampleOffsets[1].xz, Upsample(_SampleTemporary1, UpsampleOffsets).xy, 0.0, OutputEstimation.xy); + OpticalFlow(UpsampleOffsets[1].xz, Upsample(_SampleCommon1, UpsampleOffsets).xy, 0.0, OutputEstimation.xy); OutputEstimation.ba = (0.0, _Blend); } void PostDownsample1PS(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Downsample(_SampleTemporary0, TexCoord); + OutputColor0 = Downsample(_SampleCommon0, TexCoord); } void PostDownsample2PS(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Downsample(_SampleTemporary1, TexCoord); + OutputColor0 = Downsample(_SampleCommon1, TexCoord); } void PostUpsample1PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Upsample(_SampleTemporary2, TexCoord); + OutputColor0 = Upsample(_SampleCommon2, TexCoord); } void PostUpsample0PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Upsample(_SampleTemporary1, TexCoord); + OutputColor0 = Upsample(_SampleCommon1, TexCoord); } float4 Med3(float4 a, float4 b, float4 c) @@ -692,21 +692,21 @@ namespace Interpolation { VertexShader = Downsample1VS; PixelShader = PreDownsample1PS; - RenderTarget0 = _RenderTemporary1; + RenderTarget0 = _RenderCommon1; } pass { VertexShader = Downsample2VS; PixelShader = PreDownsample2PS; - RenderTarget0 = _RenderTemporary2; + RenderTarget0 = _RenderCommon2; } pass { VertexShader = Upsample1VS; PixelShader = PreUpsample1PS; - RenderTarget0 = _RenderTemporary1; + RenderTarget0 = _RenderCommon1; } pass @@ -731,56 +731,56 @@ namespace Interpolation { VertexShader = PostProcessVS; PixelShader = EstimateLevel7PS; - RenderTarget0 = _RenderTemporary7; + RenderTarget0 = _RenderCommon7; } pass { VertexShader = EstimateLevel6VS; PixelShader = EstimateLevel6PS; - RenderTarget0 = _RenderTemporary6; + RenderTarget0 = _RenderCommon6; } pass { VertexShader = EstimateLevel5VS; PixelShader = EstimateLevel5PS; - RenderTarget0 = _RenderTemporary5; + RenderTarget0 = _RenderCommon5; } pass { VertexShader = EstimateLevel4VS; PixelShader = EstimateLevel4PS; - RenderTarget0 = _RenderTemporary4; + RenderTarget0 = _RenderCommon4; } pass { VertexShader = EstimateLevel3VS; PixelShader = EstimateLevel3PS; - RenderTarget0 = _RenderTemporary3; + RenderTarget0 = _RenderCommon3; } pass { VertexShader = EstimateLevel2VS; PixelShader = EstimateLevel2PS; - RenderTarget0 = _RenderTemporary2; + RenderTarget0 = _RenderCommon2; } pass { VertexShader = EstimateLevel1VS; PixelShader = EstimateLevel1PS; - RenderTarget0 = _RenderTemporary1; + RenderTarget0 = _RenderCommon1; } pass { VertexShader = EstimateLevel0VS; PixelShader = EstimateLevel0PS; - RenderTarget0 = _RenderTemporary0; + RenderTarget0 = _RenderCommon0; ClearRenderTargets = FALSE; BlendEnable = TRUE; BlendOp = ADD; @@ -794,21 +794,21 @@ namespace Interpolation { VertexShader = Downsample1VS; PixelShader = PostDownsample1PS; - RenderTarget0 = _RenderTemporary1; + RenderTarget0 = _RenderCommon1; } pass { VertexShader = Downsample2VS; PixelShader = PostDownsample2PS; - RenderTarget0 = _RenderTemporary2; + RenderTarget0 = _RenderCommon2; } pass { VertexShader = Upsample1VS; PixelShader = PostUpsample1PS; - RenderTarget0 = _RenderTemporary1; + RenderTarget0 = _RenderCommon1; } pass diff --git a/shaders/cMotionBlur.fx b/shaders/cMotionBlur.fx index bd32801..0953557 100644 --- a/shaders/cMotionBlur.fx +++ b/shaders/cMotionBlur.fx @@ -46,7 +46,7 @@ namespace SharedResources { namespace RG16F { - texture2D _RenderTemporary1a + texture2D _RenderCommon1a { Width = BUFFER_WIDTH >> 1; Height = BUFFER_HEIGHT >> 1; @@ -56,7 +56,7 @@ namespace SharedResources namespace POW2 { - texture2D _RenderTemporary0a + texture2D _RenderCommon0a { Width = POW2SIZE_0; Height = POW2SIZE_0; @@ -64,7 +64,7 @@ namespace SharedResources MipLevels = 8; }; - texture2D _RenderTemporary0b + texture2D _RenderCommon0b { Width = POW2SIZE_0; Height = POW2SIZE_0; @@ -72,7 +72,7 @@ namespace SharedResources MipLevels = 8; }; - texture2D _RenderTemporary0c + texture2D _RenderCommon0c { Width = POW2SIZE_0; Height = POW2SIZE_0; @@ -80,49 +80,49 @@ namespace SharedResources MipLevels = 8; }; - texture2D _RenderTemporary1 + texture2D _RenderCommon1 { Width = POW2SIZE_1; Height = POW2SIZE_1; Format = RG16F; }; - texture2D _RenderTemporary2 + texture2D _RenderCommon2 { Width = POW2SIZE_2; Height = POW2SIZE_2; Format = RG16F; }; - texture2D _RenderTemporary3 + texture2D _RenderCommon3 { Width = POW2SIZE_3; Height = POW2SIZE_3; Format = RG16F; }; - texture2D _RenderTemporary4 + texture2D _RenderCommon4 { Width = POW2SIZE_4; Height = POW2SIZE_4; Format = RG16F; }; - texture2D _RenderTemporary5 + texture2D _RenderCommon5 { Width = POW2SIZE_5; Height = POW2SIZE_5; Format = RG16F; }; - texture2D _RenderTemporary6 + texture2D _RenderCommon6 { Width = POW2SIZE_6; Height = POW2SIZE_6; Format = RG16F; }; - texture2D _RenderTemporary7 + texture2D _RenderCommon7 { Width = POW2SIZE_7; Height = POW2SIZE_7; @@ -193,33 +193,33 @@ namespace MotionBlur #endif }; - sampler2D _SampleTemporary1a + sampler2D _SampleCommon1a { - Texture = SharedResources::RG16F::_RenderTemporary1a; + Texture = SharedResources::RG16F::_RenderCommon1a; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SamplePOW2Temporary0a + sampler2D _SamplePOW2Common0a { - Texture = SharedResources::RG16F::POW2::_RenderTemporary0a; + Texture = SharedResources::RG16F::POW2::_RenderCommon0a; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SamplePOW2Temporary0b + sampler2D _SamplePOW2Common0b { - Texture = SharedResources::RG16F::POW2::_RenderTemporary0b; + Texture = SharedResources::RG16F::POW2::_RenderCommon0b; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SamplePOW2Temporary0c + sampler2D _SamplePOW2Common0c { - Texture = SharedResources::RG16F::POW2::_RenderTemporary0c; + Texture = SharedResources::RG16F::POW2::_RenderCommon0c; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; @@ -241,72 +241,72 @@ namespace MotionBlur MipFilter = LINEAR; }; - sampler2D _SamplePOW2Temporary7 + sampler2D _SamplePOW2Common7 { - Texture = SharedResources::RG16F::POW2::_RenderTemporary7; + Texture = SharedResources::RG16F::POW2::_RenderCommon7; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SamplePOW2Temporary6 + sampler2D _SamplePOW2Common6 { - Texture = SharedResources::RG16F::POW2::_RenderTemporary6; + Texture = SharedResources::RG16F::POW2::_RenderCommon6; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SamplePOW2Temporary5 + sampler2D _SamplePOW2Common5 { - Texture = SharedResources::RG16F::POW2::_RenderTemporary5; + Texture = SharedResources::RG16F::POW2::_RenderCommon5; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SamplePOW2Temporary4 + sampler2D _SamplePOW2Common4 { - Texture = SharedResources::RG16F::POW2::_RenderTemporary4; + Texture = SharedResources::RG16F::POW2::_RenderCommon4; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SamplePOW2Temporary3 + sampler2D _SamplePOW2Common3 { - Texture = SharedResources::RG16F::POW2::_RenderTemporary3; + Texture = SharedResources::RG16F::POW2::_RenderCommon3; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SamplePOW2Temporary2 + sampler2D _SamplePOW2Common2 { - Texture = SharedResources::RG16F::POW2::_RenderTemporary2; + Texture = SharedResources::RG16F::POW2::_RenderCommon2; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SamplePOW2Temporary1 + sampler2D _SamplePOW2Common1 { - Texture = SharedResources::RG16F::POW2::_RenderTemporary1; + Texture = SharedResources::RG16F::POW2::_RenderCommon1; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary0 + texture2D _RenderCommon0 { Width = POW2SIZE_0; Height = POW2SIZE_0; Format = RG16F; }; - sampler2D _SamplePOW2Temporary0 + sampler2D _SamplePOW2Common0 { - Texture = _RenderTemporary0; + Texture = _RenderCommon0; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; @@ -539,11 +539,11 @@ namespace MotionBlur void OpticalFlow(in float2 TexCoord, in float2 UV, in float Level, out float2 DUV) { const float Alpha = max(ldexp(_Constraint * 1e-3, Level - MaxLevel), 1e-7); - float2 SampleC = tex2D(_SamplePOW2Temporary0a, TexCoord).rg; + float2 SampleC = tex2D(_SamplePOW2Common0a, TexCoord).rg; float2 SampleP = tex2D(_SampleData3, TexCoord).rg; float2 It = SampleC - SampleP; - float2 Ix = tex2D(_SamplePOW2Temporary0b, TexCoord).rg; - float2 Iy = tex2D(_SamplePOW2Temporary0c, TexCoord).rg; + float2 Ix = tex2D(_SamplePOW2Common0b, TexCoord).rg; + float2 Iy = tex2D(_SamplePOW2Common0c, TexCoord).rg; /* We solve for X[N] (UV) @@ -644,37 +644,37 @@ namespace MotionBlur void Copy0PS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { - OutputColor0 = tex2D(_SampleTemporary1a, TexCoord).rg; + OutputColor0 = tex2D(_SampleCommon1a, TexCoord).rg; } void PreDownsample1PS(in float4 Position : SV_Position, in float4 DownsampleCoords[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Downsample(_SamplePOW2Temporary0a, DownsampleCoords); + OutputColor0 = Downsample(_SamplePOW2Common0a, DownsampleCoords); } void PreDownsample2PS(in float4 Position : SV_Position, in float4 DownsampleCoords[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Downsample(_SamplePOW2Temporary1, DownsampleCoords); + OutputColor0 = Downsample(_SamplePOW2Common1, DownsampleCoords); } void PreDownsample3PS(in float4 Position : SV_Position, in float4 DownsampleCoords[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Downsample(_SamplePOW2Temporary2, DownsampleCoords); + OutputColor0 = Downsample(_SamplePOW2Common2, DownsampleCoords); } void PreUpsample2PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Upsample(_SamplePOW2Temporary3, UpsampleCoords); + OutputColor0 = Upsample(_SamplePOW2Common3, UpsampleCoords); } void PreUpsample1PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Upsample(_SamplePOW2Temporary2, UpsampleCoords); + OutputColor0 = Upsample(_SamplePOW2Common2, UpsampleCoords); } void PreUpsample0PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Upsample(_SamplePOW2Temporary1, UpsampleCoords); + OutputColor0 = Upsample(_SamplePOW2Common1, UpsampleCoords); } void DerivativesPS(in float4 Position : SV_Position, in float4 TexCoords[3] : TEXCOORD0, out float2 OutputColor0 : SV_Target0, out float2 OutputColor1 : SV_Target1) @@ -683,14 +683,14 @@ namespace MotionBlur // A0 B0 C0 // A1 C1 // A2 B2 C2 - float2 A0 = tex2D(_SamplePOW2Temporary0a, TexCoords[0].xy).xy; - float2 A1 = tex2D(_SamplePOW2Temporary0a, TexCoords[0].xz).xy; - float2 A2 = tex2D(_SamplePOW2Temporary0a, TexCoords[0].xw).xy; - float2 B0 = tex2D(_SamplePOW2Temporary0a, TexCoords[1].xy).xy; - float2 B2 = tex2D(_SamplePOW2Temporary0a, TexCoords[1].xw).xy; - float2 C0 = tex2D(_SamplePOW2Temporary0a, TexCoords[2].xy).xy; - float2 C1 = tex2D(_SamplePOW2Temporary0a, TexCoords[2].xz).xy; - float2 C2 = tex2D(_SamplePOW2Temporary0a, TexCoords[2].xw).xy; + float2 A0 = tex2D(_SamplePOW2Common0a, TexCoords[0].xy).xy; + float2 A1 = tex2D(_SamplePOW2Common0a, TexCoords[0].xz).xy; + float2 A2 = tex2D(_SamplePOW2Common0a, TexCoords[0].xw).xy; + float2 B0 = tex2D(_SamplePOW2Common0a, TexCoords[1].xy).xy; + float2 B2 = tex2D(_SamplePOW2Common0a, TexCoords[1].xw).xy; + float2 C0 = tex2D(_SamplePOW2Common0a, TexCoords[2].xy).xy; + float2 C1 = tex2D(_SamplePOW2Common0a, TexCoords[2].xz).xy; + float2 C2 = tex2D(_SamplePOW2Common0a, TexCoords[2].xw).xy; // -1 -1 0 +1 +1 // -1 -1 0 +1 +1 @@ -714,69 +714,69 @@ namespace MotionBlur void EstimateLevel6PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { - OpticalFlow(UpsampleCoords[1].xz, Upsample(_SamplePOW2Temporary7, UpsampleCoords).xy, 6.0, OutputColor0); + OpticalFlow(UpsampleCoords[1].xz, Upsample(_SamplePOW2Common7, UpsampleCoords).xy, 6.0, OutputColor0); } void EstimateLevel5PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { - OpticalFlow(UpsampleCoords[1].xz, Upsample(_SamplePOW2Temporary6, UpsampleCoords).xy, 5.0, OutputColor0); + OpticalFlow(UpsampleCoords[1].xz, Upsample(_SamplePOW2Common6, UpsampleCoords).xy, 5.0, OutputColor0); } void EstimateLevel4PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { - OpticalFlow(UpsampleCoords[1].xz, Upsample(_SamplePOW2Temporary5, UpsampleCoords).xy, 4.0, OutputColor0); + OpticalFlow(UpsampleCoords[1].xz, Upsample(_SamplePOW2Common5, UpsampleCoords).xy, 4.0, OutputColor0); } void EstimateLevel3PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { - OpticalFlow(UpsampleCoords[1].xz, Upsample(_SamplePOW2Temporary4, UpsampleCoords).xy, 3.0, OutputColor0); + OpticalFlow(UpsampleCoords[1].xz, Upsample(_SamplePOW2Common4, UpsampleCoords).xy, 3.0, OutputColor0); } void EstimateLevel2PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { - OpticalFlow(UpsampleCoords[1].xz, Upsample(_SamplePOW2Temporary3, UpsampleCoords).xy, 2.0, OutputColor0); + OpticalFlow(UpsampleCoords[1].xz, Upsample(_SamplePOW2Common3, UpsampleCoords).xy, 2.0, OutputColor0); } void EstimateLevel1PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { - OpticalFlow(UpsampleCoords[1].xz, Upsample(_SamplePOW2Temporary2, UpsampleCoords).xy, 1.0, OutputColor0); + OpticalFlow(UpsampleCoords[1].xz, Upsample(_SamplePOW2Common2, UpsampleCoords).xy, 1.0, OutputColor0); } void EstimateLevel0PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OpticalFlow(UpsampleCoords[1].xz, Upsample(_SamplePOW2Temporary1, UpsampleCoords).xy, 0.0, OutputColor0.xy); + OpticalFlow(UpsampleCoords[1].xz, Upsample(_SamplePOW2Common1, UpsampleCoords).xy, 0.0, OutputColor0.xy); OutputColor0.ba = (0.0, _Blend); } void PostDownsample1PS(in float4 Position : SV_Position, in float4 DownsampleCoords[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Downsample(_SamplePOW2Temporary0, DownsampleCoords); + OutputColor0 = Downsample(_SamplePOW2Common0, DownsampleCoords); } void PostDownsample2PS(in float4 Position : SV_Position, in float4 DownsampleCoords[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Downsample(_SamplePOW2Temporary1, DownsampleCoords); + OutputColor0 = Downsample(_SamplePOW2Common1, DownsampleCoords); } void PostDownsample3PS(in float4 Position : SV_Position, in float4 DownsampleCoords[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Downsample(_SamplePOW2Temporary2, DownsampleCoords); + OutputColor0 = Downsample(_SamplePOW2Common2, DownsampleCoords); } void PostUpsample2PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Upsample(_SamplePOW2Temporary3, UpsampleCoords); + OutputColor0 = Upsample(_SamplePOW2Common3, UpsampleCoords); } void PostUpsample1PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = Upsample(_SamplePOW2Temporary2, UpsampleCoords); + OutputColor0 = Upsample(_SamplePOW2Common2, UpsampleCoords); } void PostUpsample0PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0, out float2 OutputColor1 : SV_Target1) { - OutputColor0 = Upsample(_SamplePOW2Temporary1, UpsampleCoords); - OutputColor1 = tex2D(_SamplePOW2Temporary0a, UpsampleCoords[1].xz).rg; + OutputColor0 = Upsample(_SamplePOW2Common1, UpsampleCoords); + OutputColor1 = tex2D(_SamplePOW2Common0a, UpsampleCoords[1].xz).rg; } void MotionBlurPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target) @@ -784,7 +784,7 @@ namespace MotionBlur const int Samples = 4; float Noise = frac(52.9829189 * frac(dot(Position.xy, float2(0.06711056, 0.00583715)))); float FrameTimeRatio = _TargetFrameRate / (1e+3 / _FrameTime); - float2 Velocity = (tex2Dlod(_SamplePOW2Temporary0c, float4(TexCoord, 0.0, _MipBias)).xy / POW2SIZE_0) * _Scale; + float2 Velocity = (tex2Dlod(_SamplePOW2Common0c, float4(TexCoord, 0.0, _MipBias)).xy / POW2SIZE_0) * _Scale; Velocity /= (_FrameRateScaling) ? FrameTimeRatio : 1.0; for(int k = 0; k < Samples; ++k) @@ -805,14 +805,14 @@ namespace MotionBlur { VertexShader = MedianVS; PixelShader = NormalizePS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary1a; + RenderTarget0 = SharedResources::RG16F::_RenderCommon1a; } pass { VertexShader = PostProcessVS; PixelShader = Copy0PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary0a; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon0a; } // Pre-process dual-filter blur @@ -821,42 +821,42 @@ namespace MotionBlur { VertexShader = Downsample1VS; PixelShader = PreDownsample1PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary1; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon1; } pass { VertexShader = Downsample2VS; PixelShader = PreDownsample2PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary2; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon2; } pass { VertexShader = Downsample3VS; PixelShader = PreDownsample3PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary3; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon3; } pass { VertexShader = Upsample2VS; PixelShader = PreUpsample2PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary2; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon2; } pass { VertexShader = Upsample1VS; PixelShader = PreUpsample1PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary1; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon1; } pass { VertexShader = Upsample0VS; PixelShader = PreUpsample0PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary0a; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon0a; } // Calculate discrete derivative pyramid @@ -865,8 +865,8 @@ namespace MotionBlur { VertexShader = DerivativesVS; PixelShader = DerivativesPS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary0b; - RenderTarget1 = SharedResources::RG16F::POW2::_RenderTemporary0c; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon0b; + RenderTarget1 = SharedResources::RG16F::POW2::_RenderCommon0c; } // Calculate pyramidal estimation @@ -875,56 +875,56 @@ namespace MotionBlur { VertexShader = PostProcessVS; PixelShader = EstimateLevel7PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary7; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon7; } pass { VertexShader = EstimateLevel6VS; PixelShader = EstimateLevel6PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary6; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon6; } pass { VertexShader = EstimateLevel5VS; PixelShader = EstimateLevel5PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary5; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon5; } pass { VertexShader = EstimateLevel4VS; PixelShader = EstimateLevel4PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary4; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon4; } pass { VertexShader = EstimateLevel3VS; PixelShader = EstimateLevel3PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary3; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon3; } pass { VertexShader = EstimateLevel2VS; PixelShader = EstimateLevel2PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary2; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon2; } pass { VertexShader = EstimateLevel1VS; PixelShader = EstimateLevel1PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary1; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon1; } pass { VertexShader = EstimateLevel0VS; PixelShader = EstimateLevel0PS; - RenderTarget0 = _RenderTemporary0; + RenderTarget0 = _RenderCommon0; ClearRenderTargets = FALSE; BlendEnable = TRUE; BlendOp = ADD; @@ -938,42 +938,42 @@ namespace MotionBlur { VertexShader = Downsample1VS; PixelShader = PostDownsample1PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary1; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon1; } pass { VertexShader = Downsample2VS; PixelShader = PostDownsample2PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary2; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon2; } pass { VertexShader = Downsample3VS; PixelShader = PostDownsample3PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary3; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon3; } pass { VertexShader = Upsample2VS; PixelShader = PostUpsample2PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary2; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon2; } pass { VertexShader = Upsample1VS; PixelShader = PostUpsample1PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary1; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon1; } pass { VertexShader = Upsample0VS; PixelShader = PostUpsample0PS; - RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary0c; + RenderTarget0 = SharedResources::RG16F::POW2::_RenderCommon0c; // Store previous frame RenderTarget1 = _RenderData3; diff --git a/shaders/cOpticalFlow.fx b/shaders/cOpticalFlow.fx index 36759dd..f829ebf 100644 --- a/shaders/cOpticalFlow.fx +++ b/shaders/cOpticalFlow.fx @@ -48,7 +48,7 @@ namespace SharedResources { namespace RGBA16F { - texture2D _RenderTemporary1 < pooled = true; > + texture2D _RenderCommon1 < pooled = true; > { Width = BUFFER_SIZE_1.x; Height = BUFFER_SIZE_1.y; @@ -59,7 +59,7 @@ namespace SharedResources namespace RG16F { - texture2D _RenderTemporary1 < pooled = true; > + texture2D _RenderCommon1 < pooled = true; > { Width = BUFFER_SIZE_1.x; Height = BUFFER_SIZE_1.y; @@ -67,49 +67,49 @@ namespace SharedResources MipLevels = 8; }; - texture2D _RenderTemporary2 < pooled = true; > + texture2D _RenderCommon2 < pooled = true; > { Width = BUFFER_SIZE_2.x; Height = BUFFER_SIZE_2.y; Format = RG16F; }; - texture2D _RenderTemporary3 < pooled = true; > + texture2D _RenderCommon3 < pooled = true; > { Width = BUFFER_SIZE_3.x; Height = BUFFER_SIZE_3.y; Format = RG16F; }; - texture2D _RenderTemporary4 < pooled = true; > + texture2D _RenderCommon4 < pooled = true; > { Width = BUFFER_SIZE_4.x; Height = BUFFER_SIZE_4.y; Format = RG16F; }; - texture2D _RenderTemporary5 < pooled = true; > + texture2D _RenderCommon5 < pooled = true; > { Width = BUFFER_SIZE_5.x; Height = BUFFER_SIZE_5.y; Format = RG16F; }; - texture2D _RenderTemporary6 < pooled = true; > + texture2D _RenderCommon6 < pooled = true; > { Width = BUFFER_SIZE_6.x; Height = BUFFER_SIZE_6.y; Format = RG16F; }; - texture2D _RenderTemporary7 < pooled = true; > + texture2D _RenderCommon7 < pooled = true; > { Width = BUFFER_SIZE_7.x; Height = BUFFER_SIZE_7.y; Format = RG16F; }; - texture2D _RenderTemporary8 < pooled = true; > + texture2D _RenderCommon8 < pooled = true; > { Width = BUFFER_SIZE_8.x; Height = BUFFER_SIZE_8.y; @@ -225,23 +225,23 @@ namespace OpticalFlow #endif }; - sampler2D _SampleTemporary_RG16F_1a + sampler2D _SampleCommon_RG16F_1a { - Texture = SharedResources::RG16F::_RenderTemporary1; + Texture = SharedResources::RG16F::_RenderCommon1; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SampleTemporary_RGBA16F_1a + sampler2D _SampleCommon_RGBA16F_1a { - Texture = SharedResources::RGBA16F::_RenderTemporary1; + Texture = SharedResources::RGBA16F::_RenderCommon1; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary1d + texture2D _RenderCommon1d { Width = BUFFER_WIDTH / 2; Height = BUFFER_HEIGHT / 2; @@ -249,80 +249,80 @@ namespace OpticalFlow MipLevels = 8; }; - sampler2D _SampleTemporary_RG16F_1d + sampler2D _SampleCommon_RG16F_1d { - Texture = _RenderTemporary1d; + Texture = _RenderCommon1d; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SampleTemporary_RG16F_8 + sampler2D _SampleCommon_RG16F_8 { - Texture = SharedResources::RG16F::_RenderTemporary8; + Texture = SharedResources::RG16F::_RenderCommon8; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SampleTemporary_RG16F_7 + sampler2D _SampleCommon_RG16F_7 { - Texture = SharedResources::RG16F::_RenderTemporary7; + Texture = SharedResources::RG16F::_RenderCommon7; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SampleTemporary_RG16F_6 + sampler2D _SampleCommon_RG16F_6 { - Texture = SharedResources::RG16F::_RenderTemporary6; + Texture = SharedResources::RG16F::_RenderCommon6; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SampleTemporary_RG16F_5 + sampler2D _SampleCommon_RG16F_5 { - Texture = SharedResources::RG16F::_RenderTemporary5; + Texture = SharedResources::RG16F::_RenderCommon5; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SampleTemporary_RG16F_4 + sampler2D _SampleCommon_RG16F_4 { - Texture = SharedResources::RG16F::_RenderTemporary4; + Texture = SharedResources::RG16F::_RenderCommon4; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SampleTemporary_RG16F_3 + sampler2D _SampleCommon_RG16F_3 { - Texture = SharedResources::RG16F::_RenderTemporary3; + Texture = SharedResources::RG16F::_RenderCommon3; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - sampler2D _SampleTemporary_RG16F_2 + sampler2D _SampleCommon_RG16F_2 { - Texture = SharedResources::RG16F::_RenderTemporary2; + Texture = SharedResources::RG16F::_RenderCommon2; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; }; - texture2D _RenderTemporary1e + texture2D _RenderCommon1e { Width = BUFFER_SIZE_1.x; Height = BUFFER_SIZE_1.y; Format = RG16F; }; - sampler2D _SampleTemporary_RG16F_1e + sampler2D _SampleCommon_RG16F_1e { - Texture = _RenderTemporary1e; + Texture = _RenderCommon1e; MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; @@ -520,7 +520,7 @@ namespace OpticalFlow float2 VelocityCoord; VelocityCoord.xy = Origin.xy * PixelSize.xy; VelocityCoord.y = 1.0 - VelocityCoord.y; - Velocity = tex2Dlod(_SampleTemporary_RGBA16F_1a, float4(VelocityCoord, 0.0, _MipBias)).xy; + Velocity = tex2Dlod(_SampleCommon_RGBA16F_1a, float4(VelocityCoord, 0.0, _MipBias)).xy; // Scale velocity float2 Direction = Velocity * VELOCITY_SCALE; @@ -623,11 +623,11 @@ namespace OpticalFlow void OpticalFlow(in float2 TexCoord, in float2 UV, in float Level, out float2 DUV) { - float2 CurrentFrame = tex2D(_SampleTemporary_RG16F_1a, TexCoord).xy; - float2 PreviousFrame = tex2D(_SampleTemporary_RG16F_1d, TexCoord).xy; + float2 CurrentFrame = tex2D(_SampleCommon_RG16F_1a, TexCoord).xy; + float2 PreviousFrame = tex2D(_SampleCommon_RG16F_1d, TexCoord).xy; // SpatialI = - float4 SpatialI = tex2D(_SampleTemporary_RGBA16F_1a, TexCoord); + float4 SpatialI = tex2D(_SampleCommon_RGBA16F_1a, TexCoord); float2 TemporalI = CurrentFrame - PreviousFrame; const float Alpha = max(ldexp(_Constraint * 1e-5, Level - MaxLevel), 1e-7); @@ -731,32 +731,32 @@ namespace OpticalFlow void PreDownsample1PS(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = DownsamplePS(_SampleTemporary_RG16F_1a, TexCoord); + OutputColor0 = DownsamplePS(_SampleCommon_RG16F_1a, TexCoord); } void PreDownsample2PS(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = DownsamplePS(_SampleTemporary_RG16F_2, TexCoord); + OutputColor0 = DownsamplePS(_SampleCommon_RG16F_2, TexCoord); } void PreDownsample3PS(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = DownsamplePS(_SampleTemporary_RG16F_3, TexCoord); + OutputColor0 = DownsamplePS(_SampleCommon_RG16F_3, TexCoord); } void PreUpsample3PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = UpsamplePS(_SampleTemporary_RG16F_4, TexCoord); + OutputColor0 = UpsamplePS(_SampleCommon_RG16F_4, TexCoord); } void PreUpsample2PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = UpsamplePS(_SampleTemporary_RG16F_3, TexCoord); + OutputColor0 = UpsamplePS(_SampleCommon_RG16F_3, TexCoord); } void PreUpsample1PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = UpsamplePS(_SampleTemporary_RG16F_2, TexCoord); + OutputColor0 = UpsamplePS(_SampleCommon_RG16F_2, TexCoord); } void DerivativesPS(in float4 Position : SV_Position, in float4 TexCoords[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) @@ -765,14 +765,14 @@ namespace OpticalFlow // A0 B0 C0 // A1 C1 // A2 B2 C2 - float2 A0 = tex2D(_SampleTemporary_RG16F_1a, TexCoords[0].xy).xy; - float2 A1 = tex2D(_SampleTemporary_RG16F_1a, TexCoords[0].xz).xy; - float2 A2 = tex2D(_SampleTemporary_RG16F_1a, TexCoords[0].xw).xy; - float2 B0 = tex2D(_SampleTemporary_RG16F_1a, TexCoords[1].xy).xy; - float2 B2 = tex2D(_SampleTemporary_RG16F_1a, TexCoords[1].xw).xy; - float2 C0 = tex2D(_SampleTemporary_RG16F_1a, TexCoords[2].xy).xy; - float2 C1 = tex2D(_SampleTemporary_RG16F_1a, TexCoords[2].xz).xy; - float2 C2 = tex2D(_SampleTemporary_RG16F_1a, TexCoords[2].xw).xy; + float2 A0 = tex2D(_SampleCommon_RG16F_1a, TexCoords[0].xy).xy; + float2 A1 = tex2D(_SampleCommon_RG16F_1a, TexCoords[0].xz).xy; + float2 A2 = tex2D(_SampleCommon_RG16F_1a, TexCoords[0].xw).xy; + float2 B0 = tex2D(_SampleCommon_RG16F_1a, TexCoords[1].xy).xy; + float2 B2 = tex2D(_SampleCommon_RG16F_1a, TexCoords[1].xw).xy; + float2 C0 = tex2D(_SampleCommon_RG16F_1a, TexCoords[2].xy).xy; + float2 C1 = tex2D(_SampleCommon_RG16F_1a, TexCoords[2].xz).xy; + float2 C2 = tex2D(_SampleCommon_RG16F_1a, TexCoords[2].xw).xy; // -1 -1 0 +1 +1 // -1 -1 0 +1 +1 @@ -796,76 +796,76 @@ namespace OpticalFlow void EstimateLevel7PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { - OpticalFlow(TexCoord[1].xz, UpsamplePS(_SampleTemporary_RG16F_8, TexCoord).xy, 6.0, OutputColor0); + OpticalFlow(TexCoord[1].xz, UpsamplePS(_SampleCommon_RG16F_8, TexCoord).xy, 6.0, OutputColor0); } void EstimateLevel6PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { - OpticalFlow(TexCoord[1].xz, UpsamplePS(_SampleTemporary_RG16F_7, TexCoord).xy, 5.0, OutputColor0); + OpticalFlow(TexCoord[1].xz, UpsamplePS(_SampleCommon_RG16F_7, TexCoord).xy, 5.0, OutputColor0); } void EstimateLevel5PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { - OpticalFlow(TexCoord[1].xz, UpsamplePS(_SampleTemporary_RG16F_6, TexCoord).xy, 4.0, OutputColor0); + OpticalFlow(TexCoord[1].xz, UpsamplePS(_SampleCommon_RG16F_6, TexCoord).xy, 4.0, OutputColor0); } void EstimateLevel4PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { - OpticalFlow(TexCoord[1].xz, UpsamplePS(_SampleTemporary_RG16F_5, TexCoord).xy, 3.0, OutputColor0); + OpticalFlow(TexCoord[1].xz, UpsamplePS(_SampleCommon_RG16F_5, TexCoord).xy, 3.0, OutputColor0); } void EstimateLevel3PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { - OpticalFlow(TexCoord[1].xz, UpsamplePS(_SampleTemporary_RG16F_4, TexCoord).xy, 2.0, OutputColor0); + OpticalFlow(TexCoord[1].xz, UpsamplePS(_SampleCommon_RG16F_4, TexCoord).xy, 2.0, OutputColor0); } void EstimateLevel2PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { - OpticalFlow(TexCoord[1].xz, UpsamplePS(_SampleTemporary_RG16F_3, TexCoord).xy, 1.0, OutputColor0); + OpticalFlow(TexCoord[1].xz, UpsamplePS(_SampleCommon_RG16F_3, TexCoord).xy, 1.0, OutputColor0); } void EstimateLevel1PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OpticalFlow(TexCoord[1].xz, UpsamplePS(_SampleTemporary_RG16F_2, TexCoord).xy, 0.0, OutputColor0.xy); + OpticalFlow(TexCoord[1].xz, UpsamplePS(_SampleCommon_RG16F_2, TexCoord).xy, 0.0, OutputColor0.xy); OutputColor0.ba = (0.0, _Blend); } void PostDownsample1PS(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = DownsamplePS(_SampleTemporary_RG16F_1e, TexCoord); + OutputColor0 = DownsamplePS(_SampleCommon_RG16F_1e, TexCoord); } void PostDownsample2PS(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = DownsamplePS(_SampleTemporary_RG16F_2, TexCoord); + OutputColor0 = DownsamplePS(_SampleCommon_RG16F_2, TexCoord); } void PostDownsample3PS(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = DownsamplePS(_SampleTemporary_RG16F_3, TexCoord); + OutputColor0 = DownsamplePS(_SampleCommon_RG16F_3, TexCoord); } void PostUpsample3PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = UpsamplePS(_SampleTemporary_RG16F_4, TexCoord); + OutputColor0 = UpsamplePS(_SampleCommon_RG16F_4, TexCoord); } void PostUpsample2PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { - OutputColor0 = UpsamplePS(_SampleTemporary_RG16F_3, TexCoord); + OutputColor0 = UpsamplePS(_SampleCommon_RG16F_3, TexCoord); } void PostUpsample1PS(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0, out float4 OutputColor1 : SV_Target1) { - OutputColor0 = UpsamplePS(_SampleTemporary_RG16F_2, TexCoord); + OutputColor0 = UpsamplePS(_SampleCommon_RG16F_2, TexCoord); // Copy current convolved result to use at next frame - OutputColor1 = tex2D(_SampleTemporary_RG16F_1a, TexCoord[1].xz).rg; + OutputColor1 = tex2D(_SampleCommon_RG16F_1a, TexCoord[1].xz).rg; } void VelocityShadingPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target) { - float2 Velocity = tex2Dlod(_SampleTemporary_RGBA16F_1a, float4(TexCoord, 0.0, _MipBias)).xy; + float2 Velocity = tex2Dlod(_SampleCommon_RGBA16F_1a, float4(TexCoord, 0.0, _MipBias)).xy; if(_NormalizedShading) { @@ -905,7 +905,7 @@ namespace OpticalFlow { VertexShader = MedianVS; PixelShader = NormalizePS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary1; + RenderTarget0 = SharedResources::RG16F::_RenderCommon1; } // Pre-process dual-filter blur @@ -914,42 +914,42 @@ namespace OpticalFlow { VertexShader = Downsample1VS; PixelShader = PreDownsample1PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary2; + RenderTarget0 = SharedResources::RG16F::_RenderCommon2; } pass { VertexShader = Downsample2VS; PixelShader = PreDownsample2PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary3; + RenderTarget0 = SharedResources::RG16F::_RenderCommon3; } pass { VertexShader = Downsample3VS; PixelShader = PreDownsample3PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary4; + RenderTarget0 = SharedResources::RG16F::_RenderCommon4; } pass { VertexShader = Upsample3VS; PixelShader = PreUpsample3PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary3; + RenderTarget0 = SharedResources::RG16F::_RenderCommon3; } pass { VertexShader = Upsample2VS; PixelShader = PreUpsample2PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary2; + RenderTarget0 = SharedResources::RG16F::_RenderCommon2; } pass { VertexShader = Upsample1VS; PixelShader = PreUpsample1PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary1; + RenderTarget0 = SharedResources::RG16F::_RenderCommon1; } // Construct pyramids @@ -958,7 +958,7 @@ namespace OpticalFlow { VertexShader = DerivativesVS; PixelShader = DerivativesPS; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary1; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon1; } // Pyramidal estimation @@ -967,56 +967,56 @@ namespace OpticalFlow { VertexShader = PostProcessVS; PixelShader = EstimateLevel8PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary8; + RenderTarget0 = SharedResources::RG16F::_RenderCommon8; } pass { VertexShader = EstimateLevel7VS; PixelShader = EstimateLevel7PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary7; + RenderTarget0 = SharedResources::RG16F::_RenderCommon7; } pass { VertexShader = EstimateLevel6VS; PixelShader = EstimateLevel6PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary6; + RenderTarget0 = SharedResources::RG16F::_RenderCommon6; } pass { VertexShader = EstimateLevel5VS; PixelShader = EstimateLevel5PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary5; + RenderTarget0 = SharedResources::RG16F::_RenderCommon5; } pass { VertexShader = EstimateLevel4VS; PixelShader = EstimateLevel4PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary4; + RenderTarget0 = SharedResources::RG16F::_RenderCommon4; } pass { VertexShader = EstimateLevel3VS; PixelShader = EstimateLevel3PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary3; + RenderTarget0 = SharedResources::RG16F::_RenderCommon3; } pass { VertexShader = EstimateLevel2VS; PixelShader = EstimateLevel2PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary2; + RenderTarget0 = SharedResources::RG16F::_RenderCommon2; } pass { VertexShader = EstimateLevel1VS; PixelShader = EstimateLevel1PS; - RenderTarget0 = _RenderTemporary1e; + RenderTarget0 = _RenderCommon1e; ClearRenderTargets = FALSE; BlendEnable = TRUE; BlendOp = ADD; @@ -1030,45 +1030,45 @@ namespace OpticalFlow { VertexShader = Downsample1VS; PixelShader = PostDownsample1PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary2; + RenderTarget0 = SharedResources::RG16F::_RenderCommon2; } pass { VertexShader = Downsample2VS; PixelShader = PostDownsample2PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary3; + RenderTarget0 = SharedResources::RG16F::_RenderCommon3; } pass { VertexShader = Downsample3VS; PixelShader = PostDownsample3PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary4; + RenderTarget0 = SharedResources::RG16F::_RenderCommon4; } pass { VertexShader = Upsample3VS; PixelShader = PostUpsample3PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary3; + RenderTarget0 = SharedResources::RG16F::_RenderCommon3; } pass { VertexShader = Upsample2VS; PixelShader = PostUpsample2PS; - RenderTarget0 = SharedResources::RG16F::_RenderTemporary2; + RenderTarget0 = SharedResources::RG16F::_RenderCommon2; } pass { VertexShader = Upsample1VS; PixelShader = PostUpsample1PS; - RenderTarget0 = SharedResources::RGBA16F::_RenderTemporary1; + RenderTarget0 = SharedResources::RGBA16F::_RenderCommon1; // Copy previous frame - RenderTarget1 = _RenderTemporary1d; + RenderTarget1 = _RenderCommon1d; } // Render result