Add depth-stencil textures and attachments (#77)

Related: #29
This commit is contained in:
Kai Ninomiya
2017-07-17 12:03:16 -04:00
committed by GitHub
parent 28684d93ed
commit fec8c58a97
24 changed files with 227 additions and 194 deletions

View File

@@ -81,8 +81,10 @@ void frame() {
{
nxtCommandBufferBuilder builder = nxtDeviceCreateCommandBufferBuilder(device);
nxtCommandBufferBuilderBeginRenderPass(builder, renderpass, framebuffer);
nxtCommandBufferBuilderBeginRenderSubpass(builder);
nxtCommandBufferBuilderSetPipeline(builder, pipeline);
nxtCommandBufferBuilderDrawArrays(builder, 3, 1, 0, 0);
nxtCommandBufferBuilderEndRenderSubpass(builder);
nxtCommandBufferBuilderEndRenderPass(builder);
commands = nxtCommandBufferBuilderGetResult(builder);
nxtCommandBufferBuilderRelease(builder);

View File

@@ -445,18 +445,7 @@ namespace {
device = CreateCppNXTDevice();
queue = device.CreateQueueBuilder().GetResult();
renderpass = device.CreateRenderPassBuilder()
.SetAttachmentCount(1)
.AttachmentSetFormat(0, nxt::TextureFormat::R8G8B8A8Unorm)
.SetSubpassCount(1)
.SubpassSetColorAttachment(0, 0, 0)
.GetResult();
framebuffer = device.CreateFramebufferBuilder()
.SetRenderPass(renderpass)
// attachment 0 -> back buffer
// (implicit) // TODO(kainino@chromium.org): use the texture provided by WSI
.SetDimensions(640, 480)
.GetResult();
utils::CreateDefaultRenderPass(device, &renderpass, &framebuffer);
initBuffers();
initSamplers();