mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 23:26:24 +00:00
Introduce render passes
* First API design (many features missing, including input attachments) * Metal implementation (no OpenGL yet) * Render-to-texture demo (a little broken until we have depth buffers) * Update examples to use render passes
This commit is contained in:
committed by
Kai Ninomiya
parent
ca309db58a
commit
68df8b0a3a
@@ -19,6 +19,8 @@
|
||||
nxt::Device device;
|
||||
nxt::Queue queue;
|
||||
nxt::Pipeline pipeline;
|
||||
nxt::RenderPass renderpass;
|
||||
nxt::Framebuffer framebuffer;
|
||||
nxt::Buffer buffer;
|
||||
nxt::BindGroup bindGroup;
|
||||
|
||||
@@ -59,7 +61,9 @@ void init() {
|
||||
.SetBindGroupLayout(0, bgl)
|
||||
.GetResult();
|
||||
|
||||
CreateDefaultRenderPass(device, &renderpass, &framebuffer);
|
||||
pipeline = device.CreatePipelineBuilder()
|
||||
.SetSubpass(renderpass, 0)
|
||||
.SetLayout(pl)
|
||||
.SetStage(nxt::ShaderStage::Vertex, vsModule, "main")
|
||||
.SetStage(nxt::ShaderStage::Fragment, fsModule, "main")
|
||||
@@ -91,10 +95,12 @@ void frame() {
|
||||
buffer.SetSubData(0, sizeof(s) / sizeof(uint32_t), reinterpret_cast<uint32_t*>(&s));
|
||||
|
||||
nxt::CommandBuffer commands = device.CreateCommandBufferBuilder()
|
||||
.SetPipeline(pipeline)
|
||||
.TransitionBufferUsage(buffer, nxt::BufferUsageBit::Uniform)
|
||||
.SetBindGroup(0, bindGroup)
|
||||
.DrawArrays(3, 1, 0, 0)
|
||||
.BeginRenderPass(renderpass, framebuffer)
|
||||
.SetPipeline(pipeline)
|
||||
.TransitionBufferUsage(buffer, nxt::BufferUsageBit::Uniform)
|
||||
.SetBindGroup(0, bindGroup)
|
||||
.DrawArrays(3, 1, 0, 0)
|
||||
.EndRenderPass()
|
||||
.GetResult();
|
||||
|
||||
queue.Submit(1, &commands);
|
||||
|
||||
Reference in New Issue
Block a user