mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 16:37:08 +00:00
Use a descriptor for PipelineLayout (#206)
Adds support for structures inside descriptors.
This commit is contained in:
@@ -41,9 +41,7 @@ class BlendStateTest : public NXTTest {
|
||||
.SetBindingsType(nxt::ShaderStageBit::Fragment, nxt::BindingType::UniformBuffer, 0, 1)
|
||||
.GetResult();
|
||||
|
||||
pipelineLayout = device.CreatePipelineLayoutBuilder()
|
||||
.SetBindGroupLayout(0, bindGroupLayout)
|
||||
.GetResult();
|
||||
pipelineLayout = utils::MakeBasicPipelineLayout(device, &bindGroupLayout);
|
||||
|
||||
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
}
|
||||
|
||||
@@ -82,9 +82,7 @@ class DepthStencilStateTest : public NXTTest {
|
||||
.SetBindingsType(nxt::ShaderStageBit::Vertex | nxt::ShaderStageBit::Fragment, nxt::BindingType::UniformBuffer, 0, 1)
|
||||
.GetResult();
|
||||
|
||||
pipelineLayout = device.CreatePipelineLayoutBuilder()
|
||||
.SetBindGroupLayout(0, bindGroupLayout)
|
||||
.GetResult();
|
||||
pipelineLayout = utils::MakeBasicPipelineLayout(device, &bindGroupLayout);
|
||||
}
|
||||
|
||||
struct TestSpec {
|
||||
|
||||
@@ -49,9 +49,7 @@ class PushConstantTest: public NXTTest {
|
||||
.SetBindingsType(kAllStages, nxt::BindingType::StorageBuffer, 0, extraBuffer ? 2 : 1)
|
||||
.GetResult();
|
||||
|
||||
nxt::PipelineLayout pl = device.CreatePipelineLayoutBuilder()
|
||||
.SetBindGroupLayout(0, bgl)
|
||||
.GetResult();
|
||||
nxt::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||
|
||||
nxt::BufferView views[2] = {
|
||||
buf1.CreateBufferViewBuilder().SetExtent(0, 4).GetResult(),
|
||||
@@ -155,7 +153,7 @@ class PushConstantTest: public NXTTest {
|
||||
}
|
||||
|
||||
nxt::PipelineLayout MakeEmptyLayout() {
|
||||
return device.CreatePipelineLayoutBuilder().GetResult();
|
||||
return utils::MakeBasicPipelineLayout(device, nullptr);
|
||||
}
|
||||
|
||||
// The render pipeline adds one to the red channel for successful vertex push constant test
|
||||
|
||||
@@ -28,8 +28,7 @@ class DrawQuad {
|
||||
vsModule = utils::CreateShaderModule(*device, nxt::ShaderStage::Vertex, vsSource);
|
||||
fsModule = utils::CreateShaderModule(*device, nxt::ShaderStage::Fragment, fsSource);
|
||||
|
||||
pipelineLayout = device->CreatePipelineLayoutBuilder()
|
||||
.GetResult();
|
||||
pipelineLayout = utils::MakeBasicPipelineLayout(*device, nullptr);
|
||||
}
|
||||
|
||||
void Draw(nxt::CommandBufferBuilder* builder) {
|
||||
|
||||
@@ -48,9 +48,7 @@ protected:
|
||||
.SetBindingsType(nxt::ShaderStageBit::Fragment, nxt::BindingType::SampledTexture, 1, 1)
|
||||
.GetResult();
|
||||
|
||||
auto pipelineLayout = device.CreatePipelineLayoutBuilder()
|
||||
.SetBindGroupLayout(0, mBindGroupLayout)
|
||||
.GetResult();
|
||||
auto pipelineLayout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
||||
|
||||
auto vsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, R"(
|
||||
#version 450
|
||||
|
||||
@@ -408,6 +408,34 @@ TEST_F(WireTests, StructureOfValuesArgument) {
|
||||
FlushClient();
|
||||
}
|
||||
|
||||
// Test that the wire is able to send structures that contain objects
|
||||
TEST_F(WireTests, StructureOfObjectArrayArgument) {
|
||||
nxtBindGroupLayoutBuilder bglBuilder = nxtDeviceCreateBindGroupLayoutBuilder(device);
|
||||
nxtBindGroupLayout bgl = nxtBindGroupLayoutBuilderGetResult(bglBuilder);
|
||||
|
||||
nxtBindGroupLayoutBuilder apiBglBuilder = api.GetNewBindGroupLayoutBuilder();
|
||||
EXPECT_CALL(api, DeviceCreateBindGroupLayoutBuilder(apiDevice))
|
||||
.WillOnce(Return(apiBglBuilder));
|
||||
nxtBindGroupLayout apiBgl = api.GetNewBindGroupLayout();
|
||||
EXPECT_CALL(api, BindGroupLayoutBuilderGetResult(apiBglBuilder))
|
||||
.WillOnce(Return(apiBgl));
|
||||
|
||||
nxtPipelineLayoutDescriptor descriptor;
|
||||
descriptor.nextInChain = nullptr;
|
||||
descriptor.numBindGroupLayouts = 1;
|
||||
descriptor.bindGroupLayouts = &bgl;
|
||||
|
||||
nxtDeviceCreatePipelineLayout(device, &descriptor);
|
||||
EXPECT_CALL(api, DeviceCreatePipelineLayout(apiDevice, MatchesLambda([apiBgl](const nxtPipelineLayoutDescriptor* desc) -> bool {
|
||||
return desc->nextInChain == nullptr &&
|
||||
desc->numBindGroupLayouts == 1 &&
|
||||
desc->bindGroupLayouts[0] == apiBgl;
|
||||
})))
|
||||
.WillOnce(Return(nullptr));
|
||||
|
||||
FlushClient();
|
||||
}
|
||||
|
||||
// Test that the server doesn't forward calls to error objects or with error objects
|
||||
// Also test that when GetResult is called on an error builder, the error callback is fired
|
||||
TEST_F(WireTests, CallsSkippedAfterBuilderError) {
|
||||
|
||||
@@ -24,7 +24,7 @@ class RenderPipelineValidationTest : public ValidationTest {
|
||||
|
||||
renderpass = CreateSimpleRenderPass();
|
||||
|
||||
pipelineLayout = device.CreatePipelineLayoutBuilder().GetResult();
|
||||
nxt::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, nullptr);
|
||||
|
||||
inputState = device.CreateInputStateBuilder().GetResult();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user