d3dx12_render_pass.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //*********************************************************
  2. //
  3. // Copyright (c) Microsoft Corporation.
  4. // Licensed under the MIT License (MIT).
  5. //
  6. //*********************************************************
  7. #pragma once
  8. #ifndef __cplusplus
  9. #error D3DX12 requires C++
  10. #endif
  11. #include "d3d12.h"
  12. #if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
  13. inline bool operator==(const D3D12_RENDER_PASS_BEGINNING_ACCESS_PRESERVE_LOCAL_PARAMETERS& a, const D3D12_RENDER_PASS_ENDING_ACCESS_PRESERVE_LOCAL_PARAMETERS& b) noexcept
  14. {
  15. return ((a.AdditionalWidth == b.AdditionalWidth) && (a.AdditionalHeight == b.AdditionalHeight));
  16. }
  17. inline bool operator==(const D3D12_RENDER_PASS_BEGINNING_ACCESS_PRESERVE_LOCAL_PARAMETERS& a, const D3D12_RENDER_PASS_BEGINNING_ACCESS_PRESERVE_LOCAL_PARAMETERS& b) noexcept
  18. {
  19. return ((a.AdditionalWidth == b.AdditionalWidth) && (a.AdditionalHeight == b.AdditionalHeight));
  20. }
  21. inline bool operator==(const D3D12_RENDER_PASS_ENDING_ACCESS_PRESERVE_LOCAL_PARAMETERS& a, const D3D12_RENDER_PASS_ENDING_ACCESS_PRESERVE_LOCAL_PARAMETERS& b) noexcept
  22. {
  23. return ((a.AdditionalWidth == b.AdditionalWidth) && (a.AdditionalHeight == b.AdditionalHeight));
  24. }
  25. #endif
  26. inline bool operator==( const D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS &a, const D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS &b) noexcept
  27. {
  28. return a.ClearValue == b.ClearValue;
  29. }
  30. inline bool operator==( const D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS &a, const D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS &b) noexcept
  31. {
  32. if (a.pSrcResource != b.pSrcResource) return false;
  33. if (a.pDstResource != b.pDstResource) return false;
  34. if (a.SubresourceCount != b.SubresourceCount) return false;
  35. if (a.Format != b.Format) return false;
  36. if (a.ResolveMode != b.ResolveMode) return false;
  37. if (a.PreserveResolveSource != b.PreserveResolveSource) return false;
  38. return true;
  39. }
  40. inline bool operator==( const D3D12_RENDER_PASS_BEGINNING_ACCESS &a, const D3D12_RENDER_PASS_BEGINNING_ACCESS &b) noexcept
  41. {
  42. if (a.Type != b.Type) return false;
  43. switch (a.Type)
  44. {
  45. case D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR:
  46. if (!(a.Clear == b.Clear)) return false;
  47. break;
  48. #if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
  49. case D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE_LOCAL_RENDER:
  50. case D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE_LOCAL_SRV:
  51. case D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE_LOCAL_UAV:
  52. if (!(a.PreserveLocal == b.PreserveLocal)) return false;
  53. break;
  54. #endif
  55. }
  56. return true;
  57. }
  58. inline bool operator==(const D3D12_RENDER_PASS_ENDING_ACCESS& a, const D3D12_RENDER_PASS_ENDING_ACCESS& b) noexcept
  59. {
  60. if (a.Type != b.Type) return false;
  61. switch (a.Type)
  62. {
  63. case D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_RESOLVE:
  64. if (!(a.Resolve == b.Resolve)) return false;
  65. break;
  66. #if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
  67. case D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE_LOCAL_RENDER:
  68. case D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE_LOCAL_SRV:
  69. case D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE_LOCAL_UAV:
  70. if (!(a.PreserveLocal == b.PreserveLocal)) return false;
  71. break;
  72. #endif
  73. }
  74. return true;
  75. }
  76. inline bool operator==( const D3D12_RENDER_PASS_RENDER_TARGET_DESC &a, const D3D12_RENDER_PASS_RENDER_TARGET_DESC &b) noexcept
  77. {
  78. if (a.cpuDescriptor.ptr != b.cpuDescriptor.ptr) return false;
  79. if (!(a.BeginningAccess == b.BeginningAccess)) return false;
  80. if (!(a.EndingAccess == b.EndingAccess)) return false;
  81. return true;
  82. }
  83. inline bool operator==( const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC &a, const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC &b) noexcept
  84. {
  85. if (a.cpuDescriptor.ptr != b.cpuDescriptor.ptr) return false;
  86. if (!(a.DepthBeginningAccess == b.DepthBeginningAccess)) return false;
  87. if (!(a.StencilBeginningAccess == b.StencilBeginningAccess)) return false;
  88. if (!(a.DepthEndingAccess == b.DepthEndingAccess)) return false;
  89. if (!(a.StencilEndingAccess == b.StencilEndingAccess)) return false;
  90. return true;
  91. }