Remove typedefs for passed deprecations

Bug: None
Change-Id: I922fc4b1149c94f891692e6961423162a5a131e1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62360
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2021-08-23 10:10:11 +00:00 committed by Dawn LUCI CQ
parent dd1a5b3ad3
commit da230e5e5c
8 changed files with 49 additions and 73 deletions

View File

@ -208,10 +208,6 @@
{"name": "dst factor", "type": "blend factor", "default": "zero"} {"name": "dst factor", "type": "blend factor", "default": "zero"}
] ]
}, },
"blend descriptor": {
"category": "typedef",
"type": "blend component"
},
"blend factor": { "blend factor": {
"category": "enum", "category": "enum",
"values": [ "values": [
@ -294,10 +290,6 @@
} }
] ]
}, },
"buffer copy view": {
"category": "typedef",
"type": "image copy buffer"
},
"buffer descriptor": { "buffer descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": true,
@ -1032,10 +1024,6 @@
{"name": "shader location", "type": "uint32_t"} {"name": "shader location", "type": "uint32_t"}
] ]
}, },
"vertex attribute descriptor": {
"category": "typedef",
"type": "vertex attribute"
},
"vertex buffer layout": { "vertex buffer layout": {
"category": "structure", "category": "structure",
"extensible": false, "extensible": false,
@ -1046,10 +1034,6 @@
{"name": "attributes", "type": "vertex attribute", "annotation": "const*", "length": "attribute count"} {"name": "attributes", "type": "vertex attribute", "annotation": "const*", "length": "attribute count"}
] ]
}, },
"vertex buffer layout descriptor": {
"category": "typedef",
"type": "vertex buffer layout"
},
"input step mode": { "input step mode": {
"category": "typedef", "category": "typedef",
"type": "vertex step mode" "type": "vertex step mode"
@ -1750,10 +1734,6 @@
{"name": "pass op", "type": "stencil operation", "default": "keep"} {"name": "pass op", "type": "stencil operation", "default": "keep"}
] ]
}, },
"stencil state face descriptor": {
"category": "typedef",
"type": "stencil face state"
},
"surface": { "surface": {
"category": "object" "category": "object"
}, },
@ -1902,10 +1882,6 @@
{"value": 3, "name": "depth comparison"} {"value": 3, "name": "depth comparison"}
] ]
}, },
"texture copy view": {
"category": "typedef",
"type": "image copy texture"
},
"texture data layout": { "texture data layout": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": true,

View File

@ -274,7 +274,7 @@ namespace dawn_native { namespace d3d12 {
} }
} }
D3D12_DEPTH_STENCILOP_DESC StencilOpDesc(const StencilStateFaceDescriptor descriptor) { D3D12_DEPTH_STENCILOP_DESC StencilOpDesc(const StencilFaceState& descriptor) {
D3D12_DEPTH_STENCILOP_DESC desc; D3D12_DEPTH_STENCILOP_DESC desc;
desc.StencilFailOp = StencilOp(descriptor.failOp); desc.StencilFailOp = StencilOp(descriptor.failOp);

View File

@ -151,7 +151,7 @@ namespace dawn_native { namespace opengl {
state->writeMask & wgpu::ColorWriteMask::Alpha); state->writeMask & wgpu::ColorWriteMask::Alpha);
} }
bool Equal(const BlendDescriptor& lhs, const BlendDescriptor& rhs) { bool Equal(const BlendComponent& lhs, const BlendComponent& rhs) {
return lhs.operation == rhs.operation && lhs.srcFactor == rhs.srcFactor && return lhs.operation == rhs.operation && lhs.srcFactor == rhs.srcFactor &&
lhs.dstFactor == rhs.dstFactor; lhs.dstFactor == rhs.dstFactor;
} }

View File

@ -843,7 +843,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
// Blend state intentionally omitted for target 2 // Blend state intentionally omitted for target 2
wgpu::BlendDescriptor blendComponent3; wgpu::BlendComponent blendComponent3;
blendComponent3.operation = wgpu::BlendOperation::Min; blendComponent3.operation = wgpu::BlendOperation::Min;
blendComponent3.srcFactor = wgpu::BlendFactor::One; blendComponent3.srcFactor = wgpu::BlendFactor::One;
blendComponent3.dstFactor = wgpu::BlendFactor::One; blendComponent3.dstFactor = wgpu::BlendFactor::One;

