ffx_fsr2_private.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // This file is part of the FidelityFX SDK.
  2. //
  3. // Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to deal
  7. // in the Software without restriction, including without limitation the rights
  8. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. // copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. #pragma once
  22. // Constants for FSR2 DX12 dispatches. Must be kept in sync with cbFSR2 in ffx_fsr2_callbacks_hlsl.h
  23. typedef struct Fsr2Constants {
  24. int32_t renderSize[2];
  25. int32_t maxRenderSize[2];
  26. int32_t displaySize[2];
  27. int32_t inputColorResourceDimensions[2];
  28. int32_t lumaMipDimensions[2];
  29. int32_t lumaMipLevelToUse;
  30. int32_t frameIndex;
  31. float deviceToViewDepth[4];
  32. float jitterOffset[2];
  33. float motionVectorScale[2];
  34. float downscaleFactor[2];
  35. float motionVectorJitterCancellation[2];
  36. float preExposure;
  37. float previousFramePreExposure;
  38. float tanHalfFOV;
  39. float jitterPhaseCount;
  40. float deltaTime;
  41. float dynamicResChangeFactor;
  42. float viewSpaceToMetersFactor;
  43. // -- GODOT start --
  44. float pad;
  45. float reprojectionMatrix[16];
  46. // -- GODOT end --
  47. } Fsr2Constants;
  48. struct FfxFsr2ContextDescription;
  49. struct FfxDeviceCapabilities;
  50. struct FfxPipelineState;
  51. struct FfxResource;
  52. // FfxFsr2Context_Private
  53. // The private implementation of the FSR2 context.
  54. typedef struct FfxFsr2Context_Private {
  55. FfxFsr2ContextDescription contextDescription;
  56. Fsr2Constants constants;
  57. FfxDevice device;
  58. FfxDeviceCapabilities deviceCapabilities;
  59. FfxPipelineState pipelineDepthClip;
  60. FfxPipelineState pipelineReconstructPreviousDepth;
  61. FfxPipelineState pipelineLock;
  62. FfxPipelineState pipelineAccumulate;
  63. FfxPipelineState pipelineAccumulateSharpen;
  64. FfxPipelineState pipelineRCAS;
  65. FfxPipelineState pipelineComputeLuminancePyramid;
  66. FfxPipelineState pipelineGenerateReactive;
  67. FfxPipelineState pipelineTcrAutogenerate;
  68. // 2 arrays of resources, as e.g. FFX_FSR2_RESOURCE_IDENTIFIER_LOCK_STATUS will use different resources when bound as SRV vs when bound as UAV
  69. FfxResourceInternal srvResources[FFX_FSR2_RESOURCE_IDENTIFIER_COUNT];
  70. FfxResourceInternal uavResources[FFX_FSR2_RESOURCE_IDENTIFIER_COUNT];
  71. bool firstExecution;
  72. bool refreshPipelineStates;
  73. uint32_t resourceFrameIndex;
  74. float previousJitterOffset[2];
  75. int32_t jitterPhaseCountRemaining;
  76. } FfxFsr2Context_Private;