Skip to content

Commit 276e850

Browse files
committed
fix multisample code
1 parent c784b6f commit 276e850

File tree

7 files changed

+6
-19
lines changed

7 files changed

+6
-19
lines changed

docs/codes/0600_loadmodel/main.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -915,9 +915,6 @@ class HelloTriangleApplication {
915915

916916
return attributeDescriptions;
917917
}
918-
bool operator==(const Vertex& other) const {
919-
return pos == other.pos && color == other.color && texCoord == other.texCoord;
920-
}
921918
};
922919
/////////////////////////////////////////////////////////////////
923920

docs/codes/0600_loadmodel/main.diff

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ index a209945..6dabfb1 100644
9797
- inline static const std::vector<uint16_t> indices = {
9898
- 0, 1, 2, 2, 3, 0,
9999
- 4, 5, 6, 6, 7, 4
100-
+ bool operator==(const Vertex& other) const {
101-
+ return pos == other.pos && color == other.color && texCoord == other.texCoord;
102-
+ }
103100
};
104101
/////////////////////////////////////////////////////////////////
105102

docs/codes/0700_mipmaps/main.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -921,9 +921,6 @@ class HelloTriangleApplication {
921921

922922
return attributeDescriptions;
923923
}
924-
bool operator==(const Vertex& other) const {
925-
return pos == other.pos && color == other.color && texCoord == other.texCoord;
926-
}
927924
};
928925
/////////////////////////////////////////////////////////////////
929926

docs/codes/0800_multisample/main.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ class HelloTriangleApplication {
544544
vk::AttachmentDescription colorAttachmentResolve;
545545
colorAttachmentResolve.format = m_swapChainImageFormat;
546546
colorAttachmentResolve.samples = vk::SampleCountFlagBits::e1;
547-
colorAttachmentResolve.loadOp = vk::AttachmentLoadOp::eClear;
547+
colorAttachmentResolve.loadOp = vk::AttachmentLoadOp::eDontCare;
548548
colorAttachmentResolve.storeOp = vk::AttachmentStoreOp::eStore;
549549
colorAttachmentResolve.stencilLoadOp = vk::AttachmentLoadOp::eDontCare;
550550
colorAttachmentResolve.stencilStoreOp = vk::AttachmentStoreOp::eDontCare;
@@ -953,9 +953,6 @@ class HelloTriangleApplication {
953953

954954
return attributeDescriptions;
955955
}
956-
bool operator==(const Vertex& other) const {
957-
return pos == other.pos && color == other.color && texCoord == other.texCoord;
958-
}
959956
};
960957
/////////////////////////////////////////////////////////////////
961958

docs/codes/0800_multisample/main.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ index 89a0f11..ad5d479 100644
6262
+ vk::AttachmentDescription colorAttachmentResolve;
6363
+ colorAttachmentResolve.format = m_swapChainImageFormat;
6464
+ colorAttachmentResolve.samples = vk::SampleCountFlagBits::e1;
65-
+ colorAttachmentResolve.loadOp = vk::AttachmentLoadOp::eClear;
65+
+ colorAttachmentResolve.loadOp = vk::AttachmentLoadOp::eDontCare;
6666
+ colorAttachmentResolve.storeOp = vk::AttachmentStoreOp::eStore;
6767
+ colorAttachmentResolve.stencilLoadOp = vk::AttachmentLoadOp::eDontCare;
6868
+ colorAttachmentResolve.stencilStoreOp = vk::AttachmentStoreOp::eDontCare;

docs/md/0800_multisample.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,16 @@ void recreateSwapChain() {
274274
vk::AttachmentDescription colorAttachmentResolve;
275275
colorAttachmentResolve.format = m_swapChainImageFormat;
276276
colorAttachmentResolve.samples = vk::SampleCountFlagBits::e1;
277-
colorAttachmentResolve.loadOp = vk::AttachmentLoadOp::eClear;
277+
colorAttachmentResolve.loadOp = vk::AttachmentLoadOp::eDontCare;
278278
colorAttachmentResolve.storeOp = vk::AttachmentStoreOp::eStore;
279279
colorAttachmentResolve.stencilLoadOp = vk::AttachmentLoadOp::eDontCare;
280280
colorAttachmentResolve.stencilStoreOp = vk::AttachmentStoreOp::eDontCare;
281281
colorAttachmentResolve.initialLayout = vk::ImageLayout::eUndefined;
282282
colorAttachmentResolve.finalLayout = vk::ImageLayout::ePresentSrcKHR;
283283
```
284284

285+
注意 `loadOp` 不再需要清除,整幅图像会根据多重缓冲图像更新全部内容。
286+
285287
现在必须指示渲染通道将多重采样颜色图像解析为常规附件。
286288
创建一个新的附件引用,它将指向将用作解析目标的颜色缓冲
287289

src/main.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ class HelloTriangleApplication {
544544
vk::AttachmentDescription colorAttachmentResolve;
545545
colorAttachmentResolve.format = m_swapChainImageFormat;
546546
colorAttachmentResolve.samples = vk::SampleCountFlagBits::e1;
547-
colorAttachmentResolve.loadOp = vk::AttachmentLoadOp::eClear;
547+
colorAttachmentResolve.loadOp = vk::AttachmentLoadOp::eDontCare;
548548
colorAttachmentResolve.storeOp = vk::AttachmentStoreOp::eStore;
549549
colorAttachmentResolve.stencilLoadOp = vk::AttachmentLoadOp::eDontCare;
550550
colorAttachmentResolve.stencilStoreOp = vk::AttachmentStoreOp::eDontCare;
@@ -953,9 +953,6 @@ class HelloTriangleApplication {
953953

954954
return attributeDescriptions;
955955
}
956-
bool operator==(const Vertex& other) const {
957-
return pos == other.pos && color == other.color && texCoord == other.texCoord;
958-
}
959956
};
960957
/////////////////////////////////////////////////////////////////
961958

0 commit comments

Comments
 (0)