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:
parent
4589de61a0
commit
41c87d973a
72
dawn.json
72
dawn.json
|
@ -256,16 +256,6 @@
|
||||||
{"value": 4, "name": "max"}
|
{"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": {
|
"bool": {
|
||||||
"category": "native"
|
"category": "native"
|
||||||
},
|
},
|
||||||
|
@ -755,7 +745,7 @@
|
||||||
"name": "create render pipeline async",
|
"name": "create render pipeline async",
|
||||||
"returns": "void",
|
"returns": "void",
|
||||||
"args": [
|
"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": "callback", "type": "create render pipeline async callback"},
|
||||||
{"name": "userdata", "type": "void", "annotation": "*"}
|
{"name": "userdata", "type": "void", "annotation": "*"}
|
||||||
]
|
]
|
||||||
|
@ -778,7 +768,7 @@
|
||||||
"name": "create render pipeline 2",
|
"name": "create render pipeline 2",
|
||||||
"returns": "render pipeline",
|
"returns": "render pipeline",
|
||||||
"args": [
|
"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"}
|
{"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": {
|
"double": {
|
||||||
"category": "native"
|
"category": "native"
|
||||||
},
|
},
|
||||||
|
@ -1038,15 +1015,6 @@
|
||||||
"category": "typedef",
|
"category": "typedef",
|
||||||
"type": "vertex buffer layout"
|
"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": {
|
"input step mode": {
|
||||||
"category": "enum",
|
"category": "enum",
|
||||||
"values": [
|
"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": {
|
"render bundle": {
|
||||||
"category": "object"
|
"category": "object"
|
||||||
},
|
},
|
||||||
|
@ -1655,26 +1611,6 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
"render pipeline descriptor": {
|
"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",
|
"category": "structure",
|
||||||
"extensible": true,
|
"extensible": true,
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -1687,6 +1623,10 @@
|
||||||
{"name": "fragment", "type": "fragment state", "annotation": "const*", "optional": true}
|
{"name": "fragment", "type": "fragment state", "annotation": "const*", "optional": true}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"render pipeline descriptor 2": {
|
||||||
|
"category": "typedef",
|
||||||
|
"type": "render pipeline descriptor"
|
||||||
|
},
|
||||||
|
|
||||||
"sampler": {
|
"sampler": {
|
||||||
"category": "object"
|
"category": "object"
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
{ "name": "device id", "type": "ObjectId" },
|
{ "name": "device id", "type": "ObjectId" },
|
||||||
{ "name": "request serial", "type": "uint64_t" },
|
{ "name": "request serial", "type": "uint64_t" },
|
||||||
{ "name": "pipeline object handle", "type": "ObjectHandle", "handle_type": "render pipeline"},
|
{ "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": [
|
"device pop error scope": [
|
||||||
{ "name": "device id", "type": "ObjectId" },
|
{ "name": "device id", "type": "ObjectId" },
|
||||||
|
|
|
@ -119,13 +119,13 @@ void init() {
|
||||||
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||||
device, {{0, wgpu::ShaderStage::Vertex, wgpu::BufferBindingType::Uniform, true}});
|
device, {{0, wgpu::ShaderStage::Vertex, wgpu::BufferBindingType::Uniform, true}});
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.cTargets[0].format = GetPreferredSwapChainTextureFormat();
|
descriptor.cTargets[0].format = GetPreferredSwapChainTextureFormat();
|
||||||
|
|
||||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
shaderData.resize(kNumTriangles);
|
shaderData.resize(kNumTriangles);
|
||||||
for (auto& data : shaderData) {
|
for (auto& data : shaderData) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ void init() {
|
||||||
WGPUShaderModule fsModule = utils::CreateShaderModule(device, fs).Release();
|
WGPUShaderModule fsModule = utils::CreateShaderModule(device, fs).Release();
|
||||||
|
|
||||||
{
|
{
|
||||||
WGPURenderPipelineDescriptor2 descriptor = {};
|
WGPURenderPipelineDescriptor descriptor = {};
|
||||||
|
|
||||||
// Fragment state
|
// Fragment state
|
||||||
WGPUBlendState blend = {};
|
WGPUBlendState blend = {};
|
||||||
|
@ -97,7 +97,7 @@ void init() {
|
||||||
descriptor.primitive.topology = WGPUPrimitiveTopology_TriangleList;
|
descriptor.primitive.topology = WGPUPrimitiveTopology_TriangleList;
|
||||||
descriptor.primitive.stripIndexFormat = WGPUIndexFormat_Undefined;
|
descriptor.primitive.stripIndexFormat = WGPUIndexFormat_Undefined;
|
||||||
|
|
||||||
pipeline = wgpuDeviceCreateRenderPipeline2(device, &descriptor);
|
pipeline = wgpuDeviceCreateRenderPipeline(device, &descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpuShaderModuleRelease(vsModule);
|
wgpuShaderModuleRelease(vsModule);
|
||||||
|
|
|
@ -121,7 +121,7 @@ void initRender() {
|
||||||
|
|
||||||
depthStencilView = CreateDefaultDepthStencilView(device);
|
depthStencilView = CreateDefaultDepthStencilView(device);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
|
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.vertex.bufferCount = 2;
|
descriptor.vertex.bufferCount = 2;
|
||||||
|
@ -143,7 +143,7 @@ void initRender() {
|
||||||
descriptor.EnableDepthStencil(wgpu::TextureFormat::Depth24PlusStencil8);
|
descriptor.EnableDepthStencil(wgpu::TextureFormat::Depth24PlusStencil8);
|
||||||
descriptor.cTargets[0].format = GetPreferredSwapChainTextureFormat();
|
descriptor.cTargets[0].format = GetPreferredSwapChainTextureFormat();
|
||||||
|
|
||||||
renderPipeline = device.CreateRenderPipeline2(&descriptor);
|
renderPipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSim() {
|
void initSim() {
|
||||||
|
|
|
@ -120,7 +120,7 @@ void init() {
|
||||||
|
|
||||||
depthStencilView = CreateDefaultDepthStencilView(device);
|
depthStencilView = CreateDefaultDepthStencilView(device);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.vertex.bufferCount = 1;
|
descriptor.vertex.bufferCount = 1;
|
||||||
|
@ -131,7 +131,7 @@ void init() {
|
||||||
descriptor.cTargets[0].format = GetPreferredSwapChainTextureFormat();
|
descriptor.cTargets[0].format = GetPreferredSwapChainTextureFormat();
|
||||||
descriptor.EnableDepthStencil(wgpu::TextureFormat::Depth24PlusStencil8);
|
descriptor.EnableDepthStencil(wgpu::TextureFormat::Depth24PlusStencil8);
|
||||||
|
|
||||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
wgpu::TextureView view = texture.CreateView();
|
wgpu::TextureView view = texture.CreateView();
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ void init() {
|
||||||
depthStencilView = CreateDefaultDepthStencilView(device);
|
depthStencilView = CreateDefaultDepthStencilView(device);
|
||||||
|
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.vertex.bufferCount = 1;
|
descriptor.vertex.bufferCount = 1;
|
||||||
descriptor.vertex.buffers = &vertexBufferLayout;
|
descriptor.vertex.buffers = &vertexBufferLayout;
|
||||||
|
@ -198,11 +198,11 @@ void init() {
|
||||||
depthStencil->depthWriteEnabled = true;
|
depthStencil->depthWriteEnabled = true;
|
||||||
depthStencil->depthCompare = wgpu::CompareFunction::Less;
|
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.module = vsModule;
|
||||||
descriptor.vertex.bufferCount = 1;
|
descriptor.vertex.bufferCount = 1;
|
||||||
descriptor.vertex.buffers = &vertexBufferLayout;
|
descriptor.vertex.buffers = &vertexBufferLayout;
|
||||||
|
@ -217,11 +217,11 @@ void init() {
|
||||||
depthStencil->stencilBack.passOp = wgpu::StencilOperation::Replace;
|
depthStencil->stencilBack.passOp = wgpu::StencilOperation::Replace;
|
||||||
depthStencil->depthCompare = wgpu::CompareFunction::Less;
|
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.module = vsModule;
|
||||||
descriptor.vertex.bufferCount = 1;
|
descriptor.vertex.bufferCount = 1;
|
||||||
descriptor.vertex.buffers = &vertexBufferLayout;
|
descriptor.vertex.buffers = &vertexBufferLayout;
|
||||||
|
@ -239,7 +239,7 @@ void init() {
|
||||||
depthStencil->depthWriteEnabled = true;
|
depthStencil->depthWriteEnabled = true;
|
||||||
depthStencil->depthCompare = wgpu::CompareFunction::Less;
|
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);
|
cameraData.proj = glm::perspective(glm::radians(45.0f), 1.f, 1.0f, 100.0f);
|
||||||
|
|
|
@ -311,7 +311,7 @@ int main(int argc, const char* argv[]) {
|
||||||
queue = device.GetQueue();
|
queue = device.GetQueue();
|
||||||
|
|
||||||
// The hacky pipeline to render a triangle.
|
// The hacky pipeline to render a triangle.
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
utils::ComboRenderPipelineDescriptor pipelineDesc;
|
||||||
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
|
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
|
||||||
let pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
let pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
||||||
vec2<f32>( 0.0, 0.5),
|
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].
|
// BGRA shouldn't be hardcoded. Consider having a map[format -> pipeline].
|
||||||
pipelineDesc.cTargets[0].format = wgpu::TextureFormat::BGRA8Unorm;
|
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.
|
// Craete the first window, since the example exits when there are no windows.
|
||||||
AddWindow();
|
AddWindow();
|
||||||
|
|
|
@ -34,19 +34,6 @@ namespace dawn_native {
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachmentStateBlueprint::AttachmentStateBlueprint(const RenderPipelineDescriptor* descriptor)
|
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) {
|
: mSampleCount(descriptor->multisample.count) {
|
||||||
ASSERT(descriptor->fragment->targetCount <= kMaxColorAttachments);
|
ASSERT(descriptor->fragment->targetCount <= kMaxColorAttachments);
|
||||||
for (ColorAttachmentIndex i(uint8_t(0));
|
for (ColorAttachmentIndex i(uint8_t(0));
|
||||||
|
|
|
@ -38,7 +38,6 @@ namespace dawn_native {
|
||||||
// Note: Descriptors must be validated before the AttachmentState is constructed.
|
// Note: Descriptors must be validated before the AttachmentState is constructed.
|
||||||
explicit AttachmentStateBlueprint(const RenderBundleEncoderDescriptor* descriptor);
|
explicit AttachmentStateBlueprint(const RenderBundleEncoderDescriptor* descriptor);
|
||||||
explicit AttachmentStateBlueprint(const RenderPipelineDescriptor* descriptor);
|
explicit AttachmentStateBlueprint(const RenderPipelineDescriptor* descriptor);
|
||||||
explicit AttachmentStateBlueprint(const RenderPipelineDescriptor2* descriptor);
|
|
||||||
explicit AttachmentStateBlueprint(const RenderPassDescriptor* descriptor);
|
explicit AttachmentStateBlueprint(const RenderPassDescriptor* descriptor);
|
||||||
|
|
||||||
AttachmentStateBlueprint(const AttachmentStateBlueprint& rhs);
|
AttachmentStateBlueprint(const AttachmentStateBlueprint& rhs);
|
||||||
|
|
|
@ -221,7 +221,7 @@ namespace dawn_native {
|
||||||
target.format = dstFormat;
|
target.format = dstFormat;
|
||||||
|
|
||||||
// Create RenderPipeline.
|
// Create RenderPipeline.
|
||||||
RenderPipelineDescriptor2 renderPipelineDesc = {};
|
RenderPipelineDescriptor renderPipelineDesc = {};
|
||||||
|
|
||||||
// Generate the layout based on shader modules.
|
// Generate the layout based on shader modules.
|
||||||
renderPipelineDesc.layout = nullptr;
|
renderPipelineDesc.layout = nullptr;
|
||||||
|
|
|
@ -551,7 +551,7 @@ namespace dawn_native {
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultOrError<Ref<RenderPipelineBase>> DeviceBase::GetOrCreateRenderPipeline(
|
ResultOrError<Ref<RenderPipelineBase>> DeviceBase::GetOrCreateRenderPipeline(
|
||||||
const RenderPipelineDescriptor2* descriptor) {
|
const RenderPipelineDescriptor* descriptor) {
|
||||||
RenderPipelineBase blueprint(this, descriptor);
|
RenderPipelineBase blueprint(this, descriptor);
|
||||||
|
|
||||||
const size_t blueprintHash = blueprint.ComputeContentHash();
|
const size_t blueprintHash = blueprint.ComputeContentHash();
|
||||||
|
@ -668,12 +668,6 @@ namespace dawn_native {
|
||||||
return GetOrCreateAttachmentState(&blueprint);
|
return GetOrCreateAttachmentState(&blueprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<AttachmentState> DeviceBase::GetOrCreateAttachmentState(
|
|
||||||
const RenderPipelineDescriptor2* descriptor) {
|
|
||||||
AttachmentStateBlueprint blueprint(descriptor);
|
|
||||||
return GetOrCreateAttachmentState(&blueprint);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ref<AttachmentState> DeviceBase::GetOrCreateAttachmentState(
|
Ref<AttachmentState> DeviceBase::GetOrCreateAttachmentState(
|
||||||
const RenderPassDescriptor* descriptor) {
|
const RenderPassDescriptor* descriptor) {
|
||||||
AttachmentStateBlueprint blueprint(descriptor);
|
AttachmentStateBlueprint blueprint(descriptor);
|
||||||
|
@ -759,7 +753,7 @@ namespace dawn_native {
|
||||||
}
|
}
|
||||||
return result.Detach();
|
return result.Detach();
|
||||||
}
|
}
|
||||||
void DeviceBase::APICreateRenderPipelineAsync(const RenderPipelineDescriptor2* descriptor,
|
void DeviceBase::APICreateRenderPipelineAsync(const RenderPipelineDescriptor* descriptor,
|
||||||
WGPUCreateRenderPipelineAsyncCallback callback,
|
WGPUCreateRenderPipelineAsyncCallback callback,
|
||||||
void* userdata) {
|
void* userdata) {
|
||||||
ResultOrError<Ref<RenderPipelineBase>> maybeResult =
|
ResultOrError<Ref<RenderPipelineBase>> maybeResult =
|
||||||
|
@ -787,112 +781,19 @@ namespace dawn_native {
|
||||||
}
|
}
|
||||||
RenderPipelineBase* DeviceBase::APICreateRenderPipeline(
|
RenderPipelineBase* DeviceBase::APICreateRenderPipeline(
|
||||||
const RenderPipelineDescriptor* descriptor) {
|
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;
|
Ref<RenderPipelineBase> result;
|
||||||
if (ConsumedError(CreateRenderPipeline(descriptor), &result)) {
|
if (ConsumedError(CreateRenderPipeline(descriptor), &result)) {
|
||||||
return RenderPipelineBase::MakeError(this);
|
return RenderPipelineBase::MakeError(this);
|
||||||
}
|
}
|
||||||
return result.Detach();
|
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) {
|
ShaderModuleBase* DeviceBase::APICreateShaderModule(const ShaderModuleDescriptor* descriptor) {
|
||||||
Ref<ShaderModuleBase> result;
|
Ref<ShaderModuleBase> result;
|
||||||
ShaderModuleParseResult parseResult = {};
|
ShaderModuleParseResult parseResult = {};
|
||||||
|
@ -1212,14 +1113,14 @@ namespace dawn_native {
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultOrError<Ref<RenderPipelineBase>> DeviceBase::CreateRenderPipeline(
|
ResultOrError<Ref<RenderPipelineBase>> DeviceBase::CreateRenderPipeline(
|
||||||
const RenderPipelineDescriptor2* descriptor) {
|
const RenderPipelineDescriptor* descriptor) {
|
||||||
DAWN_TRY(ValidateIsAlive());
|
DAWN_TRY(ValidateIsAlive());
|
||||||
if (IsValidationEnabled()) {
|
if (IsValidationEnabled()) {
|
||||||
DAWN_TRY(ValidateRenderPipelineDescriptor(this, descriptor));
|
DAWN_TRY(ValidateRenderPipelineDescriptor(this, descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor->layout == nullptr) {
|
if (descriptor->layout == nullptr) {
|
||||||
RenderPipelineDescriptor2 descriptorWithDefaultLayout = *descriptor;
|
RenderPipelineDescriptor descriptorWithDefaultLayout = *descriptor;
|
||||||
|
|
||||||
// Ref will keep the pipeline layout alive until the end of the function where
|
// Ref will keep the pipeline layout alive until the end of the function where
|
||||||
// the pipeline will take another reference.
|
// the pipeline will take another reference.
|
||||||
|
|
|
@ -120,7 +120,7 @@ namespace dawn_native {
|
||||||
void UncachePipelineLayout(PipelineLayoutBase* obj);
|
void UncachePipelineLayout(PipelineLayoutBase* obj);
|
||||||
|
|
||||||
ResultOrError<Ref<RenderPipelineBase>> GetOrCreateRenderPipeline(
|
ResultOrError<Ref<RenderPipelineBase>> GetOrCreateRenderPipeline(
|
||||||
const RenderPipelineDescriptor2* descriptor);
|
const RenderPipelineDescriptor* descriptor);
|
||||||
void UncacheRenderPipeline(RenderPipelineBase* obj);
|
void UncacheRenderPipeline(RenderPipelineBase* obj);
|
||||||
|
|
||||||
ResultOrError<Ref<SamplerBase>> GetOrCreateSampler(const SamplerDescriptor* descriptor);
|
ResultOrError<Ref<SamplerBase>> GetOrCreateSampler(const SamplerDescriptor* descriptor);
|
||||||
|
@ -135,8 +135,6 @@ namespace dawn_native {
|
||||||
Ref<AttachmentState> GetOrCreateAttachmentState(
|
Ref<AttachmentState> GetOrCreateAttachmentState(
|
||||||
const RenderBundleEncoderDescriptor* descriptor);
|
const RenderBundleEncoderDescriptor* descriptor);
|
||||||
Ref<AttachmentState> GetOrCreateAttachmentState(const RenderPipelineDescriptor* descriptor);
|
Ref<AttachmentState> GetOrCreateAttachmentState(const RenderPipelineDescriptor* descriptor);
|
||||||
Ref<AttachmentState> GetOrCreateAttachmentState(
|
|
||||||
const RenderPipelineDescriptor2* descriptor);
|
|
||||||
Ref<AttachmentState> GetOrCreateAttachmentState(const RenderPassDescriptor* descriptor);
|
Ref<AttachmentState> GetOrCreateAttachmentState(const RenderPassDescriptor* descriptor);
|
||||||
void UncacheAttachmentState(AttachmentState* obj);
|
void UncacheAttachmentState(AttachmentState* obj);
|
||||||
|
|
||||||
|
@ -159,7 +157,7 @@ namespace dawn_native {
|
||||||
ResultOrError<Ref<RenderBundleEncoder>> CreateRenderBundleEncoder(
|
ResultOrError<Ref<RenderBundleEncoder>> CreateRenderBundleEncoder(
|
||||||
const RenderBundleEncoderDescriptor* descriptor);
|
const RenderBundleEncoderDescriptor* descriptor);
|
||||||
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipeline(
|
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipeline(
|
||||||
const RenderPipelineDescriptor2* descriptor);
|
const RenderPipelineDescriptor* descriptor);
|
||||||
ResultOrError<Ref<SamplerBase>> CreateSampler(const SamplerDescriptor* descriptor);
|
ResultOrError<Ref<SamplerBase>> CreateSampler(const SamplerDescriptor* descriptor);
|
||||||
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModule(
|
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModule(
|
||||||
const ShaderModuleDescriptor* descriptor,
|
const ShaderModuleDescriptor* descriptor,
|
||||||
|
@ -182,13 +180,13 @@ namespace dawn_native {
|
||||||
void APICreateComputePipelineAsync(const ComputePipelineDescriptor* descriptor,
|
void APICreateComputePipelineAsync(const ComputePipelineDescriptor* descriptor,
|
||||||
WGPUCreateComputePipelineAsyncCallback callback,
|
WGPUCreateComputePipelineAsyncCallback callback,
|
||||||
void* userdata);
|
void* userdata);
|
||||||
void APICreateRenderPipelineAsync(const RenderPipelineDescriptor2* descriptor,
|
void APICreateRenderPipelineAsync(const RenderPipelineDescriptor* descriptor,
|
||||||
WGPUCreateRenderPipelineAsyncCallback callback,
|
WGPUCreateRenderPipelineAsyncCallback callback,
|
||||||
void* userdata);
|
void* userdata);
|
||||||
RenderBundleEncoder* APICreateRenderBundleEncoder(
|
RenderBundleEncoder* APICreateRenderBundleEncoder(
|
||||||
const RenderBundleEncoderDescriptor* descriptor);
|
const RenderBundleEncoderDescriptor* descriptor);
|
||||||
RenderPipelineBase* APICreateRenderPipeline(const RenderPipelineDescriptor* descriptor);
|
RenderPipelineBase* APICreateRenderPipeline(const RenderPipelineDescriptor* descriptor);
|
||||||
RenderPipelineBase* APICreateRenderPipeline2(const RenderPipelineDescriptor2* descriptor);
|
RenderPipelineBase* APICreateRenderPipeline2(const RenderPipelineDescriptor* descriptor);
|
||||||
ExternalTextureBase* APICreateExternalTexture(const ExternalTextureDescriptor* descriptor);
|
ExternalTextureBase* APICreateExternalTexture(const ExternalTextureDescriptor* descriptor);
|
||||||
SamplerBase* APICreateSampler(const SamplerDescriptor* descriptor);
|
SamplerBase* APICreateSampler(const SamplerDescriptor* descriptor);
|
||||||
ShaderModuleBase* APICreateShaderModule(const ShaderModuleDescriptor* descriptor);
|
ShaderModuleBase* APICreateShaderModule(const ShaderModuleDescriptor* descriptor);
|
||||||
|
@ -304,7 +302,7 @@ namespace dawn_native {
|
||||||
virtual ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
|
virtual ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
|
||||||
const QuerySetDescriptor* descriptor) = 0;
|
const QuerySetDescriptor* descriptor) = 0;
|
||||||
virtual ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
|
virtual ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
|
||||||
const RenderPipelineDescriptor2* descriptor) = 0;
|
const RenderPipelineDescriptor* descriptor) = 0;
|
||||||
virtual ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
|
virtual ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
|
||||||
const SamplerDescriptor* descriptor) = 0;
|
const SamplerDescriptor* descriptor) = 0;
|
||||||
virtual ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(
|
virtual ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(
|
||||||
|
|
|
@ -316,7 +316,7 @@ namespace dawn_native {
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError ValidateRenderPipelineDescriptor(DeviceBase* device,
|
MaybeError ValidateRenderPipelineDescriptor(DeviceBase* device,
|
||||||
const RenderPipelineDescriptor2* descriptor) {
|
const RenderPipelineDescriptor* descriptor) {
|
||||||
if (descriptor->nextInChain != nullptr) {
|
if (descriptor->nextInChain != nullptr) {
|
||||||
return DAWN_VALIDATION_ERROR("nextInChain must be nullptr");
|
return DAWN_VALIDATION_ERROR("nextInChain must be nullptr");
|
||||||
}
|
}
|
||||||
|
@ -350,7 +350,7 @@ namespace dawn_native {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<StageAndDescriptor> GetStages(const RenderPipelineDescriptor2* descriptor) {
|
std::vector<StageAndDescriptor> GetStages(const RenderPipelineDescriptor* descriptor) {
|
||||||
std::vector<StageAndDescriptor> stages;
|
std::vector<StageAndDescriptor> stages;
|
||||||
stages.push_back(
|
stages.push_back(
|
||||||
{SingleShaderStage::Vertex, descriptor->vertex.module, descriptor->vertex.entryPoint});
|
{SingleShaderStage::Vertex, descriptor->vertex.module, descriptor->vertex.entryPoint});
|
||||||
|
@ -372,19 +372,10 @@ namespace dawn_native {
|
||||||
mDepthStencil->stencilFront.passOp != wgpu::StencilOperation::Keep;
|
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::RenderPipelineBase(DeviceBase* device,
|
RenderPipelineBase::RenderPipelineBase(DeviceBase* device,
|
||||||
const RenderPipelineDescriptor2* descriptor)
|
const RenderPipelineDescriptor* descriptor)
|
||||||
: PipelineBase(device,
|
: PipelineBase(device,
|
||||||
descriptor->layout,
|
descriptor->layout,
|
||||||
{{SingleShaderStage::Vertex, descriptor->vertex.module,
|
{{SingleShaderStage::Vertex, descriptor->vertex.module,
|
||||||
|
|
|
@ -30,9 +30,9 @@ namespace dawn_native {
|
||||||
class DeviceBase;
|
class DeviceBase;
|
||||||
|
|
||||||
MaybeError ValidateRenderPipelineDescriptor(DeviceBase* device,
|
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);
|
size_t IndexFormatSize(wgpu::IndexFormat format);
|
||||||
|
|
||||||
|
@ -40,8 +40,6 @@ namespace dawn_native {
|
||||||
|
|
||||||
bool StencilTestEnabled(const DepthStencilState* mDepthStencil);
|
bool StencilTestEnabled(const DepthStencilState* mDepthStencil);
|
||||||
|
|
||||||
bool BlendEnabled(const ColorStateDescriptor* mColorState);
|
|
||||||
|
|
||||||
struct VertexAttributeInfo {
|
struct VertexAttributeInfo {
|
||||||
wgpu::VertexFormat format;
|
wgpu::VertexFormat format;
|
||||||
uint64_t offset;
|
uint64_t offset;
|
||||||
|
@ -56,7 +54,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
class RenderPipelineBase : public PipelineBase {
|
class RenderPipelineBase : public PipelineBase {
|
||||||
public:
|
public:
|
||||||
RenderPipelineBase(DeviceBase* device, const RenderPipelineDescriptor2* descriptor);
|
RenderPipelineBase(DeviceBase* device, const RenderPipelineDescriptor* descriptor);
|
||||||
~RenderPipelineBase() override;
|
~RenderPipelineBase() override;
|
||||||
|
|
||||||
static RenderPipelineBase* MakeError(DeviceBase* device);
|
static RenderPipelineBase* MakeError(DeviceBase* device);
|
||||||
|
|
|
@ -334,7 +334,7 @@ namespace dawn_native { namespace d3d12 {
|
||||||
return QuerySet::Create(this, descriptor);
|
return QuerySet::Create(this, descriptor);
|
||||||
}
|
}
|
||||||
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
|
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
|
||||||
const RenderPipelineDescriptor2* descriptor) {
|
const RenderPipelineDescriptor* descriptor) {
|
||||||
return RenderPipeline::Create(this, descriptor);
|
return RenderPipeline::Create(this, descriptor);
|
||||||
}
|
}
|
||||||
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
||||||
|
|
|
@ -154,7 +154,7 @@ namespace dawn_native { namespace d3d12 {
|
||||||
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
|
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
|
||||||
const QuerySetDescriptor* descriptor) override;
|
const QuerySetDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
|
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
|
||||||
const RenderPipelineDescriptor2* descriptor) override;
|
const RenderPipelineDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
|
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
|
||||||
const SamplerDescriptor* descriptor) override;
|
const SamplerDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(
|
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(
|
||||||
|
|
|
@ -326,13 +326,13 @@ namespace dawn_native { namespace d3d12 {
|
||||||
|
|
||||||
ResultOrError<Ref<RenderPipeline>> RenderPipeline::Create(
|
ResultOrError<Ref<RenderPipeline>> RenderPipeline::Create(
|
||||||
Device* device,
|
Device* device,
|
||||||
const RenderPipelineDescriptor2* descriptor) {
|
const RenderPipelineDescriptor* descriptor) {
|
||||||
Ref<RenderPipeline> pipeline = AcquireRef(new RenderPipeline(device, descriptor));
|
Ref<RenderPipeline> pipeline = AcquireRef(new RenderPipeline(device, descriptor));
|
||||||
DAWN_TRY(pipeline->Initialize(descriptor));
|
DAWN_TRY(pipeline->Initialize(descriptor));
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError RenderPipeline::Initialize(const RenderPipelineDescriptor2* descriptor) {
|
MaybeError RenderPipeline::Initialize(const RenderPipelineDescriptor* descriptor) {
|
||||||
Device* device = ToBackend(GetDevice());
|
Device* device = ToBackend(GetDevice());
|
||||||
uint32_t compileFlags = 0;
|
uint32_t compileFlags = 0;
|
||||||
#if defined(_DEBUG)
|
#if defined(_DEBUG)
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace dawn_native { namespace d3d12 {
|
||||||
public:
|
public:
|
||||||
static ResultOrError<Ref<RenderPipeline>> Create(
|
static ResultOrError<Ref<RenderPipeline>> Create(
|
||||||
Device* device,
|
Device* device,
|
||||||
const RenderPipelineDescriptor2* descriptor);
|
const RenderPipelineDescriptor* descriptor);
|
||||||
RenderPipeline() = delete;
|
RenderPipeline() = delete;
|
||||||
|
|
||||||
D3D12_PRIMITIVE_TOPOLOGY GetD3D12PrimitiveTopology() const;
|
D3D12_PRIMITIVE_TOPOLOGY GetD3D12PrimitiveTopology() const;
|
||||||
|
@ -39,7 +39,7 @@ namespace dawn_native { namespace d3d12 {
|
||||||
private:
|
private:
|
||||||
~RenderPipeline() override;
|
~RenderPipeline() override;
|
||||||
using RenderPipelineBase::RenderPipelineBase;
|
using RenderPipelineBase::RenderPipelineBase;
|
||||||
MaybeError Initialize(const RenderPipelineDescriptor2* descriptor);
|
MaybeError Initialize(const RenderPipelineDescriptor* descriptor);
|
||||||
D3D12_INPUT_LAYOUT_DESC ComputeInputLayout(
|
D3D12_INPUT_LAYOUT_DESC ComputeInputLayout(
|
||||||
std::array<D3D12_INPUT_ELEMENT_DESC, kMaxVertexAttributes>* inputElementDescriptors);
|
std::array<D3D12_INPUT_ELEMENT_DESC, kMaxVertexAttributes>* inputElementDescriptors);
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ namespace dawn_native { namespace metal {
|
||||||
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
|
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
|
||||||
const QuerySetDescriptor* descriptor) override;
|
const QuerySetDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
|
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
|
||||||
const RenderPipelineDescriptor2* descriptor) override;
|
const RenderPipelineDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
|
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
|
||||||
const SamplerDescriptor* descriptor) override;
|
const SamplerDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(
|
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(
|
||||||
|
|
|
@ -146,7 +146,7 @@ namespace dawn_native { namespace metal {
|
||||||
return QuerySet::Create(this, descriptor);
|
return QuerySet::Create(this, descriptor);
|
||||||
}
|
}
|
||||||
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
|
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
|
||||||
const RenderPipelineDescriptor2* descriptor) {
|
const RenderPipelineDescriptor* descriptor) {
|
||||||
return RenderPipeline::Create(this, descriptor);
|
return RenderPipeline::Create(this, descriptor);
|
||||||
}
|
}
|
||||||
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace dawn_native { namespace metal {
|
||||||
public:
|
public:
|
||||||
static ResultOrError<Ref<RenderPipeline>> Create(
|
static ResultOrError<Ref<RenderPipeline>> Create(
|
||||||
Device* device,
|
Device* device,
|
||||||
const RenderPipelineDescriptor2* descriptor);
|
const RenderPipelineDescriptor* descriptor);
|
||||||
|
|
||||||
MTLPrimitiveType GetMTLPrimitiveTopology() const;
|
MTLPrimitiveType GetMTLPrimitiveTopology() const;
|
||||||
MTLWinding GetMTLFrontFace() const;
|
MTLWinding GetMTLFrontFace() const;
|
||||||
|
@ -47,7 +47,7 @@ namespace dawn_native { namespace metal {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using RenderPipelineBase::RenderPipelineBase;
|
using RenderPipelineBase::RenderPipelineBase;
|
||||||
MaybeError Initialize(const RenderPipelineDescriptor2* descriptor);
|
MaybeError Initialize(const RenderPipelineDescriptor* descriptor);
|
||||||
|
|
||||||
MTLVertexDescriptor* MakeVertexDesc();
|
MTLVertexDescriptor* MakeVertexDesc();
|
||||||
|
|
||||||
|
|
|
@ -321,13 +321,13 @@ namespace dawn_native { namespace metal {
|
||||||
// static
|
// static
|
||||||
ResultOrError<Ref<RenderPipeline>> RenderPipeline::Create(
|
ResultOrError<Ref<RenderPipeline>> RenderPipeline::Create(
|
||||||
Device* device,
|
Device* device,
|
||||||
const RenderPipelineDescriptor2* descriptor) {
|
const RenderPipelineDescriptor* descriptor) {
|
||||||
Ref<RenderPipeline> pipeline = AcquireRef(new RenderPipeline(device, descriptor));
|
Ref<RenderPipeline> pipeline = AcquireRef(new RenderPipeline(device, descriptor));
|
||||||
DAWN_TRY(pipeline->Initialize(descriptor));
|
DAWN_TRY(pipeline->Initialize(descriptor));
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError RenderPipeline::Initialize(const RenderPipelineDescriptor2* descriptor) {
|
MaybeError RenderPipeline::Initialize(const RenderPipelineDescriptor* descriptor) {
|
||||||
mMtlPrimitiveTopology = MTLPrimitiveTopology(GetPrimitiveTopology());
|
mMtlPrimitiveTopology = MTLPrimitiveTopology(GetPrimitiveTopology());
|
||||||
mMtlFrontFace = MTLFrontFace(GetFrontFace());
|
mMtlFrontFace = MTLFrontFace(GetFrontFace());
|
||||||
mMtlCullMode = ToMTLCullMode(GetCullMode());
|
mMtlCullMode = ToMTLCullMode(GetCullMode());
|
||||||
|
|
|
@ -122,7 +122,7 @@ namespace dawn_native { namespace null {
|
||||||
return AcquireRef(new QuerySet(this, descriptor));
|
return AcquireRef(new QuerySet(this, descriptor));
|
||||||
}
|
}
|
||||||
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
|
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
|
||||||
const RenderPipelineDescriptor2* descriptor) {
|
const RenderPipelineDescriptor* descriptor) {
|
||||||
return AcquireRef(new RenderPipeline(this, descriptor));
|
return AcquireRef(new RenderPipeline(this, descriptor));
|
||||||
}
|
}
|
||||||
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
||||||
|
|
|
@ -135,7 +135,7 @@ namespace dawn_native { namespace null {
|
||||||
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
|
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
|
||||||
const QuerySetDescriptor* descriptor) override;
|
const QuerySetDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
|
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
|
||||||
const RenderPipelineDescriptor2* descriptor) override;
|
const RenderPipelineDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
|
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
|
||||||
const SamplerDescriptor* descriptor) override;
|
const SamplerDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(
|
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(
|
||||||
|
|
|
@ -140,7 +140,7 @@ namespace dawn_native { namespace opengl {
|
||||||
return AcquireRef(new QuerySet(this, descriptor));
|
return AcquireRef(new QuerySet(this, descriptor));
|
||||||
}
|
}
|
||||||
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
|
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
|
||||||
const RenderPipelineDescriptor2* descriptor) {
|
const RenderPipelineDescriptor* descriptor) {
|
||||||
return AcquireRef(new RenderPipeline(this, descriptor));
|
return AcquireRef(new RenderPipeline(this, descriptor));
|
||||||
}
|
}
|
||||||
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
||||||
|
|
|
@ -90,7 +90,7 @@ namespace dawn_native { namespace opengl {
|
||||||
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
|
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
|
||||||
const QuerySetDescriptor* descriptor) override;
|
const QuerySetDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
|
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
|
||||||
const RenderPipelineDescriptor2* descriptor) override;
|
const RenderPipelineDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
|
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
|
||||||
const SamplerDescriptor* descriptor) override;
|
const SamplerDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(
|
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(
|
||||||
|
|
|
@ -219,7 +219,7 @@ namespace dawn_native { namespace opengl {
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
RenderPipeline::RenderPipeline(Device* device, const RenderPipelineDescriptor2* descriptor)
|
RenderPipeline::RenderPipeline(Device* device, const RenderPipelineDescriptor* descriptor)
|
||||||
: RenderPipelineBase(device, descriptor),
|
: RenderPipelineBase(device, descriptor),
|
||||||
mVertexArrayObject(0),
|
mVertexArrayObject(0),
|
||||||
mGlPrimitiveTopology(GLPrimitiveTopology(GetPrimitiveTopology())) {
|
mGlPrimitiveTopology(GLPrimitiveTopology(GetPrimitiveTopology())) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace dawn_native { namespace opengl {
|
||||||
|
|
||||||
class RenderPipeline final : public RenderPipelineBase, public PipelineGL {
|
class RenderPipeline final : public RenderPipelineBase, public PipelineGL {
|
||||||
public:
|
public:
|
||||||
RenderPipeline(Device* device, const RenderPipelineDescriptor2* descriptor);
|
RenderPipeline(Device* device, const RenderPipelineDescriptor* descriptor);
|
||||||
|
|
||||||
GLenum GetGLPrimitiveTopology() const;
|
GLenum GetGLPrimitiveTopology() const;
|
||||||
ityp::bitset<VertexAttributeLocation, kMaxVertexAttributes> GetAttributesUsingVertexBuffer(
|
ityp::bitset<VertexAttributeLocation, kMaxVertexAttributes> GetAttributesUsingVertexBuffer(
|
||||||
|
|
|
@ -131,7 +131,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
return QuerySet::Create(this, descriptor);
|
return QuerySet::Create(this, descriptor);
|
||||||
}
|
}
|
||||||
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
|
ResultOrError<Ref<RenderPipelineBase>> Device::CreateRenderPipelineImpl(
|
||||||
const RenderPipelineDescriptor2* descriptor) {
|
const RenderPipelineDescriptor* descriptor) {
|
||||||
return RenderPipeline::Create(this, descriptor);
|
return RenderPipeline::Create(this, descriptor);
|
||||||
}
|
}
|
||||||
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
ResultOrError<Ref<SamplerBase>> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
||||||
|
|
|
@ -126,7 +126,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
|
ResultOrError<Ref<QuerySetBase>> CreateQuerySetImpl(
|
||||||
const QuerySetDescriptor* descriptor) override;
|
const QuerySetDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
|
ResultOrError<Ref<RenderPipelineBase>> CreateRenderPipelineImpl(
|
||||||
const RenderPipelineDescriptor2* descriptor) override;
|
const RenderPipelineDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
|
ResultOrError<Ref<SamplerBase>> CreateSamplerImpl(
|
||||||
const SamplerDescriptor* descriptor) override;
|
const SamplerDescriptor* descriptor) override;
|
||||||
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(
|
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModuleImpl(
|
||||||
|
|
|
@ -330,13 +330,13 @@ namespace dawn_native { namespace vulkan {
|
||||||
// static
|
// static
|
||||||
ResultOrError<Ref<RenderPipeline>> RenderPipeline::Create(
|
ResultOrError<Ref<RenderPipeline>> RenderPipeline::Create(
|
||||||
Device* device,
|
Device* device,
|
||||||
const RenderPipelineDescriptor2* descriptor) {
|
const RenderPipelineDescriptor* descriptor) {
|
||||||
Ref<RenderPipeline> pipeline = AcquireRef(new RenderPipeline(device, descriptor));
|
Ref<RenderPipeline> pipeline = AcquireRef(new RenderPipeline(device, descriptor));
|
||||||
DAWN_TRY(pipeline->Initialize(descriptor));
|
DAWN_TRY(pipeline->Initialize(descriptor));
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError RenderPipeline::Initialize(const RenderPipelineDescriptor2* descriptor) {
|
MaybeError RenderPipeline::Initialize(const RenderPipelineDescriptor* descriptor) {
|
||||||
Device* device = ToBackend(GetDevice());
|
Device* device = ToBackend(GetDevice());
|
||||||
|
|
||||||
VkPipelineShaderStageCreateInfo shaderStages[2];
|
VkPipelineShaderStageCreateInfo shaderStages[2];
|
||||||
|
|
|
@ -28,14 +28,14 @@ namespace dawn_native { namespace vulkan {
|
||||||
public:
|
public:
|
||||||
static ResultOrError<Ref<RenderPipeline>> Create(
|
static ResultOrError<Ref<RenderPipeline>> Create(
|
||||||
Device* device,
|
Device* device,
|
||||||
const RenderPipelineDescriptor2* descriptor);
|
const RenderPipelineDescriptor* descriptor);
|
||||||
|
|
||||||
VkPipeline GetHandle() const;
|
VkPipeline GetHandle() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~RenderPipeline() override;
|
~RenderPipeline() override;
|
||||||
using RenderPipelineBase::RenderPipelineBase;
|
using RenderPipelineBase::RenderPipelineBase;
|
||||||
MaybeError Initialize(const RenderPipelineDescriptor2* descriptor);
|
MaybeError Initialize(const RenderPipelineDescriptor* descriptor);
|
||||||
|
|
||||||
struct PipelineVertexInputStateCreateInfoTemporaryAllocations {
|
struct PipelineVertexInputStateCreateInfoTemporaryAllocations {
|
||||||
std::array<VkVertexInputBindingDescription, kMaxVertexBuffers> bindings;
|
std::array<VkVertexInputBindingDescription, kMaxVertexBuffers> bindings;
|
||||||
|
|
|
@ -277,7 +277,7 @@ namespace dawn_wire { namespace client {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::CreateRenderPipelineAsync(WGPURenderPipelineDescriptor2 const* descriptor,
|
void Device::CreateRenderPipelineAsync(WGPURenderPipelineDescriptor const* descriptor,
|
||||||
WGPUCreateRenderPipelineAsyncCallback callback,
|
WGPUCreateRenderPipelineAsyncCallback callback,
|
||||||
void* userdata) {
|
void* userdata) {
|
||||||
if (client->IsDisconnected()) {
|
if (client->IsDisconnected()) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace dawn_wire { namespace client {
|
||||||
void CreateComputePipelineAsync(WGPUComputePipelineDescriptor const* descriptor,
|
void CreateComputePipelineAsync(WGPUComputePipelineDescriptor const* descriptor,
|
||||||
WGPUCreateComputePipelineAsyncCallback callback,
|
WGPUCreateComputePipelineAsyncCallback callback,
|
||||||
void* userdata);
|
void* userdata);
|
||||||
void CreateRenderPipelineAsync(WGPURenderPipelineDescriptor2 const* descriptor,
|
void CreateRenderPipelineAsync(WGPURenderPipelineDescriptor const* descriptor,
|
||||||
WGPUCreateRenderPipelineAsyncCallback callback,
|
WGPUCreateRenderPipelineAsyncCallback callback,
|
||||||
void* userdata);
|
void* userdata);
|
||||||
|
|
||||||
|
|
|
@ -149,11 +149,10 @@ namespace dawn_wire { namespace server {
|
||||||
SerializeCommand(cmd);
|
SerializeCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Server::DoDeviceCreateRenderPipelineAsync(
|
bool Server::DoDeviceCreateRenderPipelineAsync(ObjectId deviceId,
|
||||||
ObjectId deviceId,
|
uint64_t requestSerial,
|
||||||
uint64_t requestSerial,
|
ObjectHandle pipelineObjectHandle,
|
||||||
ObjectHandle pipelineObjectHandle,
|
const WGPURenderPipelineDescriptor* descriptor) {
|
||||||
const WGPURenderPipelineDescriptor2* descriptor) {
|
|
||||||
auto* device = DeviceObjects().Get(deviceId);
|
auto* device = DeviceObjects().Get(deviceId);
|
||||||
if (device == nullptr) {
|
if (device == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -98,7 +98,7 @@ class BindGroupTests : public DawnTest {
|
||||||
|
|
||||||
wgpu::PipelineLayout pipelineLayout = MakeBasicPipelineLayout(bindGroupLayouts);
|
wgpu::PipelineLayout pipelineLayout = MakeBasicPipelineLayout(bindGroupLayouts);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.layout = pipelineLayout;
|
pipelineDescriptor.layout = pipelineLayout;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
|
@ -114,7 +114,7 @@ class BindGroupTests : public DawnTest {
|
||||||
|
|
||||||
pipelineDescriptor.cTargets[0].blend = &blend;
|
pipelineDescriptor.cTargets[0].blend = &blend;
|
||||||
|
|
||||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -184,12 +184,12 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
||||||
return fragmentUbo.color;
|
return fragmentUbo.color;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 textureDescriptor;
|
utils::ComboRenderPipelineDescriptor textureDescriptor;
|
||||||
textureDescriptor.vertex.module = vsModule;
|
textureDescriptor.vertex.module = vsModule;
|
||||||
textureDescriptor.cFragment.module = fsModule;
|
textureDescriptor.cFragment.module = fsModule;
|
||||||
textureDescriptor.cTargets[0].format = renderPass.colorFormat;
|
textureDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&textureDescriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
|
||||||
|
|
||||||
struct Data {
|
struct Data {
|
||||||
float transform[8];
|
float transform[8];
|
||||||
|
@ -260,12 +260,12 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
||||||
return textureSample(tex, samp, FragCoord.xy);
|
return textureSample(tex, samp, FragCoord.xy);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
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};
|
constexpr float transform[] = {1.f, 0.f, 0.f, 1.f};
|
||||||
wgpu::Buffer buffer = utils::CreateBufferFromData(device, &transform, sizeof(transform),
|
wgpu::Buffer buffer = utils::CreateBufferFromData(device, &transform, sizeof(transform),
|
||||||
|
@ -382,12 +382,12 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
||||||
return fragmentUbo1.color + fragmentUbo2.color;
|
return fragmentUbo1.color + fragmentUbo2.color;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 textureDescriptor;
|
utils::ComboRenderPipelineDescriptor textureDescriptor;
|
||||||
textureDescriptor.vertex.module = vsModule;
|
textureDescriptor.vertex.module = vsModule;
|
||||||
textureDescriptor.cFragment.module = fsModule;
|
textureDescriptor.cFragment.module = fsModule;
|
||||||
textureDescriptor.cTargets[0].format = renderPass.colorFormat;
|
textureDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&textureDescriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
|
||||||
|
|
||||||
struct Data {
|
struct Data {
|
||||||
float transform[4];
|
float transform[4];
|
||||||
|
@ -970,12 +970,12 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) {
|
||||||
return ubo1.color + 2.0 * ubo2.color + 4.0 * ubo3.color;
|
return ubo1.color + 2.0 * ubo2.color + 4.0 * ubo3.color;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
pipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
|
|
||||||
wgpu::Buffer black =
|
wgpu::Buffer black =
|
||||||
utils::CreateBufferFromData(device, wgpu::BufferUsage::Uniform, {0.f, 0.f, 0.f, 0.f});
|
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
|
// This is a regression test for crbug.com/dawn/410 which tests that it can successfully compile and
|
||||||
// execute the shader.
|
// execute the shader.
|
||||||
TEST_P(BindGroupTests, ReadonlyStorage) {
|
TEST_P(BindGroupTests, ReadonlyStorage) {
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
|
|
||||||
pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
|
pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]]
|
[[stage(vertex)]]
|
||||||
|
@ -1118,7 +1118,7 @@ TEST_P(BindGroupTests, ReadonlyStorage) {
|
||||||
|
|
||||||
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
||||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||||
|
|
|
@ -213,7 +213,7 @@ class BufferZeroInitTest : public DawnTest {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
ASSERT(vertexBufferCount <= 1u);
|
ASSERT(vertexBufferCount <= 1u);
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
|
@ -222,7 +222,7 @@ class BufferZeroInitTest : public DawnTest {
|
||||||
descriptor.cBuffers[0].attributeCount = 1;
|
descriptor.cBuffers[0].attributeCount = 1;
|
||||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||||
descriptor.cTargets[0].format = kColorAttachmentFormat;
|
descriptor.cTargets[0].format = kColorAttachmentFormat;
|
||||||
return device.CreateRenderPipeline2(&descriptor);
|
return device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExpectLazyClearSubmitAndCheckOutputs(wgpu::CommandEncoder encoder,
|
void ExpectLazyClearSubmitAndCheckOutputs(wgpu::CommandEncoder encoder,
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
class ClipSpaceTest : public DawnTest {
|
class ClipSpaceTest : public DawnTest {
|
||||||
protected:
|
protected:
|
||||||
wgpu::RenderPipeline CreatePipelineForTest() {
|
wgpu::RenderPipeline CreatePipelineForTest() {
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
|
|
||||||
// Draw two triangles:
|
// Draw two triangles:
|
||||||
// 1. The depth value of the top-left one is >= 0.5
|
// 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();
|
wgpu::DepthStencilState* depthStencil = pipelineDescriptor.EnableDepthStencil();
|
||||||
depthStencil->depthCompare = wgpu::CompareFunction::LessEqual;
|
depthStencil->depthCompare = wgpu::CompareFunction::LessEqual;
|
||||||
|
|
||||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::Texture Create2DTextureForTest(wgpu::TextureFormat format) {
|
wgpu::Texture Create2DTextureForTest(wgpu::TextureFormat format) {
|
||||||
|
|
|
@ -68,20 +68,20 @@ class ColorStateTest : public DawnTest {
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 baseDescriptor;
|
utils::ComboRenderPipelineDescriptor baseDescriptor;
|
||||||
baseDescriptor.vertex.module = vsModule;
|
baseDescriptor.vertex.module = vsModule;
|
||||||
baseDescriptor.cFragment.module = fsModule;
|
baseDescriptor.cFragment.module = fsModule;
|
||||||
baseDescriptor.cTargets[0].format = renderPass.colorFormat;
|
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.vertex.module = vsModule;
|
||||||
testDescriptor.cFragment.module = fsModule;
|
testDescriptor.cFragment.module = fsModule;
|
||||||
testDescriptor.cTargets[0] = colorTargetState;
|
testDescriptor.cTargets[0] = colorTargetState;
|
||||||
testDescriptor.cTargets[0].format = renderPass.colorFormat;
|
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
|
// 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.vertex.module = vsModule;
|
||||||
baseDescriptor.cFragment.module = fsModule;
|
baseDescriptor.cFragment.module = fsModule;
|
||||||
baseDescriptor.cFragment.targetCount = 4;
|
baseDescriptor.cFragment.targetCount = 4;
|
||||||
|
|
||||||
basePipeline = device.CreateRenderPipeline2(&baseDescriptor);
|
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 testDescriptor;
|
utils::ComboRenderPipelineDescriptor testDescriptor;
|
||||||
testDescriptor.vertex.module = vsModule;
|
testDescriptor.vertex.module = vsModule;
|
||||||
testDescriptor.cFragment.module = fsModule;
|
testDescriptor.cFragment.module = fsModule;
|
||||||
testDescriptor.cFragment.targetCount = 4;
|
testDescriptor.cFragment.targetCount = 4;
|
||||||
|
@ -856,7 +856,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
|
||||||
testDescriptor.cTargets[1].blend = &blend1;
|
testDescriptor.cTargets[1].blend = &blend1;
|
||||||
testDescriptor.cTargets[3].blend = &blend3;
|
testDescriptor.cTargets[3].blend = &blend3;
|
||||||
|
|
||||||
testPipeline = device.CreateRenderPipeline2(&testDescriptor);
|
testPipeline = device.CreateRenderPipeline(&testDescriptor);
|
||||||
|
|
||||||
for (unsigned int c = 0; c < kColors.size(); ++c) {
|
for (unsigned int c = 0; c < kColors.size(); ++c) {
|
||||||
RGBA8 base = kColors[((c + 31) * 29) % kColors.size()];
|
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.vertex.module = vsModule;
|
||||||
baseDescriptor.cFragment.module = fsModule;
|
baseDescriptor.cFragment.module = fsModule;
|
||||||
baseDescriptor.cTargets[0].format = renderPass.colorFormat;
|
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.vertex.module = vsModule;
|
||||||
testDescriptor.cFragment.module = fsModule;
|
testDescriptor.cFragment.module = fsModule;
|
||||||
testDescriptor.cTargets[0].format = renderPass.colorFormat;
|
testDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
@ -940,7 +940,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
|
||||||
|
|
||||||
testDescriptor.cTargets[0].blend = &blend;
|
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};
|
constexpr wgpu::Color kWhite{1.0f, 1.0f, 1.0f, 1.0f};
|
||||||
|
|
||||||
// Check that the initial blend color is (0,0,0,0)
|
// 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.vertex.module = vsModule;
|
||||||
baseDescriptor.cFragment.module = fsModule;
|
baseDescriptor.cFragment.module = fsModule;
|
||||||
baseDescriptor.cTargets[0].format = renderPass.colorFormat;
|
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.vertex.module = vsModule;
|
||||||
testDescriptor.cFragment.module = fsModule;
|
testDescriptor.cFragment.module = fsModule;
|
||||||
testDescriptor.cTargets[0].format = renderPass.colorFormat;
|
testDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
testDescriptor.cTargets[0].writeMask = wgpu::ColorWriteMask::Red;
|
testDescriptor.cTargets[0].writeMask = wgpu::ColorWriteMask::Red;
|
||||||
|
|
||||||
testPipeline = device.CreateRenderPipeline2(&testDescriptor);
|
testPipeline = device.CreateRenderPipeline(&testDescriptor);
|
||||||
|
|
||||||
RGBA8 base(32, 64, 128, 192);
|
RGBA8 base(32, 64, 128, 192);
|
||||||
RGBA8 expected(0, 0, 0, 0);
|
RGBA8 expected(0, 0, 0, 0);
|
||||||
|
|
|
@ -138,7 +138,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
||||||
wgpu::RenderPipeline CreateRenderPipelineForTest() {
|
wgpu::RenderPipeline CreateRenderPipelineForTest() {
|
||||||
ASSERT(IsBCFormatSupported());
|
ASSERT(IsBCFormatSupported());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
struct VertexOut {
|
struct VertexOut {
|
||||||
[[location(0)]] texCoord : vec2 <f32>;
|
[[location(0)]] texCoord : vec2 <f32>;
|
||||||
|
@ -169,7 +169,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
||||||
renderPipelineDescriptor.cFragment.module = fsModule;
|
renderPipelineDescriptor.cFragment.module = fsModule;
|
||||||
renderPipelineDescriptor.cTargets[0].format = utils::BasicRenderPass::kDefaultColorFormat;
|
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.
|
// Run the given render pipeline and bind group and verify the pixels in the render target.
|
||||||
|
|
|
@ -145,7 +145,7 @@ TEST_P(CreatePipelineAsyncTest, CreateComputePipelineFailed) {
|
||||||
TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateRenderPipelineAsync) {
|
TEST_P(CreatePipelineAsyncTest, BasicUseOfCreateRenderPipelineAsync) {
|
||||||
constexpr wgpu::TextureFormat kRenderAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
|
constexpr wgpu::TextureFormat kRenderAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
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;
|
constexpr wgpu::TextureFormat kRenderAttachmentFormat = wgpu::TextureFormat::Depth32Float;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
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
|
// Verify there is no error when the device is released before the callback of
|
||||||
// CreateRenderPipelineAsync() is called.
|
// CreateRenderPipelineAsync() is called.
|
||||||
TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateRenderPipelineAsync) {
|
TEST_P(CreatePipelineAsyncTest, ReleaseDeviceBeforeCallbackOfCreateRenderPipelineAsync) {
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
class CullingTest : public DawnTest {
|
class CullingTest : public DawnTest {
|
||||||
protected:
|
protected:
|
||||||
wgpu::RenderPipeline CreatePipelineForTest(wgpu::FrontFace frontFace, wgpu::CullMode cullMode) {
|
wgpu::RenderPipeline CreatePipelineForTest(wgpu::FrontFace frontFace, wgpu::CullMode cullMode) {
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
|
|
||||||
// Draw two triangles with different winding orders:
|
// Draw two triangles with different winding orders:
|
||||||
// 1. The top-left one is counterclockwise (CCW)
|
// 1. The top-left one is counterclockwise (CCW)
|
||||||
|
@ -54,7 +54,7 @@ class CullingTest : public DawnTest {
|
||||||
pipelineDescriptor.primitive.frontFace = frontFace;
|
pipelineDescriptor.primitive.frontFace = frontFace;
|
||||||
pipelineDescriptor.primitive.cullMode = cullMode;
|
pipelineDescriptor.primitive.cullMode = cullMode;
|
||||||
|
|
||||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::Texture Create2DTextureForTest(wgpu::TextureFormat format) {
|
wgpu::Texture Create2DTextureForTest(wgpu::TextureFormat format) {
|
||||||
|
|
|
@ -112,26 +112,26 @@ TEST_P(D3D12CachingTests, SameShaderNoCache) {
|
||||||
|
|
||||||
// Store the WGSL shader into the cache.
|
// Store the WGSL shader into the cache.
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
desc.vertex.module = module;
|
desc.vertex.module = module;
|
||||||
desc.vertex.entryPoint = "vertex_main";
|
desc.vertex.entryPoint = "vertex_main";
|
||||||
desc.cFragment.module = module;
|
desc.cFragment.module = module;
|
||||||
desc.cFragment.entryPoint = "fragment_main";
|
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);
|
EXPECT_EQ(mPersistentCache.mCache.size(), 0u);
|
||||||
|
|
||||||
// Load the same WGSL shader from the cache.
|
// Load the same WGSL shader from the cache.
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
desc.vertex.module = module;
|
desc.vertex.module = module;
|
||||||
desc.vertex.entryPoint = "vertex_main";
|
desc.vertex.entryPoint = "vertex_main";
|
||||||
desc.cFragment.module = module;
|
desc.cFragment.module = module;
|
||||||
desc.cFragment.entryPoint = "fragment_main";
|
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);
|
EXPECT_EQ(mPersistentCache.mCache.size(), 0u);
|
||||||
|
@ -153,20 +153,20 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) {
|
||||||
|
|
||||||
// Store the WGSL shader into the cache.
|
// Store the WGSL shader into the cache.
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
desc.vertex.module = module;
|
desc.vertex.module = module;
|
||||||
desc.vertex.entryPoint = "vertex_main";
|
desc.vertex.entryPoint = "vertex_main";
|
||||||
desc.cFragment.module = module;
|
desc.cFragment.module = module;
|
||||||
desc.cFragment.entryPoint = "fragment_main";
|
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);
|
EXPECT_EQ(mPersistentCache.mCache.size(), 2u);
|
||||||
|
|
||||||
// Load the same WGSL shader from the cache.
|
// Load the same WGSL shader from the cache.
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
desc.vertex.module = module;
|
desc.vertex.module = module;
|
||||||
desc.vertex.entryPoint = "vertex_main";
|
desc.vertex.entryPoint = "vertex_main";
|
||||||
desc.cFragment.module = module;
|
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
|
// Cached HLSL shader calls LoadData twice (once to peek, again to get), so check 2 x
|
||||||
// kNumOfShaders hits.
|
// kNumOfShaders hits.
|
||||||
EXPECT_CACHE_HIT(4u, device.CreateRenderPipeline2(&desc));
|
EXPECT_CACHE_HIT(4u, device.CreateRenderPipeline(&desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_EQ(mPersistentCache.mCache.size(), 2u);
|
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.module = newModule;
|
||||||
desc.vertex.entryPoint = "vertex_main";
|
desc.vertex.entryPoint = "vertex_main";
|
||||||
desc.cFragment.module = newModule;
|
desc.cFragment.module = newModule;
|
||||||
desc.cFragment.entryPoint = "fragment_main";
|
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
|
// Cached HLSL shader calls LoadData twice (once to peek, again to get), so check 2 x
|
||||||
|
|
|
@ -293,7 +293,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYtoR) {
|
||||||
viewDesc.aspect = wgpu::TextureAspect::Plane0Only;
|
viewDesc.aspect = wgpu::TextureAspect::Plane0Only;
|
||||||
wgpu::TextureView textureView = wgpuTexture.CreateView(&viewDesc);
|
wgpu::TextureView textureView = wgpuTexture.CreateView(&viewDesc);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
|
||||||
renderPipelineDescriptor.vertex.module = GetTestVertexShaderModule();
|
renderPipelineDescriptor.vertex.module = GetTestVertexShaderModule();
|
||||||
|
|
||||||
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -311,7 +311,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYtoR) {
|
||||||
renderPipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
renderPipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
renderPipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
renderPipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||||
|
|
||||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||||
|
|
||||||
wgpu::Sampler sampler = device.CreateSampler();
|
wgpu::Sampler sampler = device.CreateSampler();
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleUVtoRG) {
|
||||||
viewDesc.aspect = wgpu::TextureAspect::Plane1Only;
|
viewDesc.aspect = wgpu::TextureAspect::Plane1Only;
|
||||||
wgpu::TextureView textureView = wgpuTexture.CreateView(&viewDesc);
|
wgpu::TextureView textureView = wgpuTexture.CreateView(&viewDesc);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
|
||||||
renderPipelineDescriptor.vertex.module = GetTestVertexShaderModule();
|
renderPipelineDescriptor.vertex.module = GetTestVertexShaderModule();
|
||||||
|
|
||||||
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -363,7 +363,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleUVtoRG) {
|
||||||
renderPipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
renderPipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
renderPipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
renderPipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||||
|
|
||||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||||
|
|
||||||
wgpu::Sampler sampler = device.CreateSampler();
|
wgpu::Sampler sampler = device.CreateSampler();
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYUVtoRGB) {
|
||||||
chromaViewDesc.aspect = wgpu::TextureAspect::Plane1Only;
|
chromaViewDesc.aspect = wgpu::TextureAspect::Plane1Only;
|
||||||
wgpu::TextureView chromaTextureView = wgpuTexture.CreateView(&chromaViewDesc);
|
wgpu::TextureView chromaTextureView = wgpuTexture.CreateView(&chromaViewDesc);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
|
||||||
renderPipelineDescriptor.vertex.module = GetTestVertexShaderModule();
|
renderPipelineDescriptor.vertex.module = GetTestVertexShaderModule();
|
||||||
|
|
||||||
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -424,7 +424,7 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYUVtoRGB) {
|
||||||
device, kYUVImageDataWidthInTexels, kYUVImageDataHeightInTexels);
|
device, kYUVImageDataWidthInTexels, kYUVImageDataHeightInTexels);
|
||||||
renderPipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
renderPipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||||
|
|
||||||
wgpu::Sampler sampler = device.CreateSampler();
|
wgpu::Sampler sampler = device.CreateSampler();
|
||||||
|
|
||||||
|
|
|
@ -230,40 +230,40 @@ class BlendFactorDeprecationTests : public DeprecationTests {
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.cTargets[0].blend = &descriptor.cBlends[0];
|
descriptor.cTargets[0].blend = &descriptor.cBlends[0];
|
||||||
|
|
||||||
descriptor.cBlends[0].color.srcFactor = blendFactor;
|
descriptor.cBlends[0].color.srcFactor = blendFactor;
|
||||||
if (deprecated) {
|
if (deprecated) {
|
||||||
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline2(&descriptor));
|
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
|
||||||
} else {
|
} else {
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
descriptor.cBlends[0].color.srcFactor = wgpu::BlendFactor::One;
|
descriptor.cBlends[0].color.srcFactor = wgpu::BlendFactor::One;
|
||||||
|
|
||||||
descriptor.cBlends[0].color.dstFactor = blendFactor;
|
descriptor.cBlends[0].color.dstFactor = blendFactor;
|
||||||
if (deprecated) {
|
if (deprecated) {
|
||||||
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline2(&descriptor));
|
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
|
||||||
} else {
|
} else {
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
descriptor.cBlends[0].color.dstFactor = wgpu::BlendFactor::Zero;
|
descriptor.cBlends[0].color.dstFactor = wgpu::BlendFactor::Zero;
|
||||||
|
|
||||||
descriptor.cBlends[0].alpha.srcFactor = blendFactor;
|
descriptor.cBlends[0].alpha.srcFactor = blendFactor;
|
||||||
if (deprecated) {
|
if (deprecated) {
|
||||||
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline2(&descriptor));
|
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
|
||||||
} else {
|
} else {
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
descriptor.cBlends[0].alpha.srcFactor = wgpu::BlendFactor::One;
|
descriptor.cBlends[0].alpha.srcFactor = wgpu::BlendFactor::One;
|
||||||
|
|
||||||
descriptor.cBlends[0].alpha.dstFactor = blendFactor;
|
descriptor.cBlends[0].alpha.dstFactor = blendFactor;
|
||||||
if (deprecated) {
|
if (deprecated) {
|
||||||
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline2(&descriptor));
|
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
|
||||||
} else {
|
} else {
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
descriptor.cBlends[0].alpha.dstFactor = wgpu::BlendFactor::Zero;
|
descriptor.cBlends[0].alpha.dstFactor = wgpu::BlendFactor::Zero;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ class DepthBiasTests : public DawnTest {
|
||||||
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = depthClear;
|
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = depthClear;
|
||||||
|
|
||||||
// Create a render pipeline to render the quad
|
// Create a render pipeline to render the quad
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
|
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
|
||||||
|
|
||||||
renderPipelineDesc.vertex.module = vertexModule;
|
renderPipelineDesc.vertex.module = vertexModule;
|
||||||
renderPipelineDesc.cFragment.module = fragmentModule;
|
renderPipelineDesc.cFragment.module = fragmentModule;
|
||||||
|
@ -109,7 +109,7 @@ class DepthBiasTests : public DawnTest {
|
||||||
depthStencil->depthCompare = wgpu::CompareFunction::Greater;
|
depthStencil->depthCompare = wgpu::CompareFunction::Greater;
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
|
||||||
|
|
||||||
// Draw the quad (two triangles)
|
// Draw the quad (two triangles)
|
||||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||||
|
|
|
@ -66,7 +66,7 @@ class DepthStencilCopyTests : public DawnTest {
|
||||||
return device.CreateTexture(&texDescriptor);
|
return device.CreateTexture(&texDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopulatePipelineDescriptorWriteDepth(utils::ComboRenderPipelineDescriptor2* desc,
|
void PopulatePipelineDescriptorWriteDepth(utils::ComboRenderPipelineDescriptor* desc,
|
||||||
wgpu::TextureFormat format,
|
wgpu::TextureFormat format,
|
||||||
float regionDepth) {
|
float regionDepth) {
|
||||||
desc->vertex.module = mVertexModule;
|
desc->vertex.module = mVertexModule;
|
||||||
|
@ -96,11 +96,11 @@ class DepthStencilCopyTests : public DawnTest {
|
||||||
utils::ComboRenderPassDescriptor renderPassDesc({}, texture.CreateView(&viewDesc));
|
utils::ComboRenderPassDescriptor renderPassDesc({}, texture.CreateView(&viewDesc));
|
||||||
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = clearDepth;
|
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = clearDepth;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
|
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
|
||||||
PopulatePipelineDescriptorWriteDepth(&renderPipelineDesc, wgpu::TextureFormat::Depth32Float,
|
PopulatePipelineDescriptorWriteDepth(&renderPipelineDesc, wgpu::TextureFormat::Depth32Float,
|
||||||
regionDepth);
|
regionDepth);
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
|
||||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||||
wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&renderPassDesc);
|
wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&renderPassDesc);
|
||||||
pass.SetPipeline(pipeline);
|
pass.SetPipeline(pipeline);
|
||||||
|
@ -128,12 +128,12 @@ class DepthStencilCopyTests : public DawnTest {
|
||||||
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = clearDepth;
|
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = clearDepth;
|
||||||
renderPassDesc.cDepthStencilAttachmentInfo.clearStencil = clearStencil;
|
renderPassDesc.cDepthStencilAttachmentInfo.clearStencil = clearStencil;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
|
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
|
||||||
PopulatePipelineDescriptorWriteDepth(&renderPipelineDesc,
|
PopulatePipelineDescriptorWriteDepth(&renderPipelineDesc,
|
||||||
wgpu::TextureFormat::Depth24PlusStencil8, regionDepth);
|
wgpu::TextureFormat::Depth24PlusStencil8, regionDepth);
|
||||||
renderPipelineDesc.cDepthStencil.stencilFront.passOp = wgpu::StencilOperation::Replace;
|
renderPipelineDesc.cDepthStencil.stencilFront.passOp = wgpu::StencilOperation::Replace;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
|
||||||
|
|
||||||
// Draw the quad (two triangles)
|
// Draw the quad (two triangles)
|
||||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||||
|
@ -233,7 +233,7 @@ class DepthStencilCopyTests : public DawnTest {
|
||||||
commandEncoder.CopyBufferToTexture(&bufferCopy, &textureCopy, &depthDataDesc.size);
|
commandEncoder.CopyBufferToTexture(&bufferCopy, &textureCopy, &depthDataDesc.size);
|
||||||
|
|
||||||
// Pipeline for a full screen quad.
|
// Pipeline for a full screen quad.
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
|
|
||||||
pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
|
pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]]
|
[[stage(vertex)]]
|
||||||
|
@ -283,7 +283,7 @@ class DepthStencilCopyTests : public DawnTest {
|
||||||
passDescriptor.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Load;
|
passDescriptor.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Load;
|
||||||
passDescriptor.cDepthStencilAttachmentInfo.stencilLoadOp = 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.
|
// Bind the depth data texture.
|
||||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
||||||
|
@ -642,7 +642,7 @@ TEST_P(DepthStencilCopyTests, ToStencilAspect) {
|
||||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||||
// Create a render pipline which decrements the stencil value for passing fragments.
|
// Create a render pipline which decrements the stencil value for passing fragments.
|
||||||
// A quad is drawn in the bottom left.
|
// A quad is drawn in the bottom left.
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
|
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
|
||||||
renderPipelineDesc.vertex.module = mVertexModule;
|
renderPipelineDesc.vertex.module = mVertexModule;
|
||||||
renderPipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"(
|
renderPipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(fragment)]] fn main() {
|
[[stage(fragment)]] fn main() {
|
||||||
|
@ -652,7 +652,7 @@ TEST_P(DepthStencilCopyTests, ToStencilAspect) {
|
||||||
depthStencil->stencilFront.passOp = wgpu::StencilOperation::DecrementClamp;
|
depthStencil->stencilFront.passOp = wgpu::StencilOperation::DecrementClamp;
|
||||||
renderPipelineDesc.cFragment.targetCount = 0;
|
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
|
// 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.
|
// copied in. Also load the canary depth values so they're not lost.
|
||||||
|
|
|
@ -70,7 +70,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
||||||
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
|
|
||||||
std::ostringstream shaderSource;
|
std::ostringstream shaderSource;
|
||||||
std::ostringstream shaderOutputStruct;
|
std::ostringstream shaderOutputStruct;
|
||||||
|
@ -117,7 +117,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
||||||
pipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
pipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
pipelineDescriptor.cFragment.targetCount = static_cast<uint32_t>(aspects.size());
|
pipelineDescriptor.cFragment.targetCount = static_cast<uint32_t>(aspects.size());
|
||||||
|
|
||||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::ComputePipeline CreateSamplingComputePipeline(std::vector<TestAspect> aspects,
|
wgpu::ComputePipeline CreateSamplingComputePipeline(std::vector<TestAspect> aspects,
|
||||||
|
@ -199,14 +199,14 @@ class DepthStencilSamplingTest : public DawnTest {
|
||||||
{1, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Depth},
|
{1, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Depth},
|
||||||
{2, wgpu::ShaderStage::Fragment, wgpu::BufferBindingType::Uniform}});
|
{2, wgpu::ShaderStage::Fragment, wgpu::BufferBindingType::Uniform}});
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
pipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
pipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
pipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::R32Float;
|
pipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::R32Float;
|
||||||
|
|
||||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::ComputePipeline CreateComparisonComputePipeline() {
|
wgpu::ComputePipeline CreateComparisonComputePipeline() {
|
||||||
|
|
|
@ -290,7 +290,7 @@ class DepthStencilStateTest : public DawnTest {
|
||||||
|
|
||||||
// Create a pipeline for the triangles with the test spec's depth stencil state
|
// 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.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
||||||
|
@ -298,7 +298,7 @@ class DepthStencilStateTest : public DawnTest {
|
||||||
depthStencil->format = wgpu::TextureFormat::Depth24PlusStencil8;
|
depthStencil->format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||||
descriptor.primitive.frontFace = test.frontFace;
|
descriptor.primitive.frontFace = test.frontFace;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
// Create a bind group for the data
|
// Create a bind group for the data
|
||||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
|
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
|
||||||
|
@ -732,12 +732,12 @@ TEST_P(DepthStencilStateTest, CreatePipelineWithAllFormats) {
|
||||||
};
|
};
|
||||||
|
|
||||||
for (wgpu::TextureFormat depthStencilFormat : kDepthStencilFormats) {
|
for (wgpu::TextureFormat depthStencilFormat : kDepthStencilFormats) {
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.EnableDepthStencil(depthStencilFormat);
|
descriptor.EnableDepthStencil(depthStencilFormat);
|
||||||
|
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class DestroyTest : public DawnTest {
|
||||||
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||||
|
@ -48,7 +48,7 @@ class DestroyTest : public DawnTest {
|
||||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||||
device, wgpu::BufferUsage::Vertex,
|
device, wgpu::BufferUsage::Vertex,
|
||||||
|
|
|
@ -177,8 +177,8 @@ TEST_P(DeviceLostTest, CreateComputePipelineFails) {
|
||||||
TEST_P(DeviceLostTest, CreateRenderPipelineFails) {
|
TEST_P(DeviceLostTest, CreateRenderPipelineFails) {
|
||||||
SetCallbackAndLoseForTesting();
|
SetCallbackAndLoseForTesting();
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that CreateSampler fails when device is lost
|
// Tests that CreateSampler fails when device is lost
|
||||||
|
|
|
@ -37,7 +37,7 @@ class DrawIndexedIndirectTest : public DawnTest {
|
||||||
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
|
||||||
|
@ -48,7 +48,7 @@ class DrawIndexedIndirectTest : public DawnTest {
|
||||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||||
device, wgpu::BufferUsage::Vertex,
|
device, wgpu::BufferUsage::Vertex,
|
||||||
|
|
|
@ -37,7 +37,7 @@ class DrawIndexedTest : public DawnTest {
|
||||||
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
|
||||||
|
@ -48,7 +48,7 @@ class DrawIndexedTest : public DawnTest {
|
||||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||||
device, wgpu::BufferUsage::Vertex,
|
device, wgpu::BufferUsage::Vertex,
|
||||||
|
|
|
@ -37,7 +37,7 @@ class DrawIndirectTest : public DawnTest {
|
||||||
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
|
||||||
|
@ -48,7 +48,7 @@ class DrawIndirectTest : public DawnTest {
|
||||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||||
device, wgpu::BufferUsage::Vertex,
|
device, wgpu::BufferUsage::Vertex,
|
||||||
|
|
|
@ -37,7 +37,7 @@ class DrawTest : public DawnTest {
|
||||||
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||||
|
@ -47,7 +47,7 @@ class DrawTest : public DawnTest {
|
||||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||||
device, wgpu::BufferUsage::Vertex,
|
device, wgpu::BufferUsage::Vertex,
|
||||||
|
|
|
@ -152,7 +152,7 @@ class DynamicBufferOffsetTests : public DawnTest {
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fs.str().c_str());
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fs.str().c_str());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
pipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
@ -166,7 +166,7 @@ class DynamicBufferOffsetTests : public DawnTest {
|
||||||
pipelineLayoutDescriptor.bindGroupLayouts = mBindGroupLayouts;
|
pipelineLayoutDescriptor.bindGroupLayouts = mBindGroupLayouts;
|
||||||
pipelineDescriptor.layout = device.CreatePipelineLayout(&pipelineLayoutDescriptor);
|
pipelineDescriptor.layout = device.CreatePipelineLayout(&pipelineLayoutDescriptor);
|
||||||
|
|
||||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::ComputePipeline CreateComputePipeline(bool isInheritedPipeline = false) {
|
wgpu::ComputePipeline CreateComputePipeline(bool isInheritedPipeline = false) {
|
||||||
|
|
|
@ -34,14 +34,14 @@ TEST_P(EntryPointTests, FragAndVertexSameModule) {
|
||||||
)");
|
)");
|
||||||
|
|
||||||
// Create a point pipeline from the module.
|
// Create a point pipeline from the module.
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
desc.vertex.module = module;
|
desc.vertex.module = module;
|
||||||
desc.vertex.entryPoint = "vertex_main";
|
desc.vertex.entryPoint = "vertex_main";
|
||||||
desc.cFragment.module = module;
|
desc.cFragment.module = module;
|
||||||
desc.cFragment.entryPoint = "fragment_main";
|
desc.cFragment.entryPoint = "fragment_main";
|
||||||
desc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
desc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
desc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
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.
|
// Render the point and check that it was rendered.
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
|
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
|
||||||
|
|
|
@ -145,7 +145,7 @@ struct FragInputs {
|
||||||
|
|
||||||
constexpr uint32_t kComponentsPerVertex = 4;
|
constexpr uint32_t kComponentsPerVertex = 4;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
utils::ComboRenderPipelineDescriptor pipelineDesc;
|
||||||
pipelineDesc.vertex.module = utils::CreateShaderModule(device, vertexShader.c_str());
|
pipelineDesc.vertex.module = utils::CreateShaderModule(device, vertexShader.c_str());
|
||||||
pipelineDesc.cFragment.module = utils::CreateShaderModule(device, fragmentShader.c_str());
|
pipelineDesc.cFragment.module = utils::CreateShaderModule(device, fragmentShader.c_str());
|
||||||
pipelineDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
pipelineDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
|
@ -155,7 +155,7 @@ struct FragInputs {
|
||||||
pipelineDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
pipelineDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||||
pipelineDesc.cTargets[0].format = renderPass.colorFormat;
|
pipelineDesc.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDesc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc);
|
||||||
|
|
||||||
std::vector<float> vertexData(firstVertex * kComponentsPerVertex);
|
std::vector<float> vertexData(firstVertex * kComponentsPerVertex);
|
||||||
vertexData.insert(vertexData.end(), {0, 0, 0, 1});
|
vertexData.insert(vertexData.end(), {0, 0, 0, 1});
|
||||||
|
|
|
@ -72,13 +72,13 @@ class GpuMemorySyncTests : public DawnTest {
|
||||||
return vec4<f32>(f32(data.i) / 255.0, 0.0, 0.0, 1.0);
|
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.vertex.module = vsModule;
|
||||||
rpDesc.cFragment.module = fsModule;
|
rpDesc.cFragment.module = fsModule;
|
||||||
rpDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
rpDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
rpDesc.cTargets[0].format = colorFormat;
|
rpDesc.cTargets[0].format = colorFormat;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&rpDesc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&rpDesc);
|
||||||
|
|
||||||
wgpu::BindGroup bindGroup =
|
wgpu::BindGroup bindGroup =
|
||||||
utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), {{0, buffer}});
|
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);
|
return vec4<f32>(contents.color, 0.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 rpDesc;
|
utils::ComboRenderPipelineDescriptor rpDesc;
|
||||||
rpDesc.vertex.module = vsModule;
|
rpDesc.vertex.module = vsModule;
|
||||||
rpDesc.cFragment.module = fsModule;
|
rpDesc.cFragment.module = fsModule;
|
||||||
rpDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
rpDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
rpDesc.cTargets[0].format = colorFormat;
|
rpDesc.cTargets[0].format = colorFormat;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&rpDesc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&rpDesc);
|
||||||
|
|
||||||
wgpu::BindGroup bindGroup =
|
wgpu::BindGroup bindGroup =
|
||||||
utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), {{0, mBuffer}});
|
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::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 rpDesc;
|
utils::ComboRenderPipelineDescriptor rpDesc;
|
||||||
rpDesc.vertex.module = vsModule;
|
rpDesc.vertex.module = vsModule;
|
||||||
rpDesc.cFragment.module = fsModule;
|
rpDesc.cFragment.module = fsModule;
|
||||||
rpDesc.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
rpDesc.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||||
|
@ -599,7 +599,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
|
||||||
rpDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
rpDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||||
rpDesc.cTargets[0].format = renderPass.colorFormat;
|
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),
|
wgpu::BindGroup bindGroup1 = utils::MakeBindGroup(device, rp.GetBindGroupLayout(0),
|
||||||
{{0, uniformBuffer}, {1, storageBuffer}});
|
{{0, uniformBuffer}, {1, storageBuffer}});
|
||||||
|
@ -704,7 +704,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
|
||||||
|
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 rpDesc;
|
utils::ComboRenderPipelineDescriptor rpDesc;
|
||||||
rpDesc.vertex.module = vsModule;
|
rpDesc.vertex.module = vsModule;
|
||||||
rpDesc.cFragment.module = fsModule;
|
rpDesc.cFragment.module = fsModule;
|
||||||
rpDesc.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
rpDesc.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||||
|
@ -714,7 +714,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
|
||||||
rpDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
rpDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||||
rpDesc.cTargets[0].format = renderPass.colorFormat;
|
rpDesc.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&rpDesc);
|
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&rpDesc);
|
||||||
|
|
||||||
wgpu::BindGroup bindGroup1 =
|
wgpu::BindGroup bindGroup1 =
|
||||||
utils::MakeBindGroup(device, rp.GetBindGroupLayout(0),
|
utils::MakeBindGroup(device, rp.GetBindGroupLayout(0),
|
||||||
|
|
|
@ -287,12 +287,12 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vs;
|
descriptor.vertex.module = vs;
|
||||||
descriptor.cFragment.module = fs;
|
descriptor.cFragment.module = fs;
|
||||||
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
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.
|
// The bindgroup containing the texture view for the ioSurface as well as the sampler.
|
||||||
|
|
|
@ -51,7 +51,7 @@ class IndexFormatTest : public DawnTest {
|
||||||
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = primitiveTopology;
|
descriptor.primitive.topology = primitiveTopology;
|
||||||
|
@ -62,7 +62,7 @@ class IndexFormatTest : public DawnTest {
|
||||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
return device.CreateRenderPipeline2(&descriptor);
|
return device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ class MultisampledRenderingTest : public DawnTest {
|
||||||
uint32_t sampleMask = 0xFFFFFFFF,
|
uint32_t sampleMask = 0xFFFFFFFF,
|
||||||
bool alphaToCoverageEnabled = false,
|
bool alphaToCoverageEnabled = false,
|
||||||
bool flipTriangle = false) {
|
bool flipTriangle = false) {
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
|
|
||||||
// Draw a bottom-right triangle. In standard 4xMSAA pattern, for the pixels on diagonal,
|
// Draw a bottom-right triangle. In standard 4xMSAA pattern, for the pixels on diagonal,
|
||||||
// only two of the samples will be touched.
|
// only two of the samples will be touched.
|
||||||
|
@ -269,7 +269,7 @@ class MultisampledRenderingTest : public DawnTest {
|
||||||
pipelineDescriptor.cTargets[i].format = kColorFormat;
|
pipelineDescriptor.cTargets[i].format = kColorFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class MultisampledSamplingTest : public DawnTest {
|
||||||
DawnTest::SetUp();
|
DawnTest::SetUp();
|
||||||
|
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
|
|
||||||
desc.vertex.module = utils::CreateShaderModule(device, R"(
|
desc.vertex.module = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]]
|
[[stage(vertex)]]
|
||||||
|
@ -87,7 +87,7 @@ class MultisampledSamplingTest : public DawnTest {
|
||||||
|
|
||||||
desc.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
|
desc.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
|
||||||
|
|
||||||
drawPipeline = device.CreateRenderPipeline2(&desc);
|
drawPipeline = device.CreateRenderPipeline(&desc);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
wgpu::ComputePipelineDescriptor desc = {};
|
wgpu::ComputePipelineDescriptor desc = {};
|
||||||
|
|
|
@ -207,7 +207,7 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) {
|
||||||
EXPECT_NE(pl.Get(), otherPl.Get());
|
EXPECT_NE(pl.Get(), otherPl.Get());
|
||||||
EXPECT_EQ(pl.Get() == samePl.Get(), !UsesWire());
|
EXPECT_EQ(pl.Get() == samePl.Get(), !UsesWire());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
desc.vertex.module = utils::CreateShaderModule(device, R"(
|
desc.vertex.module = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||||
|
@ -217,13 +217,13 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
desc.layout = pl;
|
desc.layout = pl;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||||
|
|
||||||
desc.layout = samePl;
|
desc.layout = samePl;
|
||||||
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline(&desc);
|
||||||
|
|
||||||
desc.layout = otherPl;
|
desc.layout = otherPl;
|
||||||
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline(&desc);
|
||||||
|
|
||||||
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
|
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
|
||||||
EXPECT_EQ(pipeline.Get() == samePipeline.Get(), !UsesWire());
|
EXPECT_EQ(pipeline.Get() == samePipeline.Get(), !UsesWire());
|
||||||
|
@ -247,19 +247,19 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) {
|
||||||
EXPECT_NE(module.Get(), otherModule.Get());
|
EXPECT_NE(module.Get(), otherModule.Get());
|
||||||
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
|
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
desc.cFragment.module = utils::CreateShaderModule(device, R"(
|
desc.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(fragment)]] fn main() {
|
[[stage(fragment)]] fn main() {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
desc.vertex.module = module;
|
desc.vertex.module = module;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||||
|
|
||||||
desc.vertex.module = sameModule;
|
desc.vertex.module = sameModule;
|
||||||
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline(&desc);
|
||||||
|
|
||||||
desc.vertex.module = otherModule;
|
desc.vertex.module = otherModule;
|
||||||
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline(&desc);
|
||||||
|
|
||||||
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
|
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
|
||||||
EXPECT_EQ(pipeline.Get() == samePipeline.Get(), !UsesWire());
|
EXPECT_EQ(pipeline.Get() == samePipeline.Get(), !UsesWire());
|
||||||
|
@ -281,20 +281,20 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) {
|
||||||
EXPECT_NE(module.Get(), otherModule.Get());
|
EXPECT_NE(module.Get(), otherModule.Get());
|
||||||
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
|
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
desc.vertex.module = utils::CreateShaderModule(device, R"(
|
desc.vertex.module = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
desc.cFragment.module = module;
|
desc.cFragment.module = module;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||||
|
|
||||||
desc.cFragment.module = sameModule;
|
desc.cFragment.module = sameModule;
|
||||||
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline(&desc);
|
||||||
|
|
||||||
desc.cFragment.module = otherModule;
|
desc.cFragment.module = otherModule;
|
||||||
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline(&desc);
|
||||||
|
|
||||||
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
|
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
|
||||||
EXPECT_EQ(pipeline.Get() == samePipeline.Get(), !UsesWire());
|
EXPECT_EQ(pipeline.Get() == samePipeline.Get(), !UsesWire());
|
||||||
|
|
|
@ -180,13 +180,13 @@ TEST_P(OpArrayLengthTest, Fragment) {
|
||||||
})")
|
})")
|
||||||
.c_str());
|
.c_str());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
descriptor.layout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
// "Draw" the lengths to the texture.
|
// "Draw" the lengths to the texture.
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
@ -241,13 +241,13 @@ TEST_P(OpArrayLengthTest, Vertex) {
|
||||||
return color;
|
return color;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
descriptor.layout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
// "Draw" the lengths to the texture.
|
// "Draw" the lengths to the texture.
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
|
|
@ -109,7 +109,7 @@ class DepthClampingTest : public DawnTest {
|
||||||
wgpu::BufferUsage::Uniform);
|
wgpu::BufferUsage::Uniform);
|
||||||
|
|
||||||
// Create a pipeline for the triangles with the test spec's params.
|
// 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.nextInChain = test.depthClampingState;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
|
@ -119,7 +119,7 @@ class DepthClampingTest : public DawnTest {
|
||||||
depthStencil->depthCompare = test.depthCompareFunction;
|
depthStencil->depthCompare = test.depthCompareFunction;
|
||||||
depthStencil->format = wgpu::TextureFormat::Depth24PlusStencil8;
|
depthStencil->format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
// Create a bind group for the data
|
// Create a bind group for the data
|
||||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
|
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
|
||||||
|
|
|
@ -183,7 +183,7 @@ class PrimitiveTopologyTest : public DawnTest {
|
||||||
// locations
|
// locations
|
||||||
void DoTest(wgpu::PrimitiveTopology primitiveTopology,
|
void DoTest(wgpu::PrimitiveTopology primitiveTopology,
|
||||||
const std::vector<LocationSpec>& locationSpecs) {
|
const std::vector<LocationSpec>& locationSpecs) {
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ class PrimitiveTopologyTest : public DawnTest {
|
||||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,11 +95,11 @@ class OcclusionQueryTests : public QueryTests {
|
||||||
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ScissorRect {
|
struct ScissorRect {
|
||||||
|
@ -129,7 +129,7 @@ class OcclusionQueryTests : public QueryTests {
|
||||||
OcclusionExpectation::Result expected) {
|
OcclusionExpectation::Result expected) {
|
||||||
constexpr uint32_t kQueryCount = 1;
|
constexpr uint32_t kQueryCount = 1;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ class OcclusionQueryTests : public QueryTests {
|
||||||
depthStencil->stencilBack.compare =
|
depthStencil->stencilBack.compare =
|
||||||
stencilTestEnabled ? wgpu::CompareFunction::Never : wgpu::CompareFunction::Always;
|
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::Texture renderTarget = CreateRenderTexture(wgpu::TextureFormat::RGBA8Unorm);
|
||||||
wgpu::TextureView renderTargetView = renderTarget.CreateView();
|
wgpu::TextureView renderTargetView = renderTarget.CreateView();
|
||||||
|
|
|
@ -47,7 +47,7 @@ class RenderBundleTest : public DawnTest {
|
||||||
return fragmentUniformBuffer.color;
|
return fragmentUniformBuffer.color;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||||
|
@ -57,7 +57,7 @@ class RenderBundleTest : public DawnTest {
|
||||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
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,
|
float colors0[] = {kColors[0].r / 255.f, kColors[0].g / 255.f, kColors[0].b / 255.f,
|
||||||
kColors[0].a / 255.f};
|
kColors[0].a / 255.f};
|
||||||
|
|
|
@ -33,12 +33,12 @@ class DrawQuad {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw(wgpu::RenderPassEncoder* pass) {
|
void Draw(wgpu::RenderPassEncoder* pass) {
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = pipelineLayout;
|
descriptor.layout = pipelineLayout;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
auto renderPipeline = device.CreateRenderPipeline2(&descriptor);
|
auto renderPipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
pass->SetPipeline(renderPipeline);
|
pass->SetPipeline(renderPipeline);
|
||||||
pass->Draw(6, 1, 0, 0);
|
pass->Draw(6, 1, 0, 0);
|
||||||
|
|
|
@ -42,13 +42,13 @@ class RenderPassTest : public DawnTest {
|
||||||
return vec4<f32>(0.0, 0.0, 1.0, 1.0);
|
return vec4<f32>(0.0, 0.0, 1.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = mVSModule;
|
descriptor.vertex.module = mVSModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||||
descriptor.cTargets[0].format = kFormat;
|
descriptor.cTargets[0].format = kFormat;
|
||||||
|
|
||||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::Texture CreateDefault2DTexture() {
|
wgpu::Texture CreateDefault2DTexture() {
|
||||||
|
@ -140,14 +140,14 @@ TEST_P(RenderPassTest, NoCorrespondingFragmentShaderOutputs) {
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(fragment)]] fn main() {
|
[[stage(fragment)]] fn main() {
|
||||||
})");
|
})");
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = mVSModule;
|
descriptor.vertex.module = mVSModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||||
descriptor.cTargets[0].format = kFormat;
|
descriptor.cTargets[0].format = kFormat;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipelineWithNoFragmentOutput =
|
wgpu::RenderPipeline pipelineWithNoFragmentOutput =
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
pass.SetPipeline(pipelineWithNoFragmentOutput);
|
pass.SetPipeline(pipelineWithNoFragmentOutput);
|
||||||
pass.Draw(3);
|
pass.Draw(3);
|
||||||
|
|
|
@ -76,7 +76,7 @@ class SamplerFilterAnisotropicTest : public DawnTest {
|
||||||
return textureSample(texture0, sampler0, input.uv);
|
return textureSample(texture0, sampler0, input.uv);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.cBuffers[0].attributeCount = 2;
|
pipelineDescriptor.cBuffers[0].attributeCount = 2;
|
||||||
|
@ -88,7 +88,7 @@ class SamplerFilterAnisotropicTest : public DawnTest {
|
||||||
pipelineDescriptor.cBuffers[0].arrayStride = 6 * sizeof(float);
|
pipelineDescriptor.cBuffers[0].arrayStride = 6 * sizeof(float);
|
||||||
pipelineDescriptor.cTargets[0].format = mRenderPass.colorFormat;
|
pipelineDescriptor.cTargets[0].format = mRenderPass.colorFormat;
|
||||||
|
|
||||||
mPipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
mPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
mBindGroupLayout = mPipeline.GetBindGroupLayout(0);
|
mBindGroupLayout = mPipeline.GetBindGroupLayout(0);
|
||||||
|
|
||||||
InitTexture();
|
InitTexture();
|
||||||
|
|
|
@ -76,12 +76,12 @@ class SamplerTest : public DawnTest {
|
||||||
return textureSample(texture0, sampler0, FragCoord.xy / vec2<f32>(2.0, 2.0));
|
return textureSample(texture0, sampler0, FragCoord.xy / vec2<f32>(2.0, 2.0));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.cTargets[0].format = mRenderPass.colorFormat;
|
pipelineDescriptor.cTargets[0].format = mRenderPass.colorFormat;
|
||||||
|
|
||||||
mPipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
mPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
mBindGroupLayout = mPipeline.GetBindGroupLayout(0);
|
mBindGroupLayout = mPipeline.GetBindGroupLayout(0);
|
||||||
|
|
||||||
wgpu::TextureDescriptor descriptor;
|
wgpu::TextureDescriptor descriptor;
|
||||||
|
|
|
@ -39,12 +39,12 @@ class ScissorTest : public DawnTest {
|
||||||
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.cTargets[0].format = format;
|
descriptor.cTargets[0].format = format;
|
||||||
|
|
||||||
return device.CreateRenderPipeline2(&descriptor);
|
return device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -116,10 +116,10 @@ fn main([[builtin(position)]] fragCoord : vec4<f32>) -> [[location(0)]] vec4<f32
|
||||||
})";
|
})";
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader.c_str());
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader.c_str());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 rpDesc;
|
utils::ComboRenderPipelineDescriptor rpDesc;
|
||||||
rpDesc.vertex.module = vsModule;
|
rpDesc.vertex.module = vsModule;
|
||||||
rpDesc.cFragment.module = fsModule;
|
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
|
// 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());
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader.c_str());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 rpDesc;
|
utils::ComboRenderPipelineDescriptor rpDesc;
|
||||||
rpDesc.vertex.module = vsModule;
|
rpDesc.vertex.module = vsModule;
|
||||||
rpDesc.cFragment.module = fsModule;
|
rpDesc.cFragment.module = fsModule;
|
||||||
rpDesc.vertex.bufferCount = 1;
|
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[0].format = wgpu::VertexFormat::Float32x3;
|
||||||
rpDesc.cAttributes[1].shaderLocation = 1;
|
rpDesc.cAttributes[1].shaderLocation = 1;
|
||||||
rpDesc.cAttributes[1].format = wgpu::VertexFormat::Float32x4;
|
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
|
// 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());
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader.c_str());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 rpDesc;
|
utils::ComboRenderPipelineDescriptor rpDesc;
|
||||||
rpDesc.vertex.module = vsModule;
|
rpDesc.vertex.module = vsModule;
|
||||||
rpDesc.cFragment.module = fsModule;
|
rpDesc.cFragment.module = fsModule;
|
||||||
rpDesc.vertex.bufferCount = 1;
|
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[0].format = wgpu::VertexFormat::Float32x3;
|
||||||
rpDesc.cAttributes[1].shaderLocation = 1;
|
rpDesc.cAttributes[1].shaderLocation = 1;
|
||||||
rpDesc.cAttributes[1].format = wgpu::VertexFormat::Float32x4;
|
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.
|
// 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());
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader.c_str());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 rpDesc;
|
utils::ComboRenderPipelineDescriptor rpDesc;
|
||||||
rpDesc.vertex.module = vsModule;
|
rpDesc.vertex.module = vsModule;
|
||||||
rpDesc.cFragment.module = fsModule;
|
rpDesc.cFragment.module = fsModule;
|
||||||
rpDesc.vertex.bufferCount = 1;
|
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[0].format = wgpu::VertexFormat::Float32x3;
|
||||||
rpDesc.cAttributes[1].shaderLocation = 1;
|
rpDesc.cAttributes[1].shaderLocation = 1;
|
||||||
rpDesc.cAttributes[1].format = wgpu::VertexFormat::Float32x4;
|
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.
|
// 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());
|
wgpu::ShaderModule shaderModule = utils::CreateShaderModule(device, shader.c_str());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 rpDesc;
|
utils::ComboRenderPipelineDescriptor rpDesc;
|
||||||
rpDesc.vertex.module = shaderModule;
|
rpDesc.vertex.module = shaderModule;
|
||||||
rpDesc.vertex.entryPoint = "vertexMain";
|
rpDesc.vertex.entryPoint = "vertexMain";
|
||||||
rpDesc.cFragment.module = shaderModule;
|
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[0].format = wgpu::VertexFormat::Float32x3;
|
||||||
rpDesc.cAttributes[1].shaderLocation = 1;
|
rpDesc.cAttributes[1].shaderLocation = 1;
|
||||||
rpDesc.cAttributes[1].format = wgpu::VertexFormat::Float32x4;
|
rpDesc.cAttributes[1].format = wgpu::VertexFormat::Float32x4;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&rpDesc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&rpDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(ShaderTests,
|
DAWN_INSTANTIATE_TEST(ShaderTests,
|
||||||
|
|
|
@ -474,12 +474,12 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vertexShader);
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, vertexShader);
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader);
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
desc.vertex.module = vsModule;
|
desc.vertex.module = vsModule;
|
||||||
desc.cFragment.module = fsModule;
|
desc.cFragment.module = fsModule;
|
||||||
desc.cTargets[0].format = kRenderAttachmentFormat;
|
desc.cTargets[0].format = kRenderAttachmentFormat;
|
||||||
desc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
desc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
return device.CreateRenderPipeline2(&desc);
|
return device.CreateRenderPipeline(&desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckDrawsGreen(const char* vertexShader,
|
void CheckDrawsGreen(const char* vertexShader,
|
||||||
|
|
|
@ -220,7 +220,7 @@ TEST_P(SwapChainValidationTests, ViewDestroyedAfterPresent) {
|
||||||
|
|
||||||
// Check that returned view is of the current format / usage / dimension / size / sample count
|
// Check that returned view is of the current format / usage / dimension / size / sample count
|
||||||
TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) {
|
TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) {
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
utils::ComboRenderPipelineDescriptor pipelineDesc;
|
||||||
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
|
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
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.
|
// Validation will check that the format of the view matches this format.
|
||||||
pipelineDesc.cTargets[0].format = wgpu::TextureFormat::BGRA8Unorm;
|
pipelineDesc.cTargets[0].format = wgpu::TextureFormat::BGRA8Unorm;
|
||||||
pipelineDesc.cTargets[1].format = wgpu::TextureFormat::R8Unorm;
|
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
|
// 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.
|
// size of the view matches the size of this texture.
|
||||||
|
|
|
@ -140,7 +140,7 @@ class TextureFormatTest : public DawnTest {
|
||||||
// bindgroup and output its decompressed values to the render target.
|
// bindgroup and output its decompressed values to the render target.
|
||||||
wgpu::RenderPipeline CreateSamplePipeline(FormatTestInfo sampleFormatInfo,
|
wgpu::RenderPipeline CreateSamplePipeline(FormatTestInfo sampleFormatInfo,
|
||||||
FormatTestInfo renderFormatInfo) {
|
FormatTestInfo renderFormatInfo) {
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
|
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]]
|
[[stage(vertex)]]
|
||||||
|
@ -174,7 +174,7 @@ class TextureFormatTest : public DawnTest {
|
||||||
desc.cFragment.module = fsModule;
|
desc.cFragment.module = fsModule;
|
||||||
desc.cTargets[0].format = renderFormatInfo.format;
|
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.
|
// The sampling test uploads the sample data in a texture with the sampleFormatInfo.format.
|
||||||
|
|
|
@ -65,13 +65,13 @@ class TextureSubresourceTest : public DawnTest {
|
||||||
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||||
descriptor.cTargets[0].format = kFormat;
|
descriptor.cTargets[0].format = kFormat;
|
||||||
|
|
||||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
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));
|
return textureSample(tex, samp, FragCoord.xy / vec2<f32>(4.0, 4.0));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||||
|
@ -117,7 +117,7 @@ class TextureSubresourceTest : public DawnTest {
|
||||||
|
|
||||||
wgpu::Sampler sampler = device.CreateSampler();
|
wgpu::Sampler sampler = device.CreateSampler();
|
||||||
|
|
||||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&descriptor);
|
||||||
wgpu::BindGroupLayout bgl = rp.GetBindGroupLayout(0);
|
wgpu::BindGroupLayout bgl = rp.GetBindGroupLayout(0);
|
||||||
wgpu::BindGroup bindGroup =
|
wgpu::BindGroup bindGroup =
|
||||||
utils::MakeBindGroup(device, bgl, {{0, sampler}, {1, samplerView}});
|
utils::MakeBindGroup(device, bgl, {{0, sampler}, {1, samplerView}});
|
||||||
|
|
|
@ -170,12 +170,12 @@ class TextureViewSamplingTest : public DawnTest {
|
||||||
void Verify(const wgpu::TextureView& textureView, const char* fragmentShader, int expected) {
|
void Verify(const wgpu::TextureView& textureView, const char* fragmentShader, int expected) {
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader);
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 textureDescriptor;
|
utils::ComboRenderPipelineDescriptor textureDescriptor;
|
||||||
textureDescriptor.vertex.module = mVSModule;
|
textureDescriptor.vertex.module = mVSModule;
|
||||||
textureDescriptor.cFragment.module = fsModule;
|
textureDescriptor.cFragment.module = fsModule;
|
||||||
textureDescriptor.cTargets[0].format = mRenderPass.colorFormat;
|
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),
|
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
||||||
{{0, mSampler}, {1, textureView}});
|
{{0, mSampler}, {1, textureView}});
|
||||||
|
@ -503,12 +503,12 @@ class TextureViewRenderingTest : public DawnTest {
|
||||||
wgpu::ShaderModule oneColorFsModule =
|
wgpu::ShaderModule oneColorFsModule =
|
||||||
utils::CreateShaderModule(device, oneColorFragmentShader);
|
utils::CreateShaderModule(device, oneColorFragmentShader);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = oneColorFsModule;
|
pipelineDescriptor.cFragment.module = oneColorFsModule;
|
||||||
pipelineDescriptor.cTargets[0].format = kDefaultFormat;
|
pipelineDescriptor.cTargets[0].format = kDefaultFormat;
|
||||||
|
|
||||||
wgpu::RenderPipeline oneColorPipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
wgpu::RenderPipeline oneColorPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,7 +66,7 @@ class TextureZeroInitTest : public DawnTest {
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
wgpu::RenderPipeline CreatePipelineForTest(float depth = 0.f) {
|
wgpu::RenderPipeline CreatePipelineForTest(float depth = 0.f) {
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest(depth);
|
pipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest(depth);
|
||||||
const char* fs = R"(
|
const char* fs = R"(
|
||||||
;
|
;
|
||||||
|
@ -79,7 +79,7 @@ class TextureZeroInitTest : public DawnTest {
|
||||||
depthStencil->depthCompare = wgpu::CompareFunction::Equal;
|
depthStencil->depthCompare = wgpu::CompareFunction::Equal;
|
||||||
depthStencil->stencilFront.compare = wgpu::CompareFunction::Equal;
|
depthStencil->stencilFront.compare = wgpu::CompareFunction::Equal;
|
||||||
|
|
||||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
wgpu::ShaderModule CreateBasicVertexShaderForTest(float depth = 0.f) {
|
wgpu::ShaderModule CreateBasicVertexShaderForTest(float depth = 0.f) {
|
||||||
std::string source = R"(
|
std::string source = R"(
|
||||||
|
@ -857,11 +857,11 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
|
||||||
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
||||||
|
|
||||||
// Create render pipeline
|
// Create render pipeline
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
|
||||||
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
||||||
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
||||||
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
||||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||||
|
|
||||||
// Create bindgroup
|
// Create bindgroup
|
||||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
||||||
|
@ -916,11 +916,11 @@ TEST_P(TextureZeroInitTest, TextureBothSampledAndAttachmentClear) {
|
||||||
wgpu::TextureView sampleView = texture.CreateView(&viewDesc);
|
wgpu::TextureView sampleView = texture.CreateView(&viewDesc);
|
||||||
|
|
||||||
// Create render pipeline
|
// Create render pipeline
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
|
||||||
renderPipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
renderPipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
||||||
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
||||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||||
|
|
||||||
wgpu::BindGroup bindGroup =
|
wgpu::BindGroup bindGroup =
|
||||||
utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0), {{0, sampleView}});
|
utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0), {{0, sampleView}});
|
||||||
|
@ -1142,11 +1142,11 @@ TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) {
|
||||||
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
|
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
|
||||||
|
|
||||||
// Create render pipeline
|
// Create render pipeline
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
|
||||||
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
||||||
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
||||||
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
||||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||||
|
|
||||||
// Create bindgroup
|
// Create bindgroup
|
||||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
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));
|
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
|
||||||
|
|
||||||
// Create render pipeline
|
// Create render pipeline
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
|
||||||
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
||||||
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
||||||
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
||||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||||
|
|
||||||
// Create bindgroup
|
// Create bindgroup
|
||||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
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));
|
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
|
||||||
|
|
||||||
// Create render pipeline
|
// Create render pipeline
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
|
||||||
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
||||||
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
||||||
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
||||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||||
|
|
||||||
// Only sample from the uninitialized first layer.
|
// Only sample from the uninitialized first layer.
|
||||||
wgpu::TextureViewDescriptor textureViewDescriptor;
|
wgpu::TextureViewDescriptor textureViewDescriptor;
|
||||||
|
@ -1789,12 +1789,12 @@ class CompressedTextureZeroInitTest : public TextureZeroInitTest {
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
|
||||||
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
||||||
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
||||||
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
||||||
wgpu::RenderPipeline renderPipeline =
|
wgpu::RenderPipeline renderPipeline =
|
||||||
device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||||
pass.SetPipeline(renderPipeline);
|
pass.SetPipeline(renderPipeline);
|
||||||
|
|
||||||
wgpu::TextureViewDescriptor textureViewDescriptor = CreateTextureViewDescriptor(
|
wgpu::TextureViewDescriptor textureViewDescriptor = CreateTextureViewDescriptor(
|
||||||
|
|
|
@ -63,7 +63,7 @@ class VertexBufferRobustnessTest : public DawnTest {
|
||||||
|
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
|
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
|
@ -72,7 +72,7 @@ class VertexBufferRobustnessTest : public DawnTest {
|
||||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
renderPass.renderPassInfo.cColorAttachments[0].clearColor = {0, 0, 0, 1};
|
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::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||||
|
|
|
@ -362,7 +362,7 @@ class VertexFormatTest : public DawnTest {
|
||||||
strideBytes += (4 - strideBytes % 4);
|
strideBytes += (4 - strideBytes % 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.vertex.bufferCount = 1;
|
descriptor.vertex.bufferCount = 1;
|
||||||
|
@ -371,7 +371,7 @@ class VertexFormatTest : public DawnTest {
|
||||||
descriptor.cAttributes[0].format = format;
|
descriptor.cAttributes[0].format = format;
|
||||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
return device.CreateRenderPipeline2(&descriptor);
|
return device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VertexType, typename ExpectedType>
|
template <typename VertexType, typename ExpectedType>
|
||||||
|
|
|
@ -66,7 +66,7 @@ class VertexStateTest : public DawnTest {
|
||||||
VertexFormat format;
|
VertexFormat format;
|
||||||
InputStepMode step;
|
InputStepMode step;
|
||||||
};
|
};
|
||||||
wgpu::RenderPipeline MakeTestPipeline(const wgpu::VertexStateDescriptor& vertexState,
|
wgpu::RenderPipeline MakeTestPipeline(const utils::ComboVertexStateDescriptor& vertexState,
|
||||||
int multiplier,
|
int multiplier,
|
||||||
const std::vector<ShaderTestSpec>& testSpec) {
|
const std::vector<ShaderTestSpec>& testSpec) {
|
||||||
std::ostringstream vs;
|
std::ostringstream vs;
|
||||||
|
@ -144,14 +144,14 @@ class VertexStateTest : public DawnTest {
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.vertex.bufferCount = vertexState.vertexBufferCount;
|
descriptor.vertex.bufferCount = vertexState.vertexBufferCount;
|
||||||
descriptor.vertex.buffers = vertexState.vertexBuffers;
|
descriptor.vertex.buffers = &vertexState.cVertexBuffers[0];
|
||||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
return device.CreateRenderPipeline2(&descriptor);
|
return device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct VertexAttributeSpec {
|
struct VertexAttributeSpec {
|
||||||
|
@ -580,7 +580,7 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) {
|
||||||
wgpu::Buffer vertexBuffer =
|
wgpu::Buffer vertexBuffer =
|
||||||
utils::CreateBufferFromData(device, &data, sizeof(data), wgpu::BufferUsage::Vertex);
|
utils::CreateBufferFromData(device, &data, sizeof(data), wgpu::BufferUsage::Vertex);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
utils::ComboRenderPipelineDescriptor pipelineDesc;
|
||||||
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
|
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
|
||||||
struct VertexIn {
|
struct VertexIn {
|
||||||
[[location(0)]] attr0 : vec4<f32>;
|
[[location(0)]] attr0 : vec4<f32>;
|
||||||
|
@ -623,7 +623,7 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) {
|
||||||
pipelineDesc.cTargets[0].format = renderPass.colorFormat;
|
pipelineDesc.cTargets[0].format = renderPass.colorFormat;
|
||||||
pipelineDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
pipelineDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDesc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc);
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
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);
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
descriptor.vertex.bufferCount = 0;
|
descriptor.vertex.bufferCount = 0;
|
||||||
descriptor.vertex.buffers = nullptr;
|
descriptor.vertex.buffers = nullptr;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,13 +33,13 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) {
|
||||||
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,11 +57,11 @@ class ViewportTest : public DawnTest {
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
bool doViewportCall = true) {
|
bool doViewportCall = true) {
|
||||||
// Create a pipeline that will draw a white quad.
|
// Create a pipeline that will draw a white quad.
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
utils::ComboRenderPipelineDescriptor pipelineDesc;
|
||||||
pipelineDesc.vertex.module = mQuadVS;
|
pipelineDesc.vertex.module = mQuadVS;
|
||||||
pipelineDesc.cFragment.module = mQuadFS;
|
pipelineDesc.cFragment.module = mQuadFS;
|
||||||
pipelineDesc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
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.
|
// Render the quad with the viewport call.
|
||||||
utils::BasicRenderPass rp = utils::CreateBasicRenderPass(device, kWidth, kHeight);
|
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) {
|
void TestViewportDepth(float minDepth, float maxDepth, bool doViewportCall = true) {
|
||||||
// Create a pipeline drawing 3 points at depth 1.0, 0.5 and 0.0.
|
// 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"(
|
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
|
||||||
let points : array<vec3<f32>, 3> = array<vec3<f32>, 3>(
|
let points : array<vec3<f32>, 3> = array<vec3<f32>, 3>(
|
||||||
vec3<f32>(-0.9, 0.0, 1.0),
|
vec3<f32>(-0.9, 0.0, 1.0),
|
||||||
|
@ -108,7 +108,7 @@ class ViewportTest : public DawnTest {
|
||||||
wgpu::DepthStencilState* depthStencil =
|
wgpu::DepthStencilState* depthStencil =
|
||||||
pipelineDesc.EnableDepthStencil(wgpu::TextureFormat::Depth32Float);
|
pipelineDesc.EnableDepthStencil(wgpu::TextureFormat::Depth32Float);
|
||||||
depthStencil->depthWriteEnabled = true;
|
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.
|
// Create the texture that will store the post-viewport-transform depth.
|
||||||
wgpu::TextureDescriptor depthDesc;
|
wgpu::TextureDescriptor depthDesc;
|
||||||
|
@ -182,11 +182,11 @@ TEST_P(ViewportTest, ViewportDepth) {
|
||||||
|
|
||||||
// Test that a draw with an empty viewport doesn't draw anything.
|
// Test that a draw with an empty viewport doesn't draw anything.
|
||||||
TEST_P(ViewportTest, EmptyViewport) {
|
TEST_P(ViewportTest, EmptyViewport) {
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
pipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
pipelineDescriptor.vertex.module = mQuadVS;
|
pipelineDescriptor.vertex.module = mQuadVS;
|
||||||
pipelineDescriptor.cFragment.module = mQuadFS;
|
pipelineDescriptor.cFragment.module = mQuadFS;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
|
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
|
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
|
||||||
|
|
||||||
|
|
|
@ -347,7 +347,7 @@ void DrawCallPerf::SetUp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the base render pipeline descriptor.
|
// Setup the base render pipeline descriptor.
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
|
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
|
||||||
renderPipelineDesc.vertex.bufferCount = 1;
|
renderPipelineDesc.vertex.bufferCount = 1;
|
||||||
renderPipelineDesc.cBuffers[0].arrayStride = 4 * sizeof(float);
|
renderPipelineDesc.cBuffers[0].arrayStride = 4 * sizeof(float);
|
||||||
renderPipelineDesc.cBuffers[0].attributeCount = 1;
|
renderPipelineDesc.cBuffers[0].attributeCount = 1;
|
||||||
|
@ -369,7 +369,7 @@ void DrawCallPerf::SetUp() {
|
||||||
renderPipelineDesc.layout = pipelineLayout;
|
renderPipelineDesc.layout = pipelineLayout;
|
||||||
renderPipelineDesc.vertex.module = vsModule;
|
renderPipelineDesc.vertex.module = vsModule;
|
||||||
renderPipelineDesc.cFragment.module = fsModule;
|
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 the test is using a dynamic pipeline, create the second pipeline.
|
||||||
if (GetParam().pipelineType == Pipeline::Dynamic) {
|
if (GetParam().pipelineType == Pipeline::Dynamic) {
|
||||||
|
@ -396,7 +396,7 @@ void DrawCallPerf::SetUp() {
|
||||||
// Create the pipeline.
|
// Create the pipeline.
|
||||||
renderPipelineDesc.layout = pipelineLayout;
|
renderPipelineDesc.layout = pipelineLayout;
|
||||||
renderPipelineDesc.cFragment.module = fsModule;
|
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.
|
// Create the buffer and bind group to bind to the constant bind group layout slot.
|
||||||
constexpr float kConstantData[] = {0.01, 0.02, 0.03};
|
constexpr float kConstantData[] = {0.01, 0.02, 0.03};
|
||||||
|
|
|
@ -68,7 +68,7 @@ class SubresourceTrackingPerf : public DawnPerfTestWithParams<SubresourceTrackin
|
||||||
uploadTexDesc.usage = wgpu::TextureUsage::CopySrc;
|
uploadTexDesc.usage = wgpu::TextureUsage::CopySrc;
|
||||||
mUploadTexture = device.CreateTexture(&uploadTexDesc);
|
mUploadTexture = device.CreateTexture(&uploadTexDesc);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
utils::ComboRenderPipelineDescriptor pipelineDesc;
|
||||||
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
|
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
[[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
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);
|
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
mPipeline = device.CreateRenderPipeline2(&pipelineDesc);
|
mPipeline = device.CreateRenderPipeline(&pipelineDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1101,13 +1101,13 @@ class SetBindGroupValidationTest : public ValidationTest {
|
||||||
[[stage(fragment)]] fn main() {
|
[[stage(fragment)]] fn main() {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
wgpu::PipelineLayout pipelineLayout =
|
wgpu::PipelineLayout pipelineLayout =
|
||||||
utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
||||||
pipelineDescriptor.layout = pipelineLayout;
|
pipelineDescriptor.layout = pipelineLayout;
|
||||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::ComputePipeline CreateComputePipeline() {
|
wgpu::ComputePipeline CreateComputePipeline() {
|
||||||
|
@ -1561,11 +1561,11 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest {
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, ss.str().c_str());
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, ss.str().c_str());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = mVsModule;
|
pipelineDescriptor.vertex.module = mVsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.layout = pipelineLayout;
|
pipelineDescriptor.layout = pipelineLayout;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
|
|
||||||
return std::make_tuple(bindGroupLayouts, pipeline);
|
return std::make_tuple(bindGroupLayouts, pipeline);
|
||||||
}
|
}
|
||||||
|
@ -1700,12 +1700,12 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
|
||||||
wgpu::PipelineLayoutDescriptor descriptor;
|
wgpu::PipelineLayoutDescriptor descriptor;
|
||||||
descriptor.bindGroupLayoutCount = bindGroupLayout.size();
|
descriptor.bindGroupLayoutCount = bindGroupLayout.size();
|
||||||
descriptor.bindGroupLayouts = bindGroupLayout.data();
|
descriptor.bindGroupLayouts = bindGroupLayout.data();
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
wgpu::PipelineLayout pipelineLayout = device.CreatePipelineLayout(&descriptor);
|
wgpu::PipelineLayout pipelineLayout = device.CreatePipelineLayout(&descriptor);
|
||||||
pipelineDescriptor.layout = pipelineLayout;
|
pipelineDescriptor.layout = pipelineLayout;
|
||||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::RenderPipeline CreateRenderPipeline(std::vector<wgpu::BindGroupLayout> bindGroupLayouts) {
|
wgpu::RenderPipeline CreateRenderPipeline(std::vector<wgpu::BindGroupLayout> bindGroupLayouts) {
|
||||||
|
@ -2070,13 +2070,13 @@ class ComparisonSamplerBindingTest : public ValidationTest {
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentSource);
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentSource);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
wgpu::PipelineLayout pipelineLayout =
|
wgpu::PipelineLayout pipelineLayout =
|
||||||
utils::MakeBasicPipelineLayout(device, bindGroupLayout);
|
utils::MakeBasicPipelineLayout(device, bindGroupLayout);
|
||||||
pipelineDescriptor.layout = pipelineLayout;
|
pipelineDescriptor.layout = pipelineLayout;
|
||||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,12 @@ class DrawIndirectValidationTest : public ValidationTest {
|
||||||
// Set up render pipeline
|
// Set up render pipeline
|
||||||
wgpu::PipelineLayout pipelineLayout = utils::MakeBasicPipelineLayout(device, nullptr);
|
wgpu::PipelineLayout pipelineLayout = utils::MakeBasicPipelineLayout(device, nullptr);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = pipelineLayout;
|
descriptor.layout = pipelineLayout;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValidateExpectation(wgpu::CommandEncoder encoder, utils::Expectation expectation) {
|
void ValidateExpectation(wgpu::CommandEncoder encoder, utils::Expectation expectation) {
|
||||||
|
|
|
@ -27,12 +27,12 @@ class GetBindGroupLayoutTests : public ValidationTest {
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, shader);
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, shader);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
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;
|
var pos_s : mat4x4<f32> = storage3.pos;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
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.
|
// The same value is returned for the same index.
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), pipeline.GetBindGroupLayout(0).Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||||
|
@ -491,12 +491,12 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
|
||||||
var pos : vec4<f32> = uniforms.pos;
|
var pos : vec4<f32> = uniforms.pos;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
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.
|
// 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;
|
binding.buffer.minBindingSize = 64;
|
||||||
wgpu::BindGroupLayout bgl64 = device.CreateBindGroupLayout(&desc);
|
wgpu::BindGroupLayout bgl64 = device.CreateBindGroupLayout(&desc);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
|
|
||||||
// Check with both stages using 4 bytes.
|
// Check with both stages using 4 bytes.
|
||||||
{
|
{
|
||||||
descriptor.vertex.module = vsModule4;
|
descriptor.vertex.module = vsModule4;
|
||||||
descriptor.cFragment.module = fsModule4;
|
descriptor.cFragment.module = fsModule4;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl4.Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl4.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
||||||
{
|
{
|
||||||
descriptor.vertex.module = vsModule64;
|
descriptor.vertex.module = vsModule64;
|
||||||
descriptor.cFragment.module = fsModule4;
|
descriptor.cFragment.module = fsModule4;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl64.Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl64.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,7 +586,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
||||||
{
|
{
|
||||||
descriptor.vertex.module = vsModule4;
|
descriptor.vertex.module = vsModule4;
|
||||||
descriptor.cFragment.module = fsModule64;
|
descriptor.cFragment.module = fsModule64;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl64.Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bgl64.Get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -629,14 +629,14 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
||||||
desc.entryCount = 1;
|
desc.entryCount = 1;
|
||||||
desc.entries = &binding;
|
desc.entries = &binding;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
|
|
||||||
// Check with only the vertex shader using the sampler
|
// Check with only the vertex shader using the sampler
|
||||||
{
|
{
|
||||||
descriptor.vertex.module = vsModuleSampler;
|
descriptor.vertex.module = vsModuleSampler;
|
||||||
descriptor.cFragment.module = fsModuleNoSampler;
|
descriptor.cFragment.module = fsModuleNoSampler;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
binding.visibility = wgpu::ShaderStage::Vertex;
|
binding.visibility = wgpu::ShaderStage::Vertex;
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
|
||||||
|
@ -646,7 +646,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
||||||
{
|
{
|
||||||
descriptor.vertex.module = vsModuleNoSampler;
|
descriptor.vertex.module = vsModuleNoSampler;
|
||||||
descriptor.cFragment.module = fsModuleSampler;
|
descriptor.cFragment.module = fsModuleSampler;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
binding.visibility = wgpu::ShaderStage::Fragment;
|
binding.visibility = wgpu::ShaderStage::Fragment;
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
|
||||||
|
@ -656,7 +656,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
||||||
{
|
{
|
||||||
descriptor.vertex.module = vsModuleSampler;
|
descriptor.vertex.module = vsModuleSampler;
|
||||||
descriptor.cFragment.module = fsModuleSampler;
|
descriptor.cFragment.module = fsModuleSampler;
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
binding.visibility = wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Vertex;
|
binding.visibility = wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Vertex;
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get());
|
||||||
|
@ -686,12 +686,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
|
||||||
var pos : vec4<f32> = ssbo.pos;
|
var pos : vec4<f32> = ssbo.pos;
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
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.
|
// Test it is invalid to have conflicting binding texture multisampling in the shaders.
|
||||||
|
@ -711,12 +711,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) {
|
||||||
textureDimensions(myTexture);
|
textureDimensions(myTexture);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
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.
|
// Test it is invalid to have conflicting binding texture dimension in the shaders.
|
||||||
|
@ -736,12 +736,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) {
|
||||||
textureDimensions(myTexture);
|
textureDimensions(myTexture);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
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.
|
// Test it is invalid to have conflicting binding texture component type in the shaders.
|
||||||
|
@ -761,12 +761,12 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) {
|
||||||
textureDimensions(myTexture);
|
textureDimensions(myTexture);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
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.
|
// 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() {
|
[[stage(fragment)]] fn main() {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
utils::ComboRenderPipelineDescriptor pipelineDesc;
|
||||||
pipelineDesc.layout = pipelineLayout;
|
pipelineDesc.layout = pipelineLayout;
|
||||||
pipelineDesc.vertex.module = vsModule;
|
pipelineDesc.vertex.module = vsModule;
|
||||||
pipelineDesc.cFragment.module = fsModule;
|
pipelineDesc.cFragment.module = fsModule;
|
||||||
|
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDesc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc);
|
||||||
|
|
||||||
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bindGroupLayout.Get());
|
EXPECT_EQ(pipeline.GetBindGroupLayout(0).Get(), bindGroupLayout.Get());
|
||||||
|
|
||||||
|
|
|
@ -32,14 +32,14 @@ class IndexBufferValidationTest : public ValidationTest {
|
||||||
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = primitiveTopology;
|
descriptor.primitive.topology = primitiveTopology;
|
||||||
descriptor.primitive.stripIndexFormat = format;
|
descriptor.primitive.stripIndexFormat = format;
|
||||||
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
return device.CreateRenderPipeline2(&descriptor);
|
return device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ class MinBufferSizeTestsBase : public ValidationTest {
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragShader.c_str());
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragShader.c_str());
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.layout = nullptr;
|
pipelineDescriptor.layout = nullptr;
|
||||||
|
@ -203,7 +203,7 @@ class MinBufferSizeTestsBase : public ValidationTest {
|
||||||
pipelineDescriptor.layout = device.CreatePipelineLayout(&descriptor);
|
pipelineDescriptor.layout = device.CreatePipelineLayout(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates render pipeline with default layout
|
// Creates render pipeline with default layout
|
||||||
|
|
|
@ -184,7 +184,7 @@ namespace {
|
||||||
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
return vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
device.CreateRenderPipelineAsync(&descriptor, callback, &callbackData);
|
device.CreateRenderPipelineAsync(&descriptor, callback, &callbackData);
|
||||||
|
|
|
@ -66,9 +66,9 @@ namespace {
|
||||||
|
|
||||||
pipelineLayout = device.CreatePipelineLayout(&pipelineLayoutDesc);
|
pipelineLayout = device.CreatePipelineLayout(&pipelineLayoutDesc);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
InitializeRenderPipelineDescriptor(&descriptor);
|
InitializeRenderPipelineDescriptor(&descriptor);
|
||||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
float data[8];
|
float data[8];
|
||||||
wgpu::Buffer buffer = utils::CreateBufferFromData(device, data, 8 * sizeof(float),
|
wgpu::Buffer buffer = utils::CreateBufferFromData(device, data, 8 * sizeof(float),
|
||||||
|
@ -98,7 +98,7 @@ namespace {
|
||||||
{1, vertexStorageBuffer, 0, sizeof(kVertices)}});
|
{1, vertexStorageBuffer, 0, sizeof(kVertices)}});
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeRenderPipelineDescriptor(utils::ComboRenderPipelineDescriptor2* descriptor) {
|
void InitializeRenderPipelineDescriptor(utils::ComboRenderPipelineDescriptor* descriptor) {
|
||||||
descriptor->layout = pipelineLayout;
|
descriptor->layout = pipelineLayout;
|
||||||
descriptor->vertex.module = vsModule;
|
descriptor->vertex.module = vsModule;
|
||||||
descriptor->cFragment.module = fsModule;
|
descriptor->cFragment.module = fsModule;
|
||||||
|
@ -729,7 +729,7 @@ TEST_F(RenderBundleValidationTest, PipelineColorFormatMismatch) {
|
||||||
renderBundleDesc.cColorFormats[1] = wgpu::TextureFormat::RG16Float;
|
renderBundleDesc.cColorFormats[1] = wgpu::TextureFormat::RG16Float;
|
||||||
renderBundleDesc.cColorFormats[2] = wgpu::TextureFormat::R16Sint;
|
renderBundleDesc.cColorFormats[2] = wgpu::TextureFormat::R16Sint;
|
||||||
|
|
||||||
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor2* desc) {
|
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor* desc) {
|
||||||
InitializeRenderPipelineDescriptor(desc);
|
InitializeRenderPipelineDescriptor(desc);
|
||||||
desc->cFragment.targetCount = 3;
|
desc->cFragment.targetCount = 3;
|
||||||
desc->cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
desc->cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
@ -739,38 +739,38 @@ TEST_F(RenderBundleValidationTest, PipelineColorFormatMismatch) {
|
||||||
|
|
||||||
// Test the success case.
|
// Test the success case.
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
SetupRenderPipelineDescForTest(&desc);
|
SetupRenderPipelineDescForTest(&desc);
|
||||||
|
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
renderBundleEncoder.Finish();
|
renderBundleEncoder.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the failure case for mismatched format types.
|
// Test the failure case for mismatched format types.
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
SetupRenderPipelineDescForTest(&desc);
|
SetupRenderPipelineDescForTest(&desc);
|
||||||
desc.cTargets[1].format = wgpu::TextureFormat::RGBA8Unorm;
|
desc.cTargets[1].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the failure case for missing format
|
// Test the failure case for missing format
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
SetupRenderPipelineDescForTest(&desc);
|
SetupRenderPipelineDescForTest(&desc);
|
||||||
desc.cFragment.targetCount = 2;
|
desc.cFragment.targetCount = 2;
|
||||||
|
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
||||||
}
|
}
|
||||||
|
@ -783,7 +783,7 @@ TEST_F(RenderBundleValidationTest, PipelineDepthStencilFormatMismatch) {
|
||||||
renderBundleDesc.cColorFormats[0] = wgpu::TextureFormat::RGBA8Unorm;
|
renderBundleDesc.cColorFormats[0] = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
renderBundleDesc.depthStencilFormat = wgpu::TextureFormat::Depth24PlusStencil8;
|
renderBundleDesc.depthStencilFormat = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||||
|
|
||||||
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor2* desc) {
|
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor* desc) {
|
||||||
InitializeRenderPipelineDescriptor(desc);
|
InitializeRenderPipelineDescriptor(desc);
|
||||||
desc->cFragment.targetCount = 1;
|
desc->cFragment.targetCount = 1;
|
||||||
desc->cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
desc->cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
@ -791,39 +791,39 @@ TEST_F(RenderBundleValidationTest, PipelineDepthStencilFormatMismatch) {
|
||||||
|
|
||||||
// Test the success case.
|
// Test the success case.
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
SetupRenderPipelineDescForTest(&desc);
|
SetupRenderPipelineDescForTest(&desc);
|
||||||
desc.EnableDepthStencil(wgpu::TextureFormat::Depth24PlusStencil8);
|
desc.EnableDepthStencil(wgpu::TextureFormat::Depth24PlusStencil8);
|
||||||
|
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
renderBundleEncoder.Finish();
|
renderBundleEncoder.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the failure case for mismatched format.
|
// Test the failure case for mismatched format.
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
SetupRenderPipelineDescForTest(&desc);
|
SetupRenderPipelineDescForTest(&desc);
|
||||||
desc.EnableDepthStencil(wgpu::TextureFormat::Depth24Plus);
|
desc.EnableDepthStencil(wgpu::TextureFormat::Depth24Plus);
|
||||||
|
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the failure case for missing format.
|
// Test the failure case for missing format.
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
SetupRenderPipelineDescForTest(&desc);
|
SetupRenderPipelineDescForTest(&desc);
|
||||||
desc.depthStencil = nullptr;
|
desc.depthStencil = nullptr;
|
||||||
|
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
||||||
}
|
}
|
||||||
|
@ -836,7 +836,7 @@ TEST_F(RenderBundleValidationTest, PipelineSampleCountMismatch) {
|
||||||
renderBundleDesc.cColorFormats[0] = wgpu::TextureFormat::RGBA8Unorm;
|
renderBundleDesc.cColorFormats[0] = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
renderBundleDesc.sampleCount = 4;
|
renderBundleDesc.sampleCount = 4;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
|
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
|
||||||
InitializeRenderPipelineDescriptor(&renderPipelineDesc);
|
InitializeRenderPipelineDescriptor(&renderPipelineDesc);
|
||||||
renderPipelineDesc.cFragment.targetCount = 1;
|
renderPipelineDesc.cFragment.targetCount = 1;
|
||||||
renderPipelineDesc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
renderPipelineDesc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
@ -846,7 +846,7 @@ TEST_F(RenderBundleValidationTest, PipelineSampleCountMismatch) {
|
||||||
{
|
{
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
renderBundleEncoder.Finish();
|
renderBundleEncoder.Finish();
|
||||||
}
|
}
|
||||||
|
@ -857,7 +857,7 @@ TEST_F(RenderBundleValidationTest, PipelineSampleCountMismatch) {
|
||||||
|
|
||||||
wgpu::RenderBundleEncoder renderBundleEncoder =
|
wgpu::RenderBundleEncoder renderBundleEncoder =
|
||||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
|
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
|
||||||
renderBundleEncoder.SetPipeline(pipeline);
|
renderBundleEncoder.SetPipeline(pipeline);
|
||||||
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
ASSERT_DEVICE_ERROR(renderBundleEncoder.Finish());
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,36 +45,11 @@ class RenderPipelineValidationTest : public ValidationTest {
|
||||||
TEST_F(RenderPipelineValidationTest, CreationSuccess) {
|
TEST_F(RenderPipelineValidationTest, CreationSuccess) {
|
||||||
{
|
{
|
||||||
// New format
|
// New format
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,49 +57,49 @@ TEST_F(RenderPipelineValidationTest, CreationSuccess) {
|
||||||
TEST_F(RenderPipelineValidationTest, DepthBiasParameterNotBeNaN) {
|
TEST_F(RenderPipelineValidationTest, DepthBiasParameterNotBeNaN) {
|
||||||
// Control case, depth bias parameters in ComboRenderPipeline default to 0 which is finite
|
// Control case, depth bias parameters in ComboRenderPipeline default to 0 which is finite
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.EnableDepthStencil();
|
descriptor.EnableDepthStencil();
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Infinite depth bias clamp is valid
|
// Infinite depth bias clamp is valid
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
||||||
depthStencil->depthBiasClamp = INFINITY;
|
depthStencil->depthBiasClamp = INFINITY;
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
// NAN depth bias clamp is invalid
|
// NAN depth bias clamp is invalid
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
||||||
depthStencil->depthBiasClamp = NAN;
|
depthStencil->depthBiasClamp = NAN;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Infinite depth bias slope is valid
|
// Infinite depth bias slope is valid
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
||||||
depthStencil->depthBiasSlopeScale = INFINITY;
|
depthStencil->depthBiasSlopeScale = INFINITY;
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
// NAN depth bias slope is invalid
|
// NAN depth bias slope is invalid
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
||||||
depthStencil->depthBiasSlopeScale = NAN;
|
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) {
|
TEST_F(RenderPipelineValidationTest, ColorTargetStateRequired) {
|
||||||
{
|
{
|
||||||
// This one succeeds because attachment 0 is the color attachment
|
// This one succeeds because attachment 0 is the color attachment
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.cFragment.targetCount = 1;
|
descriptor.cFragment.targetCount = 1;
|
||||||
|
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Fail because lack of color target states (and depth/stencil state)
|
{ // Fail because lack of color target states (and depth/stencil state)
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.cFragment.targetCount = 0;
|
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) {
|
TEST_F(RenderPipelineValidationTest, NonRenderableFormat) {
|
||||||
{
|
{
|
||||||
// Succeeds because RGBA8Unorm is renderable
|
// Succeeds because RGBA8Unorm is renderable
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Fails because RG11B10Ufloat is non-renderable
|
// Fails because RG11B10Ufloat is non-renderable
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.cTargets[0].format = wgpu::TextureFormat::RG11B10Ufloat;
|
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 i = 0; i < kNumTextureFormatBaseType; ++i) {
|
||||||
for (size_t j = 0; j < kNumTextureFormatBaseType; ++j) {
|
for (size_t j = 0; j < kNumTextureFormatBaseType; ++j) {
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cTargets[0].format = kColorFormats[j];
|
descriptor.cTargets[0].format = kColorFormats[j];
|
||||||
|
|
||||||
|
@ -198,9 +173,9 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputFormatCompatibility) {
|
||||||
descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str());
|
descriptor.cFragment.module = utils::CreateShaderModule(device, stream.str().c_str());
|
||||||
|
|
||||||
if (i == j) {
|
if (i == j) {
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
} else {
|
} 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.
|
/// Tests that the sample count of the render pipeline must be valid.
|
||||||
TEST_F(RenderPipelineValidationTest, SampleCount) {
|
TEST_F(RenderPipelineValidationTest, SampleCount) {
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.multisample.count = 4;
|
descriptor.multisample.count = 4;
|
||||||
|
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.multisample.count = 3;
|
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.dimension = wgpu::TextureDimension::e2D;
|
||||||
baseTextureDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
baseTextureDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 nonMultisampledPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor nonMultisampledPipelineDescriptor;
|
||||||
nonMultisampledPipelineDescriptor.multisample.count = 1;
|
nonMultisampledPipelineDescriptor.multisample.count = 1;
|
||||||
nonMultisampledPipelineDescriptor.vertex.module = vsModule;
|
nonMultisampledPipelineDescriptor.vertex.module = vsModule;
|
||||||
nonMultisampledPipelineDescriptor.cFragment.module = fsModule;
|
nonMultisampledPipelineDescriptor.cFragment.module = fsModule;
|
||||||
wgpu::RenderPipeline nonMultisampledPipeline =
|
wgpu::RenderPipeline nonMultisampledPipeline =
|
||||||
device.CreateRenderPipeline2(&nonMultisampledPipelineDescriptor);
|
device.CreateRenderPipeline(&nonMultisampledPipelineDescriptor);
|
||||||
|
|
||||||
nonMultisampledPipelineDescriptor.cFragment.targetCount = 0;
|
nonMultisampledPipelineDescriptor.cFragment.targetCount = 0;
|
||||||
nonMultisampledPipelineDescriptor.EnableDepthStencil();
|
nonMultisampledPipelineDescriptor.EnableDepthStencil();
|
||||||
wgpu::RenderPipeline nonMultisampledPipelineWithDepthStencilOnly =
|
wgpu::RenderPipeline nonMultisampledPipelineWithDepthStencilOnly =
|
||||||
device.CreateRenderPipeline2(&nonMultisampledPipelineDescriptor);
|
device.CreateRenderPipeline(&nonMultisampledPipelineDescriptor);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 multisampledPipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor multisampledPipelineDescriptor;
|
||||||
multisampledPipelineDescriptor.multisample.count = kMultisampledCount;
|
multisampledPipelineDescriptor.multisample.count = kMultisampledCount;
|
||||||
multisampledPipelineDescriptor.vertex.module = vsModule;
|
multisampledPipelineDescriptor.vertex.module = vsModule;
|
||||||
multisampledPipelineDescriptor.cFragment.module = fsModule;
|
multisampledPipelineDescriptor.cFragment.module = fsModule;
|
||||||
wgpu::RenderPipeline multisampledPipeline =
|
wgpu::RenderPipeline multisampledPipeline =
|
||||||
device.CreateRenderPipeline2(&multisampledPipelineDescriptor);
|
device.CreateRenderPipeline(&multisampledPipelineDescriptor);
|
||||||
|
|
||||||
multisampledPipelineDescriptor.cFragment.targetCount = 0;
|
multisampledPipelineDescriptor.cFragment.targetCount = 0;
|
||||||
multisampledPipelineDescriptor.EnableDepthStencil();
|
multisampledPipelineDescriptor.EnableDepthStencil();
|
||||||
wgpu::RenderPipeline multisampledPipelineWithDepthStencilOnly =
|
wgpu::RenderPipeline multisampledPipelineWithDepthStencilOnly =
|
||||||
device.CreateRenderPipeline2(&multisampledPipelineDescriptor);
|
device.CreateRenderPipeline(&multisampledPipelineDescriptor);
|
||||||
|
|
||||||
// It is not allowed to use multisampled render pass and non-multisampled render pipeline.
|
// 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.
|
// when the alphaToCoverage mode is enabled.
|
||||||
TEST_F(RenderPipelineValidationTest, AlphaToCoverageAndSampleCount) {
|
TEST_F(RenderPipelineValidationTest, AlphaToCoverageAndSampleCount) {
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.multisample.count = 4;
|
descriptor.multisample.count = 4;
|
||||||
descriptor.multisample.alphaToCoverageEnabled = true;
|
descriptor.multisample.alphaToCoverageEnabled = true;
|
||||||
|
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.multisample.count = 1;
|
descriptor.multisample.count = 1;
|
||||||
descriptor.multisample.alphaToCoverageEnabled = true;
|
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 i = 0; i < kNumTextureComponentType; ++i) {
|
||||||
for (size_t j = 0; j < kNumTextureComponentType; ++j) {
|
for (size_t j = 0; j < kNumTextureComponentType; ++j) {
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
|
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
|
@ -421,9 +396,9 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
|
||||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
||||||
if (i == j) {
|
if (i == j) {
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
} else {
|
} 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 i = 0; i < kNumTextureViewDimensions; ++i) {
|
||||||
for (size_t j = 0; j < kNumTextureViewDimensions; ++j) {
|
for (size_t j = 0; j < kNumTextureViewDimensions; ++j) {
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
|
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
|
@ -470,9 +445,9 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
|
||||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
|
|
||||||
if (i == j) {
|
if (i == j) {
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
} else {
|
} else {
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -491,11 +466,11 @@ TEST_F(RenderPipelineValidationTest, StorageBufferInVertexShaderNoLayout) {
|
||||||
return vec4<f32>();
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertex.module = vsModuleWithStorageBuffer;
|
descriptor.vertex.module = vsModuleWithStorageBuffer;
|
||||||
descriptor.cFragment.module = fsModule;
|
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
|
// Tests that strip primitive topologies require an index format
|
||||||
|
@ -516,7 +491,7 @@ TEST_F(RenderPipelineValidationTest, StripIndexFormatRequired) {
|
||||||
|
|
||||||
for (wgpu::PrimitiveTopology primitiveTopology : kStripTopologyTypes) {
|
for (wgpu::PrimitiveTopology primitiveTopology : kStripTopologyTypes) {
|
||||||
for (wgpu::IndexFormat indexFormat : kIndexFormatTypes) {
|
for (wgpu::IndexFormat indexFormat : kIndexFormatTypes) {
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = primitiveTopology;
|
descriptor.primitive.topology = primitiveTopology;
|
||||||
|
@ -525,17 +500,17 @@ TEST_F(RenderPipelineValidationTest, StripIndexFormatRequired) {
|
||||||
if (indexFormat == wgpu::IndexFormat::Undefined) {
|
if (indexFormat == wgpu::IndexFormat::Undefined) {
|
||||||
// Fail because the index format is undefined and the primitive
|
// Fail because the index format is undefined and the primitive
|
||||||
// topology is a strip type.
|
// topology is a strip type.
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||||
} else {
|
} else {
|
||||||
// Succeeds because the index format is given.
|
// Succeeds because the index format is given.
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (wgpu::PrimitiveTopology primitiveTopology : kListTopologyTypes) {
|
for (wgpu::PrimitiveTopology primitiveTopology : kListTopologyTypes) {
|
||||||
for (wgpu::IndexFormat indexFormat : kIndexFormatTypes) {
|
for (wgpu::IndexFormat indexFormat : kIndexFormatTypes) {
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.primitive.topology = primitiveTopology;
|
descriptor.primitive.topology = primitiveTopology;
|
||||||
|
@ -544,9 +519,9 @@ TEST_F(RenderPipelineValidationTest, StripIndexFormatRequired) {
|
||||||
if (indexFormat == wgpu::IndexFormat::Undefined) {
|
if (indexFormat == wgpu::IndexFormat::Undefined) {
|
||||||
// Succeeds even when the index format is undefined because the
|
// Succeeds even when the index format is undefined because the
|
||||||
// primitive topology isn't a strip type.
|
// primitive topology isn't a strip type.
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
} else {
|
} 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 that specifying a clampDepth value results in an error if the feature is not enabled.
|
||||||
TEST_F(RenderPipelineValidationTest, ClampDepthWithoutExtension) {
|
TEST_F(RenderPipelineValidationTest, ClampDepthWithoutExtension) {
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
wgpu::PrimitiveDepthClampingState clampingState;
|
wgpu::PrimitiveDepthClampingState clampingState;
|
||||||
clampingState.clampDepth = true;
|
clampingState.clampDepth = true;
|
||||||
descriptor.primitive.nextInChain = &clampingState;
|
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.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
wgpu::PrimitiveDepthClampingState clampingState;
|
wgpu::PrimitiveDepthClampingState clampingState;
|
||||||
clampingState.clampDepth = false;
|
clampingState.clampDepth = false;
|
||||||
descriptor.primitive.nextInChain = &clampingState;
|
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 that depthStencil.depthCompare must not be undefiend.
|
||||||
TEST_F(RenderPipelineValidationTest, DepthCompareUndefinedIsError) {
|
TEST_F(RenderPipelineValidationTest, DepthCompareUndefinedIsError) {
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
descriptor.EnableDepthStencil(wgpu::TextureFormat::Depth32Float);
|
descriptor.EnableDepthStencil(wgpu::TextureFormat::Depth32Float);
|
||||||
|
|
||||||
// Control case: Always is valid.
|
// Control case: Always is valid.
|
||||||
descriptor.cDepthStencil.depthCompare = wgpu::CompareFunction::Always;
|
descriptor.cDepthStencil.depthCompare = wgpu::CompareFunction::Always;
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
// Error case: Undefined is invalid.
|
// Error case: Undefined is invalid.
|
||||||
descriptor.cDepthStencil.depthCompare = wgpu::CompareFunction::Undefined;
|
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.
|
// 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.module = module;
|
||||||
descriptor.vertex.entryPoint = "vertex_main";
|
descriptor.vertex.entryPoint = "vertex_main";
|
||||||
descriptor.cFragment.module = module;
|
descriptor.cFragment.module = module;
|
||||||
descriptor.cFragment.entryPoint = "fragment_main";
|
descriptor.cFragment.entryPoint = "fragment_main";
|
||||||
|
|
||||||
// Success case.
|
// Success case.
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
// Test for the vertex stage entryPoint name.
|
// Test for the vertex stage entryPoint name.
|
||||||
{
|
{
|
||||||
// The entryPoint name doesn't exist in the module.
|
// The entryPoint name doesn't exist in the module.
|
||||||
descriptor.vertex.entryPoint = "main";
|
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.
|
// The entryPoint name exists, but not for the correct stage.
|
||||||
descriptor.vertex.entryPoint = "fragment_main";
|
descriptor.vertex.entryPoint = "fragment_main";
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
descriptor.vertex.entryPoint = "vertex_main";
|
descriptor.vertex.entryPoint = "vertex_main";
|
||||||
|
@ -628,11 +603,11 @@ TEST_F(RenderPipelineValidationTest, EntryPointNameValidation) {
|
||||||
{
|
{
|
||||||
// The entryPoint name doesn't exist in the module.
|
// The entryPoint name doesn't exist in the module.
|
||||||
descriptor.cFragment.entryPoint = "main";
|
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.
|
// The entryPoint name exists, but not for the correct stage.
|
||||||
descriptor.cFragment.entryPoint = "vertex_main";
|
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.vertex.module = module;
|
||||||
descriptor.cFragment.module = fsModule;
|
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.
|
// Success cases, the attribute used by the entryPoint is declared in the pipeline.
|
||||||
descriptor.vertex.entryPoint = "vertex0";
|
descriptor.vertex.entryPoint = "vertex0";
|
||||||
descriptor.cAttributes[0].shaderLocation = 0;
|
descriptor.cAttributes[0].shaderLocation = 0;
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
descriptor.vertex.entryPoint = "vertex1";
|
descriptor.vertex.entryPoint = "vertex1";
|
||||||
descriptor.cAttributes[0].shaderLocation = 1;
|
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.
|
// Error cases, the attribute used by the entryPoint isn't declared in the pipeline.
|
||||||
descriptor.vertex.entryPoint = "vertex1";
|
descriptor.vertex.entryPoint = "vertex1";
|
||||||
descriptor.cAttributes[0].shaderLocation = 0;
|
descriptor.cAttributes[0].shaderLocation = 0;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||||
|
|
||||||
descriptor.vertex.entryPoint = "vertex0";
|
descriptor.vertex.entryPoint = "vertex0";
|
||||||
descriptor.cAttributes[0].shaderLocation = 1;
|
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
|
// 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.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = module;
|
descriptor.cFragment.module = module;
|
||||||
|
|
||||||
// Success case, the component type matches between the pipeline and the entryPoint
|
// Success case, the component type matches between the pipeline and the entryPoint
|
||||||
descriptor.cFragment.entryPoint = "fragmentFloat";
|
descriptor.cFragment.entryPoint = "fragmentFloat";
|
||||||
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA32Float;
|
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA32Float;
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
descriptor.cFragment.entryPoint = "fragmentUint";
|
descriptor.cFragment.entryPoint = "fragmentUint";
|
||||||
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA32Uint;
|
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
|
// Error case, the component type doesn't match between the pipeline and the entryPoint
|
||||||
descriptor.cFragment.entryPoint = "fragmentUint";
|
descriptor.cFragment.entryPoint = "fragmentUint";
|
||||||
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA32Float;
|
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA32Float;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||||
|
|
||||||
descriptor.cFragment.entryPoint = "fragmentFloat";
|
descriptor.cFragment.entryPoint = "fragmentFloat";
|
||||||
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA32Uint;
|
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
|
// 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}});
|
device, {{1, wgpu::ShaderStage::Vertex, wgpu::BufferBindingType::Uniform}});
|
||||||
wgpu::PipelineLayout layout1 = utils::MakeBasicPipelineLayout(device, &bgl1);
|
wgpu::PipelineLayout layout1 = utils::MakeBasicPipelineLayout(device, &bgl1);
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = module;
|
descriptor.vertex.module = module;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
|
|
||||||
// Success case, the BGL matches the bindings used by the entryPoint
|
// Success case, the BGL matches the bindings used by the entryPoint
|
||||||
descriptor.vertex.entryPoint = "vertex0";
|
descriptor.vertex.entryPoint = "vertex0";
|
||||||
descriptor.layout = layout0;
|
descriptor.layout = layout0;
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
descriptor.vertex.entryPoint = "vertex1";
|
descriptor.vertex.entryPoint = "vertex1";
|
||||||
descriptor.layout = layout1;
|
descriptor.layout = layout1;
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
||||||
// Error case, the BGL doesn't match the bindings used by the entryPoint
|
// Error case, the BGL doesn't match the bindings used by the entryPoint
|
||||||
descriptor.vertex.entryPoint = "vertex1";
|
descriptor.vertex.entryPoint = "vertex1";
|
||||||
descriptor.layout = layout0;
|
descriptor.layout = layout0;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||||
|
|
||||||
descriptor.vertex.entryPoint = "vertex0";
|
descriptor.vertex.entryPoint = "vertex0";
|
||||||
descriptor.layout = layout1;
|
descriptor.layout = layout1;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
class DepthClampingValidationTest : public RenderPipelineValidationTest {
|
class DepthClampingValidationTest : public RenderPipelineValidationTest {
|
||||||
|
@ -773,21 +748,21 @@ class DepthClampingValidationTest : public RenderPipelineValidationTest {
|
||||||
// Tests that specifying a clampDepth value succeeds if the extension is enabled.
|
// Tests that specifying a clampDepth value succeeds if the extension is enabled.
|
||||||
TEST_F(DepthClampingValidationTest, Success) {
|
TEST_F(DepthClampingValidationTest, Success) {
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
wgpu::PrimitiveDepthClampingState clampingState;
|
wgpu::PrimitiveDepthClampingState clampingState;
|
||||||
clampingState.clampDepth = true;
|
clampingState.clampDepth = true;
|
||||||
descriptor.primitive.nextInChain = &clampingState;
|
descriptor.primitive.nextInChain = &clampingState;
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
wgpu::PrimitiveDepthClampingState clampingState;
|
wgpu::PrimitiveDepthClampingState clampingState;
|
||||||
clampingState.clampDepth = false;
|
clampingState.clampDepth = false;
|
||||||
descriptor.primitive.nextInChain = &clampingState;
|
descriptor.primitive.nextInChain = &clampingState;
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,11 +54,11 @@ namespace {
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(fragment)]] fn main() {
|
[[stage(fragment)]] fn main() {
|
||||||
})");
|
})");
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, nullptr);
|
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, nullptr);
|
||||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::ComputePipeline CreateNoOpComputePipeline(std::vector<wgpu::BindGroupLayout> bgls) {
|
wgpu::ComputePipeline CreateNoOpComputePipeline(std::vector<wgpu::BindGroupLayout> bgls) {
|
||||||
|
@ -765,11 +765,11 @@ namespace {
|
||||||
[[group(0), binding(0)]] var<storage> rBuffer : [[access(read)]] RBuffer;
|
[[group(0), binding(0)]] var<storage> rBuffer : [[access(read)]] RBuffer;
|
||||||
[[stage(fragment)]] fn main() {
|
[[stage(fragment)]] fn main() {
|
||||||
})");
|
})");
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl0);
|
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
|
// Resource in bg1 conflicts with resources used in bg0. However, bindings in bg1 is
|
||||||
// not used in pipeline. But we still track this binding.
|
// 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>;
|
[[group(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[stage(fragment)]] fn main() {
|
[[stage(fragment)]] fn main() {
|
||||||
})");
|
})");
|
||||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||||
pipelineDescriptor.vertex.module = vsModule;
|
pipelineDescriptor.vertex.module = vsModule;
|
||||||
pipelineDescriptor.cFragment.module = fsModule;
|
pipelineDescriptor.cFragment.module = fsModule;
|
||||||
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &readBGL);
|
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
|
// 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.
|
// in writeBG is not used in pipeline. But we still track this binding.
|
||||||
|
|
|
@ -127,11 +127,11 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
||||||
return textureLoad(image0, vec2<i32>(i32(VertexIndex), 0));
|
return textureLoad(image0, vec2<i32>(i32(VertexIndex), 0));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = mDefaultFSModule;
|
descriptor.cFragment.module = mDefaultFSModule;
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read-only storage textures can be declared in a fragment shader.
|
// 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));
|
return textureLoad(image0, vec2<i32>(FragCoord.xy));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor descriptor;
|
||||||
descriptor.layout = nullptr;
|
descriptor.layout = nullptr;
|
||||||
descriptor.vertex.module = mDefaultVSModule;
|
descriptor.vertex.module = mDefaultVSModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write-only storage textures cannot be declared in a vertex shader.
|
// 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));
|
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.layout = nullptr;
|
||||||
descriptor.vertex.module = vsModule;
|
descriptor.vertex.module = vsModule;
|
||||||
descriptor.cFragment.module = mDefaultFSModule;
|
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.
|
// 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));
|
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.layout = nullptr;
|
||||||
descriptor.vertex.module = mDefaultVSModule;
|
descriptor.vertex.module = mDefaultVSModule;
|
||||||
descriptor.cFragment.module = fsModule;
|
descriptor.cFragment.module = fsModule;
|
||||||
device.CreateRenderPipeline2(&descriptor);
|
device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,14 +64,14 @@ TEST_F(UnsafeAPIValidationTest, DrawIndexedIndirectDisallowed) {
|
||||||
bundleDesc.colorFormatsCount = 1;
|
bundleDesc.colorFormatsCount = 1;
|
||||||
bundleDesc.cColorFormats[0] = renderPass.attachmentFormat;
|
bundleDesc.cColorFormats[0] = renderPass.attachmentFormat;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 desc;
|
utils::ComboRenderPipelineDescriptor desc;
|
||||||
desc.vertex.module = utils::CreateShaderModule(
|
desc.vertex.module = utils::CreateShaderModule(
|
||||||
device,
|
device,
|
||||||
R"([[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
R"([[stage(vertex)]] fn main() -> [[builtin(position)]] vec4<f32> {
|
||||||
return vec4<f32>();
|
return vec4<f32>();
|
||||||
})");
|
})");
|
||||||
desc.cFragment.module = utils::CreateShaderModule(device, "[[stage(fragment)]] fn main() {}");
|
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.
|
// 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
Loading…
Reference in New Issue