View File

@ -66,7 +66,7 @@ class VertexStateTest : public DawnTest {
VertexFormat format; VertexFormat format;
VertexStepMode step; VertexStepMode step;
}; };
wgpu::RenderPipeline MakeTestPipeline(const utils::ComboVertexStateDescriptor& vertexState, wgpu::RenderPipeline MakeTestPipeline(const utils::ComboVertexState& vertexState,
int multiplier, int multiplier,
const std::vector<ShaderTestSpec>& testSpec) { const std::vector<ShaderTestSpec>& testSpec) {
std::ostringstream vs; std::ostringstream vs;
@ -166,7 +166,7 @@ class VertexStateTest : public DawnTest {
}; };
void MakeVertexState(const std::vector<VertexBufferSpec>& buffers, void MakeVertexState(const std::vector<VertexBufferSpec>& buffers,
utils::ComboVertexStateDescriptor* vertexState) { utils::ComboVertexState* vertexState) {
uint32_t vertexBufferCount = 0; uint32_t vertexBufferCount = 0;
uint32_t totalNumAttributes = 0; uint32_t totalNumAttributes = 0;
for (const VertexBufferSpec& buffer : buffers) { for (const VertexBufferSpec& buffer : buffers) {
@ -248,7 +248,7 @@ class VertexStateTest : public DawnTest {
// Test compilation and usage of the fixture :) // Test compilation and usage of the fixture :)
TEST_P(VertexStateTest, Basic) { TEST_P(VertexStateTest, Basic) {
utils::ComboVertexStateDescriptor vertexState; utils::ComboVertexState vertexState;
MakeVertexState( MakeVertexState(
{{4 * sizeof(float), VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}}, {{4 * sizeof(float), VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}},
&vertexState); &vertexState);
@ -270,7 +270,7 @@ TEST_P(VertexStateTest, ZeroStride) {
// This test was failing only on AMD but the OpenGL backend doesn't gather PCI info yet. // This test was failing only on AMD but the OpenGL backend doesn't gather PCI info yet.
DAWN_SUPPRESS_TEST_IF(IsLinux() && IsOpenGL()); DAWN_SUPPRESS_TEST_IF(IsLinux() && IsOpenGL());
utils::ComboVertexStateDescriptor vertexState; utils::ComboVertexState vertexState;
MakeVertexState({{0, VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}}, &vertexState); MakeVertexState({{0, VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}}, &vertexState);
wgpu::RenderPipeline pipeline = wgpu::RenderPipeline pipeline =
MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float32x4, VertexStepMode::Vertex}}); MakeTestPipeline(vertexState, 0, {{0, VertexFormat::Float32x4, VertexStepMode::Vertex}});
@ -291,7 +291,7 @@ TEST_P(VertexStateTest, AttributeExpanding) {
// R32F case // R32F case
{ {
utils::ComboVertexStateDescriptor vertexState; utils::ComboVertexState vertexState;
MakeVertexState({{0, VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32}}}}, MakeVertexState({{0, VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32}}}},
&vertexState); &vertexState);
wgpu::RenderPipeline pipeline = wgpu::RenderPipeline pipeline =
@ -302,7 +302,7 @@ TEST_P(VertexStateTest, AttributeExpanding) {
} }
// RG32F case // RG32F case
{ {
utils::ComboVertexStateDescriptor vertexState; utils::ComboVertexState vertexState;
MakeVertexState({{0, VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x2}}}}, MakeVertexState({{0, VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x2}}}},
&vertexState); &vertexState);
wgpu::RenderPipeline pipeline = MakeTestPipeline( wgpu::RenderPipeline pipeline = MakeTestPipeline(
@ -313,7 +313,7 @@ TEST_P(VertexStateTest, AttributeExpanding) {
} }
// RGB32F case // RGB32F case
{ {
utils::ComboVertexStateDescriptor vertexState; utils::ComboVertexState vertexState;
MakeVertexState({{0, VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x3}}}}, MakeVertexState({{0, VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x3}}}},
&vertexState); &vertexState);
wgpu::RenderPipeline pipeline = MakeTestPipeline( wgpu::RenderPipeline pipeline = MakeTestPipeline(
@ -329,7 +329,7 @@ TEST_P(VertexStateTest, StrideLargerThanAttributes) {
// This test was failing only on AMD but the OpenGL backend doesn't gather PCI info yet. // This test was failing only on AMD but the OpenGL backend doesn't gather PCI info yet.
DAWN_SUPPRESS_TEST_IF(IsLinux() && IsOpenGL()); DAWN_SUPPRESS_TEST_IF(IsLinux() && IsOpenGL());
utils::ComboVertexStateDescriptor vertexState; utils::ComboVertexState vertexState;
MakeVertexState( MakeVertexState(
{{8 * sizeof(float), VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}}, {{8 * sizeof(float), VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}},
&vertexState); &vertexState);
@ -348,7 +348,7 @@ TEST_P(VertexStateTest, StrideLargerThanAttributes) {
// Test two attributes at an offset, vertex version // Test two attributes at an offset, vertex version
TEST_P(VertexStateTest, TwoAttributesAtAnOffsetVertex) { TEST_P(VertexStateTest, TwoAttributesAtAnOffsetVertex) {
utils::ComboVertexStateDescriptor vertexState; utils::ComboVertexState vertexState;
MakeVertexState( MakeVertexState(
{{8 * sizeof(float), {{8 * sizeof(float),
VertexStepMode::Vertex, VertexStepMode::Vertex,
@ -369,7 +369,7 @@ TEST_P(VertexStateTest, TwoAttributesAtAnOffsetVertex) {
// Test two attributes at an offset, instance version // Test two attributes at an offset, instance version
TEST_P(VertexStateTest, TwoAttributesAtAnOffsetInstance) { TEST_P(VertexStateTest, TwoAttributesAtAnOffsetInstance) {
utils::ComboVertexStateDescriptor vertexState; utils::ComboVertexState vertexState;
MakeVertexState( MakeVertexState(
{{8 * sizeof(float), {{8 * sizeof(float),
VertexStepMode::Instance, VertexStepMode::Instance,
@ -390,7 +390,7 @@ TEST_P(VertexStateTest, TwoAttributesAtAnOffsetInstance) {
// Test a pure-instance input state // Test a pure-instance input state
TEST_P(VertexStateTest, PureInstance) { TEST_P(VertexStateTest, PureInstance) {
utils::ComboVertexStateDescriptor vertexState; utils::ComboVertexState vertexState;
MakeVertexState( MakeVertexState(
{{4 * sizeof(float), VertexStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}}, {{4 * sizeof(float), VertexStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}},
&vertexState); &vertexState);
@ -411,7 +411,7 @@ TEST_P(VertexStateTest, PureInstance) {
// Test with mixed everything, vertex vs. instance, different stride and offsets // Test with mixed everything, vertex vs. instance, different stride and offsets
// different attribute types // different attribute types
TEST_P(VertexStateTest, MixedEverything) { TEST_P(VertexStateTest, MixedEverything) {
utils::ComboVertexStateDescriptor vertexState; utils::ComboVertexState vertexState;
MakeVertexState( MakeVertexState(
{{12 * sizeof(float), {{12 * sizeof(float),
VertexStepMode::Vertex, VertexStepMode::Vertex,
@ -447,7 +447,7 @@ TEST_P(VertexStateTest, MixedEverything) {
// Test input state is unaffected by unused vertex slot // Test input state is unaffected by unused vertex slot
TEST_P(VertexStateTest, UnusedVertexSlot) { TEST_P(VertexStateTest, UnusedVertexSlot) {
// Instance input state, using slot 1 // Instance input state, using slot 1
utils::ComboVertexStateDescriptor instanceVertexState; utils::ComboVertexState instanceVertexState;
MakeVertexState( MakeVertexState(
{{0, VertexStepMode::Vertex, {}}, {{0, VertexStepMode::Vertex, {}},
{4 * sizeof(float), VertexStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}}, {4 * sizeof(float), VertexStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}},
@ -488,7 +488,7 @@ TEST_P(VertexStateTest, UnusedVertexSlot) {
// SetVertexBuffer should be reapplied when the input state changes. // SetVertexBuffer should be reapplied when the input state changes.
TEST_P(VertexStateTest, MultiplePipelinesMixedVertexState) { TEST_P(VertexStateTest, MultiplePipelinesMixedVertexState) {
// Basic input state, using slot 0 // Basic input state, using slot 0
utils::ComboVertexStateDescriptor vertexVertexState; utils::ComboVertexState vertexVertexState;
MakeVertexState( MakeVertexState(
{{4 * sizeof(float), VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}}, {{4 * sizeof(float), VertexStepMode::Vertex, {{0, 0, VertexFormat::Float32x4}}}},
&vertexVertexState); &vertexVertexState);
@ -496,7 +496,7 @@ TEST_P(VertexStateTest, MultiplePipelinesMixedVertexState) {
vertexVertexState, 1, {{0, VertexFormat::Float32x4, VertexStepMode::Vertex}}); vertexVertexState, 1, {{0, VertexFormat::Float32x4, VertexStepMode::Vertex}});
// Instance input state, using slot 1 // Instance input state, using slot 1
utils::ComboVertexStateDescriptor instanceVertexState; utils::ComboVertexState instanceVertexState;
MakeVertexState( MakeVertexState(
{{0, VertexStepMode::Instance, {}}, {{0, VertexStepMode::Instance, {}},
{4 * sizeof(float), VertexStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}}, {4 * sizeof(float), VertexStepMode::Instance, {{0, 0, VertexFormat::Float32x4}}}},
@ -538,7 +538,7 @@ TEST_P(VertexStateTest, MultiplePipelinesMixedVertexState) {
TEST_P(VertexStateTest, LastAllowedVertexBuffer) { TEST_P(VertexStateTest, LastAllowedVertexBuffer) {
constexpr uint32_t kBufferIndex = kMaxVertexBuffers - 1; constexpr uint32_t kBufferIndex = kMaxVertexBuffers - 1;
utils::ComboVertexStateDescriptor vertexState; utils::ComboVertexState vertexState;
// All the other vertex buffers default to no attributes // All the other vertex buffers default to no attributes
vertexState.vertexBufferCount = kMaxVertexBuffers; vertexState.vertexBufferCount = kMaxVertexBuffers;
vertexState.cVertexBuffers[kBufferIndex].arrayStride = 4 * sizeof(float); vertexState.cVertexBuffers[kBufferIndex].arrayStride = 4 * sizeof(float);
@ -560,7 +560,7 @@ TEST_P(VertexStateTest, LastAllowedVertexBuffer) {
TEST_P(VertexStateTest, OverlappingVertexAttributes) { TEST_P(VertexStateTest, OverlappingVertexAttributes) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 3, 3); utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 3, 3);
utils::ComboVertexStateDescriptor vertexState; utils::ComboVertexState vertexState;
MakeVertexState({{16, MakeVertexState({{16,
VertexStepMode::Vertex, VertexStepMode::Vertex,
{ {

View File

@ -20,7 +20,7 @@
class VertexStateTest : public ValidationTest { class VertexStateTest : public ValidationTest {
protected: protected:
void CreatePipeline(bool success, void CreatePipeline(bool success,
const utils::ComboVertexStateDescriptor& state, const utils::ComboVertexState& state,
const char* vertexSource) { const char* vertexSource) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vertexSource); wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vertexSource);
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
@ -52,13 +52,13 @@ class VertexStateTest : public ValidationTest {
// Check an empty vertex input is valid // Check an empty vertex input is valid
TEST_F(VertexStateTest, EmptyIsOk) { TEST_F(VertexStateTest, EmptyIsOk) {
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
CreatePipeline(true, state, kDummyVertexShader); CreatePipeline(true, state, kDummyVertexShader);
} }
// Check null buffer is valid // Check null buffer is valid
TEST_F(VertexStateTest, NullBufferIsOk) { TEST_F(VertexStateTest, NullBufferIsOk) {
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
// One null buffer (buffer[0]) is OK // One null buffer (buffer[0]) is OK
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].arrayStride = 0; state.cVertexBuffers[0].arrayStride = 0;
@ -87,7 +87,7 @@ TEST_F(VertexStateTest, NullBufferIsOk) {
// Check validation that pipeline vertex buffers are backed by attributes in the vertex input // Check validation that pipeline vertex buffers are backed by attributes in the vertex input
// Check validation that pipeline vertex buffers are backed by attributes in the vertex input // Check validation that pipeline vertex buffers are backed by attributes in the vertex input
TEST_F(VertexStateTest, PipelineCompatibility) { TEST_F(VertexStateTest, PipelineCompatibility) {
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].arrayStride = 2 * sizeof(float); state.cVertexBuffers[0].arrayStride = 2 * sizeof(float);
state.cVertexBuffers[0].attributeCount = 2; state.cVertexBuffers[0].attributeCount = 2;
@ -127,7 +127,7 @@ TEST_F(VertexStateTest, PipelineCompatibility) {
// Test that a arrayStride of 0 is valid // Test that a arrayStride of 0 is valid
TEST_F(VertexStateTest, StrideZero) { TEST_F(VertexStateTest, StrideZero) {
// Works ok without attributes // Works ok without attributes
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].arrayStride = 0; state.cVertexBuffers[0].arrayStride = 0;
state.cVertexBuffers[0].attributeCount = 1; state.cVertexBuffers[0].attributeCount = 1;
@ -142,7 +142,7 @@ TEST_F(VertexStateTest, StrideZero) {
// if vertex buffer arrayStride is not zero. // if vertex buffer arrayStride is not zero.
TEST_F(VertexStateTest, SetOffsetOutOfBounds) { TEST_F(VertexStateTest, SetOffsetOutOfBounds) {
// Control case, setting correct arrayStride and offset // Control case, setting correct arrayStride and offset
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].arrayStride = 2 * sizeof(float); state.cVertexBuffers[0].arrayStride = 2 * sizeof(float);
state.cVertexBuffers[0].attributeCount = 2; state.cVertexBuffers[0].attributeCount = 2;
@ -163,7 +163,7 @@ TEST_F(VertexStateTest, SetOffsetOutOfBounds) {
// Check out of bounds condition on total number of vertex buffers // Check out of bounds condition on total number of vertex buffers
TEST_F(VertexStateTest, SetVertexBuffersNumLimit) { TEST_F(VertexStateTest, SetVertexBuffersNumLimit) {
// Control case, setting max vertex buffer number // Control case, setting max vertex buffer number
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = kMaxVertexBuffers; state.vertexBufferCount = kMaxVertexBuffers;
for (uint32_t i = 0; i < kMaxVertexBuffers; ++i) { for (uint32_t i = 0; i < kMaxVertexBuffers; ++i) {
state.cVertexBuffers[i].attributeCount = 1; state.cVertexBuffers[i].attributeCount = 1;
@ -180,7 +180,7 @@ TEST_F(VertexStateTest, SetVertexBuffersNumLimit) {
// Check out of bounds condition on total number of vertex attributes // Check out of bounds condition on total number of vertex attributes
TEST_F(VertexStateTest, SetVertexAttributesNumLimit) { TEST_F(VertexStateTest, SetVertexAttributesNumLimit) {
// Control case, setting max vertex attribute number // Control case, setting max vertex attribute number
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 2; state.vertexBufferCount = 2;
state.cVertexBuffers[0].attributeCount = kMaxVertexAttributes; state.cVertexBuffers[0].attributeCount = kMaxVertexAttributes;
for (uint32_t i = 0; i < kMaxVertexAttributes; ++i) { for (uint32_t i = 0; i < kMaxVertexAttributes; ++i) {
@ -197,7 +197,7 @@ TEST_F(VertexStateTest, SetVertexAttributesNumLimit) {
// Check out of bounds condition on input arrayStride // Check out of bounds condition on input arrayStride
TEST_F(VertexStateTest, SetInputStrideOutOfBounds) { TEST_F(VertexStateTest, SetInputStrideOutOfBounds) {
// Control case, setting max input arrayStride // Control case, setting max input arrayStride
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].arrayStride = kMaxVertexBufferArrayStride; state.cVertexBuffers[0].arrayStride = kMaxVertexBufferArrayStride;
state.cVertexBuffers[0].attributeCount = 1; state.cVertexBuffers[0].attributeCount = 1;
@ -211,7 +211,7 @@ TEST_F(VertexStateTest, SetInputStrideOutOfBounds) {
// Check multiple of 4 bytes constraint on input arrayStride // Check multiple of 4 bytes constraint on input arrayStride
TEST_F(VertexStateTest, SetInputStrideNotAligned) { TEST_F(VertexStateTest, SetInputStrideNotAligned) {
// Control case, setting input arrayStride 4 bytes. // Control case, setting input arrayStride 4 bytes.
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].arrayStride = 4; state.cVertexBuffers[0].arrayStride = 4;
state.cVertexBuffers[0].attributeCount = 1; state.cVertexBuffers[0].attributeCount = 1;
@ -225,7 +225,7 @@ TEST_F(VertexStateTest, SetInputStrideNotAligned) {
// Test that we cannot set an already set attribute // Test that we cannot set an already set attribute
TEST_F(VertexStateTest, AlreadySetAttribute) { TEST_F(VertexStateTest, AlreadySetAttribute) {
// Control case, setting attribute 0 // Control case, setting attribute 0
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].attributeCount = 1; state.cVertexBuffers[0].attributeCount = 1;
state.cAttributes[0].shaderLocation = 0; state.cAttributes[0].shaderLocation = 0;
@ -241,7 +241,7 @@ TEST_F(VertexStateTest, AlreadySetAttribute) {
// Test that a arrayStride of 0 is valid // Test that a arrayStride of 0 is valid
TEST_F(VertexStateTest, SetSameShaderLocation) { TEST_F(VertexStateTest, SetSameShaderLocation) {
// Control case, setting different shader locations in two attributes // Control case, setting different shader locations in two attributes
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].attributeCount = 2; state.cVertexBuffers[0].attributeCount = 2;
state.cAttributes[0].shaderLocation = 0; state.cAttributes[0].shaderLocation = 0;
@ -266,7 +266,7 @@ TEST_F(VertexStateTest, SetSameShaderLocation) {
// Check out of bounds condition on attribute shader location // Check out of bounds condition on attribute shader location
TEST_F(VertexStateTest, SetAttributeLocationOutOfBounds) { TEST_F(VertexStateTest, SetAttributeLocationOutOfBounds) {
// Control case, setting last attribute shader location // Control case, setting last attribute shader location
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].attributeCount = 1; state.cVertexBuffers[0].attributeCount = 1;
state.cAttributes[0].shaderLocation = kMaxVertexAttributes - 1; state.cAttributes[0].shaderLocation = kMaxVertexAttributes - 1;
@ -280,7 +280,7 @@ TEST_F(VertexStateTest, SetAttributeLocationOutOfBounds) {
// Check attribute offset out of bounds // Check attribute offset out of bounds
TEST_F(VertexStateTest, SetAttributeOffsetOutOfBounds) { TEST_F(VertexStateTest, SetAttributeOffsetOutOfBounds) {
// Control case, setting max attribute offset for FloatR32 vertex format // Control case, setting max attribute offset for FloatR32 vertex format
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].attributeCount = 1; state.cVertexBuffers[0].attributeCount = 1;
state.cAttributes[0].offset = kMaxVertexBufferArrayStride - sizeof(wgpu::VertexFormat::Float32); state.cAttributes[0].offset = kMaxVertexBufferArrayStride - sizeof(wgpu::VertexFormat::Float32);
@ -294,7 +294,7 @@ TEST_F(VertexStateTest, SetAttributeOffsetOutOfBounds) {
// Check the min(4, formatSize) alignment constraint for the offset. // Check the min(4, formatSize) alignment constraint for the offset.
TEST_F(VertexStateTest, SetOffsetNotAligned) { TEST_F(VertexStateTest, SetOffsetNotAligned) {
// Control case, setting the offset at the correct alignments. // Control case, setting the offset at the correct alignments.
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].attributeCount = 1; state.cVertexBuffers[0].attributeCount = 1;
@ -333,7 +333,7 @@ TEST_F(VertexStateTest, SetOffsetNotAligned) {
// Check attribute offset overflow // Check attribute offset overflow
TEST_F(VertexStateTest, SetAttributeOffsetOverflow) { TEST_F(VertexStateTest, SetAttributeOffsetOverflow) {
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].attributeCount = 1; state.cVertexBuffers[0].attributeCount = 1;
state.cAttributes[0].offset = std::numeric_limits<uint32_t>::max(); state.cAttributes[0].offset = std::numeric_limits<uint32_t>::max();
@ -342,7 +342,7 @@ TEST_F(VertexStateTest, SetAttributeOffsetOverflow) {
// Check for some potential underflow in the vertex input validation // Check for some potential underflow in the vertex input validation
TEST_F(VertexStateTest, VertexFormatLargerThanNonZeroStride) { TEST_F(VertexStateTest, VertexFormatLargerThanNonZeroStride) {
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].arrayStride = 4; state.cVertexBuffers[0].arrayStride = 4;
state.cVertexBuffers[0].attributeCount = 1; state.cVertexBuffers[0].attributeCount = 1;
@ -353,7 +353,7 @@ TEST_F(VertexStateTest, VertexFormatLargerThanNonZeroStride) {
// Check that the vertex format base type must match the shader's variable base type. // Check that the vertex format base type must match the shader's variable base type.
TEST_F(VertexStateTest, BaseTypeMatching) { TEST_F(VertexStateTest, BaseTypeMatching) {
auto DoTest = [&](wgpu::VertexFormat format, std::string shaderType, bool success) { auto DoTest = [&](wgpu::VertexFormat format, std::string shaderType, bool success) {
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].arrayStride = 16; state.cVertexBuffers[0].arrayStride = 16;
state.cVertexBuffers[0].attributeCount = 1; state.cVertexBuffers[0].attributeCount = 1;
@ -407,7 +407,7 @@ TEST_F(VertexStateTest, BaseTypeMatching) {
// Check that we only check base type compatibility for vertex inputs the shader uses. // Check that we only check base type compatibility for vertex inputs the shader uses.
TEST_F(VertexStateTest, BaseTypeMatchingForInexistentInput) { TEST_F(VertexStateTest, BaseTypeMatchingForInexistentInput) {
auto DoTest = [&](wgpu::VertexFormat format) { auto DoTest = [&](wgpu::VertexFormat format) {
utils::ComboVertexStateDescriptor state; utils::ComboVertexState state;
state.vertexBufferCount = 1; state.vertexBufferCount = 1;
state.cVertexBuffers[0].arrayStride = 16; state.cVertexBuffers[0].arrayStride = 16;
state.cVertexBuffers[0].attributeCount = 1; state.cVertexBuffers[0].attributeCount = 1;

View File

@ -20,11 +20,11 @@ namespace utils {
// For creating deprecated render pipeline descriptors // For creating deprecated render pipeline descriptors
ComboVertexStateDescriptor::ComboVertexStateDescriptor() { ComboVertexState::ComboVertexState() {
vertexBufferCount = 0; vertexBufferCount = 0;
// Fill the default values for vertexBuffers and vertexAttributes in buffers. // Fill the default values for vertexBuffers and vertexAttributes in buffers.
wgpu::VertexAttributeDescriptor vertexAttribute; wgpu::VertexAttribute vertexAttribute;
vertexAttribute.shaderLocation = 0; vertexAttribute.shaderLocation = 0;
vertexAttribute.offset = 0; vertexAttribute.offset = 0;
vertexAttribute.format = wgpu::VertexFormat::Float32; vertexAttribute.format = wgpu::VertexFormat::Float32;

View File

@ -24,18 +24,18 @@
namespace utils { namespace utils {
// Primarily used by tests to easily set up the vertex buffer state portion of a RenderPipeline. // Primarily used by tests to easily set up the vertex buffer state portion of a RenderPipeline.
class ComboVertexStateDescriptor { class ComboVertexState {
public: public:
ComboVertexStateDescriptor(); ComboVertexState();
ComboVertexStateDescriptor(const ComboVertexStateDescriptor&) = delete; ComboVertexState(const ComboVertexState&) = delete;
ComboVertexStateDescriptor& operator=(const ComboVertexStateDescriptor&) = delete; ComboVertexState& operator=(const ComboVertexState&) = delete;
ComboVertexStateDescriptor(ComboVertexStateDescriptor&&) = delete; ComboVertexState(ComboVertexState&&) = delete;
ComboVertexStateDescriptor& operator=(ComboVertexStateDescriptor&&) = delete; ComboVertexState& operator=(ComboVertexState&&) = delete;
uint32_t vertexBufferCount; uint32_t vertexBufferCount;
std::array<wgpu::VertexBufferLayoutDescriptor, kMaxVertexBuffers> cVertexBuffers; std::array<wgpu::VertexBufferLayout, kMaxVertexBuffers> cVertexBuffers;
std::array<wgpu::VertexAttributeDescriptor, kMaxVertexAttributes> cAttributes; std::array<wgpu::VertexAttribute, kMaxVertexAttributes> cAttributes;
}; };
class ComboRenderPipelineDescriptor : public wgpu::RenderPipelineDescriptor { class ComboRenderPipelineDescriptor : public wgpu::RenderPipelineDescriptor {