Update VertexInput (InputState) to match the spec - Part 2

This patch changed the front end code and tests and examples.

BUG=dawn:80, dawn:107

Change-Id: Ia6c60232c04a1bfb862263766eb28e9afc3bc8db
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7620
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Yunchao He
2019-06-06 01:56:57 +00:00
committed by Commit Bot service account
parent 9cd21f1bf9
commit 97c0885a4a
21 changed files with 272 additions and 218 deletions

View File

@@ -98,8 +98,6 @@ void init() {
vertexInput.indexFormat = DAWN_INDEX_FORMAT_UINT32;
vertexInput.numBuffers = 0;
vertexInput.buffers = nullptr;
vertexInput.numAttributes = 0;
vertexInput.attributes = nullptr;
descriptor.vertexInput = &vertexInput;
DawnRasterizationStateDescriptor rasterizationState;

View File

@@ -120,20 +120,20 @@ void initRender() {
descriptor.cVertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cVertexInput.numAttributes = 3;
descriptor.cVertexInput.numBuffers = 2;
descriptor.cVertexInput.cBuffers[0].stride = sizeof(Particle);
descriptor.cVertexInput.cBuffers[0].stepMode = dawn::InputStepMode::Instance;
descriptor.cVertexInput.cBuffers[0].numAttributes = 2;
descriptor.cVertexInput.cAttributes[0].offset = offsetof(Particle, pos);
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float2;
descriptor.cVertexInput.cAttributes[1].shaderLocation = 1;
descriptor.cVertexInput.cAttributes[1].offset = offsetof(Particle, vel);
descriptor.cVertexInput.cAttributes[1].format = dawn::VertexFormat::Float2;
descriptor.cVertexInput.cAttributes[2].shaderLocation = 2;
descriptor.cVertexInput.cAttributes[2].inputSlot = 1;
descriptor.cVertexInput.cAttributes[2].format = dawn::VertexFormat::Float2;
descriptor.cVertexInput.numBuffers = 2;
descriptor.cVertexInput.cBuffers[0].stride = sizeof(Particle);
descriptor.cVertexInput.cBuffers[0].stepMode = dawn::InputStepMode::Instance;
descriptor.cVertexInput.cBuffers[1].inputSlot = 1;
descriptor.cVertexInput.cBuffers[1].stride = sizeof(glm::vec2);
descriptor.cVertexInput.cBuffers[1].numAttributes = 1;
descriptor.cVertexInput.cBuffers[1].attributes = &descriptor.cVertexInput.cAttributes[2];
descriptor.cVertexInput.cAttributes[2].shaderLocation = 2;
descriptor.cVertexInput.cAttributes[2].format = dawn::VertexFormat::Float2;
descriptor.depthStencilState = &descriptor.cDepthStencilState;
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();

View File

@@ -125,10 +125,10 @@ void init() {
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
descriptor.cVertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cVertexInput.numAttributes = 1;
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float4;
descriptor.cVertexInput.numBuffers = 1;
descriptor.cVertexInput.cBuffers[0].stride = 4 * sizeof(float);
descriptor.cVertexInput.cBuffers[0].numAttributes = 1;
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float4;
descriptor.depthStencilState = &descriptor.cDepthStencilState;
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();

View File

@@ -157,7 +157,7 @@ void init() {
})");
utils::ComboVertexInputDescriptor vertexInput;
vertexInput.numAttributes = 2;
vertexInput.cBuffers[0].numAttributes = 2;
vertexInput.cAttributes[0].format = dawn::VertexFormat::Float3;
vertexInput.cAttributes[1].shaderLocation = 1;
vertexInput.cAttributes[1].offset = 3 * sizeof(float);