Skip to content

Commit 76504f5

Browse files
committed
Add shaderDrawParameters to earlier triangle tutorial pages
1 parent a3f5172 commit 76504f5

9 files changed

Lines changed: 128 additions & 74 deletions

attachments/03_physical_device_selection.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class HelloTriangleApplication
141141
vk::DebugUtilsMessageSeverityFlagsEXT severityFlags(vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning |
142142
vk::DebugUtilsMessageSeverityFlagBitsEXT::eError);
143143
vk::DebugUtilsMessageTypeFlagsEXT messageTypeFlags(
144-
vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation);
144+
vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation);
145145
vk::DebugUtilsMessengerCreateInfoEXT debugUtilsMessengerCreateInfoEXT{.messageSeverity = severityFlags,
146146
.messageType = messageTypeFlags,
147147
.pfnUserCallback = &debugCallback};
@@ -167,10 +167,12 @@ class HelloTriangleApplication
167167
});
168168

169169
// Check if the physicalDevice supports the required features
170-
auto features =
171-
physicalDevice
172-
.template getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
173-
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
170+
auto features = physicalDevice.template getFeatures2<vk::PhysicalDeviceFeatures2,
171+
vk::PhysicalDeviceVulkan11Features,
172+
vk::PhysicalDeviceVulkan13Features,
173+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
174+
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan11Features>().shaderDrawParameters &&
175+
features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
174176
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;
175177

176178
// Return true if the physicalDevice meets all the criteria

attachments/04_logical_device.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class HelloTriangleApplication
146146
vk::DebugUtilsMessageSeverityFlagsEXT severityFlags(vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning |
147147
vk::DebugUtilsMessageSeverityFlagBitsEXT::eError);
148148
vk::DebugUtilsMessageTypeFlagsEXT messageTypeFlags(
149-
vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation);
149+
vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation);
150150
vk::DebugUtilsMessengerCreateInfoEXT debugUtilsMessengerCreateInfoEXT{.messageSeverity = severityFlags,
151151
.messageType = messageTypeFlags,
152152
.pfnUserCallback = &debugCallback};
@@ -172,10 +172,12 @@ class HelloTriangleApplication
172172
});
173173

174174
// Check if the physicalDevice supports the required features
175-
auto features =
176-
physicalDevice
177-
.template getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
178-
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
175+
auto features = physicalDevice.template getFeatures2<vk::PhysicalDeviceFeatures2,
176+
vk::PhysicalDeviceVulkan11Features,
177+
vk::PhysicalDeviceVulkan13Features,
178+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
179+
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan11Features>().shaderDrawParameters &&
180+
features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
179181
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;
180182

181183
// Return true if the physicalDevice meets all the criteria
@@ -205,11 +207,16 @@ class HelloTriangleApplication
205207
auto graphicsIndex = static_cast<uint32_t>(std::distance(queueFamilyProperties.begin(), graphicsQueueFamilyProperty));
206208

207209
// query for Vulkan 1.3 features
208-
vk::StructureChain<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT> featureChain = {
209-
{}, // vk::PhysicalDeviceFeatures2
210-
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
211-
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
212-
};
210+
vk::StructureChain<vk::PhysicalDeviceFeatures2,
211+
vk::PhysicalDeviceVulkan11Features,
212+
vk::PhysicalDeviceVulkan13Features,
213+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>
214+
featureChain = {
215+
{}, // vk::PhysicalDeviceFeatures2
216+
{.shaderDrawParameters = true}, // vk::PhysicalDeviceVulkan11Features
217+
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
218+
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
219+
};
213220

214221
// create a Device
215222
float queuePriority = 0.5f;

attachments/05_window_surface.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class HelloTriangleApplication
144144
vk::DebugUtilsMessageSeverityFlagsEXT severityFlags(vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning |
145145
vk::DebugUtilsMessageSeverityFlagBitsEXT::eError);
146146
vk::DebugUtilsMessageTypeFlagsEXT messageTypeFlags(
147-
vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation);
147+
vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation);
148148
vk::DebugUtilsMessengerCreateInfoEXT debugUtilsMessengerCreateInfoEXT{.messageSeverity = severityFlags,
149149
.messageType = messageTypeFlags,
150150
.pfnUserCallback = &debugCallback};
@@ -180,10 +180,12 @@ class HelloTriangleApplication
180180
});
181181

