Skip to content

Commit

Permalink
Fix offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
papadanku committed Feb 13, 2022
1 parent 09a9a95 commit f6612f7
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions shaders/cMotionBlur.fx
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,17 @@ namespace MotionBlur
{
DownsampleVS(ID, 1.0 / POW2SIZE_1, Position, DownsampleCoords);
}

void Downsample3VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 DownsampleCoords[4] : TEXCOORD0)
{
DownsampleVS(ID, 1.0 / POW2SIZE_2, Position, DownsampleCoords);
}

void Upsample2VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 UpsampleCoords[3] : TEXCOORD0)
{
UpsampleVS(ID, 1.0 / POW2SIZE_2, Position, UpsampleCoords);
}

void Upsample1VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 UpsampleCoords[3] : TEXCOORD0)
{
UpsampleVS(ID, 1.0 / POW2SIZE_1, Position, UpsampleCoords);
Expand Down Expand Up @@ -565,6 +575,16 @@ namespace MotionBlur
{
OutputColor0 = Downsample(_SamplePOW2Temporary1, DownsampleCoords);
}

void PreDownsample3PS(in float4 Position : SV_Position, in float4 DownsampleCoords[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0)
{
OutputColor0 = Downsample(_SamplePOW2Temporary2, DownsampleCoords);
}

void PreUpsample2PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0)
{
OutputColor0 = Upsample(_SamplePOW2Temporary3, UpsampleCoords);
}

void PreUpsample1PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0)
{
Expand Down Expand Up @@ -637,6 +657,16 @@ namespace MotionBlur
OutputColor0 = Downsample(_SamplePOW2Temporary1, DownsampleCoords);
}

void PostDownsample3PS(in float4 Position : SV_Position, in float4 DownsampleCoords[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0)
{
OutputColor0 = Downsample(_SamplePOW2Temporary2, DownsampleCoords);
}

void PostUpsample2PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0)
{
OutputColor0 = Upsample(_SamplePOW2Temporary3, UpsampleCoords);
}

void PostUpsample1PS(in float4 Position : SV_Position, in float4 UpsampleCoords[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0)
{
OutputColor0 = Upsample(_SamplePOW2Temporary2, UpsampleCoords);
Expand Down Expand Up @@ -699,7 +729,21 @@ namespace MotionBlur
PixelShader = PreDownsample2PS;
RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary2;
}

pass
{
VertexShader = Downsample3VS;
PixelShader = PreDownsample3PS;
RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary3;
}

pass
{
VertexShader = Upsample2VS;
PixelShader = PreUpsample2PS;
RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary2;
}

pass
{
VertexShader = Upsample1VS;
Expand Down Expand Up @@ -802,6 +846,20 @@ namespace MotionBlur
PixelShader = PostDownsample2PS;
RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary2;
}

pass
{
VertexShader = Downsample3VS;
PixelShader = PostDownsample3PS;
RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary3;
}

pass
{
VertexShader = Upsample2VS;
PixelShader = PostUpsample2PS;
RenderTarget0 = SharedResources::RG16F::POW2::_RenderTemporary2;
}

pass
{
Expand Down

0 comments on commit f6612f7

Please sign in to comment.