Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40a069f

Browse files
committed
remove superfluous transitions from multisampling
1 parent fa4079e commit 40a069f

1 file changed

Lines changed: 0 additions & 21 deletions

File tree

fr/10_Multisampling.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ void createColorResources() {
119119

120120
createImage(swapChainExtent.width, swapChainExtent.height, 1, msaaSamples, colorFormat, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, colorImage, colorImageMemory);
121121
colorImageView = createImageView(colorImage, colorFormat, VK_IMAGE_ASPECT_COLOR_BIT, 1);
122-
123-
transitionImageLayout(colorImage, colorFormat, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, 1);
124122
}
125123
```
126124

@@ -135,25 +133,6 @@ void initVulkan() {
135133
}
136134
```
137135

138-
Remarquez la transition de `VK_IMAGE_LAYOUT_UNDEFINED` vers `VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL`, que nous devons
139-
gérer d'une nouvelle façon. Mettons à jour la fonction `transitionImageLayout` :
140-
141-
```c++
142-
void transitionImageLayout(VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t mipLevels) {
143-
...
144-
else if (oldLayout == VK_IMAGE_LAYOUT_UNDEFINED && newLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
145-
barrier.srcAccessMask = 0;
146-
barrier.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
147-
sourceStage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
148-
destinationStage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
149-
}
150-
else {
151-
throw std::invalid_argument("transition d'organisation non supportée!");
152-
}
153-
...
154-
}
155-
```
156-
157136
Nous avons maintenant un buffer de couleurs qui utilise le multisampling. Occupons-nous maintenant de la profondeur.
158137
Modifiez `createDepthResources` et changez le nombre de samples utilisé :
159138

0 commit comments

Comments
 (0)