2
0

SharpeningUpsamplePS.hlsl 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // RUN: %dxc -E main -T ps_6_0 -O0 %s | FileCheck %s
  2. // CHECK: sampleLevel
  3. // CHECK: sampleLevel
  4. // CHECK: sampleLevel
  5. // CHECK: sampleLevel
  6. // CHECK: sampleLevel
  7. // CHECK: Log
  8. // CHECK: Exp
  9. //
  10. // Copyright (c) Microsoft. All rights reserved.
  11. // This code is licensed under the MIT License (MIT).
  12. // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
  13. // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
  14. // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
  15. // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
  16. //
  17. // Developed by Minigraph
  18. //
  19. // Author: James Stanard
  20. //
  21. //--------------------------------------------------------------------------------------
  22. // Simple bicubic filter
  23. //
  24. // http://en.wikipedia.org/wiki/Bicubic_interpolation
  25. // http://http.developer.nvidia.com/GPUGems/gpugems_ch24.html
  26. //
  27. //--------------------------------------------------------------------------------------
  28. #include "ShaderUtility.hlsli"
  29. #include "PresentRS.hlsli"
  30. Texture2D<float3> ColorTex : register(t0);
  31. SamplerState BilinearClamp : register(s0);
  32. cbuffer Constants : register(b0)
  33. {
  34. float2 UVOffset0;
  35. float2 UVOffset1;
  36. float WA, WB;
  37. }
  38. float3 GetColor(float2 UV)
  39. {
  40. float3 Color = ColorTex.SampleLevel(BilinearClamp, UV, 0);
  41. #ifdef GAMMA_SPACE
  42. return ApplyColorProfile(Color, DISPLAY_PLANE_FORMAT);
  43. #else
  44. return Color;
  45. #endif
  46. }
  47. [RootSignature(Present_RootSig)]
  48. float3 main(float4 position : SV_Position, float2 uv : TexCoord0) : SV_Target0
  49. {
  50. float3 Color = WB * GetColor(uv) - WA * (
  51. GetColor(uv + UVOffset0) + GetColor(uv - UVOffset0) +
  52. GetColor(uv + UVOffset1) + GetColor(uv - UVOffset1));
  53. #ifdef GAMMA_SPACE
  54. return Color;
  55. #else
  56. return ApplyColorProfile(Color, DISPLAY_PLANE_FORMAT);
  57. #endif
  58. }