182182
// Check if the physicalDevice supports the required features
183-
auto features =
184-
physicalDevice
185-
.template getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
186-
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
183+
auto features = physicalDevice.template getFeatures2<vk::PhysicalDeviceFeatures2,
184+
vk::PhysicalDeviceVulkan11Features,
185+
vk::PhysicalDeviceVulkan13Features,
186+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
187+
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan11Features>().shaderDrawParameters &&
188+
features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
187189
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;
188190

189191
// Return true if the physicalDevice meets all the criteria
@@ -223,11 +225,16 @@ class HelloTriangleApplication
223225
}
224226

225227
// query for Vulkan 1.3 features
226-
vk::StructureChain<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT> featureChain = {
227-
{}, // vk::PhysicalDeviceFeatures2
228-
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
229-
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
230-
};
228+
vk::StructureChain<vk::PhysicalDeviceFeatures2,
229+
vk::PhysicalDeviceVulkan11Features,
230+
vk::PhysicalDeviceVulkan13Features,
231+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>
232+
featureChain = {
233+
{}, // vk::PhysicalDeviceFeatures2
234+
{.shaderDrawParameters = true}, // vk::PhysicalDeviceVulkan11Features
235+
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
236+
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
237+
};
231238

232239
// create a Device
233240
float queuePriority = 0.5f;

attachments/06_swap_chain_creation.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class HelloTriangleApplication
152152
vk::DebugUtilsMessageSeverityFlagsEXT severityFlags(vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning |
153153
vk::DebugUtilsMessageSeverityFlagBitsEXT::eError);
154154
vk::DebugUtilsMessageTypeFlagsEXT messageTypeFlags(
155-
vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation);
155+
vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation);
156156
vk::DebugUtilsMessengerCreateInfoEXT debugUtilsMessengerCreateInfoEXT{.messageSeverity = severityFlags,
157157
.messageType = messageTypeFlags,
158158
.pfnUserCallback = &debugCallback};
@@ -188,10 +188,12 @@ class HelloTriangleApplication
188188
});
189189

190190
// Check if the physicalDevice supports the required features
191-
auto features =
192-
physicalDevice
193-
.template getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
194-
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
191+
auto features = physicalDevice.template getFeatures2<vk::PhysicalDeviceFeatures2,
192+
vk::PhysicalDeviceVulkan11Features,
193+
vk::PhysicalDeviceVulkan13Features,
194+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
195+
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan11Features>().shaderDrawParameters &&
196+
features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
195197
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;
196198

197199
// Return true if the physicalDevice meets all the criteria
@@ -231,11 +233,16 @@ class HelloTriangleApplication
231233
}
232234

233235
// query for Vulkan 1.3 features
234-
vk::StructureChain<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT> featureChain = {
235-
{}, // vk::PhysicalDeviceFeatures2
236-
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
237-
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
238-
};
236+
vk::StructureChain<vk::PhysicalDeviceFeatures2,
237+
vk::PhysicalDeviceVulkan11Features,
238+
vk::PhysicalDeviceVulkan13Features,
239+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>
240+
featureChain = {
241+
{}, // vk::PhysicalDeviceFeatures2
242+
{.shaderDrawParameters = true}, // vk::PhysicalDeviceVulkan11Features
243+
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
244+
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
245+
};
239246

240247
// create a Device
241248
float queuePriority = 0.5f;

attachments/07_image_views.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class HelloTriangleApplication
153153
vk::DebugUtilsMessageSeverityFlagsEXT severityFlags(vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning |
154154
vk::DebugUtilsMessageSeverityFlagBitsEXT::eError);
155155
vk::DebugUtilsMessageTypeFlagsEXT messageTypeFlags(
156-
vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation);
156+
vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation);
157157
vk::DebugUtilsMessengerCreateInfoEXT debugUtilsMessengerCreateInfoEXT{.messageSeverity = severityFlags,
158158
.messageType = messageTypeFlags,
159159
.pfnUserCallback = &debugCallback};
@@ -189,10 +189,12 @@ class HelloTriangleApplication
189189
});
190190

