PassData.cpp 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <Atom/RPI.Reflect/Pass/PassData.h>
  9. #include <Atom/RPI.Reflect/Pass/ComputePassData.h>
  10. #include <Atom/RPI.Reflect/Pass/CopyPassData.h>
  11. #include <Atom/RPI.Reflect/Pass/DownsampleMipChainPassData.h>
  12. #include <Atom/RPI.Reflect/Pass/EnvironmentCubeMapPassData.h>
  13. #include <Atom/RPI.Reflect/Pass/FullscreenTrianglePassData.h>
  14. #include <Atom/RPI.Reflect/Pass/RasterPassData.h>
  15. #include <Atom/RPI.Reflect/Pass/RenderPassData.h>
  16. #include <Atom/RPI.Reflect/Pass/RenderToTexturePassData.h>
  17. #include <Atom/RPI.Reflect/Pass/SlowClearPassData.h>
  18. #include <AzCore/Serialization/SerializeContext.h>
  19. namespace AZ
  20. {
  21. namespace RPI
  22. {
  23. void SlowClearPassData::Reflect(AZ::ReflectContext* context)
  24. {
  25. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  26. {
  27. serializeContext->Class<SlowClearPassData, RenderPassData>()
  28. ->Version(0)
  29. ->Field("ClearValue", &SlowClearPassData::m_clearValue)
  30. ;
  31. }
  32. }
  33. void RenderToTexturePassData::Reflect(ReflectContext* context)
  34. {
  35. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  36. {
  37. serializeContext->Class<RenderToTexturePassData, PassData>()
  38. ->Version(0)
  39. ->Field("OutputWidth", &RenderToTexturePassData::m_width)
  40. ->Field("OutputHeight", &RenderToTexturePassData::m_height)
  41. ->Field("OutputFormat", &RenderToTexturePassData::m_format);
  42. }
  43. }
  44. void RenderPassData::Reflect(ReflectContext* context)
  45. {
  46. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  47. {
  48. serializeContext->Class<RenderPassData, PassData>()
  49. ->Version(2)
  50. ->Field("BindViewSrg", &RenderPassData::m_bindViewSrg)
  51. ->Field("ShaderDataMappings", &RenderPassData::m_mappings);
  52. }
  53. }
  54. void RasterPassData::Reflect(ReflectContext* context)
  55. {
  56. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  57. {
  58. serializeContext->Class<RasterPassData, RenderPassData>()
  59. ->Version(5) // antonmic: added m_enableDrawItemsByDefault
  60. ->Field("DrawListTag", &RasterPassData::m_drawListTag)
  61. ->Field("PassSrgShaderAsset", &RasterPassData::m_passSrgShaderReference)
  62. ->Field("Viewport", &RasterPassData::m_overrideViewport)
  63. ->Field("Scissor", &RasterPassData::m_overrideScissor)
  64. ->Field("DrawListSortType", &RasterPassData::m_drawListSortType)
  65. ->Field("ViewportScissorTargetOutputIndex", &RasterPassData::m_viewportAndScissorTargetOutputIndex)
  66. ->Field("EnableDrawItemsByDefault", &RasterPassData::m_enableDrawItemsByDefault)
  67. ;
  68. }
  69. }
  70. void PipelineGlobalConnection::Reflect(ReflectContext* context)
  71. {
  72. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  73. {
  74. serializeContext->Class<PipelineGlobalConnection>()
  75. ->Version(1)
  76. ->Field("GlobalName", &PipelineGlobalConnection::m_globalName)
  77. ->Field("Slot", &PipelineGlobalConnection::m_localBinding);
  78. }
  79. }
  80. void PassData::Reflect(ReflectContext* context)
  81. {
  82. PipelineGlobalConnection::Reflect(context);
  83. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  84. {
  85. serializeContext->Class<PassData>()
  86. ->Version(3)
  87. ->Field("DeviceIndex", &PassData::m_deviceIndex)
  88. ->Field("PipelineViewTag", &PassData::m_pipelineViewTag)
  89. ->Field("PipelineGlobalConnections", &PassData::m_pipelineGlobalConnections)
  90. ->Field("MergeChildrenAsSubpasses", &PassData::m_mergeChildrenAsSubpasses)
  91. ->Field("CanBeSubpass", &PassData::m_canBecomeASubpass)
  92. ;
  93. }
  94. }
  95. void FullscreenTrianglePassData::Reflect(ReflectContext* context)
  96. {
  97. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  98. {
  99. serializeContext->Class<FullscreenTrianglePassData, RenderPassData>()
  100. ->Version(0)
  101. ->Field("ShaderAsset", &FullscreenTrianglePassData::m_shaderAsset)
  102. ->Field("StencilRef", &FullscreenTrianglePassData::m_stencilRef);
  103. }
  104. }
  105. void EnvironmentCubeMapPassData::Reflect(ReflectContext* context)
  106. {
  107. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  108. {
  109. serializeContext->Class<EnvironmentCubeMapPassData, PassData>()
  110. ->Version(0)
  111. ->Field("Position", &EnvironmentCubeMapPassData::m_position)
  112. ;
  113. }
  114. }
  115. void DownsampleMipChainPassData::Reflect(ReflectContext* context)
  116. {
  117. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  118. {
  119. serializeContext->Class<DownsampleMipChainPassData, PassData>()
  120. ->Version(0)
  121. ->Field("ShaderAsset", &DownsampleMipChainPassData::m_shaderReference)
  122. ;
  123. }
  124. }
  125. void CopyPassData::Reflect(ReflectContext* context)
  126. {
  127. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  128. {
  129. serializeContext->Class<CopyPassData, PassData>()
  130. ->Version(1)
  131. ->Field("BufferSize", &CopyPassData::m_bufferSize)
  132. ->Field("BufferSourceOffset", &CopyPassData::m_bufferSourceOffset)
  133. ->Field("BufferSourceBytesPerRow", &CopyPassData::m_bufferSourceBytesPerRow)
  134. ->Field("BufferSourceBytesPerImage", &CopyPassData::m_bufferSourceBytesPerImage)
  135. ->Field("BufferDestinationOffset", &CopyPassData::m_bufferDestinationOffset)
  136. ->Field("BufferDestinationBytesPerRow", &CopyPassData::m_bufferDestinationBytesPerRow)
  137. ->Field("BufferDestinationBytesPerImage", &CopyPassData::m_bufferDestinationBytesPerImage)
  138. ->Field("ImageSourceSize", &CopyPassData::m_sourceSize)
  139. ->Field("ImageSourceSubresource", &CopyPassData::m_imageSourceSubresource)
  140. ->Field("ImageSourceOrigin", &CopyPassData::m_imageSourceOrigin)
  141. ->Field("ImageDestinationSubresource", &CopyPassData::m_imageDestinationSubresource)
  142. ->Field("ImageDestinationOrigin", &CopyPassData::m_imageDestinationOrigin)
  143. ->Field("SourceDeviceIndex", &CopyPassData::m_sourceDeviceIndex)
  144. ->Field("DestinationDeviceIndex", &CopyPassData::m_destinationDeviceIndex)
  145. ->Field("CloneInput", &CopyPassData::m_cloneInput)
  146. ->Field("UseCopyQueue", &CopyPassData::m_useCopyQueue);
  147. }
  148. }
  149. void ComputePassData::Reflect(ReflectContext* context)
  150. {
  151. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  152. {
  153. serializeContext->Class<ComputePassData, RenderPassData>()
  154. ->Version(3)
  155. ->Field("ShaderAsset", &ComputePassData::m_shaderReference)
  156. ->Field("ThreadCountX", &ComputePassData::m_totalNumberOfThreadsX)
  157. ->Field("ThreadCountY", &ComputePassData::m_totalNumberOfThreadsY)
  158. ->Field("ThreadCountZ", &ComputePassData::m_totalNumberOfThreadsZ)
  159. ->Field("FullscreenDispatch", &ComputePassData::m_fullscreenDispatch)
  160. ->Field("FullscreenSizeSourceSlotName", &ComputePassData::m_fullscreenSizeSourceSlotName)
  161. ->Field("IndirectDispatch", &ComputePassData::m_indirectDispatch)
  162. ->Field("IndirectDispatchBufferSlotName", &ComputePassData::m_indirectDispatchBufferSlotName)
  163. ->Field("UseAsyncCompute", &ComputePassData::m_useAsyncCompute);
  164. }
  165. }
  166. } // namespace RPI
  167. } // namespace AZ