Remove indirection for vertexStage

This is to match the work in progress webgpu.h header.

Also contains a fix for the wire where it wouldn't GetExtraRequiredSize
for structures that are by-value members of other structures.

BUG=dawn:22

Change-Id: I3c706bf9cd7a550d40fd667877f032c860d0a032
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9382
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2019-09-05 09:35:07 +00:00 committed by Commit Bot service account
parent d55bd7ad94
commit c6c7a42e6e
53 changed files with 112 additions and 119 deletions

View File

@ -1051,7 +1051,7 @@
"extensible": true,
"members": [
{"name": "layout", "type": "pipeline layout"},
{"name": "vertex stage", "type": "pipeline stage descriptor", "annotation": "const*"},
{"name": "vertex stage", "type": "pipeline stage descriptor"},
{"name": "fragment stage", "type": "pipeline stage descriptor", "annotation": "const*", "optional": true},
{"name": "vertex input", "type": "vertex input descriptor", "annotation": "const*", "optional": true},
{"name": "primitive topology", "type": "primitive topology"},

View File

@ -117,7 +117,7 @@ void init() {
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();

View File

@ -61,11 +61,9 @@ void init() {
DawnRenderPipelineDescriptor descriptor;
descriptor.nextInChain = nullptr;
DawnPipelineStageDescriptor vertexStage;
vertexStage.nextInChain = nullptr;
vertexStage.module = vsModule;
vertexStage.entryPoint = "main";
descriptor.vertexStage = &vertexStage;
descriptor.vertexStage.nextInChain = nullptr;
descriptor.vertexStage.module = vsModule;
descriptor.vertexStage.entryPoint = "main";
DawnPipelineStageDescriptor fragmentStage;
fragmentStage.nextInChain = nullptr;

View File

@ -122,7 +122,7 @@ void initRender() {
depthStencilView = CreateDefaultDepthStencilView(device);
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cVertexInput.bufferCount = 2;

View File

@ -127,7 +127,7 @@ void init() {
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cVertexInput.bufferCount = 1;
descriptor.cVertexInput.cBuffers[0].stride = 4 * sizeof(float);

View File

@ -205,7 +205,7 @@ void init() {
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.layout = pl;
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.vertexInput = &vertexInput;
descriptor.depthStencilState = &descriptor.cDepthStencilState;
@ -218,7 +218,7 @@ void init() {
utils::ComboRenderPipelineDescriptor pDescriptor(device);
pDescriptor.layout = pl;
pDescriptor.cVertexStage.module = vsModule;
pDescriptor.vertexStage.module = vsModule;
pDescriptor.cFragmentStage.module = fsModule;
pDescriptor.vertexInput = &vertexInput;
pDescriptor.depthStencilState = &pDescriptor.cDepthStencilState;
@ -232,7 +232,7 @@ void init() {
utils::ComboRenderPipelineDescriptor rfDescriptor(device);
rfDescriptor.layout = pl;
rfDescriptor.cVertexStage.module = vsModule;
rfDescriptor.vertexStage.module = vsModule;
rfDescriptor.cFragmentStage.module = fsReflectionModule;
rfDescriptor.vertexInput = &vertexInput;
rfDescriptor.depthStencilState = &rfDescriptor.cDepthStencilState;

View File

@ -123,23 +123,27 @@
{% endfor %}
//* Gather how much space will be needed for pointer members.
{% for member in members if member.annotation != "value" and member.length != "strlen" and not member.skip_serialize %}
{% for member in members if member.length != "strlen" and not member.skip_serialize %}
{% if member.type.category != "object" and member.optional %}
if (record.{{as_varName(member.name)}} != nullptr)
{% endif %}
{
size_t memberLength = {{member_length(member, "record.")}};
result += memberLength * {{member_transfer_sizeof(member)}};
//* Structures might contain more pointers so we need to add their extra size as well.
{% if member.type.category == "structure" %}
for (size_t i = 0; i < memberLength; ++i) {
{% if member.annotation == "const*const*" %}
result += {{as_cType(member.type.name)}}GetExtraRequiredSize(*record.{{as_varName(member.name)}}[i]);
{% else %}
result += {{as_cType(member.type.name)}}GetExtraRequiredSize(record.{{as_varName(member.name)}}[i]);
{% endif %}
}
{% if member.annotation != "value" %}
size_t memberLength = {{member_length(member, "record.")}};
result += memberLength * {{member_transfer_sizeof(member)}};
//* Structures might contain more pointers so we need to add their extra size as well.
{% if member.type.category == "structure" %}
for (size_t i = 0; i < memberLength; ++i) {
{% if member.annotation == "const*const*" %}
result += {{as_cType(member.type.name)}}GetExtraRequiredSize(*record.{{as_varName(member.name)}}[i]);
{% else %}
{{assert(member.annotation == "const*")}}
result += {{as_cType(member.type.name)}}GetExtraRequiredSize(record.{{as_varName(member.name)}}[i]);
{% endif %}
}
{% endif %}
{% elif member.type.category == "structure" %}
result += {{as_cType(member.type.name)}}GetExtraRequiredSize(record.{{as_varName(member.name)}});
{% endif %}
}
{% endfor %}
@ -192,8 +196,8 @@
{
size_t memberLength = {{member_length(member, "record.")}};
auto memberBuffer = reinterpret_cast<{{member_transfer_type(member)}}*>(*buffer);
*buffer += memberLength * {{member_transfer_sizeof(member)}};
for (size_t i = 0; i < memberLength; ++i) {
{{serialize_member(member, "record." + memberName + "[i]", "memberBuffer[i]" )}}
}

View File

@ -283,7 +283,7 @@ namespace dawn_native {
}
DAWN_TRY(ValidatePrimitiveTopology(descriptor->primitiveTopology));
DAWN_TRY(ValidatePipelineStageDescriptor(device, descriptor->vertexStage,
DAWN_TRY(ValidatePipelineStageDescriptor(device, &descriptor->vertexStage,
descriptor->layout, SingleShaderStage::Vertex));
DAWN_TRY(ValidatePipelineStageDescriptor(device, descriptor->fragmentStage,
descriptor->layout, SingleShaderStage::Fragment));
@ -292,7 +292,7 @@ namespace dawn_native {
DAWN_TRY(ValidateRasterizationStateDescriptor(descriptor->rasterizationState));
}
if ((descriptor->vertexStage->module->GetUsedVertexAttributes() & ~attributesSetMask)
if ((descriptor->vertexStage.module->GetUsedVertexAttributes() & ~attributesSetMask)
.any()) {
return DAWN_VALIDATION_ERROR(
"Pipeline vertex stage uses inputs not in the input state");
@ -361,8 +361,8 @@ namespace dawn_native {
mPrimitiveTopology(descriptor->primitiveTopology),
mSampleMask(descriptor->sampleMask),
mAlphaToCoverageEnabled(descriptor->alphaToCoverageEnabled),
mVertexModule(descriptor->vertexStage->module),
mVertexEntryPoint(descriptor->vertexStage->entryPoint),
mVertexModule(descriptor->vertexStage.module),
mVertexEntryPoint(descriptor->vertexStage.entryPoint),
mFragmentModule(descriptor->fragmentStage->module),
mFragmentEntryPoint(descriptor->fragmentStage->entryPoint),
mIsBlueprint(blueprint) {

View File

@ -312,8 +312,8 @@ namespace dawn_native { namespace d3d12 {
D3D12_SHADER_BYTECODE* shader = nullptr;
switch (stage) {
case SingleShaderStage::Vertex:
module = ToBackend(descriptor->vertexStage->module);
entryPoint = descriptor->vertexStage->entryPoint;
module = ToBackend(descriptor->vertexStage.module);
entryPoint = descriptor->vertexStage.entryPoint;
shader = &descriptorD3D12.VS;
compileTarget = "vs_5_1";
break;

View File

@ -314,8 +314,8 @@ namespace dawn_native { namespace metal {
MTLRenderPipelineDescriptor* descriptorMTL = [MTLRenderPipelineDescriptor new];
const ShaderModule* vertexModule = ToBackend(descriptor->vertexStage->module);
const char* vertexEntryPoint = descriptor->vertexStage->entryPoint;
const ShaderModule* vertexModule = ToBackend(descriptor->vertexStage.module);
const char* vertexEntryPoint = descriptor->vertexStage.entryPoint;
ShaderModule::MetalFunctionData vertexData = vertexModule->GetFunction(
vertexEntryPoint, SingleShaderStage::Vertex, ToBackend(GetLayout()));
descriptorMTL.vertexFunction = vertexData.function;

View File

@ -198,7 +198,7 @@ namespace dawn_native { namespace opengl {
mVertexArrayObject(0),
mGlPrimitiveTopology(GLPrimitiveTopology(GetPrimitiveTopology())) {
PerStage<const ShaderModule*> modules(nullptr);
modules[SingleShaderStage::Vertex] = ToBackend(descriptor->vertexStage->module);
modules[SingleShaderStage::Vertex] = ToBackend(descriptor->vertexStage.module);
modules[SingleShaderStage::Fragment] = ToBackend(descriptor->fragmentStage->module);
PipelineGL::Initialize(device->gl, ToBackend(GetLayout()), modules);

View File

@ -320,8 +320,8 @@ namespace dawn_native { namespace vulkan {
shaderStages[0].flags = 0;
shaderStages[0].stage = VK_SHADER_STAGE_VERTEX_BIT;
shaderStages[0].pSpecializationInfo = nullptr;
shaderStages[0].module = ToBackend(descriptor->vertexStage->module)->GetHandle();
shaderStages[0].pName = descriptor->vertexStage->entryPoint;
shaderStages[0].module = ToBackend(descriptor->vertexStage.module)->GetHandle();
shaderStages[0].pName = descriptor->vertexStage.entryPoint;
shaderStages[1].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
shaderStages[1].pNext = nullptr;

View File

@ -124,7 +124,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
utils::ComboRenderPipelineDescriptor textureDescriptor(device);
textureDescriptor.layout = pipelineLayout;
textureDescriptor.cVertexStage.module = vsModule;
textureDescriptor.vertexStage.module = vsModule;
textureDescriptor.cFragmentStage.module = fsModule;
textureDescriptor.cColorStates[0]->format = renderPass.colorFormat;
@ -205,7 +205,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
pipelineDescriptor.layout = pipelineLayout;
pipelineDescriptor.cVertexStage.module = vsModule;
pipelineDescriptor.vertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = fsModule;
pipelineDescriptor.cColorStates[0]->format = renderPass.colorFormat;
@ -329,7 +329,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
utils::ComboRenderPipelineDescriptor textureDescriptor(device);
textureDescriptor.layout = pipelineLayout;
textureDescriptor.cVertexStage.module = vsModule;
textureDescriptor.vertexStage.module = vsModule;
textureDescriptor.cFragmentStage.module = fsModule;
textureDescriptor.cColorStates[0]->format = renderPass.colorFormat;
@ -422,7 +422,7 @@ TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets)
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
pipelineDescriptor.layout = pipelineLayout;
pipelineDescriptor.cVertexStage.module = vsModule;
pipelineDescriptor.vertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = fsModule;
pipelineDescriptor.cColorStates[0]->format = renderPass.colorFormat;

View File

@ -36,7 +36,7 @@ class ClipSpaceTest : public DawnTest {
void main() {
gl_Position = vec4(pos[gl_VertexIndex], 1.0);
})";
pipelineDescriptor.cVertexStage.module =
pipelineDescriptor.vertexStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
const char* fs =

View File

@ -71,7 +71,7 @@ class ColorStateTest : public DawnTest {
utils::ComboRenderPipelineDescriptor baseDescriptor(device);
baseDescriptor.layout = pipelineLayout;
baseDescriptor.cVertexStage.module = vsModule;
baseDescriptor.vertexStage.module = vsModule;
baseDescriptor.cFragmentStage.module = fsModule;
baseDescriptor.cColorStates[0]->format = renderPass.colorFormat;
@ -79,7 +79,7 @@ class ColorStateTest : public DawnTest {
utils::ComboRenderPipelineDescriptor testDescriptor(device);
testDescriptor.layout = pipelineLayout;
testDescriptor.cVertexStage.module = vsModule;
testDescriptor.vertexStage.module = vsModule;
testDescriptor.cFragmentStage.module = fsModule;
testDescriptor.cColorStates[0] = &colorStateDescriptor;
testDescriptor.cColorStates[0]->format = renderPass.colorFormat;
@ -797,7 +797,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
utils::ComboRenderPipelineDescriptor baseDescriptor(device);
baseDescriptor.layout = pipelineLayout;
baseDescriptor.cVertexStage.module = vsModule;
baseDescriptor.vertexStage.module = vsModule;
baseDescriptor.cFragmentStage.module = fsModule;
baseDescriptor.colorStateCount = 4;
@ -805,7 +805,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
utils::ComboRenderPipelineDescriptor testDescriptor(device);
testDescriptor.layout = pipelineLayout;
testDescriptor.cVertexStage.module = vsModule;
testDescriptor.vertexStage.module = vsModule;
testDescriptor.cFragmentStage.module = fsModule;
testDescriptor.colorStateCount = 4;
@ -899,7 +899,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
utils::ComboRenderPipelineDescriptor baseDescriptor(device);
baseDescriptor.layout = pipelineLayout;
baseDescriptor.cVertexStage.module = vsModule;
baseDescriptor.vertexStage.module = vsModule;
baseDescriptor.cFragmentStage.module = fsModule;
baseDescriptor.cColorStates[0]->format = renderPass.colorFormat;
@ -907,7 +907,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
utils::ComboRenderPipelineDescriptor testDescriptor(device);
testDescriptor.layout = pipelineLayout;
testDescriptor.cVertexStage.module = vsModule;
testDescriptor.vertexStage.module = vsModule;
testDescriptor.cFragmentStage.module = fsModule;
testDescriptor.cColorStates[0]->format = renderPass.colorFormat;
@ -1023,7 +1023,7 @@ TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) {
utils::ComboRenderPipelineDescriptor baseDescriptor(device);
baseDescriptor.layout = pipelineLayout;
baseDescriptor.cVertexStage.module = vsModule;
baseDescriptor.vertexStage.module = vsModule;
baseDescriptor.cFragmentStage.module = fsModule;
baseDescriptor.cColorStates[0]->format = renderPass.colorFormat;
@ -1031,7 +1031,7 @@ TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) {
utils::ComboRenderPipelineDescriptor testDescriptor(device);
testDescriptor.layout = pipelineLayout;
testDescriptor.cVertexStage.module = vsModule;
testDescriptor.vertexStage.module = vsModule;
testDescriptor.cFragmentStage.module = fsModule;
testDescriptor.cColorStates[0]->format = renderPass.colorFormat;
testDescriptor.cColorStates[0]->writeMask = dawn::ColorWriteMask::Red;

View File

@ -163,7 +163,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
void main() {
fragColor = texture(sampler2D(texture0, sampler0), texCoord);
})");
renderPipelineDescriptor.cVertexStage.module = vsModule;
renderPipelineDescriptor.vertexStage.module = vsModule;
renderPipelineDescriptor.cFragmentStage.module = fsModule;
renderPipelineDescriptor.layout = pipelineLayout;
renderPipelineDescriptor.cColorStates[0]->format =

View File

@ -36,7 +36,7 @@ class CullingTest : public DawnTest {
void main() {
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
})";
pipelineDescriptor.cVertexStage.module =
pipelineDescriptor.vertexStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
// gl_FragCoord of pixel(x, y) in framebuffer coordinate is (x + 0.5, y + 0.5). And we use

View File

@ -275,7 +275,7 @@ class DepthStencilStateTest : public DawnTest {
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.layout = pipelineLayout;
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cDepthStencilState = test.depthStencilState;
descriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;

View File

@ -43,7 +43,7 @@ class DestroyTest : public DawnTest {
})");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
descriptor.cVertexInput.bufferCount = 1;

View File

@ -43,7 +43,7 @@ class DrawIndexedIndirectTest : public DawnTest {
})");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
descriptor.cVertexInput.bufferCount = 1;

View File

@ -43,7 +43,7 @@ class DrawIndexedTest : public DawnTest {
})");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
descriptor.cVertexInput.bufferCount = 1;

View File

@ -43,7 +43,7 @@ class DrawIndirectTest : public DawnTest {
})");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
descriptor.cVertexInput.bufferCount = 1;

View File

@ -43,7 +43,7 @@ class DrawTest : public DawnTest {
})");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
descriptor.cVertexInput.bufferCount = 1;

View File

@ -140,7 +140,7 @@ class DynamicBufferOffsetTests : public DawnTest {
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs.str().c_str());
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
pipelineDescriptor.cVertexStage.module = vsModule;
pipelineDescriptor.vertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = fsModule;
pipelineDescriptor.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;

View File

@ -303,7 +303,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
)");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vs;
descriptor.vertexStage.module = vs;
descriptor.cFragmentStage.module = fs;
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
descriptor.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;

View File

@ -48,7 +48,7 @@ class IndexFormatTest : public DawnTest {
})");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
descriptor.cVertexInput.indexFormat = format;

View File

@ -196,7 +196,7 @@ class MultisampledRenderingTest : public DawnTest {
void main() {
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
})";
pipelineDescriptor.cVertexStage.module =
pipelineDescriptor.vertexStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
pipelineDescriptor.cFragmentStage.module =

View File

@ -213,7 +213,7 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) {
EXPECT_EQ(pl.Get() == samePl.Get(), !UsesWire());
utils::ComboRenderPipelineDescriptor desc(device);
desc.cVertexStage.module =
desc.vertexStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
@ -269,13 +269,13 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) {
void main() {
})");
desc.cVertexStage.module = module;
desc.vertexStage.module = module;
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
desc.cVertexStage.module = sameModule;
desc.vertexStage.module = sameModule;
dawn::RenderPipeline samePipeline = device.CreateRenderPipeline(&desc);
desc.cVertexStage.module = otherModule;
desc.vertexStage.module = otherModule;
dawn::RenderPipeline otherPipeline = device.CreateRenderPipeline(&desc);
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
@ -305,7 +305,7 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) {
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
utils::ComboRenderPipelineDescriptor desc(device);
desc.cVertexStage.module =
desc.vertexStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {

View File

@ -179,7 +179,7 @@ TEST_P(OpArrayLengthTest, Fragment) {
.c_str());
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::PointList;
descriptor.cColorStates[0]->format = renderPass.colorFormat;
@ -240,7 +240,7 @@ TEST_P(OpArrayLengthTest, Vertex) {
})");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::PointList;
descriptor.cColorStates[0]->format = renderPass.colorFormat;

View File

@ -183,7 +183,7 @@ class PrimitiveTopologyTest : public DawnTest {
// Draw the vertices with the given primitive topology and check the pixel values of the test locations
void DoTest(dawn::PrimitiveTopology primitiveTopology, const std::vector<LocationSpec> &locationSpecs) {
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = primitiveTopology;
descriptor.cVertexInput.bufferCount = 1;

View File

@ -74,7 +74,7 @@ class RenderBundleTest : public DawnTest {
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.layout = pipelineLayout;
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
descriptor.cVertexInput.bufferCount = 1;

View File

@ -38,7 +38,7 @@ class DrawQuad {
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.layout = pipelineLayout;
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
auto renderPipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -44,7 +44,7 @@ protected:
})");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
descriptor.cColorStates[0]->format = kFormat;

View File

@ -75,7 +75,7 @@ protected:
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
pipelineDescriptor.layout = pipelineLayout;
pipelineDescriptor.cVertexStage.module = vsModule;
pipelineDescriptor.vertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = fsModule;
pipelineDescriptor.cColorStates[0]->format = mRenderPass.colorFormat;

View File

@ -40,7 +40,7 @@ class ScissorTest: public DawnTest {
})");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cColorStates[0]->format = format;

View File

@ -216,7 +216,7 @@ class TextureFormatTest : public DawnTest {
dawn::ShaderModule fsModule = utils::CreateShaderModule(
device, utils::SingleShaderStage::Fragment, fsSource.str().c_str());
desc.cVertexStage.module = vsModule;
desc.vertexStage.module = vsModule;
desc.cFragmentStage.module = fsModule;
desc.layout = utils::MakeBasicPipelineLayout(device, &bgl);
desc.cColorStates[0]->format = renderFormatInfo.format;

View File

@ -167,7 +167,7 @@ protected:
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fragmentShader);
utils::ComboRenderPipelineDescriptor textureDescriptor(device);
textureDescriptor.cVertexStage.module = mVSModule;
textureDescriptor.vertexStage.module = mVSModule;
textureDescriptor.cFragmentStage.module = fsModule;
textureDescriptor.layout = mPipelineLayout;
textureDescriptor.cColorStates[0]->format = mRenderPass.colorFormat;
@ -505,7 +505,7 @@ class TextureViewRenderingTest : public DawnTest {
device, utils::SingleShaderStage::Fragment, oneColorFragmentShader);
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
pipelineDescriptor.cVertexStage.module = vsModule;
pipelineDescriptor.vertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = oneColorFsModule;
pipelineDescriptor.cColorStates[0]->format = kDefaultFormat;

View File

@ -64,7 +64,7 @@ class TextureZeroInitTest : public DawnTest {
void main() {
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
})";
pipelineDescriptor.cVertexStage.module =
pipelineDescriptor.vertexStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
const char* fs =
@ -441,7 +441,7 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
// Create render pipeline
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
renderPipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bindGroupLayout);
renderPipelineDescriptor.cVertexStage.module =
renderPipelineDescriptor.vertexStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(#version 450
const vec2 pos[6] = vec2[6](vec2(-1.0f, -1.0f),
vec2(-1.0f, 1.0f),

View File

@ -360,7 +360,7 @@ class VertexFormatTest : public DawnTest {
}
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cVertexInput.bufferCount = 1;
descriptor.cVertexInput.cBuffers[0].stride = strideBytes;

View File

@ -128,7 +128,7 @@ class VertexInputTest : public DawnTest {
})");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.vertexInput = &vertexInput;
descriptor.cColorStates[0]->format = renderPass.colorFormat;
@ -541,7 +541,7 @@ TEST_P(OptionalVertexInputTest, Basic) {
})");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::PointList;
descriptor.vertexInput = nullptr;

View File

@ -40,7 +40,7 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) {
})");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = dawn::PrimitiveTopology::PointList;
descriptor.cColorStates[0]->format = renderPass.colorFormat;

View File

@ -44,7 +44,7 @@ class ViewportTest : public DawnTest {
color = vec4(0.0, 1.0, 0.0, 1.0);
}
})";
pipelineDescriptor.cVertexStage.module =
pipelineDescriptor.vertexStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
const char* fs =

View File

@ -630,7 +630,7 @@ class SetBindGroupValidationTest : public ValidationTest {
})");
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
pipelineDescriptor.cVertexStage.module = vsModule;
pipelineDescriptor.vertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = fsModule;
dawn::PipelineLayout pipelineLayout =
utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);

View File

@ -43,7 +43,7 @@ class DrawIndirectValidationTest : public ValidationTest {
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.layout = pipelineLayout;
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -96,7 +96,7 @@ namespace {
void InitializeRenderPipelineDescriptor(utils::ComboRenderPipelineDescriptor* descriptor) {
descriptor->layout = pipelineLayout;
descriptor->cVertexStage.module = vsModule;
descriptor->vertexStage.module = vsModule;
descriptor->cFragmentStage.module = fsModule;
descriptor->cVertexInput.bufferCount = 1;
descriptor->cVertexInput.cBuffers[0].stride = 2 * sizeof(float);

View File

@ -61,7 +61,7 @@ void main() {
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.layout = pipelineLayout;
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);

View File

@ -45,7 +45,7 @@ class RenderPipelineValidationTest : public ValidationTest {
TEST_F(RenderPipelineValidationTest, CreationSuccess) {
{
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
device.CreateRenderPipeline(&descriptor);
@ -53,7 +53,7 @@ TEST_F(RenderPipelineValidationTest, CreationSuccess) {
{
// Vertex input should be optional
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.vertexInput = nullptr;
@ -62,10 +62,9 @@ TEST_F(RenderPipelineValidationTest, CreationSuccess) {
{
// Rasterization state should be optional
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.rasterizationState = nullptr;
device.CreateRenderPipeline(&descriptor);
}
}
@ -75,7 +74,7 @@ TEST_F(RenderPipelineValidationTest, ColorStateRequired) {
{
// This one succeeds because attachment 0 is the color attachment
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.colorStateCount = 1;
@ -84,7 +83,7 @@ TEST_F(RenderPipelineValidationTest, ColorStateRequired) {
{ // Fail because lack of color states (and depth/stencil state)
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.colorStateCount = 0;
@ -97,7 +96,7 @@ TEST_F(RenderPipelineValidationTest, NonRenderableFormat) {
{
// Succeeds because RGBA8Unorm is renderable
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
@ -107,7 +106,7 @@ TEST_F(RenderPipelineValidationTest, NonRenderableFormat) {
{
// Fails because RG11B10Float is non-renderable
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.cColorStates[0]->format = dawn::TextureFormat::RG11B10Float;
@ -119,7 +118,7 @@ TEST_F(RenderPipelineValidationTest, NonRenderableFormat) {
TEST_F(RenderPipelineValidationTest, SampleCount) {
{
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.sampleCount = 4;
@ -128,7 +127,7 @@ TEST_F(RenderPipelineValidationTest, SampleCount) {
{
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.sampleCount = 3;
@ -154,7 +153,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
utils::ComboRenderPipelineDescriptor nonMultisampledPipelineDescriptor(device);
nonMultisampledPipelineDescriptor.sampleCount = 1;
nonMultisampledPipelineDescriptor.cVertexStage.module = vsModule;
nonMultisampledPipelineDescriptor.vertexStage.module = vsModule;
nonMultisampledPipelineDescriptor.cFragmentStage.module = fsModule;
dawn::RenderPipeline nonMultisampledPipeline =
device.CreateRenderPipeline(&nonMultisampledPipelineDescriptor);
@ -167,7 +166,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
utils::ComboRenderPipelineDescriptor multisampledPipelineDescriptor(device);
multisampledPipelineDescriptor.sampleCount = kMultisampledCount;
multisampledPipelineDescriptor.cVertexStage.module = vsModule;
multisampledPipelineDescriptor.vertexStage.module = vsModule;
multisampledPipelineDescriptor.cFragmentStage.module = fsModule;
dawn::RenderPipeline multisampledPipeline =
device.CreateRenderPipeline(&multisampledPipelineDescriptor);

View File

@ -71,7 +71,7 @@ class VertexBufferValidationTest : public ValidationTest {
dawn::RenderPipeline MakeRenderPipeline(const dawn::ShaderModule& vsModule,
unsigned int bufferCount) {
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
for (unsigned int i = 0; i < bufferCount; ++i) {

View File

@ -34,7 +34,7 @@ class VertexInputTest : public ValidationTest {
)");
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.cVertexStage.module = vsModule;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.vertexInput = &state;
descriptor.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;

View File

@ -162,11 +162,9 @@ TEST_F(WireArgumentTests, CStringArgument) {
DawnRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.nextInChain = nullptr;
DawnPipelineStageDescriptor vertexStage;
vertexStage.nextInChain = nullptr;
vertexStage.module = vsModule;
vertexStage.entryPoint = "main";
pipelineDescriptor.vertexStage = &vertexStage;
pipelineDescriptor.vertexStage.nextInChain = nullptr;
pipelineDescriptor.vertexStage.module = vsModule;
pipelineDescriptor.vertexStage.entryPoint = "main";
DawnPipelineStageDescriptor fragmentStage;
fragmentStage.nextInChain = nullptr;
@ -193,7 +191,7 @@ TEST_F(WireArgumentTests, CStringArgument) {
EXPECT_CALL(api,
DeviceCreateRenderPipeline(
apiDevice, MatchesLambda([](const DawnRenderPipelineDescriptor* desc) -> bool {
return desc->vertexStage->entryPoint == std::string("main");
return desc->vertexStage.entryPoint == std::string("main");
})))
.WillOnce(Return(apiDummyPipeline));

View File

@ -132,11 +132,9 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
DawnRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.nextInChain = nullptr;
DawnPipelineStageDescriptor vertexStage;
vertexStage.nextInChain = nullptr;
vertexStage.module = vsModule;
vertexStage.entryPoint = "main";
pipelineDescriptor.vertexStage = &vertexStage;
pipelineDescriptor.vertexStage.nextInChain = nullptr;
pipelineDescriptor.vertexStage.module = vsModule;
pipelineDescriptor.vertexStage.entryPoint = "main";
DawnPipelineStageDescriptor fragmentStage;
fragmentStage.nextInChain = nullptr;

View File

@ -53,10 +53,7 @@ namespace utils {
descriptor->sampleCount = 1;
// Set defaults for the vertex stage descriptor.
{
descriptor->vertexStage = &cVertexStage;
cVertexStage.entryPoint = "main";
}
{ vertexStage.entryPoint = "main"; }
// Set defaults for the fragment stage desriptor.
{

View File

@ -35,7 +35,6 @@ namespace utils {
public:
ComboRenderPipelineDescriptor(const dawn::Device& device);
dawn::PipelineStageDescriptor cVertexStage;
dawn::PipelineStageDescriptor cFragmentStage;
ComboVertexInputDescriptor cVertexInput;