From 94b2e513358161034ad4fd4d69aafa5be6227db4 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 7 Feb 2022 13:41:54 -0700 Subject: [PATCH] Use constructors instead of cast operators --- shaders/cBloom.fx | 4 ++-- shaders/cInterpolation.fx | 22 +++++++++++----------- shaders/cMotionBlur.fx | 22 +++++++++++----------- shaders/cOpticalFlow.fx | 26 +++++++++++++------------- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/shaders/cBloom.fx b/shaders/cBloom.fx index 3027378..89db4e7 100644 --- a/shaders/cBloom.fx +++ b/shaders/cBloom.fx @@ -211,7 +211,7 @@ void DownsampleVS(in uint ID, out float4 Position, out float4 TexCoord[4], float { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - const float2 PixelSize = 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -Factor); + const float2 PixelSize = 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -Factor)); // Quadrant TexCoord[0] = TexCoord0.xyxy + float4(-1.0, -1.0, 1.0, 1.0) * PixelSize.xyxy; // Left column @@ -226,7 +226,7 @@ void UpsampleVS(in uint ID, out float4 Position, out float4 TexCoord[3], float F { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - const float2 PixelSize = 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -Factor); + const float2 PixelSize = 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -Factor)); // Left column TexCoord[0] = TexCoord0.xyyy + float4(-2.0, 2.0, 0.0, -2.0) * PixelSize.xyyy; // Center column diff --git a/shaders/cInterpolation.fx b/shaders/cInterpolation.fx index 6eb15df..ebd9ff0 100644 --- a/shaders/cInterpolation.fx +++ b/shaders/cInterpolation.fx @@ -346,22 +346,22 @@ namespace Interpolation void Downsample1VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 DownsampleOffsets[4] : TEXCOORD0) { - DownsampleVS(ID, 1.0 / (uint2)ldexp(BUFFER_SIZE, -1.0), Position, DownsampleOffsets); + DownsampleVS(ID, 1.0 / uint2(ldexp(BUFFER_SIZE, -1.0)), Position, DownsampleOffsets); } void Downsample2VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 DownsampleOffsets[4] : TEXCOORD0) { - DownsampleVS(ID, 1.0 / (uint2)ldexp(BUFFER_SIZE, -2.0), Position, DownsampleOffsets); + DownsampleVS(ID, 1.0 / uint2(ldexp(BUFFER_SIZE, -2.0)), Position, DownsampleOffsets); } void Upsample1VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 UpsampleOffsets[3] : TEXCOORD0) { - UpsampleVS(ID, 1.0 / (uint2)ldexp(BUFFER_SIZE, -1.0), Position, UpsampleOffsets); + UpsampleVS(ID, 1.0 / uint2(ldexp(BUFFER_SIZE, -1.0)), Position, UpsampleOffsets); } void Upsample0VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 UpsampleOffsets[3] : TEXCOORD0) { - UpsampleVS(ID, 1.0 / (uint2)ldexp(BUFFER_SIZE, 0.0), Position, UpsampleOffsets); + UpsampleVS(ID, 1.0 / uint2(ldexp(BUFFER_SIZE, 0.0)), Position, UpsampleOffsets); } void DerivativesVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets : TEXCOORD0) @@ -377,49 +377,49 @@ namespace Interpolation { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - UpsampleOffsets(TexCoord0, 1.0 / (uint2)ldexp(BUFFER_SIZE, -7.0), Offsets); + UpsampleOffsets(TexCoord0, 1.0 / uint2(ldexp(BUFFER_SIZE, -7.0)), Offsets); } void EstimateLevel5VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - UpsampleOffsets(TexCoord0, 1.0 / (uint2)ldexp(BUFFER_SIZE, -6.0), Offsets); + UpsampleOffsets(TexCoord0, 1.0 / uint2(ldexp(BUFFER_SIZE, -6.0)), Offsets); } void EstimateLevel4VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - UpsampleOffsets(TexCoord0, 1.0 / (uint2)ldexp(BUFFER_SIZE, -5.0), Offsets); + UpsampleOffsets(TexCoord0, 1.0 / uint2(ldexp(BUFFER_SIZE, -5.0)), Offsets); } void EstimateLevel3VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - UpsampleOffsets(TexCoord0, 1.0 / (uint2)ldexp(BUFFER_SIZE, -4.0), Offsets); + UpsampleOffsets(TexCoord0, 1.0 / uint2(ldexp(BUFFER_SIZE, -4.0)), Offsets); } void EstimateLevel2VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - UpsampleOffsets(TexCoord0, 1.0 / (uint2)ldexp(BUFFER_SIZE, -3.0), Offsets); + UpsampleOffsets(TexCoord0, 1.0 / uint2(ldexp(BUFFER_SIZE, -3.0)), Offsets); } void EstimateLevel1VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - UpsampleOffsets(TexCoord0, 1.0 / (uint2)ldexp(BUFFER_SIZE, -2.0), Offsets); + UpsampleOffsets(TexCoord0, 1.0 / uint2(ldexp(BUFFER_SIZE, -2.0)), Offsets); } void EstimateLevel0VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - UpsampleOffsets(TexCoord0, 1.0 / (uint2)ldexp(BUFFER_SIZE, -1.0), Offsets); + UpsampleOffsets(TexCoord0, 1.0 / uint2(ldexp(BUFFER_SIZE, -1.0)), Offsets); } // Pixel shaders diff --git a/shaders/cMotionBlur.fx b/shaders/cMotionBlur.fx index 68292e2..4358715 100644 --- a/shaders/cMotionBlur.fx +++ b/shaders/cMotionBlur.fx @@ -329,22 +329,22 @@ namespace MotionBlur void Downsample1VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 DownsampleOffsets[4] : TEXCOORD0) { - DownsampleVS(ID, 1.0 / (uint2)ldexp(BUFFER_SIZE, -1.0), Position, DownsampleOffsets); + DownsampleVS(ID, 1.0 / uint2(ldexp(BUFFER_SIZE, -1.0)), Position, DownsampleOffsets); } void Downsample2VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 DownsampleOffsets[4] : TEXCOORD0) { - DownsampleVS(ID, 1.0 / (uint2)ldexp(BUFFER_SIZE, -2.0), Position, DownsampleOffsets); + DownsampleVS(ID, 1.0 / uint2(ldexp(BUFFER_SIZE, -2.0)), Position, DownsampleOffsets); } void Upsample1VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 UpsampleOffsets[3] : TEXCOORD0) { - UpsampleVS(ID, 1.0 / (uint2)ldexp(BUFFER_SIZE, -1.0), Position, UpsampleOffsets); + UpsampleVS(ID, 1.0 / uint2(ldexp(BUFFER_SIZE, -1.0)), Position, UpsampleOffsets); } void Upsample0VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 UpsampleOffsets[3] : TEXCOORD0) { - UpsampleVS(ID, 1.0 / (uint2)ldexp(BUFFER_SIZE, 0.0), Position, UpsampleOffsets); + UpsampleVS(ID, 1.0 / uint2(ldexp(BUFFER_SIZE, 0.0)), Position, UpsampleOffsets); } void DerivativesVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets : TEXCOORD0) @@ -360,49 +360,49 @@ namespace MotionBlur { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - UpsampleOffsets(TexCoord0, 1.0 / (uint2)ldexp(BUFFER_SIZE, -7.0), Offsets); + UpsampleOffsets(TexCoord0, 1.0 / uint2(ldexp(BUFFER_SIZE, -7.0)), Offsets); } void EstimateLevel5VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - UpsampleOffsets(TexCoord0, 1.0 / (uint2)ldexp(BUFFER_SIZE, -6.0), Offsets); + UpsampleOffsets(TexCoord0, 1.0 / uint2(ldexp(BUFFER_SIZE, -6.0)), Offsets); } void EstimateLevel4VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - UpsampleOffsets(TexCoord0, 1.0 / (uint2)ldexp(BUFFER_SIZE, -5.0), Offsets); + UpsampleOffsets(TexCoord0, 1.0 / uint2(ldexp(BUFFER_SIZE, -5.0)), Offsets); } void EstimateLevel3VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - UpsampleOffsets(TexCoord0, 1.0 / (uint2)ldexp(BUFFER_SIZE, -4.0), Offsets); + UpsampleOffsets(TexCoord0, 1.0 / uint2(ldexp(BUFFER_SIZE, -4.0)), Offsets); } void EstimateLevel2VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - UpsampleOffsets(TexCoord0, 1.0 / (uint2)ldexp(BUFFER_SIZE, -3.0), Offsets); + UpsampleOffsets(TexCoord0, 1.0 / uint2(ldexp(BUFFER_SIZE, -3.0)), Offsets); } void EstimateLevel1VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - UpsampleOffsets(TexCoord0, 1.0 / (uint2)ldexp(BUFFER_SIZE, -2.0), Offsets); + UpsampleOffsets(TexCoord0, 1.0 / uint2(ldexp(BUFFER_SIZE, -2.0)), Offsets); } void EstimateLevel0VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { float2 TexCoord0; PostProcessVS(ID, Position, TexCoord0); - UpsampleOffsets(TexCoord0, 1.0 / (uint2)ldexp(BUFFER_SIZE, -1.0), Offsets); + UpsampleOffsets(TexCoord0, 1.0 / uint2(ldexp(BUFFER_SIZE, -1.0)), Offsets); } // Pixel shaders diff --git a/shaders/cOpticalFlow.fx b/shaders/cOpticalFlow.fx index 390bc6c..e522fce 100644 --- a/shaders/cOpticalFlow.fx +++ b/shaders/cOpticalFlow.fx @@ -379,32 +379,32 @@ namespace OpticalFlow void Downsample1VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 DownsampleCoords[4] : TEXCOORD0) { - DownsampleVS(ID, 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -1.0), Position, DownsampleCoords); + DownsampleVS(ID, 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -1.0)), Position, DownsampleCoords); } void Downsample2VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 DownsampleCoords[4] : TEXCOORD0) { - DownsampleVS(ID, 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -2.0), Position, DownsampleCoords); + DownsampleVS(ID, 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -2.0)), Position, DownsampleCoords); } void Downsample3VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 DownsampleCoords[4] : TEXCOORD0) { - DownsampleVS(ID, 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -3.0), Position, DownsampleCoords); + DownsampleVS(ID, 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -3.0)), Position, DownsampleCoords); } void Upsample2VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 UpsampleCoords[3] : TEXCOORD0) { - UpsampleVS(ID, 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -3.0), Position, UpsampleCoords); + UpsampleVS(ID, 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -3.0)), Position, UpsampleCoords); } void Upsample1VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 UpsampleCoords[3] : TEXCOORD0) { - UpsampleVS(ID, 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -2.0), Position, UpsampleCoords); + UpsampleVS(ID, 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -2.0)), Position, UpsampleCoords); } void Upsample0VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 UpsampleCoords[3] : TEXCOORD0) { - UpsampleVS(ID, 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -1.0), Position, UpsampleCoords); + UpsampleVS(ID, 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -1.0)), Position, UpsampleCoords); } void DerivativesVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets : TEXCOORD0) @@ -425,37 +425,37 @@ namespace OpticalFlow void EstimateLevel6VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { - EstimateVS(ID, 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -7.0), Position, Offsets); + EstimateVS(ID, 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -7.0)), Position, Offsets); } void EstimateLevel5VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { - EstimateVS(ID, 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -6.0), Position, Offsets); + EstimateVS(ID, 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -6.0)), Position, Offsets); } void EstimateLevel4VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { - EstimateVS(ID, 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -5.0), Position, Offsets); + EstimateVS(ID, 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -5.0)), Position, Offsets); } void EstimateLevel3VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { - EstimateVS(ID, 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -4.0), Position, Offsets); + EstimateVS(ID, 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -4.0)), Position, Offsets); } void EstimateLevel2VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { - EstimateVS(ID, 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -3.0), Position, Offsets); + EstimateVS(ID, 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -3.0)), Position, Offsets); } void EstimateLevel1VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { - EstimateVS(ID, 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -2.0), Position, Offsets); + EstimateVS(ID, 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -2.0)), Position, Offsets); } void EstimateLevel0VS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float4 Offsets[3] : TEXCOORD0) { - EstimateVS(ID, 1.0 / (uint2)ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -1.0), Position, Offsets); + EstimateVS(ID, 1.0 / uint2(ldexp(float2(BUFFER_WIDTH, BUFFER_HEIGHT), -1.0)), Position, Offsets); } void VelocityStreamsVS(in uint ID : SV_VertexID, out float4 Position : SV_Position, out float2 Velocity : TEXCOORD0)