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:
Kai Ninomiya
2017-05-16 14:04:22 -07:00
committed by Kai Ninomiya
parent ca309db58a
commit 68df8b0a3a
34 changed files with 1305 additions and 54 deletions

View File

@@ -22,6 +22,8 @@
nxt::Device device;
nxt::Queue queue;
nxt::Pipeline pipeline;
nxt::RenderPass renderpass;
nxt::Framebuffer framebuffer;
float RandomFloat(float min, float max) {
float zeroOne = rand() / float(RAND_MAX);
@@ -103,7 +105,9 @@ void init() {
})"
);
CreateDefaultRenderPass(device, &renderpass, &framebuffer);
pipeline = device.CreatePipelineBuilder()
.SetSubpass(renderpass, 0)
.SetStage(nxt::ShaderStage::Vertex, vsModule, "main")
.SetStage(nxt::ShaderStage::Fragment, fsModule, "main")
.GetResult();
@@ -129,6 +133,7 @@ void frame() {
for (int j = 0; j < 50; j++) {
nxt::CommandBufferBuilder builder = device.CreateCommandBufferBuilder()
.BeginRenderPass(renderpass, framebuffer)
.SetPipeline(pipeline)
.Clone();
@@ -140,6 +145,7 @@ void frame() {
i++;
}
builder.EndRenderPass();
commands[j] = builder.GetResult();
}