DumpToTexture.hlsl 979 B

1234567891011121314151617181920212223242526272829303132
  1. // RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s
  2. // CHECK: bufferLoad
  3. // CHECK: storeOutput
  4. //--------------------------------------------------------------------------------------
  5. // File: DumpToTexture.hlsl
  6. //
  7. // The PS for converting CS output buffer to a texture, used in CS path of
  8. // HDRToneMappingCS11 sample
  9. //
  10. // Copyright (c) Microsoft Corporation. All rights reserved.
  11. //--------------------------------------------------------------------------------------
  12. StructuredBuffer<float4> buffer : register( t0 );
  13. struct QuadVS_Output
  14. {
  15. float4 Pos : SV_POSITION;
  16. float2 Tex : TEXCOORD0;
  17. };
  18. cbuffer cbPS : register( b0 )
  19. {
  20. uint4 g_param;
  21. };
  22. float4 main( QuadVS_Output Input ) : SV_TARGET
  23. {
  24. // To calculate the buffer offset, it is natural to use the screen space coordinates,
  25. // Input.Pos is the screen space coordinates of the pixel being written
  26. return buffer[ (Input.Pos.x - 0.5) + (Input.Pos.y - 0.5) * g_param.x ];
  27. }