Construct VertexInputDescriptor, in order to match web idl

BUG=dawn:107

Change-Id: Ic219fb98a88a7ac597fbdc592f604f27b76d756b
Reviewed-on: https://dawn-review.googlesource.com/c/4721
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
Yunchao He
2019-02-14 23:56:07 +00:00
committed by Commit Bot service account
parent e7bb3fd119
commit 4dec7371a2
14 changed files with 136 additions and 65 deletions

View File

@@ -126,18 +126,28 @@ void initRender() {
attribute2.offset = offsetof(Particle, vel);
attribute2.format = dawn::VertexFormat::FloatR32G32;
dawn::VertexInputDescriptor input1;
input1.inputSlot = 0;
input1.stride = sizeof(Particle);
input1.stepMode = dawn::InputStepMode::Instance;
dawn::VertexAttributeDescriptor attribute3;
attribute3.shaderLocation = 2;
attribute3.inputSlot = 1;
attribute3.offset = 0;
attribute3.format = dawn::VertexFormat::FloatR32G32;
dawn::VertexInputDescriptor input2;
input2.inputSlot = 1;
input2.stride = sizeof(glm::vec2);
input2.stepMode = dawn::InputStepMode::Vertex;
dawn::InputState inputState = device.CreateInputStateBuilder()
.SetAttribute(&attribute1)
.SetAttribute(&attribute2)
.SetInput(0, sizeof(Particle), dawn::InputStepMode::Instance)
.SetInput(&input1)
.SetAttribute(&attribute3)
.SetInput(1, sizeof(glm::vec2), dawn::InputStepMode::Vertex)
.SetInput(&input2)
.GetResult();
depthStencilView = CreateDefaultDepthStencilView(device);