From a16f387ca033d5091b3a8c3997eac252f0948ae4 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 6 Jan 2022 16:15:38 -0700 Subject: [PATCH] Fix Direct3D12 bug --- readme.md | 1 + shaders/cAbberation.fx | 4 +-- shaders/cAutoExposure.fx | 6 ++-- shaders/cBloom.fx | 66 +++++++++++++++++----------------- shaders/cCheckerBoard.fx | 4 +-- shaders/cColorBlendOp.fx | 5 +-- shaders/cColorNormalization.fx | 4 +-- shaders/cDefault.fx | 4 +-- shaders/cFilmGrain.fx | 8 ++--- shaders/cFrameBlending.fx | 6 ++-- shaders/cFrameDifference.fx | 10 +++--- shaders/cInterpolation.fx | 30 ++++++++-------- shaders/cLetterBox.fx | 4 +-- shaders/cLinearGaussianBlur.fx | 1 + shaders/cLuminance.fx | 4 +-- shaders/cMipLevels.fx | 10 +++--- shaders/cMosaic.fx | 6 ++-- shaders/cMotionBlur.fx | 28 +++++++-------- shaders/cOpticalFlow.fx | 30 ++++++++-------- shaders/cPingPong.fx | 14 ++++---- shaders/cPureDepthAO.fx | 10 +++--- shaders/cShard.fx | 4 +-- shaders/cSrcDestBlend.fx | 6 ++-- shaders/cThreshold.fx | 4 +-- shaders/cTile.fx | 4 +-- shaders/cTonemap.fx | 4 +-- shaders/kContour.fx | 6 ++-- shaders/kDatamosh.fx | 16 ++++----- shaders/kMirror.fx | 4 +-- shaders/kVignette.fx | 4 +-- 30 files changed, 155 insertions(+), 152 deletions(-) create mode 100644 shaders/cLinearGaussianBlur.fx diff --git a/readme.md b/readme.md index 7d08e21..9398e49 100644 --- a/readme.md +++ b/readme.md @@ -49,6 +49,7 @@ kVignette | Natural vignetting effect + Prefix `_` to uniform objects and variables (except for user functions) + Suffix `VS` for `VertexShader`, `PS` for `PixelShader` + Use **ALLCAPS** semantics and state parameters ++ Use **Pascal_Case** for System-Value Semantics (`SV_Position`) + Use **PascalCase** for + Namespaces + Structs diff --git a/shaders/cAbberation.fx b/shaders/cAbberation.fx index fbb039e..8601cf5 100644 --- a/shaders/cAbberation.fx +++ b/shaders/cAbberation.fx @@ -19,7 +19,7 @@ sampler2D _SampleColor /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -39,7 +39,7 @@ void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION Thus, just doing TexCoord + 1.0 moves the texture to the window's other sides, rendering it out of sight */ -void AbberationPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void AbberationPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { const float2 PixelSize = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT); // Shift red channel diff --git a/shaders/cAutoExposure.fx b/shaders/cAutoExposure.fx index 228c4bf..6b8398b 100644 --- a/shaders/cAutoExposure.fx +++ b/shaders/cAutoExposure.fx @@ -45,7 +45,7 @@ sampler2D _SampleLumaLOD /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -54,7 +54,7 @@ void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION /* [Pixel Shaders] */ -void BlitPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) +void BlitPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float4 Color = tex2D(_SampleColor, TexCoord); @@ -63,7 +63,7 @@ void BlitPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out floa OutputColor0 = float4(max(Color.r, max(Color.g, Color.b)).rrr, _TimeRate); } -void ExposurePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void ExposurePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { // Average Luma = Average value (1x1) for all of the pixels float AverageLuma = tex2Dlod(_SampleLumaLOD, float4(TexCoord, 0.0, 8.0)).r; diff --git a/shaders/cBloom.fx b/shaders/cBloom.fx index acf0e99..c60612d 100644 --- a/shaders/cBloom.fx +++ b/shaders/cBloom.fx @@ -148,14 +148,14 @@ sampler2D _SampleBloom8 /* [ Vertex Shaders ] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; Position = float4(TexCoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0); } -void DownsampleVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[4] : TEXCOORD0, float Factor) +void DownsampleVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[4] : TEXCOORD0, float Factor) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); @@ -170,7 +170,7 @@ void DownsampleVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, TexCoord[3] = TexCoord0.xyyy + float4(2.0, 2.0, 0.0, -2.0) * pSize.xyyy; } -void UpsampleVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[3] : TEXCOORD0, float Factor) +void UpsampleVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[3] : TEXCOORD0, float Factor) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); @@ -183,72 +183,72 @@ void UpsampleVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, i TexCoord[2] = TexCoord0.xyyy + float4(1.0, 1.0, 0.0, -1.0) * pSize.xyyy; } -void DownsampleVS1(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[4] : TEXCOORD0) +void DownsampleVS1(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[4] : TEXCOORD0) { DownsampleVS(ID, Position, TexCoord, 1.0); } -void DownsampleVS2(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[4] : TEXCOORD0) +void DownsampleVS2(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[4] : TEXCOORD0) { DownsampleVS(ID, Position, TexCoord, 2.0); } -void DownsampleVS3(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[4] : TEXCOORD0) +void DownsampleVS3(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[4] : TEXCOORD0) { DownsampleVS(ID, Position, TexCoord, 3.0); } -void DownsampleVS4(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[4] : TEXCOORD0) +void DownsampleVS4(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[4] : TEXCOORD0) { DownsampleVS(ID, Position, TexCoord, 4.0); } -void DownsampleVS5(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[4] : TEXCOORD0) +void DownsampleVS5(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[4] : TEXCOORD0) { DownsampleVS(ID, Position, TexCoord, 5.0); } -void DownsampleVS6(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[4] : TEXCOORD0) +void DownsampleVS6(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[4] : TEXCOORD0) { DownsampleVS(ID, Position, TexCoord, 6.0); } -void DownsampleVS7(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[4] : TEXCOORD0) +void DownsampleVS7(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[4] : TEXCOORD0) { DownsampleVS(ID, Position, TexCoord, 7.0); } -void UpsampleVS8(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[3] : TEXCOORD0) +void UpsampleVS8(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[3] : TEXCOORD0) { UpsampleVS(ID, Position, TexCoord, 8.0); } -void UpsampleVS7(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[3] : TEXCOORD0) +void UpsampleVS7(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[3] : TEXCOORD0) { UpsampleVS(ID, Position, TexCoord, 7.0); } -void UpsampleVS6(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[3] : TEXCOORD0) +void UpsampleVS6(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[3] : TEXCOORD0) { UpsampleVS(ID, Position, TexCoord, 6.0); } -void UpsampleVS5(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[3] : TEXCOORD0) +void UpsampleVS5(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[3] : TEXCOORD0) { UpsampleVS(ID, Position, TexCoord, 5.0); } -void UpsampleVS4(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[3] : TEXCOORD0) +void UpsampleVS4(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[3] : TEXCOORD0) { UpsampleVS(ID, Position, TexCoord, 4.0); } -void UpsampleVS3(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[3] : TEXCOORD0) +void UpsampleVS3(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[3] : TEXCOORD0) { UpsampleVS(ID, Position, TexCoord, 3.0); } -void UpsampleVS2(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[3] : TEXCOORD0) +void UpsampleVS2(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[3] : TEXCOORD0) { UpsampleVS(ID, Position, TexCoord, 2.0); } @@ -324,7 +324,7 @@ float Med3(float x, float y, float z) return max(min(x, y), min(max(x, y), z)); } -void PrefilterPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void PrefilterPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { const float Knee = mad(_Threshold, _Smooth, 1e-5f); const float3 Curve = float3(_Threshold - Knee, Knee * 2.0, 0.25 / Knee); @@ -365,77 +365,77 @@ float3 RRTAndODTFit(float3 v) return a / b; } -void DownsamplePS1(float4 Position : SV_POSITION, float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void DownsamplePS1(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = DownsamplePS(_SampleBloom1, TexCoord); } -void DownsamplePS2(float4 Position : SV_POSITION, float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void DownsamplePS2(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = DownsamplePS(_SampleBloom2, TexCoord); } -void DownsamplePS3(float4 Position : SV_POSITION, float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void DownsamplePS3(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = DownsamplePS(_SampleBloom3, TexCoord); } -void DownsamplePS4(float4 Position : SV_POSITION, float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void DownsamplePS4(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = DownsamplePS(_SampleBloom4, TexCoord); } -void DownsamplePS5(float4 Position : SV_POSITION, float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void DownsamplePS5(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = DownsamplePS(_SampleBloom5, TexCoord); } -void DownsamplePS6(float4 Position : SV_POSITION, float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void DownsamplePS6(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = DownsamplePS(_SampleBloom6, TexCoord); } -void DownsamplePS7(float4 Position : SV_POSITION, float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void DownsamplePS7(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = DownsamplePS(_SampleBloom7, TexCoord); } -void UpsamplePS8(float4 Position : SV_POSITION, float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void UpsamplePS8(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = UpsamplePS(_SampleBloom8, TexCoord); } -void UpsamplePS7(float4 Position : SV_POSITION, float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void UpsamplePS7(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = UpsamplePS(_SampleBloom7, TexCoord); } -void UpsamplePS6(float4 Position : SV_POSITION, float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void UpsamplePS6(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = UpsamplePS(_SampleBloom6, TexCoord); } -void UpsamplePS5(float4 Position : SV_POSITION, float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void UpsamplePS5(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = UpsamplePS(_SampleBloom5, TexCoord); } -void UpsamplePS4(float4 Position : SV_POSITION, float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void UpsamplePS4(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = UpsamplePS(_SampleBloom4, TexCoord); } -void UpsamplePS3(float4 Position : SV_POSITION, float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void UpsamplePS3(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = UpsamplePS(_SampleBloom3, TexCoord); } -void UpsamplePS2(float4 Position : SV_POSITION, float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void UpsamplePS2(in float4 Position : SV_Position, in float4 TexCoord[3] : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = UpsamplePS(_SampleBloom2, TexCoord); } -void CompositePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void CompositePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float4 Src = tex2D(_SampleBloom1, TexCoord); Src *= _Intensity; diff --git a/shaders/cCheckerBoard.fx b/shaders/cCheckerBoard.fx index d134aed..5d868e4 100644 --- a/shaders/cCheckerBoard.fx +++ b/shaders/cCheckerBoard.fx @@ -18,7 +18,7 @@ uniform bool _InvertCheckerboard < ui_label = "Invert Checkerboard Pattern"; > = false; -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -27,7 +27,7 @@ void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION /* [Pixel Shaders] */ -void CheckerBoardPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void CheckerBoardPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float CheckerBoard = frac(dot(Position.xy, 0.5)) * 2.0; CheckerBoard = _InvertCheckerboard ? 1.0 - CheckerBoard : CheckerBoard; diff --git a/shaders/cColorBlendOp.fx b/shaders/cColorBlendOp.fx index 2c68b17..4d0f904 100644 --- a/shaders/cColorBlendOp.fx +++ b/shaders/cColorBlendOp.fx @@ -11,9 +11,10 @@ uniform float4 _Color < /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position) { // Clip a triangle twice the screen's size to make a quad + float2 TexCoord = 0.0; TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; Position = float4(TexCoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0); @@ -21,7 +22,7 @@ void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION /* [Pixel Shaders] */ -void ColorPS(float4 Position : SV_Position, out float4 OutputColor0 : SV_Target0) +void ColorPS(in float4 Position : SV_Position, out float4 OutputColor0 : SV_Target0) { // Fill this quad with a color OutputColor0 = _Color; diff --git a/shaders/cColorNormalization.fx b/shaders/cColorNormalization.fx index d3568b1..84e9443 100644 --- a/shaders/cColorNormalization.fx +++ b/shaders/cColorNormalization.fx @@ -34,7 +34,7 @@ sampler2D _SampleColor /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -43,7 +43,7 @@ void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION /* [Pixel Shaders] */ -void NormalizationPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float3 OutputColor0 : SV_TARGET0) +void NormalizationPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float3 OutputColor0 : SV_Target0) { OutputColor0 = 0.0; float3 Color = tex2D(_SampleColor, TexCoord).rgb; diff --git a/shaders/cDefault.fx b/shaders/cDefault.fx index fed8d40..b59d9c1 100644 --- a/shaders/cDefault.fx +++ b/shaders/cDefault.fx @@ -3,12 +3,12 @@ Placeholder shader to initialize the pipeline for comparing shaders */ -void PostProcessVS(out float4 Position : SV_POSITION) +void PostProcessVS(out float4 Position : SV_Position) { Position = 0.0; } -void PostProcessPS(out float4 OutputColor0 : SV_TARGET0) +void PostProcessPS(out float4 OutputColor0 : SV_Target0) { OutputColor0 = 0.0; } diff --git a/shaders/cFilmGrain.fx b/shaders/cFilmGrain.fx index a14b105..c59ec77 100644 --- a/shaders/cFilmGrain.fx +++ b/shaders/cFilmGrain.fx @@ -23,7 +23,7 @@ uniform float _Intensity < uniform float _Time < source = "timer"; >; -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -37,12 +37,12 @@ float GaussianWeight(float x, float Sigma) return rsqrt(Pi * Sigma) * exp(-((x * x) / (2.0 * Sigma))); } -float4 VignettePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0) : SV_Target +void FilmGrainPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float Time = rcp(1e+3 / _Time) * _Speed; float Seed = dot(Position.xy, float2(12.9898, 78.233)); float Noise = frac(sin(Seed) * 43758.5453 + Time); - return GaussianWeight(Noise, _Variance) * _Intensity; + OutputColor0 = GaussianWeight(Noise, _Variance) * _Intensity; } technique cFilmGrain @@ -50,7 +50,7 @@ technique cFilmGrain pass { VertexShader = PostProcessVS; - PixelShader = VignettePS; + PixelShader = FilmGrainPS; // (Shader[Src] * SrcBlend) + (Buffer[Dest] * DestBlend) // This shader: (Shader[Src] * (1.0 - Buffer[Dest])) + Buffer[Dest] BlendEnable = TRUE; diff --git a/shaders/cFrameBlending.fx b/shaders/cFrameBlending.fx index a9c47d4..69a2f65 100644 --- a/shaders/cFrameBlending.fx +++ b/shaders/cFrameBlending.fx @@ -36,7 +36,7 @@ sampler2D _SampleCopy /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -45,13 +45,13 @@ void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION /* [Pixel Shaders] */ -void BlendPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void BlendPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { // Copy backbuffer to a that continuously blends with its previous result OutputColor0 = float4(tex2D(_SampleColor, TexCoord).rgb, _BlendFactor); } -void DisplayPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void DisplayPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { // Display the buffer OutputColor0 = tex2D(_SampleCopy, TexCoord); diff --git a/shaders/cFrameDifference.fx b/shaders/cFrameDifference.fx index cb70794..9130717 100644 --- a/shaders/cFrameDifference.fx +++ b/shaders/cFrameDifference.fx @@ -66,7 +66,7 @@ sampler2D _SamplePrevious /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -75,14 +75,14 @@ void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION /* [Pixel Shaders] */ -void BlitPS0(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void BlitPS0(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float3 Color = tex2D(_SampleColor, TexCoord).rgb; float3 NColor = saturate(Color / dot(Color, 1.0)); OutputColor0 = (_NormalizeInput) ? NColor : max(max(Color.r, Color.g), Color.b); } -void DifferencePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void DifferencePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { if(_NormalizeInput) { @@ -102,12 +102,12 @@ void DifferencePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, ou OutputColor0.a = _Blend; } -void OutputPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void OutputPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleDifference, TexCoord).r; } -void BlitPS1(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void BlitPS1(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleCurrent, TexCoord); } diff --git a/shaders/cInterpolation.fx b/shaders/cInterpolation.fx index 5531e43..6bce61d 100644 --- a/shaders/cInterpolation.fx +++ b/shaders/cInterpolation.fx @@ -133,7 +133,7 @@ sampler2D _SampleFrame1 /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -170,19 +170,19 @@ void OutputOffsets(in float2 TexCoord, inout float4 Offsets[7], float2 Direction } } -void HorizontalBlurVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0, inout float4 Offsets[7] : TEXCOORD1) +void HorizontalBlurVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0, out float4 Offsets[7] : TEXCOORD1) { PostProcessVS(ID, Position, TexCoord); OutputOffsets(TexCoord, Offsets, float2(1.0 / BUFFER_SIZE.x, 0.0)); } -void VerticalBlurVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0, inout float4 Offsets[7] : TEXCOORD1) +void VerticalBlurVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0, out float4 Offsets[7] : TEXCOORD1) { PostProcessVS(ID, Position, TexCoord); OutputOffsets(TexCoord, Offsets, float2(0.0, 1.0 / BUFFER_SIZE.y)); } -void DerivativesVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord : TEXCOORD0) +void DerivativesVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord : TEXCOORD0) { const float2 PixelSize = 0.5 / BUFFER_SIZE; const float4 PixelOffset = float4(PixelSize, -PixelSize); @@ -218,34 +218,34 @@ float4 GaussianBlur(sampler2D Source, float2 TexCoord, float4 Offsets[7]) return Output / Total; } -void CopyPS0(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_TARGET0) +void CopyPS0(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleData0, TexCoord).rg; } -void CopyPS1(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void CopyPS1(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleColor, TexCoord); } -void NormalizePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_TARGET0) +void NormalizePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { float3 Color = tex2D(_SampleFrame0, TexCoord).rgb; OutputColor0 = saturate(Color.xy / dot(Color, 1.0)); } -void HorizontalBlurPS0(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_TARGET0) +void HorizontalBlurPS0(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, in float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleData0, TexCoord, Offsets).xyz; OutputColor0.a = 1.0; } -void VerticalBlurPS0(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_TARGET0) +void VerticalBlurPS0(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, in float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleData1, TexCoord, Offsets); } -void DerivativesPS(float4 Position : SV_POSITION, float4 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void DerivativesPS(in float4 Position : SV_Position, in float4 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float2 Sample0 = tex2D(_SampleData0, TexCoord.zy).xy; // (-x, +y) float2 Sample1 = tex2D(_SampleData0, TexCoord.xy).xy; // (+x, +y) @@ -256,7 +256,7 @@ void DerivativesPS(float4 Position : SV_POSITION, float4 TexCoord : TEXCOORD0, o OutputColor0 *= 4.0; } -void OpticalFlowPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void OpticalFlowPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { const float MaxLevel = 6.5; float4 OpticalFlow; @@ -295,12 +295,12 @@ void OpticalFlowPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, o OutputColor0.ba = _Blend; } -void HorizontalBlurPS1(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_TARGET0) +void HorizontalBlurPS1(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, in float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleOpticalFlow, TexCoord, Offsets); } -void VerticalBlurPS1(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_TARGET0) +void VerticalBlurPS1(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, in float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleData1, TexCoord, Offsets); } @@ -310,7 +310,7 @@ float4 Med3(float4 x, float4 y, float4 z) return max(min(x, y), min(max(x, y), z)); } -void InterpolatePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void InterpolatePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float2 MotionVectors = tex2Dlod(_SampleData2, float4(TexCoord, 0.0, _Detail)).xy / BUFFER_SIZE; float4 FrameF = tex2D(_SampleFrame1, TexCoord + MotionVectors); @@ -321,7 +321,7 @@ void InterpolatePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, o OutputColor0 = Med3(FrameA, FrameF, FrameB); } -void CopyPS2(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void CopyPS2(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleFrame0, TexCoord); } diff --git a/shaders/cLetterBox.fx b/shaders/cLetterBox.fx index ae8bf9d..47b8c43 100644 --- a/shaders/cLetterBox.fx +++ b/shaders/cLetterBox.fx @@ -12,7 +12,7 @@ uniform float2 _Scale < /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, inout float4 Position : SV_Position, inout float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -21,7 +21,7 @@ void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION /* [Pixel Shaders] */ -void LetterboxPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float3 OutputColor : SV_Target0) +void LetterboxPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float3 OutputColor : SV_Target0) { // Output a rectangle const float2 Scale = -_Scale * 0.5 + 0.5; diff --git a/shaders/cLinearGaussianBlur.fx b/shaders/cLinearGaussianBlur.fx new file mode 100644 index 0000000..9601b32 --- /dev/null +++ b/shaders/cLinearGaussianBlur.fx @@ -0,0 +1 @@ +// Coming soon \ No newline at end of file diff --git a/shaders/cLuminance.fx b/shaders/cLuminance.fx index d5f8fa5..c2aa079 100644 --- a/shaders/cLuminance.fx +++ b/shaders/cLuminance.fx @@ -19,7 +19,7 @@ sampler2D _SampleColor /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -28,7 +28,7 @@ void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION /* [Pixel Shaders] */ -void LuminancePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void LuminancePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float4 Color = tex2D(_SampleColor, TexCoord); switch(_Select) diff --git a/shaders/cMipLevels.fx b/shaders/cMipLevels.fx index 2994907..8ff73b5 100644 --- a/shaders/cMipLevels.fx +++ b/shaders/cMipLevels.fx @@ -42,7 +42,7 @@ sampler2D _SampleImage /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -60,19 +60,19 @@ float MipLODLevel(float2 TexCoord, float2 InputSize, float Bias) return max(log2(Product) * 0.5 + Bias, 0.0); } -void BlitPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void BlitPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleColor, TexCoord); } -void MipLevelPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void MipLevelPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float2 InputSize = float2(BUFFER_WIDTH, BUFFER_HEIGHT) / 2.0; float MipLevel = MipLODLevel(TexCoord, InputSize, 0.0); OutputColor0 = tex2Dlod(_SampleMipMaps, float4(TexCoord, 0.0, MipLevel)); } -void ImagePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void OutputPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleImage, TexCoord); } @@ -102,7 +102,7 @@ technique cMipLevels pass { VertexShader = PostProcessVS; - PixelShader = ImagePS; + PixelShader = OutputPS; #if BUFFER_COLOR_BIT_DEPTH == 8 SRGBWriteEnable = TRUE; #endif diff --git a/shaders/cMosaic.fx b/shaders/cMosaic.fx index e258f37..cdfc989 100644 --- a/shaders/cMosaic.fx +++ b/shaders/cMosaic.fx @@ -50,7 +50,7 @@ sampler2D _SampleMosaicLOD /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -59,12 +59,12 @@ void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION /* [Pixel Shaders] */ -void BlitPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void BlitPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleColor, TexCoord); } -void MosaicPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void MosaicPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float2 PixelPosition = TexCoord * float2(BUFFER_WIDTH, BUFFER_HEIGHT); const float2 ScreenSize = float2(BUFFER_WIDTH, BUFFER_HEIGHT); diff --git a/shaders/cMotionBlur.fx b/shaders/cMotionBlur.fx index d2a4b5d..fb316d8 100644 --- a/shaders/cMotionBlur.fx +++ b/shaders/cMotionBlur.fx @@ -142,7 +142,7 @@ sampler2D _SampleOpticalFlow /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -179,19 +179,19 @@ void OutputOffsets(in float2 TexCoord, inout float4 Offsets[7], float2 Direction } } -void HorizontalBlurVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0, inout float4 Offsets[7] : TEXCOORD1) +void HorizontalBlurVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0, out float4 Offsets[7] : TEXCOORD1) { PostProcessVS(ID, Position, TexCoord); OutputOffsets(TexCoord, Offsets, float2(1.0 / BUFFER_SIZE.x, 0.0)); } -void VerticalBlurVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0, inout float4 Offsets[7] : TEXCOORD1) +void VerticalBlurVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0, out float4 Offsets[7] : TEXCOORD1) { PostProcessVS(ID, Position, TexCoord); OutputOffsets(TexCoord, Offsets, float2(0.0, 1.0 / BUFFER_SIZE.y)); } -void DerivativesVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord : TEXCOORD0) +void DerivativesVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord : TEXCOORD0) { const float2 PixelSize = 0.5 / BUFFER_SIZE; const float4 PixelOffset = float4(PixelSize, -PixelSize); @@ -227,34 +227,34 @@ float4 GaussianBlur(sampler2D Source, float2 TexCoord, float4 Offsets[7]) return Output / Total; } -void CopyPS0(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_TARGET0) +void CopyPS0(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleData0, TexCoord).rg; } -void NormalizePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_TARGET0) +void NormalizePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { float3 Color = tex2D(_SampleColor, TexCoord).rgb; OutputColor0 = saturate(Color.xy / dot(Color, 1.0)); } -void CopyPS1(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_TARGET0) +void CopyPS1(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleBuffer, TexCoord).rg; } -void HorizontalBlurPS0(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_TARGET0) +void HorizontalBlurPS0(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, in float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleData0, TexCoord, Offsets).xyz; OutputColor0.a = 1.0; } -void VerticalBlurPS0(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_TARGET0) +void VerticalBlurPS0(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, in float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleData1, TexCoord, Offsets); } -void DerivativesPS(float4 Position : SV_POSITION, float4 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void DerivativesPS(in float4 Position : SV_Position, in float4 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float2 Sample0 = tex2D(_SampleData0, TexCoord.zy).xy; // (-x, +y) float2 Sample1 = tex2D(_SampleData0, TexCoord.xy).xy; // (+x, +y) @@ -265,7 +265,7 @@ void DerivativesPS(float4 Position : SV_POSITION, float4 TexCoord : TEXCOORD0, o OutputColor0 *= 4.0; } -void OpticalFlowPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void OpticalFlowPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float RedBlack = frac(dot(Position.xy, 0.5)) * 2.0; const float MaxLevel = 6.5; @@ -305,17 +305,17 @@ void OpticalFlowPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, o OutputColor0.ba = _Blend; } -void HorizontalBlurPS1(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_TARGET0) +void HorizontalBlurPS1(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, in float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleOpticalFlow, TexCoord, Offsets); } -void VerticalBlurPS1(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_TARGET0) +void VerticalBlurPS1(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, in float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleData1, TexCoord, Offsets); } -void OutputPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target) +void OutputPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target) { const int Samples = 4; float Noise = frac(52.9829189 * frac(dot(Position.xy, float2(0.06711056, 0.00583715)))); diff --git a/shaders/cOpticalFlow.fx b/shaders/cOpticalFlow.fx index 9b7b9e2..32b1e22 100644 --- a/shaders/cOpticalFlow.fx +++ b/shaders/cOpticalFlow.fx @@ -115,7 +115,7 @@ sampler2D _SampleOpticalFlow /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -152,19 +152,19 @@ void OutputOffsets(in float2 TexCoord, inout float4 Offsets[7], float2 Direction } } -void HorizontalBlurVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0, inout float4 Offsets[7] : TEXCOORD1) +void HorizontalBlurVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0, out float4 Offsets[7] : TEXCOORD1) { PostProcessVS(ID, Position, TexCoord); OutputOffsets(TexCoord, Offsets, float2(1.0 / SCREEN_SIZE.x, 0.0)); } -void VerticalBlurVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0, inout float4 Offsets[7] : TEXCOORD1) +void VerticalBlurVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0, out float4 Offsets[7] : TEXCOORD1) { PostProcessVS(ID, Position, TexCoord); OutputOffsets(TexCoord, Offsets, float2(0.0, 1.0 / SCREEN_SIZE.y)); } -void DerivativesVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 Offsets : TEXCOORD0) +void DerivativesVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets : TEXCOORD0) { const float2 PixelSize = 0.5 / SCREEN_SIZE.xy; const float4 PixelOffset = float4(PixelSize, -PixelSize); @@ -173,7 +173,7 @@ void DerivativesVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION Offsets = TexCoord0.xyxy + PixelOffset; } -void VelocityStreamsVS(in uint ID : SV_VERTEXID, out float4 Position : SV_POSITION, out float2 Velocity : TEXCOORD0) +void VelocityStreamsVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 Velocity : TEXCOORD0) { int LineID = ID / 2; // Line Index int VertexID = ID % 2; // Vertex Index within the line (0 = start, 1 = end) @@ -251,28 +251,28 @@ float4 GaussianBlur(sampler2D Source, float2 TexCoord, float4 Offsets[7]) return Output / Total; } -void CopyPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_TARGET0) +void CopyPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleData0, TexCoord).rg; } -void BlitPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_TARGET0) +void BlitPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { float3 Color = tex2D(_SampleColor, TexCoord).rgb; OutputColor0 = saturate(Color.xy / dot(Color, 1.0)); } -void HorizontalBlurPS0(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_TARGET0) +void HorizontalBlurPS0(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, in float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleData0, TexCoord, Offsets); } -void VerticalBlurPS0(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_TARGET0) +void VerticalBlurPS0(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, in float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleData1, TexCoord, Offsets); } -void DerivativesPS(float4 Position : SV_POSITION, float4 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void DerivativesPS(in float4 Position : SV_Position, in float4 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float2 Sample0 = tex2D(_SampleData0, TexCoord.zy).xy; // (-x, +y) float2 Sample1 = tex2D(_SampleData0, TexCoord.xy).xy; // (+x, +y) @@ -283,7 +283,7 @@ void DerivativesPS(float4 Position : SV_POSITION, float4 TexCoord : TEXCOORD0, o OutputColor0 *= 4.0; } -void OpticalFlowPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void OpticalFlowPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { const float MaxLevel = 6.5; float4 OpticalFlow; @@ -322,17 +322,17 @@ void OpticalFlowPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, o OutputColor0.ba = _Blend; } -void HorizontalBlurPS1(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_TARGET0) +void HorizontalBlurPS1(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, in float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleOpticalFlow, TexCoord, Offsets); } -void VerticalBlurPS1(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_TARGET0) +void VerticalBlurPS1(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, in float4 Offsets[7] : TEXCOORD1, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleData1, TexCoord, Offsets); } -void VelocityShadingPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target) +void VelocityShadingPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target) { float2 Velocity = tex2Dlod(_SampleData2, float4(TexCoord, 0.0, _Detail)).xy; float VelocityLength = saturate(rsqrt(dot(Velocity, Velocity))); @@ -341,7 +341,7 @@ void VelocityShadingPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD OutputColor0.a = 1.0; } -void VelocityStreamsPS(float4 Position : SV_POSITION, float2 Velocity : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void VelocityStreamsPS(in float4 Position : SV_Position, in float2 Velocity : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float Length = length(Velocity) * VELOCITY_SCALE * 0.05; OutputColor0.rg = (Velocity.xy / Length) * 0.5 + 0.5; diff --git a/shaders/cPingPong.fx b/shaders/cPingPong.fx index 51e69d4..9ffdcd9 100644 --- a/shaders/cPingPong.fx +++ b/shaders/cPingPong.fx @@ -81,7 +81,7 @@ sampler2D _SampleBufferB /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -104,32 +104,32 @@ float4 GaussianBlur(sampler2D Source, float2 TexCoord, const float2 Direction) return Output; } -void BlitPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void BlitPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleColor, TexCoord); } -void HorizontalBlurPS0(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void HorizontalBlurPS0(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleBufferA, TexCoord, float2(1.0, 0.0)); } -void VerticalBlurPS0(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void VerticalBlurPS0(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleBufferB, TexCoord, float2(0.0, 1.0)); } -void HorizontalBlurPS1(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void HorizontalBlurPS1(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleBufferA, TexCoord, float2(1.0, 0.0)); } -void VerticalBlurPS1(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void VerticalBlurPS1(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleBufferB, TexCoord, float2(0.0, 1.0)); } -void OutputPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void OutputPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleBufferA, TexCoord); } diff --git a/shaders/cPureDepthAO.fx b/shaders/cPureDepthAO.fx index 9ccbbb4..805b549 100644 --- a/shaders/cPureDepthAO.fx +++ b/shaders/cPureDepthAO.fx @@ -166,7 +166,7 @@ float2 Rotate2D( float2 r, float l ) return float2(dot(r, float2(Directions[1], -Directions[0])), dot(r, Directions.xy)); } -void OcclusionPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void OcclusionPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { const int Samples = 16; @@ -237,22 +237,22 @@ float GaussianBlur(sampler2D Source, float2 TexCoord, float2 Direction) return Output / TotalWeight; } -void BlitPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float OutputColor0 : SV_TARGET0) +void BlitPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleOcclusion, TexCoord).x; } -void HorizontalBlurPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float OutputColor0 : SV_TARGET0) +void HorizontalBlurPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleData0, TexCoord, float2(1.0, 0.0)).x; } -void VerticalBlurPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float OutputColor0 : SV_TARGET0) +void VerticalBlurPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float OutputColor0 : SV_Target0) { OutputColor0 = GaussianBlur(_SampleData1, TexCoord, float2(0.0, 1.0)).x; } -void ImagePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float3 OutputColor0 : SV_TARGET0) +void ImagePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float3 OutputColor0 : SV_Target0) { switch(_Debug) diff --git a/shaders/cShard.fx b/shaders/cShard.fx index cef2ab8..c838a45 100644 --- a/shaders/cShard.fx +++ b/shaders/cShard.fx @@ -17,7 +17,7 @@ sampler2D _SampleColor /* [Vertex Shaders] */ -void ShardVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0, inout float4 Offset : TEXCOORD1) +void ShardVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0, out float4 Offset : TEXCOORD1) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -28,7 +28,7 @@ void ShardVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inou /* [ Pixel Shaders ] */ -void ShardPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, float4 Offset : TEXCOORD1, out float4 OutputColor0 : SV_TARGET0) +void ShardPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, in float4 Offset : TEXCOORD1, out float4 OutputColor0 : SV_Target0) { float4 OriginalSample = tex2D(_SampleColor, TexCoord); float4 BlurSample; diff --git a/shaders/cSrcDestBlend.fx b/shaders/cSrcDestBlend.fx index 963c0ae..51675b6 100644 --- a/shaders/cSrcDestBlend.fx +++ b/shaders/cSrcDestBlend.fx @@ -32,7 +32,7 @@ sampler2D _SampleFrame /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -41,12 +41,12 @@ void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION /* [Pixel Shaders] */ -void BlitPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void BlitPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleColor, TexCoord); } -void BlendPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void BlendPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float4 Src = tex2D(_SampleFrame, TexCoord); float4 Dest = tex2D(_SampleColor, TexCoord); diff --git a/shaders/cThreshold.fx b/shaders/cThreshold.fx index 670b5e3..80987fb 100644 --- a/shaders/cThreshold.fx +++ b/shaders/cThreshold.fx @@ -39,7 +39,7 @@ sampler2D _SampleColor /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -53,7 +53,7 @@ float Med3(float x, float y, float z) /* [Pixel Shaders] */ -void ThresholdPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void ThresholdPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { const float Knee = mad(_Threshold, _Smooth, 1e-5f); const float3 Curve = float3(_Threshold - Knee, Knee * 2.0, 0.25 / Knee); diff --git a/shaders/cTile.fx b/shaders/cTile.fx index 3a16d64..900fa66 100644 --- a/shaders/cTile.fx +++ b/shaders/cTile.fx @@ -23,7 +23,7 @@ sampler2D _SampleColor #endif }; -void TileVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void TileVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -37,7 +37,7 @@ void TileVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout TexCoord += 0.5; } -void TilePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void TilePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleColor, TexCoord); } diff --git a/shaders/cTonemap.fx b/shaders/cTonemap.fx index 47d6609..a6e93b4 100644 --- a/shaders/cTonemap.fx +++ b/shaders/cTonemap.fx @@ -17,7 +17,7 @@ sampler2D _SampleColor /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -37,7 +37,7 @@ float3 Tonemap(float3 N) return mad(N, mad(A, N, C * B), D * E) / mad(N, mad(A, N, B), D * F) - (E / F); } -void TonemapPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void TonemapPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float3 LinearColor = tex2D(_SampleColor, TexCoord).rgb; const float3 WhitePoint = 1.0 / Tonemap(float3(2.80f, 2.90f, 3.10f)); diff --git a/shaders/kContour.fx b/shaders/kContour.fx index 1bad553..9ccea9f 100644 --- a/shaders/kContour.fx +++ b/shaders/kContour.fx @@ -79,14 +79,14 @@ sampler2D _SampleColor #endif }; -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; Position = float4(TexCoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0); } -void ContourVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord[4] : TEXCOORD0) +void ContourVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord[4] : TEXCOORD0) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); @@ -107,7 +107,7 @@ float3 NormalizeValue(float3 Input) return (_NormalizeOutput) ? Input * rsqrt(dot(Input, Input) + _NormalWeight) : Input; } -void ContourPS(float4 Position : SV_POSITION, float4 TexCoord[4] : TEXCOORD0, out float3 OutputColor0 : SV_TARGET0) +void ContourPS(in float4 Position : SV_Position, in float4 TexCoord[4] : TEXCOORD0, out float3 OutputColor0 : SV_Target0) { /* A0 B0 C0 diff --git a/shaders/kDatamosh.fx b/shaders/kDatamosh.fx index d4e5109..a5b0d0f 100644 --- a/shaders/kDatamosh.fx +++ b/shaders/kDatamosh.fx @@ -220,14 +220,14 @@ sampler2D _SampleFeedback /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD0) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD0) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; Position = float4(TexCoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0); } -void DerivativesVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float4 TexCoord : TEXCOORD0) +void DerivativesVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 TexCoord : TEXCOORD0) { const float2 PixelSize = 0.5 / _HALFSIZE; const float4 PixelOffset = float4(PixelSize, -PixelSize); @@ -238,13 +238,13 @@ void DerivativesVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION /* [Pixel Shaders ] */ -void ConvertPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_TARGET0) +void ConvertPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0) { float3 Color = tex2D(_SampleColor, TexCoord).rgb; OutputColor0 = saturate(Color.xy / dot(Color, 1.0)); } -void DerivativesPS(float4 Position : SV_POSITION, float4 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void DerivativesPS(in float4 Position : SV_Position, in float4 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { float2 Sample0 = tex2D(_SampleFrame0, TexCoord.zy).xy; // (-x, +y) float2 Sample1 = tex2D(_SampleFrame0, TexCoord.xy).xy; // (+x, +y) @@ -264,7 +264,7 @@ void DerivativesPS(float4 Position : SV_POSITION, float4 TexCoord : TEXCOORD0, o - Repeat until full resolution level of original frames is reached */ -void OpticalFlowPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void OpticalFlowPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = 0.0; const float MaxLevel = 6.5; @@ -304,7 +304,7 @@ float RandomNoise(float2 TexCoord) return frac(43758.5453 * sin(f)); } -void AccumulatePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0, out float4 OutputColor1 : SV_TARGET1) +void AccumulatePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0, out float4 OutputColor1 : SV_Target1) { float Quality = 1.0 - _Entropy; float2 Time = float2(_Time, 0.0); @@ -338,7 +338,7 @@ void AccumulatePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, ou OutputColor1 = float4(tex2D(_SampleFrame0, TexCoord).rgb, 0.0); } -void OutputPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) +void OutputPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { const float2 DisplacementTexel = 1.0 / _HALFSIZE; const float Quality = 1.0 - _Entropy; @@ -383,7 +383,7 @@ void OutputPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out fl OutputColor0 = lerp(Working, Source, ConditionalWeight); } -void BlitPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) +void BlitPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { OutputColor0 = tex2D(_SampleColor, TexCoord); } diff --git a/shaders/kMirror.fx b/shaders/kMirror.fx index 05ee869..a516ad6 100644 --- a/shaders/kMirror.fx +++ b/shaders/kMirror.fx @@ -49,7 +49,7 @@ sampler2D _SampleColor /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -58,7 +58,7 @@ void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION /* [ Pixel Shaders ] */ -void MirrorPS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD, out float4 OutputColor0 : SV_TARGET0) +void MirrorPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD, out float4 OutputColor0 : SV_Target0) { // Convert to the polar coordinate. float2 Polar = TexCoord - 0.5; diff --git a/shaders/kVignette.fx b/shaders/kVignette.fx index d3d5bf6..1b44146 100644 --- a/shaders/kVignette.fx +++ b/shaders/kVignette.fx @@ -31,7 +31,7 @@ uniform float _Falloff < /* [Vertex Shaders] */ -void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION, inout float2 TexCoord : TEXCOORD) +void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 TexCoord : TEXCOORD) { TexCoord.x = (ID == 2) ? 2.0 : 0.0; TexCoord.y = (ID == 1) ? 2.0 : 0.0; @@ -40,7 +40,7 @@ void PostProcessVS(in uint ID : SV_VERTEXID, inout float4 Position : SV_POSITION /* [ Pixel Shaders ] */ -void VignettePS(float4 Position : SV_POSITION, float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_TARGET0) +void VignettePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0) { const float AspectRatio = BUFFER_WIDTH / BUFFER_HEIGHT; float2 Coord = (TexCoord - 0.5) * AspectRatio * 2.0;