MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / update

Method update

samples/performance/subpasses/subpasses.cpp:187–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185#endif
186
187void Subpasses::update(float delta_time)
188{
189 // Check whether the user changed the render technique
190 if (configs[Config::RenderTechnique].value != last_render_technique)
191 {
192 LOGI("Changing render technique");
193 last_render_technique = configs[Config::RenderTechnique].value;
194
195 // Reset frames, their synchronization objects and their command buffers
196 for (auto &frame : get_render_context().get_render_frames())
197 {
198 frame->reset();
199 }
200 }
201
202 // Check whether the user switched the attachment or the G-buffer option
203 if (configs[Config::TransientAttachments].value != last_transient_attachment ||
204 configs[Config::GBufferSize].value != last_g_buffer_size)
205 {
206 // If attachment option has changed
207 if (configs[Config::TransientAttachments].value != last_transient_attachment)
208 {
209 rt_usage_flags = VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
210
211 // If attachment should be transient
212 if (configs[Config::TransientAttachments].value == 0)
213 {
214 rt_usage_flags |= VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT;
215 }
216 else
217 {
218 LOGI("Creating non transient attachments");
219 }
220 last_transient_attachment = configs[Config::TransientAttachments].value;
221 }
222
223 // It G-buffer option has changed
224 if (configs[Config::GBufferSize].value != last_g_buffer_size)
225 {
226 if (configs[Config::GBufferSize].value == 0)
227 {
228 // Use less bits
229 albedo_format = VK_FORMAT_R8G8B8A8_UNORM; // 32-bit
230 normal_format = VK_FORMAT_A2B10G10R10_UNORM_PACK32; // 32-bit
231 }
232 else
233 {
234 // Use more bits
235 albedo_format = VK_FORMAT_R32G32B32A32_SFLOAT; // 128-bit
236 normal_format = VK_FORMAT_R32G32B32A32_SFLOAT; // 128-bit
237 }
238
239 last_g_buffer_size = configs[Config::GBufferSize].value;
240 }
241
242 // Reset frames, their synchronization objects and their command buffers
243 for (auto &frame : get_render_context().get_render_frames())
244 {

Callers 1

Calls 2

resetMethod · 0.45
recreateMethod · 0.45

Tested by 1