Add render pass color and depth stencil attachment descriptor

This patch is the first one of the descriptorization of render pass. In
this patch we add support of RenderPassColorAttachmentDescriptor
and RenderPassDepthStencilAttachmentDescriptor to
RenderPassDescriptorBuilder.

This patch also adds StoreOp to render pass color and depth stencil
attachment descriptor.

RenderPassDescriptorBuilder will be completely removed in the next
patch.

BUG=dawn:6, dawn:49
TEST=dawn_end2end_tests, dawn_unittests

Change-Id: If623b41d04016425efa53932ae1648daf2263675
Reviewed-on: https://dawn-review.googlesource.com/c/3300
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Jiawei Shao
2018-12-19 08:21:13 +00:00
committed by Commit Bot service account
parent 292c0c31f2
commit 5e811aeee5
13 changed files with 429 additions and 184 deletions

View File

@@ -127,7 +127,13 @@ void frame() {
dawnRenderPassDescriptor renderpassInfo;
{
dawnRenderPassDescriptorBuilder builder = dawnDeviceCreateRenderPassDescriptorBuilder(device);
dawnRenderPassDescriptorBuilderSetColorAttachment(builder, 0, backbufferView, DAWN_LOAD_OP_CLEAR);
dawnRenderPassColorAttachmentDescriptor colorAttachment;
colorAttachment.attachment = backbufferView;
colorAttachment.resolveTarget = nullptr;
colorAttachment.clearColor = { 0.0f, 0.0f, 0.0f, 0.0f };
colorAttachment.loadOp = DAWN_LOAD_OP_CLEAR;
colorAttachment.storeOp = DAWN_STORE_OP_STORE;
dawnRenderPassDescriptorBuilderSetColorAttachments(builder, 1, &colorAttachment);
renderpassInfo = dawnRenderPassDescriptorBuilderGetResult(builder);
dawnRenderPassDescriptorBuilderRelease(builder);
}

View File

@@ -157,9 +157,25 @@ void GetNextRenderPassDescriptor(const dawn::Device& device,
dawn::RenderPassDescriptor* info) {
*backbuffer = swapchain.GetNextTexture();
auto backbufferView = backbuffer->CreateDefaultTextureView();
dawn::RenderPassColorAttachmentDescriptor colorAttachment;
colorAttachment.attachment = backbufferView;
colorAttachment.resolveTarget = nullptr;
colorAttachment.clearColor = { 0.0f, 0.0f, 0.0f, 0.0f };
colorAttachment.loadOp = dawn::LoadOp::Clear;
colorAttachment.storeOp = dawn::StoreOp::Store;
dawn::RenderPassDepthStencilAttachmentDescriptor depthStencilAttachment;
depthStencilAttachment.attachment = depthStencilView;
depthStencilAttachment.depthLoadOp = dawn::LoadOp::Clear;
depthStencilAttachment.stencilLoadOp = dawn::LoadOp::Clear;
depthStencilAttachment.clearDepth = 1.0f;
depthStencilAttachment.clearStencil = 0;
depthStencilAttachment.depthStoreOp = dawn::StoreOp::Store;
depthStencilAttachment.stencilStoreOp = dawn::StoreOp::Store;
*info = device.CreateRenderPassDescriptorBuilder()
.SetColorAttachment(0, backbufferView, dawn::LoadOp::Clear)
.SetDepthStencilAttachment(depthStencilView, dawn::LoadOp::Clear, dawn::LoadOp::Clear)
.SetColorAttachments(1, &colorAttachment)
.SetDepthStencilAttachment(&depthStencilAttachment)
.GetResult();
}