|
1 | 1 | /* |
2 | | - * Copyright 2019-2024 Diligent Graphics LLC |
| 2 | + * Copyright 2019-2025 Diligent Graphics LLC |
3 | 3 | * Copyright 2015-2019 Egor Yusov |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
@@ -2210,4 +2210,35 @@ VkComponentMapping TextureComponentMappingToVkComponentMapping(const TextureComp |
2210 | 2210 | }; |
2211 | 2211 | } |
2212 | 2212 |
|
| 2213 | +VkPipelineRenderingCreateInfoKHR GraphicsPipelineDesc_To_VkPipelineRenderingCreateInfo(const GraphicsPipelineDesc& PipelineDesc, |
| 2214 | + std::vector<VkFormat>& ColorAttachmentFormats) |
| 2215 | +{ |
| 2216 | + VkPipelineRenderingCreateInfoKHR PipelineRenderingCI{}; |
| 2217 | + PipelineRenderingCI.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR; |
| 2218 | + PipelineRenderingCI.pNext = nullptr; |
| 2219 | + PipelineRenderingCI.viewMask = (1u << PipelineDesc.NumViewports) - 1u; |
| 2220 | + |
| 2221 | + PipelineRenderingCI.colorAttachmentCount = PipelineDesc.NumRenderTargets; |
| 2222 | + ColorAttachmentFormats.resize(PipelineDesc.NumRenderTargets); |
| 2223 | + for (Uint32 rt = 0; rt < PipelineDesc.NumRenderTargets; ++rt) |
| 2224 | + { |
| 2225 | + TEXTURE_FORMAT RTVFormat = PipelineDesc.RTVFormats[rt]; |
| 2226 | + ColorAttachmentFormats[rt] = TexFormatToVkFormat(RTVFormat); |
| 2227 | + } |
| 2228 | + PipelineRenderingCI.pColorAttachmentFormats = ColorAttachmentFormats.data(); |
| 2229 | + |
| 2230 | + TEXTURE_FORMAT DSVFormat = PipelineDesc.DSVFormat; |
| 2231 | + if (DSVFormat != TEX_FORMAT_UNKNOWN) |
| 2232 | + { |
| 2233 | + PipelineRenderingCI.depthAttachmentFormat = TexFormatToVkFormat(DSVFormat); |
| 2234 | + const TextureFormatAttribs& FmtAttribs = GetTextureFormatAttribs(DSVFormat); |
| 2235 | + if (FmtAttribs.ComponentType == COMPONENT_TYPE_DEPTH_STENCIL) |
| 2236 | + { |
| 2237 | + PipelineRenderingCI.stencilAttachmentFormat = PipelineRenderingCI.depthAttachmentFormat; |
| 2238 | + } |
| 2239 | + } |
| 2240 | + |
| 2241 | + return PipelineRenderingCI; |
| 2242 | +} |
| 2243 | + |
2213 | 2244 | } // namespace Diligent |
0 commit comments