PSApproach_BloomPS.hlsl 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s
  2. // CHECK: sample
  3. // CHECK: storeOutput
  4. //--------------------------------------------------------------------------------------
  5. // File: PSApproach.hlsl
  6. //
  7. // The PSs for doing post-processing, used in PS path of
  8. // HDRToneMappingCS11 sample
  9. //
  10. // Copyright (c) Microsoft Corporation. All rights reserved.
  11. //--------------------------------------------------------------------------------------
  12. static const float4 LUM_VECTOR = float4(.299, .587, .114, 0);
  13. static const float MIDDLE_GRAY = 0.72f;
  14. static const float LUM_WHITE = 1.5f;
  15. static const float BRIGHT_THRESHOLD = 0.5f;
  16. SamplerState PointSampler : register (s0);
  17. SamplerState LinearSampler : register (s1);
  18. struct QuadVS_Output
  19. {
  20. float4 Pos : SV_POSITION;
  21. float2 Tex : TEXCOORD0;
  22. };
  23. Texture2D s0 : register(t0);
  24. Texture2D s1 : register(t1);
  25. Texture2D s2 : register(t2);
  26. cbuffer cb0
  27. {
  28. float2 g_avSampleOffsets[15];
  29. float4 g_avSampleWeights[15];
  30. }
  31. float4 main( QuadVS_Output Input ) : SV_TARGET
  32. {
  33. float4 vSample = 0.0f;
  34. float4 vColor = 0.0f;
  35. float2 vSamplePosition;
  36. for( int iSample = 0; iSample < 15; iSample++ )
  37. {
  38. // Sample from adjacent points
  39. vSamplePosition = Input.Tex + g_avSampleOffsets[iSample];
  40. vColor = s0.Sample( PointSampler, vSamplePosition);
  41. vSample += g_avSampleWeights[iSample]*vColor;
  42. }
  43. return vSample;
  44. }