Render Pipeline Descriptorization -- Part I
This patch remove render pipeline builder and use descriptor to create render pipeline.
Sub-objects in descriptor will be removed in future.
Bug: dawn:4
Change-Id: I58dd569c7be42c2648311847b939c681189c2854
Reviewed-on: https://dawn-review.googlesource.com/c/2180
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
diff --git a/examples/CppHelloTriangle.cpp b/examples/CppHelloTriangle.cpp
index 5bd7d67..f0f6794 100644
--- a/examples/CppHelloTriangle.cpp
+++ b/examples/CppHelloTriangle.cpp
@@ -14,6 +14,7 @@
#include "SampleUtils.h"
+#include "utils/ComboRenderPipelineDescriptor.h"
#include "utils/DawnHelpers.h"
#include "utils/SystemUtils.h"
@@ -125,15 +126,17 @@
depthStencilView = CreateDefaultDepthStencilView(device);
- pipeline = device.CreateRenderPipelineBuilder()
- .SetColorAttachmentFormat(0, GetPreferredSwapChainTextureFormat())
- .SetDepthStencilAttachmentFormat(dawn::TextureFormat::D32FloatS8Uint)
- .SetLayout(pl)
- .SetStage(dawn::ShaderStage::Vertex, vsModule, "main")
- .SetStage(dawn::ShaderStage::Fragment, fsModule, "main")
- .SetIndexFormat(dawn::IndexFormat::Uint32)
- .SetInputState(inputState)
- .GetResult();
+ utils::ComboRenderPipelineDescriptor descriptor(device);
+ descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
+ descriptor.cVertexStage.module = vsModule;
+ descriptor.cFragmentStage.module = fsModule;
+ descriptor.inputState = inputState;
+ descriptor.cAttachmentsState.hasDepthStencilAttachment = true;
+ descriptor.cDepthStencilAttachment.format = dawn::TextureFormat::D32FloatS8Uint;
+ descriptor.cColorAttachments[0].format =
+ GetPreferredSwapChainTextureFormat();
+
+ pipeline = device.CreateRenderPipeline(&descriptor);
dawn::TextureView view = texture.CreateDefaultTextureView();