MCPcopy Create free account
hub / github.com/a2flo/floor / begin

Method begin

graphics/vulkan/vulkan_renderer.cpp:134–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134bool vulkan_renderer::begin(const dynamic_render_state_t dynamic_render_state) {
135#if defined(FLOOR_DEBUG)
136 if (is_indirect) {
137 if (dynamic_render_state.viewport || dynamic_render_state.scissor) {
138 log_warn("dynamic viewport/scissor is not supported in indirect render pipelines");
139 }
140 }
141#endif
142
143 const auto& vk_pass = (const vulkan_pass&)pass;
144
145 // create framebuffer(s) for this pass
146 const auto vk_render_pass = vk_pass.get_vulkan_render_pass(cqueue.get_device(), multi_view);
147 cur_framebuffer = create_vulkan_framebuffer(vk_render_pass, vk_pass.get_description(multi_view).debug_label, dynamic_render_state.viewport);
148 if (cur_framebuffer == nullptr) {
149 return false;
150 }
151
152 // create cmd buffer if we haven't yet
153 if (!did_begin_cmd_buffer) {
154 // it's now safe to begin the cmd buffer
155 if (!create_cmd_buffer()) {
156 return false;
157 }
158 }
159
160 // transition attachments
161 if (!att_transition_barriers.empty()) {
162 const VkDependencyInfo dep_info {
163 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
164 .pNext = nullptr,
165 .dependencyFlags = 0,
166 .memoryBarrierCount = 0,
167 .pMemoryBarriers = nullptr,
168 .bufferMemoryBarrierCount = 0,
169 .pBufferMemoryBarriers = nullptr,
170 .imageMemoryBarrierCount = uint32_t(att_transition_barriers.size()),
171 .pImageMemoryBarriers = &att_transition_barriers[0],
172 };
173 vkCmdPipelineBarrier2(render_cmd_buffer.cmd_buffer, &dep_info);
174 }
175
176 // actually begin the render pass
177 const auto& pipeline_desc = cur_pipeline->get_description(multi_view);
178
179 if (!dynamic_render_state.viewport) {
180 cur_viewport = {
181 .x = 0.0f,
182 .y = 0.0f,
183 .width = (float)pipeline_desc.viewport.x,
184 .height = (float)pipeline_desc.viewport.y,
185 .minDepth = pipeline_desc.depth.range.x,
186 .maxDepth = pipeline_desc.depth.range.y,
187 };
188 } else {
189 cur_viewport = {
190 .x = 0.0f,
191 .y = 0.0f,

Callers

nothing calls this directly

Calls 8

get_deviceMethod · 0.80
needs_clearMethod · 0.80
reserveMethod · 0.80
minFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected