Construct ComboInputStateDescriptor to simplify tests and examples
Bug=dawn:107
Change-Id: I900de454cacf9f62ae97213161a98ce6d4254eab
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6020
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
diff --git a/examples/CppHelloTriangle.cpp b/examples/CppHelloTriangle.cpp
index ca756cf..1c703af 100644
--- a/examples/CppHelloTriangle.cpp
+++ b/examples/CppHelloTriangle.cpp
@@ -111,17 +111,6 @@
fragColor = texture(sampler2D(myTexture, mySampler), gl_FragCoord.xy / vec2(640.0, 480.0));
})");
- dawn::VertexAttributeDescriptor attribute;
- attribute.shaderLocation = 0;
- attribute.inputSlot = 0;
- attribute.offset = 0;
- attribute.format = dawn::VertexFormat::Float4;
-
- dawn::VertexInputDescriptor input;
- input.inputSlot = 0;
- input.stride = 4 * sizeof(float);
- input.stepMode = dawn::InputStepMode::Vertex;
-
auto bgl = utils::MakeBindGroupLayout(
device, {
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler},
@@ -137,9 +126,9 @@
descriptor.cVertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cInputState.numAttributes = 1;
- descriptor.cInputState.attributes = &attribute;
+ descriptor.cInputState.cAttributes[0].format = dawn::VertexFormat::Float4;
descriptor.cInputState.numInputs = 1;
- descriptor.cInputState.inputs = &input;
+ descriptor.cInputState.cInputs[0].stride = 4 * sizeof(float);
descriptor.depthStencilState = &descriptor.cDepthStencilState;
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();