Update naming for vertex state

- VertexInputDescriptor -> VertexStateDescriptor
- VertexBufferDescriptor -> VertexBufferLayoutDescriptor
- VertexBufferDescriptor.stride -> .arrayStride
- VertexAttributeDescriptor.offset no longer optional

gpuweb PR: https://github.com/gpuweb/gpuweb/pull/469

Bug: dawn:22
Change-Id: I5431df4ba22cfbdb1bc81e6709e562cd736892a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13100
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Kai Ninomiya
2019-11-07 22:23:29 +00:00
committed by Commit Bot service account
parent c3284fa40e
commit ae1f25fee8
39 changed files with 507 additions and 497 deletions

View File

@@ -18,11 +18,11 @@
namespace utils {
ComboVertexInputDescriptor::ComboVertexInputDescriptor() {
wgpu::VertexInputDescriptor* descriptor = this;
ComboVertexStateDescriptor::ComboVertexStateDescriptor() {
wgpu::VertexStateDescriptor* descriptor = this;
descriptor->indexFormat = wgpu::IndexFormat::Uint32;
descriptor->bufferCount = 0;
descriptor->vertexBufferCount = 0;
// Fill the default values for vertexBuffers and vertexAttributes in buffers.
wgpu::VertexAttributeDescriptor vertexAttribute;
@@ -33,17 +33,18 @@ namespace utils {
cAttributes[i] = vertexAttribute;
}
for (uint32_t i = 0; i < kMaxVertexBuffers; ++i) {
cBuffers[i].stride = 0;
cBuffers[i].stepMode = wgpu::InputStepMode::Vertex;
cBuffers[i].attributeCount = 0;
cBuffers[i].attributes = nullptr;
cVertexBuffers[i].arrayStride = 0;
cVertexBuffers[i].stepMode = wgpu::InputStepMode::Vertex;
cVertexBuffers[i].attributeCount = 0;
cVertexBuffers[i].attributes = nullptr;
}
// cBuffers[i].attributes points to somewhere in cAttributes. cBuffers[0].attributes
// points to &cAttributes[0] by default. Assuming cBuffers[0] has two attributes, then
// cBuffers[1].attributes should point to &cAttributes[2]. Likewise, if cBuffers[1]
// has 3 attributes, then cBuffers[2].attributes should point to &cAttributes[5].
cBuffers[0].attributes = &cAttributes[0];
descriptor->buffers = &cBuffers[0];
// cVertexBuffers[i].attributes points to somewhere in cAttributes.
// cVertexBuffers[0].attributes points to &cAttributes[0] by default. Assuming
// cVertexBuffers[0] has two attributes, then cVertexBuffers[1].attributes should point to
// &cAttributes[2]. Likewise, if cVertexBuffers[1] has 3 attributes, then
// cVertexBuffers[2].attributes should point to &cAttributes[5].
cVertexBuffers[0].attributes = &cAttributes[0];
descriptor->vertexBuffers = &cVertexBuffers[0];
}
ComboRenderPipelineDescriptor::ComboRenderPipelineDescriptor(const wgpu::Device& device) {
@@ -62,7 +63,7 @@ namespace utils {
}
// Set defaults for the input state descriptors.
descriptor->vertexInput = &cVertexInput;
descriptor->vertexState = &cVertexState;
// Set defaults for the rasterization state descriptor.
{

View File

@@ -23,11 +23,11 @@
namespace utils {
class ComboVertexInputDescriptor : public wgpu::VertexInputDescriptor {
class ComboVertexStateDescriptor : public wgpu::VertexStateDescriptor {
public:
ComboVertexInputDescriptor();
ComboVertexStateDescriptor();
std::array<wgpu::VertexBufferDescriptor, kMaxVertexBuffers> cBuffers;
std::array<wgpu::VertexBufferLayoutDescriptor, kMaxVertexBuffers> cVertexBuffers;
std::array<wgpu::VertexAttributeDescriptor, kMaxVertexAttributes> cAttributes;
};
@@ -42,7 +42,7 @@ namespace utils {
wgpu::ProgrammableStageDescriptor cFragmentStage;
ComboVertexInputDescriptor cVertexInput;
ComboVertexStateDescriptor cVertexState;
wgpu::RasterizationStateDescriptor cRasterizationState;
std::array<wgpu::ColorStateDescriptor, kMaxColorAttachments> cColorStates;
wgpu::DepthStencilStateDescriptor cDepthStencilState;