191191
// Check if the physicalDevice supports the required features
192-
auto features =
193-
physicalDevice
194-
.template getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
195-
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
192+
auto features = physicalDevice.template getFeatures2<vk::PhysicalDeviceFeatures2,
193+
vk::PhysicalDeviceVulkan11Features,
194+
vk::PhysicalDeviceVulkan13Features,
195+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
196+
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan11Features>().shaderDrawParameters &&
197+
features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
196198
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;
197199

198200
// Return true if the physicalDevice meets all the criteria
@@ -232,11 +234,16 @@ class HelloTriangleApplication
232234
}
233235

234236
// query for Vulkan 1.3 features
235-
vk::StructureChain<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT> featureChain = {
236-
{}, // vk::PhysicalDeviceFeatures2
237-
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
238-
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
239-
};
237+
vk::StructureChain<vk::PhysicalDeviceFeatures2,
238+
vk::PhysicalDeviceVulkan11Features,
239+
vk::PhysicalDeviceVulkan13Features,
240+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>
241+
featureChain = {
242+
{}, // vk::PhysicalDeviceFeatures2
243+
{.shaderDrawParameters = true}, // vk::PhysicalDeviceVulkan11Features
244+
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
245+
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
246+
};
240247

241248
// create a Device
242249
float queuePriority = 0.5f;

attachments/08_graphics_pipeline.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class HelloTriangleApplication
154154
vk::DebugUtilsMessageSeverityFlagsEXT severityFlags(vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning |
155155
vk::DebugUtilsMessageSeverityFlagBitsEXT::eError);
156156
vk::DebugUtilsMessageTypeFlagsEXT messageTypeFlags(
157-
vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation);
157+
vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation);
158158
vk::DebugUtilsMessengerCreateInfoEXT debugUtilsMessengerCreateInfoEXT{.messageSeverity = severityFlags,
159159
.messageType = messageTypeFlags,
160160
.pfnUserCallback = &debugCallback};
@@ -190,10 +190,12 @@ class HelloTriangleApplication
190190
});
191191

192192
// Check if the physicalDevice supports the required features
193-
auto features =
194-
physicalDevice
195-
.template getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
196-
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
193+
auto features = physicalDevice.template getFeatures2<vk::PhysicalDeviceFeatures2,
194+
vk::PhysicalDeviceVulkan11Features,
195+
vk::PhysicalDeviceVulkan13Features,
196+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>();
197+
bool supportsRequiredFeatures = features.template get<vk::PhysicalDeviceVulkan11Features>().shaderDrawParameters &&
198+
features.template get<vk::PhysicalDeviceVulkan13Features>().dynamicRendering &&
197199
features.template get<vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>().extendedDynamicState;
198200

199201
// Return true if the physicalDevice meets all the criteria
@@ -233,11 +235,16 @@ class HelloTriangleApplication
233235
}
234236

235237
// query for Vulkan 1.3 features
236-
vk::StructureChain<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVulkan13Features, vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT> featureChain = {
237-
{}, // vk::PhysicalDeviceFeatures2
238-
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
239-
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
240-
};
238+
vk::StructureChain<vk::PhysicalDeviceFeatures2,
239+
vk::PhysicalDeviceVulkan11Features,
240+
vk::PhysicalDeviceVulkan13Features,
241+
vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT>
242+
featureChain = {
243+
{}, // vk::PhysicalDeviceFeatures2
244+
{.shaderDrawParameters = true}, // vk::PhysicalDeviceVulkan11Features
245+
{.dynamicRendering = true}, // vk::PhysicalDeviceVulkan13Features
246+
{.extendedDynamicState = true} // vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT
247+
};
241248

242249
// create a Device
243250
float queuePriority = 0.5f;

0 commit comments

Comments
 (0)