diff options
Diffstat (limited to 'tests/hlsl/dxsdk/HDRToneMappingCS11')
8 files changed, 0 insertions, 553 deletions
diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/BrightPassAndHorizFilterCS.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/BrightPassAndHorizFilterCS.hlsl deleted file mode 100644 index 3addeca08..000000000 --- a/tests/hlsl/dxsdk/HDRToneMappingCS11/BrightPassAndHorizFilterCS.hlsl +++ /dev/null @@ -1,64 +0,0 @@ -//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues. -//TEST:COMPARE_HLSL: -profile cs_4_0 -entry CSMain -//-------------------------------------------------------------------------------------- -// File: BrightPassAndHorizFilterCS.hlsl -// -// The CS for bright pass and horizontal blur, used in CS path of -// HDRToneMappingCS11 sample -// -// Copyright (c) Microsoft Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- -static const float MIDDLE_GRAY = 0.72f; -static const float LUM_WHITE = 1.5f; -static const float BRIGHT_THRESHOLD = 0.5f; - -Texture2D Input : register( t0 ); -StructuredBuffer<float> lum : register( t1 ); -RWStructuredBuffer<float4> Result : register( u0 ); - -cbuffer cb0 -{ - float4 g_avSampleWeights[15]; - uint g_outputwidth; - float g_inverse; - int2 g_inputsize; -} - -#define kernelhalf 7 -#define groupthreads 128 -groupshared float4 temp[groupthreads]; - -[numthreads( groupthreads, 1, 1 )] -void CSMain( uint3 Gid : SV_GroupID, uint GI : SV_GroupIndex ) -{ - int2 coord = int2( GI - kernelhalf + (groupthreads - kernelhalf * 2) * Gid.x, Gid.y ); - coord = coord.xy * 8 + int2(4, 3); - coord = clamp( coord, int2(0, 0), int2(g_inputsize.x-1, g_inputsize.y-1) ); - float4 vColor = Input.Load( int3(coord, 0) ); - - float fLum = lum[0]*g_inverse; - - // Bright pass and tone mapping - vColor = max( 0.0f, vColor - BRIGHT_THRESHOLD ); - vColor *= MIDDLE_GRAY / (fLum + 0.001f); - vColor *= (1.0f + vColor/LUM_WHITE); - vColor /= (1.0f + vColor); - - temp[GI] = vColor; - - GroupMemoryBarrierWithGroupSync(); - - // Horizontal blur - if ( GI >= kernelhalf && - GI < (groupthreads - kernelhalf) && - ( (Gid.x * (groupthreads - 2 * kernelhalf) + GI - kernelhalf) < g_outputwidth) ) - { - float4 vOut = 0; - - [unroll] - for ( int i = -kernelhalf; i <= kernelhalf; ++i ) - vOut += temp[GI + i] * g_avSampleWeights[i + kernelhalf]; - - Result[GI - kernelhalf + (groupthreads - kernelhalf * 2) * Gid.x + Gid.y * g_outputwidth] = float4(vOut.rgb, 1.0f); - } -} diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/DumpToTexture.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/DumpToTexture.hlsl deleted file mode 100644 index f2d119eb5..000000000 --- a/tests/hlsl/dxsdk/HDRToneMappingCS11/DumpToTexture.hlsl +++ /dev/null @@ -1,29 +0,0 @@ -//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues. -//TEST:COMPARE_HLSL: -profile ps_4_0 -entry PSDump -//-------------------------------------------------------------------------------------- -// File: DumpToTexture.hlsl -// -// The PS for converting CS output buffer to a texture, used in CS path of -// HDRToneMappingCS11 sample -// -// Copyright (c) Microsoft Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- -StructuredBuffer<float4> buffer : register( t0 ); - -struct QuadVS_Output -{ - float4 Pos : SV_POSITION; - float2 Tex : TEXCOORD0; -}; - -cbuffer cbPS : register( b0 ) -{ - uint4 g_param; -}; - -float4 PSDump( QuadVS_Output Input ) : SV_TARGET -{ - // To calculate the buffer offset, it is natural to use the screen space coordinates, - // Input.Pos is the screen space coordinates of the pixel being written - return buffer[ (Input.Pos.x - 0.5) + (Input.Pos.y - 0.5) * g_param.x ]; -} diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/FilterCS.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/FilterCS.hlsl deleted file mode 100644 index e21b97e30..000000000 --- a/tests/hlsl/dxsdk/HDRToneMappingCS11/FilterCS.hlsl +++ /dev/null @@ -1,73 +0,0 @@ -//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues. -//TEST:COMPARE_HLSL: -profile cs_4_0 -entry CSVerticalFilter -entry CSHorizFilter -//-------------------------------------------------------------------------------------- -// File: FilterCS.hlsl -// -// The CSs for doing vertical and horizontal blur, used in CS path of -// HDRToneMappingCS11 sample -// -// Copyright (c) Microsoft Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- -StructuredBuffer<float4> InputBuf : register( t0 ); -Texture2D InputTex : register( t1 ); -RWStructuredBuffer<float4> Result : register( u0 ); - -cbuffer cb0 -{ - float4 g_avSampleWeights[15]; - int2 g_outputsize; - int2 g_inputsize; -} - -#define kernelhalf 7 -#define groupthreads 128 -groupshared float4 temp[groupthreads]; - -[numthreads( groupthreads, 1, 1 )] -void CSVerticalFilter( uint3 Gid : SV_GroupID, uint GI : SV_GroupIndex ) -{ - int offsety = GI - kernelhalf + (groupthreads - kernelhalf * 2) * Gid.y; - offsety = clamp( offsety, 0, g_inputsize.y-1 ); - int offset = Gid.x + offsety * g_inputsize.x; - temp[GI] = InputBuf[offset]; - - GroupMemoryBarrierWithGroupSync(); - - // Vertical blur - if ( GI >= kernelhalf && - GI < (groupthreads - kernelhalf) && - ( (GI - kernelhalf + (groupthreads - kernelhalf * 2) * Gid.y) < g_outputsize.y) ) - { - float4 vOut = 0; - - [unroll] - for ( int i = -kernelhalf; i <= kernelhalf; ++i ) - vOut += temp[GI + i] * g_avSampleWeights[i + kernelhalf]; - - Result[Gid.x + (GI - kernelhalf + (groupthreads - kernelhalf * 2) * Gid.y) * g_outputsize.x] = float4(vOut.rgb, 1.0f); - } -} - -[numthreads( groupthreads, 1, 1 )] -void CSHorizFilter( uint3 Gid : SV_GroupID, uint GI : SV_GroupIndex ) -{ - int2 coord = int2( GI - kernelhalf + (groupthreads - kernelhalf * 2) * Gid.x, Gid.y ); - coord = clamp( coord, int2(0, 0), int2(g_inputsize.x-1, g_inputsize.y-1) ); - temp[GI] = InputTex.Load( int3(coord, 0) ); - - GroupMemoryBarrierWithGroupSync(); - - // Horizontal blur - if ( GI >= kernelhalf && - GI < (groupthreads - kernelhalf) && - ( (Gid.x * (groupthreads - 2 * kernelhalf) + GI - kernelhalf) < g_outputsize.x) ) - { - float4 vOut = 0; - - [unroll] - for ( int i = -kernelhalf; i <= kernelhalf; ++i ) - vOut += temp[GI + i] * g_avSampleWeights[i + kernelhalf]; - - Result[GI - kernelhalf + (groupthreads - kernelhalf * 2) * Gid.x + Gid.y * g_outputsize.x] = float4(vOut.rgb, 1.0f); - } -} diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/FinalPass.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/FinalPass.hlsl deleted file mode 100644 index f5a49d2eb..000000000 --- a/tests/hlsl/dxsdk/HDRToneMappingCS11/FinalPass.hlsl +++ /dev/null @@ -1,79 +0,0 @@ -//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues. -//TEST:COMPARE_HLSL: -profile vs_4_0 -entry QuadVS -profile ps_4_0 -entry PSFinalPass -entry PSFinalPassForCPUReduction -//-------------------------------------------------------------------------------------- -// File: FinalPass.hlsl -// -// The PSs for doing tone-mapping based on the input luminance, used in CS path of -// HDRToneMappingCS11 sample -// -// Copyright (c) Microsoft Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- -struct QuadVS_Input -{ - float4 Pos : POSITION; - float2 Tex : TEXCOORD0; -}; - -struct QuadVS_Output -{ - float4 Pos : SV_POSITION; - float2 Tex : TEXCOORD0; -}; - -QuadVS_Output QuadVS( QuadVS_Input Input ) -{ - QuadVS_Output Output; - Output.Pos = Input.Pos; - Output.Tex = Input.Tex; - return Output; -} - -Texture2D<float4> tex : register( t0 ); -StructuredBuffer<float> lum : register( t1 ); -Texture2D<float4> bloom : register( t2 ); - -SamplerState PointSampler : register (s0); -SamplerState LinearSampler : register (s1); - - -static const float MIDDLE_GRAY = 0.72f; -static const float LUM_WHITE = 1.5f; - -cbuffer cbPS : register( b0 ) -{ - float4 g_param; -}; - -float4 PSFinalPass( QuadVS_Output Input ) : SV_TARGET -{ - float4 vColor = tex.Sample( PointSampler, Input.Tex ); - float fLum = lum[0]*g_param.x; - float3 vBloom = bloom.Sample( LinearSampler, Input.Tex ); - - // Tone mapping - vColor.rgb *= MIDDLE_GRAY / (fLum + 0.001f); - vColor.rgb *= (1.0f + vColor/LUM_WHITE); - vColor.rgb /= (1.0f + vColor); - - vColor.rgb += 0.6f * vBloom; - vColor.a = 1.0f; - - return vColor; -} - -float4 PSFinalPassForCPUReduction( QuadVS_Output Input ) : SV_TARGET -{ - float4 vColor = tex.Sample( PointSampler, Input.Tex ); - float fLum = g_param.x; - float3 vBloom = bloom.Sample( LinearSampler, Input.Tex ); - - // Tone mapping - vColor.rgb *= MIDDLE_GRAY / (fLum + 0.001f); - vColor.rgb *= (1.0f + vColor/LUM_WHITE); - vColor.rgb /= (1.0f + vColor); - - vColor.rgb += 0.6f * vBloom; - vColor.a = 1.0f; - - return vColor; -} diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/PSApproach.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/PSApproach.hlsl deleted file mode 100644 index 3f16b2449..000000000 --- a/tests/hlsl/dxsdk/HDRToneMappingCS11/PSApproach.hlsl +++ /dev/null @@ -1,129 +0,0 @@ -//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues. -//TEST:COMPARE_HLSL: -profile ps_4_0 -entry DownScale2x2_Lum -entry DownScale3x3 -entry FinalPass -entry DownScale3x3_BrightPass -entry Bloom -//-------------------------------------------------------------------------------------- -// File: PSApproach.hlsl -// -// The PSs for doing post-processing, used in PS path of -// HDRToneMappingCS11 sample -// -// Copyright (c) Microsoft Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- -static const float4 LUM_VECTOR = float4(.299, .587, .114, 0); -static const float MIDDLE_GRAY = 0.72f; -static const float LUM_WHITE = 1.5f; -static const float BRIGHT_THRESHOLD = 0.5f; - -SamplerState PointSampler : register (s0); -SamplerState LinearSampler : register (s1); - -struct QuadVS_Output -{ - float4 Pos : SV_POSITION; - float2 Tex : TEXCOORD0; -}; - -Texture2D s0 : register(t0); -Texture2D s1 : register(t1); -Texture2D s2 : register(t2); - -float4 DownScale2x2_Lum ( QuadVS_Output Input ) : SV_TARGET -{ - float4 vColor = 0.0f; - float fAvg = 0.0f; - - for( int y = -1; y < 1; y++ ) - { - for( int x = -1; x < 1; x++ ) - { - // Compute the sum of color values - vColor = s0.Sample( PointSampler, Input.Tex, int2(x,y) ); - - fAvg += dot( vColor, LUM_VECTOR ); - } - } - - fAvg /= 4; - - return float4(fAvg, fAvg, fAvg, 1.0f); -} - -float4 DownScale3x3( QuadVS_Output Input ) : SV_TARGET -{ - float fAvg = 0.0f; - float4 vColor; - - for( int y = -1; y <= 1; y++ ) - { - for( int x = -1; x <= 1; x++ ) - { - // Compute the sum of color values - vColor = s0.Sample( PointSampler, Input.Tex, int2(x,y) ); - - fAvg += vColor.r; - } - } - - // Divide the sum to complete the average - fAvg /= 9; - - return float4(fAvg, fAvg, fAvg, 1.0f); -} - -float4 FinalPass( QuadVS_Output Input ) : SV_TARGET -{ - //float4 vColor = 0; - float4 vColor = s0.Sample( PointSampler, Input.Tex ); - float4 vLum = s1.Sample( PointSampler, float2(0,0) ); - float3 vBloom = s2.Sample( LinearSampler, Input.Tex ); - - // Tone mapping - vColor.rgb *= MIDDLE_GRAY / (vLum.r + 0.001f); - vColor.rgb *= (1.0f + vColor/LUM_WHITE); - vColor.rgb /= (1.0f + vColor); - - vColor.rgb += 0.6f * vBloom; - vColor.a = 1.0f; - - return vColor; -} - -float4 DownScale3x3_BrightPass( QuadVS_Output Input ) : SV_TARGET -{ - float3 vColor = 0.0f; - float4 vLum = s1.Sample( PointSampler, float2(0, 0) ); - float fLum = vLum.r; - - vColor = s0.Sample( PointSampler, Input.Tex ).rgb; - - // Bright pass and tone mapping - vColor = max( 0.0f, vColor - BRIGHT_THRESHOLD ); - vColor *= MIDDLE_GRAY / (fLum + 0.001f); - vColor *= (1.0f + vColor/LUM_WHITE); - vColor /= (1.0f + vColor); - - return float4(vColor, 1.0f); -} - -cbuffer cb0 -{ - float2 g_avSampleOffsets[15]; - float4 g_avSampleWeights[15]; -} - -float4 Bloom( QuadVS_Output Input ) : SV_TARGET -{ - float4 vSample = 0.0f; - float4 vColor = 0.0f; - float2 vSamplePosition; - - for( int iSample = 0; iSample < 15; iSample++ ) - { - // Sample from adjacent points - vSamplePosition = Input.Tex + g_avSampleOffsets[iSample]; - vColor = s0.Sample( PointSampler, vSamplePosition); - - vSample += g_avSampleWeights[iSample]*vColor; - } - - return vSample; -} diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceTo1DCS.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceTo1DCS.hlsl deleted file mode 100644 index 1316250d5..000000000 --- a/tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceTo1DCS.hlsl +++ /dev/null @@ -1,72 +0,0 @@ -//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues. -//TEST:COMPARE_HLSL: -profile cs_4_0 -entry CSMain -//----------------------------------------------------------------------------- -// File: ReduceTo1DCS.hlsl -// -// Desc: Reduce an input Texture2D to a buffer -// -// Copyright (c) Microsoft Corporation. All rights reserved. -//----------------------------------------------------------------------------- -Texture2D Input : register( t0 ); -RWStructuredBuffer<float> Result : register( u0 ); - -cbuffer cbCS : register( b0 ) -{ - uint4 g_param; // (g_param.x, g_param.y) is the x and y dimensions of the Dispatch call - // (g_param.z, g_param.w) is the size of the above Input Texture2D -}; - -//#define CS_FULL_PIXEL_REDUCITON // Defining this or not must be the same as in HDRToneMappingCS11.cpp - -#define blocksize 8 -#define blocksizeY 8 -#define groupthreads (blocksize*blocksizeY) -groupshared float accum[groupthreads]; - -static const float4 LUM_VECTOR = float4(.299, .587, .114, 0); - -[numthreads(blocksize,blocksizeY,1)] -void CSMain( uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint GI : SV_GroupIndex ) -{ - float4 s = -#ifdef CS_FULL_PIXEL_REDUCITON - Input.Load( uint3(DTid.xy , 0) )+ - Input.Load( uint3(DTid.xy + uint2(blocksize*g_param.x, 0), 0) ) + - Input.Load( uint3(DTid.xy + uint2(0, blocksizeY*g_param.y), 0) ) + - Input.Load( uint3(DTid.xy + uint2(blocksize*g_param.x, blocksizeY*g_param.y), 0) ); -#else - Input.Load( uint3((float)DTid.x/81.0f*g_param.z, (float)DTid.y/81.0f*g_param.w, 0) ); -#endif - - accum[GI] = dot( s, LUM_VECTOR ); - - // Parallel reduction algorithm follows - GroupMemoryBarrierWithGroupSync(); - if ( GI < 32 ) - accum[GI] += accum[32+GI]; - - GroupMemoryBarrierWithGroupSync(); - if ( GI < 16 ) - accum[GI] += accum[16+GI]; - - GroupMemoryBarrierWithGroupSync(); - if ( GI < 8 ) - accum[GI] += accum[8+GI]; - - GroupMemoryBarrierWithGroupSync(); - if ( GI < 4 ) - accum[GI] += accum[4+GI]; - - GroupMemoryBarrierWithGroupSync(); - if ( GI < 2 ) - accum[GI] += accum[2+GI]; - - GroupMemoryBarrierWithGroupSync(); - if ( GI < 1 ) - accum[GI] += accum[1+GI]; - - if ( GI == 0 ) - { - Result[Gid.y*g_param.x+Gid.x] = accum[0]; - } -} diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceToSingleCS.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceToSingleCS.hlsl deleted file mode 100644 index 73857a6bb..000000000 --- a/tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceToSingleCS.hlsl +++ /dev/null @@ -1,63 +0,0 @@ -//TEST_DISABLED:COMPARE_HLSL:-no-mangle -profile cs_4_0 -entry CSMain -//----------------------------------------------------------------------------- -// File: ReduceToSingleCS.hlsl -// -// Desc: Reduce an input buffer by a factor of groupthreads -// -// Copyright (c) Microsoft Corporation. All rights reserved. -//----------------------------------------------------------------------------- - -StructuredBuffer<float> Input : register( t0 ); -RWStructuredBuffer<float> Result : register( u0 ); - -cbuffer cbCS : register( b0 ) -{ - uint4 g_param; // g_param.x is the actual elements contained in Input - // g_param.y is the x dimension of the Dispatch call -}; - -#define groupthreads 128 -groupshared float accum[groupthreads]; - -[numthreads(groupthreads,1,1)] -void CSMain( uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint GI : SV_GroupIndex ) -{ - if ( DTid.x < g_param.x ) - accum[GI] = Input[DTid.x]; - else - accum[GI] = 0; - - // Parallel reduction algorithm follows - GroupMemoryBarrierWithGroupSync(); - if ( GI < 64 ) - accum[GI] += accum[64+GI]; - - GroupMemoryBarrierWithGroupSync(); - if ( GI < 32 ) - accum[GI] += accum[32+GI]; - - GroupMemoryBarrierWithGroupSync(); - if ( GI < 16 ) - accum[GI] += accum[16+GI]; - - GroupMemoryBarrierWithGroupSync(); - if ( GI < 8 ) - accum[GI] += accum[8+GI]; - - GroupMemoryBarrierWithGroupSync(); - if ( GI < 4 ) - accum[GI] += accum[4+GI]; - - GroupMemoryBarrierWithGroupSync(); - if ( GI < 2 ) - accum[GI] += accum[2+GI]; - - GroupMemoryBarrierWithGroupSync(); - if ( GI < 1 ) - accum[GI] += accum[1+GI]; - - if ( GI == 0 ) - { - Result[Gid.x] = accum[0]; - } -} diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/skybox11.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/skybox11.hlsl deleted file mode 100644 index a0e44ba95..000000000 --- a/tests/hlsl/dxsdk/HDRToneMappingCS11/skybox11.hlsl +++ /dev/null @@ -1,44 +0,0 @@ -//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues. -//TEST:COMPARE_HLSL: -profile vs_4_0 -entry SkyboxVS -profile ps_4_0 -entry SkyboxPS -//----------------------------------------------------------------------------- -// File: SkyBox11.hlsl -// -// Desc: -// -// Copyright (c) Microsoft Corporation. All rights reserved. -//----------------------------------------------------------------------------- - -cbuffer cbPerObject : register( b0 ) -{ - row_major matrix g_mWorldViewProjection : packoffset( c0 ); -} - -TextureCube g_EnvironmentTexture : register( t0 ); -SamplerState g_sam : register( s0 ); - -struct SkyboxVS_Input -{ - float4 Pos : POSITION; -}; - -struct SkyboxVS_Output -{ - float4 Pos : SV_POSITION; - float3 Tex : TEXCOORD0; -}; - -SkyboxVS_Output SkyboxVS( SkyboxVS_Input Input ) -{ - SkyboxVS_Output Output; - - Output.Pos = Input.Pos; - Output.Tex = normalize( mul(Input.Pos, g_mWorldViewProjection) ); - - return Output; -} - -float4 SkyboxPS( SkyboxVS_Output Input ) : SV_TARGET -{ - float4 color = g_EnvironmentTexture.Sample( g_sam, Input.Tex ); - return color; -} |
