Updating end-2-end tests to use new RenderPipelineDescriptor format
Bug: dawn:642 Change-Id: Ie38dfe7286b51eb7f3ecd8902e5249321ff63c11 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44980 Auto-Submit: Brandon Jones <bajones@chromium.org> Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
parent
27c4f03de1
commit
bff9d3a357
|
@ -133,35 +133,35 @@ namespace dawn_native {
|
|||
ShaderModuleBase* fragmentModule = store->copyTextureForBrowserFS.Get();
|
||||
|
||||
// Prepare vertex stage.
|
||||
ProgrammableStageDescriptor vertexStage = {};
|
||||
vertexStage.module = vertexModule;
|
||||
vertexStage.entryPoint = "main";
|
||||
VertexState vertex = {};
|
||||
vertex.module = vertexModule;
|
||||
vertex.entryPoint = "main";
|
||||
|
||||
// Prepare frgament stage.
|
||||
ProgrammableStageDescriptor fragmentStage = {};
|
||||
fragmentStage.module = fragmentModule;
|
||||
fragmentStage.entryPoint = "main";
|
||||
FragmentState fragment = {};
|
||||
fragment.module = fragmentModule;
|
||||
fragment.entryPoint = "main";
|
||||
|
||||
// Prepare color state.
|
||||
ColorStateDescriptor colorState = {};
|
||||
colorState.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
ColorTargetState target = {};
|
||||
target.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
|
||||
// Create RenderPipeline.
|
||||
RenderPipelineDescriptor renderPipelineDesc = {};
|
||||
RenderPipelineDescriptor2 renderPipelineDesc = {};
|
||||
|
||||
// Generate the layout based on shader modules.
|
||||
renderPipelineDesc.layout = nullptr;
|
||||
|
||||
renderPipelineDesc.vertexStage = vertexStage;
|
||||
renderPipelineDesc.fragmentStage = &fragmentStage;
|
||||
renderPipelineDesc.vertex = vertex;
|
||||
renderPipelineDesc.fragment = &fragment;
|
||||
|
||||
renderPipelineDesc.primitiveTopology = wgpu::PrimitiveTopology::TriangleList;
|
||||
renderPipelineDesc.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||
|
||||
renderPipelineDesc.colorStateCount = 1;
|
||||
renderPipelineDesc.colorStates = &colorState;
|
||||
fragment.targetCount = 1;
|
||||
fragment.targets = ⌖
|
||||
|
||||
store->copyTextureForBrowserPipeline =
|
||||
AcquireRef(device->CreateRenderPipeline(&renderPipelineDesc));
|
||||
AcquireRef(device->CreateRenderPipeline2(&renderPipelineDesc));
|
||||
}
|
||||
|
||||
return store->copyTextureForBrowserPipeline.Get();
|
||||
|
|
|
@ -100,19 +100,23 @@ class BindGroupTests : public DawnTest {
|
|||
|
||||
wgpu::PipelineLayout pipelineLayout = MakeBasicPipelineLayout(bindGroupLayouts);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
pipelineDescriptor.layout = pipelineLayout;
|
||||
pipelineDescriptor.vertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
pipelineDescriptor.cColorStates[0].colorBlend.operation = wgpu::BlendOperation::Add;
|
||||
pipelineDescriptor.cColorStates[0].colorBlend.srcFactor = wgpu::BlendFactor::One;
|
||||
pipelineDescriptor.cColorStates[0].colorBlend.dstFactor = wgpu::BlendFactor::One;
|
||||
pipelineDescriptor.cColorStates[0].alphaBlend.operation = wgpu::BlendOperation::Add;
|
||||
pipelineDescriptor.cColorStates[0].alphaBlend.srcFactor = wgpu::BlendFactor::One;
|
||||
pipelineDescriptor.cColorStates[0].alphaBlend.dstFactor = wgpu::BlendFactor::One;
|
||||
pipelineDescriptor.vertex.module = vsModule;
|
||||
pipelineDescriptor.cFragment.module = fsModule;
|
||||
pipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
wgpu::BlendState blend;
|
||||
blend.color.operation = wgpu::BlendOperation::Add;
|
||||
blend.color.srcFactor = wgpu::BlendFactor::One;
|
||||
blend.color.dstFactor = wgpu::BlendFactor::One;
|
||||
blend.alpha.operation = wgpu::BlendOperation::Add;
|
||||
blend.alpha.srcFactor = wgpu::BlendFactor::One;
|
||||
blend.alpha.dstFactor = wgpu::BlendFactor::One;
|
||||
|
||||
pipelineDescriptor.cTargets[0].blend = &blend;
|
||||
|
||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -187,12 +191,12 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
|||
fragColor = fragmentUbo.color;
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor textureDescriptor(device);
|
||||
textureDescriptor.vertexStage.module = vsModule;
|
||||
textureDescriptor.cFragmentStage.module = fsModule;
|
||||
textureDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 textureDescriptor;
|
||||
textureDescriptor.vertex.module = vsModule;
|
||||
textureDescriptor.cFragment.module = fsModule;
|
||||
textureDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&textureDescriptor);
|
||||
|
||||
struct Data {
|
||||
float transform[8];
|
||||
|
@ -269,12 +273,12 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
|||
fragColor = textureSample(tex, samp, FragCoord.xy);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.vertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
pipelineDescriptor.vertex.module = vsModule;
|
||||
pipelineDescriptor.cFragment.module = fsModule;
|
||||
pipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
|
||||
constexpr float transform[] = {1.f, 0.f, 0.f, 1.f};
|
||||
wgpu::Buffer buffer = utils::CreateBufferFromData(device, &transform, sizeof(transform),
|
||||
|
@ -395,12 +399,12 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
|||
fragColor = fragmentUbo1.color + fragmentUbo2.color;
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor textureDescriptor(device);
|
||||
textureDescriptor.vertexStage.module = vsModule;
|
||||
textureDescriptor.cFragmentStage.module = fsModule;
|
||||
textureDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 textureDescriptor;
|
||||
textureDescriptor.vertex.module = vsModule;
|
||||
textureDescriptor.cFragment.module = fsModule;
|
||||
textureDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&textureDescriptor);
|
||||
|
||||
struct Data {
|
||||
float transform[4];
|
||||
|
@ -984,12 +988,12 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) {
|
|||
fragColor = ubo1.color + 2.0 * ubo2.color + 4.0 * ubo3.color;
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.vertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
pipelineDescriptor.vertex.module = vsModule;
|
||||
pipelineDescriptor.cFragment.module = fsModule;
|
||||
pipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
|
||||
wgpu::Buffer black =
|
||||
utils::CreateBufferFromData(device, wgpu::BufferUsage::Uniform, {0.f, 0.f, 0.f, 0.f});
|
||||
|
@ -1100,9 +1104,9 @@ TEST_P(BindGroupTests, EmptyLayout) {
|
|||
// This is a regression test for crbug.com/dawn/410 which tests that it can successfully compile and
|
||||
// execute the shader.
|
||||
TEST_P(BindGroupTests, ReadonlyStorage) {
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
|
||||
pipelineDescriptor.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDescriptor.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
|
||||
|
@ -1115,7 +1119,7 @@ TEST_P(BindGroupTests, ReadonlyStorage) {
|
|||
Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
||||
})");
|
||||
|
||||
pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDescriptor.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct Buffer0 {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
|
@ -1128,14 +1132,14 @@ TEST_P(BindGroupTests, ReadonlyStorage) {
|
|||
|
||||
constexpr uint32_t kRTSize = 4;
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
pipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BufferBindingType::Storage}});
|
||||
|
||||
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||
|
|
|
@ -224,16 +224,16 @@ class BufferZeroInitTest : public DawnTest {
|
|||
})");
|
||||
|
||||
ASSERT(vertexBufferCount <= 1u);
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.cVertexState.vertexBufferCount = vertexBufferCount;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = kColorAttachmentFormat;
|
||||
return device.CreateRenderPipeline(&descriptor);
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.vertex.bufferCount = vertexBufferCount;
|
||||
descriptor.cBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cBuffers[0].attributeCount = 1;
|
||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cTargets[0].format = kColorAttachmentFormat;
|
||||
return device.CreateRenderPipeline2(&descriptor);
|
||||
}
|
||||
|
||||
void ExpectLazyClearSubmitAndCheckOutputs(wgpu::CommandEncoder encoder,
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
class ClipSpaceTest : public DawnTest {
|
||||
protected:
|
||||
wgpu::RenderPipeline CreatePipelineForTest() {
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
|
||||
// Draw two triangles:
|
||||
// 1. The depth value of the top-left one is >= 0.5
|
||||
// 2. The depth value of the bottom-right one is <= 0.5
|
||||
pipelineDescriptor.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDescriptor.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
const pos : array<vec3<f32>, 6> = array<vec3<f32>, 6>(
|
||||
vec3<f32>(-1.0, 1.0, 1.0),
|
||||
vec3<f32>(-1.0, -1.0, 0.5),
|
||||
|
@ -42,17 +42,17 @@ class ClipSpaceTest : public DawnTest {
|
|||
return;
|
||||
})");
|
||||
|
||||
pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDescriptor.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<out> fragColor : vec4<f32>;;
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
})");
|
||||
|
||||
pipelineDescriptor.cDepthStencilState.depthCompare = wgpu::CompareFunction::LessEqual;
|
||||
pipelineDescriptor.depthStencilState = &pipelineDescriptor.cDepthStencilState;
|
||||
wgpu::DepthStencilState* depthStencil = pipelineDescriptor.EnableDepthStencil();
|
||||
depthStencil->depthCompare = wgpu::CompareFunction::LessEqual;
|
||||
|
||||
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
}
|
||||
|
||||
wgpu::Texture Create2DTextureForTest(wgpu::TextureFormat format) {
|
||||
|
|
|
@ -54,7 +54,7 @@ class ColorStateTest : public DawnTest {
|
|||
|
||||
// Set up basePipeline and testPipeline. testPipeline has the given blend state on the first
|
||||
// attachment. basePipeline has no blending
|
||||
void SetupSingleSourcePipelines(wgpu::ColorStateDescriptor colorStateDescriptor) {
|
||||
void SetupSingleSourcePipelines(wgpu::ColorTargetState colorTargetState) {
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct MyBlock {
|
||||
color : vec4<f32>;
|
||||
|
@ -70,20 +70,20 @@ class ColorStateTest : public DawnTest {
|
|||
}
|
||||
)");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor baseDescriptor(device);
|
||||
baseDescriptor.vertexStage.module = vsModule;
|
||||
baseDescriptor.cFragmentStage.module = fsModule;
|
||||
baseDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 baseDescriptor;
|
||||
baseDescriptor.vertex.module = vsModule;
|
||||
baseDescriptor.cFragment.module = fsModule;
|
||||
baseDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
|
||||
basePipeline = device.CreateRenderPipeline2(&baseDescriptor);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor testDescriptor(device);
|
||||
testDescriptor.vertexStage.module = vsModule;
|
||||
testDescriptor.cFragmentStage.module = fsModule;
|
||||
testDescriptor.cColorStates[0] = colorStateDescriptor;
|
||||
testDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 testDescriptor;
|
||||
testDescriptor.vertex.module = vsModule;
|
||||
testDescriptor.cFragment.module = fsModule;
|
||||
testDescriptor.cTargets[0] = colorTargetState;
|
||||
testDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
testPipeline = device.CreateRenderPipeline(&testDescriptor);
|
||||
testPipeline = device.CreateRenderPipeline2(&testDescriptor);
|
||||
}
|
||||
|
||||
// Create a bind group to set the colors as a uniform buffer
|
||||
|
@ -138,14 +138,17 @@ class ColorStateTest : public DawnTest {
|
|||
void CheckBlendOperation(RGBA8 base,
|
||||
wgpu::BlendOperation operation,
|
||||
std::vector<std::pair<RGBA8, RGBA8>> tests) {
|
||||
wgpu::BlendDescriptor blend;
|
||||
blend.operation = operation;
|
||||
blend.srcFactor = wgpu::BlendFactor::One;
|
||||
blend.dstFactor = wgpu::BlendFactor::One;
|
||||
wgpu::BlendComponent blendComponent;
|
||||
blendComponent.operation = operation;
|
||||
blendComponent.srcFactor = wgpu::BlendFactor::One;
|
||||
blendComponent.dstFactor = wgpu::BlendFactor::One;
|
||||
|
||||
wgpu::ColorStateDescriptor descriptor;
|
||||
descriptor.alphaBlend = blend;
|
||||
descriptor.colorBlend = blend;
|
||||
wgpu::BlendState blend;
|
||||
blend.color = blendComponent;
|
||||
blend.alpha = blendComponent;
|
||||
|
||||
wgpu::ColorTargetState descriptor;
|
||||
descriptor.blend = &blend;
|
||||
descriptor.writeMask = wgpu::ColorWriteMask::All;
|
||||
|
||||
SetupSingleSourcePipelines(descriptor);
|
||||
|
@ -163,19 +166,22 @@ class ColorStateTest : public DawnTest {
|
|||
wgpu::BlendFactor alphaSrcFactor,
|
||||
wgpu::BlendFactor alphaDstFactor,
|
||||
std::vector<std::pair<TriangleSpec, RGBA8>> tests) {
|
||||
wgpu::BlendDescriptor colorBlend;
|
||||
wgpu::BlendComponent colorBlend;
|
||||
colorBlend.operation = wgpu::BlendOperation::Add;
|
||||
colorBlend.srcFactor = colorSrcFactor;
|
||||
colorBlend.dstFactor = colorDstFactor;
|
||||
|
||||
wgpu::BlendDescriptor alphaBlend;
|
||||
wgpu::BlendComponent alphaBlend;
|
||||
alphaBlend.operation = wgpu::BlendOperation::Add;
|
||||
alphaBlend.srcFactor = alphaSrcFactor;
|
||||
alphaBlend.dstFactor = alphaDstFactor;
|
||||
|
||||
wgpu::ColorStateDescriptor descriptor;
|
||||
descriptor.colorBlend = colorBlend;
|
||||
descriptor.alphaBlend = alphaBlend;
|
||||
wgpu::BlendState blend;
|
||||
blend.color = colorBlend;
|
||||
blend.alpha = alphaBlend;
|
||||
|
||||
wgpu::ColorTargetState descriptor;
|
||||
descriptor.blend = &blend;
|
||||
descriptor.writeMask = wgpu::ColorWriteMask::All;
|
||||
|
||||
SetupSingleSourcePipelines(descriptor);
|
||||
|
@ -289,13 +295,17 @@ namespace {
|
|||
|
||||
// Test compilation and usage of the fixture
|
||||
TEST_P(ColorStateTest, Basic) {
|
||||
wgpu::BlendDescriptor blend;
|
||||
blend.operation = wgpu::BlendOperation::Add;
|
||||
blend.srcFactor = wgpu::BlendFactor::One;
|
||||
blend.dstFactor = wgpu::BlendFactor::Zero;
|
||||
wgpu::ColorStateDescriptor descriptor;
|
||||
descriptor.alphaBlend = blend;
|
||||
descriptor.colorBlend = blend;
|
||||
wgpu::BlendComponent blendComponent;
|
||||
blendComponent.operation = wgpu::BlendOperation::Add;
|
||||
blendComponent.srcFactor = wgpu::BlendFactor::One;
|
||||
blendComponent.dstFactor = wgpu::BlendFactor::Zero;
|
||||
|
||||
wgpu::BlendState blend;
|
||||
blend.color = blendComponent;
|
||||
blend.alpha = blendComponent;
|
||||
|
||||
wgpu::ColorTargetState descriptor;
|
||||
descriptor.blend = &blend;
|
||||
descriptor.writeMask = wgpu::ColorWriteMask::All;
|
||||
|
||||
SetupSingleSourcePipelines(descriptor);
|
||||
|
@ -668,14 +678,17 @@ TEST_P(ColorStateTest, DstBlendFactorOneMinusBlendColor) {
|
|||
|
||||
// Check that the color write mask works
|
||||
TEST_P(ColorStateTest, ColorWriteMask) {
|
||||
wgpu::BlendDescriptor blend;
|
||||
blend.operation = wgpu::BlendOperation::Add;
|
||||
blend.srcFactor = wgpu::BlendFactor::One;
|
||||
blend.dstFactor = wgpu::BlendFactor::One;
|
||||
wgpu::BlendComponent blendComponent;
|
||||
blendComponent.operation = wgpu::BlendOperation::Add;
|
||||
blendComponent.srcFactor = wgpu::BlendFactor::One;
|
||||
blendComponent.dstFactor = wgpu::BlendFactor::One;
|
||||
|
||||
wgpu::ColorStateDescriptor descriptor;
|
||||
descriptor.colorBlend = blend;
|
||||
descriptor.alphaBlend = blend;
|
||||
wgpu::BlendState blend;
|
||||
blend.color = blendComponent;
|
||||
blend.alpha = blendComponent;
|
||||
|
||||
wgpu::ColorTargetState descriptor;
|
||||
descriptor.blend = &blend;
|
||||
{
|
||||
// Test single channel color write
|
||||
descriptor.writeMask = wgpu::ColorWriteMask::Red;
|
||||
|
@ -715,14 +728,17 @@ TEST_P(ColorStateTest, ColorWriteMask) {
|
|||
// Check that the color write mask works when blending is disabled
|
||||
TEST_P(ColorStateTest, ColorWriteMaskBlendingDisabled) {
|
||||
{
|
||||
wgpu::BlendDescriptor blend;
|
||||
blend.operation = wgpu::BlendOperation::Add;
|
||||
blend.srcFactor = wgpu::BlendFactor::One;
|
||||
blend.dstFactor = wgpu::BlendFactor::Zero;
|
||||
wgpu::ColorStateDescriptor descriptor;
|
||||
descriptor.alphaBlend = blend;
|
||||
descriptor.colorBlend = blend;
|
||||
wgpu::BlendComponent blendComponent;
|
||||
blendComponent.operation = wgpu::BlendOperation::Add;
|
||||
blendComponent.srcFactor = wgpu::BlendFactor::One;
|
||||
blendComponent.dstFactor = wgpu::BlendFactor::Zero;
|
||||
|
||||
wgpu::BlendState blend;
|
||||
blend.color = blendComponent;
|
||||
blend.alpha = blendComponent;
|
||||
|
||||
wgpu::ColorTargetState descriptor;
|
||||
descriptor.blend = &blend;
|
||||
descriptor.writeMask = wgpu::ColorWriteMask::Red;
|
||||
SetupSingleSourcePipelines(descriptor);
|
||||
|
||||
|
@ -793,44 +809,53 @@ TEST_P(ColorStateTest, IndependentColorState) {
|
|||
}
|
||||
)");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor baseDescriptor(device);
|
||||
baseDescriptor.vertexStage.module = vsModule;
|
||||
baseDescriptor.cFragmentStage.module = fsModule;
|
||||
baseDescriptor.colorStateCount = 4;
|
||||
utils::ComboRenderPipelineDescriptor2 baseDescriptor;
|
||||
baseDescriptor.vertex.module = vsModule;
|
||||
baseDescriptor.cFragment.module = fsModule;
|
||||
baseDescriptor.cFragment.targetCount = 4;
|
||||
|
||||
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
|
||||
basePipeline = device.CreateRenderPipeline2(&baseDescriptor);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor testDescriptor(device);
|
||||
testDescriptor.vertexStage.module = vsModule;
|
||||
testDescriptor.cFragmentStage.module = fsModule;
|
||||
testDescriptor.colorStateCount = 4;
|
||||
utils::ComboRenderPipelineDescriptor2 testDescriptor;
|
||||
testDescriptor.vertex.module = vsModule;
|
||||
testDescriptor.cFragment.module = fsModule;
|
||||
testDescriptor.cFragment.targetCount = 4;
|
||||
|
||||
// set color states
|
||||
wgpu::BlendDescriptor blend1;
|
||||
blend1.operation = wgpu::BlendOperation::Add;
|
||||
blend1.srcFactor = wgpu::BlendFactor::One;
|
||||
blend1.dstFactor = wgpu::BlendFactor::One;
|
||||
wgpu::BlendComponent blendComponent0;
|
||||
blendComponent0.operation = wgpu::BlendOperation::Add;
|
||||
blendComponent0.srcFactor = wgpu::BlendFactor::One;
|
||||
blendComponent0.dstFactor = wgpu::BlendFactor::One;
|
||||
|
||||
wgpu::BlendDescriptor blend2;
|
||||
blend2.operation = wgpu::BlendOperation::Subtract;
|
||||
blend2.srcFactor = wgpu::BlendFactor::One;
|
||||
blend2.dstFactor = wgpu::BlendFactor::One;
|
||||
wgpu::BlendState blend0;
|
||||
blend0.color = blendComponent0;
|
||||
blend0.alpha = blendComponent0;
|
||||
|
||||
wgpu::BlendDescriptor blend3;
|
||||
blend3.operation = wgpu::BlendOperation::Min;
|
||||
blend3.srcFactor = wgpu::BlendFactor::One;
|
||||
blend3.dstFactor = wgpu::BlendFactor::One;
|
||||
wgpu::BlendComponent blendComponent1;
|
||||
blendComponent1.operation = wgpu::BlendOperation::Subtract;
|
||||
blendComponent1.srcFactor = wgpu::BlendFactor::One;
|
||||
blendComponent1.dstFactor = wgpu::BlendFactor::One;
|
||||
|
||||
testDescriptor.cColorStates[0].colorBlend = blend1;
|
||||
testDescriptor.cColorStates[0].alphaBlend = blend1;
|
||||
wgpu::BlendState blend1;
|
||||
blend1.color = blendComponent1;
|
||||
blend1.alpha = blendComponent1;
|
||||
|
||||
testDescriptor.cColorStates[1].colorBlend = blend2;
|
||||
testDescriptor.cColorStates[1].alphaBlend = blend2;
|
||||
// Blend state intentionally omitted for target 2
|
||||
|
||||
testDescriptor.cColorStates[3].colorBlend = blend3;
|
||||
testDescriptor.cColorStates[3].alphaBlend = blend3;
|
||||
wgpu::BlendDescriptor blendComponent3;
|
||||
blendComponent3.operation = wgpu::BlendOperation::Min;
|
||||
blendComponent3.srcFactor = wgpu::BlendFactor::One;
|
||||
blendComponent3.dstFactor = wgpu::BlendFactor::One;
|
||||
|
||||
testPipeline = device.CreateRenderPipeline(&testDescriptor);
|
||||
wgpu::BlendState blend3;
|
||||
blend3.color = blendComponent3;
|
||||
blend3.alpha = blendComponent3;
|
||||
|
||||
testDescriptor.cTargets[0].blend = &blend0;
|
||||
testDescriptor.cTargets[1].blend = &blend1;
|
||||
testDescriptor.cTargets[3].blend = &blend3;
|
||||
|
||||
testPipeline = device.CreateRenderPipeline2(&testDescriptor);
|
||||
|
||||
for (unsigned int c = 0; c < kColors.size(); ++c) {
|
||||
RGBA8 base = kColors[((c + 31) * 29) % kColors.size()];
|
||||
|
@ -894,26 +919,30 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
|
|||
}
|
||||
)");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor baseDescriptor(device);
|
||||
baseDescriptor.vertexStage.module = vsModule;
|
||||
baseDescriptor.cFragmentStage.module = fsModule;
|
||||
baseDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 baseDescriptor;
|
||||
baseDescriptor.vertex.module = vsModule;
|
||||
baseDescriptor.cFragment.module = fsModule;
|
||||
baseDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
|
||||
basePipeline = device.CreateRenderPipeline2(&baseDescriptor);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor testDescriptor(device);
|
||||
testDescriptor.vertexStage.module = vsModule;
|
||||
testDescriptor.cFragmentStage.module = fsModule;
|
||||
testDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 testDescriptor;
|
||||
testDescriptor.vertex.module = vsModule;
|
||||
testDescriptor.cFragment.module = fsModule;
|
||||
testDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::BlendDescriptor blend;
|
||||
blend.operation = wgpu::BlendOperation::Add;
|
||||
blend.srcFactor = wgpu::BlendFactor::BlendColor;
|
||||
blend.dstFactor = wgpu::BlendFactor::One;
|
||||
testDescriptor.cColorStates[0].colorBlend = blend;
|
||||
testDescriptor.cColorStates[0].alphaBlend = blend;
|
||||
wgpu::BlendComponent blendComponent;
|
||||
blendComponent.operation = wgpu::BlendOperation::Add;
|
||||
blendComponent.srcFactor = wgpu::BlendFactor::BlendColor;
|
||||
blendComponent.dstFactor = wgpu::BlendFactor::One;
|
||||
|
||||
testPipeline = device.CreateRenderPipeline(&testDescriptor);
|
||||
wgpu::BlendState blend;
|
||||
blend.color = blendComponent;
|
||||
blend.alpha = blendComponent;
|
||||
|
||||
testDescriptor.cTargets[0].blend = &blend;
|
||||
|
||||
testPipeline = device.CreateRenderPipeline2(&testDescriptor);
|
||||
constexpr wgpu::Color kWhite{1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
// Check that the initial blend color is (0,0,0,0)
|
||||
|
@ -1017,20 +1046,20 @@ TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) {
|
|||
}
|
||||
)");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor baseDescriptor(device);
|
||||
baseDescriptor.vertexStage.module = vsModule;
|
||||
baseDescriptor.cFragmentStage.module = fsModule;
|
||||
baseDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 baseDescriptor;
|
||||
baseDescriptor.vertex.module = vsModule;
|
||||
baseDescriptor.cFragment.module = fsModule;
|
||||
baseDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
|
||||
basePipeline = device.CreateRenderPipeline2(&baseDescriptor);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor testDescriptor(device);
|
||||
testDescriptor.vertexStage.module = vsModule;
|
||||
testDescriptor.cFragmentStage.module = fsModule;
|
||||
testDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
testDescriptor.cColorStates[0].writeMask = wgpu::ColorWriteMask::Red;
|
||||
utils::ComboRenderPipelineDescriptor2 testDescriptor;
|
||||
testDescriptor.vertex.module = vsModule;
|
||||
testDescriptor.cFragment.module = fsModule;
|
||||
testDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
testDescriptor.cTargets[0].writeMask = wgpu::ColorWriteMask::Red;
|
||||
|
||||
testPipeline = device.CreateRenderPipeline(&testDescriptor);
|
||||
testPipeline = device.CreateRenderPipeline2(&testDescriptor);
|
||||
|
||||
RGBA8 base(32, 64, 128, 192);
|
||||
RGBA8 expected(0, 0, 0, 0);
|
||||
|
|
|
@ -138,7 +138,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
|||
wgpu::RenderPipeline CreateRenderPipelineForTest() {
|
||||
ASSERT(IsBCFormatSupported());
|
||||
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[location(0)]] var<out> texCoord : vec2 <f32>;
|
||||
|
@ -166,12 +166,11 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
|||
fragColor = textureSample(texture0, sampler0, texCoord);
|
||||
return;
|
||||
})");
|
||||
renderPipelineDescriptor.vertexStage.module = vsModule;
|
||||
renderPipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
renderPipelineDescriptor.cColorStates[0].format =
|
||||
utils::BasicRenderPass::kDefaultColorFormat;
|
||||
renderPipelineDescriptor.vertex.module = vsModule;
|
||||
renderPipelineDescriptor.cFragment.module = fsModule;
|
||||
renderPipelineDescriptor.cTargets[0].format = utils::BasicRenderPass::kDefaultColorFormat;
|
||||
|
||||
return device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
return device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||
}
|
||||
|
||||
// Run the given render pipeline and bind group and verify the pixels in the render target.
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
class CullingTest : public DawnTest {
|
||||
protected:
|
||||
wgpu::RenderPipeline CreatePipelineForTest(wgpu::FrontFace frontFace, wgpu::CullMode cullMode) {
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
|
||||
// Draw two triangles with different winding orders:
|
||||
// 1. The top-left one is counterclockwise (CCW)
|
||||
// 2. The bottom-right one is clockwise (CW)
|
||||
pipelineDescriptor.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDescriptor.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
|
||||
vec2<f32>(-1.0, 1.0),
|
||||
vec2<f32>(-1.0, 0.0),
|
||||
|
@ -45,7 +45,7 @@ class CullingTest : public DawnTest {
|
|||
// FragCoord of pixel(x, y) in framebuffer coordinate is (x + 0.5, y + 0.5). And we use
|
||||
// RGBA8 format for the back buffer. So (FragCoord.xy - vec2(0.5)) / 255 in shader code
|
||||
// will make the pixel's R and G channels exactly equal to the pixel's x and y coordinates.
|
||||
pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDescriptor.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<out> fragColor : vec4<f32>;;
|
||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
||||
|
||||
|
@ -57,10 +57,10 @@ class CullingTest : public DawnTest {
|
|||
})");
|
||||
|
||||
// Set culling mode and front face according to the parameters
|
||||
pipelineDescriptor.cRasterizationState.frontFace = frontFace;
|
||||
pipelineDescriptor.cRasterizationState.cullMode = cullMode;
|
||||
pipelineDescriptor.primitive.frontFace = frontFace;
|
||||
pipelineDescriptor.primitive.cullMode = cullMode;
|
||||
|
||||
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
}
|
||||
|
||||
wgpu::Texture Create2DTextureForTest(wgpu::TextureFormat format) {
|
||||
|
|
|
@ -118,26 +118,26 @@ TEST_P(D3D12CachingTests, SameShaderNoCache) {
|
|||
|
||||
// Store the WGSL shader into the cache.
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
desc.vertexStage.module = module;
|
||||
desc.vertexStage.entryPoint = "vertex_main";
|
||||
desc.cFragmentStage.module = module;
|
||||
desc.cFragmentStage.entryPoint = "fragment_main";
|
||||
utils::ComboRenderPipelineDescriptor2 desc;
|
||||
desc.vertex.module = module;
|
||||
desc.vertex.entryPoint = "vertex_main";
|
||||
desc.cFragment.module = module;
|
||||
desc.cFragment.entryPoint = "fragment_main";
|
||||
|
||||
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline(&desc));
|
||||
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline2(&desc));
|
||||
}
|
||||
|
||||
EXPECT_EQ(mPersistentCache.mCache.size(), 0u);
|
||||
|
||||
// Load the same WGSL shader from the cache.
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
desc.vertexStage.module = module;
|
||||
desc.vertexStage.entryPoint = "vertex_main";
|
||||
desc.cFragmentStage.module = module;
|
||||
desc.cFragmentStage.entryPoint = "fragment_main";
|
||||
utils::ComboRenderPipelineDescriptor2 desc;
|
||||
desc.vertex.module = module;
|
||||
desc.vertex.entryPoint = "vertex_main";
|
||||
desc.cFragment.module = module;
|
||||
desc.cFragment.entryPoint = "fragment_main";
|
||||
|
||||
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline(&desc));
|
||||
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline2(&desc));
|
||||
}
|
||||
|
||||
EXPECT_EQ(mPersistentCache.mCache.size(), 0u);
|
||||
|
@ -165,28 +165,28 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) {
|
|||
|
||||
// Store the WGSL shader into the cache.
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
desc.vertexStage.module = module;
|
||||
desc.vertexStage.entryPoint = "vertex_main";
|
||||
desc.cFragmentStage.module = module;
|
||||
desc.cFragmentStage.entryPoint = "fragment_main";
|
||||
utils::ComboRenderPipelineDescriptor2 desc;
|
||||
desc.vertex.module = module;
|
||||
desc.vertex.entryPoint = "vertex_main";
|
||||
desc.cFragment.module = module;
|
||||
desc.cFragment.entryPoint = "fragment_main";
|
||||
|
||||
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline(&desc));
|
||||
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline2(&desc));
|
||||
}
|
||||
|
||||
EXPECT_EQ(mPersistentCache.mCache.size(), 2u);
|
||||
|
||||
// Load the same WGSL shader from the cache.
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
desc.vertexStage.module = module;
|
||||
desc.vertexStage.entryPoint = "vertex_main";
|
||||
desc.cFragmentStage.module = module;
|
||||
desc.cFragmentStage.entryPoint = "fragment_main";
|
||||
utils::ComboRenderPipelineDescriptor2 desc;
|
||||
desc.vertex.module = module;
|
||||
desc.vertex.entryPoint = "vertex_main";
|
||||
desc.cFragment.module = module;
|
||||
desc.cFragment.entryPoint = "fragment_main";
|
||||
|
||||
// Cached HLSL shader calls LoadData twice (once to peek, again to get), so check 2 x
|
||||
// kNumOfShaders hits.
|
||||
EXPECT_CACHE_HIT(4u, device.CreateRenderPipeline(&desc));
|
||||
EXPECT_CACHE_HIT(4u, device.CreateRenderPipeline2(&desc));
|
||||
}
|
||||
|
||||
EXPECT_EQ(mPersistentCache.mCache.size(), 2u);
|
||||
|
@ -209,12 +209,12 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) {
|
|||
)");
|
||||
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
desc.vertexStage.module = newModule;
|
||||
desc.vertexStage.entryPoint = "vertex_main";
|
||||
desc.cFragmentStage.module = newModule;
|
||||
desc.cFragmentStage.entryPoint = "fragment_main";
|
||||
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline(&desc));
|
||||
utils::ComboRenderPipelineDescriptor2 desc;
|
||||
desc.vertex.module = newModule;
|
||||
desc.vertex.entryPoint = "vertex_main";
|
||||
desc.cFragment.module = newModule;
|
||||
desc.cFragment.entryPoint = "fragment_main";
|
||||
EXPECT_CACHE_HIT(0u, device.CreateRenderPipeline2(&desc));
|
||||
}
|
||||
|
||||
// Cached HLSL shader calls LoadData twice (once to peek, again to get), so check 2 x
|
||||
|
|
|
@ -273,10 +273,10 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYtoR) {
|
|||
viewDesc.aspect = wgpu::TextureAspect::Plane0Only;
|
||||
wgpu::TextureView textureView = wgpuTexture.CreateView(&viewDesc);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
renderPipelineDescriptor.vertexStage.module = GetTestVertexShaderModule();
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
renderPipelineDescriptor.vertex.module = GetTestVertexShaderModule();
|
||||
|
||||
renderPipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[set(0), binding(0)]] var sampler0 : sampler;
|
||||
[[set(0), binding(1)]] var texture : texture_2d<f32>;
|
||||
|
||||
|
@ -290,10 +290,10 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYtoR) {
|
|||
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(
|
||||
device, kYUVImageDataWidthInTexels, kYUVImageDataHeightInTexels);
|
||||
renderPipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
renderPipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleList;
|
||||
renderPipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
renderPipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
|
||||
|
@ -326,10 +326,10 @@ TEST_P(D3D12VideoViewsTests, NV12SampleUVtoRG) {
|
|||
viewDesc.aspect = wgpu::TextureAspect::Plane1Only;
|
||||
wgpu::TextureView textureView = wgpuTexture.CreateView(&viewDesc);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
renderPipelineDescriptor.vertexStage.module = GetTestVertexShaderModule();
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
renderPipelineDescriptor.vertex.module = GetTestVertexShaderModule();
|
||||
|
||||
renderPipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[set(0), binding(0)]] var sampler0 : sampler;
|
||||
[[set(0), binding(1)]] var texture : texture_2d<f32>;
|
||||
|
||||
|
@ -344,10 +344,10 @@ TEST_P(D3D12VideoViewsTests, NV12SampleUVtoRG) {
|
|||
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(
|
||||
device, kYUVImageDataWidthInTexels, kYUVImageDataHeightInTexels);
|
||||
renderPipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
renderPipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleList;
|
||||
renderPipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
renderPipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
|
||||
|
@ -384,10 +384,10 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYUVtoRGB) {
|
|||
chromaViewDesc.aspect = wgpu::TextureAspect::Plane1Only;
|
||||
wgpu::TextureView chromaTextureView = wgpuTexture.CreateView(&chromaViewDesc);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
renderPipelineDescriptor.vertexStage.module = GetTestVertexShaderModule();
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
renderPipelineDescriptor.vertex.module = GetTestVertexShaderModule();
|
||||
|
||||
renderPipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[set(0), binding(0)]] var sampler0 : sampler;
|
||||
[[set(0), binding(1)]] var lumaTexture : texture_2d<f32>;
|
||||
[[set(0), binding(2)]] var chromaTexture : texture_2d<f32>;
|
||||
|
@ -404,9 +404,9 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYUVtoRGB) {
|
|||
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(
|
||||
device, kYUVImageDataWidthInTexels, kYUVImageDataHeightInTexels);
|
||||
renderPipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
renderPipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
|
||||
|
|
|
@ -229,25 +229,22 @@ class VertexFormatDeprecationTests : public DeprecationTests {
|
|||
}
|
||||
)");
|
||||
|
||||
utils::ComboVertexStateDescriptor vertexState;
|
||||
vertexState.vertexBufferCount = 1;
|
||||
vertexState.cVertexBuffers[0].arrayStride = 32;
|
||||
vertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
vertexState.cAttributes[0].format = vertexFormat;
|
||||
vertexState.cAttributes[0].offset = 0;
|
||||
vertexState.cAttributes[0].shaderLocation = 0;
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.vertexState = &vertexState;
|
||||
descriptor.cColorStates[0].format = utils::BasicRenderPass::kDefaultColorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.vertex.bufferCount = 1;
|
||||
descriptor.cBuffers[0].arrayStride = 32;
|
||||
descriptor.cBuffers[0].attributeCount = 1;
|
||||
descriptor.cAttributes[0].format = vertexFormat;
|
||||
descriptor.cAttributes[0].offset = 0;
|
||||
descriptor.cAttributes[0].shaderLocation = 0;
|
||||
descriptor.cTargets[0].format = utils::BasicRenderPass::kDefaultColorFormat;
|
||||
|
||||
if (deprecated) {
|
||||
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
|
||||
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline2(&descriptor));
|
||||
} else {
|
||||
device.CreateRenderPipeline(&descriptor);
|
||||
device.CreateRenderPipeline2(&descriptor);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -101,24 +101,21 @@ class DepthBiasTests : public DawnTest {
|
|||
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = depthClear;
|
||||
|
||||
// Create a render pipeline to render the quad
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
|
||||
|
||||
renderPipelineDesc.cRasterizationState.depthBias = bias;
|
||||
renderPipelineDesc.cRasterizationState.depthBiasSlopeScale = biasSlopeScale;
|
||||
renderPipelineDesc.cRasterizationState.depthBiasClamp = biasClamp;
|
||||
|
||||
renderPipelineDesc.vertexStage.module = vertexModule;
|
||||
renderPipelineDesc.cFragmentStage.module = fragmentModule;
|
||||
renderPipelineDesc.cDepthStencilState.format = depthFormat;
|
||||
renderPipelineDesc.cDepthStencilState.depthWriteEnabled = true;
|
||||
renderPipelineDesc.vertex.module = vertexModule;
|
||||
renderPipelineDesc.cFragment.module = fragmentModule;
|
||||
wgpu::DepthStencilState* depthStencil = renderPipelineDesc.EnableDepthStencil(depthFormat);
|
||||
depthStencil->depthWriteEnabled = true;
|
||||
depthStencil->depthBias = bias;
|
||||
depthStencil->depthBiasSlopeScale = biasSlopeScale;
|
||||
depthStencil->depthBiasClamp = biasClamp;
|
||||
|
||||
if (depthFormat != wgpu::TextureFormat::Depth32Float) {
|
||||
renderPipelineDesc.cDepthStencilState.depthCompare = wgpu::CompareFunction::Greater;
|
||||
depthStencil->depthCompare = wgpu::CompareFunction::Greater;
|
||||
}
|
||||
|
||||
renderPipelineDesc.depthStencilState = &renderPipelineDesc.cDepthStencilState;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
|
||||
|
||||
// Draw the quad (two triangles)
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
|
|
|
@ -68,10 +68,10 @@ class DepthStencilCopyTests : public DawnTest {
|
|||
return device.CreateTexture(&texDescriptor);
|
||||
}
|
||||
|
||||
void PopulatePipelineDescriptorWriteDepth(utils::ComboRenderPipelineDescriptor* desc,
|
||||
void PopulatePipelineDescriptorWriteDepth(utils::ComboRenderPipelineDescriptor2* desc,
|
||||
wgpu::TextureFormat format,
|
||||
float regionDepth) {
|
||||
desc->vertexStage.module = mVertexModule;
|
||||
desc->vertex.module = mVertexModule;
|
||||
|
||||
std::string fsSource = R"(
|
||||
[[builtin(frag_depth)]] var<out> FragDepth : f32;
|
||||
|
@ -79,11 +79,10 @@ class DepthStencilCopyTests : public DawnTest {
|
|||
FragDepth = )" + std::to_string(regionDepth) +
|
||||
";\n}";
|
||||
|
||||
desc->cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, fsSource.c_str());
|
||||
desc->cDepthStencilState.format = format;
|
||||
desc->cDepthStencilState.depthWriteEnabled = true;
|
||||
desc->depthStencilState = &desc->cDepthStencilState;
|
||||
desc->colorStateCount = 0;
|
||||
desc->cFragment.module = utils::CreateShaderModuleFromWGSL(device, fsSource.c_str());
|
||||
wgpu::DepthStencilState* depthStencil = desc->EnableDepthStencil(format);
|
||||
depthStencil->depthWriteEnabled = true;
|
||||
desc->cFragment.targetCount = 0;
|
||||
}
|
||||
|
||||
// Initialize the depth/stencil values for the texture using a render pass.
|
||||
|
@ -100,11 +99,11 @@ class DepthStencilCopyTests : public DawnTest {
|
|||
utils::ComboRenderPassDescriptor renderPassDesc({}, texture.CreateView(&viewDesc));
|
||||
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = clearDepth;
|
||||
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
|
||||
PopulatePipelineDescriptorWriteDepth(&renderPipelineDesc, wgpu::TextureFormat::Depth32Float,
|
||||
regionDepth);
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&renderPassDesc);
|
||||
pass.SetPipeline(pipeline);
|
||||
|
@ -132,13 +131,12 @@ class DepthStencilCopyTests : public DawnTest {
|
|||
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = clearDepth;
|
||||
renderPassDesc.cDepthStencilAttachmentInfo.clearStencil = clearStencil;
|
||||
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
|
||||
PopulatePipelineDescriptorWriteDepth(&renderPipelineDesc,
|
||||
wgpu::TextureFormat::Depth24PlusStencil8, regionDepth);
|
||||
renderPipelineDesc.cDepthStencil.stencilFront.passOp = wgpu::StencilOperation::Replace;
|
||||
|
||||
renderPipelineDesc.cDepthStencilState.stencilFront.passOp = wgpu::StencilOperation::Replace;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
|
||||
|
||||
// Draw the quad (two triangles)
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
|
@ -238,9 +236,9 @@ class DepthStencilCopyTests : public DawnTest {
|
|||
commandEncoder.CopyBufferToTexture(&bufferCopy, &textureCopy, &depthDataDesc.size);
|
||||
|
||||
// Pipeline for a full screen quad.
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
|
||||
pipelineDescriptor.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDescriptor.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
|
||||
|
@ -254,7 +252,7 @@ class DepthStencilCopyTests : public DawnTest {
|
|||
|
||||
// Sample the input texture and write out depth. |result| will only be set to 1 if we
|
||||
// pass the depth test.
|
||||
pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDescriptor.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[group(0), binding(0)]] var texture0 : texture_2d<f32>;
|
||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
||||
|
||||
|
@ -267,16 +265,15 @@ class DepthStencilCopyTests : public DawnTest {
|
|||
})");
|
||||
|
||||
// Pass the depth test only if the depth is equal.
|
||||
pipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleList;
|
||||
pipelineDescriptor.depthStencilState = &pipelineDescriptor.cDepthStencilState;
|
||||
pipelineDescriptor.cDepthStencilState.format = depthFormat;
|
||||
pipelineDescriptor.cDepthStencilState.depthCompare = wgpu::CompareFunction::Equal;
|
||||
pipelineDescriptor.cColorStates[0].format = colorTexDesc.format;
|
||||
pipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||
wgpu::DepthStencilState* depthStencil = pipelineDescriptor.EnableDepthStencil(depthFormat);
|
||||
depthStencil->depthCompare = wgpu::CompareFunction::Equal;
|
||||
pipelineDescriptor.cTargets[0].format = colorTexDesc.format;
|
||||
|
||||
// TODO(jiawei.shao@intel.com): The Intel Mesa Vulkan driver can't set gl_FragDepth unless
|
||||
// depthWriteEnabled == true. This either needs to be fixed in the driver or restricted by
|
||||
// the WebGPU API.
|
||||
pipelineDescriptor.cDepthStencilState.depthWriteEnabled = true;
|
||||
depthStencil->depthWriteEnabled = true;
|
||||
|
||||
wgpu::TextureViewDescriptor viewDesc = {};
|
||||
viewDesc.baseMipLevel = mipLevel;
|
||||
|
@ -287,7 +284,7 @@ class DepthStencilCopyTests : public DawnTest {
|
|||
passDescriptor.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Load;
|
||||
passDescriptor.cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Load;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
|
||||
// Bind the depth data texture.
|
||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
||||
|
@ -646,18 +643,17 @@ TEST_P(DepthStencilCopyTests, ToStencilAspect) {
|
|||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
// Create a render pipline which decrements the stencil value for passing fragments.
|
||||
// A quad is drawn in the bottom left.
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
|
||||
renderPipelineDesc.vertexStage.module = mVertexModule;
|
||||
renderPipelineDesc.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
|
||||
renderPipelineDesc.vertex.module = mVertexModule;
|
||||
renderPipelineDesc.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
})");
|
||||
renderPipelineDesc.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
renderPipelineDesc.cDepthStencilState.stencilFront.passOp =
|
||||
wgpu::StencilOperation::DecrementClamp;
|
||||
renderPipelineDesc.depthStencilState = &renderPipelineDesc.cDepthStencilState;
|
||||
renderPipelineDesc.colorStateCount = 0;
|
||||
wgpu::DepthStencilState* depthStencil =
|
||||
renderPipelineDesc.EnableDepthStencil(wgpu::TextureFormat::Depth24PlusStencil8);
|
||||
depthStencil->stencilFront.passOp = wgpu::StencilOperation::DecrementClamp;
|
||||
renderPipelineDesc.cFragment.targetCount = 0;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&renderPipelineDesc);
|
||||
|
||||
// Create a render pass which loads the stencil. We want to load the values we
|
||||
// copied in. Also load the canary depth values so they're not lost.
|
||||
|
|
|
@ -71,7 +71,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
|
||||
std::ostringstream shaderSource;
|
||||
std::ostringstream shaderBody;
|
||||
|
@ -88,7 +88,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||
|
||||
shaderBody << "\nresult" << index << " = textureLoad(tex" << index
|
||||
<< ", vec2<i32>(0, 0), 0)[" << componentIndex << "];\n";
|
||||
pipelineDescriptor.cColorStates[index].format = wgpu::TextureFormat::R32Float;
|
||||
pipelineDescriptor.cTargets[index].format = wgpu::TextureFormat::R32Float;
|
||||
break;
|
||||
case TestAspect::Stencil:
|
||||
shaderSource << "[[group(0), binding(" << index << ")]] var tex" << index
|
||||
|
@ -99,7 +99,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||
|
||||
shaderBody << "\nresult" << index << " = textureLoad(tex" << index
|
||||
<< ", vec2<i32>(0, 0), 0)[" << componentIndex << "];\n";
|
||||
pipelineDescriptor.cColorStates[index].format = wgpu::TextureFormat::R8Uint;
|
||||
pipelineDescriptor.cTargets[index].format = wgpu::TextureFormat::R8Uint;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -110,12 +110,12 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||
|
||||
wgpu::ShaderModule fsModule =
|
||||
utils::CreateShaderModuleFromWGSL(device, shaderSource.str().c_str());
|
||||
pipelineDescriptor.vertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
pipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
pipelineDescriptor.colorStateCount = static_cast<uint32_t>(aspects.size());
|
||||
pipelineDescriptor.vertex.module = vsModule;
|
||||
pipelineDescriptor.cFragment.module = fsModule;
|
||||
pipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
pipelineDescriptor.cFragment.targetCount = static_cast<uint32_t>(aspects.size());
|
||||
|
||||
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
}
|
||||
|
||||
wgpu::ComputePipeline CreateSamplingComputePipeline(std::vector<TestAspect> aspects,
|
||||
|
@ -201,14 +201,14 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||
{1, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Depth},
|
||||
{2, wgpu::ShaderStage::Fragment, wgpu::BufferBindingType::Uniform}});
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.vertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
pipelineDescriptor.vertex.module = vsModule;
|
||||
pipelineDescriptor.cFragment.module = fsModule;
|
||||
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||
pipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
pipelineDescriptor.cColorStates[0].format = wgpu::TextureFormat::R32Float;
|
||||
pipelineDescriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
pipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::R32Float;
|
||||
|
||||
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
}
|
||||
|
||||
wgpu::ComputePipeline CreateComparisonComputePipeline() {
|
||||
|
|
|
@ -87,7 +87,7 @@ class DepthStencilStateTest : public DawnTest {
|
|||
}
|
||||
|
||||
struct TestSpec {
|
||||
const wgpu::DepthStencilStateDescriptor& depthStencilState;
|
||||
const wgpu::DepthStencilState& depthStencil;
|
||||
RGBA8 color;
|
||||
float depth;
|
||||
uint32_t stencil;
|
||||
|
@ -101,13 +101,13 @@ class DepthStencilStateTest : public DawnTest {
|
|||
bool less,
|
||||
bool equal,
|
||||
bool greater) {
|
||||
wgpu::StencilStateFaceDescriptor stencilFace;
|
||||
wgpu::StencilFaceState stencilFace;
|
||||
stencilFace.compare = wgpu::CompareFunction::Always;
|
||||
stencilFace.failOp = wgpu::StencilOperation::Keep;
|
||||
stencilFace.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
stencilFace.passOp = wgpu::StencilOperation::Keep;
|
||||
|
||||
wgpu::DepthStencilStateDescriptor baseState;
|
||||
wgpu::DepthStencilState baseState;
|
||||
baseState.depthWriteEnabled = true;
|
||||
baseState.depthCompare = wgpu::CompareFunction::Always;
|
||||
baseState.stencilBack = stencilFace;
|
||||
|
@ -115,7 +115,7 @@ class DepthStencilStateTest : public DawnTest {
|
|||
baseState.stencilReadMask = 0xff;
|
||||
baseState.stencilWriteMask = 0xff;
|
||||
|
||||
wgpu::DepthStencilStateDescriptor state;
|
||||
wgpu::DepthStencilState state;
|
||||
state.depthWriteEnabled = true;
|
||||
state.depthCompare = compareFunction;
|
||||
state.stencilBack = stencilFace;
|
||||
|
@ -151,12 +151,12 @@ class DepthStencilStateTest : public DawnTest {
|
|||
bool less,
|
||||
bool equal,
|
||||
bool greater) {
|
||||
wgpu::StencilStateFaceDescriptor baseStencilFaceDescriptor;
|
||||
wgpu::StencilFaceState baseStencilFaceDescriptor;
|
||||
baseStencilFaceDescriptor.compare = wgpu::CompareFunction::Always;
|
||||
baseStencilFaceDescriptor.failOp = wgpu::StencilOperation::Keep;
|
||||
baseStencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
baseStencilFaceDescriptor.passOp = wgpu::StencilOperation::Replace;
|
||||
wgpu::DepthStencilStateDescriptor baseState;
|
||||
wgpu::DepthStencilState baseState;
|
||||
baseState.depthWriteEnabled = false;
|
||||
baseState.depthCompare = wgpu::CompareFunction::Always;
|
||||
baseState.stencilBack = baseStencilFaceDescriptor;
|
||||
|
@ -164,12 +164,12 @@ class DepthStencilStateTest : public DawnTest {
|
|||
baseState.stencilReadMask = 0xff;
|
||||
baseState.stencilWriteMask = 0xff;
|
||||
|
||||
wgpu::StencilStateFaceDescriptor stencilFaceDescriptor;
|
||||
wgpu::StencilFaceState stencilFaceDescriptor;
|
||||
stencilFaceDescriptor.compare = compareFunction;
|
||||
stencilFaceDescriptor.failOp = wgpu::StencilOperation::Keep;
|
||||
stencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
stencilFaceDescriptor.passOp = wgpu::StencilOperation::Keep;
|
||||
wgpu::DepthStencilStateDescriptor state;
|
||||
wgpu::DepthStencilState state;
|
||||
state.depthWriteEnabled = false;
|
||||
state.depthCompare = wgpu::CompareFunction::Always;
|
||||
state.stencilBack = stencilFaceDescriptor;
|
||||
|
@ -204,12 +204,12 @@ class DepthStencilStateTest : public DawnTest {
|
|||
uint32_t initialStencil,
|
||||
uint32_t reference,
|
||||
uint32_t expectedStencil) {
|
||||
wgpu::StencilStateFaceDescriptor baseStencilFaceDescriptor;
|
||||
wgpu::StencilFaceState baseStencilFaceDescriptor;
|
||||
baseStencilFaceDescriptor.compare = wgpu::CompareFunction::Always;
|
||||
baseStencilFaceDescriptor.failOp = wgpu::StencilOperation::Keep;
|
||||
baseStencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
baseStencilFaceDescriptor.passOp = wgpu::StencilOperation::Replace;
|
||||
wgpu::DepthStencilStateDescriptor baseState;
|
||||
wgpu::DepthStencilState baseState;
|
||||
baseState.depthWriteEnabled = false;
|
||||
baseState.depthCompare = wgpu::CompareFunction::Always;
|
||||
baseState.stencilBack = baseStencilFaceDescriptor;
|
||||
|
@ -217,12 +217,12 @@ class DepthStencilStateTest : public DawnTest {
|
|||
baseState.stencilReadMask = 0xff;
|
||||
baseState.stencilWriteMask = 0xff;
|
||||
|
||||
wgpu::StencilStateFaceDescriptor stencilFaceDescriptor;
|
||||
wgpu::StencilFaceState stencilFaceDescriptor;
|
||||
stencilFaceDescriptor.compare = wgpu::CompareFunction::Always;
|
||||
stencilFaceDescriptor.failOp = wgpu::StencilOperation::Keep;
|
||||
stencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
stencilFaceDescriptor.passOp = stencilOperation;
|
||||
wgpu::DepthStencilStateDescriptor state;
|
||||
wgpu::DepthStencilState state;
|
||||
state.depthWriteEnabled = false;
|
||||
state.depthCompare = wgpu::CompareFunction::Always;
|
||||
state.stencilBack = stencilFaceDescriptor;
|
||||
|
@ -243,12 +243,12 @@ class DepthStencilStateTest : public DawnTest {
|
|||
|
||||
// Draw a list of test specs, and check if the stencil value is equal to the expected value
|
||||
void CheckStencil(std::vector<TestSpec> testParams, uint32_t expectedStencil) {
|
||||
wgpu::StencilStateFaceDescriptor stencilFaceDescriptor;
|
||||
wgpu::StencilFaceState stencilFaceDescriptor;
|
||||
stencilFaceDescriptor.compare = wgpu::CompareFunction::Equal;
|
||||
stencilFaceDescriptor.failOp = wgpu::StencilOperation::Keep;
|
||||
stencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
stencilFaceDescriptor.passOp = wgpu::StencilOperation::Keep;
|
||||
wgpu::DepthStencilStateDescriptor state;
|
||||
wgpu::DepthStencilState state;
|
||||
state.depthWriteEnabled = false;
|
||||
state.depthCompare = wgpu::CompareFunction::Always;
|
||||
state.stencilBack = stencilFaceDescriptor;
|
||||
|
@ -290,15 +290,15 @@ class DepthStencilStateTest : public DawnTest {
|
|||
|
||||
// Create a pipeline for the triangles with the test spec's depth stencil state
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.cDepthStencilState = test.depthStencilState;
|
||||
descriptor.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
descriptor.cRasterizationState.frontFace = test.frontFace;
|
||||
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
wgpu::DepthStencilState* depthStencil = descriptor.EnableDepthStencil();
|
||||
*depthStencil = test.depthStencil;
|
||||
depthStencil->format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
descriptor.primitive.frontFace = test.frontFace;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
// Create a bind group for the data
|
||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
|
||||
|
@ -335,13 +335,13 @@ class DepthStencilStateTest : public DawnTest {
|
|||
|
||||
// Test compilation and usage of the fixture
|
||||
TEST_P(DepthStencilStateTest, Basic) {
|
||||
wgpu::StencilStateFaceDescriptor stencilFace;
|
||||
wgpu::StencilFaceState stencilFace;
|
||||
stencilFace.compare = wgpu::CompareFunction::Always;
|
||||
stencilFace.failOp = wgpu::StencilOperation::Keep;
|
||||
stencilFace.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
stencilFace.passOp = wgpu::StencilOperation::Keep;
|
||||
|
||||
wgpu::DepthStencilStateDescriptor state;
|
||||
wgpu::DepthStencilState state;
|
||||
state.depthWriteEnabled = false;
|
||||
state.depthCompare = wgpu::CompareFunction::Always;
|
||||
state.stencilBack = stencilFace;
|
||||
|
@ -358,13 +358,13 @@ TEST_P(DepthStencilStateTest, Basic) {
|
|||
|
||||
// Test defaults: depth and stencil tests disabled
|
||||
TEST_P(DepthStencilStateTest, DepthStencilDisabled) {
|
||||
wgpu::StencilStateFaceDescriptor stencilFace;
|
||||
wgpu::StencilFaceState stencilFace;
|
||||
stencilFace.compare = wgpu::CompareFunction::Always;
|
||||
stencilFace.failOp = wgpu::StencilOperation::Keep;
|
||||
stencilFace.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
stencilFace.passOp = wgpu::StencilOperation::Keep;
|
||||
|
||||
wgpu::DepthStencilStateDescriptor state;
|
||||
wgpu::DepthStencilState state;
|
||||
state.depthWriteEnabled = false;
|
||||
state.depthCompare = wgpu::CompareFunction::Always;
|
||||
state.stencilBack = stencilFace;
|
||||
|
@ -423,13 +423,13 @@ TEST_P(DepthStencilStateTest, DepthNotEqual) {
|
|||
|
||||
// Test that disabling depth writes works and leaves the depth buffer unchanged
|
||||
TEST_P(DepthStencilStateTest, DepthWriteDisabled) {
|
||||
wgpu::StencilStateFaceDescriptor stencilFace;
|
||||
wgpu::StencilFaceState stencilFace;
|
||||
stencilFace.compare = wgpu::CompareFunction::Always;
|
||||
stencilFace.failOp = wgpu::StencilOperation::Keep;
|
||||
stencilFace.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
stencilFace.passOp = wgpu::StencilOperation::Keep;
|
||||
|
||||
wgpu::DepthStencilStateDescriptor baseState;
|
||||
wgpu::DepthStencilState baseState;
|
||||
baseState.depthWriteEnabled = true;
|
||||
baseState.depthCompare = wgpu::CompareFunction::Always;
|
||||
baseState.stencilBack = stencilFace;
|
||||
|
@ -437,7 +437,7 @@ TEST_P(DepthStencilStateTest, DepthWriteDisabled) {
|
|||
baseState.stencilReadMask = 0xff;
|
||||
baseState.stencilWriteMask = 0xff;
|
||||
|
||||
wgpu::DepthStencilStateDescriptor noDepthWrite;
|
||||
wgpu::DepthStencilState noDepthWrite;
|
||||
noDepthWrite.depthWriteEnabled = false;
|
||||
noDepthWrite.depthCompare = wgpu::CompareFunction::Always;
|
||||
noDepthWrite.stencilBack = stencilFace;
|
||||
|
@ -445,7 +445,7 @@ TEST_P(DepthStencilStateTest, DepthWriteDisabled) {
|
|||
noDepthWrite.stencilReadMask = 0xff;
|
||||
noDepthWrite.stencilWriteMask = 0xff;
|
||||
|
||||
wgpu::DepthStencilStateDescriptor checkState;
|
||||
wgpu::DepthStencilState checkState;
|
||||
checkState.depthWriteEnabled = false;
|
||||
checkState.depthCompare = wgpu::CompareFunction::Equal;
|
||||
checkState.stencilBack = stencilFace;
|
||||
|
@ -538,12 +538,12 @@ TEST_P(DepthStencilStateTest, StencilDecrementWrap) {
|
|||
|
||||
// Check that the setting a stencil read mask works
|
||||
TEST_P(DepthStencilStateTest, StencilReadMask) {
|
||||
wgpu::StencilStateFaceDescriptor baseStencilFaceDescriptor;
|
||||
wgpu::StencilFaceState baseStencilFaceDescriptor;
|
||||
baseStencilFaceDescriptor.compare = wgpu::CompareFunction::Always;
|
||||
baseStencilFaceDescriptor.failOp = wgpu::StencilOperation::Keep;
|
||||
baseStencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
baseStencilFaceDescriptor.passOp = wgpu::StencilOperation::Replace;
|
||||
wgpu::DepthStencilStateDescriptor baseState;
|
||||
wgpu::DepthStencilState baseState;
|
||||
baseState.depthWriteEnabled = false;
|
||||
baseState.depthCompare = wgpu::CompareFunction::Always;
|
||||
baseState.stencilBack = baseStencilFaceDescriptor;
|
||||
|
@ -551,12 +551,12 @@ TEST_P(DepthStencilStateTest, StencilReadMask) {
|
|||
baseState.stencilReadMask = 0xff;
|
||||
baseState.stencilWriteMask = 0xff;
|
||||
|
||||
wgpu::StencilStateFaceDescriptor stencilFaceDescriptor;
|
||||
wgpu::StencilFaceState stencilFaceDescriptor;
|
||||
stencilFaceDescriptor.compare = wgpu::CompareFunction::Equal;
|
||||
stencilFaceDescriptor.failOp = wgpu::StencilOperation::Keep;
|
||||
stencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
stencilFaceDescriptor.passOp = wgpu::StencilOperation::Keep;
|
||||
wgpu::DepthStencilStateDescriptor state;
|
||||
wgpu::DepthStencilState state;
|
||||
state.depthWriteEnabled = false;
|
||||
state.depthCompare = wgpu::CompareFunction::Always;
|
||||
state.stencilBack = stencilFaceDescriptor;
|
||||
|
@ -577,12 +577,12 @@ TEST_P(DepthStencilStateTest, StencilReadMask) {
|
|||
|
||||
// Check that setting a stencil write mask works
|
||||
TEST_P(DepthStencilStateTest, StencilWriteMask) {
|
||||
wgpu::StencilStateFaceDescriptor baseStencilFaceDescriptor;
|
||||
wgpu::StencilFaceState baseStencilFaceDescriptor;
|
||||
baseStencilFaceDescriptor.compare = wgpu::CompareFunction::Always;
|
||||
baseStencilFaceDescriptor.failOp = wgpu::StencilOperation::Keep;
|
||||
baseStencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
baseStencilFaceDescriptor.passOp = wgpu::StencilOperation::Replace;
|
||||
wgpu::DepthStencilStateDescriptor baseState;
|
||||
wgpu::DepthStencilState baseState;
|
||||
baseState.depthWriteEnabled = false;
|
||||
baseState.depthCompare = wgpu::CompareFunction::Always;
|
||||
baseState.stencilBack = baseStencilFaceDescriptor;
|
||||
|
@ -590,12 +590,12 @@ TEST_P(DepthStencilStateTest, StencilWriteMask) {
|
|||
baseState.stencilReadMask = 0xff;
|
||||
baseState.stencilWriteMask = 0x1;
|
||||
|
||||
wgpu::StencilStateFaceDescriptor stencilFaceDescriptor;
|
||||
wgpu::StencilFaceState stencilFaceDescriptor;
|
||||
stencilFaceDescriptor.compare = wgpu::CompareFunction::Equal;
|
||||
stencilFaceDescriptor.failOp = wgpu::StencilOperation::Keep;
|
||||
stencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
stencilFaceDescriptor.passOp = wgpu::StencilOperation::Keep;
|
||||
wgpu::DepthStencilStateDescriptor state;
|
||||
wgpu::DepthStencilState state;
|
||||
state.depthWriteEnabled = false;
|
||||
state.depthCompare = wgpu::CompareFunction::Always;
|
||||
state.stencilBack = stencilFaceDescriptor;
|
||||
|
@ -616,12 +616,12 @@ TEST_P(DepthStencilStateTest, StencilWriteMask) {
|
|||
|
||||
// Test that the stencil operation is executed on stencil fail
|
||||
TEST_P(DepthStencilStateTest, StencilFail) {
|
||||
wgpu::StencilStateFaceDescriptor baseStencilFaceDescriptor;
|
||||
wgpu::StencilFaceState baseStencilFaceDescriptor;
|
||||
baseStencilFaceDescriptor.compare = wgpu::CompareFunction::Always;
|
||||
baseStencilFaceDescriptor.failOp = wgpu::StencilOperation::Keep;
|
||||
baseStencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
baseStencilFaceDescriptor.passOp = wgpu::StencilOperation::Replace;
|
||||
wgpu::DepthStencilStateDescriptor baseState;
|
||||
wgpu::DepthStencilState baseState;
|
||||
baseState.depthWriteEnabled = false;
|
||||
baseState.depthCompare = wgpu::CompareFunction::Always;
|
||||
baseState.stencilBack = baseStencilFaceDescriptor;
|
||||
|
@ -629,12 +629,12 @@ TEST_P(DepthStencilStateTest, StencilFail) {
|
|||
baseState.stencilReadMask = 0xff;
|
||||
baseState.stencilWriteMask = 0xff;
|
||||
|
||||
wgpu::StencilStateFaceDescriptor stencilFaceDescriptor;
|
||||
wgpu::StencilFaceState stencilFaceDescriptor;
|
||||
stencilFaceDescriptor.compare = wgpu::CompareFunction::Less;
|
||||
stencilFaceDescriptor.failOp = wgpu::StencilOperation::Replace;
|
||||
stencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
stencilFaceDescriptor.passOp = wgpu::StencilOperation::Keep;
|
||||
wgpu::DepthStencilStateDescriptor state;
|
||||
wgpu::DepthStencilState state;
|
||||
state.depthWriteEnabled = false;
|
||||
state.depthCompare = wgpu::CompareFunction::Always;
|
||||
state.stencilBack = stencilFaceDescriptor;
|
||||
|
@ -653,12 +653,12 @@ TEST_P(DepthStencilStateTest, StencilFail) {
|
|||
|
||||
// Test that the stencil operation is executed on stencil pass, depth fail
|
||||
TEST_P(DepthStencilStateTest, StencilDepthFail) {
|
||||
wgpu::StencilStateFaceDescriptor baseStencilFaceDescriptor;
|
||||
wgpu::StencilFaceState baseStencilFaceDescriptor;
|
||||
baseStencilFaceDescriptor.compare = wgpu::CompareFunction::Always;
|
||||
baseStencilFaceDescriptor.failOp = wgpu::StencilOperation::Keep;
|
||||
baseStencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
baseStencilFaceDescriptor.passOp = wgpu::StencilOperation::Replace;
|
||||
wgpu::DepthStencilStateDescriptor baseState;
|
||||
wgpu::DepthStencilState baseState;
|
||||
baseState.depthWriteEnabled = true;
|
||||
baseState.depthCompare = wgpu::CompareFunction::Always;
|
||||
baseState.stencilBack = baseStencilFaceDescriptor;
|
||||
|
@ -666,12 +666,12 @@ TEST_P(DepthStencilStateTest, StencilDepthFail) {
|
|||
baseState.stencilReadMask = 0xff;
|
||||
baseState.stencilWriteMask = 0xff;
|
||||
|
||||
wgpu::StencilStateFaceDescriptor stencilFaceDescriptor;
|
||||
wgpu::StencilFaceState stencilFaceDescriptor;
|
||||
stencilFaceDescriptor.compare = wgpu::CompareFunction::Greater;
|
||||
stencilFaceDescriptor.failOp = wgpu::StencilOperation::Keep;
|
||||
stencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Replace;
|
||||
stencilFaceDescriptor.passOp = wgpu::StencilOperation::Keep;
|
||||
wgpu::DepthStencilStateDescriptor state;
|
||||
wgpu::DepthStencilState state;
|
||||
state.depthWriteEnabled = true;
|
||||
state.depthCompare = wgpu::CompareFunction::Less;
|
||||
state.stencilBack = stencilFaceDescriptor;
|
||||
|
@ -689,12 +689,12 @@ TEST_P(DepthStencilStateTest, StencilDepthFail) {
|
|||
|
||||
// Test that the stencil operation is executed on stencil pass, depth pass
|
||||
TEST_P(DepthStencilStateTest, StencilDepthPass) {
|
||||
wgpu::StencilStateFaceDescriptor baseStencilFaceDescriptor;
|
||||
wgpu::StencilFaceState baseStencilFaceDescriptor;
|
||||
baseStencilFaceDescriptor.compare = wgpu::CompareFunction::Always;
|
||||
baseStencilFaceDescriptor.failOp = wgpu::StencilOperation::Keep;
|
||||
baseStencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
baseStencilFaceDescriptor.passOp = wgpu::StencilOperation::Replace;
|
||||
wgpu::DepthStencilStateDescriptor baseState;
|
||||
wgpu::DepthStencilState baseState;
|
||||
baseState.depthWriteEnabled = true;
|
||||
baseState.depthCompare = wgpu::CompareFunction::Always;
|
||||
baseState.stencilBack = baseStencilFaceDescriptor;
|
||||
|
@ -702,12 +702,12 @@ TEST_P(DepthStencilStateTest, StencilDepthPass) {
|
|||
baseState.stencilReadMask = 0xff;
|
||||
baseState.stencilWriteMask = 0xff;
|
||||
|
||||
wgpu::StencilStateFaceDescriptor stencilFaceDescriptor;
|
||||
wgpu::StencilFaceState stencilFaceDescriptor;
|
||||
stencilFaceDescriptor.compare = wgpu::CompareFunction::Greater;
|
||||
stencilFaceDescriptor.failOp = wgpu::StencilOperation::Keep;
|
||||
stencilFaceDescriptor.depthFailOp = wgpu::StencilOperation::Keep;
|
||||
stencilFaceDescriptor.passOp = wgpu::StencilOperation::Replace;
|
||||
wgpu::DepthStencilStateDescriptor state;
|
||||
wgpu::DepthStencilState state;
|
||||
state.depthWriteEnabled = true;
|
||||
state.depthCompare = wgpu::CompareFunction::Less;
|
||||
state.stencilBack = stencilFaceDescriptor;
|
||||
|
@ -732,19 +732,18 @@ TEST_P(DepthStencilStateTest, CreatePipelineWithAllFormats) {
|
|||
};
|
||||
|
||||
for (wgpu::TextureFormat depthStencilFormat : kDepthStencilFormats) {
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.cDepthStencilState.format = depthStencilFormat;
|
||||
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.EnableDepthStencil(depthStencilFormat);
|
||||
|
||||
device.CreateRenderPipeline(&descriptor);
|
||||
device.CreateRenderPipeline2(&descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
// Test that the front and back stencil states are set correctly (and take frontFace into account)
|
||||
TEST_P(DepthStencilStateTest, StencilFrontAndBackFace) {
|
||||
wgpu::DepthStencilStateDescriptor state;
|
||||
wgpu::DepthStencilState state;
|
||||
state.stencilFront.compare = wgpu::CompareFunction::Always;
|
||||
state.stencilBack.compare = wgpu::CompareFunction::Never;
|
||||
|
||||
|
|
|
@ -40,17 +40,17 @@ class DestroyTest : public DawnTest {
|
|||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor.vertex.bufferCount = 1;
|
||||
descriptor.cBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cBuffers[0].attributeCount = 1;
|
||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, wgpu::BufferUsage::Vertex,
|
||||
|
|
|
@ -196,8 +196,8 @@ TEST_P(DeviceLostTest, CreateComputePipelineFails) {
|
|||
TEST_P(DeviceLostTest, CreateRenderPipelineFails) {
|
||||
SetCallbackAndLoseForTesting();
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline2(&descriptor));
|
||||
}
|
||||
|
||||
// Tests that CreateSampler fails when device is lost
|
||||
|
|
|
@ -39,18 +39,18 @@ class DrawIndexedIndirectTest : public DawnTest {
|
|||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleStrip;
|
||||
descriptor.cVertexState.indexFormat = wgpu::IndexFormat::Uint32;
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
|
||||
descriptor.primitive.stripIndexFormat = wgpu::IndexFormat::Uint32;
|
||||
descriptor.vertex.bufferCount = 1;
|
||||
descriptor.cBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cBuffers[0].attributeCount = 1;
|
||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, wgpu::BufferUsage::Vertex,
|
||||
|
|
|
@ -39,18 +39,18 @@ class DrawIndexedTest : public DawnTest {
|
|||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleStrip;
|
||||
descriptor.cVertexState.indexFormat = wgpu::IndexFormat::Uint32;
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
|
||||
descriptor.primitive.stripIndexFormat = wgpu::IndexFormat::Uint32;
|
||||
descriptor.vertex.bufferCount = 1;
|
||||
descriptor.cBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cBuffers[0].attributeCount = 1;
|
||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, wgpu::BufferUsage::Vertex,
|
||||
|
|
|
@ -39,18 +39,18 @@ class DrawIndirectTest : public DawnTest {
|
|||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleStrip;
|
||||
descriptor.cVertexState.indexFormat = wgpu::IndexFormat::Uint32;
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
|
||||
descriptor.primitive.stripIndexFormat = wgpu::IndexFormat::Uint32;
|
||||
descriptor.vertex.bufferCount = 1;
|
||||
descriptor.cBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cBuffers[0].attributeCount = 1;
|
||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, wgpu::BufferUsage::Vertex,
|
||||
|
|
|
@ -39,17 +39,17 @@ class DrawTest : public DawnTest {
|
|||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor.vertex.bufferCount = 1;
|
||||
descriptor.cBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cBuffers[0].attributeCount = 1;
|
||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, wgpu::BufferUsage::Vertex,
|
||||
|
|
|
@ -155,10 +155,10 @@ class DynamicBufferOffsetTests : public DawnTest {
|
|||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, fs.str().c_str());
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.vertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
pipelineDescriptor.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
pipelineDescriptor.vertex.module = vsModule;
|
||||
pipelineDescriptor.cFragment.module = fsModule;
|
||||
pipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
|
||||
wgpu::PipelineLayoutDescriptor pipelineLayoutDescriptor;
|
||||
if (isInheritedPipeline) {
|
||||
|
@ -169,7 +169,7 @@ class DynamicBufferOffsetTests : public DawnTest {
|
|||
pipelineLayoutDescriptor.bindGroupLayouts = mBindGroupLayouts;
|
||||
pipelineDescriptor.layout = device.CreatePipelineLayout(&pipelineLayoutDescriptor);
|
||||
|
||||
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
}
|
||||
|
||||
wgpu::ComputePipeline CreateComputePipeline(bool isInheritedPipeline = false) {
|
||||
|
|
|
@ -40,14 +40,14 @@ TEST_P(EntryPointTests, FragAndVertexSameModule) {
|
|||
)");
|
||||
|
||||
// Create a point pipeline from the module.
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
desc.vertexStage.module = module;
|
||||
desc.vertexStage.entryPoint = "vertex_main";
|
||||
desc.cFragmentStage.module = module;
|
||||
desc.cFragmentStage.entryPoint = "fragment_main";
|
||||
desc.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
desc.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||
utils::ComboRenderPipelineDescriptor2 desc;
|
||||
desc.vertex.module = module;
|
||||
desc.vertex.entryPoint = "vertex_main";
|
||||
desc.cFragment.module = module;
|
||||
desc.cFragment.entryPoint = "fragment_main";
|
||||
desc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
desc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
||||
|
||||
// Render the point and check that it was rendered.
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
|
||||
|
|
|
@ -154,19 +154,19 @@ void FirstIndexOffsetTests::TestImpl(DrawMode mode,
|
|||
|
||||
constexpr uint32_t kComponentsPerVertex = 4;
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDesc(device);
|
||||
pipelineDesc.vertexStage.module =
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
||||
pipelineDesc.vertex.module =
|
||||
utils::CreateShaderModuleFromWGSL(device, vertexShader.str().c_str());
|
||||
pipelineDesc.cFragmentStage.module =
|
||||
pipelineDesc.cFragment.module =
|
||||
utils::CreateShaderModuleFromWGSL(device, fragmentShader.str().c_str());
|
||||
pipelineDesc.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
pipelineDesc.cVertexState.vertexBufferCount = 1;
|
||||
pipelineDesc.cVertexState.cVertexBuffers[0].arrayStride = kComponentsPerVertex * sizeof(float);
|
||||
pipelineDesc.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
pipelineDesc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
pipelineDesc.cColorStates[0].format = renderPass.colorFormat;
|
||||
pipelineDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
pipelineDesc.vertex.bufferCount = 1;
|
||||
pipelineDesc.cBuffers[0].arrayStride = kComponentsPerVertex * sizeof(float);
|
||||
pipelineDesc.cBuffers[0].attributeCount = 1;
|
||||
pipelineDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
pipelineDesc.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDesc);
|
||||
|
||||
std::vector<float> vertexData(firstVertex * kComponentsPerVertex);
|
||||
vertexData.insert(vertexData.end(), {0, 0, 0, 1});
|
||||
|
|
|
@ -74,13 +74,13 @@ class GpuMemorySyncTests : public DawnTest {
|
|||
fragColor = vec4<f32>(f32(data.i) / 255.0, 0.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor rpDesc(device);
|
||||
rpDesc.vertexStage.module = vsModule;
|
||||
rpDesc.cFragmentStage.module = fsModule;
|
||||
rpDesc.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
rpDesc.cColorStates[0].format = colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 rpDesc;
|
||||
rpDesc.vertex.module = vsModule;
|
||||
rpDesc.cFragment.module = fsModule;
|
||||
rpDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
rpDesc.cTargets[0].format = colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&rpDesc);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&rpDesc);
|
||||
|
||||
wgpu::BindGroup bindGroup =
|
||||
utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), {{0, buffer}});
|
||||
|
@ -351,13 +351,13 @@ class StorageToUniformSyncTests : public DawnTest {
|
|||
fragColor = vec4<f32>(contents.color, 0.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor rpDesc(device);
|
||||
rpDesc.vertexStage.module = vsModule;
|
||||
rpDesc.cFragmentStage.module = fsModule;
|
||||
rpDesc.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
rpDesc.cColorStates[0].format = colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 rpDesc;
|
||||
rpDesc.vertex.module = vsModule;
|
||||
rpDesc.cFragment.module = fsModule;
|
||||
rpDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
rpDesc.cTargets[0].format = colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&rpDesc);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&rpDesc);
|
||||
|
||||
wgpu::BindGroup bindGroup =
|
||||
utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), {{0, mBuffer}});
|
||||
|
@ -595,17 +595,17 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
|
|||
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor rpDesc(device);
|
||||
rpDesc.vertexStage.module = vsModule;
|
||||
rpDesc.cFragmentStage.module = fsModule;
|
||||
rpDesc.primitiveTopology = wgpu::PrimitiveTopology::TriangleList;
|
||||
rpDesc.cVertexState.vertexBufferCount = 1;
|
||||
rpDesc.cVertexState.cVertexBuffers[0].arrayStride = kVertexBufferStride;
|
||||
rpDesc.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
rpDesc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
rpDesc.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 rpDesc;
|
||||
rpDesc.vertex.module = vsModule;
|
||||
rpDesc.cFragment.module = fsModule;
|
||||
rpDesc.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||
rpDesc.vertex.bufferCount = 1;
|
||||
rpDesc.cBuffers[0].arrayStride = kVertexBufferStride;
|
||||
rpDesc.cBuffers[0].attributeCount = 1;
|
||||
rpDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
rpDesc.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&rpDesc);
|
||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&rpDesc);
|
||||
|
||||
wgpu::BindGroup bindGroup1 = utils::MakeBindGroup(device, rp.GetBindGroupLayout(0),
|
||||
{{0, uniformBuffer}, {1, storageBuffer}});
|
||||
|
@ -712,17 +712,17 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
|
|||
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor rpDesc(device);
|
||||
rpDesc.vertexStage.module = vsModule;
|
||||
rpDesc.cFragmentStage.module = fsModule;
|
||||
rpDesc.primitiveTopology = wgpu::PrimitiveTopology::TriangleList;
|
||||
rpDesc.cVertexState.vertexBufferCount = 1;
|
||||
rpDesc.cVertexState.cVertexBuffers[0].arrayStride = kVertexBufferStride;
|
||||
rpDesc.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
rpDesc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
rpDesc.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 rpDesc;
|
||||
rpDesc.vertex.module = vsModule;
|
||||
rpDesc.cFragment.module = fsModule;
|
||||
rpDesc.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||
rpDesc.vertex.bufferCount = 1;
|
||||
rpDesc.cBuffers[0].arrayStride = kVertexBufferStride;
|
||||
rpDesc.cBuffers[0].attributeCount = 1;
|
||||
rpDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
rpDesc.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&rpDesc);
|
||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&rpDesc);
|
||||
|
||||
wgpu::BindGroup bindGroup1 =
|
||||
utils::MakeBindGroup(device, rp.GetBindGroupLayout(0),
|
||||
|
|
|
@ -285,12 +285,12 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
|||
}
|
||||
)");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vs;
|
||||
descriptor.cFragmentStage.module = fs;
|
||||
descriptor.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vs;
|
||||
descriptor.cFragment.module = fs;
|
||||
descriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
}
|
||||
|
||||
// The bindgroup containing the texture view for the ioSurface as well as the sampler.
|
||||
|
|
|
@ -51,18 +51,18 @@ class IndexFormatTest : public DawnTest {
|
|||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = primitiveTopology;
|
||||
descriptor.cVertexState.indexFormat = format;
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = primitiveTopology;
|
||||
descriptor.primitive.stripIndexFormat = format;
|
||||
descriptor.vertex.bufferCount = 1;
|
||||
descriptor.cBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cBuffers[0].attributeCount = 1;
|
||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
return device.CreateRenderPipeline(&descriptor);
|
||||
return device.CreateRenderPipeline2(&descriptor);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ class MultisampledRenderingTest : public DawnTest {
|
|||
uint32_t sampleMask = 0xFFFFFFFF,
|
||||
bool alphaToCoverageEnabled = false,
|
||||
bool flipTriangle = false) {
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
|
||||
// Draw a bottom-right triangle. In standard 4xMSAA pattern, for the pixels on diagonal,
|
||||
// only two of the samples will be touched.
|
||||
|
@ -222,33 +222,33 @@ class MultisampledRenderingTest : public DawnTest {
|
|||
})";
|
||||
|
||||
if (flipTriangle) {
|
||||
pipelineDescriptor.vertexStage.module =
|
||||
pipelineDescriptor.vertex.module =
|
||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vsFlipped);
|
||||
} else {
|
||||
pipelineDescriptor.vertexStage.module =
|
||||
pipelineDescriptor.vertex.module =
|
||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
|
||||
}
|
||||
|
||||
pipelineDescriptor.cFragmentStage.module =
|
||||
pipelineDescriptor.cFragment.module =
|
||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs);
|
||||
|
||||
if (hasDepthStencilAttachment) {
|
||||
pipelineDescriptor.cDepthStencilState.format = kDepthStencilFormat;
|
||||
pipelineDescriptor.cDepthStencilState.depthWriteEnabled = true;
|
||||
pipelineDescriptor.cDepthStencilState.depthCompare = wgpu::CompareFunction::Less;
|
||||
pipelineDescriptor.depthStencilState = &pipelineDescriptor.cDepthStencilState;
|
||||
wgpu::DepthStencilState* depthStencil =
|
||||
pipelineDescriptor.EnableDepthStencil(kDepthStencilFormat);
|
||||
depthStencil->depthWriteEnabled = true;
|
||||
depthStencil->depthCompare = wgpu::CompareFunction::Less;
|
||||
}
|
||||
|
||||
pipelineDescriptor.sampleCount = kSampleCount;
|
||||
pipelineDescriptor.sampleMask = sampleMask;
|
||||
pipelineDescriptor.alphaToCoverageEnabled = alphaToCoverageEnabled;
|
||||
pipelineDescriptor.multisample.count = kSampleCount;
|
||||
pipelineDescriptor.multisample.mask = sampleMask;
|
||||
pipelineDescriptor.multisample.alphaToCoverageEnabled = alphaToCoverageEnabled;
|
||||
|
||||
pipelineDescriptor.colorStateCount = numColorAttachments;
|
||||
pipelineDescriptor.cFragment.targetCount = numColorAttachments;
|
||||
for (uint32_t i = 0; i < numColorAttachments; ++i) {
|
||||
pipelineDescriptor.cColorStates[i].format = kColorFormat;
|
||||
pipelineDescriptor.cTargets[i].format = kColorFormat;
|
||||
}
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,16 +51,16 @@ class MultisampledSamplingTest : public DawnTest {
|
|||
DawnTest::SetUp();
|
||||
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
utils::ComboRenderPipelineDescriptor2 desc;
|
||||
|
||||
desc.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
desc.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<in> pos : vec2<f32>;
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
Position = vec4<f32>(pos, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
desc.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
desc.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<out> fragColor : f32;
|
||||
[[builtin(frag_depth)]] var<out> FragDepth : f32;
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
|
@ -68,23 +68,22 @@ class MultisampledSamplingTest : public DawnTest {
|
|||
FragDepth = 0.7;
|
||||
})");
|
||||
|
||||
desc.cVertexState.indexFormat = wgpu::IndexFormat::Uint32;
|
||||
desc.cVertexState.vertexBufferCount = 1;
|
||||
desc.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
desc.cVertexState.cVertexBuffers[0].arrayStride = 2 * sizeof(float);
|
||||
desc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x2;
|
||||
desc.primitive.stripIndexFormat = wgpu::IndexFormat::Uint32;
|
||||
desc.vertex.bufferCount = 1;
|
||||
desc.cBuffers[0].attributeCount = 1;
|
||||
desc.cBuffers[0].arrayStride = 2 * sizeof(float);
|
||||
desc.cAttributes[0].format = wgpu::VertexFormat::Float32x2;
|
||||
|
||||
desc.cDepthStencilState.format = kDepthFormat;
|
||||
desc.cDepthStencilState.depthWriteEnabled = true;
|
||||
desc.depthStencilState = &desc.cDepthStencilState;
|
||||
wgpu::DepthStencilState* depthStencil = desc.EnableDepthStencil(kDepthFormat);
|
||||
depthStencil->depthWriteEnabled = true;
|
||||
|
||||
desc.sampleCount = kSampleCount;
|
||||
desc.colorStateCount = 1;
|
||||
desc.cColorStates[0].format = kColorFormat;
|
||||
desc.multisample.count = kSampleCount;
|
||||
desc.cFragment.targetCount = 1;
|
||||
desc.cTargets[0].format = kColorFormat;
|
||||
|
||||
desc.primitiveTopology = wgpu::PrimitiveTopology::TriangleStrip;
|
||||
desc.primitive.topology = wgpu::PrimitiveTopology::TriangleStrip;
|
||||
|
||||
drawPipeline = device.CreateRenderPipeline(&desc);
|
||||
drawPipeline = device.CreateRenderPipeline2(&desc);
|
||||
}
|
||||
{
|
||||
wgpu::ComputePipelineDescriptor desc = {};
|
||||
|
|
|
@ -210,24 +210,24 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnLayout) {
|
|||
EXPECT_NE(pl.Get(), otherPl.Get());
|
||||
EXPECT_EQ(pl.Get() == samePl.Get(), !UsesWire());
|
||||
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
desc.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
utils::ComboRenderPipelineDescriptor2 desc;
|
||||
desc.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||
})");
|
||||
desc.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
desc.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
})");
|
||||
|
||||
desc.layout = pl;
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
||||
|
||||
desc.layout = samePl;
|
||||
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline(&desc);
|
||||
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline2(&desc);
|
||||
|
||||
desc.layout = otherPl;
|
||||
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline(&desc);
|
||||
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline2(&desc);
|
||||
|
||||
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
|
||||
EXPECT_EQ(pipeline.Get() == samePipeline.Get(), !UsesWire());
|
||||
|
@ -254,19 +254,19 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnVertexModule) {
|
|||
EXPECT_NE(module.Get(), otherModule.Get());
|
||||
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
|
||||
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
desc.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
utils::ComboRenderPipelineDescriptor2 desc;
|
||||
desc.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
})");
|
||||
|
||||
desc.vertexStage.module = module;
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||
desc.vertex.module = module;
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
||||
|
||||
desc.vertexStage.module = sameModule;
|
||||
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline(&desc);
|
||||
desc.vertex.module = sameModule;
|
||||
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline2(&desc);
|
||||
|
||||
desc.vertexStage.module = otherModule;
|
||||
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline(&desc);
|
||||
desc.vertex.module = otherModule;
|
||||
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline2(&desc);
|
||||
|
||||
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
|
||||
EXPECT_EQ(pipeline.Get() == samePipeline.Get(), !UsesWire());
|
||||
|
@ -289,21 +289,21 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) {
|
|||
EXPECT_NE(module.Get(), otherModule.Get());
|
||||
EXPECT_EQ(module.Get() == sameModule.Get(), !UsesWire());
|
||||
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
desc.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
utils::ComboRenderPipelineDescriptor2 desc;
|
||||
desc.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||
})");
|
||||
|
||||
desc.cFragmentStage.module = module;
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||
desc.cFragment.module = module;
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&desc);
|
||||
|
||||
desc.cFragmentStage.module = sameModule;
|
||||
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline(&desc);
|
||||
desc.cFragment.module = sameModule;
|
||||
wgpu::RenderPipeline samePipeline = device.CreateRenderPipeline2(&desc);
|
||||
|
||||
desc.cFragmentStage.module = otherModule;
|
||||
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline(&desc);
|
||||
desc.cFragment.module = otherModule;
|
||||
wgpu::RenderPipeline otherPipeline = device.CreateRenderPipeline2(&desc);
|
||||
|
||||
EXPECT_NE(pipeline.Get(), otherPipeline.Get());
|
||||
EXPECT_EQ(pipeline.Get() == samePipeline.Get(), !UsesWire());
|
||||
|
|
|
@ -180,13 +180,13 @@ TEST_P(OpArrayLengthTest, Fragment) {
|
|||
})")
|
||||
.c_str());
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
// "Draw" the lengths to the texture.
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
@ -240,13 +240,13 @@ TEST_P(OpArrayLengthTest, Vertex) {
|
|||
fragColor = pointColor;
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
// "Draw" the lengths to the texture.
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
|
|
@ -185,23 +185,23 @@ class PrimitiveTopologyTest : public DawnTest {
|
|||
// locations
|
||||
void DoTest(wgpu::PrimitiveTopology primitiveTopology,
|
||||
const std::vector<LocationSpec>& locationSpecs) {
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
|
||||
descriptor.primitiveTopology = primitiveTopology;
|
||||
descriptor.primitive.topology = primitiveTopology;
|
||||
if (primitiveTopology == wgpu::PrimitiveTopology::TriangleStrip ||
|
||||
primitiveTopology == wgpu::PrimitiveTopology::LineStrip) {
|
||||
descriptor.cVertexState.indexFormat = wgpu::IndexFormat::Uint32;
|
||||
descriptor.primitive.stripIndexFormat = wgpu::IndexFormat::Uint32;
|
||||
}
|
||||
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
descriptor.vertex.bufferCount = 1;
|
||||
descriptor.cBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cBuffers[0].attributeCount = 1;
|
||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
|
|
|
@ -121,24 +121,21 @@ class OcclusionQueryTests : public QueryTests {
|
|||
void TestOcclusionQueryWithDepthStencilTest(bool depthTestEnabled,
|
||||
bool stencilTestEnabled,
|
||||
OcclusionExpectation::Result expected) {
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
|
||||
// Enable depth and stencil tests and set comparison tests never pass.
|
||||
wgpu::DepthStencilStateDescriptor depthStencilState;
|
||||
depthStencilState.depthCompare =
|
||||
wgpu::DepthStencilState* depthStencil =
|
||||
descriptor.EnableDepthStencil(wgpu::TextureFormat::Depth24PlusStencil8);
|
||||
depthStencil->depthCompare =
|
||||
depthTestEnabled ? wgpu::CompareFunction::Never : wgpu::CompareFunction::Always;
|
||||
depthStencilState.stencilFront.compare =
|
||||
depthStencil->stencilFront.compare =
|
||||
stencilTestEnabled ? wgpu::CompareFunction::Never : wgpu::CompareFunction::Always;
|
||||
depthStencilState.stencilBack.compare =
|
||||
depthStencil->stencilBack.compare =
|
||||
stencilTestEnabled ? wgpu::CompareFunction::Never : wgpu::CompareFunction::Always;
|
||||
|
||||
descriptor.cDepthStencilState = depthStencilState;
|
||||
descriptor.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
wgpu::Texture renderTarget = CreateRenderTexture(wgpu::TextureFormat::RGBA8Unorm);
|
||||
wgpu::TextureView renderTargetView = renderTarget.CreateView();
|
||||
|
@ -173,11 +170,11 @@ class OcclusionQueryTests : public QueryTests {
|
|||
|
||||
void TestOcclusionQueryWithScissorTest(ScissorRect rect,
|
||||
OcclusionExpectation::Result expected) {
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
wgpu::QuerySet querySet = CreateOcclusionQuerySet(kQueryCount);
|
||||
wgpu::Buffer destination = CreateResolveBuffer(kQueryCount * sizeof(uint64_t));
|
||||
|
|
|
@ -49,17 +49,17 @@ class RenderBundleTest : public DawnTest {
|
|||
fragColor = fragmentUniformBuffer.color;
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor.vertex.bufferCount = 1;
|
||||
descriptor.cBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
descriptor.cBuffers[0].attributeCount = 1;
|
||||
descriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
float colors0[] = {kColors[0].r / 255.f, kColors[0].g / 255.f, kColors[0].b / 255.f,
|
||||
kColors[0].a / 255.f};
|
||||
|
|
|
@ -33,12 +33,12 @@ class DrawQuad {
|
|||
}
|
||||
|
||||
void Draw(wgpu::RenderPassEncoder* pass) {
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.layout = pipelineLayout;
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
|
||||
auto renderPipeline = device.CreateRenderPipeline(&descriptor);
|
||||
auto renderPipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
pass->SetPipeline(renderPipeline);
|
||||
pass->Draw(6, 1, 0, 0);
|
||||
|
|
|
@ -45,13 +45,13 @@ class RenderPassTest : public DawnTest {
|
|||
fragColor = vec4<f32>(0.0, 0.0, 1.0, 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = mVSModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor.cColorStates[0].format = kFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = mVSModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor.cTargets[0].format = kFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
}
|
||||
|
||||
wgpu::Texture CreateDefault2DTexture() {
|
||||
|
@ -143,14 +143,14 @@ TEST_P(RenderPassTest, NoCorrespondingFragmentShaderOutputs) {
|
|||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
})");
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = mVSModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor.cColorStates[0].format = kFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = mVSModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor.cTargets[0].format = kFormat;
|
||||
|
||||
wgpu::RenderPipeline pipelineWithNoFragmentOutput =
|
||||
device.CreateRenderPipeline(&descriptor);
|
||||
device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
pass.SetPipeline(pipelineWithNoFragmentOutput);
|
||||
pass.Draw(3);
|
||||
|
|
|
@ -69,22 +69,19 @@ class SamplerFilterAnisotropicTest : public DawnTest {
|
|||
fragColor = textureSample(texture0, sampler0, fragUV);
|
||||
})");
|
||||
|
||||
utils::ComboVertexStateDescriptor vertexState;
|
||||
vertexState.cVertexBuffers[0].attributeCount = 2;
|
||||
vertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
vertexState.cAttributes[1].shaderLocation = 1;
|
||||
vertexState.cAttributes[1].offset = 4 * sizeof(float);
|
||||
vertexState.cAttributes[1].format = wgpu::VertexFormat::Float32x2;
|
||||
vertexState.vertexBufferCount = 1;
|
||||
vertexState.cVertexBuffers[0].arrayStride = 6 * sizeof(float);
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
pipelineDescriptor.vertex.module = vsModule;
|
||||
pipelineDescriptor.cFragment.module = fsModule;
|
||||
pipelineDescriptor.cBuffers[0].attributeCount = 2;
|
||||
pipelineDescriptor.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
pipelineDescriptor.cAttributes[1].shaderLocation = 1;
|
||||
pipelineDescriptor.cAttributes[1].offset = 4 * sizeof(float);
|
||||
pipelineDescriptor.cAttributes[1].format = wgpu::VertexFormat::Float32x2;
|
||||
pipelineDescriptor.vertex.bufferCount = 1;
|
||||
pipelineDescriptor.cBuffers[0].arrayStride = 6 * sizeof(float);
|
||||
pipelineDescriptor.cTargets[0].format = mRenderPass.colorFormat;
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.vertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
pipelineDescriptor.vertexState = &vertexState;
|
||||
pipelineDescriptor.cColorStates[0].format = mRenderPass.colorFormat;
|
||||
|
||||
mPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
mPipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
mBindGroupLayout = mPipeline.GetBindGroupLayout(0);
|
||||
|
||||
InitTexture();
|
||||
|
|
|
@ -81,12 +81,12 @@ class SamplerTest : public DawnTest {
|
|||
fragColor = textureSample(texture0, sampler0, FragCoord.xy / vec2<f32>(2.0, 2.0));
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.vertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
pipelineDescriptor.cColorStates[0].format = mRenderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
pipelineDescriptor.vertex.module = vsModule;
|
||||
pipelineDescriptor.cFragment.module = fsModule;
|
||||
pipelineDescriptor.cTargets[0].format = mRenderPass.colorFormat;
|
||||
|
||||
mPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
mPipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
mBindGroupLayout = mPipeline.GetBindGroupLayout(0);
|
||||
|
||||
wgpu::TextureDescriptor descriptor;
|
||||
|
|
|
@ -42,12 +42,12 @@ class ScissorTest : public DawnTest {
|
|||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.cColorStates[0].format = format;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.cTargets[0].format = format;
|
||||
|
||||
return device.CreateRenderPipeline(&descriptor);
|
||||
return device.CreateRenderPipeline2(&descriptor);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -474,12 +474,12 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
|
|||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, vertexShader);
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, fragmentShader);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
desc.vertexStage.module = vsModule;
|
||||
desc.cFragmentStage.module = fsModule;
|
||||
desc.cColorStates[0].format = kRenderAttachmentFormat;
|
||||
desc.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
return device.CreateRenderPipeline(&desc);
|
||||
utils::ComboRenderPipelineDescriptor2 desc;
|
||||
desc.vertex.module = vsModule;
|
||||
desc.cFragment.module = fsModule;
|
||||
desc.cTargets[0].format = kRenderAttachmentFormat;
|
||||
desc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
return device.CreateRenderPipeline2(&desc);
|
||||
}
|
||||
|
||||
void CheckDrawsGreen(const char* vertexShader,
|
||||
|
|
|
@ -220,24 +220,24 @@ TEST_P(SwapChainValidationTests, ViewDestroyedAfterPresent) {
|
|||
|
||||
// Check that returned view is of the current format / usage / dimension / size / sample count
|
||||
TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) {
|
||||
utils::ComboRenderPipelineDescriptor pipelineDesc(device);
|
||||
pipelineDesc.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
||||
pipelineDesc.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
})");
|
||||
pipelineDesc.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDesc.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
// Validation will check that the sample count of the view matches this format.
|
||||
pipelineDesc.sampleCount = 1;
|
||||
pipelineDesc.colorStateCount = 2;
|
||||
pipelineDesc.multisample.count = 1;
|
||||
pipelineDesc.cFragment.targetCount = 2;
|
||||
// Validation will check that the format of the view matches this format.
|
||||
pipelineDesc.cColorStates[0].format = wgpu::TextureFormat::BGRA8Unorm;
|
||||
pipelineDesc.cColorStates[1].format = wgpu::TextureFormat::R8Unorm;
|
||||
device.CreateRenderPipeline(&pipelineDesc);
|
||||
pipelineDesc.cTargets[0].format = wgpu::TextureFormat::BGRA8Unorm;
|
||||
pipelineDesc.cTargets[1].format = wgpu::TextureFormat::R8Unorm;
|
||||
device.CreateRenderPipeline2(&pipelineDesc);
|
||||
|
||||
// Create a second texture to be used as render pass attachment. Validation will check that the
|
||||
// size of the view matches the size of this texture.
|
||||
|
|
|
@ -144,7 +144,7 @@ class TextureFormatTest : public DawnTest {
|
|||
// bindgroup and output its decompressed values to the render target.
|
||||
wgpu::RenderPipeline CreateSamplePipeline(FormatTestInfo sampleFormatInfo,
|
||||
FormatTestInfo renderFormatInfo) {
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
utils::ComboRenderPipelineDescriptor2 desc;
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
||||
|
@ -173,11 +173,11 @@ class TextureFormatTest : public DawnTest {
|
|||
wgpu::ShaderModule fsModule =
|
||||
utils::CreateShaderModuleFromWGSL(device, fsSource.str().c_str());
|
||||
|
||||
desc.vertexStage.module = vsModule;
|
||||
desc.cFragmentStage.module = fsModule;
|
||||
desc.cColorStates[0].format = renderFormatInfo.format;
|
||||
desc.vertex.module = vsModule;
|
||||
desc.cFragment.module = fsModule;
|
||||
desc.cTargets[0].format = renderFormatInfo.format;
|
||||
|
||||
return device.CreateRenderPipeline(&desc);
|
||||
return device.CreateRenderPipeline2(&desc);
|
||||
}
|
||||
|
||||
// The sampling test uploads the sample data in a texture with the sampleFormatInfo.format.
|
||||
|
|
|
@ -68,13 +68,13 @@ class TextureSubresourceTest : public DawnTest {
|
|||
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor.cColorStates[0].format = kFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor.cTargets[0].format = kFormat;
|
||||
|
||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&descriptor);
|
||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
||||
|
@ -117,15 +117,15 @@ class TextureSubresourceTest : public DawnTest {
|
|||
fragColor = textureSample(tex, samp, FragCoord.xy / vec2<f32>(4.0, 4.0));
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor.cColorStates[0].format = kFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList;
|
||||
descriptor.cTargets[0].format = kFormat;
|
||||
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
|
||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline(&descriptor);
|
||||
wgpu::RenderPipeline rp = device.CreateRenderPipeline2(&descriptor);
|
||||
wgpu::BindGroupLayout bgl = rp.GetBindGroupLayout(0);
|
||||
wgpu::BindGroup bindGroup =
|
||||
utils::MakeBindGroup(device, bgl, {{0, sampler}, {1, samplerView}});
|
||||
|
|
|
@ -163,12 +163,12 @@ class TextureViewSamplingTest : public DawnTest {
|
|||
wgpu::ShaderModule fsModule =
|
||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fragmentShader);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor textureDescriptor(device);
|
||||
textureDescriptor.vertexStage.module = mVSModule;
|
||||
textureDescriptor.cFragmentStage.module = fsModule;
|
||||
textureDescriptor.cColorStates[0].format = mRenderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 textureDescriptor;
|
||||
textureDescriptor.vertex.module = mVSModule;
|
||||
textureDescriptor.cFragment.module = fsModule;
|
||||
textureDescriptor.cTargets[0].format = mRenderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&textureDescriptor);
|
||||
|
||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
||||
{{0, mSampler}, {1, textureView}});
|
||||
|
@ -513,12 +513,12 @@ class TextureViewRenderingTest : public DawnTest {
|
|||
wgpu::ShaderModule oneColorFsModule = utils::CreateShaderModule(
|
||||
device, utils::SingleShaderStage::Fragment, oneColorFragmentShader);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.vertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = oneColorFsModule;
|
||||
pipelineDescriptor.cColorStates[0].format = kDefaultFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
pipelineDescriptor.vertex.module = vsModule;
|
||||
pipelineDescriptor.cFragment.module = oneColorFsModule;
|
||||
pipelineDescriptor.cTargets[0].format = kDefaultFormat;
|
||||
|
||||
wgpu::RenderPipeline oneColorPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
wgpu::RenderPipeline oneColorPipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
|
|
|
@ -66,21 +66,20 @@ class TextureZeroInitTest : public DawnTest {
|
|||
return descriptor;
|
||||
}
|
||||
wgpu::RenderPipeline CreatePipelineForTest(float depth = 0.f) {
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.vertexStage.module = CreateBasicVertexShaderForTest(depth);
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
pipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest(depth);
|
||||
const char* fs = R"(
|
||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
)";
|
||||
pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, fs);
|
||||
pipelineDescriptor.cFragment.module = utils::CreateShaderModuleFromWGSL(device, fs);
|
||||
wgpu::DepthStencilState* depthStencil = pipelineDescriptor.EnableDepthStencil();
|
||||
depthStencil->depthCompare = wgpu::CompareFunction::Equal;
|
||||
depthStencil->stencilFront.compare = wgpu::CompareFunction::Equal;
|
||||
|
||||
pipelineDescriptor.cDepthStencilState.depthCompare = wgpu::CompareFunction::Equal;
|
||||
pipelineDescriptor.cDepthStencilState.stencilFront.compare = wgpu::CompareFunction::Equal;
|
||||
pipelineDescriptor.depthStencilState = &pipelineDescriptor.cDepthStencilState;
|
||||
|
||||
return device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
return device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
}
|
||||
wgpu::ShaderModule CreateBasicVertexShaderForTest(float depth = 0.f) {
|
||||
std::string source = R"(
|
||||
|
@ -857,11 +856,11 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
|
|||
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
||||
|
||||
// Create render pipeline
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
renderPipelineDescriptor.cColorStates[0].format = kColorFormat;
|
||||
renderPipelineDescriptor.vertexStage.module = CreateBasicVertexShaderForTest();
|
||||
renderPipelineDescriptor.cFragmentStage.module = CreateSampledTextureFragmentShaderForTest();
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
||||
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
||||
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||
|
||||
// Create bindgroup
|
||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
||||
|
@ -916,11 +915,11 @@ TEST_P(TextureZeroInitTest, TextureBothSampledAndAttachmentClear) {
|
|||
wgpu::TextureView sampleView = texture.CreateView(&viewDesc);
|
||||
|
||||
// Create render pipeline
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
renderPipelineDescriptor.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
renderPipelineDescriptor.vertexStage.module = CreateBasicVertexShaderForTest();
|
||||
renderPipelineDescriptor.cFragmentStage.module = CreateSampledTextureFragmentShaderForTest();
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
renderPipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
||||
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||
|
||||
wgpu::BindGroup bindGroup =
|
||||
utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0), {{0, sampleView}});
|
||||
|
@ -1142,11 +1141,11 @@ TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) {
|
|||
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
|
||||
|
||||
// Create render pipeline
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
renderPipelineDescriptor.vertexStage.module = CreateBasicVertexShaderForTest();
|
||||
renderPipelineDescriptor.cFragmentStage.module = CreateSampledTextureFragmentShaderForTest();
|
||||
renderPipelineDescriptor.cColorStates[0].format = kColorFormat;
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
||||
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
||||
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||
|
||||
// Create bindgroup
|
||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
||||
|
@ -1288,11 +1287,11 @@ TEST_P(TextureZeroInitTest, PreservesInitializedMip) {
|
|||
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
|
||||
|
||||
// Create render pipeline
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
renderPipelineDescriptor.vertexStage.module = CreateBasicVertexShaderForTest();
|
||||
renderPipelineDescriptor.cFragmentStage.module = CreateSampledTextureFragmentShaderForTest();
|
||||
renderPipelineDescriptor.cColorStates[0].format = kColorFormat;
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
||||
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
||||
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||
|
||||
// Create bindgroup
|
||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
||||
|
@ -1365,11 +1364,11 @@ TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) {
|
|||
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
|
||||
|
||||
// Create render pipeline
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
renderPipelineDescriptor.vertexStage.module = CreateBasicVertexShaderForTest();
|
||||
renderPipelineDescriptor.cFragmentStage.module = CreateSampledTextureFragmentShaderForTest();
|
||||
renderPipelineDescriptor.cColorStates[0].format = kColorFormat;
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
||||
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
||||
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||
|
||||
// Only sample from the uninitialized first layer.
|
||||
wgpu::TextureViewDescriptor textureViewDescriptor;
|
||||
|
@ -1790,13 +1789,12 @@ class CompressedTextureZeroInitTest : public TextureZeroInitTest {
|
|||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
renderPipelineDescriptor.cColorStates[0].format = kColorFormat;
|
||||
renderPipelineDescriptor.vertexStage.module = CreateBasicVertexShaderForTest();
|
||||
renderPipelineDescriptor.cFragmentStage.module =
|
||||
CreateSampledTextureFragmentShaderForTest();
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
renderPipelineDescriptor.cTargets[0].format = kColorFormat;
|
||||
renderPipelineDescriptor.vertex.module = CreateBasicVertexShaderForTest();
|
||||
renderPipelineDescriptor.cFragment.module = CreateSampledTextureFragmentShaderForTest();
|
||||
wgpu::RenderPipeline renderPipeline =
|
||||
device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||
pass.SetPipeline(renderPipeline);
|
||||
|
||||
wgpu::TextureViewDescriptor textureViewDescriptor = CreateTextureViewDescriptor(
|
||||
|
|
|
@ -68,15 +68,16 @@ class VertexBufferRobustnessTest : public DawnTest {
|
|||
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.vertexState = &vertexState;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.vertex.bufferCount = vertexState.vertexBufferCount;
|
||||
descriptor.vertex.buffers = &vertexState.cVertexBuffers[0];
|
||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
renderPass.renderPassInfo.cColorAttachments[0].clearColor = {0, 0, 0, 1};
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||
|
|
|
@ -359,16 +359,16 @@ class VertexFormatTest : public DawnTest {
|
|||
strideBytes += (4 - strideBytes % 4);
|
||||
}
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.cVertexState.vertexBufferCount = 1;
|
||||
descriptor.cVertexState.cVertexBuffers[0].arrayStride = strideBytes;
|
||||
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
descriptor.cVertexState.cAttributes[0].format = format;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.vertex.bufferCount = 1;
|
||||
descriptor.cBuffers[0].arrayStride = strideBytes;
|
||||
descriptor.cBuffers[0].attributeCount = 1;
|
||||
descriptor.cAttributes[0].format = format;
|
||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
return device.CreateRenderPipeline(&descriptor);
|
||||
return device.CreateRenderPipeline2(&descriptor);
|
||||
}
|
||||
|
||||
template <typename VertexType, typename ExpectedType>
|
||||
|
|
|
@ -132,13 +132,14 @@ class VertexStateTest : public DawnTest {
|
|||
}
|
||||
)");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.vertexState = &vertexState;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.vertex.bufferCount = vertexState.vertexBufferCount;
|
||||
descriptor.vertex.buffers = vertexState.vertexBuffers;
|
||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
return device.CreateRenderPipeline(&descriptor);
|
||||
return device.CreateRenderPipeline2(&descriptor);
|
||||
}
|
||||
|
||||
struct VertexAttributeSpec {
|
||||
|
@ -567,8 +568,8 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) {
|
|||
wgpu::Buffer vertexBuffer =
|
||||
utils::CreateBufferFromData(device, &data, sizeof(data), wgpu::BufferUsage::Vertex);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDesc(device);
|
||||
pipelineDesc.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
||||
pipelineDesc.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<in> attr0 : vec4<f32>;
|
||||
[[location(1)]] var<in> attr1 : vec2<u32>;
|
||||
[[location(2)]] var<in> attr2 : vec4<f32>;
|
||||
|
@ -594,17 +595,18 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) {
|
|||
color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
})");
|
||||
pipelineDesc.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDesc.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<in> color : vec4<f32>;
|
||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
fragColor = color;
|
||||
})");
|
||||
pipelineDesc.vertexState = &vertexState;
|
||||
pipelineDesc.cColorStates[0].format = renderPass.colorFormat;
|
||||
pipelineDesc.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
pipelineDesc.vertex.bufferCount = vertexState.vertexBufferCount;
|
||||
pipelineDesc.vertex.buffers = &vertexState.cVertexBuffers[0];
|
||||
pipelineDesc.cTargets[0].format = renderPass.colorFormat;
|
||||
pipelineDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDesc);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||
|
@ -651,13 +653,14 @@ TEST_P(OptionalVertexStateTest, Basic) {
|
|||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.vertexState = nullptr;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.vertex.bufferCount = 0;
|
||||
descriptor.vertex.buffers = nullptr;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
|
|
|
@ -36,13 +36,13 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) {
|
|||
fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
descriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&descriptor);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
|
|
|
@ -60,11 +60,11 @@ class ViewportTest : public DawnTest {
|
|||
uint32_t height,
|
||||
bool doViewportCall = true) {
|
||||
// Create a pipeline that will draw a white quad.
|
||||
utils::ComboRenderPipelineDescriptor pipelineDesc(device);
|
||||
pipelineDesc.vertexStage.module = mQuadVS;
|
||||
pipelineDesc.cFragmentStage.module = mQuadFS;
|
||||
pipelineDesc.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc);
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
||||
pipelineDesc.vertex.module = mQuadVS;
|
||||
pipelineDesc.cFragment.module = mQuadFS;
|
||||
pipelineDesc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDesc);
|
||||
|
||||
// Render the quad with the viewport call.
|
||||
utils::BasicRenderPass rp = utils::CreateBasicRenderPass(device, kWidth, kHeight);
|
||||
|
@ -94,8 +94,8 @@ class ViewportTest : public DawnTest {
|
|||
|
||||
void TestViewportDepth(float minDepth, float maxDepth, bool doViewportCall = true) {
|
||||
// Create a pipeline drawing 3 points at depth 1.0, 0.5 and 0.0.
|
||||
utils::ComboRenderPipelineDescriptor pipelineDesc(device);
|
||||
pipelineDesc.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
||||
pipelineDesc.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
|
||||
|
@ -107,13 +107,13 @@ class ViewportTest : public DawnTest {
|
|||
[[stage(vertex)]] fn main() -> void {
|
||||
Position = vec4<f32>(points[VertexIndex], 1.0);
|
||||
})");
|
||||
pipelineDesc.cFragmentStage.module = mQuadFS;
|
||||
pipelineDesc.colorStateCount = 0;
|
||||
pipelineDesc.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||
pipelineDesc.depthStencilState = &pipelineDesc.cDepthStencilState;
|
||||
pipelineDesc.cDepthStencilState.depthWriteEnabled = true;
|
||||
pipelineDesc.cDepthStencilState.format = wgpu::TextureFormat::Depth32Float;
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDesc);
|
||||
pipelineDesc.cFragment.module = mQuadFS;
|
||||
pipelineDesc.cFragment.targetCount = 0;
|
||||
pipelineDesc.primitive.topology = wgpu::PrimitiveTopology::PointList;
|
||||
wgpu::DepthStencilState* depthStencil =
|
||||
pipelineDesc.EnableDepthStencil(wgpu::TextureFormat::Depth32Float);
|
||||
depthStencil->depthWriteEnabled = true;
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDesc);
|
||||
|
||||
// Create the texture that will store the post-viewport-transform depth.
|
||||
wgpu::TextureDescriptor depthDesc;
|
||||
|
@ -187,11 +187,11 @@ TEST_P(ViewportTest, ViewportDepth) {
|
|||
|
||||
// Test that a draw with an empty viewport doesn't draw anything.
|
||||
TEST_P(ViewportTest, EmptyViewport) {
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
pipelineDescriptor.vertexStage.module = mQuadVS;
|
||||
pipelineDescriptor.cFragmentStage.module = mQuadFS;
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
pipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
pipelineDescriptor.vertex.module = mQuadVS;
|
||||
pipelineDescriptor.cFragment.module = mQuadFS;
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
|
||||
|
||||
|
|
|
@ -351,14 +351,13 @@ void DrawCallPerf::SetUp() {
|
|||
}
|
||||
|
||||
// Setup the base render pipeline descriptor.
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
|
||||
renderPipelineDesc.cVertexState.vertexBufferCount = 1;
|
||||
renderPipelineDesc.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
renderPipelineDesc.cVertexState.cVertexBuffers[0].attributeCount = 1;
|
||||
renderPipelineDesc.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
renderPipelineDesc.depthStencilState = &renderPipelineDesc.cDepthStencilState;
|
||||
renderPipelineDesc.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
renderPipelineDesc.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDesc;
|
||||
renderPipelineDesc.vertex.bufferCount = 1;
|
||||
renderPipelineDesc.cBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
renderPipelineDesc.cBuffers[0].attributeCount = 1;
|
||||
renderPipelineDesc.cAttributes[0].format = wgpu::VertexFormat::Float32x4;
|
||||
renderPipelineDesc.EnableDepthStencil(wgpu::TextureFormat::Depth24PlusStencil8);
|
||||
renderPipelineDesc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
|
||||
// Create the pipeline layout for the first pipeline.
|
||||
wgpu::PipelineLayoutDescriptor pipelineLayoutDesc = {};
|
||||
|
@ -372,9 +371,9 @@ void DrawCallPerf::SetUp() {
|
|||
|
||||
// Create the first pipeline.
|
||||
renderPipelineDesc.layout = pipelineLayout;
|
||||
renderPipelineDesc.vertexStage.module = vsModule;
|
||||
renderPipelineDesc.cFragmentStage.module = fsModule;
|
||||
mPipelines[0] = device.CreateRenderPipeline(&renderPipelineDesc);
|
||||
renderPipelineDesc.vertex.module = vsModule;
|
||||
renderPipelineDesc.cFragment.module = fsModule;
|
||||
mPipelines[0] = device.CreateRenderPipeline2(&renderPipelineDesc);
|
||||
|
||||
// If the test is using a dynamic pipeline, create the second pipeline.
|
||||
if (GetParam().pipelineType == Pipeline::Dynamic) {
|
||||
|
@ -400,8 +399,8 @@ void DrawCallPerf::SetUp() {
|
|||
|
||||
// Create the pipeline.
|
||||
renderPipelineDesc.layout = pipelineLayout;
|
||||
renderPipelineDesc.cFragmentStage.module = fsModule;
|
||||
mPipelines[1] = device.CreateRenderPipeline(&renderPipelineDesc);
|
||||
renderPipelineDesc.cFragment.module = fsModule;
|
||||
mPipelines[1] = device.CreateRenderPipeline2(&renderPipelineDesc);
|
||||
|
||||
// Create the buffer and bind group to bind to the constant bind group layout slot.
|
||||
constexpr float kConstantData[] = {0.01, 0.02, 0.03};
|
||||
|
@ -459,8 +458,8 @@ void DrawCallPerf::SetUp() {
|
|||
if (GetParam().withRenderBundle == RenderBundle::Yes) {
|
||||
wgpu::RenderBundleEncoderDescriptor descriptor = {};
|
||||
descriptor.colorFormatsCount = 1;
|
||||
descriptor.colorFormats = &renderPipelineDesc.cColorStates[0].format;
|
||||
descriptor.depthStencilFormat = renderPipelineDesc.cDepthStencilState.format;
|
||||
descriptor.colorFormats = &renderPipelineDesc.cTargets[0].format;
|
||||
descriptor.depthStencilFormat = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
|
||||
wgpu::RenderBundleEncoder encoder = device.CreateRenderBundleEncoder(&descriptor);
|
||||
RecordRenderCommands(encoder);
|
||||
|
|
|
@ -69,21 +69,21 @@ class SubresourceTrackingPerf : public DawnPerfTestWithParams<SubresourceTrackin
|
|||
uploadTexDesc.usage = wgpu::TextureUsage::CopySrc;
|
||||
mUploadTexture = device.CreateTexture(&uploadTexDesc);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDesc(device);
|
||||
pipelineDesc.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
||||
pipelineDesc.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
Position = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
)");
|
||||
pipelineDesc.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDesc.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
||||
[[group(0), binding(0)]] var materials : texture_2d<f32>;
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
FragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
)");
|
||||
mPipeline = device.CreateRenderPipeline(&pipelineDesc);
|
||||
mPipeline = device.CreateRenderPipeline2(&pipelineDesc);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -59,7 +59,7 @@ TEST_F(RenderPipelineValidationTest, CreationSuccess) {
|
|||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
|
||||
device.CreateRenderPipeline(&descriptor);
|
||||
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
|
||||
}
|
||||
{
|
||||
// Vertex input should be optional
|
||||
|
@ -68,7 +68,7 @@ TEST_F(RenderPipelineValidationTest, CreationSuccess) {
|
|||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.vertexState = nullptr;
|
||||
|
||||
device.CreateRenderPipeline(&descriptor);
|
||||
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
|
||||
}
|
||||
{
|
||||
// Rasterization state should be optional
|
||||
|
@ -76,7 +76,7 @@ TEST_F(RenderPipelineValidationTest, CreationSuccess) {
|
|||
descriptor.vertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.rasterizationState = nullptr;
|
||||
device.CreateRenderPipeline(&descriptor);
|
||||
EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -127,14 +127,14 @@ TEST_P(D3D12DescriptorHeapTests, SwitchOverViewHeap) {
|
|||
DAWN_SKIP_TEST_IF(!mD3DDevice->IsToggleEnabled(
|
||||
dawn_native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting));
|
||||
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
|
||||
// Fill in a view heap with "view only" bindgroups (1x view per group) by creating a
|
||||
// view bindgroup each draw. After HEAP_SIZE + 1 draws, the heaps must switch over.
|
||||
renderPipelineDescriptor.vertexStage.module = mSimpleVSModule;
|
||||
renderPipelineDescriptor.cFragmentStage.module = mSimpleFSModule;
|
||||
renderPipelineDescriptor.vertex.module = mSimpleVSModule;
|
||||
renderPipelineDescriptor.cFragment.module = mSimpleFSModule;
|
||||
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
Device* d3dDevice = reinterpret_cast<Device*>(device.Get());
|
||||
|
@ -171,25 +171,25 @@ TEST_P(D3D12DescriptorHeapTests, SwitchOverViewHeap) {
|
|||
|
||||
// Verify the shader visible sampler heaps does not switch over within a single submit.
|
||||
TEST_P(D3D12DescriptorHeapTests, NoSwitchOverSamplerHeap) {
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
|
||||
// Fill in a sampler heap with "sampler only" bindgroups (1x sampler per group) by creating a
|
||||
// sampler bindgroup each draw. After HEAP_SIZE + 1 draws, the heaps WILL NOT switch over
|
||||
// because the sampler heap allocations are de-duplicated.
|
||||
renderPipelineDescriptor.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
renderPipelineDescriptor.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
renderPipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
||||
[[group(0), binding(0)]] var sampler0 : sampler;
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
FragColor = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||
})");
|
||||
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
|
@ -442,10 +442,10 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBO) {
|
|||
utils::BasicRenderPass renderPass =
|
||||
MakeRenderPass(kRTSize, kRTSize, wgpu::TextureFormat::R32Float);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.vertexStage.module = mSimpleVSModule;
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
pipelineDescriptor.vertex.module = mSimpleVSModule;
|
||||
|
||||
pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDescriptor.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct U {
|
||||
heapSize : f32;
|
||||
};
|
||||
|
@ -456,15 +456,18 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBO) {
|
|||
FragColor = buffer0.heapSize;
|
||||
})");
|
||||
|
||||
pipelineDescriptor.cColorStates[0].format = wgpu::TextureFormat::R32Float;
|
||||
pipelineDescriptor.cColorStates[0].colorBlend.operation = wgpu::BlendOperation::Add;
|
||||
pipelineDescriptor.cColorStates[0].colorBlend.srcFactor = wgpu::BlendFactor::One;
|
||||
pipelineDescriptor.cColorStates[0].colorBlend.dstFactor = wgpu::BlendFactor::One;
|
||||
pipelineDescriptor.cColorStates[0].alphaBlend.operation = wgpu::BlendOperation::Add;
|
||||
pipelineDescriptor.cColorStates[0].alphaBlend.srcFactor = wgpu::BlendFactor::One;
|
||||
pipelineDescriptor.cColorStates[0].alphaBlend.dstFactor = wgpu::BlendFactor::One;
|
||||
wgpu::BlendState blend;
|
||||
blend.color.operation = wgpu::BlendOperation::Add;
|
||||
blend.color.srcFactor = wgpu::BlendFactor::One;
|
||||
blend.color.dstFactor = wgpu::BlendFactor::One;
|
||||
blend.alpha.operation = wgpu::BlendOperation::Add;
|
||||
blend.alpha.srcFactor = wgpu::BlendFactor::One;
|
||||
blend.alpha.dstFactor = wgpu::BlendFactor::One;
|
||||
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
pipelineDescriptor.cTargets[0].format = wgpu::TextureFormat::R32Float;
|
||||
pipelineDescriptor.cTargets[0].blend = &blend;
|
||||
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
|
||||
const uint32_t heapSize =
|
||||
mD3DDevice->GetViewShaderVisibleDescriptorAllocator()->GetShaderVisibleHeapSizeForTesting();
|
||||
|
@ -515,12 +518,12 @@ TEST_P(D3D12DescriptorHeapTests, EncodeUBOOverflowMultipleSubmit) {
|
|||
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.vertexStage.module = mSimpleVSModule;
|
||||
pipelineDescriptor.cFragmentStage.module = mSimpleFSModule;
|
||||
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
pipelineDescriptor.vertex.module = mSimpleVSModule;
|
||||
pipelineDescriptor.cFragment.module = mSimpleFSModule;
|
||||
pipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
|
||||
// Encode the first descriptor and submit.
|
||||
{
|
||||
|
@ -600,12 +603,12 @@ TEST_P(D3D12DescriptorHeapTests, EncodeReuseUBOOverflow) {
|
|||
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.vertexStage.module = mSimpleVSModule;
|
||||
pipelineDescriptor.cFragmentStage.module = mSimpleFSModule;
|
||||
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
pipelineDescriptor.vertex.module = mSimpleVSModule;
|
||||
pipelineDescriptor.cFragment.module = mSimpleFSModule;
|
||||
pipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
|
||||
std::array<float, 4> redColor = {1, 0, 0, 1};
|
||||
wgpu::Buffer firstUniformBuffer = utils::CreateBufferFromData(
|
||||
|
@ -661,12 +664,12 @@ TEST_P(D3D12DescriptorHeapTests, EncodeReuseUBOMultipleSubmits) {
|
|||
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.vertexStage.module = mSimpleVSModule;
|
||||
pipelineDescriptor.cFragmentStage.module = mSimpleFSModule;
|
||||
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
pipelineDescriptor.vertex.module = mSimpleVSModule;
|
||||
pipelineDescriptor.cFragment.module = mSimpleFSModule;
|
||||
pipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
|
||||
// Encode heap worth of descriptors plus one more.
|
||||
std::array<float, 4> redColor = {1, 0, 0, 1};
|
||||
|
@ -773,9 +776,9 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
|
|||
}
|
||||
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDescriptor;
|
||||
|
||||
pipelineDescriptor.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDescriptor.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct U {
|
||||
transform : mat2x2<f32>;
|
||||
};
|
||||
|
@ -791,7 +794,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
|
|||
);
|
||||
Position = vec4<f32>(buffer0.transform * (pos[VertexIndex]), 0.0, 1.0);
|
||||
})");
|
||||
pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDescriptor.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct U {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
|
@ -807,9 +810,9 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
|
|||
})");
|
||||
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
pipelineDescriptor.cTargets[0].format = renderPass.colorFormat;
|
||||
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline2(&pipelineDescriptor);
|
||||
|
||||
// Encode a heap worth of descriptors |kNumOfHeaps| times.
|
||||
constexpr float dummy = 0.0f;
|
||||
|
|
|
@ -330,11 +330,11 @@ TEST_P(D3D12ResourceResidencyTests, SetExternalReservation) {
|
|||
// Checks that when a descriptor heap is bound, it is locked resident. Also checks that when a
|
||||
// previous descriptor heap becomes unbound, it is unlocked, placed in the LRU and can be evicted.
|
||||
TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) {
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
|
||||
|
||||
// Fill in a view heap with "view only" bindgroups (1x view per group) by creating a
|
||||
// view bindgroup each draw. After HEAP_SIZE + 1 draws, the heaps must switch over.
|
||||
renderPipelineDescriptor.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
renderPipelineDescriptor.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
||||
|
||||
|
@ -347,7 +347,7 @@ TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) {
|
|||
Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
||||
})");
|
||||
|
||||
renderPipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct U {
|
||||
color : vec4<f32>;
|
||||
};
|
||||
|
@ -358,7 +358,7 @@ TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) {
|
|||
FragColor = colorBuffer.color;
|
||||
})");
|
||||
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline2(&renderPipelineDescriptor);
|
||||
constexpr uint32_t kSize = 512;
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kSize, kSize);
|
||||
|
||||
|
|
|
@ -73,8 +73,6 @@ namespace utils {
|
|||
std::array<wgpu::BlendState, kMaxColorAttachments> cBlends;
|
||||
|
||||
wgpu::FragmentState cFragment;
|
||||
|
||||
private:
|
||||
wgpu::DepthStencilState cDepthStencil;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue