Removed deprecated CreateRenderPipeline path

Renames all the RenderPipeline*2 stuff to simple RenderPipeline* but
keeps *2 definitionas around as typedefs and wrappers so that users can
migrate away from it.

Bug: dawn:22
Change-Id: If301d81a829bba0646c3a61068f2279932b191e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51764
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Brandon Jones 2021-05-21 05:01:38 +00:00 committed by Dawn LUCI CQ
parent 4589de61a0
commit 41c87d973a
110 changed files with 609 additions and 927 deletions

View File

@ -256,16 +256,6 @@
{"value": 4, "name": "max"}
]
},
"color state descriptor": {
"category": "structure",
"extensible": true,
"members": [
{"name": "format", "type": "texture format"},
{"name": "alpha blend", "type": "blend component"},
{"name": "color blend", "type": "blend component"},
{"name": "write mask", "type": "color write mask", "default": "all"}
]
},
"bool": {
"category": "native"
},
@ -755,7 +745,7 @@
"name": "create render pipeline async",
"returns": "void",
"args": [
{"name": "descriptor", "type": "render pipeline descriptor 2", "annotation": "const*"},
{"name": "descriptor", "type": "render pipeline descriptor", "annotation": "const*"},
{"name": "callback", "type": "create render pipeline async callback"},
{"name": "userdata", "type": "void", "annotation": "*"}
]
@ -778,7 +768,7 @@
"name": "create render pipeline 2",
"returns": "render pipeline",
"args": [
{"name": "descriptor", "type": "render pipeline descriptor 2", "annotation": "const*"}
{"name": "descriptor", "type": "render pipeline descriptor", "annotation": "const*"}
]
},
{
@ -884,19 +874,6 @@
{"name": "depth clamping", "type": "bool", "default": "false"}
]
},
"depth stencil state descriptor": {
"category": "structure",
"extensible": true,
"members": [
{"name": "format", "type": "texture format"},
{"name": "depth write enabled", "type": "bool", "default": "false"},
{"name": "depth compare", "type": "compare function", "default": "always"},
{"name": "stencil front", "type": "stencil face state"},
{"name": "stencil back", "type": "stencil face state"},
{"name": "stencil read mask", "type": "uint32_t", "default": "0xFFFFFFFF"},
{"name": "stencil write mask", "type": "uint32_t", "default": "0xFFFFFFFF"}
]
},
"double": {
"category": "native"
},
@ -1038,15 +1015,6 @@
"category": "typedef",
"type": "vertex buffer layout"
},
"vertex state descriptor": {
"category": "structure",
"extensible": true,
"members": [
{"name": "index format", "type": "index format", "default": "undefined"},
{"name": "vertex buffer count", "type": "uint32_t", "default": 0},
{"name": "vertex buffers", "type": "vertex buffer layout", "annotation": "const*", "length": "vertex buffer count"}
]
},
"input step mode": {
"category": "enum",
"values": [
@ -1225,18 +1193,6 @@
]
},
"rasterization state descriptor": {
"category": "structure",
"extensible": true,
"members": [
{"name": "front face", "type": "front face", "default": "CCW"},
{"name": "cull mode", "type": "cull mode", "default": "none"},
{"name": "depth bias", "type": "int32_t", "default": "0"},
{"name": "depth bias slope scale", "type": "float", "default": "0.0f"},
{"name": "depth bias clamp", "type": "float", "default": "0.0f"}
]
},
"render bundle": {
"category": "object"
},
@ -1655,26 +1611,6 @@
},
"render pipeline descriptor": {
"category": "structure",
"extensible": true,
"members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "layout", "type": "pipeline layout", "optional": true},
{"name": "vertex stage", "type": "programmable stage descriptor"},
{"name": "fragment stage", "type": "programmable stage descriptor", "annotation": "const*", "optional": true},
{"name": "vertex state", "type": "vertex state descriptor", "annotation": "const*", "optional": true},
{"name": "primitive topology", "type": "primitive topology"},
{"name": "rasterization state", "type": "rasterization state descriptor", "annotation": "const*", "optional": true},
{"name": "sample count", "type": "uint32_t", "default": "1"},
{"name": "depth stencil state", "type": "depth stencil state descriptor", "annotation": "const*", "optional": true},
{"name": "color state count", "type": "uint32_t"},
{"name": "color states", "type": "color state descriptor", "annotation": "const*", "length": "color state count"},
{"name": "sample mask", "type": "uint32_t", "default": "0xFFFFFFFF"},
{"name": "alpha to coverage enabled", "type": "bool", "default": "false"}
]
},
"render pipeline descriptor 2": {
"category": "structure",
"extensible": true,
"members": [
@ -1687,6 +1623,10 @@
{"name": "fragment", "type": "fragment state", "annotation": "const*", "optional": true}
]
},
"render pipeline descriptor 2": {
"category": "typedef",
"type": "render pipeline descriptor"
},
"sampler": {
"category": "object"

View File

@ -49,7 +49,7 @@
{ "name": "device id", "type": "ObjectId" },
{ "name": "request serial", "type": "uint64_t" },
{ "name": "pipeline object handle", "type": "ObjectHandle", "handle_type": "render pipeline"},
{ "name": "descriptor", "type": "render pipeline descriptor 2", "annotation": "const*"}
{ "name": "descriptor", "type": "render pipeline descriptor", "annotation": "const*"}
],
"device pop error scope": [
{ "name": "device id", "type": "ObjectId" },

View File

@ -119,13 +119,13 @@ void init() {
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Vertex, wgpu::BufferBindingType::Uniform, true}});
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.cTargets[0].format = GetPreferredSwapChainTextureFormat();
pipeline = device.CreateRenderPipeline2(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor);
shaderData.resize(kNumTriangles);
for (auto& data : shaderData) {

View File

@ -56,7 +56,7 @@ void init() {
WGPUShaderModule fsModule = utils::CreateShaderModule(device, fs).Release();
{
WGPURenderPipelineDescriptor2 descriptor = {};
WGPURenderPipelineDescriptor descriptor = {};
// Fragment state
WGPUBlendState blend = {};
@ -97,7 +97,7 @@ void init() {
descriptor.primitive.topology = WGPUPrimitiveTopology_TriangleList;
descriptor.primitive.stripIndexFormat = WGPUIndexFormat_Undefined;
pipeline = wgpuDeviceCreateRenderPipeline2(device, &descriptor);
pipeline = wgpuDeviceCreateRenderPipeline(device, &descriptor);
}
wgpuShaderModuleRelease(vsModule);

View File

@ -121,7 +121,7 @@ void initRender() {
depthStencilView = CreateDefaultDepthStencilView(device);
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.vertex.bufferCount = 2;
@ -143,7 +143,7 @@ void initRender() {
descriptor.EnableDepthStencil(wgpu::TextureFormat::Depth24PlusStencil8);
descriptor.cTargets[0].format = GetPreferredSwapChainTextureFormat();
renderPipeline = device.CreateRenderPipeline2(&descriptor);
renderPipeline = device.CreateRenderPipeline(&descriptor);
}
void initSim() {

View File

@ -120,7 +120,7 @@ void init() {
depthStencilView = CreateDefaultDepthStencilView(device);
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
descriptor.vertex.module = vsModule;
descriptor.vertex.bufferCount = 1;
@ -131,7 +131,7 @@ void init() {
descriptor.cTargets[0].format = GetPreferredSwapChainTextureFormat();
descriptor.EnableDepthStencil(wgpu::TextureFormat::Depth24PlusStencil8);
pipeline = device.CreateRenderPipeline2(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor);
wgpu::TextureView view = texture.CreateView();

View File

@ -184,7 +184,7 @@ void init() {
depthStencilView = CreateDefaultDepthStencilView(device);
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.vertex.bufferCount = 1;
descriptor.vertex.buffers = &vertexBufferLayout;
@ -198,11 +198,11 @@ void init() {
depthStencil->depthWriteEnabled = true;
depthStencil->depthCompare = wgpu::CompareFunction::Less;
pipeline = device.CreateRenderPipeline2(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor);
}
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.vertex.bufferCount = 1;
descriptor.vertex.buffers = &vertexBufferLayout;
@ -217,11 +217,11 @@ void init() {
depthStencil->stencilBack.passOp = wgpu::StencilOperation::Replace;
depthStencil->depthCompare = wgpu::CompareFunction::Less;
planePipeline = device.CreateRenderPipeline2(&descriptor);
planePipeline = device.CreateRenderPipeline(&descriptor);
}
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.vertex.bufferCount = 1;
descriptor.vertex.buffers = &vertexBufferLayout;
@ -239,7 +239,7 @@ void init() {
depthStencil->depthWriteEnabled = true;
depthStencil->depthCompare = wgpu::CompareFunction::Less;
reflectionPipeline = device.CreateRenderPipeline2(&descriptor);
reflectionPipeline = device.CreateRenderPipeline(&descriptor);
}
cameraData.proj = glm::perspective(glm::radians(45.0f), 1.f, 1.0f, 100.0f);

View File

@ -311,7 +311,7 @@ int main(int argc, const char* argv[]) {
queue = device.GetQueue();
// The hacky pipeline to render a triangle.
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
utils::ComboRenderPipelineDescriptor pipelineDesc;
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
let pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>( 0.0, 0.5),
@ -328,7 +328,7 @@ int main(int argc, const char* argv[]) {
})");
// BGRA shouldn't be hardcoded. Consider having a map[format -> pipeline].
pipelineDesc.cTargets[0].format = wgpu::TextureFormat::BGRA8Unorm;
trianglePipeline = device.CreateRenderPipeline2(&pipelineDesc);
trianglePipeline = device.CreateRenderPipeline(&pipelineDesc);
// Craete the first window, since the example exits when there are no windows.
AddWindow();

View File

@ -34,19 +34,6 @@ namespace dawn_native {
}
AttachmentStateBlueprint::AttachmentStateBlueprint(const RenderPipelineDescriptor* descriptor)
: mSampleCount(descriptor->sampleCount) {
ASSERT(descriptor->colorStateCount <= kMaxColorAttachments);
for (ColorAttachmentIndex i(uint8_t(0));
i < ColorAttachmentIndex(static_cast<uint8_t>(descriptor->colorStateCount)); ++i) {
mColorAttachmentsSet.set(i);
mColorFormats[i] = descriptor->colorStates[static_cast<uint8_t>(i)].format;
}
if (descriptor->depthStencilState != nullptr) {
mDepthStencilFormat = descriptor->depthStencilState->format;
}
}
AttachmentStateBlueprint::AttachmentStateBlueprint(const RenderPipelineDescriptor2* descriptor)
: mSampleCount(descriptor->multisample.count) {
ASSERT(descriptor->fragment->targetCount <= kMaxColorAttachments);
for (ColorAttachmentIndex i(uint8_t(0));

View File

@ -38,7 +38,6 @@ namespace dawn_native {
// Note: Descriptors must be validated before the AttachmentState is constructed.
explicit AttachmentStateBlueprint(const RenderBundleEncoderDescriptor* descriptor);
explicit AttachmentStateBlueprint(const RenderPipelineDescriptor* descriptor);
explicit AttachmentStateBlueprint(const RenderPipelineDescriptor2* descriptor);
explicit AttachmentStateBlueprint(const RenderPassDescriptor* descriptor);
AttachmentStateBlueprint(const AttachmentStateBlueprint& rhs);

View File

@ -221,7 +221,7 @@ namespace dawn_native {
target.format = dstFormat;
// Create RenderPipeline.
RenderPipelineDescriptor2 renderPipelineDesc = {};
RenderPipelineDescriptor renderPipelineDesc = {};
// Generate the layout based on shader modules.
renderPipelineDesc.layout = nullptr;

View File

@ -551,7 +551,7 @@ namespace dawn_native {
}
ResultOrError<Ref<RenderPipelineBase>> DeviceBase::GetOrCreateRenderPipeline(
const RenderPipelineDescriptor2* descriptor) {
const RenderPipelineDescriptor* descriptor) {
RenderPipelineBase blueprint(this, descriptor);
const size_t blueprintHash = blueprint.ComputeContentHash();
@ -668,12 +668,6 @@ namespace dawn_native {
return GetOrCreateAttachmentState(&blueprint);
}
Ref<AttachmentState> DeviceBase::GetOrCreateAttachmentState(
const RenderPipelineDescriptor2* descriptor) {
AttachmentStateBlueprint blueprint(descriptor);
return GetOrCreateAttachmentState(&blueprint);
}
Ref<AttachmentState> DeviceBase::GetOrCreateAttachmentState(
const RenderPassDescriptor* descriptor) {
AttachmentStateBlueprint blueprint(descriptor);
@ -759,7 +753,7 @@ namespace dawn_native {
}
return result.Detach();
}
void DeviceBase::APICreateRenderPipelineAsync(const RenderPipelineDescriptor2* descriptor,
void DeviceBase::APICreateRenderPipelineAsync(const RenderPipelineDescriptor* descriptor,
WGPUCreateRenderPipelineAsyncCallback callback,
void* userdata) {
ResultOrError<Ref<RenderPipelineBase>> maybeResult =
@ -787,112 +781,19 @@ namespace dawn_native {
}
RenderPipelineBase* DeviceBase::APICreateRenderPipeline(
const RenderPipelineDescriptor* descriptor) {
// TODO: Enable this warning once the tests have been converted to either use the new
// format or expect the deprecation warning.
EmitDeprecationWarning(
"The format of RenderPipelineDescriptor has changed, and will soon require the "
"new structure. Please begin using CreateRenderPipeline2() instead.");
// Convert descriptor to the new format it before proceeding.
RenderPipelineDescriptor2 normalizedDescriptor;
normalizedDescriptor.label = descriptor->label;
normalizedDescriptor.layout = descriptor->layout;
normalizedDescriptor.vertex.module = descriptor->vertexStage.module;
normalizedDescriptor.vertex.entryPoint = descriptor->vertexStage.entryPoint;
normalizedDescriptor.primitive.topology = descriptor->primitiveTopology;
normalizedDescriptor.multisample.count = descriptor->sampleCount;
normalizedDescriptor.multisample.mask = descriptor->sampleMask;
normalizedDescriptor.multisample.alphaToCoverageEnabled =
descriptor->alphaToCoverageEnabled;
if (descriptor->vertexState) {
const VertexStateDescriptor* vertexState = descriptor->vertexState;
normalizedDescriptor.primitive.stripIndexFormat = vertexState->indexFormat;
normalizedDescriptor.vertex.bufferCount = vertexState->vertexBufferCount;
normalizedDescriptor.vertex.buffers = vertexState->vertexBuffers;
} else {
normalizedDescriptor.vertex.bufferCount = 0;
normalizedDescriptor.vertex.buffers = nullptr;
}
DepthStencilState depthStencil;
if (descriptor->depthStencilState) {
const DepthStencilStateDescriptor* depthStencilState = descriptor->depthStencilState;
normalizedDescriptor.depthStencil = &depthStencil;
depthStencil.format = depthStencilState->format;
depthStencil.depthWriteEnabled = depthStencilState->depthWriteEnabled;
depthStencil.depthCompare = depthStencilState->depthCompare;
depthStencil.stencilFront = depthStencilState->stencilFront;
depthStencil.stencilBack = depthStencilState->stencilBack;
depthStencil.stencilReadMask = depthStencilState->stencilReadMask;
depthStencil.stencilWriteMask = depthStencilState->stencilWriteMask;
}
if (descriptor->rasterizationState) {
const RasterizationStateDescriptor* rasterizationState = descriptor->rasterizationState;
normalizedDescriptor.primitive.frontFace = rasterizationState->frontFace;
normalizedDescriptor.primitive.cullMode = rasterizationState->cullMode;
depthStencil.depthBias = rasterizationState->depthBias;
depthStencil.depthBiasSlopeScale = rasterizationState->depthBiasSlopeScale;
depthStencil.depthBiasClamp = rasterizationState->depthBiasClamp;
}
FragmentState fragment;
std::vector<ColorTargetState> targets;
std::vector<BlendState> blendStates;
if (descriptor->fragmentStage) {
const ProgrammableStageDescriptor* fragmentStage = descriptor->fragmentStage;
normalizedDescriptor.fragment = &fragment;
fragment.module = fragmentStage->module;
fragment.entryPoint = fragmentStage->entryPoint;
targets.resize(descriptor->colorStateCount);
blendStates.resize(descriptor->colorStateCount);
for (uint32_t i = 0; i < descriptor->colorStateCount; ++i) {
const ColorStateDescriptor& colorState = descriptor->colorStates[i];
ColorTargetState& target = targets[i];
target.format = colorState.format;
target.writeMask = colorState.writeMask;
if (BlendEnabled(&colorState)) {
BlendState* blend = &blendStates[i];
target.blend = blend;
blend->color.srcFactor = colorState.colorBlend.srcFactor;
blend->color.dstFactor = colorState.colorBlend.dstFactor;
blend->color.operation = colorState.colorBlend.operation;
blend->alpha.srcFactor = colorState.alphaBlend.srcFactor;
blend->alpha.dstFactor = colorState.alphaBlend.dstFactor;
blend->alpha.operation = colorState.alphaBlend.operation;
}
}
fragment.targetCount = descriptor->colorStateCount;
fragment.targets = targets.data();
}
Ref<RenderPipelineBase> result;
if (ConsumedError(CreateRenderPipeline(&normalizedDescriptor), &result)) {
return RenderPipelineBase::MakeError(this);
}
return result.Detach();
}
RenderPipelineBase* DeviceBase::APICreateRenderPipeline2(
const RenderPipelineDescriptor2* descriptor) {
Ref<RenderPipelineBase> result;
if (ConsumedError(CreateRenderPipeline(descriptor), &result)) {
return RenderPipelineBase::MakeError(this);
}
return result.Detach();
}
RenderPipelineBase* DeviceBase::APICreateRenderPipeline2(
const RenderPipelineDescriptor* descriptor) {
EmitDeprecationWarning(
"CreateRenderPipeline2() has been deprecated. Please begin using "
"CreateRenderPipeline() instead.");
return APICreateRenderPipeline(descriptor);
}
ShaderModuleBase* DeviceBase::APICreateShaderModule(const ShaderModuleDescriptor* descriptor) {
Ref<ShaderModuleBase> result;
ShaderModuleParseResult parseResult = {};
@ -1212,14 +1113,14 @@ namespace dawn_native {
}
ResultOrError<Ref<RenderPipelineBase>> DeviceBase::CreateRenderPipeline(
const RenderPipelineDescriptor2* descriptor) {
const RenderPipelineDescriptor* descriptor) {
DAWN_TRY(ValidateIsAlive());
if (IsValidationEnabled()) {
DAWN_TRY(ValidateRenderPipelineDescriptor(this, descriptor));
}
if (descriptor->layout == nullptr) {
RenderPipelineDescriptor2 descriptorWithDefaultLayout = *descriptor;
RenderPipelineDescriptor descriptorWithDefaultLayout = *descriptor;
// Ref will keep the pipeline layout alive until the end of the function where
// the pipeline will take another reference.

View File

@ -120,7 +120,7 @@ namespace dawn_native {
void UncachePipelineLayout(PipelineLayoutBase* obj);
ResultOrError<Ref<RenderPipelineBase>> GetOrCreateRenderPipeline(
const RenderPipelineDescriptor2* descriptor);
const RenderPipelineDescriptor* descriptor);
void UncacheRenderPipeline(RenderPipelineBase* obj);
ResultOrError<Ref<SamplerBase>> GetOrCreateSampler(const SamplerDescriptor* descriptor);
@ -135,8 +135,6 @@ namespace dawn_native {
Ref<AttachmentState> GetOrCreateAttachmentState(
const RenderBundleEncoderDescriptor* descriptor);
Ref<AttachmentState> GetOrCreateAttachmentState(const RenderPipelineDescriptor* descriptor);
Ref<AttachmentState> GetOrCreateAttachmentState(
const RenderPipelineDescriptor2* descriptor);
Ref<AttachmentState> GetOrCreateAttachmentState(const RenderPassDescriptor* descriptor);
void UncacheAttachmentState(AttachmentState* obj);
@ -159,7 +157,7 @@ namespace dawn_native {
ResultOrError<Ref<RenderBundleEncoder>> CreateRenderBundleEncoder(
const RenderBundleEncoderDescriptor* descriptor);
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipeline(
const RenderPipelineDescriptor2* descriptor);
const RenderPipelineDescriptor* descriptor);
ResultOrError<Ref<SamplerBase>> CreateSampler(const SamplerDescriptor* descriptor);
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModule(
const ShaderModuleDescriptor* descriptor,
@ -182,13 +180,13 @@ namespace dawn_native {
void APICreateComputePipelineAsync(const ComputePipelineDescriptor* descriptor,
WGPUCreateComputePipelineAsyncCallback callback,
void* userdata);
void APICreateRenderPipelineAsync(const RenderPipelineDescriptor2* descriptor,
void APICreateRenderPipelineAsync(const RenderPipelineDescriptor* descriptor,
WGPUCreateRenderPipelineAsyncCallback callback,
void* userdata);
RenderBundleEncoder* APICreateRenderBundleEncoder(
const RenderBundleEncoderDescriptor* descriptor);
RenderPipelineBase* APICreateRenderPipeline(const RenderPipelineDescriptor* descriptor);
RenderPipelineBase* APICreateRenderPipeline2(const RenderPipelineDescriptor2* descriptor);
RenderPipelineBase* APICreateRenderPipeline2(const RenderPipelineDescriptor* descriptor);
ExternalTextureBase* APICreateExternalTexture(const ExternalTextureDescriptor* descriptor);
SamplerBase* APICreateSampler(const SamplerDescriptor* descriptor);
ShaderModuleBase* APICreateShaderModule(const ShaderModuleDescriptor* descriptor);
@ -304,7 +302,7 @@ namespace dawn_native {
virtual ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
const QuerySetDescriptor* descriptor) = 0;
virtual ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
const RenderPipelineDescriptor2* descriptor) = 0;
const RenderPipelineDescriptor* descriptor) = 0;
virtual ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
const SamplerDescriptor* descriptor) = 0;
virtual ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(

View File

@ -316,7 +316,7 @@ namespace dawn_native {
}
MaybeError ValidateRenderPipelineDescriptor(DeviceBase* device,
const RenderPipelineDescriptor2* descriptor) {
const RenderPipelineDescriptor* descriptor) {
if (descriptor->nextInChain != nullptr) {
return DAWN_VALIDATION_ERROR("nextInChain must be nullptr");
}
@ -350,7 +350,7 @@ namespace dawn_native {
return {};
}
std::vector<StageAndDescriptor> GetStages(const RenderPipelineDescriptor2* descriptor) {
std::vector<StageAndDescriptor> GetStages(const RenderPipelineDescriptor* descriptor) {
std::vector<StageAndDescriptor> stages;
stages.push_back(
{SingleShaderStage::Vertex, descriptor->vertex.module, descriptor->vertex.entryPoint});
@ -372,19 +372,10 @@ namespace dawn_native {
mDepthStencil->stencilFront.passOp != wgpu::StencilOperation::Keep;
}
bool BlendEnabled(const ColorStateDescriptor* mColorState) {
return mColorState->alphaBlend.operation != wgpu::BlendOperation::Add ||
mColorState->alphaBlend.srcFactor != wgpu::BlendFactor::One ||
mColorState->alphaBlend.dstFactor != wgpu::BlendFactor::Zero ||
mColorState->colorBlend.operation != wgpu::BlendOperation::Add ||
mColorState->colorBlend.srcFactor != wgpu::BlendFactor::One ||
mColorState->colorBlend.dstFactor != wgpu::BlendFactor::Zero;
}
// RenderPipelineBase
RenderPipelineBase::RenderPipelineBase(DeviceBase* device,
const RenderPipelineDescriptor2* descriptor)
const RenderPipelineDescriptor* descriptor)
: PipelineBase(device,
descriptor->layout,
{{SingleShaderStage::Vertex, descriptor->vertex.module,

View File

@ -30,9 +30,9 @@ namespace dawn_native {
class DeviceBase;
MaybeError ValidateRenderPipelineDescriptor(DeviceBase* device,
const RenderPipelineDescriptor2* descriptor);
const RenderPipelineDescriptor* descriptor);
std::vector<StageAndDescriptor> GetStages(const RenderPipelineDescriptor2* descriptor);
std::vector<StageAndDescriptor> GetStages(const RenderPipelineDescriptor* descriptor);
size_t IndexFormatSize(wgpu::IndexFormat format);
@ -40,8 +40,6 @@ namespace dawn_native {
bool StencilTestEnabled(const DepthStencilState* mDepthStencil);
bool BlendEnabled(const ColorStateDescriptor* mColorState);
struct VertexAttributeInfo {
wgpu::VertexFormat format;
uint64_t offset;
@ -56,7 +54,7 @@ namespace dawn_native {
class RenderPipelineBase : public PipelineBase {
public:
RenderPipelineBase(DeviceBase* device, const RenderPipelineDescriptor2* descriptor);
RenderPipelineBase(DeviceBase* device, const RenderPipelineDescriptor* descriptor);
~RenderPipelineBase() override;
static RenderPipelineBase* MakeError(DeviceBase* device);

View File

@ -334,7 +334,7 @@ namespace dawn_native { namespace d3d12 {
return QuerySet::Create(this, descriptor);
}
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
const RenderPipelineDescriptor2* descriptor) {
const RenderPipelineDescriptor* descriptor) {
return RenderPipeline::Create(this, descriptor);
}
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {

View File

@ -154,7 +154,7 @@ namespace dawn_native { namespace d3d12 {
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
const QuerySetDescriptor* descriptor) override;
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
const RenderPipelineDescriptor2* descriptor) override;
const RenderPipelineDescriptor* descriptor) override;
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
const SamplerDescriptor* descriptor) override;
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(

View File

@ -326,13 +326,13 @@ namespace dawn_native { namespace d3d12 {
ResultOrError<Ref<RenderPipeline>> RenderPipeline::Create(
Device* device,
const RenderPipelineDescriptor2* descriptor) {
const RenderPipelineDescriptor* descriptor) {
Ref<RenderPipeline> pipeline = AcquireRef(new RenderPipeline(device, descriptor));
DAWN_TRY(pipeline->Initialize(descriptor));
return pipeline;
}
MaybeError RenderPipeline::Initialize(const RenderPipelineDescriptor2* descriptor) {
MaybeError RenderPipeline::Initialize(const RenderPipelineDescriptor* descriptor) {
Device* device = ToBackend(GetDevice());
uint32_t compileFlags = 0;
#if defined(_DEBUG)

View File

@ -28,7 +28,7 @@ namespace dawn_native { namespace d3d12 {
public:
static ResultOrError<Ref<RenderPipeline>> Create(
Device* device,
const RenderPipelineDescriptor2* descriptor);
const RenderPipelineDescriptor* descriptor);
RenderPipeline() = delete;
D3D12_PRIMITIVE_TOPOLOGY GetD3D12PrimitiveTopology() const;
@ -39,7 +39,7 @@ namespace dawn_native { namespace d3d12 {
private:
~RenderPipeline() override;
using RenderPipelineBase::RenderPipelineBase;
MaybeError Initialize(const RenderPipelineDescriptor2* descriptor);
MaybeError Initialize(const RenderPipelineDescriptor* descriptor);
D3D12_INPUT_LAYOUT_DESC ComputeInputLayout(
std::array<D3D12_INPUT_ELEMENT_DESC, kMaxVertexAttributes>* inputElementDescriptors);

View File

@ -91,7 +91,7 @@ namespace dawn_native { namespace metal {
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
const QuerySetDescriptor* descriptor) override;
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
const RenderPipelineDescriptor2* descriptor) override;
const RenderPipelineDescriptor* descriptor) override;
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
const SamplerDescriptor* descriptor) override;
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(

View File

@ -146,7 +146,7 @@ namespace dawn_native { namespace metal {
return QuerySet::Create(this, descriptor);
}
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
const RenderPipelineDescriptor2* descriptor) {
const RenderPipelineDescriptor* descriptor) {
return RenderPipeline::Create(this, descriptor);
}
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {

View File

@ -29,7 +29,7 @@ namespace dawn_native { namespace metal {
public:
static ResultOrError<Ref<RenderPipeline>> Create(
Device* device,
const RenderPipelineDescriptor2* descriptor);
const RenderPipelineDescriptor* descriptor);
MTLPrimitiveType GetMTLPrimitiveTopology() const;
MTLWinding GetMTLFrontFace() const;
@ -47,7 +47,7 @@ namespace dawn_native { namespace metal {
private:
using RenderPipelineBase::RenderPipelineBase;
MaybeError Initialize(const RenderPipelineDescriptor2* descriptor);
MaybeError Initialize(const RenderPipelineDescriptor* descriptor);
MTLVertexDescriptor* MakeVertexDesc();

View File

@ -321,13 +321,13 @@ namespace dawn_native { namespace metal {
// static
ResultOrError<Ref<RenderPipeline>> RenderPipeline::Create(
Device* device,
const RenderPipelineDescriptor2* descriptor) {
const RenderPipelineDescriptor* descriptor) {
Ref<RenderPipeline> pipeline = AcquireRef(new RenderPipeline(device, descriptor));
DAWN_TRY(pipeline->Initialize(descriptor));
return pipeline;
}
MaybeError RenderPipeline::Initialize(const RenderPipelineDescriptor2* descriptor) {
MaybeError RenderPipeline::Initialize(const RenderPipelineDescriptor* descriptor) {
mMtlPrimitiveTopology = MTLPrimitiveTopology(GetPrimitiveTopology());
mMtlFrontFace = MTLFrontFace(GetFrontFace());
mMtlCullMode = ToMTLCullMode(GetCullMode());

View File

@ -122,7 +122,7 @@ namespace dawn_native { namespace null {
return AcquireRef(new QuerySet(this, descriptor));
}
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
const RenderPipelineDescriptor2* descriptor) {
const RenderPipelineDescriptor* descriptor) {
return AcquireRef(new RenderPipeline(this, descriptor));
}
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {

View File

@ -135,7 +135,7 @@ namespace dawn_native { namespace null {
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
const QuerySetDescriptor* descriptor) override;
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
const RenderPipelineDescriptor2* descriptor) override;
const RenderPipelineDescriptor* descriptor) override;
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
const SamplerDescriptor* descriptor) override;
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(

View File

@ -140,7 +140,7 @@ namespace dawn_native { namespace opengl {
return AcquireRef(new QuerySet(this, descriptor));
}
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
const RenderPipelineDescriptor2* descriptor) {
const RenderPipelineDescriptor* descriptor) {
return AcquireRef(new RenderPipeline(this, descriptor));
}
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {

View File

@ -90,7 +90,7 @@ namespace dawn_native { namespace opengl {
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
const QuerySetDescriptor* descriptor) override;
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
const RenderPipelineDescriptor2* descriptor) override;
const RenderPipelineDescriptor* descriptor) override;
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
const SamplerDescriptor* descriptor) override;
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(

View File

@ -219,7 +219,7 @@ namespace dawn_native { namespace opengl {
} // anonymous namespace
RenderPipeline::RenderPipeline(Device* device, const RenderPipelineDescriptor2* descriptor)
RenderPipeline::RenderPipeline(Device* device, const RenderPipelineDescriptor* descriptor)
: RenderPipelineBase(device, descriptor),
mVertexArrayObject(0),
mGlPrimitiveTopology(GLPrimitiveTopology(GetPrimitiveTopology())) {

View File

@ -29,7 +29,7 @@ namespace dawn_native { namespace opengl {
class RenderPipeline final : public RenderPipelineBase, public PipelineGL {
public:
RenderPipeline(Device* device, const RenderPipelineDescriptor2* descriptor);
RenderPipeline(Device* device, const RenderPipelineDescriptor* descriptor);
GLenum GetGLPrimitiveTopology() const;
ityp::bitset<VertexAttributeLocation, kMaxVertexAttributes> GetAttributesUsingVertexBuffer(

View File

@ -131,7 +131,7 @@ namespace dawn_native { namespace vulkan {
return QuerySet::Create(this, descriptor);
}
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
const RenderPipelineDescriptor2* descriptor) {
const RenderPipelineDescriptor* descriptor) {
return RenderPipeline::Create(this, descriptor);
}
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {

View File

@ -126,7 +126,7 @@ namespace dawn_native { namespace vulkan {
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
const QuerySetDescriptor* descriptor) override;
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
const RenderPipelineDescriptor2* descriptor) override;
const RenderPipelineDescriptor* descriptor) override;
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
const SamplerDescriptor* descriptor) override;
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(

View File

@ -330,13 +330,13 @@ namespace dawn_native { namespace vulkan {
// static
ResultOrError<Ref<RenderPipeline>> RenderPipeline::Create(
Device* device,
const RenderPipelineDescriptor2* descriptor) {
const RenderPipelineDescriptor* descriptor) {
Ref<RenderPipeline> pipeline = AcquireRef(new RenderPipeline(device, descriptor));
DAWN_TRY(pipeline->Initialize(descriptor));
return pipeline;
}
MaybeError RenderPipeline::Initialize(const RenderPipelineDescriptor2* descriptor) {
MaybeError RenderPipeline::Initialize(const RenderPipelineDescriptor* descriptor) {
Device* device = ToBackend(GetDevice());
VkPipelineShaderStageCreateInfo shaderStages[2];

View File

@ -28,14 +28,14 @@ namespace dawn_native { namespace vulkan {
public:
static ResultOrError<Ref<RenderPipeline>> Create(
Device* device,
const RenderPipelineDescriptor2* descriptor);
const RenderPipelineDescriptor* descriptor);
VkPipeline GetHandle() const;
private:
~RenderPipeline() override;
using RenderPipelineBase::RenderPipelineBase;
MaybeError Initialize(const RenderPipelineDescriptor2* descriptor);
MaybeError Initialize(const RenderPipelineDescriptor* descriptor);
struct PipelineVertexInputStateCreateInfoTemporaryAllocations {
std::array<VkVertexInputBindingDescription, kMaxVertexBuffers> bindings;

View File

@ -277,7 +277,7 @@ namespace dawn_wire { namespace client {
return true;
}
void Device::CreateRenderPipelineAsync(WGPURenderPipelineDescriptor2 const* descriptor,
void Device::CreateRenderPipelineAsync(WGPURenderPipelineDescriptor const* descriptor,
WGPUCreateRenderPipelineAsyncCallback callback,
void* userdata) {
if (client->IsDisconnected()) {

View File

@ -45,7 +45,7 @@ namespace dawn_wire { namespace client {
void CreateComputePipelineAsync(WGPUComputePipelineDescriptor const* descriptor,
WGPUCreateComputePipelineAsyncCallback callback,
void* userdata);
void CreateRenderPipelineAsync(WGPURenderPipelineDescriptor2 const* descriptor,
void CreateRenderPipelineAsync(WGPURenderPipelineDescriptor const* descriptor,
WGPUCreateRenderPipelineAsyncCallback callback,
void* userdata);

View File

@ -149,11 +149,10 @@ namespace dawn_wire { namespace server {
SerializeCommand(cmd);
}
bool Server::DoDeviceCreateRenderPipelineAsync(
ObjectId deviceId,
uint64_t requestSerial,
ObjectHandle pipelineObjectHandle,
const WGPURenderPipelineDescriptor2* descriptor) {
bool Server::DoDeviceCreateRenderPipelineAsync(ObjectId deviceId,
uint64_t requestSerial,
ObjectHandle pipelineObjectHandle,
const WGPURenderPipelineDescriptor* descriptor) {
auto* device = DeviceObjects().Get(deviceId);
if (device == nullptr) {
return false;

View File

@ -98,7 +98,7 @@ class BindGroupTests : public DawnTest {
wgpu::PipelineLayout pipelineLayout = MakeBasicPipelineLayout(bindGroupLayouts);
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.layout = pipelineLayout;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = fsModule;
@ -114,7 +114,7 @@ class BindGroupTests : public DawnTest {
pipelineDescriptor.cTargets[0].blend = &blend;
return device.CreateRenderPipeline2(&pipelineDescriptor);
return device.CreateRenderPipeline(&pipelineDescriptor);
}
};
@ -184,12 +184,12 @@ TEST_P(BindGroupTests, ReusedUBO) {
return fragmentUbo.color;
})");
utils::ComboRenderPipelineDescriptor2 textureDescriptor;
utils::ComboRenderPipelineDescriptor textureDescriptor;
textureDescriptor.vertex.module = vsModule;
textureDescriptor.cFragment.module = fsModule;
textureDescriptor.cTargets[0].format = renderPass.colorFormat;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&textureDescriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
struct Data {
float transform[8];
@ -260,12 +260,12 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
return textureSample(tex, samp, FragCoord.xy);
})");
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = fsModule;
pipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
constexpr float transform[] = {1.f, 0.f, 0.f, 1.f};
wgpu::Buffer buffer = utils::CreateBufferFromData(device, &transform, sizeof(transform),
@ -382,12 +382,12 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
return fragmentUbo1.color + fragmentUbo2.color;
})");
utils::ComboRenderPipelineDescriptor2 textureDescriptor;
utils::ComboRenderPipelineDescriptor textureDescriptor;
textureDescriptor.vertex.module = vsModule;
textureDescriptor.cFragment.module = fsModule;
textureDescriptor.cTargets[0].format = renderPass.colorFormat;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&textureDescriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
struct Data {
float transform[4];
@ -970,12 +970,12 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) {
return ubo1.color + 2.0 * ubo2.color + 4.0 * ubo3.color;
})");
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = fsModule;
pipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
wgpu::Buffer black =
utils::CreateBufferFromData(device, wgpu::BufferUsage::Uniform, {0.f, 0.f, 0.f, 0.f});
@ -1086,7 +1086,7 @@ TEST_P(BindGroupTests, EmptyLayout) {
// This is a regression test for crbug.com/dawn/410 which tests that it can successfully compile and
// execute the shader.
TEST_P(BindGroupTests, ReadonlyStorage) {
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
@ -1118,7 +1118,7 @@ TEST_P(BindGroupTests, ReadonlyStorage) {
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);

View File

@ -213,7 +213,7 @@ class BufferZeroInitTest : public DawnTest {
})");
ASSERT(vertexBufferCount <= 1u);
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
@ -222,7 +222,7 @@ class BufferZeroInitTest : public DawnTest {
descriptor.cBuffers[0].attributeCount = 1;
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
descriptor.cTargets[0].format = kColorAttachmentFormat;
return device.CreateRenderPipeline2(&descriptor);
return device.CreateRenderPipeline(&descriptor);
}
void ExpectLazyClearSubmitAndCheckOutputs(wgpu::CommandEncoder encoder,

View File

@ -20,7 +20,7 @@
class ClipSpaceTest : public DawnTest {
protected:
wgpu::RenderPipeline CreatePipelineForTest() {
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
// Draw two triangles:
// 1. The depth value of the top-left one is >= 0.5
@ -47,7 +47,7 @@ class ClipSpaceTest : public DawnTest {
wgpu::DepthStencilState* depthStencil = pipelineDescriptor.EnableDepthStencil();
depthStencil->depthCompare = wgpu::CompareFunction::LessEqual;
return device.CreateRenderPipeline2(&pipelineDescriptor);
return device.CreateRenderPipeline(&pipelineDescriptor);
}
wgpu::Texture Create2DTextureForTest(wgpu::TextureFormat format) {

View File

@ -68,20 +68,20 @@ class ColorStateTest : public DawnTest {
}
)");
utils::ComboRenderPipelineDescriptor2 baseDescriptor;
utils::ComboRenderPipelineDescriptor baseDescriptor;
baseDescriptor.vertex.module = vsModule;
baseDescriptor.cFragment.module = fsModule;
baseDescriptor.cTargets[0].format = renderPass.colorFormat;
basePipeline = device.CreateRenderPipeline2(&baseDescriptor);
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
utils::ComboRenderPipelineDescriptor2 testDescriptor;
utils::ComboRenderPipelineDescriptor testDescriptor;
testDescriptor.vertex.module = vsModule;
testDescriptor.cFragment.module = fsModule;
testDescriptor.cTargets[0] = colorTargetState;
testDescriptor.cTargets[0].format = renderPass.colorFormat;
testPipeline = device.CreateRenderPipeline2(&testDescriptor);
testPipeline = device.CreateRenderPipeline(&testDescriptor);
}
// Create a bind group to set the colors as a uniform buffer
@ -810,14 +810,14 @@ TEST_P(ColorStateTest, IndependentColorState) {
}
)");
utils::ComboRenderPipelineDescriptor2 baseDescriptor;
utils::ComboRenderPipelineDescriptor baseDescriptor;
baseDescriptor.vertex.module = vsModule;
baseDescriptor.cFragment.module = fsModule;
baseDescriptor.cFragment.targetCount = 4;
basePipeline = device.CreateRenderPipeline2(&baseDescriptor);
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
utils::ComboRenderPipelineDescriptor2 testDescriptor;
utils::ComboRenderPipelineDescriptor testDescriptor;
testDescriptor.vertex.module = vsModule;
testDescriptor.cFragment.module = fsModule;
testDescriptor.cFragment.targetCount = 4;
@ -856,7 +856,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
testDescriptor.cTargets[1].blend = &blend1;
testDescriptor.cTargets[3].blend = &blend3;
testPipeline = device.CreateRenderPipeline2(&testDescriptor);
testPipeline = device.CreateRenderPipeline(&testDescriptor);
for (unsigned int c = 0; c < kColors.size(); ++c) {
RGBA8 base = kColors[((c + 31) * 29) % kColors.size()];
@ -917,14 +917,14 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
}
)");
utils::ComboRenderPipelineDescriptor2 baseDescriptor;
utils::ComboRenderPipelineDescriptor baseDescriptor;
baseDescriptor.vertex.module = vsModule;
baseDescriptor.cFragment.module = fsModule;
baseDescriptor.cTargets[0].format = renderPass.colorFormat;
basePipeline = device.CreateRenderPipeline2(&baseDescriptor);
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
utils::ComboRenderPipelineDescriptor2 testDescriptor;
utils::ComboRenderPipelineDescriptor testDescriptor;
testDescriptor.vertex.module = vsModule;
testDescriptor.cFragment.module = fsModule;
testDescriptor.cTargets[0].format = renderPass.colorFormat;
@ -940,7 +940,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
testDescriptor.cTargets[0].blend = &blend;
testPipeline = device.CreateRenderPipeline2(&testDescriptor);
testPipeline = device.CreateRenderPipeline(&testDescriptor);
constexpr wgpu::Color kWhite{1.0f, 1.0f, 1.0f, 1.0f};
// Check that the initial blend color is (0,0,0,0)
@ -1041,20 +1041,20 @@ TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) {
}
)");
utils::ComboRenderPipelineDescriptor2 baseDescriptor;
utils::ComboRenderPipelineDescriptor baseDescriptor;
baseDescriptor.vertex.module = vsModule;
baseDescriptor.cFragment.module = fsModule;
baseDescriptor.cTargets[0].format = renderPass.colorFormat;
basePipeline = device.CreateRenderPipeline2(&baseDescriptor);
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
utils::ComboRenderPipelineDescriptor2 testDescriptor;
utils::ComboRenderPipelineDescriptor testDescriptor;
testDescriptor.vertex.module = vsModule;
testDescriptor.cFragment.module = fsModule;
testDescriptor.cTargets[0].format = renderPass.colorFormat;
testDescriptor.cTargets[0].writeMask = wgpu::ColorWriteMask::Red;
testPipeline = device.CreateRenderPipeline2(&testDescriptor);
testPipeline = device.CreateRenderPipeline(&testDescriptor);
RGBA8 base(32, 64, 128, 192);
RGBA8 expected(0, 0, 0, 0);

View File

@ -138,7 +138,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
wgpu::RenderPipeline CreateRenderPipelineForTest() {
ASSERT(IsBCFormatSupported());
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
struct VertexOut {
[[location(0)]] texCoord : vec2 <f32>;
@ -169,7 +169,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
renderPipelineDescriptor.cFragment.module = fsModule;
renderPipelineDescriptor.cTargets[0].format = utils::BasicRenderPass::kDefaultColorFormat;
return device.CreateRenderPipeline2(&renderPipelineDescriptor);
return device.CreateRenderPipeline(&renderPipelineDescriptor);
}
// Run the given render pipeline and bind group and verify the pixels in the render target.

View File

@ -145,7 +145,7 @@ TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) {
TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateRenderPipelineAsync) {
constexpr wgpu::TextureFormat kRenderAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
@ -213,7 +213,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineFailed) {
constexpr wgpu::TextureFormat kRenderAttachmentFormat = wgpu::TextureFormat::Depth32Float;
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
@ -275,7 +275,7 @@ TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateComputePipeli
// Verify there is no error when the device is released before the callback of
// CreateRenderPipelineAsync() is called.
TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateRenderPipelineAsync) {
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);

View File

@ -20,7 +20,7 @@
class CullingTest : public DawnTest {
protected:
wgpu::RenderPipeline CreatePipelineForTest(wgpu::FrontFace frontFace, wgpu::CullMode cullMode) {
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
// Draw two triangles with different winding orders:
// 1. The top-left one is counterclockwise (CCW)
@ -54,7 +54,7 @@ class CullingTest : public DawnTest {
pipelineDescriptor.primitive.frontFace = frontFace;
pipelineDescriptor.primitive.cullMode = cullMode;
return device.CreateRenderPipeline2(&pipelineDescriptor);
return device.CreateRenderPipeline(&pipelineDescriptor);
}
wgpu::Texture Create2DTextureForTest(wgpu::TextureFormat format) {

View File

@ -112,26 +112,26 @@ TEST_P(D3D12CachingTests, SameShaderNoCache) {
// Store the WGSL shader into the cache.
{
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
desc.vertex.module = module;
desc.vertex.entryPoint = "vertex_main";
desc.cFragment.module = module;
desc.cFragment.entryPoint = "fragment_main";
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline2(&desc));
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline(&desc));
}
EXPECT_EQ(mPersistentCache.mCache.size(), 0u);
// Load the same WGSL shader from the cache.
{
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
desc.vertex.module = module;
desc.vertex.entryPoint = "vertex_main";
desc.cFragment.module = module;
desc.cFragment.entryPoint = "fragment_main";
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline2(&desc));
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline(&desc));
}
EXPECT_EQ(mPersistentCache.mCache.size(), 0u);
@ -153,20 +153,20 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) {
// Store the WGSL shader into the cache.
{
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
desc.vertex.module = module;
desc.vertex.entryPoint = "vertex_main";
desc.cFragment.module = module;
desc.cFragment.entryPoint = "fragment_main";
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline2(&desc));
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline(&desc));
}
EXPECT_EQ(mPersistentCache.mCache.size(), 2u);
// Load the same WGSL shader from the cache.
{
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
desc.vertex.module = module;
desc.vertex.entryPoint = "vertex_main";
desc.cFragment.module = module;
@ -174,7 +174,7 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) {
// Cached HLSL shader calls LoadData twice (once to peek, again to get), so check 2 x
// kNumOfShaders hits.
EXPECT_CACHE_HIT(4u, device.CreateRenderPipeline2(&desc));
EXPECT_CACHE_HIT(4u, device.CreateRenderPipeline(&desc));
}
EXPECT_EQ(mPersistentCache.mCache.size(), 2u);
@ -191,12 +191,12 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) {
)");
{
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
desc.vertex.module = newModule;
desc.vertex.entryPoint = "vertex_main";
desc.cFragment.module = newModule;
desc.cFragment.entryPoint = "fragment_main";
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline2(&desc));
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline(&desc));
}
// Cached HLSL shader calls LoadData twice (once to peek, again to get), so check 2 x

View File

@ -293,7 +293,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYtoR) {
viewDesc.aspect = wgpu::TextureAspect::Plane0Only;
wgpu::TextureView textureView = wgpuTexture.CreateView(&viewDesc);
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
renderPipelineDescriptor.vertex.module = GetTestVertexShaderModule();
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
@ -311,7 +311,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYtoR) {
renderPipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
renderPipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
wgpu::Sampler sampler = device.CreateSampler();
@ -344,7 +344,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleUVtoRG) {
viewDesc.aspect = wgpu::TextureAspect::Plane1Only;
wgpu::TextureView textureView = wgpuTexture.CreateView(&viewDesc);
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
renderPipelineDescriptor.vertex.module = GetTestVertexShaderModule();
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
@ -363,7 +363,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleUVtoRG) {
renderPipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
renderPipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
wgpu::Sampler sampler = device.CreateSampler();
@ -404,7 +404,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYUVtoRGB) {
chromaViewDesc.aspect = wgpu::TextureAspect::Plane1Only;
wgpu::TextureView chromaTextureView = wgpuTexture.CreateView(&chromaViewDesc);
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
renderPipelineDescriptor.vertex.module = GetTestVertexShaderModule();
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
@ -424,7 +424,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYUVtoRGB) {
device, kYUVImageDataWidthInTexels, kYUVImageDataHeightInTexels);
renderPipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
wgpu::Sampler sampler = device.CreateSampler();

View File

@ -230,40 +230,40 @@ class BlendFactorDeprecationTests : public DeprecationTests {
}
)");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.cTargets[0].blend = &descriptor.cBlends[0];
descriptor.cBlends[0].color.srcFactor = blendFactor;
if (deprecated) {
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline2(&descriptor));
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
} else {
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
descriptor.cBlends[0].color.srcFactor = wgpu::BlendFactor::One;
descriptor.cBlends[0].color.dstFactor = blendFactor;
if (deprecated) {
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline2(&descriptor));
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
} else {
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
descriptor.cBlends[0].color.dstFactor = wgpu::BlendFactor::Zero;
descriptor.cBlends[0].alpha.srcFactor = blendFactor;
if (deprecated) {
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline2(&descriptor));
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
} else {
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
descriptor.cBlends[0].alpha.srcFactor = wgpu::BlendFactor::One;
descriptor.cBlends[0].alpha.dstFactor = blendFactor;
if (deprecated) {
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline2(&descriptor));
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
} else {
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
descriptor.cBlends[0].alpha.dstFactor = wgpu::BlendFactor::Zero;
}

View File

@ -95,7 +95,7 @@ class DepthBiasTests : public DawnTest {
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = depthClear;
// Create a render pipeline to render the quad
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
renderPipelineDesc.vertex.module = vertexModule;
renderPipelineDesc.cFragment.module = fragmentModule;
@ -109,7 +109,7 @@ class DepthBiasTests : public DawnTest {
depthStencil->depthCompare = wgpu::CompareFunction::Greater;
}
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
// Draw the quad (two triangles)
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();

View File

@ -66,7 +66,7 @@ class DepthStencilCopyTests : public DawnTest {
return device.CreateTexture(&texDescriptor);
}
void PopulatePipelineDescriptorWriteDepth(utils::ComboRenderPipelineDescriptor2* desc,
void PopulatePipelineDescriptorWriteDepth(utils::ComboRenderPipelineDescriptor* desc,
wgpu::TextureFormat format,
float regionDepth) {
desc->vertex.module = mVertexModule;
@ -96,11 +96,11 @@ class DepthStencilCopyTests : public DawnTest {
utils::ComboRenderPassDescriptor renderPassDesc({}, texture.CreateView(&viewDesc));
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = clearDepth;
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
PopulatePipelineDescriptorWriteDepth(&renderPipelineDesc, wgpu::TextureFormat::Depth32Float,
regionDepth);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&renderPassDesc);
pass.SetPipeline(pipeline);
@ -128,12 +128,12 @@ class DepthStencilCopyTests : public DawnTest {
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = clearDepth;
renderPassDesc.cDepthStencilAttachmentInfo.clearStencil = clearStencil;
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
PopulatePipelineDescriptorWriteDepth(&renderPipelineDesc,
wgpu::TextureFormat::Depth24PlusStencil8, regionDepth);
renderPipelineDesc.cDepthStencil.stencilFront.passOp = wgpu::StencilOperation::Replace;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
// Draw the quad (two triangles)
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
@ -233,7 +233,7 @@ class DepthStencilCopyTests : public DawnTest {
commandEncoder.CopyBufferToTexture(&bufferCopy, &textureCopy, &depthDataDesc.size);
// Pipeline for a full screen quad.
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
@ -283,7 +283,7 @@ class DepthStencilCopyTests : public DawnTest {
passDescriptor.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Load;
passDescriptor.cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Load;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
// Bind the depth data texture.
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
@ -642,7 +642,7 @@ TEST_P(DepthStencilCopyTests, ToStencilAspect) {
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
// Create a render pipline which decrements the stencil value for passing fragments.
// A quad is drawn in the bottom left.
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
renderPipelineDesc.vertex.module = mVertexModule;
renderPipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"(
[[stage(fragment)]] fn main() {
@ -652,7 +652,7 @@ TEST_P(DepthStencilCopyTests, ToStencilAspect) {
depthStencil->stencilFront.passOp = wgpu::StencilOperation::DecrementClamp;
renderPipelineDesc.cFragment.targetCount = 0;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
// Create a render pass which loads the stencil. We want to load the values we
// copied in. Also load the canary depth values so they're not lost.

View File

@ -70,7 +70,7 @@ class DepthStencilSamplingTest : public DawnTest {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
std::ostringstream shaderSource;
std::ostringstream shaderOutputStruct;
@ -117,7 +117,7 @@ class DepthStencilSamplingTest : public DawnTest {
pipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
pipelineDescriptor.cFragment.targetCount = static_cast<uint32_t>(aspects.size());
return device.CreateRenderPipeline2(&pipelineDescriptor);
return device.CreateRenderPipeline(&pipelineDescriptor);
}
wgpu::ComputePipeline CreateSamplingComputePipeline(std::vector<TestAspect> aspects,
@ -199,14 +199,14 @@ class DepthStencilSamplingTest : public DawnTest {
{1, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Depth},
{2, wgpu::ShaderStage::Fragment, wgpu::BufferBindingType::Uniform}});
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = fsModule;
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
pipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
pipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::R32Float;
return device.CreateRenderPipeline2(&pipelineDescriptor);
return device.CreateRenderPipeline(&pipelineDescriptor);
}
wgpu::ComputePipeline CreateComparisonComputePipeline() {

View File

@ -290,7 +290,7 @@ class DepthStencilStateTest : public DawnTest {
// Create a pipeline for the triangles with the test spec's depth stencil state
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
@ -298,7 +298,7 @@ class DepthStencilStateTest : public DawnTest {
depthStencil->format = wgpu::TextureFormat::Depth24PlusStencil8;
descriptor.primitive.frontFace = test.frontFace;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
// Create a bind group for the data
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
@ -732,12 +732,12 @@ TEST_P(DepthStencilStateTest, CreatePipelineWithAllFormats) {
};
for (wgpu::TextureFormat depthStencilFormat : kDepthStencilFormats) {
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.EnableDepthStencil(depthStencilFormat);
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
}

View File

@ -38,7 +38,7 @@ class DestroyTest : public DawnTest {
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
@ -48,7 +48,7 @@ class DestroyTest : public DawnTest {
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
descriptor.cTargets[0].format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline2(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor);
vertexBuffer = utils::CreateBufferFromData<float>(
device, wgpu::BufferUsage::Vertex,

View File

@ -177,8 +177,8 @@ TEST_P(DeviceLostTest, CreateComputePipelineFails) {
TEST_P(DeviceLostTest, CreateRenderPipelineFails) {
SetCallbackAndLoseForTesting();
utils::ComboRenderPipelineDescriptor2 descriptor;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
utils::ComboRenderPipelineDescriptor descriptor;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
// Tests that CreateSampler fails when device is lost

View File

@ -37,7 +37,7 @@ class DrawIndexedIndirectTest : public DawnTest {
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
@ -48,7 +48,7 @@ class DrawIndexedIndirectTest : public DawnTest {
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
descriptor.cTargets[0].format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline2(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor);
vertexBuffer = utils::CreateBufferFromData<float>(
device, wgpu::BufferUsage::Vertex,

View File

@ -37,7 +37,7 @@ class DrawIndexedTest : public DawnTest {
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
@ -48,7 +48,7 @@ class DrawIndexedTest : public DawnTest {
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
descriptor.cTargets[0].format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline2(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor);
vertexBuffer = utils::CreateBufferFromData<float>(
device, wgpu::BufferUsage::Vertex,

View File

@ -37,7 +37,7 @@ class DrawIndirectTest : public DawnTest {
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
@ -48,7 +48,7 @@ class DrawIndirectTest : public DawnTest {
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
descriptor.cTargets[0].format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline2(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor);
vertexBuffer = utils::CreateBufferFromData<float>(
device, wgpu::BufferUsage::Vertex,

View File

@ -37,7 +37,7 @@ class DrawTest : public DawnTest {
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
@ -47,7 +47,7 @@ class DrawTest : public DawnTest {
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
descriptor.cTargets[0].format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline2(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor);
vertexBuffer = utils::CreateBufferFromData<float>(
device, wgpu::BufferUsage::Vertex,

View File

@ -152,7 +152,7 @@ class DynamicBufferOffsetTests : public DawnTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fs.str().c_str());
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = fsModule;
pipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
@ -166,7 +166,7 @@ class DynamicBufferOffsetTests : public DawnTest {
pipelineLayoutDescriptor.bindGroupLayouts = mBindGroupLayouts;
pipelineDescriptor.layout = device.CreatePipelineLayout(&pipelineLayoutDescriptor);
return device.CreateRenderPipeline2(&pipelineDescriptor);
return device.CreateRenderPipeline(&pipelineDescriptor);
}
wgpu::ComputePipeline CreateComputePipeline(bool isInheritedPipeline = false) {

View File

@ -34,14 +34,14 @@ TEST_P(EntryPointTests, FragAndVertexSameModule) {
)");
// Create a point pipeline from the module.
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
desc.vertex.module = module;
desc.vertex.entryPoint = "vertex_main";
desc.cFragment.module = module;
desc.cFragment.entryPoint = "fragment_main";
desc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
desc.primitive.topology = wgpu::PrimitiveTopology::PointList;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
// Render the point and check that it was rendered.
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);

View File

@ -145,7 +145,7 @@ struct FragInputs {
constexpr uint32_t kComponentsPerVertex = 4;
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
utils::ComboRenderPipelineDescriptor pipelineDesc;
pipelineDesc.vertex.module = utils::CreateShaderModule(device, vertexShader.c_str());
pipelineDesc.cFragment.module = utils::CreateShaderModule(device, fragmentShader.c_str());
pipelineDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
@ -155,7 +155,7 @@ struct FragInputs {
pipelineDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
pipelineDesc.cTargets[0].format = renderPass.colorFormat;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc);
std::vector<float> vertexData(firstVertex * kComponentsPerVertex);
vertexData.insert(vertexData.end(), {0, 0, 0, 1});

View File

@ -72,13 +72,13 @@ class GpuMemorySyncTests : public DawnTest {
return vec4<f32>(f32(data.i) / 255.0, 0.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 rpDesc;
utils::ComboRenderPipelineDescriptor rpDesc;
rpDesc.vertex.module = vsModule;
rpDesc.cFragment.module = fsModule;
rpDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
rpDesc.cTargets[0].format = colorFormat;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&rpDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&rpDesc);
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), {{0, buffer}});
@ -347,13 +347,13 @@ class StorageToUniformSyncTests : public DawnTest {
return vec4<f32>(contents.color, 0.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 rpDesc;
utils::ComboRenderPipelineDescriptor rpDesc;
rpDesc.vertex.module = vsModule;
rpDesc.cFragment.module = fsModule;
rpDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
rpDesc.cTargets[0].format = colorFormat;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&rpDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&rpDesc);
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), {{0, mBuffer}});
@ -589,7 +589,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
utils::ComboRenderPipelineDescriptor2 rpDesc;
utils::ComboRenderPipelineDescriptor rpDesc;
rpDesc.vertex.module = vsModule;
rpDesc.cFragment.module = fsModule;
rpDesc.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
@ -599,7 +599,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
rpDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
rpDesc.cTargets[0].format = renderPass.colorFormat;
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&rpDesc);
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&rpDesc);
wgpu::BindGroup bindGroup1 = utils::MakeBindGroup(device, rp.GetBindGroupLayout(0),
{{0, uniformBuffer}, {1, storageBuffer}});
@ -704,7 +704,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
utils::ComboRenderPipelineDescriptor2 rpDesc;
utils::ComboRenderPipelineDescriptor rpDesc;
rpDesc.vertex.module = vsModule;
rpDesc.cFragment.module = fsModule;
rpDesc.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
@ -714,7 +714,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
rpDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
rpDesc.cTargets[0].format = renderPass.colorFormat;
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&rpDesc);
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&rpDesc);
wgpu::BindGroup bindGroup1 =
utils::MakeBindGroup(device, rp.GetBindGroupLayout(0),

View File

@ -287,12 +287,12 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
}
)");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vs;
descriptor.cFragment.module = fs;
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
pipeline = device.CreateRenderPipeline2(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor);
}
// The bindgroup containing the texture view for the ioSurface as well as the sampler.

View File

@ -51,7 +51,7 @@ class IndexFormatTest : public DawnTest {
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = primitiveTopology;
@ -62,7 +62,7 @@ class IndexFormatTest : public DawnTest {
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
descriptor.cTargets[0].format = renderPass.colorFormat;
return device.CreateRenderPipeline2(&descriptor);
return device.CreateRenderPipeline(&descriptor);
}
};

View File

@ -218,7 +218,7 @@ class MultisampledRenderingTest : public DawnTest {
uint32_t sampleMask = 0xFFFFFFFF,
bool alphaToCoverageEnabled = false,
bool flipTriangle = false) {
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
// Draw a bottom-right triangle. In standard 4xMSAA pattern, for the pixels on diagonal,
// only two of the samples will be touched.
@ -269,7 +269,7 @@ class MultisampledRenderingTest : public DawnTest {
pipelineDescriptor.cTargets[i].format = kColorFormat;
}
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
return pipeline;
}

View File

@ -51,7 +51,7 @@ class MultisampledSamplingTest : public DawnTest {
DawnTest::SetUp();
{
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
desc.vertex.module = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
@ -87,7 +87,7 @@ class MultisampledSamplingTest : public DawnTest {
desc.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
drawPipeline = device.CreateRenderPipeline2(&desc);
drawPipeline = device.CreateRenderPipeline(&desc);
}
{
wgpu::ComputePipelineDescriptor desc = {};

View File

@ -207,7 +207,7 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) {
EXPECT_NE(pl.Get(), otherPl.Get());
EXPECT_EQ(pl.Get() == samePl.Get(), !UsesWire());
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
desc.vertex.module = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
@ -217,13 +217,13 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) {
})");
desc.layout = pl;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
desc.layout = samePl;
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline(&desc);
desc.layout = otherPl;
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline(&desc);
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
EXPECT_EQ(pipeline.Get() == samePipeline.Get(), !UsesWire());
@ -247,19 +247,19 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) {
EXPECT_NE(module.Get(), otherModule.Get());
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
desc.cFragment.module = utils::CreateShaderModule(device, R"(
[[stage(fragment)]] fn main() {
})");
desc.vertex.module = module;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
desc.vertex.module = sameModule;
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline(&desc);
desc.vertex.module = otherModule;
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline(&desc);
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
EXPECT_EQ(pipeline.Get() == samePipeline.Get(), !UsesWire());
@ -281,20 +281,20 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) {
EXPECT_NE(module.Get(), otherModule.Get());
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
desc.vertex.module = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
})");
desc.cFragment.module = module;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
desc.cFragment.module = sameModule;
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline(&desc);
desc.cFragment.module = otherModule;
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline(&desc);
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
EXPECT_EQ(pipeline.Get() == samePipeline.Get(), !UsesWire());

View File

@ -180,13 +180,13 @@ TEST_P(OpArrayLengthTest, Fragment) {
})")
.c_str());
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
descriptor.cTargets[0].format = renderPass.colorFormat;
descriptor.layout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
// "Draw" the lengths to the texture.
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
@ -241,13 +241,13 @@ TEST_P(OpArrayLengthTest, Vertex) {
return color;
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
descriptor.cTargets[0].format = renderPass.colorFormat;
descriptor.layout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
// "Draw" the lengths to the texture.
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();

View File

@ -109,7 +109,7 @@ class DepthClampingTest : public DawnTest {
wgpu::BufferUsage::Uniform);
// Create a pipeline for the triangles with the test spec's params.
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.primitive.nextInChain = test.depthClampingState;
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
descriptor.vertex.module = vsModule;
@ -119,7 +119,7 @@ class DepthClampingTest : public DawnTest {
depthStencil->depthCompare = test.depthCompareFunction;
depthStencil->format = wgpu::TextureFormat::Depth24PlusStencil8;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
// Create a bind group for the data
wgpu::BindGroup bindGroup = utils::MakeBindGroup(

View File

@ -183,7 +183,7 @@ class PrimitiveTopologyTest : public DawnTest {
// locations
void DoTest(wgpu::PrimitiveTopology primitiveTopology,
const std::vector<LocationSpec>& locationSpecs) {
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
@ -199,7 +199,7 @@ class PrimitiveTopologyTest : public DawnTest {
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
descriptor.cTargets[0].format = renderPass.colorFormat;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
{

View File

@ -95,11 +95,11 @@ class OcclusionQueryTests : public QueryTests {
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
pipeline = device.CreateRenderPipeline2(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor);
}
struct ScissorRect {
@ -129,7 +129,7 @@ class OcclusionQueryTests : public QueryTests {
OcclusionExpectation::Result expected) {
constexpr uint32_t kQueryCount = 1;
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
@ -143,7 +143,7 @@ class OcclusionQueryTests : public QueryTests {
depthStencil->stencilBack.compare =
stencilTestEnabled ? wgpu::CompareFunction::Never : wgpu::CompareFunction::Always;
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&descriptor);
wgpu::Texture renderTarget = CreateRenderTexture(wgpu::TextureFormat::RGBA8Unorm);
wgpu::TextureView renderTargetView = renderTarget.CreateView();

View File

@ -47,7 +47,7 @@ class RenderBundleTest : public DawnTest {
return fragmentUniformBuffer.color;
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
@ -57,7 +57,7 @@ class RenderBundleTest : public DawnTest {
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
descriptor.cTargets[0].format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline2(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor);
float colors0[] = {kColors[0].r / 255.f, kColors[0].g / 255.f, kColors[0].b / 255.f,
kColors[0].a / 255.f};

View File

@ -33,12 +33,12 @@ class DrawQuad {
}
void Draw(wgpu::RenderPassEncoder* pass) {
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = pipelineLayout;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
auto renderPipeline = device.CreateRenderPipeline2(&descriptor);
auto renderPipeline = device.CreateRenderPipeline(&descriptor);
pass->SetPipeline(renderPipeline);
pass->Draw(6, 1, 0, 0);

View File

@ -42,13 +42,13 @@ class RenderPassTest : public DawnTest {
return vec4<f32>(0.0, 0.0, 1.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = mVSModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
descriptor.cTargets[0].format = kFormat;
pipeline = device.CreateRenderPipeline2(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor);
}
wgpu::Texture CreateDefault2DTexture() {
@ -140,14 +140,14 @@ TEST_P(RenderPassTest, NoCorrespondingFragmentShaderOutputs) {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = mVSModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
descriptor.cTargets[0].format = kFormat;
wgpu::RenderPipeline pipelineWithNoFragmentOutput =
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
pass.SetPipeline(pipelineWithNoFragmentOutput);
pass.Draw(3);

View File

@ -76,7 +76,7 @@ class SamplerFilterAnisotropicTest : public DawnTest {
return textureSample(texture0, sampler0, input.uv);
})");
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = fsModule;
pipelineDescriptor.cBuffers[0].attributeCount = 2;
@ -88,7 +88,7 @@ class SamplerFilterAnisotropicTest : public DawnTest {
pipelineDescriptor.cBuffers[0].arrayStride = 6 * sizeof(float);
pipelineDescriptor.cTargets[0].format = mRenderPass.colorFormat;
mPipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
mPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
mBindGroupLayout = mPipeline.GetBindGroupLayout(0);
InitTexture();

View File

@ -76,12 +76,12 @@ class SamplerTest : public DawnTest {
return textureSample(texture0, sampler0, FragCoord.xy / vec2<f32>(2.0, 2.0));
})");
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = fsModule;
pipelineDescriptor.cTargets[0].format = mRenderPass.colorFormat;
mPipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
mPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
mBindGroupLayout = mPipeline.GetBindGroupLayout(0);
wgpu::TextureDescriptor descriptor;

View File

@ -39,12 +39,12 @@ class ScissorTest : public DawnTest {
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.cTargets[0].format = format;
return device.CreateRenderPipeline2(&descriptor);
return device.CreateRenderPipeline(&descriptor);
}
};

View File

@ -116,10 +116,10 @@ fn main([[builtin(position)]] fragCoord : vec4<f32>) -> [[location(0)]] vec4<f32
})";
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader.c_str());
utils::ComboRenderPipelineDescriptor2 rpDesc;
utils::ComboRenderPipelineDescriptor rpDesc;
rpDesc.vertex.module = vsModule;
rpDesc.cFragment.module = fsModule;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&rpDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&rpDesc);
}
// Tests that a vertex shader using struct function parameters and return values for shader stage
@ -152,7 +152,7 @@ fn main([[location(0)]] color : vec4<f32>) -> [[location(0)]] vec4<f32> {
})";
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader.c_str());
utils::ComboRenderPipelineDescriptor2 rpDesc;
utils::ComboRenderPipelineDescriptor rpDesc;
rpDesc.vertex.module = vsModule;
rpDesc.cFragment.module = fsModule;
rpDesc.vertex.bufferCount = 1;
@ -162,7 +162,7 @@ fn main([[location(0)]] color : vec4<f32>) -> [[location(0)]] vec4<f32> {
rpDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x3;
rpDesc.cAttributes[1].shaderLocation = 1;
rpDesc.cAttributes[1].format = wgpu::VertexFormat::Float32x4;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&rpDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&rpDesc);
}
// Tests that shaders using struct function parameters and return values for shader stage I/O
@ -200,7 +200,7 @@ fn main(input : FragmentIn) -> [[location(0)]] vec4<f32> {
})";
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader.c_str());
utils::ComboRenderPipelineDescriptor2 rpDesc;
utils::ComboRenderPipelineDescriptor rpDesc;
rpDesc.vertex.module = vsModule;
rpDesc.cFragment.module = fsModule;
rpDesc.vertex.bufferCount = 1;
@ -210,7 +210,7 @@ fn main(input : FragmentIn) -> [[location(0)]] vec4<f32> {
rpDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x3;
rpDesc.cAttributes[1].shaderLocation = 1;
rpDesc.cAttributes[1].format = wgpu::VertexFormat::Float32x4;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&rpDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&rpDesc);
}
// Tests that shaders I/O structs that us compatible locations but are not sorted by hand can link.
@ -247,7 +247,7 @@ fn main(input : FragmentIn) -> [[location(0)]] vec4<f32> {
})";
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader.c_str());
utils::ComboRenderPipelineDescriptor2 rpDesc;
utils::ComboRenderPipelineDescriptor rpDesc;
rpDesc.vertex.module = vsModule;
rpDesc.cFragment.module = fsModule;
rpDesc.vertex.bufferCount = 1;
@ -257,7 +257,7 @@ fn main(input : FragmentIn) -> [[location(0)]] vec4<f32> {
rpDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x3;
rpDesc.cAttributes[1].shaderLocation = 1;
rpDesc.cAttributes[1].format = wgpu::VertexFormat::Float32x4;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&rpDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&rpDesc);
}
// Tests that shaders I/O structs can be shared between vertex and fragment shaders.
@ -290,7 +290,7 @@ fn fragmentMain(input : VertexOut) -> [[location(0)]] vec4<f32> {
})";
wgpu::ShaderModule shaderModule = utils::CreateShaderModule(device, shader.c_str());
utils::ComboRenderPipelineDescriptor2 rpDesc;
utils::ComboRenderPipelineDescriptor rpDesc;
rpDesc.vertex.module = shaderModule;
rpDesc.vertex.entryPoint = "vertexMain";
rpDesc.cFragment.module = shaderModule;
@ -302,7 +302,7 @@ fn fragmentMain(input : VertexOut) -> [[location(0)]] vec4<f32> {
rpDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x3;
rpDesc.cAttributes[1].shaderLocation = 1;
rpDesc.cAttributes[1].format = wgpu::VertexFormat::Float32x4;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&rpDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&rpDesc);
}
DAWN_INSTANTIATE_TEST(ShaderTests,

View File

@ -474,12 +474,12 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vertexShader);
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader);
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
desc.vertex.module = vsModule;
desc.cFragment.module = fsModule;
desc.cTargets[0].format = kRenderAttachmentFormat;
desc.primitive.topology = wgpu::PrimitiveTopology::PointList;
return device.CreateRenderPipeline2(&desc);
return device.CreateRenderPipeline(&desc);
}
void CheckDrawsGreen(const char* vertexShader,

View File

@ -220,7 +220,7 @@ TEST_P(SwapChainValidationTests, ViewDestroyedAfterPresent) {
// Check that returned view is of the current format / usage / dimension / size / sample count
TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) {
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
utils::ComboRenderPipelineDescriptor pipelineDesc;
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
@ -235,7 +235,7 @@ TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) {
// Validation will check that the format of the view matches this format.
pipelineDesc.cTargets[0].format = wgpu::TextureFormat::BGRA8Unorm;
pipelineDesc.cTargets[1].format = wgpu::TextureFormat::R8Unorm;
device.CreateRenderPipeline2(&pipelineDesc);
device.CreateRenderPipeline(&pipelineDesc);
// Create a second texture to be used as render pass attachment. Validation will check that the
// size of the view matches the size of this texture.

View File

@ -140,7 +140,7 @@ class TextureFormatTest : public DawnTest {
// bindgroup and output its decompressed values to the render target.
wgpu::RenderPipeline CreateSamplePipeline(FormatTestInfo sampleFormatInfo,
FormatTestInfo renderFormatInfo) {
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
@ -174,7 +174,7 @@ class TextureFormatTest : public DawnTest {
desc.cFragment.module = fsModule;
desc.cTargets[0].format = renderFormatInfo.format;
return device.CreateRenderPipeline2(&desc);
return device.CreateRenderPipeline(&desc);
}
// The sampling test uploads the sample data in a texture with the sampleFormatInfo.format.

View File

@ -65,13 +65,13 @@ class TextureSubresourceTest : public DawnTest {
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
descriptor.cTargets[0].format = kFormat;
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&descriptor);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
@ -109,7 +109,7 @@ class TextureSubresourceTest : public DawnTest {
return textureSample(tex, samp, FragCoord.xy / vec2<f32>(4.0, 4.0));
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
@ -117,7 +117,7 @@ class TextureSubresourceTest : public DawnTest {
wgpu::Sampler sampler = device.CreateSampler();
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&descriptor);
wgpu::BindGroupLayout bgl = rp.GetBindGroupLayout(0);
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, bgl, {{0, sampler}, {1, samplerView}});

View File

@ -170,12 +170,12 @@ class TextureViewSamplingTest : public DawnTest {
void Verify(const wgpu::TextureView& textureView, const char* fragmentShader, int expected) {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader);
utils::ComboRenderPipelineDescriptor2 textureDescriptor;
utils::ComboRenderPipelineDescriptor textureDescriptor;
textureDescriptor.vertex.module = mVSModule;
textureDescriptor.cFragment.module = fsModule;
textureDescriptor.cTargets[0].format = mRenderPass.colorFormat;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&textureDescriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
{{0, mSampler}, {1, textureView}});
@ -503,12 +503,12 @@ class TextureViewRenderingTest : public DawnTest {
wgpu::ShaderModule oneColorFsModule =
utils::CreateShaderModule(device, oneColorFragmentShader);
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = oneColorFsModule;
pipelineDescriptor.cTargets[0].format = kDefaultFormat;
wgpu::RenderPipeline oneColorPipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
wgpu::RenderPipeline oneColorPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
{

View File

@ -66,7 +66,7 @@ class TextureZeroInitTest : public DawnTest {
return descriptor;
}
wgpu::RenderPipeline CreatePipelineForTest(float depth = 0.f) {
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest(depth);
const char* fs = R"(
;
@ -79,7 +79,7 @@ class TextureZeroInitTest : public DawnTest {
depthStencil->depthCompare = wgpu::CompareFunction::Equal;
depthStencil->stencilFront.compare = wgpu::CompareFunction::Equal;
return device.CreateRenderPipeline2(&pipelineDescriptor);
return device.CreateRenderPipeline(&pipelineDescriptor);
}
wgpu::ShaderModule CreateBasicVertexShaderForTest(float depth = 0.f) {
std::string source = R"(
@ -857,11 +857,11 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
// Create render pipeline
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
// Create bindgroup
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
@ -916,11 +916,11 @@ TEST_P(TextureZeroInitTest, TextureBothSampledAndAttachmentClear) {
wgpu::TextureView sampleView = texture.CreateView(&viewDesc);
// Create render pipeline
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
renderPipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0), {{0, sampleView}});
@ -1142,11 +1142,11 @@ TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) {
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
// Create render pipeline
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
// Create bindgroup
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
@ -1288,11 +1288,11 @@ TEST_P(TextureZeroInitTest, PreservesInitializedMip) {
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
// Create render pipeline
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
// Create bindgroup
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
@ -1365,11 +1365,11 @@ TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) {
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
// Create render pipeline
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
// Only sample from the uninitialized first layer.
wgpu::TextureViewDescriptor textureViewDescriptor;
@ -1789,12 +1789,12 @@ class CompressedTextureZeroInitTest : public TextureZeroInitTest {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
{
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
wgpu::RenderPipeline renderPipeline =
device.CreateRenderPipeline2(&renderPipelineDescriptor);
device.CreateRenderPipeline(&renderPipelineDescriptor);
pass.SetPipeline(renderPipeline);
wgpu::TextureViewDescriptor textureViewDescriptor = CreateTextureViewDescriptor(

View File

@ -63,7 +63,7 @@ class VertexBufferRobustnessTest : public DawnTest {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
@ -72,7 +72,7 @@ class VertexBufferRobustnessTest : public DawnTest {
descriptor.cTargets[0].format = renderPass.colorFormat;
renderPass.renderPassInfo.cColorAttachments[0].clearColor = {0, 0, 0, 1};
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);

View File

@ -362,7 +362,7 @@ class VertexFormatTest : public DawnTest {
strideBytes += (4 - strideBytes % 4);
}
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.vertex.bufferCount = 1;
@ -371,7 +371,7 @@ class VertexFormatTest : public DawnTest {
descriptor.cAttributes[0].format = format;
descriptor.cTargets[0].format = renderPass.colorFormat;
return device.CreateRenderPipeline2(&descriptor);
return device.CreateRenderPipeline(&descriptor);
}
template <typename VertexType, typename ExpectedType>

View File

@ -66,7 +66,7 @@ class VertexStateTest : public DawnTest {
VertexFormat format;
InputStepMode step;
};
wgpu::RenderPipeline MakeTestPipeline(const wgpu::VertexStateDescriptor& vertexState,
wgpu::RenderPipeline MakeTestPipeline(const utils::ComboVertexStateDescriptor& vertexState,
int multiplier,
const std::vector<ShaderTestSpec>& testSpec) {
std::ostringstream vs;
@ -144,14 +144,14 @@ class VertexStateTest : public DawnTest {
}
)");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.vertex.bufferCount = vertexState.vertexBufferCount;
descriptor.vertex.buffers = vertexState.vertexBuffers;
descriptor.vertex.buffers = &vertexState.cVertexBuffers[0];
descriptor.cTargets[0].format = renderPass.colorFormat;
return device.CreateRenderPipeline2(&descriptor);
return device.CreateRenderPipeline(&descriptor);
}
struct VertexAttributeSpec {
@ -580,7 +580,7 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) {
wgpu::Buffer vertexBuffer =
utils::CreateBufferFromData(device, &data, sizeof(data), wgpu::BufferUsage::Vertex);
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
utils::ComboRenderPipelineDescriptor pipelineDesc;
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
struct VertexIn {
[[location(0)]] attr0 : vec4<f32>;
@ -623,7 +623,7 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) {
pipelineDesc.cTargets[0].format = renderPass.colorFormat;
pipelineDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
@ -668,14 +668,14 @@ TEST_P(OptionalVertexStateTest, Basic) {
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
descriptor.vertex.bufferCount = 0;
descriptor.vertex.buffers = nullptr;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
{

View File

@ -33,13 +33,13 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) {
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
descriptor.cTargets[0].format = renderPass.colorFormat;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
{

View File

@ -57,11 +57,11 @@ class ViewportTest : public DawnTest {
uint32_t height,
bool doViewportCall = true) {
// Create a pipeline that will draw a white quad.
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
utils::ComboRenderPipelineDescriptor pipelineDesc;
pipelineDesc.vertex.module = mQuadVS;
pipelineDesc.cFragment.module = mQuadFS;
pipelineDesc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc);
// Render the quad with the viewport call.
utils::BasicRenderPass rp = utils::CreateBasicRenderPass(device, kWidth, kHeight);
@ -91,7 +91,7 @@ class ViewportTest : public DawnTest {
void TestViewportDepth(float minDepth, float maxDepth, bool doViewportCall = true) {
// Create a pipeline drawing 3 points at depth 1.0, 0.5 and 0.0.
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
utils::ComboRenderPipelineDescriptor pipelineDesc;
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
let points : array<vec3<f32>, 3> = array<vec3<f32>, 3>(
vec3<f32>(-0.9, 0.0, 1.0),
@ -108,7 +108,7 @@ class ViewportTest : public DawnTest {
wgpu::DepthStencilState* depthStencil =
pipelineDesc.EnableDepthStencil(wgpu::TextureFormat::Depth32Float);
depthStencil->depthWriteEnabled = true;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc);
// Create the texture that will store the post-viewport-transform depth.
wgpu::TextureDescriptor depthDesc;
@ -182,11 +182,11 @@ TEST_P(ViewportTest, ViewportDepth) {
// Test that a draw with an empty viewport doesn't draw anything.
TEST_P(ViewportTest, EmptyViewport) {
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
pipelineDescriptor.vertex.module = mQuadVS;
pipelineDescriptor.cFragment.module = mQuadFS;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);

View File

@ -347,7 +347,7 @@ void DrawCallPerf::SetUp() {
}
// Setup the base render pipeline descriptor.
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
renderPipelineDesc.vertex.bufferCount = 1;
renderPipelineDesc.cBuffers[0].arrayStride = 4 * sizeof(float);
renderPipelineDesc.cBuffers[0].attributeCount = 1;
@ -369,7 +369,7 @@ void DrawCallPerf::SetUp() {
renderPipelineDesc.layout = pipelineLayout;
renderPipelineDesc.vertex.module = vsModule;
renderPipelineDesc.cFragment.module = fsModule;
mPipelines[0] = device.CreateRenderPipeline2(&renderPipelineDesc);
mPipelines[0] = device.CreateRenderPipeline(&renderPipelineDesc);
// If the test is using a dynamic pipeline, create the second pipeline.
if (GetParam().pipelineType == Pipeline::Dynamic) {
@ -396,7 +396,7 @@ void DrawCallPerf::SetUp() {
// Create the pipeline.
renderPipelineDesc.layout = pipelineLayout;
renderPipelineDesc.cFragment.module = fsModule;
mPipelines[1] = device.CreateRenderPipeline2(&renderPipelineDesc);
mPipelines[1] = device.CreateRenderPipeline(&renderPipelineDesc);
// Create the buffer and bind group to bind to the constant bind group layout slot.
constexpr float kConstantData[] = {0.01, 0.02, 0.03};

View File

@ -68,7 +68,7 @@ class SubresourceTrackingPerf : public DawnPerfTestWithParams<SubresourceTrackin
uploadTexDesc.usage = wgpu::TextureUsage::CopySrc;
mUploadTexture = device.CreateTexture(&uploadTexDesc);
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
utils::ComboRenderPipelineDescriptor pipelineDesc;
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
@ -81,7 +81,7 @@ class SubresourceTrackingPerf : public DawnPerfTestWithParams<SubresourceTrackin
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
}
)");
mPipeline = device.CreateRenderPipeline2(&pipelineDesc);
mPipeline = device.CreateRenderPipeline(&pipelineDesc);
}
private:

View File

@ -1101,13 +1101,13 @@ class SetBindGroupValidationTest : public ValidationTest {
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = fsModule;
wgpu::PipelineLayout pipelineLayout =
utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
pipelineDescriptor.layout = pipelineLayout;
return device.CreateRenderPipeline2(&pipelineDescriptor);
return device.CreateRenderPipeline(&pipelineDescriptor);
}
wgpu::ComputePipeline CreateComputePipeline() {
@ -1561,11 +1561,11 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, ss.str().c_str());
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = mVsModule;
pipelineDescriptor.cFragment.module = fsModule;
pipelineDescriptor.layout = pipelineLayout;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
return std::make_tuple(bindGroupLayouts, pipeline);
}
@ -1700,12 +1700,12 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
wgpu::PipelineLayoutDescriptor descriptor;
descriptor.bindGroupLayoutCount = bindGroupLayout.size();
descriptor.bindGroupLayouts = bindGroupLayout.data();
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = fsModule;
wgpu::PipelineLayout pipelineLayout = device.CreatePipelineLayout(&descriptor);
pipelineDescriptor.layout = pipelineLayout;
return device.CreateRenderPipeline2(&pipelineDescriptor);
return device.CreateRenderPipeline(&pipelineDescriptor);
}
wgpu::RenderPipeline CreateRenderPipeline(std::vector<wgpu::BindGroupLayout> bindGroupLayouts) {
@ -2070,13 +2070,13 @@ class ComparisonSamplerBindingTest : public ValidationTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentSource);
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = fsModule;
wgpu::PipelineLayout pipelineLayout =
utils::MakeBasicPipelineLayout(device, bindGroupLayout);
pipelineDescriptor.layout = pipelineLayout;
return device.CreateRenderPipeline2(&pipelineDescriptor);
return device.CreateRenderPipeline(&pipelineDescriptor);
}
};

View File

@ -36,12 +36,12 @@ class DrawIndirectValidationTest : public ValidationTest {
// Set up render pipeline
wgpu::PipelineLayout pipelineLayout = utils::MakeBasicPipelineLayout(device, nullptr);
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = pipelineLayout;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
pipeline = device.CreateRenderPipeline2(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor);
}
void ValidateExpectation(wgpu::CommandEncoder encoder, utils::Expectation expectation) {

View File

@ -27,12 +27,12 @@ class GetBindGroupLayoutTests : public ValidationTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, shader);
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = nullptr;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
return device.CreateRenderPipeline2(&descriptor);
return device.CreateRenderPipeline(&descriptor);
}
};
@ -73,12 +73,12 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
var pos_s : mat4x4<f32> = storage3.pos;
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = nullptr;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
// The same value is returned for the same index.
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), pipeline.GetBindGroupLayout(0).Get());
@ -491,12 +491,12 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
var pos : vec4<f32> = uniforms.pos;
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = nullptr;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
// Test that minBufferSize is set on the BGL and that the max of the min buffer sizes is used.
@ -563,14 +563,14 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
binding.buffer.minBindingSize = 64;
wgpu::BindGroupLayout bgl64 = device.CreateBindGroupLayout(&desc);
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = nullptr;
// Check with both stages using 4 bytes.
{
descriptor.vertex.module = vsModule4;
descriptor.cFragment.module = fsModule4;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl4.Get());
}
@ -578,7 +578,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
{
descriptor.vertex.module = vsModule64;
descriptor.cFragment.module = fsModule4;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl64.Get());
}
@ -586,7 +586,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
{
descriptor.vertex.module = vsModule4;
descriptor.cFragment.module = fsModule64;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl64.Get());
}
}
@ -629,14 +629,14 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
desc.entryCount = 1;
desc.entries = &binding;
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = nullptr;
// Check with only the vertex shader using the sampler
{
descriptor.vertex.module = vsModuleSampler;
descriptor.cFragment.module = fsModuleNoSampler;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
binding.visibility = wgpu::ShaderStage::Vertex;
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
@ -646,7 +646,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
{
descriptor.vertex.module = vsModuleNoSampler;
descriptor.cFragment.module = fsModuleSampler;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
binding.visibility = wgpu::ShaderStage::Fragment;
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
@ -656,7 +656,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
{
descriptor.vertex.module = vsModuleSampler;
descriptor.cFragment.module = fsModuleSampler;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
binding.visibility = wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Vertex;
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
@ -686,12 +686,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
var pos : vec4<f32> = ssbo.pos;
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = nullptr;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
// Test it is invalid to have conflicting binding texture multisampling in the shaders.
@ -711,12 +711,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) {
textureDimensions(myTexture);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = nullptr;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
// Test it is invalid to have conflicting binding texture dimension in the shaders.
@ -736,12 +736,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) {
textureDimensions(myTexture);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = nullptr;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
// Test it is invalid to have conflicting binding texture component type in the shaders.
@ -761,12 +761,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) {
textureDimensions(myTexture);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = nullptr;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
// Test it is an error to query an out of range bind group layout.
@ -853,12 +853,12 @@ TEST_F(GetBindGroupLayoutTests, Reflection) {
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
utils::ComboRenderPipelineDescriptor pipelineDesc;
pipelineDesc.layout = pipelineLayout;
pipelineDesc.vertex.module = vsModule;
pipelineDesc.cFragment.module = fsModule;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc);
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bindGroupLayout.Get());

View File

@ -32,14 +32,14 @@ class IndexBufferValidationTest : public ValidationTest {
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = primitiveTopology;
descriptor.primitive.stripIndexFormat = format;
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
return device.CreateRenderPipeline2(&descriptor);
return device.CreateRenderPipeline(&descriptor);
}
};

View File

@ -192,7 +192,7 @@ class MinBufferSizeTestsBase : public ValidationTest {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragShader.c_str());
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = fsModule;
pipelineDescriptor.layout = nullptr;
@ -203,7 +203,7 @@ class MinBufferSizeTestsBase : public ValidationTest {
pipelineDescriptor.layout = device.CreatePipelineLayout(&descriptor);
}
return device.CreateRenderPipeline2(&pipelineDescriptor);
return device.CreateRenderPipeline(&pipelineDescriptor);
}
// Creates render pipeline with default layout

View File

@ -184,7 +184,7 @@ namespace {
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
device.CreateRenderPipelineAsync(&descriptor, callback, &callbackData);

View File

@ -66,9 +66,9 @@ namespace {
pipelineLayout = device.CreatePipelineLayout(&pipelineLayoutDesc);
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
InitializeRenderPipelineDescriptor(&descriptor);
pipeline = device.CreateRenderPipeline2(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor);
float data[8];
wgpu::Buffer buffer = utils::CreateBufferFromData(device, data, 8 * sizeof(float),
@ -98,7 +98,7 @@ namespace {
{1, vertexStorageBuffer, 0, sizeof(kVertices)}});
}
void InitializeRenderPipelineDescriptor(utils::ComboRenderPipelineDescriptor2* descriptor) {
void InitializeRenderPipelineDescriptor(utils::ComboRenderPipelineDescriptor* descriptor) {
descriptor->layout = pipelineLayout;
descriptor->vertex.module = vsModule;
descriptor->cFragment.module = fsModule;
@ -729,7 +729,7 @@ TEST_F(RenderBundleValidationTest, PipelineColorFormatMismatch) {
renderBundleDesc.cColorFormats[1] = wgpu::TextureFormat::RG16Float;
renderBundleDesc.cColorFormats[2] = wgpu::TextureFormat::R16Sint;
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor2* desc) {
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor* desc) {
InitializeRenderPipelineDescriptor(desc);
desc->cFragment.targetCount = 3;
desc->cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
@ -739,38 +739,38 @@ TEST_F(RenderBundleValidationTest, PipelineColorFormatMismatch) {
// Test the success case.
{
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
SetupRenderPipelineDescForTest(&desc);
wgpu::RenderBundleEncoder renderBundleEncoder =
device.CreateRenderBundleEncoder(&renderBundleDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
renderBundleEncoder.SetPipeline(pipeline);
renderBundleEncoder.Finish();
}
// Test the failure case for mismatched format types.
{
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
SetupRenderPipelineDescForTest(&desc);
desc.cTargets[1].format = wgpu::TextureFormat::RGBA8Unorm;
wgpu::RenderBundleEncoder renderBundleEncoder =
device.CreateRenderBundleEncoder(&renderBundleDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
renderBundleEncoder.SetPipeline(pipeline);
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
}
// Test the failure case for missing format
{
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
SetupRenderPipelineDescForTest(&desc);
desc.cFragment.targetCount = 2;
wgpu::RenderBundleEncoder renderBundleEncoder =
device.CreateRenderBundleEncoder(&renderBundleDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
renderBundleEncoder.SetPipeline(pipeline);
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
}
@ -783,7 +783,7 @@ TEST_F(RenderBundleValidationTest, PipelineDepthStencilFormatMismatch) {
renderBundleDesc.cColorFormats[0] = wgpu::TextureFormat::RGBA8Unorm;
renderBundleDesc.depthStencilFormat = wgpu::TextureFormat::Depth24PlusStencil8;
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor2* desc) {
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor* desc) {
InitializeRenderPipelineDescriptor(desc);
desc->cFragment.targetCount = 1;
desc->cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
@ -791,39 +791,39 @@ TEST_F(RenderBundleValidationTest, PipelineDepthStencilFormatMismatch) {
// Test the success case.
{
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
SetupRenderPipelineDescForTest(&desc);
desc.EnableDepthStencil(wgpu::TextureFormat::Depth24PlusStencil8);
wgpu::RenderBundleEncoder renderBundleEncoder =
device.CreateRenderBundleEncoder(&renderBundleDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
renderBundleEncoder.SetPipeline(pipeline);
renderBundleEncoder.Finish();
}
// Test the failure case for mismatched format.
{
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
SetupRenderPipelineDescForTest(&desc);
desc.EnableDepthStencil(wgpu::TextureFormat::Depth24Plus);
wgpu::RenderBundleEncoder renderBundleEncoder =
device.CreateRenderBundleEncoder(&renderBundleDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
renderBundleEncoder.SetPipeline(pipeline);
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
}
// Test the failure case for missing format.
{
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
SetupRenderPipelineDescForTest(&desc);
desc.depthStencil = nullptr;
wgpu::RenderBundleEncoder renderBundleEncoder =
device.CreateRenderBundleEncoder(&renderBundleDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
renderBundleEncoder.SetPipeline(pipeline);
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
}
@ -836,7 +836,7 @@ TEST_F(RenderBundleValidationTest, PipelineSampleCountMismatch) {
renderBundleDesc.cColorFormats[0] = wgpu::TextureFormat::RGBA8Unorm;
renderBundleDesc.sampleCount = 4;
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
InitializeRenderPipelineDescriptor(&renderPipelineDesc);
renderPipelineDesc.cFragment.targetCount = 1;
renderPipelineDesc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
@ -846,7 +846,7 @@ TEST_F(RenderBundleValidationTest, PipelineSampleCountMismatch) {
{
wgpu::RenderBundleEncoder renderBundleEncoder =
device.CreateRenderBundleEncoder(&renderBundleDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
renderBundleEncoder.SetPipeline(pipeline);
renderBundleEncoder.Finish();
}
@ -857,7 +857,7 @@ TEST_F(RenderBundleValidationTest, PipelineSampleCountMismatch) {
wgpu::RenderBundleEncoder renderBundleEncoder =
device.CreateRenderBundleEncoder(&renderBundleDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
renderBundleEncoder.SetPipeline(pipeline);
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
}

View File

@ -45,36 +45,11 @@ class RenderPipelineValidationTest : public ValidationTest {
TEST_F(RenderPipelineValidationTest, CreationSuccess) {
{
// New format
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
device.CreateRenderPipeline2(&descriptor);
}
{
// Deprecated format
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
}
{
// Vertex input should be optional
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.vertexState = nullptr;
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
}
{
// Rasterization state should be optional
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.rasterizationState = nullptr;
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
device.CreateRenderPipeline(&descriptor);
}
}
@ -82,49 +57,49 @@ TEST_F(RenderPipelineValidationTest, CreationSuccess) {
TEST_F(RenderPipelineValidationTest, DepthBiasParameterNotBeNaN) {
// Control case, depth bias parameters in ComboRenderPipeline default to 0 which is finite
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.EnableDepthStencil();
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
// Infinite depth bias clamp is valid
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
depthStencil->depthBiasClamp = INFINITY;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
// NAN depth bias clamp is invalid
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
depthStencil->depthBiasClamp = NAN;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
// Infinite depth bias slope is valid
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
depthStencil->depthBiasSlopeScale = INFINITY;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
// NAN depth bias slope is invalid
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
depthStencil->depthBiasSlopeScale = NAN;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
}
@ -132,21 +107,21 @@ TEST_F(RenderPipelineValidationTest, DepthBiasParameterNotBeNaN) {
TEST_F(RenderPipelineValidationTest, ColorTargetStateRequired) {
{
// This one succeeds because attachment 0 is the color attachment
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.cFragment.targetCount = 1;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
{ // Fail because lack of color target states (and depth/stencil state)
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.cFragment.targetCount = 0;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
}
@ -154,22 +129,22 @@ TEST_F(RenderPipelineValidationTest, ColorTargetStateRequired) {
TEST_F(RenderPipelineValidationTest, NonRenderableFormat) {
{
// Succeeds because RGBA8Unorm is renderable
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
{
// Fails because RG11B10Ufloat is non-renderable
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.cTargets[0].format = wgpu::TextureFormat::RG11B10Ufloat;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
}
@ -183,7 +158,7 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputFormatCompatibility) {
for (size_t i = 0; i < kNumTextureFormatBaseType; ++i) {
for (size_t j = 0; j < kNumTextureFormatBaseType; ++j) {
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cTargets[0].format = kColorFormats[j];
@ -198,9 +173,9 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputFormatCompatibility) {
descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str());
if (i == j) {
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
} else {
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
}
}
@ -209,21 +184,21 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputFormatCompatibility) {
/// Tests that the sample count of the render pipeline must be valid.
TEST_F(RenderPipelineValidationTest, SampleCount) {
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.multisample.count = 4;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.multisample.count = 3;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
}
@ -242,29 +217,29 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
baseTextureDescriptor.dimension = wgpu::TextureDimension::e2D;
baseTextureDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
utils::ComboRenderPipelineDescriptor2 nonMultisampledPipelineDescriptor;
utils::ComboRenderPipelineDescriptor nonMultisampledPipelineDescriptor;
nonMultisampledPipelineDescriptor.multisample.count = 1;
nonMultisampledPipelineDescriptor.vertex.module = vsModule;
nonMultisampledPipelineDescriptor.cFragment.module = fsModule;
wgpu::RenderPipeline nonMultisampledPipeline =
device.CreateRenderPipeline2(&nonMultisampledPipelineDescriptor);
device.CreateRenderPipeline(&nonMultisampledPipelineDescriptor);
nonMultisampledPipelineDescriptor.cFragment.targetCount = 0;
nonMultisampledPipelineDescriptor.EnableDepthStencil();
wgpu::RenderPipeline nonMultisampledPipelineWithDepthStencilOnly =
device.CreateRenderPipeline2(&nonMultisampledPipelineDescriptor);
device.CreateRenderPipeline(&nonMultisampledPipelineDescriptor);
utils::ComboRenderPipelineDescriptor2 multisampledPipelineDescriptor;
utils::ComboRenderPipelineDescriptor multisampledPipelineDescriptor;
multisampledPipelineDescriptor.multisample.count = kMultisampledCount;
multisampledPipelineDescriptor.vertex.module = vsModule;
multisampledPipelineDescriptor.cFragment.module = fsModule;
wgpu::RenderPipeline multisampledPipeline =
device.CreateRenderPipeline2(&multisampledPipelineDescriptor);
device.CreateRenderPipeline(&multisampledPipelineDescriptor);
multisampledPipelineDescriptor.cFragment.targetCount = 0;
multisampledPipelineDescriptor.EnableDepthStencil();
wgpu::RenderPipeline multisampledPipelineWithDepthStencilOnly =
device.CreateRenderPipeline2(&multisampledPipelineDescriptor);
device.CreateRenderPipeline(&multisampledPipelineDescriptor);
// It is not allowed to use multisampled render pass and non-multisampled render pipeline.
{
@ -371,23 +346,23 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
// when the alphaToCoverage mode is enabled.
TEST_F(RenderPipelineValidationTest, AlphaToCoverageAndSampleCount) {
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.multisample.count = 4;
descriptor.multisample.alphaToCoverageEnabled = true;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.multisample.count = 1;
descriptor.multisample.alphaToCoverageEnabled = true;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
}
@ -403,7 +378,7 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
for (size_t i = 0; i < kNumTextureComponentType; ++i) {
for (size_t j = 0; j < kNumTextureComponentType; ++j) {
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
std::ostringstream stream;
@ -421,9 +396,9 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
if (i == j) {
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
} else {
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
}
}
@ -452,7 +427,7 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
for (size_t i = 0; i < kNumTextureViewDimensions; ++i) {
for (size_t j = 0; j < kNumTextureViewDimensions; ++j) {
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
std::ostringstream stream;
@ -470,9 +445,9 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
if (i == j) {
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
} else {
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
}
}
@ -491,11 +466,11 @@ TEST_F(RenderPipelineValidationTest, StorageBufferInVertexShaderNoLayout) {
return vec4<f32>();
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = nullptr;
descriptor.vertex.module = vsModuleWithStorageBuffer;
descriptor.cFragment.module = fsModule;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
// Tests that strip primitive topologies require an index format
@ -516,7 +491,7 @@ TEST_F(RenderPipelineValidationTest, StripIndexFormatRequired) {
for (wgpu::PrimitiveTopology primitiveTopology : kStripTopologyTypes) {
for (wgpu::IndexFormat indexFormat : kIndexFormatTypes) {
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = primitiveTopology;
@ -525,17 +500,17 @@ TEST_F(RenderPipelineValidationTest, StripIndexFormatRequired) {
if (indexFormat == wgpu::IndexFormat::Undefined) {
// Fail because the index format is undefined and the primitive
// topology is a strip type.
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
} else {
// Succeeds because the index format is given.
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
}
}
for (wgpu::PrimitiveTopology primitiveTopology : kListTopologyTypes) {
for (wgpu::IndexFormat indexFormat : kIndexFormatTypes) {
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.primitive.topology = primitiveTopology;
@ -544,9 +519,9 @@ TEST_F(RenderPipelineValidationTest, StripIndexFormatRequired) {
if (indexFormat == wgpu::IndexFormat::Undefined) {
// Succeeds even when the index format is undefined because the
// primitive topology isn't a strip type.
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
} else {
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
}
}
@ -555,39 +530,39 @@ TEST_F(RenderPipelineValidationTest, StripIndexFormatRequired) {
// Test that specifying a clampDepth value results in an error if the feature is not enabled.
TEST_F(RenderPipelineValidationTest, ClampDepthWithoutExtension) {
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
wgpu::PrimitiveDepthClampingState clampingState;
clampingState.clampDepth = true;
descriptor.primitive.nextInChain = &clampingState;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
wgpu::PrimitiveDepthClampingState clampingState;
clampingState.clampDepth = false;
descriptor.primitive.nextInChain = &clampingState;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
}
// Test that depthStencil.depthCompare must not be undefiend.
TEST_F(RenderPipelineValidationTest, DepthCompareUndefinedIsError) {
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
descriptor.EnableDepthStencil(wgpu::TextureFormat::Depth32Float);
// Control case: Always is valid.
descriptor.cDepthStencil.depthCompare = wgpu::CompareFunction::Always;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
// Error case: Undefined is invalid.
descriptor.cDepthStencil.depthCompare = wgpu::CompareFunction::Undefined;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
// Test that the entryPoint names must be present for the correct stage in the shader module.
@ -602,24 +577,24 @@ TEST_F(RenderPipelineValidationTest, EntryPointNameValidation) {
}
)");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = module;
descriptor.vertex.entryPoint = "vertex_main";
descriptor.cFragment.module = module;
descriptor.cFragment.entryPoint = "fragment_main";
// Success case.
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
// Test for the vertex stage entryPoint name.
{
// The entryPoint name doesn't exist in the module.
descriptor.vertex.entryPoint = "main";
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
// The entryPoint name exists, but not for the correct stage.
descriptor.vertex.entryPoint = "fragment_main";
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
descriptor.vertex.entryPoint = "vertex_main";
@ -628,11 +603,11 @@ TEST_F(RenderPipelineValidationTest, EntryPointNameValidation) {
{
// The entryPoint name doesn't exist in the module.
descriptor.cFragment.entryPoint = "main";
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
// The entryPoint name exists, but not for the correct stage.
descriptor.cFragment.entryPoint = "vertex_main";
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
}
@ -649,7 +624,7 @@ TEST_F(RenderPipelineValidationTest, VertexAttribCorrectEntryPoint) {
}
)");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = module;
descriptor.cFragment.module = fsModule;
@ -662,20 +637,20 @@ TEST_F(RenderPipelineValidationTest, VertexAttribCorrectEntryPoint) {
// Success cases, the attribute used by the entryPoint is declared in the pipeline.
descriptor.vertex.entryPoint = "vertex0";
descriptor.cAttributes[0].shaderLocation = 0;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
descriptor.vertex.entryPoint = "vertex1";
descriptor.cAttributes[0].shaderLocation = 1;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
// Error cases, the attribute used by the entryPoint isn't declared in the pipeline.
descriptor.vertex.entryPoint = "vertex1";
descriptor.cAttributes[0].shaderLocation = 0;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
descriptor.vertex.entryPoint = "vertex0";
descriptor.cAttributes[0].shaderLocation = 1;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
// Test that fragment output validation is for the correct entryPoint
@ -689,27 +664,27 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputCorrectEntryPoint) {
}
)");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = module;
// Success case, the component type matches between the pipeline and the entryPoint
descriptor.cFragment.entryPoint = "fragmentFloat";
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA32Float;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
descriptor.cFragment.entryPoint = "fragmentUint";
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA32Uint;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
// Error case, the component type doesn't match between the pipeline and the entryPoint
descriptor.cFragment.entryPoint = "fragmentUint";
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA32Float;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
descriptor.cFragment.entryPoint = "fragmentFloat";
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA32Uint;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
// Test that fragment output validation is for the correct entryPoint
@ -738,27 +713,27 @@ TEST_F(RenderPipelineValidationTest, DISABLED_BindingsFromCorrectEntryPoint) {
device, {{1, wgpu::ShaderStage::Vertex, wgpu::BufferBindingType::Uniform}});
wgpu::PipelineLayout layout1 = utils::MakeBasicPipelineLayout(device, &bgl1);
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = module;
descriptor.cFragment.module = fsModule;
// Success case, the BGL matches the bindings used by the entryPoint
descriptor.vertex.entryPoint = "vertex0";
descriptor.layout = layout0;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
descriptor.vertex.entryPoint = "vertex1";
descriptor.layout = layout1;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
// Error case, the BGL doesn't match the bindings used by the entryPoint
descriptor.vertex.entryPoint = "vertex1";
descriptor.layout = layout0;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
descriptor.vertex.entryPoint = "vertex0";
descriptor.layout = layout1;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
class DepthClampingValidationTest : public RenderPipelineValidationTest {
@ -773,21 +748,21 @@ class DepthClampingValidationTest : public RenderPipelineValidationTest {
// Tests that specifying a clampDepth value succeeds if the extension is enabled.
TEST_F(DepthClampingValidationTest, Success) {
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
wgpu::PrimitiveDepthClampingState clampingState;
clampingState.clampDepth = true;
descriptor.primitive.nextInChain = &clampingState;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
{
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = fsModule;
wgpu::PrimitiveDepthClampingState clampingState;
clampingState.clampDepth = false;
descriptor.primitive.nextInChain = &clampingState;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
}

View File

@ -54,11 +54,11 @@ namespace {
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = fsModule;
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, nullptr);
return device.CreateRenderPipeline2(&pipelineDescriptor);
return device.CreateRenderPipeline(&pipelineDescriptor);
}
wgpu::ComputePipeline CreateNoOpComputePipeline(std::vector<wgpu::BindGroupLayout> bgls) {
@ -765,11 +765,11 @@ namespace {
[[group(0), binding(0)]] var<storage> rBuffer : [[access(read)]] RBuffer;
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = fsModule;
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl0);
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&pipelineDescriptor);
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&pipelineDescriptor);
// Resource in bg1 conflicts with resources used in bg0. However, bindings in bg1 is
// not used in pipeline. But we still track this binding.
@ -1511,11 +1511,11 @@ namespace {
[[group(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d<rgba8unorm>;
[[stage(fragment)]] fn main() {
})");
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
pipelineDescriptor.vertex.module = vsModule;
pipelineDescriptor.cFragment.module = fsModule;
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &readBGL);
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&pipelineDescriptor);
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&pipelineDescriptor);
// Texture binding in readBG conflicts with texture binding in writeBG. The binding
// in writeBG is not used in pipeline. But we still track this binding.

View File

@ -127,11 +127,11 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
return textureLoad(image0, vec2<i32>(i32(VertexIndex), 0));
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = nullptr;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = mDefaultFSModule;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
// Read-only storage textures can be declared in a fragment shader.
@ -144,11 +144,11 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
return textureLoad(image0, vec2<i32>(FragCoord.xy));
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = nullptr;
descriptor.vertex.module = mDefaultVSModule;
descriptor.cFragment.module = fsModule;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
// Write-only storage textures cannot be declared in a vertex shader.
@ -159,11 +159,11 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
textureStore(image0, vec2<i32>(i32(vertex_index), 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = nullptr;
descriptor.vertex.module = vsModule;
descriptor.cFragment.module = mDefaultFSModule;
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
}
// Write-only storage textures can be declared in a fragment shader.
@ -174,11 +174,11 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
textureStore(image0, vec2<i32>(position.xy), vec4<f32>(1.0, 0.0, 0.0, 1.0));
})");
utils::ComboRenderPipelineDescriptor2 descriptor;
utils::ComboRenderPipelineDescriptor descriptor;
descriptor.layout = nullptr;
descriptor.vertex.module = mDefaultVSModule;
descriptor.cFragment.module = fsModule;
device.CreateRenderPipeline2(&descriptor);
device.CreateRenderPipeline(&descriptor);
}
}

View File

@ -64,14 +64,14 @@ TEST_F(UnsafeAPIValidationTest, DrawIndexedIndirectDisallowed) {
bundleDesc.colorFormatsCount = 1;
bundleDesc.cColorFormats[0] = renderPass.attachmentFormat;
utils::ComboRenderPipelineDescriptor2 desc;
utils::ComboRenderPipelineDescriptor desc;
desc.vertex.module = utils::CreateShaderModule(
device,
R"([[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
return vec4<f32>();
})");
desc.cFragment.module = utils::CreateShaderModule(device, "[[stage(fragment)]] fn main() {}");
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
// Control cases: DrawIndirect and DrawIndexed are allowed inside a render pass.
{

Some files were not shown because too many files have changed in this diff Show More