Replace VertexFormatUtils with a dawn_native table of formats

This replaces multiple switches with a single indexing into a data
table, and also adds information about the VertexFormatBaseType for
later validation.

Bug: dawn:1008
Change-Id: Ic3f564b0dc571cc0008a54785613f962ce223452
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59030
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2021-07-22 08:57:29 +00:00
committed by Dawn LUCI CQ
parent c607e81de2
commit 1384e8b163
14 changed files with 126 additions and 235 deletions

View File

@@ -15,8 +15,6 @@
#include "tests/unittests/validation/ValidationTest.h"
#include "common/Constants.h"
#include "common/VertexFormatUtils.h"
#include "utils/ComboRenderPipelineDescriptor.h"
#include "utils/WGPUHelpers.h"
@@ -111,8 +109,7 @@ namespace {
for (auto attr : buffer.attributes) {
// [[location({shaderLocation})]] var_{id} : {typeString},
inputStringStream << "[[location(" << attr.shaderLocation << ")]] var_"
<< attributeCount << " : "
<< dawn::GetWGSLVertexFormatType(attr.format) << ", ";
<< attributeCount << " : vec4<f32>,";
attributeCount++;
}
}
@@ -171,9 +168,7 @@ namespace {
// Create a render pipeline using only one vertex-step-mode Float32x4 buffer
wgpu::RenderPipeline CreateBasicRenderPipeline(uint32_t bufferStride = kFloat32x4Stride) {
DAWN_ASSERT(bufferStride >=
dawn::VertexFormatNumComponents(wgpu::VertexFormat::Float32x4) *
dawn::VertexFormatComponentSize(wgpu::VertexFormat::Float32x4));
DAWN_ASSERT(bufferStride >= kFloat32x4Stride);
std::vector<PipelineVertexBufferDesc> bufferDescList = {
{bufferStride, wgpu::InputStepMode::Vertex, {{0, wgpu::VertexFormat::Float32x4}}},