Construct VertexAttributeDescriptor, in order to match web idl

The parameters about vertex attribute were encapsulated in
VertexAttributeDescriptor in web idl. This change construct
this descriptor accordingly.

BUG=dawn:107

Change-Id: Ia1c6e53af951d8f2a0c0b69bdca09291c2661e50
Reviewed-on: https://dawn-review.googlesource.com/c/4620
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 00:35:39 +00:00
committed by Commit Bot service account
parent 445869d2b0
commit b2207737ab
18 changed files with 207 additions and 73 deletions

View File

@@ -156,11 +156,23 @@ void init() {
fragColor = vec4(mix(f_col, vec3(0.5, 0.5, 0.5), 0.5), 1.0);
})");
dawn::VertexAttributeDescriptor attribute1;
attribute1.shaderLocation = 0;
attribute1.inputSlot = 0;
attribute1.offset = 0;
attribute1.format = dawn::VertexFormat::FloatR32G32B32;
dawn::VertexAttributeDescriptor attribute2;
attribute2.shaderLocation = 1;
attribute2.inputSlot = 0;
attribute2.offset = 3 * sizeof(float);
attribute2.format = dawn::VertexFormat::FloatR32G32B32;
auto inputState = device.CreateInputStateBuilder()
.SetAttribute(0, 0, dawn::VertexFormat::FloatR32G32B32, 0)
.SetAttribute(1, 0, dawn::VertexFormat::FloatR32G32B32, 3 * sizeof(float))
.SetInput(0, 6 * sizeof(float), dawn::InputStepMode::Vertex)
.GetResult();
.SetAttribute(&attribute1)
.SetAttribute(&attribute2)
.SetInput(0, 6 * sizeof(float), dawn::InputStepMode::Vertex)
.GetResult();
auto bgl = utils::MakeBindGroupLayout(
device, {