实现测试着色器功能并创建渲染管线

This commit is contained in:
2026-01-19 13:27:37 +08:00
parent b710062afd
commit 25a4df2d1d
3 changed files with 63 additions and 2 deletions

View File

@@ -48,6 +48,8 @@ namespace mirai {
}
wgpu::raii::CommandEncoder encoder = wgpu_context::instance().get_command_encoder();
wgpu::raii::Queue queue = wgpu_context::instance().get_queue();
auto size = get_framebuffer_size();
auto pipeline = wgpu_context::instance().get_test_pipeline();
auto [texture, texture_view] = acquire_next_swapchain_texture();
wgpu::RenderPassColorAttachment color_attachment{};
@@ -63,7 +65,10 @@ namespace mirai {
render_pass_descriptor.colorAttachments = &color_attachment;
wgpu::raii::RenderPassEncoder render_pass = encoder->beginRenderPass(render_pass_descriptor);
render_pass->setPipeline(pipeline);
render_pass->draw(3, 1, 0, 0);
render_pass->end();
wgpu::raii::CommandBuffer command_buffer = encoder->finish();
queue->submit(*command_buffer);