From 54e58c20b246bf7659235e11b9bd0106d0bb2254 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Wed, 18 Jul 2018 13:43:49 +0200 Subject: [PATCH] Rename nxt:: to dawn:: in tests --- src/tests/NXTTest.cpp | 38 +-- src/tests/NXTTest.h | 24 +- src/tests/end2end/BasicTests.cpp | 4 +- src/tests/end2end/BlendStateTests.cpp | 238 +++++++++--------- src/tests/end2end/BufferTests.cpp | 52 ++-- .../end2end/ComputeCopyStorageBufferTests.cpp | 18 +- src/tests/end2end/CopyTests.cpp | 32 +-- src/tests/end2end/DepthStencilStateTests.cpp | 214 ++++++++-------- src/tests/end2end/DrawElementsTests.cpp | 30 +-- src/tests/end2end/IndexFormatTests.cpp | 68 ++--- src/tests/end2end/InputStateTests.cpp | 92 +++---- src/tests/end2end/PrimitiveTopologyTests.cpp | 38 +-- src/tests/end2end/PushConstantTests.cpp | 112 ++++----- src/tests/end2end/RenderPassLoadOpTests.cpp | 40 +-- src/tests/end2end/SamplerTests.cpp | 50 ++-- src/tests/end2end/ScissorTests.cpp | 32 +-- .../end2end/ViewportOrientationTests.cpp | 14 +- src/tests/unittests/ObjectBaseTests.cpp | 2 +- src/tests/unittests/PerStageTests.cpp | 62 ++--- .../validation/BindGroupValidationTests.cpp | 20 +- .../validation/BlendStateValidationTests.cpp | 30 +-- .../validation/BufferValidationTests.cpp | 142 +++++------ .../CopyCommandsValidationTests.cpp | 226 ++++++++--------- .../DepthStencilStateValidationTests.cpp | 50 ++-- .../validation/InputStateValidationTests.cpp | 80 +++--- .../PushConstantsValidationTests.cpp | 36 +-- .../RenderPassDescriptorValidationTests.cpp | 76 +++--- .../RenderPipelineValidationTests.cpp | 82 +++--- .../unittests/validation/ValidationTest.cpp | 26 +- .../unittests/validation/ValidationTest.h | 14 +- .../VertexBufferValidationTests.cpp | 30 +-- 31 files changed, 986 insertions(+), 986 deletions(-) diff --git a/src/tests/NXTTest.cpp b/src/tests/NXTTest.cpp index 11bd443017..567a8eb2a1 100644 --- a/src/tests/NXTTest.cpp +++ b/src/tests/NXTTest.cpp @@ -99,9 +99,9 @@ namespace { NXTTest::~NXTTest() { // We need to destroy child objects before the Device mReadbackSlots.clear(); - queue = nxt::Queue(); - swapchain = nxt::SwapChain(); - device = nxt::Device(); + queue = dawn::Queue(); + swapchain = dawn::SwapChain(); + device = dawn::Device(); delete mBinding; mBinding = nullptr; @@ -145,15 +145,15 @@ void NXTTest::SetUp() { nxtProcTable procs; if (gTestUsesWire) { - mC2sBuf = new nxt::wire::TerribleCommandBuffer(); - mS2cBuf = new nxt::wire::TerribleCommandBuffer(); + mC2sBuf = new dawn::wire::TerribleCommandBuffer(); + mS2cBuf = new dawn::wire::TerribleCommandBuffer(); - mWireServer = nxt::wire::NewServerCommandHandler(backendDevice, backendProcs, mS2cBuf); + mWireServer = dawn::wire::NewServerCommandHandler(backendDevice, backendProcs, mS2cBuf); mC2sBuf->SetHandler(mWireServer); nxtDevice clientDevice; nxtProcTable clientProcs; - mWireClient = nxt::wire::NewClientDevice(&clientProcs, &clientDevice, mC2sBuf); + mWireClient = dawn::wire::NewClientDevice(&clientProcs, &clientDevice, mC2sBuf); mS2cBuf->SetHandler(mWireClient); procs = clientProcs; @@ -166,7 +166,7 @@ void NXTTest::SetUp() { // Set up the device and queue because all tests need them, and NXTTest needs them too for the // deferred expectations. nxtSetProcs(&procs); - device = nxt::Device::Acquire(cDevice); + device = dawn::Device::Acquire(cDevice); queue = device.CreateQueue(); // The swapchain isn't used by tests but is useful when debugging with graphics debuggers that @@ -174,8 +174,8 @@ void NXTTest::SetUp() { swapchain = device.CreateSwapChainBuilder() .SetImplementation(mBinding->GetSwapChainImplementation()) .GetResult(); - swapchain.Configure(static_cast(mBinding->GetPreferredSwapChainTextureFormat()), - nxt::TextureUsageBit::OutputAttachment, 400, 400); + swapchain.Configure(static_cast(mBinding->GetPreferredSwapChainTextureFormat()), + dawn::TextureUsageBit::OutputAttachment, 400, 400); // The end2end tests should never cause validation errors. These should be tested in unittests. device.SetErrorCallback(DeviceErrorCauseTestFailure, 0); @@ -204,14 +204,14 @@ void NXTTest::TearDown() { } } -std::ostringstream& NXTTest::AddBufferExpectation(const char* file, int line, const nxt::Buffer& buffer, uint32_t offset, uint32_t size, detail::Expectation* expectation) { - nxt::Buffer source = buffer.Clone(); +std::ostringstream& NXTTest::AddBufferExpectation(const char* file, int line, const dawn::Buffer& buffer, uint32_t offset, uint32_t size, detail::Expectation* expectation) { + dawn::Buffer source = buffer.Clone(); auto readback = ReserveReadback(size); // We need to enqueue the copy immediately because by the time we resolve the expectation, // the buffer might have been modified. - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .CopyBufferToBuffer(source, offset, readback.buffer, readback.offset, size) .GetResult(); @@ -232,8 +232,8 @@ std::ostringstream& NXTTest::AddBufferExpectation(const char* file, int line, co return *(mDeferredExpectations.back().message.get()); } -std::ostringstream& NXTTest::AddTextureExpectation(const char* file, int line, const nxt::Texture& texture, uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t level, uint32_t pixelSize, detail::Expectation* expectation) { - nxt::Texture source = texture.Clone(); +std::ostringstream& NXTTest::AddTextureExpectation(const char* file, int line, const dawn::Texture& texture, uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t level, uint32_t pixelSize, detail::Expectation* expectation) { + dawn::Texture source = texture.Clone(); uint32_t rowPitch = Align(width * pixelSize, kTextureRowPitchAlignment); uint32_t size = rowPitch * (height - 1) + width * pixelSize; @@ -241,7 +241,7 @@ std::ostringstream& NXTTest::AddTextureExpectation(const char* file, int line, c // We need to enqueue the copy immediately because by the time we resolve the expectation, // the texture might have been modified. - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .CopyTextureToBuffer(source, x, y, 0, width, height, 1, level, readback.buffer, readback.offset, rowPitch) .GetResult(); @@ -271,7 +271,7 @@ void NXTTest::WaitABit() { void NXTTest::SwapBuffersForCapture() { // Insert a frame boundary for API capture tools. - nxt::Texture backBuffer = swapchain.GetNextTexture(); + dawn::Texture backBuffer = swapchain.GetNextTexture(); swapchain.Present(backBuffer); } @@ -289,7 +289,7 @@ NXTTest::ReadbackReservation NXTTest::ReserveReadback(uint32_t readbackSize) { slot.bufferSize = readbackSize; slot.buffer = device.CreateBufferBuilder() .SetSize(readbackSize) - .SetAllowedUsage(nxt::BufferUsageBit::MapRead | nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst) .GetResult(); ReadbackReservation reservation; @@ -310,7 +310,7 @@ void NXTTest::MapSlotsSynchronously() { auto userdata = new MapReadUserdata{this, i}; auto& slot = mReadbackSlots[i]; - slot.buffer.MapReadAsync(0, slot.bufferSize, SlotMapReadCallback, static_cast(reinterpret_cast(userdata))); + slot.buffer.MapReadAsync(0, slot.bufferSize, SlotMapReadCallback, static_cast(reinterpret_cast(userdata))); } // Busy wait until all map operations are done. diff --git a/src/tests/NXTTest.h b/src/tests/NXTTest.h index b40c17cb4d..f028f4b2d0 100644 --- a/src/tests/NXTTest.h +++ b/src/tests/NXTTest.h @@ -69,7 +69,7 @@ namespace detail { namespace nxt { namespace wire { class CommandHandler; class TerribleCommandBuffer; -}} // namespace nxt::wire +}} // namespace dawn::wire class NXTTest : public ::testing::TestWithParam { public: @@ -84,20 +84,20 @@ class NXTTest : public ::testing::TestWithParam { bool IsVulkan() const; protected: - nxt::Device device; - nxt::Queue queue; - nxt::SwapChain swapchain; + dawn::Device device; + dawn::Queue queue; + dawn::SwapChain swapchain; // Helper methods to implement the EXPECT_ macros std::ostringstream& AddBufferExpectation(const char* file, int line, - const nxt::Buffer& buffer, + const dawn::Buffer& buffer, uint32_t offset, uint32_t size, detail::Expectation* expectation); std::ostringstream& AddTextureExpectation(const char* file, int line, - const nxt::Texture& texture, + const dawn::Texture& texture, uint32_t x, uint32_t y, uint32_t width, @@ -112,15 +112,15 @@ class NXTTest : public ::testing::TestWithParam { private: // Things used to set up testing through the Wire. - nxt::wire::CommandHandler* mWireServer = nullptr; - nxt::wire::CommandHandler* mWireClient = nullptr; - nxt::wire::TerribleCommandBuffer* mC2sBuf = nullptr; - nxt::wire::TerribleCommandBuffer* mS2cBuf = nullptr; + dawn::wire::CommandHandler* mWireServer = nullptr; + dawn::wire::CommandHandler* mWireClient = nullptr; + dawn::wire::TerribleCommandBuffer* mC2sBuf = nullptr; + dawn::wire::TerribleCommandBuffer* mS2cBuf = nullptr; void FlushWire(); // MapRead buffers used to get data for the expectations struct ReadbackSlot { - nxt::Buffer buffer; + dawn::Buffer buffer; uint32_t bufferSize; const void* mappedData = nullptr; }; @@ -135,7 +135,7 @@ class NXTTest : public ::testing::TestWithParam { // Reserve space where the data for an expectation can be copied struct ReadbackReservation { - nxt::Buffer buffer; + dawn::Buffer buffer; size_t slot; uint32_t offset; }; diff --git a/src/tests/end2end/BasicTests.cpp b/src/tests/end2end/BasicTests.cpp index 0f0883d844..338764d35b 100644 --- a/src/tests/end2end/BasicTests.cpp +++ b/src/tests/end2end/BasicTests.cpp @@ -22,9 +22,9 @@ class BasicTests : public NXTTest { // Test Buffer::SetSubData changes the content of the buffer, but really this is the most // basic test possible, and tests the test harness TEST_P(BasicTests, BufferSetSubData) { - nxt::Buffer buffer = device.CreateBufferBuilder() + dawn::Buffer buffer = device.CreateBufferBuilder() .SetSize(4) - .SetAllowedUsage(nxt::BufferUsageBit::TransferSrc | nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst) .GetResult(); uint8_t value = 187; diff --git a/src/tests/end2end/BlendStateTests.cpp b/src/tests/end2end/BlendStateTests.cpp index 7b78109599..8cd74fd81d 100644 --- a/src/tests/end2end/BlendStateTests.cpp +++ b/src/tests/end2end/BlendStateTests.cpp @@ -28,7 +28,7 @@ class BlendStateTest : public NXTTest { void SetUp() override { NXTTest::SetUp(); - vsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, R"( + vsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, R"( #version 450 void main() { const vec2 pos[3] = vec2[3](vec2(-1.f, -1.f), vec2(3.f, -1.f), vec2(-1.f, 3.f)); @@ -38,7 +38,7 @@ class BlendStateTest : public NXTTest { bindGroupLayout = utils::MakeBindGroupLayout( device, { - {0, nxt::ShaderStageBit::Fragment, nxt::BindingType::UniformBuffer}, + {0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}, }); pipelineLayout = utils::MakeBasicPipelineLayout(device, &bindGroupLayout); @@ -52,8 +52,8 @@ class BlendStateTest : public NXTTest { }; // Set up basePipeline and testPipeline. testPipeline has the given blend state on the first attachment. basePipeline has no blending - void SetupSingleSourcePipelines(const nxt::BlendState &blendState) { - nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"( + void SetupSingleSourcePipelines(const dawn::BlendState &blendState) { + dawn::ShaderModule fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"( #version 450 layout(set = 0, binding = 0) uniform myBlock { vec4 color; @@ -69,22 +69,22 @@ class BlendStateTest : public NXTTest { basePipeline = device.CreateRenderPipelineBuilder() .SetColorAttachmentFormat(0, renderPass.colorFormat) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .GetResult(); testPipeline = device.CreateRenderPipelineBuilder() .SetColorAttachmentFormat(0, renderPass.colorFormat) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .SetColorAttachmentBlendState(0, blendState) .GetResult(); } // Create a bind group to set the colors as a uniform buffer template - nxt::BindGroup MakeBindGroupForColors(std::array colors) { + dawn::BindGroup MakeBindGroupForColors(std::array colors) { std::array data; for (unsigned int i = 0; i < N; ++i) { data[4 * i + 0] = static_cast(colors[i].r) / 255.f; @@ -95,22 +95,22 @@ class BlendStateTest : public NXTTest { uint32_t bufferSize = static_cast(4 * N * sizeof(float)); - nxt::Buffer buffer = utils::CreateBufferFromData(device, &data, bufferSize, nxt::BufferUsageBit::Uniform); + dawn::Buffer buffer = utils::CreateBufferFromData(device, &data, bufferSize, dawn::BufferUsageBit::Uniform); - nxt::BufferView view = buffer.CreateBufferViewBuilder() + dawn::BufferView view = buffer.CreateBufferViewBuilder() .SetExtent(0, bufferSize) .GetResult(); return device.CreateBindGroupBuilder() .SetLayout(bindGroupLayout) - .SetUsage(nxt::BindGroupUsage::Frozen) + .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &view) .GetResult(); } // Test that after drawing a triangle with the base color, and then the given triangle spec, the color is as expected void DoSingleSourceTest(RGBA8 base, const TriangleSpec& triangle, const RGBA8& expected) { - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) // First use the base pipeline to draw a triangle with no blending .SetRenderPipeline(basePipeline) @@ -132,11 +132,11 @@ class BlendStateTest : public NXTTest { } // Given a vector of tests where each element is , check that all expectations are true for the given blend operation - void CheckBlendOperation(RGBA8 base, nxt::BlendOperation operation, std::vector> tests) { - nxt::BlendState blendState = device.CreateBlendStateBuilder() + void CheckBlendOperation(RGBA8 base, dawn::BlendOperation operation, std::vector> tests) { + dawn::BlendState blendState = device.CreateBlendStateBuilder() .SetBlendEnabled(true) - .SetColorBlend(operation, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetAlphaBlend(operation, nxt::BlendFactor::One, nxt::BlendFactor::One) + .SetColorBlend(operation, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetAlphaBlend(operation, dawn::BlendFactor::One, dawn::BlendFactor::One) .GetResult(); SetupSingleSourcePipelines(blendState); @@ -147,11 +147,11 @@ class BlendStateTest : public NXTTest { } // Given a vector of tests where each element is , check that all expectations are true for the given blend factors - void CheckBlendFactor(RGBA8 base, nxt::BlendFactor colorSrcFactor, nxt::BlendFactor colorDstFactor, nxt::BlendFactor alphaSrcFactor, nxt::BlendFactor alphaDstFactor, std::vector> tests) { - nxt::BlendState blendState = device.CreateBlendStateBuilder() + void CheckBlendFactor(RGBA8 base, dawn::BlendFactor colorSrcFactor, dawn::BlendFactor colorDstFactor, dawn::BlendFactor alphaSrcFactor, dawn::BlendFactor alphaDstFactor, std::vector> tests) { + dawn::BlendState blendState = device.CreateBlendStateBuilder() .SetBlendEnabled(true) - .SetColorBlend(nxt::BlendOperation::Add, colorSrcFactor, colorDstFactor) - .SetAlphaBlend(nxt::BlendOperation::Add, alphaSrcFactor, alphaDstFactor) + .SetColorBlend(dawn::BlendOperation::Add, colorSrcFactor, colorDstFactor) + .SetAlphaBlend(dawn::BlendOperation::Add, alphaSrcFactor, alphaDstFactor) .GetResult(); SetupSingleSourcePipelines(blendState); @@ -161,20 +161,20 @@ class BlendStateTest : public NXTTest { } } - void CheckSrcBlendFactor(RGBA8 base, nxt::BlendFactor colorFactor, nxt::BlendFactor alphaFactor, std::vector> tests) { - CheckBlendFactor(base, colorFactor, nxt::BlendFactor::One, alphaFactor, nxt::BlendFactor::One, tests); + void CheckSrcBlendFactor(RGBA8 base, dawn::BlendFactor colorFactor, dawn::BlendFactor alphaFactor, std::vector> tests) { + CheckBlendFactor(base, colorFactor, dawn::BlendFactor::One, alphaFactor, dawn::BlendFactor::One, tests); } - void CheckDstBlendFactor(RGBA8 base, nxt::BlendFactor colorFactor, nxt::BlendFactor alphaFactor, std::vector> tests) { - CheckBlendFactor(base, nxt::BlendFactor::One, colorFactor, nxt::BlendFactor::One, alphaFactor, tests); + void CheckDstBlendFactor(RGBA8 base, dawn::BlendFactor colorFactor, dawn::BlendFactor alphaFactor, std::vector> tests) { + CheckBlendFactor(base, dawn::BlendFactor::One, colorFactor, dawn::BlendFactor::One, alphaFactor, tests); } utils::BasicRenderPass renderPass; - nxt::RenderPipeline basePipeline; - nxt::RenderPipeline testPipeline; - nxt::ShaderModule vsModule; - nxt::BindGroupLayout bindGroupLayout; - nxt::PipelineLayout pipelineLayout; + dawn::RenderPipeline basePipeline; + dawn::RenderPipeline testPipeline; + dawn::ShaderModule vsModule; + dawn::BindGroupLayout bindGroupLayout; + dawn::PipelineLayout pipelineLayout; }; namespace { @@ -264,7 +264,7 @@ namespace { // Test compilation and usage of the fixture TEST_P(BlendStateTest, Basic) { - nxt::BlendState blendState = device.CreateBlendStateBuilder().GetResult(); + dawn::BlendState blendState = device.CreateBlendStateBuilder().GetResult(); SetupSingleSourcePipelines(blendState); DoSingleSourceTest(RGBA8(0, 0, 0, 0), { RGBA8(255, 0, 0, 0) }, RGBA8(255, 0, 0, 0)); @@ -277,7 +277,7 @@ TEST_P(BlendStateTest, BlendOperationAdd) { std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { return std::make_pair(color, base + color); }); - CheckBlendOperation(base, nxt::BlendOperation::Add, tests); + CheckBlendOperation(base, dawn::BlendOperation::Add, tests); } TEST_P(BlendStateTest, BlendOperationSubtract) { @@ -286,7 +286,7 @@ TEST_P(BlendStateTest, BlendOperationSubtract) { std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { return std::make_pair(color, color - base); }); - CheckBlendOperation(base, nxt::BlendOperation::Subtract, tests); + CheckBlendOperation(base, dawn::BlendOperation::Subtract, tests); } TEST_P(BlendStateTest, BlendOperationReverseSubtract) { @@ -295,7 +295,7 @@ TEST_P(BlendStateTest, BlendOperationReverseSubtract) { std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { return std::make_pair(color, base - color); }); - CheckBlendOperation(base, nxt::BlendOperation::ReverseSubtract, tests); + CheckBlendOperation(base, dawn::BlendOperation::ReverseSubtract, tests); } TEST_P(BlendStateTest, BlendOperationMin) { @@ -304,7 +304,7 @@ TEST_P(BlendStateTest, BlendOperationMin) { std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { return std::make_pair(color, min(base, color)); }); - CheckBlendOperation(base, nxt::BlendOperation::Min, tests); + CheckBlendOperation(base, dawn::BlendOperation::Min, tests); } TEST_P(BlendStateTest, BlendOperationMax) { @@ -313,7 +313,7 @@ TEST_P(BlendStateTest, BlendOperationMax) { std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { return std::make_pair(color, max(base, color)); }); - CheckBlendOperation(base, nxt::BlendOperation::Max, tests); + CheckBlendOperation(base, dawn::BlendOperation::Max, tests); } // The following tests check that the Source blend factor works @@ -323,7 +323,7 @@ TEST_P(BlendStateTest, SrcBlendFactorZero) { std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { return std::make_pair(TriangleSpec({ { color } }), base); }); - CheckSrcBlendFactor(base, nxt::BlendFactor::Zero, nxt::BlendFactor::Zero, tests); + CheckSrcBlendFactor(base, dawn::BlendFactor::Zero, dawn::BlendFactor::Zero, tests); } TEST_P(BlendStateTest, SrcBlendFactorOne) { @@ -332,7 +332,7 @@ TEST_P(BlendStateTest, SrcBlendFactorOne) { std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { return std::make_pair(TriangleSpec({ { color } }), base + color); }); - CheckSrcBlendFactor(base, nxt::BlendFactor::One, nxt::BlendFactor::One, tests); + CheckSrcBlendFactor(base, dawn::BlendFactor::One, dawn::BlendFactor::One, tests); } TEST_P(BlendStateTest, SrcBlendFactorSrcColor) { @@ -344,7 +344,7 @@ TEST_P(BlendStateTest, SrcBlendFactorSrcColor) { RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckSrcBlendFactor(base, nxt::BlendFactor::SrcColor, nxt::BlendFactor::Zero, tests); + CheckSrcBlendFactor(base, dawn::BlendFactor::SrcColor, dawn::BlendFactor::Zero, tests); } TEST_P(BlendStateTest, SrcBlendFactorOneMinusSrcColor) { @@ -356,7 +356,7 @@ TEST_P(BlendStateTest, SrcBlendFactorOneMinusSrcColor) { RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckSrcBlendFactor(base, nxt::BlendFactor::OneMinusSrcColor, nxt::BlendFactor::Zero, tests); + CheckSrcBlendFactor(base, dawn::BlendFactor::OneMinusSrcColor, dawn::BlendFactor::Zero, tests); } TEST_P(BlendStateTest, SrcBlendFactorSrcAlpha) { @@ -367,7 +367,7 @@ TEST_P(BlendStateTest, SrcBlendFactorSrcAlpha) { RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckSrcBlendFactor(base, nxt::BlendFactor::SrcAlpha, nxt::BlendFactor::SrcAlpha, tests); + CheckSrcBlendFactor(base, dawn::BlendFactor::SrcAlpha, dawn::BlendFactor::SrcAlpha, tests); } TEST_P(BlendStateTest, SrcBlendFactorOneMinusSrcAlpha) { @@ -378,7 +378,7 @@ TEST_P(BlendStateTest, SrcBlendFactorOneMinusSrcAlpha) { RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckSrcBlendFactor(base, nxt::BlendFactor::OneMinusSrcAlpha, nxt::BlendFactor::OneMinusSrcAlpha, tests); + CheckSrcBlendFactor(base, dawn::BlendFactor::OneMinusSrcAlpha, dawn::BlendFactor::OneMinusSrcAlpha, tests); } TEST_P(BlendStateTest, SrcBlendFactorDstColor) { @@ -390,7 +390,7 @@ TEST_P(BlendStateTest, SrcBlendFactorDstColor) { RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckSrcBlendFactor(base, nxt::BlendFactor::DstColor, nxt::BlendFactor::Zero, tests); + CheckSrcBlendFactor(base, dawn::BlendFactor::DstColor, dawn::BlendFactor::Zero, tests); } TEST_P(BlendStateTest, SrcBlendFactorOneMinusDstColor) { @@ -402,7 +402,7 @@ TEST_P(BlendStateTest, SrcBlendFactorOneMinusDstColor) { RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckSrcBlendFactor(base, nxt::BlendFactor::OneMinusDstColor, nxt::BlendFactor::Zero, tests); + CheckSrcBlendFactor(base, dawn::BlendFactor::OneMinusDstColor, dawn::BlendFactor::Zero, tests); } TEST_P(BlendStateTest, SrcBlendFactorDstAlpha) { @@ -413,7 +413,7 @@ TEST_P(BlendStateTest, SrcBlendFactorDstAlpha) { RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckSrcBlendFactor(base, nxt::BlendFactor::DstAlpha, nxt::BlendFactor::DstAlpha, tests); + CheckSrcBlendFactor(base, dawn::BlendFactor::DstAlpha, dawn::BlendFactor::DstAlpha, tests); } TEST_P(BlendStateTest, SrcBlendFactorOneMinusDstAlpha) { @@ -424,7 +424,7 @@ TEST_P(BlendStateTest, SrcBlendFactorOneMinusDstAlpha) { RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckSrcBlendFactor(base, nxt::BlendFactor::OneMinusDstAlpha, nxt::BlendFactor::OneMinusDstAlpha, tests); + CheckSrcBlendFactor(base, dawn::BlendFactor::OneMinusDstAlpha, dawn::BlendFactor::OneMinusDstAlpha, tests); } TEST_P(BlendStateTest, SrcBlendFactorSrcAlphaSaturated) { @@ -436,7 +436,7 @@ TEST_P(BlendStateTest, SrcBlendFactorSrcAlphaSaturated) { RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckSrcBlendFactor(base, nxt::BlendFactor::SrcAlphaSaturated, nxt::BlendFactor::SrcAlphaSaturated, tests); + CheckSrcBlendFactor(base, dawn::BlendFactor::SrcAlphaSaturated, dawn::BlendFactor::SrcAlphaSaturated, tests); } TEST_P(BlendStateTest, SrcBlendFactorBlendColor) { @@ -447,7 +447,7 @@ TEST_P(BlendStateTest, SrcBlendFactorBlendColor) { RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, triangleSpec.blendFactor); return std::make_pair(triangleSpec, expected); }); - CheckSrcBlendFactor(base, nxt::BlendFactor::BlendColor, nxt::BlendFactor::BlendColor, tests); + CheckSrcBlendFactor(base, dawn::BlendFactor::BlendColor, dawn::BlendFactor::BlendColor, tests); } TEST_P(BlendStateTest, SrcBlendFactorOneMinusBlendColor) { @@ -459,7 +459,7 @@ TEST_P(BlendStateTest, SrcBlendFactorOneMinusBlendColor) { RGBA8 expected = base + mix(RGBA8(0, 0, 0, 0), color, f); return std::make_pair(triangleSpec, expected); }); - CheckSrcBlendFactor(base, nxt::BlendFactor::OneMinusBlendColor, nxt::BlendFactor::OneMinusBlendColor, tests); + CheckSrcBlendFactor(base, dawn::BlendFactor::OneMinusBlendColor, dawn::BlendFactor::OneMinusBlendColor, tests); } // The following tests check that the Destination blend factor works @@ -469,7 +469,7 @@ TEST_P(BlendStateTest, DstBlendFactorZero) { std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { return std::make_pair(TriangleSpec({ { color } }), color); }); - CheckDstBlendFactor(base, nxt::BlendFactor::Zero, nxt::BlendFactor::Zero, tests); + CheckDstBlendFactor(base, dawn::BlendFactor::Zero, dawn::BlendFactor::Zero, tests); } TEST_P(BlendStateTest, DstBlendFactorOne) { @@ -478,7 +478,7 @@ TEST_P(BlendStateTest, DstBlendFactorOne) { std::transform(kColors.begin(), kColors.end(), std::back_inserter(tests), [&](const RGBA8& color) { return std::make_pair(TriangleSpec({ { color } }), base + color); }); - CheckDstBlendFactor(base, nxt::BlendFactor::One, nxt::BlendFactor::One, tests); + CheckDstBlendFactor(base, dawn::BlendFactor::One, dawn::BlendFactor::One, tests); } TEST_P(BlendStateTest, DstBlendFactorSrcColor) { @@ -490,7 +490,7 @@ TEST_P(BlendStateTest, DstBlendFactorSrcColor) { RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckDstBlendFactor(base, nxt::BlendFactor::SrcColor, nxt::BlendFactor::Zero, tests); + CheckDstBlendFactor(base, dawn::BlendFactor::SrcColor, dawn::BlendFactor::Zero, tests); } TEST_P(BlendStateTest, DstBlendFactorOneMinusSrcColor) { @@ -502,7 +502,7 @@ TEST_P(BlendStateTest, DstBlendFactorOneMinusSrcColor) { RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckDstBlendFactor(base, nxt::BlendFactor::OneMinusSrcColor, nxt::BlendFactor::Zero, tests); + CheckDstBlendFactor(base, dawn::BlendFactor::OneMinusSrcColor, dawn::BlendFactor::Zero, tests); } TEST_P(BlendStateTest, DstBlendFactorSrcAlpha) { @@ -513,7 +513,7 @@ TEST_P(BlendStateTest, DstBlendFactorSrcAlpha) { RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckDstBlendFactor(base, nxt::BlendFactor::SrcAlpha, nxt::BlendFactor::SrcAlpha, tests); + CheckDstBlendFactor(base, dawn::BlendFactor::SrcAlpha, dawn::BlendFactor::SrcAlpha, tests); } TEST_P(BlendStateTest, DstBlendFactorOneMinusSrcAlpha) { @@ -524,7 +524,7 @@ TEST_P(BlendStateTest, DstBlendFactorOneMinusSrcAlpha) { RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckDstBlendFactor(base, nxt::BlendFactor::OneMinusSrcAlpha, nxt::BlendFactor::OneMinusSrcAlpha, tests); + CheckDstBlendFactor(base, dawn::BlendFactor::OneMinusSrcAlpha, dawn::BlendFactor::OneMinusSrcAlpha, tests); } TEST_P(BlendStateTest, DstBlendFactorDstColor) { @@ -536,7 +536,7 @@ TEST_P(BlendStateTest, DstBlendFactorDstColor) { RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckDstBlendFactor(base, nxt::BlendFactor::DstColor, nxt::BlendFactor::Zero, tests); + CheckDstBlendFactor(base, dawn::BlendFactor::DstColor, dawn::BlendFactor::Zero, tests); } TEST_P(BlendStateTest, DstBlendFactorOneMinusDstColor) { @@ -548,7 +548,7 @@ TEST_P(BlendStateTest, DstBlendFactorOneMinusDstColor) { RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckDstBlendFactor(base, nxt::BlendFactor::OneMinusDstColor, nxt::BlendFactor::Zero, tests); + CheckDstBlendFactor(base, dawn::BlendFactor::OneMinusDstColor, dawn::BlendFactor::Zero, tests); } TEST_P(BlendStateTest, DstBlendFactorDstAlpha) { @@ -559,7 +559,7 @@ TEST_P(BlendStateTest, DstBlendFactorDstAlpha) { RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckDstBlendFactor(base, nxt::BlendFactor::DstAlpha, nxt::BlendFactor::DstAlpha, tests); + CheckDstBlendFactor(base, dawn::BlendFactor::DstAlpha, dawn::BlendFactor::DstAlpha, tests); } TEST_P(BlendStateTest, DstBlendFactorOneMinusDstAlpha) { @@ -570,7 +570,7 @@ TEST_P(BlendStateTest, DstBlendFactorOneMinusDstAlpha) { RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckDstBlendFactor(base, nxt::BlendFactor::OneMinusDstAlpha, nxt::BlendFactor::OneMinusDstAlpha, tests); + CheckDstBlendFactor(base, dawn::BlendFactor::OneMinusDstAlpha, dawn::BlendFactor::OneMinusDstAlpha, tests); } TEST_P(BlendStateTest, DstBlendFactorSrcAlphaSaturated) { @@ -582,7 +582,7 @@ TEST_P(BlendStateTest, DstBlendFactorSrcAlphaSaturated) { RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, fac); return std::make_pair(TriangleSpec({ { color } }), expected); }); - CheckDstBlendFactor(base, nxt::BlendFactor::SrcAlphaSaturated, nxt::BlendFactor::SrcAlphaSaturated, tests); + CheckDstBlendFactor(base, dawn::BlendFactor::SrcAlphaSaturated, dawn::BlendFactor::SrcAlphaSaturated, tests); } TEST_P(BlendStateTest, DstBlendFactorBlendColor) { @@ -593,7 +593,7 @@ TEST_P(BlendStateTest, DstBlendFactorBlendColor) { RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, triangleSpec.blendFactor); return std::make_pair(triangleSpec, expected); }); - CheckDstBlendFactor(base, nxt::BlendFactor::BlendColor, nxt::BlendFactor::BlendColor, tests); + CheckDstBlendFactor(base, dawn::BlendFactor::BlendColor, dawn::BlendFactor::BlendColor, tests); } TEST_P(BlendStateTest, DstBlendFactorOneMinusBlendColor) { @@ -605,18 +605,18 @@ TEST_P(BlendStateTest, DstBlendFactorOneMinusBlendColor) { RGBA8 expected = color + mix(RGBA8(0, 0, 0, 0), base, f); return std::make_pair(triangleSpec, expected); }); - CheckDstBlendFactor(base, nxt::BlendFactor::OneMinusBlendColor, nxt::BlendFactor::OneMinusBlendColor, tests); + CheckDstBlendFactor(base, dawn::BlendFactor::OneMinusBlendColor, dawn::BlendFactor::OneMinusBlendColor, tests); } // Check that the color write mask works TEST_P(BlendStateTest, ColorWriteMask) { { // Test single channel color write - nxt::BlendState blendState = device.CreateBlendStateBuilder() + dawn::BlendState blendState = device.CreateBlendStateBuilder() .SetBlendEnabled(true) - .SetColorBlend(nxt::BlendOperation::Add, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetAlphaBlend(nxt::BlendOperation::Add, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetColorWriteMask(nxt::ColorWriteMask::Red) + .SetColorBlend(dawn::BlendOperation::Add, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetAlphaBlend(dawn::BlendOperation::Add, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetColorWriteMask(dawn::ColorWriteMask::Red) .GetResult(); SetupSingleSourcePipelines(blendState); @@ -629,11 +629,11 @@ TEST_P(BlendStateTest, ColorWriteMask) { { // Test multi channel color write - nxt::BlendState blendState = device.CreateBlendStateBuilder() + dawn::BlendState blendState = device.CreateBlendStateBuilder() .SetBlendEnabled(true) - .SetColorBlend(nxt::BlendOperation::Add, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetAlphaBlend(nxt::BlendOperation::Add, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetColorWriteMask(nxt::ColorWriteMask::Green | nxt::ColorWriteMask::Alpha) + .SetColorBlend(dawn::BlendOperation::Add, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetAlphaBlend(dawn::BlendOperation::Add, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetColorWriteMask(dawn::ColorWriteMask::Green | dawn::ColorWriteMask::Alpha) .GetResult(); SetupSingleSourcePipelines(blendState); @@ -646,11 +646,11 @@ TEST_P(BlendStateTest, ColorWriteMask) { { // Test no channel color write - nxt::BlendState blendState = device.CreateBlendStateBuilder() + dawn::BlendState blendState = device.CreateBlendStateBuilder() .SetBlendEnabled(true) - .SetColorBlend(nxt::BlendOperation::Add, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetAlphaBlend(nxt::BlendOperation::Add, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetColorWriteMask(nxt::ColorWriteMask::None) + .SetColorBlend(dawn::BlendOperation::Add, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetAlphaBlend(dawn::BlendOperation::Add, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetColorWriteMask(dawn::ColorWriteMask::None) .GetResult(); SetupSingleSourcePipelines(blendState); @@ -664,15 +664,15 @@ TEST_P(BlendStateTest, ColorWriteMask) { // Check that the color write mask works when blending is disabled TEST_P(BlendStateTest, ColorWriteMaskBlendingDisabled) { { - nxt::BlendState blendState = device.CreateBlendStateBuilder() + dawn::BlendState blendState = device.CreateBlendStateBuilder() .SetBlendEnabled(false) - .SetColorWriteMask(nxt::ColorWriteMask::Red) + .SetColorWriteMask(dawn::ColorWriteMask::Red) .GetResult(); SetupSingleSourcePipelines(blendState); RGBA8 base(32, 64, 128, 192); RGBA8 expected(32, 0, 0, 0); - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(testPipeline) .SetBindGroup(0, MakeBindGroupForColors(std::array({ { base } }))) @@ -688,28 +688,28 @@ TEST_P(BlendStateTest, ColorWriteMaskBlendingDisabled) { // Test that independent blend states on render targets works TEST_P(BlendStateTest, IndependentBlendState) { - std::array renderTargets; - std::array renderTargetViews; + std::array renderTargets; + std::array renderTargetViews; for (uint32_t i = 0; i < 4; ++i) { renderTargets[i] = device.CreateTextureBuilder() - .SetDimension(nxt::TextureDimension::e2D) + .SetDimension(dawn::TextureDimension::e2D) .SetExtent(kRTSize, kRTSize, 1) - .SetFormat(nxt::TextureFormat::R8G8B8A8Unorm) + .SetFormat(dawn::TextureFormat::R8G8B8A8Unorm) .SetMipLevels(1) - .SetAllowedUsage(nxt::TextureUsageBit::OutputAttachment | nxt::TextureUsageBit::TransferSrc) + .SetAllowedUsage(dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc) .GetResult(); renderTargetViews[i] = renderTargets[i].CreateTextureViewBuilder().GetResult(); } - nxt::RenderPassDescriptor renderpass = device.CreateRenderPassDescriptorBuilder() - .SetColorAttachment(0, renderTargetViews[0], nxt::LoadOp::Clear) - .SetColorAttachment(1, renderTargetViews[1], nxt::LoadOp::Clear) - .SetColorAttachment(2, renderTargetViews[2], nxt::LoadOp::Clear) - .SetColorAttachment(3, renderTargetViews[3], nxt::LoadOp::Clear) + dawn::RenderPassDescriptor renderpass = device.CreateRenderPassDescriptorBuilder() + .SetColorAttachment(0, renderTargetViews[0], dawn::LoadOp::Clear) + .SetColorAttachment(1, renderTargetViews[1], dawn::LoadOp::Clear) + .SetColorAttachment(2, renderTargetViews[2], dawn::LoadOp::Clear) + .SetColorAttachment(3, renderTargetViews[3], dawn::LoadOp::Clear) .GetResult(); - nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"( + dawn::ShaderModule fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"( #version 450 layout(set = 0, binding = 0) uniform myBlock { vec4 color0; @@ -731,42 +731,42 @@ TEST_P(BlendStateTest, IndependentBlendState) { } )"); - std::array blendStates = { { + std::array blendStates = { { device.CreateBlendStateBuilder() .SetBlendEnabled(true) - .SetColorBlend(nxt::BlendOperation::Add, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetAlphaBlend(nxt::BlendOperation::Add, nxt::BlendFactor::One, nxt::BlendFactor::One) + .SetColorBlend(dawn::BlendOperation::Add, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetAlphaBlend(dawn::BlendOperation::Add, dawn::BlendFactor::One, dawn::BlendFactor::One) .GetResult(), device.CreateBlendStateBuilder() .SetBlendEnabled(true) - .SetColorBlend(nxt::BlendOperation::Subtract, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetAlphaBlend(nxt::BlendOperation::Subtract, nxt::BlendFactor::One, nxt::BlendFactor::One) + .SetColorBlend(dawn::BlendOperation::Subtract, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetAlphaBlend(dawn::BlendOperation::Subtract, dawn::BlendFactor::One, dawn::BlendFactor::One) .GetResult(), device.CreateBlendStateBuilder() .SetBlendEnabled(true) - .SetColorBlend(nxt::BlendOperation::Min, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetAlphaBlend(nxt::BlendOperation::Min, nxt::BlendFactor::One, nxt::BlendFactor::One) + .SetColorBlend(dawn::BlendOperation::Min, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetAlphaBlend(dawn::BlendOperation::Min, dawn::BlendFactor::One, dawn::BlendFactor::One) .GetResult(), } }; basePipeline = device.CreateRenderPipelineBuilder() - .SetColorAttachmentFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) - .SetColorAttachmentFormat(1, nxt::TextureFormat::R8G8B8A8Unorm) - .SetColorAttachmentFormat(2, nxt::TextureFormat::R8G8B8A8Unorm) - .SetColorAttachmentFormat(3, nxt::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(0, dawn::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(1, dawn::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(2, dawn::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(3, dawn::TextureFormat::R8G8B8A8Unorm) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .GetResult(); testPipeline = device.CreateRenderPipelineBuilder() - .SetColorAttachmentFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) - .SetColorAttachmentFormat(1, nxt::TextureFormat::R8G8B8A8Unorm) - .SetColorAttachmentFormat(2, nxt::TextureFormat::R8G8B8A8Unorm) - .SetColorAttachmentFormat(3, nxt::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(0, dawn::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(1, dawn::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(2, dawn::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(3, dawn::TextureFormat::R8G8B8A8Unorm) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .SetColorAttachmentBlendState(0, blendStates[0]) .SetColorAttachmentBlendState(1, blendStates[1]) // Blend state not set on third color attachment. It should be default @@ -786,7 +786,7 @@ TEST_P(BlendStateTest, IndependentBlendState) { RGBA8 expected2 = color2; RGBA8 expected3 = min(color3, base); - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderpass) .SetRenderPipeline(basePipeline) .SetBindGroup(0, MakeBindGroupForColors(std::array({ { base, base, base, base } }))) @@ -809,13 +809,13 @@ TEST_P(BlendStateTest, IndependentBlendState) { // Test that the default blend color is correctly set at the beginning of every subpass TEST_P(BlendStateTest, DefaultBlendColor) { - nxt::BlendState blendState = device.CreateBlendStateBuilder() + dawn::BlendState blendState = device.CreateBlendStateBuilder() .SetBlendEnabled(true) - .SetColorBlend(nxt::BlendOperation::Add, nxt::BlendFactor::BlendColor, nxt::BlendFactor::One) - .SetAlphaBlend(nxt::BlendOperation::Add, nxt::BlendFactor::BlendColor, nxt::BlendFactor::One) + .SetColorBlend(dawn::BlendOperation::Add, dawn::BlendFactor::BlendColor, dawn::BlendFactor::One) + .SetAlphaBlend(dawn::BlendOperation::Add, dawn::BlendFactor::BlendColor, dawn::BlendFactor::One) .GetResult(); - nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"( + dawn::ShaderModule fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"( #version 450 layout(set = 0, binding = 0) uniform myBlock { vec4 color; @@ -831,21 +831,21 @@ TEST_P(BlendStateTest, DefaultBlendColor) { basePipeline = device.CreateRenderPipelineBuilder() .SetColorAttachmentFormat(0, renderPass.colorFormat) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .GetResult(); testPipeline = device.CreateRenderPipelineBuilder() .SetColorAttachmentFormat(0, renderPass.colorFormat) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .SetColorAttachmentBlendState(0, blendState) .GetResult(); // Check that the initial blend color is (0,0,0,0) { - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(basePipeline) .SetBindGroup(0, MakeBindGroupForColors(std::array({ { RGBA8(0, 0, 0, 0) } }))) @@ -863,7 +863,7 @@ TEST_P(BlendStateTest, DefaultBlendColor) { // Check that setting the blend color works { - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(basePipeline) .SetBindGroup(0, MakeBindGroupForColors(std::array({ { RGBA8(0, 0, 0, 0) } }))) @@ -882,7 +882,7 @@ TEST_P(BlendStateTest, DefaultBlendColor) { // Check that the blend color is not inherited between render passes { - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(basePipeline) .SetBindGroup(0, MakeBindGroupForColors(std::array({ { RGBA8(0, 0, 0, 0) } }))) diff --git a/src/tests/end2end/BufferTests.cpp b/src/tests/end2end/BufferTests.cpp index 7b1dd9da91..7b77c207b1 100644 --- a/src/tests/end2end/BufferTests.cpp +++ b/src/tests/end2end/BufferTests.cpp @@ -27,8 +27,8 @@ class BufferMapReadTests : public NXTTest { test->mappedData = data; } - const void* MapReadAsyncAndWait(const nxt::Buffer& buffer, uint32_t start, uint32_t offset) { - buffer.MapReadAsync(start, offset, MapReadCallback, static_cast(reinterpret_cast(this))); + const void* MapReadAsyncAndWait(const dawn::Buffer& buffer, uint32_t start, uint32_t offset) { + buffer.MapReadAsync(start, offset, MapReadCallback, static_cast(reinterpret_cast(this))); while (mappedData == nullptr) { WaitABit(); @@ -43,9 +43,9 @@ class BufferMapReadTests : public NXTTest { // Test that the simplest map read (one u8 at offset 0) works. TEST_P(BufferMapReadTests, SmallReadAtZero) { - nxt::Buffer buffer = device.CreateBufferBuilder() + dawn::Buffer buffer = device.CreateBufferBuilder() .SetSize(1) - .SetAllowedUsage(nxt::BufferUsageBit::MapRead | nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst) .GetResult(); uint8_t myData = 187; @@ -59,9 +59,9 @@ TEST_P(BufferMapReadTests, SmallReadAtZero) { // Test mapping a buffer at an offset. TEST_P(BufferMapReadTests, SmallReadAtOffset) { - nxt::Buffer buffer = device.CreateBufferBuilder() + dawn::Buffer buffer = device.CreateBufferBuilder() .SetSize(4000) - .SetAllowedUsage(nxt::BufferUsageBit::MapRead | nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst) .GetResult(); uint8_t myData = 234; @@ -75,9 +75,9 @@ TEST_P(BufferMapReadTests, SmallReadAtOffset) { // Test mapping a buffer at an offset that's not uint32-aligned. TEST_P(BufferMapReadTests, SmallReadAtUnalignedOffset) { - nxt::Buffer buffer = device.CreateBufferBuilder() + dawn::Buffer buffer = device.CreateBufferBuilder() .SetSize(4000) - .SetAllowedUsage(nxt::BufferUsageBit::MapRead | nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst) .GetResult(); uint8_t myData = 213; @@ -97,9 +97,9 @@ TEST_P(BufferMapReadTests, LargeRead) { myData.push_back(i); } - nxt::Buffer buffer = device.CreateBufferBuilder() + dawn::Buffer buffer = device.CreateBufferBuilder() .SetSize(static_cast(kDataSize * sizeof(uint32_t))) - .SetAllowedUsage(nxt::BufferUsageBit::MapRead | nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst) .GetResult(); buffer.SetSubData(0, kDataSize * sizeof(uint32_t), reinterpret_cast(myData.data())); @@ -123,8 +123,8 @@ class BufferMapWriteTests : public NXTTest { test->mappedData = data; } - void* MapWriteAsyncAndWait(const nxt::Buffer& buffer, uint32_t start, uint32_t offset) { - buffer.MapWriteAsync(start, offset, MapWriteCallback, static_cast(reinterpret_cast(this))); + void* MapWriteAsyncAndWait(const dawn::Buffer& buffer, uint32_t start, uint32_t offset) { + buffer.MapWriteAsync(start, offset, MapWriteCallback, static_cast(reinterpret_cast(this))); while (mappedData == nullptr) { WaitABit(); @@ -139,9 +139,9 @@ class BufferMapWriteTests : public NXTTest { // Test that the simplest map write (one u32 at offset 0) works. TEST_P(BufferMapWriteTests, SmallWriteAtZero) { - nxt::Buffer buffer = device.CreateBufferBuilder() + dawn::Buffer buffer = device.CreateBufferBuilder() .SetSize(4) - .SetAllowedUsage(nxt::BufferUsageBit::MapWrite | nxt::BufferUsageBit::TransferSrc) + .SetAllowedUsage(dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc) .GetResult(); uint32_t myData = 2934875; @@ -154,9 +154,9 @@ TEST_P(BufferMapWriteTests, SmallWriteAtZero) { // Test mapping a buffer at an offset. TEST_P(BufferMapWriteTests, SmallWriteAtOffset) { - nxt::Buffer buffer = device.CreateBufferBuilder() + dawn::Buffer buffer = device.CreateBufferBuilder() .SetSize(4000) - .SetAllowedUsage(nxt::BufferUsageBit::MapWrite | nxt::BufferUsageBit::TransferSrc) + .SetAllowedUsage(dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc) .GetResult(); uint32_t myData = 2934875; @@ -175,9 +175,9 @@ TEST_P(BufferMapWriteTests, LargeWrite) { myData.push_back(i); } - nxt::Buffer buffer = device.CreateBufferBuilder() + dawn::Buffer buffer = device.CreateBufferBuilder() .SetSize(static_cast(kDataSize * sizeof(uint32_t))) - .SetAllowedUsage(nxt::BufferUsageBit::MapWrite | nxt::BufferUsageBit::TransferSrc) + .SetAllowedUsage(dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc) .GetResult(); void* mappedData = MapWriteAsyncAndWait(buffer, 0, kDataSize * sizeof(uint32_t)); @@ -194,9 +194,9 @@ class BufferSetSubDataTests : public NXTTest { // Test the simplest set sub data: setting one u8 at offset 0. TEST_P(BufferSetSubDataTests, SmallDataAtZero) { - nxt::Buffer buffer = device.CreateBufferBuilder() + dawn::Buffer buffer = device.CreateBufferBuilder() .SetSize(1) - .SetAllowedUsage(nxt::BufferUsageBit::TransferSrc | nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst) .GetResult(); uint8_t value = 171; @@ -207,9 +207,9 @@ TEST_P(BufferSetSubDataTests, SmallDataAtZero) { // Test that SetSubData offset works. TEST_P(BufferSetSubDataTests, SmallDataAtOffset) { - nxt::Buffer buffer = device.CreateBufferBuilder() + dawn::Buffer buffer = device.CreateBufferBuilder() .SetSize(4000) - .SetAllowedUsage(nxt::BufferUsageBit::TransferSrc | nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst) .GetResult(); constexpr uint32_t kOffset = 2000; @@ -230,9 +230,9 @@ TEST_P(BufferSetSubDataTests, ManySetSubData) { constexpr uint32_t kSize = 4000 * 1000; constexpr uint32_t kElements = 1000 * 1000; - nxt::Buffer buffer = device.CreateBufferBuilder() + dawn::Buffer buffer = device.CreateBufferBuilder() .SetSize(kSize) - .SetAllowedUsage(nxt::BufferUsageBit::TransferSrc | nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst) .GetResult(); std::vector expectedData; @@ -248,9 +248,9 @@ TEST_P(BufferSetSubDataTests, ManySetSubData) { TEST_P(BufferSetSubDataTests, LargeSetSubData) { constexpr uint32_t kSize = 4000 * 1000; constexpr uint32_t kElements = 1000 * 1000; - nxt::Buffer buffer = device.CreateBufferBuilder() + dawn::Buffer buffer = device.CreateBufferBuilder() .SetSize(kSize) - .SetAllowedUsage(nxt::BufferUsageBit::TransferSrc | nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst) .GetResult(); std::vector expectedData; diff --git a/src/tests/end2end/ComputeCopyStorageBufferTests.cpp b/src/tests/end2end/ComputeCopyStorageBufferTests.cpp index c4e9a65a31..04fb524505 100644 --- a/src/tests/end2end/ComputeCopyStorageBufferTests.cpp +++ b/src/tests/end2end/ComputeCopyStorageBufferTests.cpp @@ -30,24 +30,24 @@ class ComputeCopyStorageBufferTests : public NXTTest { void ComputeCopyStorageBufferTests::BasicTest(const char* shader) { auto bgl = utils::MakeBindGroupLayout( device, { - {0, nxt::ShaderStageBit::Compute, nxt::BindingType::StorageBuffer}, - {1, nxt::ShaderStageBit::Compute, nxt::BindingType::StorageBuffer}, + {0, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer}, + {1, dawn::ShaderStageBit::Compute, dawn::BindingType::StorageBuffer}, }); // Set up shader and pipeline - auto module = utils::CreateShaderModule(device, nxt::ShaderStage::Compute, shader); + auto module = utils::CreateShaderModule(device, dawn::ShaderStage::Compute, shader); auto pl = utils::MakeBasicPipelineLayout(device, &bgl); auto pipeline = device.CreateComputePipelineBuilder() .SetLayout(pl) - .SetStage(nxt::ShaderStage::Compute, module, "main") + .SetStage(dawn::ShaderStage::Compute, module, "main") .GetResult(); // Set up src storage buffer auto src = device.CreateBufferBuilder() .SetSize(kNumUints * sizeof(uint32_t)) - .SetAllowedUsage(nxt::BufferUsageBit::Storage | nxt::BufferUsageBit::TransferSrc | - nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::TransferSrc | + dawn::BufferUsageBit::TransferDst) .GetResult(); std::array expected; for (uint32_t i = 0; i < kNumUints; ++i) { @@ -62,8 +62,8 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) { auto dst = device.CreateBufferBuilder() .SetSize(kNumUints * sizeof(uint32_t)) - .SetAllowedUsage(nxt::BufferUsageBit::Storage | nxt::BufferUsageBit::TransferSrc | - nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::TransferSrc | + dawn::BufferUsageBit::TransferDst) .GetResult(); std::array zero{}; dst.SetSubData(0, sizeof(zero), reinterpret_cast(zero.data())); @@ -73,7 +73,7 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) { // Set up bind group and issue dispatch auto bindGroup = device.CreateBindGroupBuilder() .SetLayout(bgl) - .SetUsage(nxt::BindGroupUsage::Frozen) + .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &srcView) .SetBufferViews(1, 1, &dstView) .GetResult(); diff --git a/src/tests/end2end/CopyTests.cpp b/src/tests/end2end/CopyTests.cpp index bd71e8955d..7693c8b672 100644 --- a/src/tests/end2end/CopyTests.cpp +++ b/src/tests/end2end/CopyTests.cpp @@ -72,12 +72,12 @@ class CopyTests_T2B : public CopyTests { void DoTest(const TextureSpec& textureSpec, const BufferSpec& bufferSpec) { // Create a texture that is `width` x `height` with (`level` + 1) mip levels. - nxt::Texture texture = device.CreateTextureBuilder() - .SetDimension(nxt::TextureDimension::e2D) + dawn::Texture texture = device.CreateTextureBuilder() + .SetDimension(dawn::TextureDimension::e2D) .SetExtent(textureSpec.width, textureSpec.height, 1) - .SetFormat(nxt::TextureFormat::R8G8B8A8Unorm) + .SetFormat(dawn::TextureFormat::R8G8B8A8Unorm) .SetMipLevels(textureSpec.level + 1) - .SetAllowedUsage(nxt::TextureUsageBit::TransferDst | nxt::TextureUsageBit::TransferSrc) + .SetAllowedUsage(dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc) .GetResult(); uint32_t width = textureSpec.width >> textureSpec.level; @@ -89,9 +89,9 @@ class CopyTests_T2B : public CopyTests { // Create an upload buffer and use it to populate the `level` mip of the texture std::vector textureData(texelCount); FillTextureData(width, height, rowPitch / kBytesPerTexel, textureData.data()); - nxt::Buffer uploadBuffer = utils::CreateBufferFromData(device, textureData.data(), static_cast(sizeof(RGBA8) * textureData.size()), nxt::BufferUsageBit::TransferSrc); + dawn::Buffer uploadBuffer = utils::CreateBufferFromData(device, textureData.data(), static_cast(sizeof(RGBA8) * textureData.size()), dawn::BufferUsageBit::TransferSrc); - nxt::CommandBuffer commands[2]; + dawn::CommandBuffer commands[2]; commands[0] = device.CreateCommandBufferBuilder() .CopyBufferToTexture(uploadBuffer, 0, rowPitch, texture, 0, 0, 0, width, height, 1, textureSpec.level) @@ -100,9 +100,9 @@ class CopyTests_T2B : public CopyTests { // Create a buffer of size `size` and populate it with empty data (0,0,0,0) // Note: Prepopulating the buffer with empty data ensures that there is not random data in the expectation // and helps ensure that the padding due to the row pitch is not modified by the copy - nxt::Buffer buffer = device.CreateBufferBuilder() + dawn::Buffer buffer = device.CreateBufferBuilder() .SetSize(bufferSpec.size) - .SetAllowedUsage(nxt::BufferUsageBit::TransferSrc | nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst) .GetResult(); std::vector emptyData(bufferSpec.size / kBytesPerTexel); buffer.SetSubData(0, static_cast(emptyData.size() * sizeof(RGBA8)), reinterpret_cast(emptyData.data())); @@ -147,24 +147,24 @@ protected: void DoTest(const TextureSpec& textureSpec, const BufferSpec& bufferSpec) { // Create a buffer of size `size` and populate it with data - nxt::Buffer buffer = device.CreateBufferBuilder() + dawn::Buffer buffer = device.CreateBufferBuilder() .SetSize(bufferSpec.size) - .SetAllowedUsage(nxt::BufferUsageBit::TransferSrc | nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst) .GetResult(); std::vector bufferData(bufferSpec.size / kBytesPerTexel); FillBufferData(bufferData.data(), bufferData.size()); buffer.SetSubData(0, static_cast(bufferData.size() * sizeof(RGBA8)), reinterpret_cast(bufferData.data())); // Create a texture that is `width` x `height` with (`level` + 1) mip levels. - nxt::Texture texture = device.CreateTextureBuilder() - .SetDimension(nxt::TextureDimension::e2D) + dawn::Texture texture = device.CreateTextureBuilder() + .SetDimension(dawn::TextureDimension::e2D) .SetExtent(textureSpec.width, textureSpec.height, 1) - .SetFormat(nxt::TextureFormat::R8G8B8A8Unorm) + .SetFormat(dawn::TextureFormat::R8G8B8A8Unorm) .SetMipLevels(textureSpec.level + 1) - .SetAllowedUsage(nxt::TextureUsageBit::TransferDst | nxt::TextureUsageBit::TransferSrc) + .SetAllowedUsage(dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc) .GetResult(); - nxt::CommandBuffer commands[2]; + dawn::CommandBuffer commands[2]; // Create an upload buffer filled with empty data and use it to populate the `level` mip of the texture // Note: Prepopulating the texture with empty data ensures that there is not random data in the expectation @@ -177,7 +177,7 @@ protected: uint32_t texelCount = texelsPerRow * (height - 1) + width; std::vector emptyData(texelCount); - nxt::Buffer uploadBuffer = utils::CreateBufferFromData(device, emptyData.data(), static_cast(sizeof(RGBA8) * emptyData.size()), nxt::BufferUsageBit::TransferSrc); + dawn::Buffer uploadBuffer = utils::CreateBufferFromData(device, emptyData.data(), static_cast(sizeof(RGBA8) * emptyData.size()), dawn::BufferUsageBit::TransferSrc); commands[0] = device.CreateCommandBufferBuilder() .CopyBufferToTexture(uploadBuffer, 0, rowPitch, texture, 0, 0, 0, width, height, 1, textureSpec.level) diff --git a/src/tests/end2end/DepthStencilStateTests.cpp b/src/tests/end2end/DepthStencilStateTests.cpp index c9a4252bc0..0d280bcc93 100644 --- a/src/tests/end2end/DepthStencilStateTests.cpp +++ b/src/tests/end2end/DepthStencilStateTests.cpp @@ -25,31 +25,31 @@ class DepthStencilStateTest : public NXTTest { NXTTest::SetUp(); renderTarget = device.CreateTextureBuilder() - .SetDimension(nxt::TextureDimension::e2D) + .SetDimension(dawn::TextureDimension::e2D) .SetExtent(kRTSize, kRTSize, 1) - .SetFormat(nxt::TextureFormat::R8G8B8A8Unorm) + .SetFormat(dawn::TextureFormat::R8G8B8A8Unorm) .SetMipLevels(1) - .SetAllowedUsage(nxt::TextureUsageBit::OutputAttachment | nxt::TextureUsageBit::TransferSrc) + .SetAllowedUsage(dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc) .GetResult(); renderTargetView = renderTarget.CreateTextureViewBuilder().GetResult(); depthTexture = device.CreateTextureBuilder() - .SetDimension(nxt::TextureDimension::e2D) + .SetDimension(dawn::TextureDimension::e2D) .SetExtent(kRTSize, kRTSize, 1) - .SetFormat(nxt::TextureFormat::D32FloatS8Uint) + .SetFormat(dawn::TextureFormat::D32FloatS8Uint) .SetMipLevels(1) - .SetAllowedUsage(nxt::TextureUsageBit::OutputAttachment) + .SetAllowedUsage(dawn::TextureUsageBit::OutputAttachment) .GetResult(); depthTextureView = depthTexture.CreateTextureViewBuilder().GetResult(); renderpass = device.CreateRenderPassDescriptorBuilder() - .SetColorAttachment(0, renderTargetView, nxt::LoadOp::Clear) - .SetDepthStencilAttachment(depthTextureView, nxt::LoadOp::Clear, nxt::LoadOp::Clear) + .SetColorAttachment(0, renderTargetView, dawn::LoadOp::Clear) + .SetDepthStencilAttachment(depthTextureView, dawn::LoadOp::Clear, dawn::LoadOp::Clear) .GetResult(); - vsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, R"( + vsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, R"( #version 450 layout(set = 0, binding = 0) uniform myBlock { vec3 color; @@ -64,7 +64,7 @@ class DepthStencilStateTest : public NXTTest { } )"); - fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"( + fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"( #version 450 layout(set = 0, binding = 0) uniform myBlock { vec3 color; @@ -78,15 +78,15 @@ class DepthStencilStateTest : public NXTTest { bindGroupLayout = utils::MakeBindGroupLayout( device, { - {0, nxt::ShaderStageBit::Vertex | nxt::ShaderStageBit::Fragment, - nxt::BindingType::UniformBuffer}, + {0, dawn::ShaderStageBit::Vertex | dawn::ShaderStageBit::Fragment, + dawn::BindingType::UniformBuffer}, }); pipelineLayout = utils::MakeBasicPipelineLayout(device, &bindGroupLayout); } struct TestSpec { - const nxt::DepthStencilState& depthStencilState; + const dawn::DepthStencilState& depthStencilState; RGBA8 color; float depth; uint32_t stencil; @@ -94,13 +94,13 @@ class DepthStencilStateTest : public NXTTest { // Check whether a depth comparison function works as expected // The less, equal, greater booleans denote wether the respective triangle should be visible based on the comparison function - void CheckDepthCompareFunction(nxt::CompareFunction compareFunction, bool less, bool equal, bool greater) { - nxt::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() - .SetDepthCompareFunction(nxt::CompareFunction::Always) + void CheckDepthCompareFunction(dawn::CompareFunction compareFunction, bool less, bool equal, bool greater) { + dawn::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() + .SetDepthCompareFunction(dawn::CompareFunction::Always) .SetDepthWriteEnabled(true) .GetResult(); - nxt::DepthStencilState state = device.CreateDepthStencilStateBuilder() + dawn::DepthStencilState state = device.CreateDepthStencilStateBuilder() .SetDepthCompareFunction(compareFunction) .SetDepthWriteEnabled(true) .GetResult(); @@ -125,13 +125,13 @@ class DepthStencilStateTest : public NXTTest { // Check whether a stencil comparison function works as expected // The less, equal, greater booleans denote wether the respective triangle should be visible based on the comparison function - void CheckStencilCompareFunction(nxt::CompareFunction compareFunction, bool less, bool equal, bool greater) { - nxt::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Always, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep, nxt::StencilOperation::Replace) + void CheckStencilCompareFunction(dawn::CompareFunction compareFunction, bool less, bool equal, bool greater) { + dawn::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Always, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep, dawn::StencilOperation::Replace) .GetResult(); - nxt::DepthStencilState state = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, compareFunction, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep) + dawn::DepthStencilState state = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, compareFunction, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep) .GetResult(); RGBA8 baseColor = RGBA8(255, 255, 255, 255); @@ -153,13 +153,13 @@ class DepthStencilStateTest : public NXTTest { } // Given the provided `initialStencil` and `reference`, check that applying the `stencilOperation` produces the `expectedStencil` - void CheckStencilOperation(nxt::StencilOperation stencilOperation, uint32_t initialStencil, uint32_t reference, uint32_t expectedStencil) { - nxt::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Always, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep, nxt::StencilOperation::Replace) + void CheckStencilOperation(dawn::StencilOperation stencilOperation, uint32_t initialStencil, uint32_t reference, uint32_t expectedStencil) { + dawn::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Always, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep, dawn::StencilOperation::Replace) .GetResult(); - nxt::DepthStencilState state = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Always, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep, stencilOperation) + dawn::DepthStencilState state = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Always, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep, stencilOperation) .GetResult(); CheckStencil({ @@ -173,8 +173,8 @@ class DepthStencilStateTest : public NXTTest { // Draw a list of test specs, and check if the stencil value is equal to the expected value void CheckStencil(std::vector testParams, uint32_t expectedStencil) { - nxt::DepthStencilState state = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Equal, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep) + dawn::DepthStencilState state = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Equal, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep) .GetResult(); testParams.push_back({ state, RGBA8(0, 255, 0, 255), 0, expectedStencil }); @@ -184,7 +184,7 @@ class DepthStencilStateTest : public NXTTest { // Each test param represents a pair of triangles with a color, depth, stencil value, and depthStencil state, one frontfacing, one backfacing // Draw the triangles in order and check the expected colors for the frontfaces and backfaces void DoTest(const std::vector &testParams, const RGBA8& expectedFront, const RGBA8& expectedBack) { - nxt::CommandBufferBuilder builder = device.CreateCommandBufferBuilder(); + dawn::CommandBufferBuilder builder = device.CreateCommandBufferBuilder(); struct TriangleData { float color[3]; @@ -201,26 +201,26 @@ class DepthStencilStateTest : public NXTTest { test.depth, }; // Upload a buffer for each triangle's depth and color data - nxt::Buffer buffer = utils::CreateBufferFromData(device, &data, sizeof(TriangleData), nxt::BufferUsageBit::Uniform); + dawn::Buffer buffer = utils::CreateBufferFromData(device, &data, sizeof(TriangleData), dawn::BufferUsageBit::Uniform); - nxt::BufferView view = buffer.CreateBufferViewBuilder() + dawn::BufferView view = buffer.CreateBufferViewBuilder() .SetExtent(0, sizeof(TriangleData)) .GetResult(); // Create a bind group for the data - nxt::BindGroup bindGroup = device.CreateBindGroupBuilder() + dawn::BindGroup bindGroup = device.CreateBindGroupBuilder() .SetLayout(bindGroupLayout) - .SetUsage(nxt::BindGroupUsage::Frozen) + .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &view) .GetResult(); // Create a pipeline for the triangles with the test spec's depth stencil state - nxt::RenderPipeline pipeline = device.CreateRenderPipelineBuilder() - .SetColorAttachmentFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) - .SetDepthStencilAttachmentFormat(nxt::TextureFormat::D32FloatS8Uint) + dawn::RenderPipeline pipeline = device.CreateRenderPipelineBuilder() + .SetColorAttachmentFormat(0, dawn::TextureFormat::R8G8B8A8Unorm) + .SetDepthStencilAttachmentFormat(dawn::TextureFormat::D32FloatS8Uint) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .SetDepthStencilState(test.depthStencilState) .GetResult(); @@ -230,7 +230,7 @@ class DepthStencilStateTest : public NXTTest { .DrawArrays(6, 1, 0, 0); } - nxt::CommandBuffer commands = builder + dawn::CommandBuffer commands = builder .EndRenderPass() .GetResult(); @@ -244,20 +244,20 @@ class DepthStencilStateTest : public NXTTest { DoTest(testParams, expected, expected); } - nxt::RenderPassDescriptor renderpass; - nxt::Texture renderTarget; - nxt::Texture depthTexture; - nxt::TextureView renderTargetView; - nxt::TextureView depthTextureView; - nxt::ShaderModule vsModule; - nxt::ShaderModule fsModule; - nxt::BindGroupLayout bindGroupLayout; - nxt::PipelineLayout pipelineLayout; + dawn::RenderPassDescriptor renderpass; + dawn::Texture renderTarget; + dawn::Texture depthTexture; + dawn::TextureView renderTargetView; + dawn::TextureView depthTextureView; + dawn::ShaderModule vsModule; + dawn::ShaderModule fsModule; + dawn::BindGroupLayout bindGroupLayout; + dawn::PipelineLayout pipelineLayout; }; // Test compilation and usage of the fixture TEST_P(DepthStencilStateTest, Basic) { - nxt::DepthStencilState state = device.CreateDepthStencilStateBuilder() + dawn::DepthStencilState state = device.CreateDepthStencilStateBuilder() .GetResult(); DoTest({ @@ -267,7 +267,7 @@ TEST_P(DepthStencilStateTest, Basic) { // Test defaults: depth and stencil tests disabled TEST_P(DepthStencilStateTest, DepthStencilDisabled) { - nxt::DepthStencilState state = device.CreateDepthStencilStateBuilder() + dawn::DepthStencilState state = device.CreateDepthStencilStateBuilder() .GetResult(); TestSpec specs[3] = { @@ -288,51 +288,51 @@ TEST_P(DepthStencilStateTest, DepthStencilDisabled) { // The following tests check that each depth comparison function works TEST_P(DepthStencilStateTest, DepthAlways) { - CheckDepthCompareFunction(nxt::CompareFunction::Always , true, true, true); + CheckDepthCompareFunction(dawn::CompareFunction::Always , true, true, true); } TEST_P(DepthStencilStateTest, DepthEqual) { - CheckDepthCompareFunction(nxt::CompareFunction::Equal, false, true, false); + CheckDepthCompareFunction(dawn::CompareFunction::Equal, false, true, false); } TEST_P(DepthStencilStateTest, DepthGreater) { - CheckDepthCompareFunction(nxt::CompareFunction::Greater, false, false, true); + CheckDepthCompareFunction(dawn::CompareFunction::Greater, false, false, true); } TEST_P(DepthStencilStateTest, DepthGreaterEqual) { - CheckDepthCompareFunction(nxt::CompareFunction::GreaterEqual, false, true, true); + CheckDepthCompareFunction(dawn::CompareFunction::GreaterEqual, false, true, true); } TEST_P(DepthStencilStateTest, DepthLess) { - CheckDepthCompareFunction(nxt::CompareFunction::Less, true, false, false); + CheckDepthCompareFunction(dawn::CompareFunction::Less, true, false, false); } TEST_P(DepthStencilStateTest, DepthLessEqual) { - CheckDepthCompareFunction(nxt::CompareFunction::LessEqual, true, true, false); + CheckDepthCompareFunction(dawn::CompareFunction::LessEqual, true, true, false); } TEST_P(DepthStencilStateTest, DepthNever) { - CheckDepthCompareFunction(nxt::CompareFunction::Never, false, false, false); + CheckDepthCompareFunction(dawn::CompareFunction::Never, false, false, false); } TEST_P(DepthStencilStateTest, DepthNotEqual) { - CheckDepthCompareFunction(nxt::CompareFunction::NotEqual, true, false, true); + CheckDepthCompareFunction(dawn::CompareFunction::NotEqual, true, false, true); } // Test that disabling depth writes works and leaves the depth buffer unchanged TEST_P(DepthStencilStateTest, DepthWriteDisabled) { - nxt::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() - .SetDepthCompareFunction(nxt::CompareFunction::Always) + dawn::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() + .SetDepthCompareFunction(dawn::CompareFunction::Always) .SetDepthWriteEnabled(true) .GetResult(); - nxt::DepthStencilState noDepthWrite = device.CreateDepthStencilStateBuilder() - .SetDepthCompareFunction(nxt::CompareFunction::Always) + dawn::DepthStencilState noDepthWrite = device.CreateDepthStencilStateBuilder() + .SetDepthCompareFunction(dawn::CompareFunction::Always) .SetDepthWriteEnabled(false) .GetResult(); - nxt::DepthStencilState checkState = device.CreateDepthStencilStateBuilder() - .SetDepthCompareFunction(nxt::CompareFunction::Equal) + dawn::DepthStencilState checkState = device.CreateDepthStencilStateBuilder() + .SetDepthCompareFunction(dawn::CompareFunction::Equal) .GetResult(); DoTest({ @@ -344,82 +344,82 @@ TEST_P(DepthStencilStateTest, DepthWriteDisabled) { // The following tests check that each stencil comparison function works TEST_P(DepthStencilStateTest, StencilAlways) { - CheckStencilCompareFunction(nxt::CompareFunction::Always, true, true, true); + CheckStencilCompareFunction(dawn::CompareFunction::Always, true, true, true); } TEST_P(DepthStencilStateTest, StencilEqual) { - CheckStencilCompareFunction(nxt::CompareFunction::Equal, false, true, false); + CheckStencilCompareFunction(dawn::CompareFunction::Equal, false, true, false); } TEST_P(DepthStencilStateTest, StencilGreater) { - CheckStencilCompareFunction(nxt::CompareFunction::Greater, false, false, true); + CheckStencilCompareFunction(dawn::CompareFunction::Greater, false, false, true); } TEST_P(DepthStencilStateTest, StencilGreaterEqual) { - CheckStencilCompareFunction(nxt::CompareFunction::GreaterEqual, false, true, true); + CheckStencilCompareFunction(dawn::CompareFunction::GreaterEqual, false, true, true); } TEST_P(DepthStencilStateTest, StencilLess) { - CheckStencilCompareFunction(nxt::CompareFunction::Less, true, false, false); + CheckStencilCompareFunction(dawn::CompareFunction::Less, true, false, false); } TEST_P(DepthStencilStateTest, StencilLessEqual) { - CheckStencilCompareFunction(nxt::CompareFunction::LessEqual, true, true, false); + CheckStencilCompareFunction(dawn::CompareFunction::LessEqual, true, true, false); } TEST_P(DepthStencilStateTest, StencilNever) { - CheckStencilCompareFunction(nxt::CompareFunction::Never, false, false, false); + CheckStencilCompareFunction(dawn::CompareFunction::Never, false, false, false); } TEST_P(DepthStencilStateTest, StencilNotEqual) { - CheckStencilCompareFunction(nxt::CompareFunction::NotEqual, true, false, true); + CheckStencilCompareFunction(dawn::CompareFunction::NotEqual, true, false, true); } // The following tests check that each stencil operation works TEST_P(DepthStencilStateTest, StencilKeep) { - CheckStencilOperation(nxt::StencilOperation::Keep, 1, 3, 1); + CheckStencilOperation(dawn::StencilOperation::Keep, 1, 3, 1); } TEST_P(DepthStencilStateTest, StencilZero) { - CheckStencilOperation(nxt::StencilOperation::Zero, 1, 3, 0); + CheckStencilOperation(dawn::StencilOperation::Zero, 1, 3, 0); } TEST_P(DepthStencilStateTest, StencilReplace) { - CheckStencilOperation(nxt::StencilOperation::Replace, 1, 3, 3); + CheckStencilOperation(dawn::StencilOperation::Replace, 1, 3, 3); } TEST_P(DepthStencilStateTest, StencilInvert) { - CheckStencilOperation(nxt::StencilOperation::Invert, 0xf0, 3, 0x0f); + CheckStencilOperation(dawn::StencilOperation::Invert, 0xf0, 3, 0x0f); } TEST_P(DepthStencilStateTest, StencilIncrementClamp) { - CheckStencilOperation(nxt::StencilOperation::IncrementClamp, 1, 3, 2); - CheckStencilOperation(nxt::StencilOperation::IncrementClamp, 0xff, 3, 0xff); + CheckStencilOperation(dawn::StencilOperation::IncrementClamp, 1, 3, 2); + CheckStencilOperation(dawn::StencilOperation::IncrementClamp, 0xff, 3, 0xff); } TEST_P(DepthStencilStateTest, StencilIncrementWrap) { - CheckStencilOperation(nxt::StencilOperation::IncrementWrap, 1, 3, 2); - CheckStencilOperation(nxt::StencilOperation::IncrementWrap, 0xff, 3, 0); + CheckStencilOperation(dawn::StencilOperation::IncrementWrap, 1, 3, 2); + CheckStencilOperation(dawn::StencilOperation::IncrementWrap, 0xff, 3, 0); } TEST_P(DepthStencilStateTest, StencilDecrementClamp) { - CheckStencilOperation(nxt::StencilOperation::DecrementClamp, 1, 3, 0); - CheckStencilOperation(nxt::StencilOperation::DecrementClamp, 0, 3, 0); + CheckStencilOperation(dawn::StencilOperation::DecrementClamp, 1, 3, 0); + CheckStencilOperation(dawn::StencilOperation::DecrementClamp, 0, 3, 0); } TEST_P(DepthStencilStateTest, StencilDecrementWrap) { - CheckStencilOperation(nxt::StencilOperation::DecrementWrap, 1, 3, 0); - CheckStencilOperation(nxt::StencilOperation::DecrementWrap, 0, 3, 0xff); + CheckStencilOperation(dawn::StencilOperation::DecrementWrap, 1, 3, 0); + CheckStencilOperation(dawn::StencilOperation::DecrementWrap, 0, 3, 0xff); } // Check that the setting a stencil read mask works TEST_P(DepthStencilStateTest, StencilReadMask) { - nxt::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Always, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep, nxt::StencilOperation::Replace) + dawn::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Always, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep, dawn::StencilOperation::Replace) .GetResult(); - nxt::DepthStencilState state = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Equal, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep) + dawn::DepthStencilState state = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Equal, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep) .SetStencilMask(0x2, 0xff) .GetResult(); @@ -434,13 +434,13 @@ TEST_P(DepthStencilStateTest, StencilReadMask) { // Check that setting a stencil write mask works TEST_P(DepthStencilStateTest, StencilWriteMask) { - nxt::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Always, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep, nxt::StencilOperation::Replace) + dawn::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Always, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep, dawn::StencilOperation::Replace) .SetStencilMask(0xff, 0x1) .GetResult(); - nxt::DepthStencilState state = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Equal, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep) + dawn::DepthStencilState state = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Equal, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep) .GetResult(); RGBA8 baseColor = RGBA8(255, 255, 255, 255); @@ -453,12 +453,12 @@ TEST_P(DepthStencilStateTest, StencilWriteMask) { // Test that the stencil operation is executed on stencil fail TEST_P(DepthStencilStateTest, StencilFail) { - nxt::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Always, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep, nxt::StencilOperation::Replace) + dawn::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Always, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep, dawn::StencilOperation::Replace) .GetResult(); - nxt::DepthStencilState state = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Less, nxt::StencilOperation::Replace, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep) + dawn::DepthStencilState state = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Less, dawn::StencilOperation::Replace, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep) .GetResult(); CheckStencil({ @@ -469,15 +469,15 @@ TEST_P(DepthStencilStateTest, StencilFail) { // Test that the stencil operation is executed on stencil pass, depth fail TEST_P(DepthStencilStateTest, StencilDepthFail) { - nxt::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Always, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep, nxt::StencilOperation::Replace) + dawn::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Always, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep, dawn::StencilOperation::Replace) .SetDepthWriteEnabled(true) .GetResult(); - nxt::DepthStencilState state = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Greater, nxt::StencilOperation::Keep, nxt::StencilOperation::Replace, nxt::StencilOperation::Keep) + dawn::DepthStencilState state = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Greater, dawn::StencilOperation::Keep, dawn::StencilOperation::Replace, dawn::StencilOperation::Keep) .SetDepthWriteEnabled(true) - .SetDepthCompareFunction(nxt::CompareFunction::Less) + .SetDepthCompareFunction(dawn::CompareFunction::Less) .GetResult(); CheckStencil({ @@ -488,15 +488,15 @@ TEST_P(DepthStencilStateTest, StencilDepthFail) { // Test that the stencil operation is executed on stencil pass, depth pass TEST_P(DepthStencilStateTest, StencilDepthPass) { - nxt::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Always, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep, nxt::StencilOperation::Replace) + dawn::DepthStencilState baseState = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Always, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep, dawn::StencilOperation::Replace) .SetDepthWriteEnabled(true) .GetResult(); - nxt::DepthStencilState state = device.CreateDepthStencilStateBuilder() - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Greater, nxt::StencilOperation::Keep, nxt::StencilOperation::Keep, nxt::StencilOperation::Replace) + dawn::DepthStencilState state = device.CreateDepthStencilStateBuilder() + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Greater, dawn::StencilOperation::Keep, dawn::StencilOperation::Keep, dawn::StencilOperation::Replace) .SetDepthWriteEnabled(true) - .SetDepthCompareFunction(nxt::CompareFunction::Less) + .SetDepthCompareFunction(dawn::CompareFunction::Less) .GetResult(); CheckStencil({ diff --git a/src/tests/end2end/DrawElementsTests.cpp b/src/tests/end2end/DrawElementsTests.cpp index 9c27e639d6..25eabc877f 100644 --- a/src/tests/end2end/DrawElementsTests.cpp +++ b/src/tests/end2end/DrawElementsTests.cpp @@ -25,12 +25,12 @@ class DrawElementsTest : public NXTTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); - nxt::InputState inputState = device.CreateInputStateBuilder() - .SetInput(0, 4 * sizeof(float), nxt::InputStepMode::Vertex) - .SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32A32, 0) + dawn::InputState inputState = device.CreateInputStateBuilder() + .SetInput(0, 4 * sizeof(float), dawn::InputStepMode::Vertex) + .SetAttribute(0, 0, dawn::VertexFormat::FloatR32G32B32A32, 0) .GetResult(); - nxt::ShaderModule vsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, R"( + dawn::ShaderModule vsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, R"( #version 450 layout(location = 0) in vec4 pos; void main() { @@ -38,7 +38,7 @@ class DrawElementsTest : public NXTTest { })" ); - nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"( + dawn::ShaderModule fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"( #version 450 layout(location = 0) out vec4 fragColor; void main() { @@ -48,33 +48,33 @@ class DrawElementsTest : public NXTTest { pipeline = device.CreateRenderPipelineBuilder() .SetColorAttachmentFormat(0, renderPass.colorFormat) - .SetPrimitiveTopology(nxt::PrimitiveTopology::TriangleStrip) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") - .SetIndexFormat(nxt::IndexFormat::Uint32) + .SetPrimitiveTopology(dawn::PrimitiveTopology::TriangleStrip) + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") + .SetIndexFormat(dawn::IndexFormat::Uint32) .SetInputState(inputState) .GetResult(); - vertexBuffer = utils::CreateBufferFromData(device, nxt::BufferUsageBit::Vertex, { + vertexBuffer = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Vertex, { -1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, -1.0f, 0.0f, 1.0f }); - indexBuffer = utils::CreateBufferFromData(device, nxt::BufferUsageBit::Index, { + indexBuffer = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Index, { 0, 1, 2, 0, 3, 1 }); } utils::BasicRenderPass renderPass; - nxt::RenderPipeline pipeline; - nxt::Buffer vertexBuffer; - nxt::Buffer indexBuffer; + dawn::RenderPipeline pipeline; + dawn::Buffer vertexBuffer; + dawn::Buffer indexBuffer; void Test(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, uint32_t firstInstance, RGBA8 bottomLeftExpected, RGBA8 topRightExpected) { uint32_t zeroOffset = 0; - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(pipeline) .SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset) diff --git a/src/tests/end2end/IndexFormatTests.cpp b/src/tests/end2end/IndexFormatTests.cpp index 27bea4b4eb..a8266fc9b6 100644 --- a/src/tests/end2end/IndexFormatTests.cpp +++ b/src/tests/end2end/IndexFormatTests.cpp @@ -29,13 +29,13 @@ class IndexFormatTest : public NXTTest { utils::BasicRenderPass renderPass; - nxt::RenderPipeline MakeTestPipeline(nxt::IndexFormat format) { - nxt::InputState inputState = device.CreateInputStateBuilder() - .SetInput(0, 4 * sizeof(float), nxt::InputStepMode::Vertex) - .SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32A32, 0) + dawn::RenderPipeline MakeTestPipeline(dawn::IndexFormat format) { + dawn::InputState inputState = device.CreateInputStateBuilder() + .SetInput(0, 4 * sizeof(float), dawn::InputStepMode::Vertex) + .SetAttribute(0, 0, dawn::VertexFormat::FloatR32G32B32A32, 0) .GetResult(); - nxt::ShaderModule vsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, R"( + dawn::ShaderModule vsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, R"( #version 450 layout(location = 0) in vec4 pos; void main() { @@ -43,7 +43,7 @@ class IndexFormatTest : public NXTTest { })" ); - nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"( + dawn::ShaderModule fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"( #version 450 layout(location = 0) out vec4 fragColor; void main() { @@ -53,9 +53,9 @@ class IndexFormatTest : public NXTTest { return device.CreateRenderPipelineBuilder() .SetColorAttachmentFormat(0, renderPass.colorFormat) - .SetPrimitiveTopology(nxt::PrimitiveTopology::TriangleStrip) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetPrimitiveTopology(dawn::PrimitiveTopology::TriangleStrip) + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .SetIndexFormat(format) .SetInputState(inputState) .GetResult(); @@ -64,21 +64,21 @@ class IndexFormatTest : public NXTTest { // Test that the Uint32 index format is correctly interpreted TEST_P(IndexFormatTest, Uint32) { - nxt::RenderPipeline pipeline = MakeTestPipeline(nxt::IndexFormat::Uint32); + dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint32); - nxt::Buffer vertexBuffer = utils::CreateBufferFromData(device, nxt::BufferUsageBit::Vertex, { + dawn::Buffer vertexBuffer = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Vertex, { -1.0f, 1.0f, 0.0f, 1.0f, // Note Vertices[0] = Vertices[1] -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f }); // If this is interpreted as Uint16, then it would be 0, 1, 0, ... and would draw nothing. - nxt::Buffer indexBuffer = utils::CreateBufferFromData(device, nxt::BufferUsageBit::Index, { + dawn::Buffer indexBuffer = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Index, { 1, 2, 3 }); uint32_t zeroOffset = 0; - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(pipeline) .SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset) @@ -94,20 +94,20 @@ TEST_P(IndexFormatTest, Uint32) { // Test that the Uint16 index format is correctly interpreted TEST_P(IndexFormatTest, Uint16) { - nxt::RenderPipeline pipeline = MakeTestPipeline(nxt::IndexFormat::Uint16); + dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint16); - nxt::Buffer vertexBuffer = utils::CreateBufferFromData(device, nxt::BufferUsageBit::Vertex, { + dawn::Buffer vertexBuffer = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Vertex, { -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f }); // If this is interpreted as uint32, it will have index 1 and 2 be both 0 and render nothing - nxt::Buffer indexBuffer = utils::CreateBufferFromData(device, nxt::BufferUsageBit::Index, { + dawn::Buffer indexBuffer = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Index, { 1, 2, 0, 0, 0, 0 }); uint32_t zeroOffset = 0; - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(pipeline) .SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset) @@ -135,21 +135,21 @@ TEST_P(IndexFormatTest, Uint16) { // Test use of primitive restart with an Uint32 index format TEST_P(IndexFormatTest, Uint32PrimitiveRestart) { - nxt::RenderPipeline pipeline = MakeTestPipeline(nxt::IndexFormat::Uint32); + dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint32); - nxt::Buffer vertexBuffer = utils::CreateBufferFromData(device, nxt::BufferUsageBit::Vertex, { + dawn::Buffer vertexBuffer = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Vertex, { 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f, }); - nxt::Buffer indexBuffer = utils::CreateBufferFromData(device, nxt::BufferUsageBit::Index, { + dawn::Buffer indexBuffer = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Index, { 0, 1, 2, 0xFFFFFFFFu, 3, 4, 2, }); uint32_t zeroOffset = 0; - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(pipeline) .SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset) @@ -167,21 +167,21 @@ TEST_P(IndexFormatTest, Uint32PrimitiveRestart) { // Test use of primitive restart with an Uint16 index format TEST_P(IndexFormatTest, Uint16PrimitiveRestart) { - nxt::RenderPipeline pipeline = MakeTestPipeline(nxt::IndexFormat::Uint16); + dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint16); - nxt::Buffer vertexBuffer = utils::CreateBufferFromData(device, nxt::BufferUsageBit::Vertex, { + dawn::Buffer vertexBuffer = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Vertex, { 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f, }); - nxt::Buffer indexBuffer = utils::CreateBufferFromData(device, nxt::BufferUsageBit::Index, { + dawn::Buffer indexBuffer = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Index, { 0, 1, 2, 0xFFFFu, 3, 4, 2, }); uint32_t zeroOffset = 0; - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(pipeline) .SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset) @@ -206,22 +206,22 @@ TEST_P(IndexFormatTest, ChangePipelineAfterSetIndexBuffer) { return; } - nxt::RenderPipeline pipeline32 = MakeTestPipeline(nxt::IndexFormat::Uint32); - nxt::RenderPipeline pipeline16 = MakeTestPipeline(nxt::IndexFormat::Uint16); + dawn::RenderPipeline pipeline32 = MakeTestPipeline(dawn::IndexFormat::Uint32); + dawn::RenderPipeline pipeline16 = MakeTestPipeline(dawn::IndexFormat::Uint16); - nxt::Buffer vertexBuffer = utils::CreateBufferFromData(device, nxt::BufferUsageBit::Vertex, { + dawn::Buffer vertexBuffer = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Vertex, { -1.0f, 1.0f, 0.0f, 1.0f, // Note Vertices[0] = Vertices[1] -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f }); // If this is interpreted as Uint16, then it would be 0, 1, 0, ... and would draw nothing. - nxt::Buffer indexBuffer = utils::CreateBufferFromData(device, nxt::BufferUsageBit::Index, { + dawn::Buffer indexBuffer = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Index, { 1, 2, 3 }); uint32_t zeroOffset = 0; - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(pipeline16) .SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset) @@ -242,19 +242,19 @@ TEST_P(IndexFormatTest, ChangePipelineAfterSetIndexBuffer) { // TODO(cwallez@chromium.org): This is currently disallowed by the validation but // we want to support eventually. TEST_P(IndexFormatTest, DISABLED_SetIndexBufferBeforeSetPipeline) { - nxt::RenderPipeline pipeline = MakeTestPipeline(nxt::IndexFormat::Uint32); + dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint32); - nxt::Buffer vertexBuffer = utils::CreateBufferFromData(device, nxt::BufferUsageBit::Vertex, { + dawn::Buffer vertexBuffer = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Vertex, { -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f }); - nxt::Buffer indexBuffer = utils::CreateBufferFromData(device, nxt::BufferUsageBit::Index, { + dawn::Buffer indexBuffer = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Index, { 0, 1, 2 }); uint32_t zeroOffset = 0; - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetIndexBuffer(indexBuffer, 0) .SetRenderPipeline(pipeline) diff --git a/src/tests/end2end/InputStateTests.cpp b/src/tests/end2end/InputStateTests.cpp index a14ac14218..b065dfe2ab 100644 --- a/src/tests/end2end/InputStateTests.cpp +++ b/src/tests/end2end/InputStateTests.cpp @@ -17,8 +17,8 @@ #include "common/Assert.h" #include "utils/NXTHelpers.h" -using nxt::InputStepMode; -using nxt::VertexFormat; +using dawn::InputStepMode; +using dawn::VertexFormat; // Input state tests all work the same way: the test will render triangles in a grid up to 4x4. Each triangle // is position in the grid such that X will correspond to the "triangle number" and the Y to the instance number. @@ -63,7 +63,7 @@ class InputStateTest : public NXTTest { VertexFormat format; InputStepMode step; }; - nxt::RenderPipeline MakeTestPipeline(const nxt::InputState& inputState, int multiplier, std::vector testSpec) { + dawn::RenderPipeline MakeTestPipeline(const dawn::InputState& inputState, int multiplier, std::vector testSpec) { std::ostringstream vs; vs << "#version 450\n"; @@ -110,8 +110,8 @@ class InputStateTest : public NXTTest { vs << " }\n;"; vs << "}\n"; - nxt::ShaderModule vsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, vs.str().c_str()); - nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"( + dawn::ShaderModule vsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, vs.str().c_str()); + dawn::ShaderModule fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"( #version 450 layout(location = 0) in vec4 color; layout(location = 0) out vec4 fragColor; @@ -122,8 +122,8 @@ class InputStateTest : public NXTTest { return device.CreateRenderPipelineBuilder() .SetColorAttachmentFormat(0, renderPass.colorFormat) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .SetInputState(inputState) .GetResult(); } @@ -139,8 +139,8 @@ class InputStateTest : public NXTTest { uint32_t offset; VertexFormat format; }; - nxt::InputState MakeInputState(std::vector inputs, std::vector attributes) { - nxt::InputStateBuilder builder = device.CreateInputStateBuilder(); + dawn::InputState MakeInputState(std::vector inputs, std::vector attributes) { + dawn::InputStateBuilder builder = device.CreateInputStateBuilder(); for (const auto& input : inputs) { builder.SetInput(input.slot, input.stride, input.step); @@ -154,19 +154,19 @@ class InputStateTest : public NXTTest { } template - nxt::Buffer MakeVertexBuffer(std::vector data) { - return utils::CreateBufferFromData(device, data.data(), static_cast(data.size() * sizeof(T)), nxt::BufferUsageBit::Vertex); + dawn::Buffer MakeVertexBuffer(std::vector data) { + return utils::CreateBufferFromData(device, data.data(), static_cast(data.size() * sizeof(T)), dawn::BufferUsageBit::Vertex); } struct DrawVertexBuffer { uint32_t location; - nxt::Buffer* buffer; + dawn::Buffer* buffer; }; - void DoTestDraw(const nxt::RenderPipeline& pipeline, unsigned int triangles, unsigned int instances, std::vector vertexBuffers) { + void DoTestDraw(const dawn::RenderPipeline& pipeline, unsigned int triangles, unsigned int instances, std::vector vertexBuffers) { EXPECT_LE(triangles, 4u); EXPECT_LE(instances, 4u); - nxt::CommandBufferBuilder builder = device.CreateCommandBufferBuilder(); + dawn::CommandBufferBuilder builder = device.CreateCommandBufferBuilder(); builder.BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(pipeline); @@ -176,7 +176,7 @@ class InputStateTest : public NXTTest { builder.SetVertexBuffers(buffer.location, 1, buffer.buffer, &zeroOffset); } - nxt::CommandBuffer commands = builder + dawn::CommandBuffer commands = builder .DrawArrays(triangles * 3, instances, 0, 0) .EndRenderPass() .GetResult(); @@ -203,17 +203,17 @@ class InputStateTest : public NXTTest { // Test compilation and usage of the fixture :) TEST_P(InputStateTest, Basic) { - nxt::InputState inputState = MakeInputState({ + dawn::InputState inputState = MakeInputState({ {0, 4 * sizeof(float), InputStepMode::Vertex} }, { {0, 0, 0, VertexFormat::FloatR32G32B32A32} } ); - nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { + dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex} }); - nxt::Buffer buffer0 = MakeVertexBuffer({ + dawn::Buffer buffer0 = MakeVertexBuffer({ 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5 @@ -223,17 +223,17 @@ TEST_P(InputStateTest, Basic) { // Test a stride of 0 works TEST_P(InputStateTest, ZeroStride) { - nxt::InputState inputState = MakeInputState({ + dawn::InputState inputState = MakeInputState({ {0, 0, InputStepMode::Vertex} }, { {0, 0, 0, VertexFormat::FloatR32G32B32A32} } ); - nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, { + dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, { {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex} }); - nxt::Buffer buffer0 = MakeVertexBuffer({ + dawn::Buffer buffer0 = MakeVertexBuffer({ 0, 1, 2, 3, }); DoTestDraw(pipeline, 1, 1, {DrawVertexBuffer{0, &buffer0}}); @@ -243,51 +243,51 @@ TEST_P(InputStateTest, ZeroStride) { TEST_P(InputStateTest, AttributeExpanding) { // R32F case { - nxt::InputState inputState = MakeInputState({ + dawn::InputState inputState = MakeInputState({ {0, 0, InputStepMode::Vertex} }, { {0, 0, 0, VertexFormat::FloatR32} } ); - nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, { + dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, { {0, VertexFormat::FloatR32, InputStepMode::Vertex} }); - nxt::Buffer buffer0 = MakeVertexBuffer({ + dawn::Buffer buffer0 = MakeVertexBuffer({ 0, 1, 2, 3 }); DoTestDraw(pipeline, 1, 1, {DrawVertexBuffer{0, &buffer0}}); } // RG32F case { - nxt::InputState inputState = MakeInputState({ + dawn::InputState inputState = MakeInputState({ {0, 0, InputStepMode::Vertex} }, { {0, 0, 0, VertexFormat::FloatR32G32} } ); - nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, { + dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, { {0, VertexFormat::FloatR32G32, InputStepMode::Vertex} }); - nxt::Buffer buffer0 = MakeVertexBuffer({ + dawn::Buffer buffer0 = MakeVertexBuffer({ 0, 1, 2, 3 }); DoTestDraw(pipeline, 1, 1, {DrawVertexBuffer{0, &buffer0}}); } // RGB32F case { - nxt::InputState inputState = MakeInputState({ + dawn::InputState inputState = MakeInputState({ {0, 0, InputStepMode::Vertex} }, { {0, 0, 0, VertexFormat::FloatR32G32B32} } ); - nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, { + dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 0, { {0, VertexFormat::FloatR32G32B32, InputStepMode::Vertex} }); - nxt::Buffer buffer0 = MakeVertexBuffer({ + dawn::Buffer buffer0 = MakeVertexBuffer({ 0, 1, 2, 3 }); DoTestDraw(pipeline, 1, 1, {DrawVertexBuffer{0, &buffer0}}); @@ -296,17 +296,17 @@ TEST_P(InputStateTest, AttributeExpanding) { // Test a stride larger than the attributes TEST_P(InputStateTest, StrideLargerThanAttributes) { - nxt::InputState inputState = MakeInputState({ + dawn::InputState inputState = MakeInputState({ {0, 8 * sizeof(float), InputStepMode::Vertex} }, { {0, 0, 0, VertexFormat::FloatR32G32B32A32} } ); - nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { + dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex} }); - nxt::Buffer buffer0 = MakeVertexBuffer({ + dawn::Buffer buffer0 = MakeVertexBuffer({ 0, 1, 2, 3, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 2, 3, 4, 5, 0, 0, 0, 0, @@ -316,18 +316,18 @@ TEST_P(InputStateTest, StrideLargerThanAttributes) { // Test two attributes at an offset, vertex version TEST_P(InputStateTest, TwoAttributesAtAnOffsetVertex) { - nxt::InputState inputState = MakeInputState({ + dawn::InputState inputState = MakeInputState({ {0, 8 * sizeof(float), InputStepMode::Vertex} }, { {0, 0, 0, VertexFormat::FloatR32G32B32A32}, {1, 0, 4 * sizeof(float), VertexFormat::FloatR32G32B32A32} } ); - nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { + dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Vertex} }); - nxt::Buffer buffer0 = MakeVertexBuffer({ + dawn::Buffer buffer0 = MakeVertexBuffer({ 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 2, 3, 4, 5, 2, 3, 4, 5, @@ -337,18 +337,18 @@ TEST_P(InputStateTest, TwoAttributesAtAnOffsetVertex) { // Test two attributes at an offset, instance version TEST_P(InputStateTest, TwoAttributesAtAnOffsetInstance) { - nxt::InputState inputState = MakeInputState({ + dawn::InputState inputState = MakeInputState({ {0, 8 * sizeof(float), InputStepMode::Instance} }, { {0, 0, 0, VertexFormat::FloatR32G32B32A32}, {1, 0, 4 * sizeof(float), VertexFormat::FloatR32G32B32A32} } ); - nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { + dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Instance} }); - nxt::Buffer buffer0 = MakeVertexBuffer({ + dawn::Buffer buffer0 = MakeVertexBuffer({ 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 2, 3, 4, 5, 2, 3, 4, 5, @@ -358,17 +358,17 @@ TEST_P(InputStateTest, TwoAttributesAtAnOffsetInstance) { // Test a pure-instance input state TEST_P(InputStateTest, PureInstance) { - nxt::InputState inputState = MakeInputState({ + dawn::InputState inputState = MakeInputState({ {0, 4 * sizeof(float), InputStepMode::Instance} }, { {0, 0, 0, VertexFormat::FloatR32G32B32A32} } ); - nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { + dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { {0, VertexFormat::FloatR32G32B32A32, InputStepMode::Instance} }); - nxt::Buffer buffer0 = MakeVertexBuffer({ + dawn::Buffer buffer0 = MakeVertexBuffer({ 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, @@ -380,7 +380,7 @@ TEST_P(InputStateTest, PureInstance) { // Test with mixed everything, vertex vs. instance, different stride and offsets // different attribute types TEST_P(InputStateTest, MixedEverything) { - nxt::InputState inputState = MakeInputState({ + dawn::InputState inputState = MakeInputState({ {0, 12 * sizeof(float), InputStepMode::Vertex}, {1, 10 * sizeof(float), InputStepMode::Instance}, }, { @@ -390,20 +390,20 @@ TEST_P(InputStateTest, MixedEverything) { {3, 1, 5 * sizeof(float), VertexFormat::FloatR32G32B32A32} } ); - nxt::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { + dawn::RenderPipeline pipeline = MakeTestPipeline(inputState, 1, { {0, VertexFormat::FloatR32, InputStepMode::Vertex}, {1, VertexFormat::FloatR32G32, InputStepMode::Vertex}, {2, VertexFormat::FloatR32G32B32, InputStepMode::Instance}, {3, VertexFormat::FloatR32G32B32A32, InputStepMode::Instance} }); - nxt::Buffer buffer0 = MakeVertexBuffer({ + dawn::Buffer buffer0 = MakeVertexBuffer({ 0, 1, 2, 3, 0, 0, 0, 1, 2, 3, 0, 0, 1, 2, 3, 4, 0, 0, 1, 2, 3, 4, 0, 0, 2, 3, 4, 5, 0, 0, 2, 3, 4, 5, 0, 0, 3, 4, 5, 6, 0, 0, 3, 4, 5, 6, 0, 0, }); - nxt::Buffer buffer1 = MakeVertexBuffer({ + dawn::Buffer buffer1 = MakeVertexBuffer({ 0, 1, 2, 3, 0, 0, 1, 2, 3, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 2, 3, 4, 5, 0, 2, 3, 4, 5, 0, diff --git a/src/tests/end2end/PrimitiveTopologyTests.cpp b/src/tests/end2end/PrimitiveTopologyTests.cpp index 2a5b38acbc..ebde93eef8 100644 --- a/src/tests/end2end/PrimitiveTopologyTests.cpp +++ b/src/tests/end2end/PrimitiveTopologyTests.cpp @@ -149,7 +149,7 @@ class PrimitiveTopologyTest : public NXTTest { renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); - vsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, R"( + vsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, R"( #version 450 layout(location = 0) in vec4 pos; void main() { @@ -157,7 +157,7 @@ class PrimitiveTopologyTest : public NXTTest { })" ); - fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"( + fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"( #version 450 layout(location = 0) out vec4 fragColor; void main() { @@ -165,11 +165,11 @@ class PrimitiveTopologyTest : public NXTTest { })"); inputState = device.CreateInputStateBuilder() - .SetAttribute(0, 0, nxt::VertexFormat::FloatR32G32B32A32, 0) - .SetInput(0, 4 * sizeof(float), nxt::InputStepMode::Vertex) + .SetAttribute(0, 0, dawn::VertexFormat::FloatR32G32B32A32, 0) + .SetInput(0, 4 * sizeof(float), dawn::InputStepMode::Vertex) .GetResult(); - vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices), nxt::BufferUsageBit::Vertex); + vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices), dawn::BufferUsageBit::Vertex); } struct LocationSpec { @@ -184,17 +184,17 @@ class PrimitiveTopologyTest : public NXTTest { } // Draw the vertices with the given primitive topology and check the pixel values of the test locations - void DoTest(nxt::PrimitiveTopology primitiveTopology, const std::vector &locationSpecs) { - nxt::RenderPipeline pipeline = device.CreateRenderPipelineBuilder() + void DoTest(dawn::PrimitiveTopology primitiveTopology, const std::vector &locationSpecs) { + dawn::RenderPipeline pipeline = device.CreateRenderPipelineBuilder() .SetColorAttachmentFormat(0, renderPass.colorFormat) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .SetInputState(inputState) .SetPrimitiveTopology(primitiveTopology) .GetResult(); static const uint32_t zeroOffset = 0; - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(pipeline) .SetVertexBuffers(0, 1, &vertexBuffer, &zeroOffset) @@ -215,15 +215,15 @@ class PrimitiveTopologyTest : public NXTTest { } utils::BasicRenderPass renderPass; - nxt::ShaderModule vsModule; - nxt::ShaderModule fsModule; - nxt::InputState inputState; - nxt::Buffer vertexBuffer; + dawn::ShaderModule vsModule; + dawn::ShaderModule fsModule; + dawn::InputState inputState; + dawn::Buffer vertexBuffer; }; // Test Point primitive topology TEST_P(PrimitiveTopologyTest, PointList) { - DoTest(nxt::PrimitiveTopology::PointList, { + DoTest(dawn::PrimitiveTopology::PointList, { // Check that the points are drawn TestPoints(kPointTestLocations, true), @@ -237,7 +237,7 @@ TEST_P(PrimitiveTopologyTest, PointList) { // Test Line primitive topology TEST_P(PrimitiveTopologyTest, LineList) { - DoTest(nxt::PrimitiveTopology::LineList, { + DoTest(dawn::PrimitiveTopology::LineList, { // Check that lines are drawn TestPoints(kLineTestLocations, true), @@ -250,7 +250,7 @@ TEST_P(PrimitiveTopologyTest, LineList) { // Test LineStrip primitive topology TEST_P(PrimitiveTopologyTest, LineStrip) { - DoTest(nxt::PrimitiveTopology::LineStrip, { + DoTest(dawn::PrimitiveTopology::LineStrip, { // Check that lines are drawn TestPoints(kLineTestLocations, true), TestPoints(kLineStripTestLocations, true), @@ -263,7 +263,7 @@ TEST_P(PrimitiveTopologyTest, LineStrip) { // Test Triangle primitive topology TEST_P(PrimitiveTopologyTest, TriangleList) { - DoTest(nxt::PrimitiveTopology::TriangleList, { + DoTest(dawn::PrimitiveTopology::TriangleList, { // Check that triangles are drawn TestPoints(kTriangleTestLocations, true), @@ -274,7 +274,7 @@ TEST_P(PrimitiveTopologyTest, TriangleList) { // Test TriangleStrip primitive topology TEST_P(PrimitiveTopologyTest, TriangleStrip) { - DoTest(nxt::PrimitiveTopology::TriangleStrip, { + DoTest(dawn::PrimitiveTopology::TriangleStrip, { TestPoints(kTriangleTestLocations, true), TestPoints(kTriangleStripTestLocations, true), }); diff --git a/src/tests/end2end/PushConstantTests.cpp b/src/tests/end2end/PushConstantTests.cpp index 3ab49fdc5a..a6a2b71289 100644 --- a/src/tests/end2end/PushConstantTests.cpp +++ b/src/tests/end2end/PushConstantTests.cpp @@ -25,43 +25,43 @@ class PushConstantTest: public NXTTest { // Layout, bind group and friends to store results for compute tests, can have an extra buffer // so that two different pipeline layout can be created. struct TestBindings { - nxt::PipelineLayout layout; - nxt::BindGroup bindGroup; - nxt::Buffer resultBuffer; + dawn::PipelineLayout layout; + dawn::BindGroup bindGroup; + dawn::Buffer resultBuffer; }; TestBindings MakeTestBindings(bool extraBuffer) { - nxt::Buffer buf1 = device.CreateBufferBuilder() + dawn::Buffer buf1 = device.CreateBufferBuilder() .SetSize(4) - .SetAllowedUsage(nxt::BufferUsageBit::Storage | nxt::BufferUsageBit::TransferSrc | nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst) .GetResult(); uint32_t one = 1; buf1.SetSubData(0, sizeof(one), reinterpret_cast(&one)); - nxt::Buffer buf2 = device.CreateBufferBuilder() + dawn::Buffer buf2 = device.CreateBufferBuilder() .SetSize(4) - .SetAllowedUsage(nxt::BufferUsageBit::Storage) + .SetAllowedUsage(dawn::BufferUsageBit::Storage) .GetResult(); - nxt::ShaderStageBit kAllStages = nxt::ShaderStageBit::Compute | nxt::ShaderStageBit::Fragment | nxt::ShaderStageBit::Vertex; - constexpr nxt::ShaderStageBit kNoStages{}; + dawn::ShaderStageBit kAllStages = dawn::ShaderStageBit::Compute | dawn::ShaderStageBit::Fragment | dawn::ShaderStageBit::Vertex; + constexpr dawn::ShaderStageBit kNoStages{}; - nxt::BindGroupLayout bgl = utils::MakeBindGroupLayout( + dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout( device, { - {0, kAllStages, nxt::BindingType::StorageBuffer}, - {1, extraBuffer ? kAllStages : kNoStages, nxt::BindingType::StorageBuffer}, + {0, kAllStages, dawn::BindingType::StorageBuffer}, + {1, extraBuffer ? kAllStages : kNoStages, dawn::BindingType::StorageBuffer}, }); - nxt::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl); + dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl); - nxt::BufferView views[2] = { + dawn::BufferView views[2] = { buf1.CreateBufferViewBuilder().SetExtent(0, 4).GetResult(), buf2.CreateBufferViewBuilder().SetExtent(0, 4).GetResult(), }; - nxt::BindGroup bg = device.CreateBindGroupBuilder() + dawn::BindGroup bg = device.CreateBindGroupBuilder() .SetLayout(bgl) - .SetUsage(nxt::BindGroupUsage::Frozen) + .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, extraBuffer ? 2 : 1, views) .GetResult(); @@ -132,8 +132,8 @@ class PushConstantTest: public NXTTest { } // The compute pipeline ANDs the result of the test in the SSBO - nxt::ComputePipeline MakeTestComputePipeline(const nxt::PipelineLayout& pl, PushConstantSpec spec) { - nxt::ShaderModule module = utils::CreateShaderModule(device, nxt::ShaderStage::Compute, (R"( + dawn::ComputePipeline MakeTestComputePipeline(const dawn::PipelineLayout& pl, PushConstantSpec spec) { + dawn::ShaderModule module = utils::CreateShaderModule(device, dawn::ShaderStage::Compute, (R"( #version 450 layout(set = 0, binding = 0) buffer Result { int success; @@ -151,18 +151,18 @@ class PushConstantTest: public NXTTest { return device.CreateComputePipelineBuilder() .SetLayout(pl) - .SetStage(nxt::ShaderStage::Compute, module, "main") + .SetStage(dawn::ShaderStage::Compute, module, "main") .GetResult(); } - nxt::PipelineLayout MakeEmptyLayout() { + dawn::PipelineLayout MakeEmptyLayout() { return utils::MakeBasicPipelineLayout(device, nullptr); } // The render pipeline adds one to the red channel for successful vertex push constant test // and adds one to green for the frgament test. - nxt::RenderPipeline MakeTestRenderPipeline(nxt::PipelineLayout& layout, PushConstantSpec vsSpec, PushConstantSpec fsSpec) { - nxt::ShaderModule vsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, (R"( + dawn::RenderPipeline MakeTestRenderPipeline(dawn::PipelineLayout& layout, PushConstantSpec vsSpec, PushConstantSpec fsSpec) { + dawn::ShaderModule vsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, (R"( #version 450 )" + MakePushConstantBlock(vsSpec) + R"( layout(location = 0) out float red; @@ -173,7 +173,7 @@ class PushConstantTest: public NXTTest { gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f); })").c_str() ); - nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, (R"( + dawn::ShaderModule fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, (R"( #version 450 )" + MakePushConstantBlock(fsSpec) + R"( layout(location = 0) out vec4 color; @@ -185,18 +185,18 @@ class PushConstantTest: public NXTTest { })").c_str() ); - nxt::BlendState blendState = device.CreateBlendStateBuilder() + dawn::BlendState blendState = device.CreateBlendStateBuilder() .SetBlendEnabled(true) - .SetColorBlend(nxt::BlendOperation::Add, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetAlphaBlend(nxt::BlendOperation::Add, nxt::BlendFactor::One, nxt::BlendFactor::One) + .SetColorBlend(dawn::BlendOperation::Add, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetAlphaBlend(dawn::BlendOperation::Add, dawn::BlendFactor::One, dawn::BlendFactor::One) .GetResult(); return device.CreateRenderPipelineBuilder() - .SetColorAttachmentFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(0, dawn::TextureFormat::R8G8B8A8Unorm) .SetLayout(layout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") - .SetPrimitiveTopology(nxt::PrimitiveTopology::PointList) + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") + .SetPrimitiveTopology(dawn::PrimitiveTopology::PointList) .SetColorAttachmentBlendState(0, blendState) .GetResult(); } @@ -207,10 +207,10 @@ TEST_P(PushConstantTest, ComputePassDefaultsToZero) { auto binding = MakeTestBindings(false); // Expect push constants to be zero in all dispatches of this test. - nxt::ComputePipeline pipeline = MakeTestComputePipeline(binding.layout, MakeAllZeroSpec()); + dawn::ComputePipeline pipeline = MakeTestComputePipeline(binding.layout, MakeAllZeroSpec()); uint32_t notZero = 42; - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginComputePass() // Test compute push constants are set to zero by default. .SetComputePipeline(pipeline) @@ -218,7 +218,7 @@ TEST_P(PushConstantTest, ComputePassDefaultsToZero) { .Dispatch(1, 1, 1) // Set push constants to non-zero value to check they will be reset to zero // on the next BeginComputePass - .SetPushConstants(nxt::ShaderStageBit::Compute, 0, 1, ¬Zero) + .SetPushConstants(dawn::ShaderStageBit::Compute, 0, 1, ¬Zero) .EndComputePass() .BeginComputePass() .SetComputePipeline(pipeline) @@ -238,10 +238,10 @@ TEST_P(PushConstantTest, RenderPassDefaultsToZero) { // Expect push constants to be zero in all draws of this test. PushConstantSpec allZeros = MakeAllZeroSpec(); - nxt::PipelineLayout layout = MakeEmptyLayout(); - nxt::RenderPipeline pipeline = MakeTestRenderPipeline(layout, MakeAllZeroSpec(), MakeAllZeroSpec()); + dawn::PipelineLayout layout = MakeEmptyLayout(); + dawn::RenderPipeline pipeline = MakeTestRenderPipeline(layout, MakeAllZeroSpec(), MakeAllZeroSpec()); - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) // Test render push constants are set to zero by default. .SetRenderPipeline(pipeline) @@ -266,12 +266,12 @@ TEST_P(PushConstantTest, VariousConstantTypes) { auto binding = MakeTestBindings(false); PushConstantSpec spec = {{Int, -1}, {UInt, 3}, {Float, 4}}; - nxt::ComputePipeline pipeline = MakeTestComputePipeline(binding.layout, spec); + dawn::ComputePipeline pipeline = MakeTestComputePipeline(binding.layout, spec); - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginComputePass() - .SetPushConstants(nxt::ShaderStageBit::Compute, 0, 3, reinterpret_cast(&values)) + .SetPushConstants(dawn::ShaderStageBit::Compute, 0, 3, reinterpret_cast(&values)) .SetComputePipeline(pipeline) .SetBindGroup(0, binding.bindGroup) .Dispatch(1, 1, 1) @@ -290,20 +290,20 @@ TEST_P(PushConstantTest, InheritThroughPipelineLayoutChange) { auto binding2 = MakeTestBindings(true); PushConstantSpec spec1 = {{Int, 1}}; PushConstantSpec spec2 = {{Int, 2}}; - nxt::ComputePipeline pipeline1 = MakeTestComputePipeline(binding1.layout, spec1); - nxt::ComputePipeline pipeline2 = MakeTestComputePipeline(binding2.layout, spec2); + dawn::ComputePipeline pipeline1 = MakeTestComputePipeline(binding1.layout, spec1); + dawn::ComputePipeline pipeline2 = MakeTestComputePipeline(binding2.layout, spec2); uint32_t one = 1; uint32_t two = 2; - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginComputePass() // Set Push constant before there is a pipeline set - .SetPushConstants(nxt::ShaderStageBit::Compute, 0, 1, &one) + .SetPushConstants(dawn::ShaderStageBit::Compute, 0, 1, &one) .SetComputePipeline(pipeline1) .SetBindGroup(0, binding1.bindGroup) .Dispatch(1, 1, 1) // Change the push constant before changing pipeline layout - .SetPushConstants(nxt::ShaderStageBit::Compute, 0, 1, &two) + .SetPushConstants(dawn::ShaderStageBit::Compute, 0, 1, &two) .SetComputePipeline(pipeline2) .SetBindGroup(0, binding2.bindGroup) .Dispatch(1, 1, 1) @@ -326,11 +326,11 @@ TEST_P(PushConstantTest, SetAllConstantsToNonZero) { } auto binding = MakeTestBindings(false); - nxt::ComputePipeline pipeline = MakeTestComputePipeline(binding.layout, spec); + dawn::ComputePipeline pipeline = MakeTestComputePipeline(binding.layout, spec); - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginComputePass() - .SetPushConstants(nxt::ShaderStageBit::Compute, 0, kMaxPushConstants, &values[0]) + .SetPushConstants(dawn::ShaderStageBit::Compute, 0, kMaxPushConstants, &values[0]) .SetComputePipeline(pipeline) .SetBindGroup(0, binding.bindGroup) .Dispatch(1, 1, 1) @@ -349,15 +349,15 @@ TEST_P(PushConstantTest, SeparateVertexAndFragmentConstants) { utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1); - nxt::PipelineLayout layout = MakeEmptyLayout(); - nxt::RenderPipeline pipeline = MakeTestRenderPipeline(layout, vsSpec, fsSpec); + dawn::PipelineLayout layout = MakeEmptyLayout(); + dawn::RenderPipeline pipeline = MakeTestRenderPipeline(layout, vsSpec, fsSpec); uint32_t one = 1; uint32_t two = 2; - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) - .SetPushConstants(nxt::ShaderStageBit::Vertex, 0, 1, &one) - .SetPushConstants(nxt::ShaderStageBit::Fragment, 0, 1, &two) + .SetPushConstants(dawn::ShaderStageBit::Vertex, 0, 1, &one) + .SetPushConstants(dawn::ShaderStageBit::Fragment, 0, 1, &two) .SetRenderPipeline(pipeline) .DrawArrays(1, 1, 0, 0) .EndRenderPass() @@ -374,13 +374,13 @@ TEST_P(PushConstantTest, SimultaneousVertexAndFragmentConstants) { utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1); - nxt::PipelineLayout layout = MakeEmptyLayout(); - nxt::RenderPipeline pipeline = MakeTestRenderPipeline(layout, spec, spec); + dawn::PipelineLayout layout = MakeEmptyLayout(); + dawn::RenderPipeline pipeline = MakeTestRenderPipeline(layout, spec, spec); uint32_t two = 2; - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) - .SetPushConstants(nxt::ShaderStageBit::Vertex | nxt::ShaderStageBit::Fragment, 0, 1, &two) + .SetPushConstants(dawn::ShaderStageBit::Vertex | dawn::ShaderStageBit::Fragment, 0, 1, &two) .SetRenderPipeline(pipeline) .DrawArrays(1, 1, 0, 0) .EndRenderPass() diff --git a/src/tests/end2end/RenderPassLoadOpTests.cpp b/src/tests/end2end/RenderPassLoadOpTests.cpp index a9d3a319cb..96d95326d7 100644 --- a/src/tests/end2end/RenderPassLoadOpTests.cpp +++ b/src/tests/end2end/RenderPassLoadOpTests.cpp @@ -23,20 +23,20 @@ constexpr static unsigned int kRTSize = 16; class DrawQuad { public: DrawQuad() {} - DrawQuad(nxt::Device* device, const char* vsSource, const char* fsSource) + DrawQuad(dawn::Device* device, const char* vsSource, const char* fsSource) : device(device) { - vsModule = utils::CreateShaderModule(*device, nxt::ShaderStage::Vertex, vsSource); - fsModule = utils::CreateShaderModule(*device, nxt::ShaderStage::Fragment, fsSource); + vsModule = utils::CreateShaderModule(*device, dawn::ShaderStage::Vertex, vsSource); + fsModule = utils::CreateShaderModule(*device, dawn::ShaderStage::Fragment, fsSource); pipelineLayout = utils::MakeBasicPipelineLayout(*device, nullptr); } - void Draw(nxt::CommandBufferBuilder* builder) { + void Draw(dawn::CommandBufferBuilder* builder) { auto renderPipeline = device->CreateRenderPipelineBuilder() - .SetColorAttachmentFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(0, dawn::TextureFormat::R8G8B8A8Unorm) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .GetResult(); builder->SetRenderPipeline(renderPipeline); @@ -44,10 +44,10 @@ class DrawQuad { } private: - nxt::Device* device = nullptr; - nxt::ShaderModule vsModule = {}; - nxt::ShaderModule fsModule = {}; - nxt::PipelineLayout pipelineLayout = {}; + dawn::Device* device = nullptr; + dawn::ShaderModule vsModule = {}; + dawn::ShaderModule fsModule = {}; + dawn::PipelineLayout pipelineLayout = {}; }; class RenderPassLoadOpTests : public NXTTest { @@ -56,11 +56,11 @@ class RenderPassLoadOpTests : public NXTTest { NXTTest::SetUp(); renderTarget = device.CreateTextureBuilder() - .SetDimension(nxt::TextureDimension::e2D) + .SetDimension(dawn::TextureDimension::e2D) .SetExtent(kRTSize, kRTSize, 1) - .SetFormat(nxt::TextureFormat::R8G8B8A8Unorm) + .SetFormat(dawn::TextureFormat::R8G8B8A8Unorm) .SetMipLevels(1) - .SetAllowedUsage(nxt::TextureUsageBit::OutputAttachment | nxt::TextureUsageBit::TransferSrc) + .SetAllowedUsage(dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc) .GetResult(); renderTargetView = renderTarget.CreateTextureViewBuilder().GetResult(); @@ -94,8 +94,8 @@ class RenderPassLoadOpTests : public NXTTest { blueQuad = DrawQuad(&device, vsSource, fsSource); } - nxt::Texture renderTarget; - nxt::TextureView renderTargetView; + dawn::Texture renderTarget; + dawn::TextureView renderTargetView; std::array expectZero; std::array expectGreen; @@ -110,7 +110,7 @@ TEST_P(RenderPassLoadOpTests, ColorClearThenLoadAndDraw) { // Part 1: clear once, check to make sure it's cleared auto renderPassClearZero = device.CreateRenderPassDescriptorBuilder() - .SetColorAttachment(0, renderTargetView, nxt::LoadOp::Clear) + .SetColorAttachment(0, renderTargetView, dawn::LoadOp::Clear) .SetColorAttachmentClearColor(0, 0.0f, 0.0f, 0.0f, 0.0f) .GetResult(); @@ -122,7 +122,7 @@ TEST_P(RenderPassLoadOpTests, ColorClearThenLoadAndDraw) { .GetResult(); auto renderPassClearGreen = device.CreateRenderPassDescriptorBuilder() - .SetColorAttachment(0, renderTargetView, nxt::LoadOp::Clear) + .SetColorAttachment(0, renderTargetView, dawn::LoadOp::Clear) .SetColorAttachmentClearColor(0, 0.0f, 1.0f, 0.0f, 1.0f) .GetResult(); @@ -142,10 +142,10 @@ TEST_P(RenderPassLoadOpTests, ColorClearThenLoadAndDraw) { // Part 2: draw a blue quad into the right half of the render target, and check result auto renderPassLoad = device.CreateRenderPassDescriptorBuilder() - .SetColorAttachment(0, renderTargetView, nxt::LoadOp::Load) + .SetColorAttachment(0, renderTargetView, dawn::LoadOp::Load) .GetResult(); - nxt::CommandBuffer commandsLoad; + dawn::CommandBuffer commandsLoad; { auto builder = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPassLoad) diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp index 9a47c6fd98..a5872cdd2a 100644 --- a/src/tests/end2end/SamplerTests.cpp +++ b/src/tests/end2end/SamplerTests.cpp @@ -25,14 +25,14 @@ constexpr static unsigned int kRTSize = 64; namespace { struct AddressModeTestCase { - nxt::AddressMode mMode; + dawn::AddressMode mMode; uint8_t mExpected2; uint8_t mExpected3; }; AddressModeTestCase addressModes[] = { - { nxt::AddressMode::Repeat, 0, 255, }, - { nxt::AddressMode::MirroredRepeat, 255, 0, }, - { nxt::AddressMode::ClampToEdge, 255, 255, }, + { dawn::AddressMode::Repeat, 0, 255, }, + { dawn::AddressMode::MirroredRepeat, 255, 0, }, + { dawn::AddressMode::ClampToEdge, 255, 255, }, }; } @@ -44,13 +44,13 @@ protected: mBindGroupLayout = utils::MakeBindGroupLayout( device, { - {0, nxt::ShaderStageBit::Fragment, nxt::BindingType::Sampler}, - {1, nxt::ShaderStageBit::Fragment, nxt::BindingType::SampledTexture}, + {0, dawn::ShaderStageBit::Fragment, dawn::BindingType::Sampler}, + {1, dawn::ShaderStageBit::Fragment, dawn::BindingType::SampledTexture}, }); auto pipelineLayout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout); - auto vsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, R"( + auto vsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, R"( #version 450 void main() { const vec2 pos[6] = vec2[6](vec2(-2.f, -2.f), @@ -62,7 +62,7 @@ protected: gl_Position = vec4(pos[gl_VertexIndex], 0.f, 1.f); } )"); - auto fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"( + auto fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"( #version 450 layout(set = 0, binding = 0) uniform sampler sampler0; layout(set = 0, binding = 1) uniform texture2D texture0; @@ -76,16 +76,16 @@ protected: mPipeline = device.CreateRenderPipelineBuilder() .SetColorAttachmentFormat(0, mRenderPass.colorFormat) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .GetResult(); auto texture = device.CreateTextureBuilder() - .SetDimension(nxt::TextureDimension::e2D) + .SetDimension(dawn::TextureDimension::e2D) .SetExtent(2, 2, 1) - .SetFormat(nxt::TextureFormat::R8G8B8A8Unorm) + .SetFormat(dawn::TextureFormat::R8G8B8A8Unorm) .SetMipLevels(1) - .SetAllowedUsage(nxt::TextureUsageBit::TransferDst | nxt::TextureUsageBit::Sampled) + .SetAllowedUsage(dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled) .GetResult(); // Create a 2x2 checkerboard texture, with black in the top left and bottom right corners. @@ -96,8 +96,8 @@ protected: data[0] = data[rowPixels + 1] = black; data[1] = data[rowPixels] = white; - nxt::Buffer stagingBuffer = utils::CreateBufferFromData(device, data, sizeof(data), nxt::BufferUsageBit::TransferSrc); - nxt::CommandBuffer copy = device.CreateCommandBufferBuilder() + dawn::Buffer stagingBuffer = utils::CreateBufferFromData(device, data, sizeof(data), dawn::BufferUsageBit::TransferSrc); + dawn::CommandBuffer copy = device.CreateCommandBufferBuilder() .CopyBufferToTexture(stagingBuffer, 0, 256, texture, 0, 0, 0, 2, 2, 1, 0) .GetResult(); @@ -106,12 +106,12 @@ protected: } void TestAddressModes(AddressModeTestCase u, AddressModeTestCase v, AddressModeTestCase w) { - nxt::Sampler sampler; + dawn::Sampler sampler; { - nxt::SamplerDescriptor descriptor; - descriptor.minFilter = nxt::FilterMode::Nearest; - descriptor.magFilter = nxt::FilterMode::Nearest; - descriptor.mipmapFilter = nxt::FilterMode::Nearest; + dawn::SamplerDescriptor descriptor; + descriptor.minFilter = dawn::FilterMode::Nearest; + descriptor.magFilter = dawn::FilterMode::Nearest; + descriptor.mipmapFilter = dawn::FilterMode::Nearest; descriptor.addressModeU = u.mMode; descriptor.addressModeV = v.mMode; descriptor.addressModeW = w.mMode; @@ -120,12 +120,12 @@ protected: auto bindGroup = device.CreateBindGroupBuilder() .SetLayout(mBindGroupLayout) - .SetUsage(nxt::BindGroupUsage::Frozen) + .SetUsage(dawn::BindGroupUsage::Frozen) .SetSamplers(0, 1, &sampler) .SetTextureViews(1, 1, &mTextureView) .GetResult(); - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(mRenderPass.renderPassInfo) .SetRenderPipeline(mPipeline) .SetBindGroup(0, bindGroup) @@ -153,9 +153,9 @@ protected: } utils::BasicRenderPass mRenderPass; - nxt::BindGroupLayout mBindGroupLayout; - nxt::RenderPipeline mPipeline; - nxt::TextureView mTextureView; + dawn::BindGroupLayout mBindGroupLayout; + dawn::RenderPipeline mPipeline; + dawn::TextureView mTextureView; }; // Test drawing a rect with a checkerboard texture with different address modes. diff --git a/src/tests/end2end/ScissorTests.cpp b/src/tests/end2end/ScissorTests.cpp index b993bdc58e..e42bd13a06 100644 --- a/src/tests/end2end/ScissorTests.cpp +++ b/src/tests/end2end/ScissorTests.cpp @@ -18,8 +18,8 @@ class ScissorTest: public NXTTest { protected: - nxt::RenderPipeline CreateQuadPipeline(nxt::TextureFormat format) { - nxt::ShaderModule vsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, R"( + dawn::RenderPipeline CreateQuadPipeline(dawn::TextureFormat format) { + dawn::ShaderModule vsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, R"( #version 450 const vec2 pos[6] = vec2[6]( vec2(-1.0f, -1.0f), vec2(-1.0f, 1.0f), vec2(1.0f, -1.0f), @@ -29,17 +29,17 @@ class ScissorTest: public NXTTest { gl_Position = vec4(pos[gl_VertexIndex], 0.5, 1.0); })"); - nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"( + dawn::ShaderModule fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"( #version 450 layout(location = 0) out vec4 fragColor; void main() { fragColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); })"); - nxt::RenderPipeline pipeline = device.CreateRenderPipelineBuilder() + dawn::RenderPipeline pipeline = device.CreateRenderPipelineBuilder() .SetColorAttachmentFormat(0, format) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .GetResult(); return pipeline; @@ -49,9 +49,9 @@ class ScissorTest: public NXTTest { // Test that by default the scissor test is disabled and the whole attachment can be drawn to. TEST_P(ScissorTest, DefaultsToWholeRenderTarget) { utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 100, 100); - nxt::RenderPipeline pipeline = CreateQuadPipeline(renderPass.colorFormat); + dawn::RenderPipeline pipeline = CreateQuadPipeline(renderPass.colorFormat); - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(pipeline) .DrawArrays(6, 1, 0, 0) @@ -69,9 +69,9 @@ TEST_P(ScissorTest, DefaultsToWholeRenderTarget) { // Test setting the scissor to something larger than the attachments. TEST_P(ScissorTest, LargerThanAttachment) { utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 100, 100); - nxt::RenderPipeline pipeline = CreateQuadPipeline(renderPass.colorFormat); + dawn::RenderPipeline pipeline = CreateQuadPipeline(renderPass.colorFormat); - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(pipeline) .SetScissorRect(0, 0, 200, 200) @@ -95,9 +95,9 @@ TEST_P(ScissorTest, EmptyRect) { } utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 2, 2); - nxt::RenderPipeline pipeline = CreateQuadPipeline(renderPass.colorFormat); + dawn::RenderPipeline pipeline = CreateQuadPipeline(renderPass.colorFormat); - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(pipeline) .SetScissorRect(0, 0, 0, 0) @@ -116,14 +116,14 @@ TEST_P(ScissorTest, EmptyRect) { // Test setting a partial scissor (not empty, not full attachment) TEST_P(ScissorTest, PartialRect) { utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 100, 100); - nxt::RenderPipeline pipeline = CreateQuadPipeline(renderPass.colorFormat); + dawn::RenderPipeline pipeline = CreateQuadPipeline(renderPass.colorFormat); constexpr uint32_t kX = 3; constexpr uint32_t kY = 7; constexpr uint32_t kW = 5; constexpr uint32_t kH = 13; - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(pipeline) .SetScissorRect(kX, kY, kW, kH) @@ -144,9 +144,9 @@ TEST_P(ScissorTest, PartialRect) { // Test that the scissor setting doesn't get inherited between renderpasses TEST_P(ScissorTest, NoInheritanceBetweenRenderPass) { utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 100, 100); - nxt::RenderPipeline pipeline = CreateQuadPipeline(renderPass.colorFormat); + dawn::RenderPipeline pipeline = CreateQuadPipeline(renderPass.colorFormat); - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() // RenderPass 1 set the scissor .BeginRenderPass(renderPass.renderPassInfo) .SetScissorRect(0, 0, 0, 0) diff --git a/src/tests/end2end/ViewportOrientationTests.cpp b/src/tests/end2end/ViewportOrientationTests.cpp index 977403f091..d2b462901d 100644 --- a/src/tests/end2end/ViewportOrientationTests.cpp +++ b/src/tests/end2end/ViewportOrientationTests.cpp @@ -22,27 +22,27 @@ class ViewportOrientationTests : public NXTTest {}; TEST_P(ViewportOrientationTests, OriginAt0x0) { utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 2, 2); - nxt::ShaderModule vsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, R"( + dawn::ShaderModule vsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, R"( #version 450 void main() { gl_Position = vec4(-0.5f, -0.5f, 0.0f, 1.0f); })"); - nxt::ShaderModule fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"( + dawn::ShaderModule fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"( #version 450 layout(location = 0) out vec4 fragColor; void main() { fragColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); })"); - nxt::RenderPipeline pipeline = device.CreateRenderPipelineBuilder() + dawn::RenderPipeline pipeline = device.CreateRenderPipelineBuilder() .SetColorAttachmentFormat(0, renderPass.colorFormat) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") - .SetPrimitiveTopology(nxt::PrimitiveTopology::PointList) + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") + .SetPrimitiveTopology(dawn::PrimitiveTopology::PointList) .GetResult(); - nxt::CommandBuffer commands = device.CreateCommandBufferBuilder() + dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() .BeginRenderPass(renderPass.renderPassInfo) .SetRenderPipeline(pipeline) .DrawArrays(1, 1, 0, 0) diff --git a/src/tests/unittests/ObjectBaseTests.cpp b/src/tests/unittests/ObjectBaseTests.cpp index 29c7d9e1f8..2e62335ccb 100644 --- a/src/tests/unittests/ObjectBaseTests.cpp +++ b/src/tests/unittests/ObjectBaseTests.cpp @@ -16,7 +16,7 @@ #include "nxt/nxtcpp.h" -class Object : public nxt::ObjectBase { +class Object : public dawn::ObjectBase { public: using ObjectBase::ObjectBase; using ObjectBase::operator=; diff --git a/src/tests/unittests/PerStageTests.cpp b/src/tests/unittests/PerStageTests.cpp index e459f675c4..a837c3c0ac 100644 --- a/src/tests/unittests/PerStageTests.cpp +++ b/src/tests/unittests/PerStageTests.cpp @@ -20,70 +20,70 @@ using namespace backend; // Tests for StageBit TEST(PerStage, StageBit) { - ASSERT_EQ(StageBit(nxt::ShaderStage::Vertex), nxt::ShaderStageBit::Vertex); - ASSERT_EQ(StageBit(nxt::ShaderStage::Fragment), nxt::ShaderStageBit::Fragment); - ASSERT_EQ(StageBit(nxt::ShaderStage::Compute), nxt::ShaderStageBit::Compute); + ASSERT_EQ(StageBit(dawn::ShaderStage::Vertex), dawn::ShaderStageBit::Vertex); + ASSERT_EQ(StageBit(dawn::ShaderStage::Fragment), dawn::ShaderStageBit::Fragment); + ASSERT_EQ(StageBit(dawn::ShaderStage::Compute), dawn::ShaderStageBit::Compute); } // Basic test for the PerStage container TEST(PerStage, PerStage) { PerStage data; - // Store data using nxt::ShaderStage - data[nxt::ShaderStage::Vertex] = 42; - data[nxt::ShaderStage::Fragment] = 3; - data[nxt::ShaderStage::Compute] = -1; + // Store data using dawn::ShaderStage + data[dawn::ShaderStage::Vertex] = 42; + data[dawn::ShaderStage::Fragment] = 3; + data[dawn::ShaderStage::Compute] = -1; - // Load it using nxt::ShaderStageBit - ASSERT_EQ(data[nxt::ShaderStageBit::Vertex], 42); - ASSERT_EQ(data[nxt::ShaderStageBit::Fragment], 3); - ASSERT_EQ(data[nxt::ShaderStageBit::Compute], -1); + // Load it using dawn::ShaderStageBit + ASSERT_EQ(data[dawn::ShaderStageBit::Vertex], 42); + ASSERT_EQ(data[dawn::ShaderStageBit::Fragment], 3); + ASSERT_EQ(data[dawn::ShaderStageBit::Compute], -1); } // Test IterateStages with kAllStages TEST(PerStage, IterateAllStages) { PerStage counts; - counts[nxt::ShaderStage::Vertex] = 0; - counts[nxt::ShaderStage::Fragment] = 0; - counts[nxt::ShaderStage::Compute] = 0; + counts[dawn::ShaderStage::Vertex] = 0; + counts[dawn::ShaderStage::Fragment] = 0; + counts[dawn::ShaderStage::Compute] = 0; for (auto stage : IterateStages(kAllStages)) { counts[stage] ++; } - ASSERT_EQ(counts[nxt::ShaderStageBit::Vertex], 1); - ASSERT_EQ(counts[nxt::ShaderStageBit::Fragment], 1); - ASSERT_EQ(counts[nxt::ShaderStageBit::Compute], 1); + ASSERT_EQ(counts[dawn::ShaderStageBit::Vertex], 1); + ASSERT_EQ(counts[dawn::ShaderStageBit::Fragment], 1); + ASSERT_EQ(counts[dawn::ShaderStageBit::Compute], 1); } // Test IterateStages with one stage TEST(PerStage, IterateOneStage) { PerStage counts; - counts[nxt::ShaderStage::Vertex] = 0; - counts[nxt::ShaderStage::Fragment] = 0; - counts[nxt::ShaderStage::Compute] = 0; + counts[dawn::ShaderStage::Vertex] = 0; + counts[dawn::ShaderStage::Fragment] = 0; + counts[dawn::ShaderStage::Compute] = 0; - for (auto stage : IterateStages(nxt::ShaderStageBit::Fragment)) { + for (auto stage : IterateStages(dawn::ShaderStageBit::Fragment)) { counts[stage] ++; } - ASSERT_EQ(counts[nxt::ShaderStageBit::Vertex], 0); - ASSERT_EQ(counts[nxt::ShaderStageBit::Fragment], 1); - ASSERT_EQ(counts[nxt::ShaderStageBit::Compute], 0); + ASSERT_EQ(counts[dawn::ShaderStageBit::Vertex], 0); + ASSERT_EQ(counts[dawn::ShaderStageBit::Fragment], 1); + ASSERT_EQ(counts[dawn::ShaderStageBit::Compute], 0); } // Test IterateStages with no stage TEST(PerStage, IterateNoStages) { PerStage counts; - counts[nxt::ShaderStage::Vertex] = 0; - counts[nxt::ShaderStage::Fragment] = 0; - counts[nxt::ShaderStage::Compute] = 0; + counts[dawn::ShaderStage::Vertex] = 0; + counts[dawn::ShaderStage::Fragment] = 0; + counts[dawn::ShaderStage::Compute] = 0; - for (auto stage : IterateStages(nxt::ShaderStageBit::Fragment & nxt::ShaderStageBit::Vertex)) { + for (auto stage : IterateStages(dawn::ShaderStageBit::Fragment & dawn::ShaderStageBit::Vertex)) { counts[stage] ++; } - ASSERT_EQ(counts[nxt::ShaderStageBit::Vertex], 0); - ASSERT_EQ(counts[nxt::ShaderStageBit::Fragment], 0); - ASSERT_EQ(counts[nxt::ShaderStageBit::Compute], 0); + ASSERT_EQ(counts[dawn::ShaderStageBit::Vertex], 0); + ASSERT_EQ(counts[dawn::ShaderStageBit::Fragment], 0); + ASSERT_EQ(counts[dawn::ShaderStageBit::Compute], 0); } diff --git a/src/tests/unittests/validation/BindGroupValidationTests.cpp b/src/tests/unittests/validation/BindGroupValidationTests.cpp index 735f0bb479..62909eb74e 100644 --- a/src/tests/unittests/validation/BindGroupValidationTests.cpp +++ b/src/tests/unittests/validation/BindGroupValidationTests.cpp @@ -21,11 +21,11 @@ class BindGroupValidationTest : public ValidationTest { TEST_F(BindGroupValidationTest, BufferViewOffset) { auto layout = utils::MakeBindGroupLayout( device, { - {0, nxt::ShaderStageBit::Vertex, nxt::BindingType::UniformBuffer}, + {0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}, }); auto buffer = device.CreateBufferBuilder() - .SetAllowedUsage(nxt::BufferUsageBit::Uniform) + .SetAllowedUsage(dawn::BufferUsageBit::Uniform) .SetSize(512) .GetResult(); @@ -37,7 +37,7 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) { auto bindGroup = AssertWillBeSuccess(device.CreateBindGroupBuilder()) .SetLayout(layout) - .SetUsage(nxt::BindGroupUsage::Frozen) + .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &bufferView) .GetResult(); } @@ -50,7 +50,7 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) { auto bindGroup = AssertWillBeSuccess(device.CreateBindGroupBuilder()) .SetLayout(layout) - .SetUsage(nxt::BindGroupUsage::Frozen) + .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &bufferView) .GetResult(); } @@ -63,7 +63,7 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) { auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder()) .SetLayout(layout) - .SetUsage(nxt::BindGroupUsage::Frozen) + .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &bufferView) .GetResult(); } @@ -75,7 +75,7 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) { auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder()) .SetLayout(layout) - .SetUsage(nxt::BindGroupUsage::Frozen) + .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &bufferView) .GetResult(); } @@ -87,7 +87,7 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) { auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder()) .SetLayout(layout) - .SetUsage(nxt::BindGroupUsage::Frozen) + .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &bufferView) .GetResult(); } @@ -99,7 +99,7 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) { auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder()) .SetLayout(layout) - .SetUsage(nxt::BindGroupUsage::Frozen) + .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &bufferView) .GetResult(); } @@ -112,11 +112,11 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) { TEST_F(BindGroupValidationTest, BindGroupLayoutCache) { auto layout1 = utils::MakeBindGroupLayout( device, { - {0, nxt::ShaderStageBit::Vertex, nxt::BindingType::UniformBuffer}, + {0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}, }); auto layout2 = utils::MakeBindGroupLayout( device, { - {0, nxt::ShaderStageBit::Vertex, nxt::BindingType::UniformBuffer}, + {0, dawn::ShaderStageBit::Vertex, dawn::BindingType::UniformBuffer}, }); // Caching should cause these to be the same. diff --git a/src/tests/unittests/validation/BlendStateValidationTests.cpp b/src/tests/unittests/validation/BlendStateValidationTests.cpp index 786f239276..5a1e83a273 100644 --- a/src/tests/unittests/validation/BlendStateValidationTests.cpp +++ b/src/tests/unittests/validation/BlendStateValidationTests.cpp @@ -21,17 +21,17 @@ class BlendStateValidationTest : public ValidationTest { TEST_F(BlendStateValidationTest, CreationSuccess) { // Success for setting all properties { - nxt::BlendState state = AssertWillBeSuccess(device.CreateBlendStateBuilder()) + dawn::BlendState state = AssertWillBeSuccess(device.CreateBlendStateBuilder()) .SetBlendEnabled(true) - .SetAlphaBlend(nxt::BlendOperation::Add, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetColorBlend(nxt::BlendOperation::Add, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetColorWriteMask(nxt::ColorWriteMask::Red) + .SetAlphaBlend(dawn::BlendOperation::Add, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetColorBlend(dawn::BlendOperation::Add, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetColorWriteMask(dawn::ColorWriteMask::Red) .GetResult(); } // Success for empty builder { - nxt::BlendState state = AssertWillBeSuccess(device.CreateBlendStateBuilder()) + dawn::BlendState state = AssertWillBeSuccess(device.CreateBlendStateBuilder()) .GetResult(); } } @@ -40,7 +40,7 @@ TEST_F(BlendStateValidationTest, CreationSuccess) { TEST_F(BlendStateValidationTest, CreationDuplicates) { // Test failure when specifying blend enabled multiple times { - nxt::BlendState state = AssertWillBeError(device.CreateBlendStateBuilder()) + dawn::BlendState state = AssertWillBeError(device.CreateBlendStateBuilder()) .SetBlendEnabled(true) .SetBlendEnabled(false) .GetResult(); @@ -48,25 +48,25 @@ TEST_F(BlendStateValidationTest, CreationDuplicates) { // Test failure when specifying alpha blend multiple times { - nxt::BlendState state = AssertWillBeError(device.CreateBlendStateBuilder()) - .SetAlphaBlend(nxt::BlendOperation::Add, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetAlphaBlend(nxt::BlendOperation::Add, nxt::BlendFactor::Zero, nxt::BlendFactor::Zero) + dawn::BlendState state = AssertWillBeError(device.CreateBlendStateBuilder()) + .SetAlphaBlend(dawn::BlendOperation::Add, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetAlphaBlend(dawn::BlendOperation::Add, dawn::BlendFactor::Zero, dawn::BlendFactor::Zero) .GetResult(); } // Test failure when specifying color blend multiple times { - nxt::BlendState state = AssertWillBeError(device.CreateBlendStateBuilder()) - .SetColorBlend(nxt::BlendOperation::Add, nxt::BlendFactor::One, nxt::BlendFactor::One) - .SetColorBlend(nxt::BlendOperation::Add, nxt::BlendFactor::Zero, nxt::BlendFactor::Zero) + dawn::BlendState state = AssertWillBeError(device.CreateBlendStateBuilder()) + .SetColorBlend(dawn::BlendOperation::Add, dawn::BlendFactor::One, dawn::BlendFactor::One) + .SetColorBlend(dawn::BlendOperation::Add, dawn::BlendFactor::Zero, dawn::BlendFactor::Zero) .GetResult(); } // Test failure when specifying color write mask multiple times { - nxt::BlendState state = AssertWillBeError(device.CreateBlendStateBuilder()) - .SetColorWriteMask(nxt::ColorWriteMask::Red) - .SetColorWriteMask(nxt::ColorWriteMask::Green) + dawn::BlendState state = AssertWillBeError(device.CreateBlendStateBuilder()) + .SetColorWriteMask(dawn::ColorWriteMask::Red) + .SetColorWriteMask(dawn::ColorWriteMask::Green) .GetResult(); } diff --git a/src/tests/unittests/validation/BufferValidationTests.cpp b/src/tests/unittests/validation/BufferValidationTests.cpp index 6e112c04f1..1a1b78e654 100644 --- a/src/tests/unittests/validation/BufferValidationTests.cpp +++ b/src/tests/unittests/validation/BufferValidationTests.cpp @@ -42,26 +42,26 @@ static void ToMockBufferMapWriteCallback(nxtBufferMapAsyncStatus status, void* p class BufferValidationTest : public ValidationTest { protected: - nxt::Buffer CreateMapReadBuffer(uint32_t size) { + dawn::Buffer CreateMapReadBuffer(uint32_t size) { return device.CreateBufferBuilder() .SetSize(size) - .SetAllowedUsage(nxt::BufferUsageBit::MapRead) + .SetAllowedUsage(dawn::BufferUsageBit::MapRead) .GetResult(); } - nxt::Buffer CreateMapWriteBuffer(uint32_t size) { + dawn::Buffer CreateMapWriteBuffer(uint32_t size) { return device.CreateBufferBuilder() .SetSize(size) - .SetAllowedUsage(nxt::BufferUsageBit::MapWrite) + .SetAllowedUsage(dawn::BufferUsageBit::MapWrite) .GetResult(); } - nxt::Buffer CreateSetSubDataBuffer(uint32_t size) { + dawn::Buffer CreateSetSubDataBuffer(uint32_t size) { return device.CreateBufferBuilder() .SetSize(size) - .SetAllowedUsage(nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::TransferDst) .GetResult(); } - nxt::Queue queue; + dawn::Queue queue; private: void SetUp() override { @@ -84,9 +84,9 @@ class BufferValidationTest : public ValidationTest { TEST_F(BufferValidationTest, CreationSuccess) { // Success { - nxt::Buffer buf = AssertWillBeSuccess(device.CreateBufferBuilder()) + dawn::Buffer buf = AssertWillBeSuccess(device.CreateBufferBuilder()) .SetSize(4) - .SetAllowedUsage(nxt::BufferUsageBit::Uniform) + .SetAllowedUsage(dawn::BufferUsageBit::Uniform) .GetResult(); } } @@ -95,19 +95,19 @@ TEST_F(BufferValidationTest, CreationSuccess) { TEST_F(BufferValidationTest, CreationDuplicates) { // When size is specified multiple times { - nxt::Buffer buf = AssertWillBeError(device.CreateBufferBuilder()) + dawn::Buffer buf = AssertWillBeError(device.CreateBufferBuilder()) .SetSize(4) .SetSize(3) - .SetAllowedUsage(nxt::BufferUsageBit::Uniform) + .SetAllowedUsage(dawn::BufferUsageBit::Uniform) .GetResult(); } // When allowed usage is specified multiple times { - nxt::Buffer buf = AssertWillBeError(device.CreateBufferBuilder()) + dawn::Buffer buf = AssertWillBeError(device.CreateBufferBuilder()) .SetSize(4) - .SetAllowedUsage(nxt::BufferUsageBit::Vertex) - .SetAllowedUsage(nxt::BufferUsageBit::Uniform) + .SetAllowedUsage(dawn::BufferUsageBit::Vertex) + .SetAllowedUsage(dawn::BufferUsageBit::Uniform) .GetResult(); } } @@ -116,15 +116,15 @@ TEST_F(BufferValidationTest, CreationDuplicates) { TEST_F(BufferValidationTest, CreationMissingProperties) { // When allowed usage is missing { - nxt::Buffer buf = AssertWillBeError(device.CreateBufferBuilder()) + dawn::Buffer buf = AssertWillBeError(device.CreateBufferBuilder()) .SetSize(4) .GetResult(); } // When size is missing { - nxt::Buffer buf = AssertWillBeError(device.CreateBufferBuilder()) - .SetAllowedUsage(nxt::BufferUsageBit::Vertex) + dawn::Buffer buf = AssertWillBeError(device.CreateBufferBuilder()) + .SetAllowedUsage(dawn::BufferUsageBit::Vertex) .GetResult(); } } @@ -133,32 +133,32 @@ TEST_F(BufferValidationTest, CreationMissingProperties) { TEST_F(BufferValidationTest, CreationMapUsageRestrictions) { // MapRead with TransferDst is ok { - nxt::Buffer buf = AssertWillBeSuccess(device.CreateBufferBuilder(), "1") - .SetAllowedUsage(nxt::BufferUsageBit::MapRead | nxt::BufferUsageBit::TransferDst) + dawn::Buffer buf = AssertWillBeSuccess(device.CreateBufferBuilder(), "1") + .SetAllowedUsage(dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst) .SetSize(4) .GetResult(); } // MapRead with something else is an error { - nxt::Buffer buf = AssertWillBeError(device.CreateBufferBuilder(), "2") - .SetAllowedUsage(nxt::BufferUsageBit::MapRead | nxt::BufferUsageBit::Uniform) + dawn::Buffer buf = AssertWillBeError(device.CreateBufferBuilder(), "2") + .SetAllowedUsage(dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::Uniform) .SetSize(4) .GetResult(); } // MapWrite with TransferSrc is ok { - nxt::Buffer buf = AssertWillBeSuccess(device.CreateBufferBuilder(), "3") - .SetAllowedUsage(nxt::BufferUsageBit::MapWrite | nxt::BufferUsageBit::TransferSrc) + dawn::Buffer buf = AssertWillBeSuccess(device.CreateBufferBuilder(), "3") + .SetAllowedUsage(dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc) .SetSize(4) .GetResult(); } // MapWrite with something else is an error { - nxt::Buffer buf = AssertWillBeError(device.CreateBufferBuilder(), "4") - .SetAllowedUsage(nxt::BufferUsageBit::MapWrite | nxt::BufferUsageBit::Uniform) + dawn::Buffer buf = AssertWillBeError(device.CreateBufferBuilder(), "4") + .SetAllowedUsage(dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::Uniform) .SetSize(4) .GetResult(); } @@ -166,9 +166,9 @@ TEST_F(BufferValidationTest, CreationMapUsageRestrictions) { // Test the success case for mapping buffer for reading TEST_F(BufferValidationTest, MapReadSuccess) { - nxt::Buffer buf = CreateMapReadBuffer(4); + dawn::Buffer buf = CreateMapReadBuffer(4); - nxt::CallbackUserdata userdata = 40598; + dawn::CallbackUserdata userdata = 40598; buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata); EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) @@ -180,9 +180,9 @@ TEST_F(BufferValidationTest, MapReadSuccess) { // Test the success case for mapping buffer for writing TEST_F(BufferValidationTest, MapWriteSuccess) { - nxt::Buffer buf = CreateMapWriteBuffer(4); + dawn::Buffer buf = CreateMapWriteBuffer(4); - nxt::CallbackUserdata userdata = 40598; + dawn::CallbackUserdata userdata = 40598; buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata); EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) @@ -194,9 +194,9 @@ TEST_F(BufferValidationTest, MapWriteSuccess) { // Test map reading out of range causes an error TEST_F(BufferValidationTest, MapReadOutOfRange) { - nxt::Buffer buf = CreateMapReadBuffer(4); + dawn::Buffer buf = CreateMapReadBuffer(4); - nxt::CallbackUserdata userdata = 40599; + dawn::CallbackUserdata userdata = 40599; EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) .Times(1); @@ -205,9 +205,9 @@ TEST_F(BufferValidationTest, MapReadOutOfRange) { // Test map writing out of range causes an error TEST_F(BufferValidationTest, MapWriteOutOfRange) { - nxt::Buffer buf = CreateMapWriteBuffer(4); + dawn::Buffer buf = CreateMapWriteBuffer(4); - nxt::CallbackUserdata userdata = 40599; + dawn::CallbackUserdata userdata = 40599; EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) .Times(1); @@ -216,12 +216,12 @@ TEST_F(BufferValidationTest, MapWriteOutOfRange) { // Test map reading a buffer with wrong current usage TEST_F(BufferValidationTest, MapReadWrongUsage) { - nxt::Buffer buf = device.CreateBufferBuilder() + dawn::Buffer buf = device.CreateBufferBuilder() .SetSize(4) - .SetAllowedUsage(nxt::BufferUsageBit::TransferDst) + .SetAllowedUsage(dawn::BufferUsageBit::TransferDst) .GetResult(); - nxt::CallbackUserdata userdata = 40600; + dawn::CallbackUserdata userdata = 40600; EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) .Times(1); @@ -230,12 +230,12 @@ TEST_F(BufferValidationTest, MapReadWrongUsage) { // Test map writing a buffer with wrong current usage TEST_F(BufferValidationTest, MapWriteWrongUsage) { - nxt::Buffer buf = device.CreateBufferBuilder() + dawn::Buffer buf = device.CreateBufferBuilder() .SetSize(4) - .SetAllowedUsage(nxt::BufferUsageBit::TransferSrc) + .SetAllowedUsage(dawn::BufferUsageBit::TransferSrc) .GetResult(); - nxt::CallbackUserdata userdata = 40600; + dawn::CallbackUserdata userdata = 40600; EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata)) .Times(1); @@ -244,14 +244,14 @@ TEST_F(BufferValidationTest, MapWriteWrongUsage) { // Test map reading a buffer that is already mapped TEST_F(BufferValidationTest, MapReadAlreadyMapped) { - nxt::Buffer buf = CreateMapReadBuffer(4); + dawn::Buffer buf = CreateMapReadBuffer(4); - nxt::CallbackUserdata userdata1 = 40601; + dawn::CallbackUserdata userdata1 = 40601; buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata1); EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata1)) .Times(1); - nxt::CallbackUserdata userdata2 = 40602; + dawn::CallbackUserdata userdata2 = 40602; EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata2)) .Times(1); ASSERT_DEVICE_ERROR(buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata2)); @@ -261,14 +261,14 @@ TEST_F(BufferValidationTest, MapReadAlreadyMapped) { // Test map writing a buffer that is already mapped TEST_F(BufferValidationTest, MapWriteAlreadyMapped) { - nxt::Buffer buf = CreateMapWriteBuffer(4); + dawn::Buffer buf = CreateMapWriteBuffer(4); - nxt::CallbackUserdata userdata1 = 40601; + dawn::CallbackUserdata userdata1 = 40601; buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata1); EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata1)) .Times(1); - nxt::CallbackUserdata userdata2 = 40602; + dawn::CallbackUserdata userdata2 = 40602; EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata2)) .Times(1); ASSERT_DEVICE_ERROR(buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata2)); @@ -279,9 +279,9 @@ TEST_F(BufferValidationTest, MapWriteAlreadyMapped) { // Test unmapping before having the result gives UNKNOWN - for reading TEST_F(BufferValidationTest, MapReadUnmapBeforeResult) { - nxt::Buffer buf = CreateMapReadBuffer(4); + dawn::Buffer buf = CreateMapReadBuffer(4); - nxt::CallbackUserdata userdata = 40603; + dawn::CallbackUserdata userdata = 40603; buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata); EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) @@ -295,9 +295,9 @@ TEST_F(BufferValidationTest, MapReadUnmapBeforeResult) { // Test unmapping before having the result gives UNKNOWN - for writing TEST_F(BufferValidationTest, MapWriteUnmapBeforeResult) { - nxt::Buffer buf = CreateMapWriteBuffer(4); + dawn::Buffer buf = CreateMapWriteBuffer(4); - nxt::CallbackUserdata userdata = 40603; + dawn::CallbackUserdata userdata = 40603; buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata); EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) @@ -314,9 +314,9 @@ TEST_F(BufferValidationTest, MapWriteUnmapBeforeResult) { // when its external ref count reaches 0. TEST_F(BufferValidationTest, DISABLED_MapReadDestroyBeforeResult) { { - nxt::Buffer buf = CreateMapReadBuffer(4); + dawn::Buffer buf = CreateMapReadBuffer(4); - nxt::CallbackUserdata userdata = 40604; + dawn::CallbackUserdata userdata = 40604; buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata); EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) @@ -333,9 +333,9 @@ TEST_F(BufferValidationTest, DISABLED_MapReadDestroyBeforeResult) { // when its external ref count reaches 0. TEST_F(BufferValidationTest, DISABLED_MapWriteDestroyBeforeResult) { { - nxt::Buffer buf = CreateMapWriteBuffer(4); + dawn::Buffer buf = CreateMapWriteBuffer(4); - nxt::CallbackUserdata userdata = 40604; + dawn::CallbackUserdata userdata = 40604; buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata); EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) @@ -350,9 +350,9 @@ TEST_F(BufferValidationTest, DISABLED_MapWriteDestroyBeforeResult) { // When a MapRead is cancelled with Unmap it might still be in flight, test doing a new request // works as expected and we don't get the cancelled request's data. TEST_F(BufferValidationTest, MapReadUnmapBeforeResultThenMapAgain) { - nxt::Buffer buf = CreateMapReadBuffer(4); + dawn::Buffer buf = CreateMapReadBuffer(4); - nxt::CallbackUserdata userdata = 40605; + dawn::CallbackUserdata userdata = 40605; buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata); EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) @@ -372,9 +372,9 @@ TEST_F(BufferValidationTest, MapReadUnmapBeforeResultThenMapAgain) { // When a MapWrite is cancelled with Unmap it might still be in flight, test doing a new request // works as expected and we don't get the cancelled request's data. TEST_F(BufferValidationTest, MapWriteUnmapBeforeResultThenMapAgain) { - nxt::Buffer buf = CreateMapWriteBuffer(4); + dawn::Buffer buf = CreateMapWriteBuffer(4); - nxt::CallbackUserdata userdata = 40605; + dawn::CallbackUserdata userdata = 40605; buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata); EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_UNKNOWN, nullptr, userdata)) @@ -392,9 +392,9 @@ TEST_F(BufferValidationTest, MapWriteUnmapBeforeResultThenMapAgain) { // Test that the MapReadCallback isn't fired twice when unmap() is called inside the callback TEST_F(BufferValidationTest, UnmapInsideMapReadCallback) { - nxt::Buffer buf = CreateMapReadBuffer(4); + dawn::Buffer buf = CreateMapReadBuffer(4); - nxt::CallbackUserdata userdata = 40678; + dawn::CallbackUserdata userdata = 40678; buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata); EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) @@ -407,9 +407,9 @@ TEST_F(BufferValidationTest, UnmapInsideMapReadCallback) { // Test that the MapWriteCallback isn't fired twice when unmap() is called inside the callback TEST_F(BufferValidationTest, UnmapInsideMapWriteCallback) { - nxt::Buffer buf = CreateMapWriteBuffer(4); + dawn::Buffer buf = CreateMapWriteBuffer(4); - nxt::CallbackUserdata userdata = 40678; + dawn::CallbackUserdata userdata = 40678; buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata); EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) @@ -422,14 +422,14 @@ TEST_F(BufferValidationTest, UnmapInsideMapWriteCallback) { // Test that the MapReadCallback isn't fired twice the buffer external refcount reaches 0 in the callback TEST_F(BufferValidationTest, DestroyInsideMapReadCallback) { - nxt::Buffer buf = CreateMapReadBuffer(4); + dawn::Buffer buf = CreateMapReadBuffer(4); - nxt::CallbackUserdata userdata = 40679; + dawn::CallbackUserdata userdata = 40679; buf.MapReadAsync(0, 4, ToMockBufferMapReadCallback, userdata); EXPECT_CALL(*mockBufferMapReadCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) .WillOnce(InvokeWithoutArgs([&]() { - buf = nxt::Buffer(); + buf = dawn::Buffer(); })); queue.Submit(0, nullptr); @@ -437,14 +437,14 @@ TEST_F(BufferValidationTest, DestroyInsideMapReadCallback) { // Test that the MapWriteCallback isn't fired twice the buffer external refcount reaches 0 in the callback TEST_F(BufferValidationTest, DestroyInsideMapWriteCallback) { - nxt::Buffer buf = CreateMapWriteBuffer(4); + dawn::Buffer buf = CreateMapWriteBuffer(4); - nxt::CallbackUserdata userdata = 40679; + dawn::CallbackUserdata userdata = 40679; buf.MapWriteAsync(0, 4, ToMockBufferMapWriteCallback, userdata); EXPECT_CALL(*mockBufferMapWriteCallback, Call(NXT_BUFFER_MAP_ASYNC_STATUS_SUCCESS, Ne(nullptr), userdata)) .WillOnce(InvokeWithoutArgs([&]() { - buf = nxt::Buffer(); + buf = dawn::Buffer(); })); queue.Submit(0, nullptr); @@ -452,7 +452,7 @@ TEST_F(BufferValidationTest, DestroyInsideMapWriteCallback) { // Test the success case for Buffer::SetSubData TEST_F(BufferValidationTest, SetSubDataSuccess) { - nxt::Buffer buf = CreateSetSubDataBuffer(1); + dawn::Buffer buf = CreateSetSubDataBuffer(1); uint8_t foo = 0; buf.SetSubData(0, sizeof(foo), &foo); @@ -460,7 +460,7 @@ TEST_F(BufferValidationTest, SetSubDataSuccess) { // Test error case for SetSubData out of bounds TEST_F(BufferValidationTest, SetSubDataOutOfBounds) { - nxt::Buffer buf = CreateSetSubDataBuffer(1); + dawn::Buffer buf = CreateSetSubDataBuffer(1); uint8_t foo = 0; ASSERT_DEVICE_ERROR(buf.SetSubData(0, 2, &foo)); @@ -468,9 +468,9 @@ TEST_F(BufferValidationTest, SetSubDataOutOfBounds) { // Test error case for SetSubData with the wrong usage TEST_F(BufferValidationTest, SetSubDataWrongUsage) { - nxt::Buffer buf = device.CreateBufferBuilder() + dawn::Buffer buf = device.CreateBufferBuilder() .SetSize(1) - .SetAllowedUsage(nxt::BufferUsageBit::Vertex) + .SetAllowedUsage(dawn::BufferUsageBit::Vertex) .GetResult(); uint8_t foo = 0; diff --git a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp index d36a757791..8ae1d46f43 100644 --- a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp +++ b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp @@ -18,18 +18,18 @@ class CopyCommandTest : public ValidationTest { protected: - nxt::Buffer CreateFrozenBuffer(uint32_t size, nxt::BufferUsageBit usage) { - nxt::Buffer buf = AssertWillBeSuccess(device.CreateBufferBuilder()) + dawn::Buffer CreateFrozenBuffer(uint32_t size, dawn::BufferUsageBit usage) { + dawn::Buffer buf = AssertWillBeSuccess(device.CreateBufferBuilder()) .SetSize(size) .SetAllowedUsage(usage) .GetResult(); return buf; } - nxt::Texture Create2DTexture(uint32_t width, uint32_t height, uint32_t levels, - nxt::TextureFormat format, nxt::TextureUsageBit usage) { - nxt::Texture tex = AssertWillBeSuccess(device.CreateTextureBuilder()) - .SetDimension(nxt::TextureDimension::e2D) + dawn::Texture Create2DTexture(uint32_t width, uint32_t height, uint32_t levels, + dawn::TextureFormat format, dawn::TextureUsageBit usage) { + dawn::Texture tex = AssertWillBeSuccess(device.CreateTextureBuilder()) + .SetDimension(dawn::TextureDimension::e2D) .SetExtent(width, height, 1) .SetFormat(format) .SetMipLevels(levels) @@ -51,12 +51,12 @@ class CopyCommandTest_B2B : public CopyCommandTest { // Test a successfull B2B copy TEST_F(CopyCommandTest_B2B, Success) { - nxt::Buffer source = CreateFrozenBuffer(16, nxt::BufferUsageBit::TransferSrc); - nxt::Buffer destination = CreateFrozenBuffer(16, nxt::BufferUsageBit::TransferDst); + dawn::Buffer source = CreateFrozenBuffer(16, dawn::BufferUsageBit::TransferSrc); + dawn::Buffer destination = CreateFrozenBuffer(16, dawn::BufferUsageBit::TransferDst); // Copy different copies, including some that touch the OOB condition { - nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) .CopyBufferToBuffer(source, 0, destination, 0, 16) .CopyBufferToBuffer(source, 8, destination, 0, 8) .CopyBufferToBuffer(source, 0, destination, 8, 8) @@ -65,7 +65,7 @@ TEST_F(CopyCommandTest_B2B, Success) { // Empty copies are valid { - nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) .CopyBufferToBuffer(source, 0, destination, 0, 0) .CopyBufferToBuffer(source, 0, destination, 16, 0) .CopyBufferToBuffer(source, 16, destination, 0, 0) @@ -75,19 +75,19 @@ TEST_F(CopyCommandTest_B2B, Success) { // Test B2B copies with OOB TEST_F(CopyCommandTest_B2B, OutOfBounds) { - nxt::Buffer source = CreateFrozenBuffer(16, nxt::BufferUsageBit::TransferSrc); - nxt::Buffer destination = CreateFrozenBuffer(16, nxt::BufferUsageBit::TransferDst); + dawn::Buffer source = CreateFrozenBuffer(16, dawn::BufferUsageBit::TransferSrc); + dawn::Buffer destination = CreateFrozenBuffer(16, dawn::BufferUsageBit::TransferDst); // OOB on the source { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToBuffer(source, 8, destination, 0, 12) .GetResult(); } // OOB on the destination { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToBuffer(source, 0, destination, 8, 12) .GetResult(); } @@ -95,20 +95,20 @@ TEST_F(CopyCommandTest_B2B, OutOfBounds) { // Test B2B copies with incorrect buffer usage TEST_F(CopyCommandTest_B2B, BadUsage) { - nxt::Buffer source = CreateFrozenBuffer(16, nxt::BufferUsageBit::TransferSrc); - nxt::Buffer destination = CreateFrozenBuffer(16, nxt::BufferUsageBit::TransferDst); - nxt::Buffer vertex = CreateFrozenBuffer(16, nxt::BufferUsageBit::Vertex); + dawn::Buffer source = CreateFrozenBuffer(16, dawn::BufferUsageBit::TransferSrc); + dawn::Buffer destination = CreateFrozenBuffer(16, dawn::BufferUsageBit::TransferDst); + dawn::Buffer vertex = CreateFrozenBuffer(16, dawn::BufferUsageBit::Vertex); // Source with incorrect usage { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToBuffer(vertex, 0, destination, 0, 16) .GetResult(); } // Destination with incorrect usage { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToBuffer(source, 0, vertex, 0, 16) .GetResult(); } @@ -120,13 +120,13 @@ class CopyCommandTest_B2T : public CopyCommandTest { // Test a successfull B2T copy TEST_F(CopyCommandTest_B2T, Success) { uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1); - nxt::Buffer source = CreateFrozenBuffer(bufferSize, nxt::BufferUsageBit::TransferSrc); - nxt::Texture destination = Create2DTexture(16, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::TransferDst); + dawn::Buffer source = CreateFrozenBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc); + dawn::Texture destination = Create2DTexture(16, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::TransferDst); // Different copies, including some that touch the OOB condition { - nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) // Copy 4x4 block in corner of first mip. .CopyBufferToTexture(source, 0, 256, destination, 0, 0, 0, 4, 4, 1, 0) // Copy 4x4 block in opposite corner of first mip. @@ -140,7 +140,7 @@ TEST_F(CopyCommandTest_B2T, Success) { // Copies with a 256-byte aligned row pitch but unaligned texture region { - nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) // Unaligned region .CopyBufferToTexture(source, 0, 256, destination, 0, 0, 0, 3, 4, 1, 0) // Unaligned region with texture offset @@ -152,7 +152,7 @@ TEST_F(CopyCommandTest_B2T, Success) { // Empty copies are valid { - nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) // An empty copy .CopyBufferToTexture(source, 0, 0, destination, 0, 0, 0, 0, 0, 1, 0) // An empty copy touching the end of the buffer @@ -166,27 +166,27 @@ TEST_F(CopyCommandTest_B2T, Success) { // Test OOB conditions on the buffer TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) { uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1); - nxt::Buffer source = CreateFrozenBuffer(bufferSize, nxt::BufferUsageBit::TransferSrc); - nxt::Texture destination = Create2DTexture(16, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::TransferDst); + dawn::Buffer source = CreateFrozenBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc); + dawn::Texture destination = Create2DTexture(16, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::TransferDst); // OOB on the buffer because we copy too many pixels { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, 0, 256, destination, 0, 0, 0, 4, 5, 1, 0) .GetResult(); } // OOB on the buffer because of the offset { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, 4, 256, destination, 0, 0, 0, 4, 4, 1, 0) .GetResult(); } // OOB on the buffer because (row pitch * (height - 1) + width) * depth overflows { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, 0, 512, destination, 0, 0, 0, 4, 3, 1, 0) .GetResult(); } @@ -196,8 +196,8 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) { { uint32_t sourceBufferSize = BufferSizeForTextureCopy(7, 3, 1); ASSERT_TRUE(256 * 3 > sourceBufferSize) << "row pitch * height should overflow buffer"; - nxt::Buffer sourceBuffer = CreateFrozenBuffer(sourceBufferSize, nxt::BufferUsageBit::TransferSrc); - nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) + dawn::Buffer sourceBuffer = CreateFrozenBuffer(sourceBufferSize, dawn::BufferUsageBit::TransferSrc); + dawn::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(sourceBuffer, 0, 256, destination, 0, 0, 0, 7, 3, 1, 0) .GetResult(); } @@ -206,34 +206,34 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) { // Test OOB conditions on the texture TEST_F(CopyCommandTest_B2T, OutOfBoundsOnTexture) { uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1); - nxt::Buffer source = CreateFrozenBuffer(bufferSize, nxt::BufferUsageBit::TransferSrc); - nxt::Texture destination = Create2DTexture(16, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::TransferDst); + dawn::Buffer source = CreateFrozenBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc); + dawn::Texture destination = Create2DTexture(16, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::TransferDst); // OOB on the texture because x + width overflows { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, 0, 256, destination, 13, 12, 0, 4, 4, 1, 0) .GetResult(); } // OOB on the texture because y + width overflows { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, 0, 256, destination, 12, 13, 0, 4, 4, 1, 0) .GetResult(); } // OOB on the texture because we overflow a non-zero mip { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, 0, 256, destination, 1, 0, 0, 4, 4, 1, 2) .GetResult(); } // OOB on the texture even on an empty copy when we copy to a non-existent mip. { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, 0, 0, destination, 0, 0, 0, 0, 0, 1, 5) .GetResult(); } @@ -241,20 +241,20 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnTexture) { // Test that we force Z=0 and Depth=1 on copies to 2D textures TEST_F(CopyCommandTest_B2T, ZDepthConstraintFor2DTextures) { - nxt::Buffer source = CreateFrozenBuffer(16 * 4, nxt::BufferUsageBit::TransferSrc); - nxt::Texture destination = Create2DTexture(16, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::TransferDst); + dawn::Buffer source = CreateFrozenBuffer(16 * 4, dawn::BufferUsageBit::TransferSrc); + dawn::Texture destination = Create2DTexture(16, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::TransferDst); // Z=1 on an empty copy still errors { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, 0, 0, destination, 0, 0, 1, 0, 0, 1, 0) .GetResult(); } // Depth=0 on an empty copy still errors { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, 0, 0, destination, 0, 0, 0, 0, 0, 0, 0) .GetResult(); } @@ -262,23 +262,23 @@ TEST_F(CopyCommandTest_B2T, ZDepthConstraintFor2DTextures) { // Test B2T copies with incorrect buffer usage TEST_F(CopyCommandTest_B2T, IncorrectUsage) { - nxt::Buffer source = CreateFrozenBuffer(16 * 4, nxt::BufferUsageBit::TransferSrc); - nxt::Buffer vertex = CreateFrozenBuffer(16 * 4, nxt::BufferUsageBit::Vertex); - nxt::Texture destination = Create2DTexture(16, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::TransferDst); - nxt::Texture sampled = Create2DTexture(16, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::Sampled); + dawn::Buffer source = CreateFrozenBuffer(16 * 4, dawn::BufferUsageBit::TransferSrc); + dawn::Buffer vertex = CreateFrozenBuffer(16 * 4, dawn::BufferUsageBit::Vertex); + dawn::Texture destination = Create2DTexture(16, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::TransferDst); + dawn::Texture sampled = Create2DTexture(16, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::Sampled); // Incorrect source usage { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(vertex, 0, 256, destination, 0, 0, 0, 4, 4, 1, 0) .GetResult(); } // Incorrect destination usage { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, 0, 256, sampled, 0, 0, 0, 4, 4, 1, 0) .GetResult(); } @@ -286,27 +286,27 @@ TEST_F(CopyCommandTest_B2T, IncorrectUsage) { TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) { uint32_t bufferSize = BufferSizeForTextureCopy(128, 16, 1); - nxt::Buffer source = CreateFrozenBuffer(bufferSize, nxt::BufferUsageBit::TransferSrc); - nxt::Texture destination = Create2DTexture(128, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::TransferDst); + dawn::Buffer source = CreateFrozenBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc); + dawn::Texture destination = Create2DTexture(128, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::TransferDst); // Default row pitch is not 256-byte aligned { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, 0, 0, destination, 0, 0, 0, 3, 4, 1, 0) .GetResult(); } // Row pitch is not 256-byte aligned { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, 0, 128, destination, 0, 0, 0, 4, 4, 1, 0) .GetResult(); } // Row pitch is less than width * bytesPerPixel { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, 0, 256, destination, 0, 0, 0, 65, 1, 1, 0) .GetResult(); } @@ -315,29 +315,29 @@ TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) { // Test B2T copies with incorrect buffer offset usage TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) { uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1); - nxt::Buffer source = CreateFrozenBuffer(bufferSize, nxt::BufferUsageBit::TransferSrc); - nxt::Texture destination = Create2DTexture(16, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::TransferDst); + dawn::Buffer source = CreateFrozenBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc); + dawn::Texture destination = Create2DTexture(16, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::TransferDst); // Correct usage { - nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, bufferSize - 4, 256, destination, 0, 0, 0, 1, 1, 1, 0) .GetResult(); } // Incorrect usages { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, bufferSize - 5, 256, destination, 0, 0, 0, 1, 1, 1, 0) .GetResult(); } { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, bufferSize - 6, 256, destination, 0, 0, 0, 1, 1, 1, 0) .GetResult(); } { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyBufferToTexture(source, bufferSize - 7, 256, destination, 0, 0, 0, 1, 1, 1, 0) .GetResult(); } @@ -349,13 +349,13 @@ class CopyCommandTest_T2B : public CopyCommandTest { // Test a successfull T2B copy TEST_F(CopyCommandTest_T2B, Success) { uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1); - nxt::Texture source = Create2DTexture(16, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::TransferSrc); - nxt::Buffer destination = CreateFrozenBuffer(bufferSize, nxt::BufferUsageBit::TransferDst); + dawn::Texture source = Create2DTexture(16, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::TransferSrc); + dawn::Buffer destination = CreateFrozenBuffer(bufferSize, dawn::BufferUsageBit::TransferDst); // Different copies, including some that touch the OOB condition { - nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) // Copy from 4x4 block in corner of first mip. .CopyTextureToBuffer(source, 0, 0, 0, 4, 4, 1, 0, destination, 0, 256) // Copy from 4x4 block in opposite corner of first mip. @@ -369,7 +369,7 @@ TEST_F(CopyCommandTest_T2B, Success) { // Copies with a 256-byte aligned row pitch but unaligned texture region { - nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) // Unaligned region .CopyTextureToBuffer(source, 0, 0, 0, 3, 4, 1, 0, destination, 0, 256) // Unaligned region with texture offset @@ -381,7 +381,7 @@ TEST_F(CopyCommandTest_T2B, Success) { // Empty copies are valid { - nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) // An empty copy .CopyTextureToBuffer(source, 0, 0, 0, 0, 0, 1, 0, destination, 0, 0) // An empty copy touching the end of the buffer @@ -395,34 +395,34 @@ TEST_F(CopyCommandTest_T2B, Success) { // Test OOB conditions on the texture TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) { uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1); - nxt::Texture source = Create2DTexture(16, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::TransferSrc); - nxt::Buffer destination = CreateFrozenBuffer(bufferSize, nxt::BufferUsageBit::TransferDst); + dawn::Texture source = Create2DTexture(16, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::TransferSrc); + dawn::Buffer destination = CreateFrozenBuffer(bufferSize, dawn::BufferUsageBit::TransferDst); // OOB on the texture because x + width overflows { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 13, 12, 0, 4, 4, 1, 0, destination, 0, 256) .GetResult(); } // OOB on the texture because y + width overflows { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 12, 13, 0, 4, 4, 1, 0, destination, 0, 256) .GetResult(); } // OOB on the texture because we overflow a non-zero mip { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 1, 0, 0, 4, 4, 1, 2, destination, 0, 256) .GetResult(); } // OOB on the texture even on an empty copy when we copy from a non-existent mip. { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 0, 0, 0, 1, 5, destination, 0, 0) .GetResult(); } @@ -431,27 +431,27 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) { // Test OOB conditions on the buffer TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) { uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1); - nxt::Texture source = Create2DTexture(16, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::TransferSrc); - nxt::Buffer destination = CreateFrozenBuffer(bufferSize, nxt::BufferUsageBit::TransferDst); + dawn::Texture source = Create2DTexture(16, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::TransferSrc); + dawn::Buffer destination = CreateFrozenBuffer(bufferSize, dawn::BufferUsageBit::TransferDst); // OOB on the buffer because we copy too many pixels { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 0, 4, 5, 1, 0, destination, 0, 256) .GetResult(); } // OOB on the buffer because of the offset { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 0, 4, 4, 1, 0, destination, 4, 256) .GetResult(); } // OOB on the buffer because (row pitch * (height - 1) + width) * depth overflows { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 0, 4, 3, 1, 0, destination, 0, 512) .GetResult(); } @@ -461,8 +461,8 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) { { uint32_t destinationBufferSize = BufferSizeForTextureCopy(7, 3, 1); ASSERT_TRUE(256 * 3 > destinationBufferSize) << "row pitch * height should overflow buffer"; - nxt::Buffer destinationBuffer = CreateFrozenBuffer(destinationBufferSize, nxt::BufferUsageBit::TransferDst); - nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) + dawn::Buffer destinationBuffer = CreateFrozenBuffer(destinationBufferSize, dawn::BufferUsageBit::TransferDst); + dawn::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 0, 7, 3, 1, 0, destinationBuffer, 0, 256) .GetResult(); } @@ -471,20 +471,20 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) { // Test that we force Z=0 and Depth=1 on copies from to 2D textures TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) { uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1); - nxt::Texture source = Create2DTexture(16, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::TransferSrc); - nxt::Buffer destination = CreateFrozenBuffer(bufferSize, nxt::BufferUsageBit::TransferDst); + dawn::Texture source = Create2DTexture(16, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::TransferSrc); + dawn::Buffer destination = CreateFrozenBuffer(bufferSize, dawn::BufferUsageBit::TransferDst); // Z=1 on an empty copy still errors { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 1, 0, 0, 1, 0, destination, 0, 0) .GetResult(); } // Depth=0 on an empty copy still errors { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 0, 0, 0, 0, 0, destination, 0, 0) .GetResult(); } @@ -493,23 +493,23 @@ TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) { // Test T2B copies with incorrect buffer usage TEST_F(CopyCommandTest_T2B, IncorrectUsage) { uint32_t bufferSize = BufferSizeForTextureCopy(4, 4, 1); - nxt::Texture source = Create2DTexture(16, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::TransferSrc); - nxt::Texture sampled = Create2DTexture(16, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::Sampled); - nxt::Buffer destination = CreateFrozenBuffer(bufferSize, nxt::BufferUsageBit::TransferDst); - nxt::Buffer vertex = CreateFrozenBuffer(bufferSize, nxt::BufferUsageBit::Vertex); + dawn::Texture source = Create2DTexture(16, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::TransferSrc); + dawn::Texture sampled = Create2DTexture(16, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::Sampled); + dawn::Buffer destination = CreateFrozenBuffer(bufferSize, dawn::BufferUsageBit::TransferDst); + dawn::Buffer vertex = CreateFrozenBuffer(bufferSize, dawn::BufferUsageBit::Vertex); // Incorrect source usage { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(sampled, 0, 0, 0, 4, 4, 1, 0, destination, 0, 256) .GetResult(); } // Incorrect destination usage { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 0, 4, 4, 1, 0, vertex, 0, 256) .GetResult(); } @@ -517,27 +517,27 @@ TEST_F(CopyCommandTest_T2B, IncorrectUsage) { TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) { uint32_t bufferSize = BufferSizeForTextureCopy(128, 16, 1); - nxt::Texture source = Create2DTexture(128, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::TransferDst); - nxt::Buffer destination = CreateFrozenBuffer(bufferSize, nxt::BufferUsageBit::TransferSrc); + dawn::Texture source = Create2DTexture(128, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::TransferDst); + dawn::Buffer destination = CreateFrozenBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc); // Default row pitch is not 256-byte aligned { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 0, 3, 4, 1, 0, destination, 0, 256) .GetResult(); } // Row pitch is not 256-byte aligned { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 0, 4, 4, 1, 0, destination, 0, 257) .GetResult(); } // Row pitch is less than width * bytesPerPixel { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 0, 65, 1, 1, 0, destination, 0, 256) .GetResult(); } @@ -546,29 +546,29 @@ TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) { // Test T2B copies with incorrect buffer offset usage TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) { uint32_t bufferSize = BufferSizeForTextureCopy(128, 16, 1); - nxt::Texture source = Create2DTexture(128, 16, 5, nxt::TextureFormat::R8G8B8A8Unorm, - nxt::TextureUsageBit::TransferSrc); - nxt::Buffer destination = CreateFrozenBuffer(bufferSize, nxt::BufferUsageBit::TransferDst); + dawn::Texture source = Create2DTexture(128, 16, 5, dawn::TextureFormat::R8G8B8A8Unorm, + dawn::TextureUsageBit::TransferSrc); + dawn::Buffer destination = CreateFrozenBuffer(bufferSize, dawn::BufferUsageBit::TransferDst); // Correct usage { - nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 0, 1, 1, 1, 0, destination, bufferSize - 4, 256) .GetResult(); } // Incorrect usages { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 0, 1, 1, 1, 0, destination, bufferSize - 5, 256) .GetResult(); } { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 0, 1, 1, 1, 0, destination, bufferSize - 6, 256) .GetResult(); } { - nxt::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) + dawn::CommandBuffer commands = AssertWillBeError(device.CreateCommandBufferBuilder()) .CopyTextureToBuffer(source, 0, 0, 0, 1, 1, 1, 0, destination, bufferSize - 7, 256) .GetResult(); } diff --git a/src/tests/unittests/validation/DepthStencilStateValidationTests.cpp b/src/tests/unittests/validation/DepthStencilStateValidationTests.cpp index d2f474dee8..858c2b4a2d 100644 --- a/src/tests/unittests/validation/DepthStencilStateValidationTests.cpp +++ b/src/tests/unittests/validation/DepthStencilStateValidationTests.cpp @@ -21,28 +21,28 @@ class DepthStencilStateValidationTest : public ValidationTest { TEST_F(DepthStencilStateValidationTest, CreationSuccess) { // Success for setting all properties { - nxt::DepthStencilState ds = AssertWillBeSuccess(device.CreateDepthStencilStateBuilder()) - .SetDepthCompareFunction(nxt::CompareFunction::Less) + dawn::DepthStencilState ds = AssertWillBeSuccess(device.CreateDepthStencilStateBuilder()) + .SetDepthCompareFunction(dawn::CompareFunction::Less) .SetDepthWriteEnabled(true) - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Greater, - nxt::StencilOperation::Keep, nxt::StencilOperation::Keep, nxt::StencilOperation::Replace) + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Greater, + dawn::StencilOperation::Keep, dawn::StencilOperation::Keep, dawn::StencilOperation::Replace) .SetStencilMask(0x0, 0x1) .GetResult(); } // Success for empty builder { - nxt::DepthStencilState ds = AssertWillBeSuccess(device.CreateDepthStencilStateBuilder()) + dawn::DepthStencilState ds = AssertWillBeSuccess(device.CreateDepthStencilStateBuilder()) .GetResult(); } // Test success when setting stencil function on separate faces { - nxt::DepthStencilState ds = AssertWillBeSuccess(device.CreateDepthStencilStateBuilder()) - .SetStencilFunction(nxt::Face::Front, nxt::CompareFunction::Less, - nxt::StencilOperation::Replace, nxt::StencilOperation::Replace, nxt::StencilOperation::Replace) - .SetStencilFunction(nxt::Face::Back, nxt::CompareFunction::Greater, - nxt::StencilOperation::Replace, nxt::StencilOperation::Replace, nxt::StencilOperation::Replace) + dawn::DepthStencilState ds = AssertWillBeSuccess(device.CreateDepthStencilStateBuilder()) + .SetStencilFunction(dawn::Face::Front, dawn::CompareFunction::Less, + dawn::StencilOperation::Replace, dawn::StencilOperation::Replace, dawn::StencilOperation::Replace) + .SetStencilFunction(dawn::Face::Back, dawn::CompareFunction::Greater, + dawn::StencilOperation::Replace, dawn::StencilOperation::Replace, dawn::StencilOperation::Replace) .GetResult(); } } @@ -51,7 +51,7 @@ TEST_F(DepthStencilStateValidationTest, CreationSuccess) { TEST_F(DepthStencilStateValidationTest, CreationDuplicates) { // Test failure when specifying depth write enabled multiple times { - nxt::DepthStencilState ds = AssertWillBeError(device.CreateDepthStencilStateBuilder()) + dawn::DepthStencilState ds = AssertWillBeError(device.CreateDepthStencilStateBuilder()) .SetDepthWriteEnabled(true) .SetDepthWriteEnabled(false) .GetResult(); @@ -59,15 +59,15 @@ TEST_F(DepthStencilStateValidationTest, CreationDuplicates) { // Test failure when specifying depth compare function multiple times { - nxt::DepthStencilState ds = AssertWillBeError(device.CreateDepthStencilStateBuilder()) - .SetDepthCompareFunction(nxt::CompareFunction::Less) - .SetDepthCompareFunction(nxt::CompareFunction::Greater) + dawn::DepthStencilState ds = AssertWillBeError(device.CreateDepthStencilStateBuilder()) + .SetDepthCompareFunction(dawn::CompareFunction::Less) + .SetDepthCompareFunction(dawn::CompareFunction::Greater) .GetResult(); } // Test failure when setting stencil mask multiple times { - nxt::DepthStencilState ds = AssertWillBeError(device.CreateDepthStencilStateBuilder()) + dawn::DepthStencilState ds = AssertWillBeError(device.CreateDepthStencilStateBuilder()) .SetStencilMask(0x00, 0x00) .SetStencilMask(0xff, 0xff) .GetResult(); @@ -75,21 +75,21 @@ TEST_F(DepthStencilStateValidationTest, CreationDuplicates) { // Test failure when directly setting stencil function on a face multiple times { - nxt::DepthStencilState ds = AssertWillBeError(device.CreateDepthStencilStateBuilder()) - .SetStencilFunction(nxt::Face::Back, nxt::CompareFunction::Less, - nxt::StencilOperation::Replace, nxt::StencilOperation::Replace, nxt::StencilOperation::Replace) - .SetStencilFunction(nxt::Face::Back, nxt::CompareFunction::Greater, - nxt::StencilOperation::Replace, nxt::StencilOperation::Replace, nxt::StencilOperation::Replace) + dawn::DepthStencilState ds = AssertWillBeError(device.CreateDepthStencilStateBuilder()) + .SetStencilFunction(dawn::Face::Back, dawn::CompareFunction::Less, + dawn::StencilOperation::Replace, dawn::StencilOperation::Replace, dawn::StencilOperation::Replace) + .SetStencilFunction(dawn::Face::Back, dawn::CompareFunction::Greater, + dawn::StencilOperation::Replace, dawn::StencilOperation::Replace, dawn::StencilOperation::Replace) .GetResult(); } // Test failure when indirectly setting stencil function on a face multiple times { - nxt::DepthStencilState ds = AssertWillBeError(device.CreateDepthStencilStateBuilder()) - .SetStencilFunction(nxt::Face::Both, nxt::CompareFunction::Less, - nxt::StencilOperation::Replace, nxt::StencilOperation::Replace, nxt::StencilOperation::Replace) - .SetStencilFunction(nxt::Face::Back, nxt::CompareFunction::Greater, - nxt::StencilOperation::Replace, nxt::StencilOperation::Replace, nxt::StencilOperation::Replace) + dawn::DepthStencilState ds = AssertWillBeError(device.CreateDepthStencilStateBuilder()) + .SetStencilFunction(dawn::Face::Both, dawn::CompareFunction::Less, + dawn::StencilOperation::Replace, dawn::StencilOperation::Replace, dawn::StencilOperation::Replace) + .SetStencilFunction(dawn::Face::Back, dawn::CompareFunction::Greater, + dawn::StencilOperation::Replace, dawn::StencilOperation::Replace, dawn::StencilOperation::Replace) .GetResult(); } } diff --git a/src/tests/unittests/validation/InputStateValidationTests.cpp b/src/tests/unittests/validation/InputStateValidationTests.cpp index 0a4eaf6f8d..08a54f7d15 100644 --- a/src/tests/unittests/validation/InputStateValidationTests.cpp +++ b/src/tests/unittests/validation/InputStateValidationTests.cpp @@ -22,24 +22,24 @@ static constexpr uint32_t kMaxVertexInputs = 16u; class InputStateTest : public ValidationTest { protected: - nxt::RenderPipeline CreatePipeline(bool success, const nxt::InputState& inputState, std::string vertexSource) { + dawn::RenderPipeline CreatePipeline(bool success, const dawn::InputState& inputState, std::string vertexSource) { DummyRenderPass renderpassData = CreateDummyRenderPass(); - nxt::ShaderModuleBuilder vsModuleBuilder = AssertWillBeSuccess(device.CreateShaderModuleBuilder()); - utils::FillShaderModuleBuilder(vsModuleBuilder, nxt::ShaderStage::Vertex, vertexSource.c_str()); - nxt::ShaderModule vsModule = vsModuleBuilder.GetResult(); + dawn::ShaderModuleBuilder vsModuleBuilder = AssertWillBeSuccess(device.CreateShaderModuleBuilder()); + utils::FillShaderModuleBuilder(vsModuleBuilder, dawn::ShaderStage::Vertex, vertexSource.c_str()); + dawn::ShaderModule vsModule = vsModuleBuilder.GetResult(); - nxt::ShaderModuleBuilder fsModuleBuilder = AssertWillBeSuccess(device.CreateShaderModuleBuilder()); - utils::FillShaderModuleBuilder(fsModuleBuilder, nxt::ShaderStage::Fragment, R"( + dawn::ShaderModuleBuilder fsModuleBuilder = AssertWillBeSuccess(device.CreateShaderModuleBuilder()); + utils::FillShaderModuleBuilder(fsModuleBuilder, dawn::ShaderStage::Fragment, R"( #version 450 layout(location = 0) out vec4 fragColor; void main() { fragColor = vec4(1.0, 0.0, 0.0, 1.0); } )"); - nxt::ShaderModule fsModule = fsModuleBuilder.GetResult(); + dawn::ShaderModule fsModule = fsModuleBuilder.GetResult(); - nxt::RenderPipelineBuilder builder; + dawn::RenderPipelineBuilder builder; if (success) { builder = AssertWillBeSuccess(device.CreateRenderPipelineBuilder()); } else { @@ -47,8 +47,8 @@ class InputStateTest : public ValidationTest { } return builder.SetColorAttachmentFormat(0, renderpassData.attachmentFormat) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .SetInputState(inputState) .GetResult(); } @@ -56,7 +56,7 @@ class InputStateTest : public ValidationTest { // Check an empty input state is valid TEST_F(InputStateTest, EmptyIsOk) { - nxt::InputState state = AssertWillBeSuccess(device.CreateInputStateBuilder()) + dawn::InputState state = AssertWillBeSuccess(device.CreateInputStateBuilder()) .GetResult(); CreatePipeline(true, state, R"( @@ -69,10 +69,10 @@ TEST_F(InputStateTest, EmptyIsOk) { // Check validation that pipeline vertex inputs are backed by attributes in the input state TEST_F(InputStateTest, PipelineCompatibility) { - nxt::InputState state = AssertWillBeSuccess(device.CreateInputStateBuilder()) - .SetInput(0, 2 * sizeof(float), nxt::InputStepMode::Vertex) - .SetAttribute(0, 0, nxt::VertexFormat::FloatR32, 0) - .SetAttribute(1, 0, nxt::VertexFormat::FloatR32, sizeof(float)) + dawn::InputState state = AssertWillBeSuccess(device.CreateInputStateBuilder()) + .SetInput(0, 2 * sizeof(float), dawn::InputStepMode::Vertex) + .SetAttribute(0, 0, dawn::VertexFormat::FloatR32, 0) + .SetAttribute(1, 0, dawn::VertexFormat::FloatR32, sizeof(float)) .GetResult(); // Control case: pipeline with one input per attribute @@ -108,13 +108,13 @@ TEST_F(InputStateTest, PipelineCompatibility) { TEST_F(InputStateTest, StrideZero) { // Works ok without attributes AssertWillBeSuccess(device.CreateInputStateBuilder()) - .SetInput(0, 0, nxt::InputStepMode::Vertex) + .SetInput(0, 0, dawn::InputStepMode::Vertex) .GetResult(); // Works ok with attributes at a large-ish offset AssertWillBeSuccess(device.CreateInputStateBuilder()) - .SetInput(0, 0, nxt::InputStepMode::Vertex) - .SetAttribute(0, 0, nxt::VertexFormat::FloatR32, 128) + .SetInput(0, 0, dawn::InputStepMode::Vertex) + .SetAttribute(0, 0, dawn::VertexFormat::FloatR32, 128) .GetResult(); } @@ -122,13 +122,13 @@ TEST_F(InputStateTest, StrideZero) { TEST_F(InputStateTest, AlreadySetInput) { // Control case AssertWillBeSuccess(device.CreateInputStateBuilder()) - .SetInput(0, 0, nxt::InputStepMode::Vertex) + .SetInput(0, 0, dawn::InputStepMode::Vertex) .GetResult(); // Oh no, input 0 is set twice AssertWillBeError(device.CreateInputStateBuilder()) - .SetInput(0, 0, nxt::InputStepMode::Vertex) - .SetInput(0, 0, nxt::InputStepMode::Vertex) + .SetInput(0, 0, dawn::InputStepMode::Vertex) + .SetInput(0, 0, dawn::InputStepMode::Vertex) .GetResult(); } @@ -136,12 +136,12 @@ TEST_F(InputStateTest, AlreadySetInput) { TEST_F(InputStateTest, SetInputOutOfBounds) { // Control case, setting last input AssertWillBeSuccess(device.CreateInputStateBuilder()) - .SetInput(kMaxVertexInputs - 1, 0, nxt::InputStepMode::Vertex) + .SetInput(kMaxVertexInputs - 1, 0, dawn::InputStepMode::Vertex) .GetResult(); // Test OOB AssertWillBeError(device.CreateInputStateBuilder()) - .SetInput(kMaxVertexInputs, 0, nxt::InputStepMode::Vertex) + .SetInput(kMaxVertexInputs, 0, dawn::InputStepMode::Vertex) .GetResult(); } @@ -149,15 +149,15 @@ TEST_F(InputStateTest, SetInputOutOfBounds) { TEST_F(InputStateTest, AlreadySetAttribute) { // Control case, setting last attribute AssertWillBeSuccess(device.CreateInputStateBuilder()) - .SetInput(0, 0, nxt::InputStepMode::Vertex) - .SetAttribute(0, 0, nxt::VertexFormat::FloatR32, 0) + .SetInput(0, 0, dawn::InputStepMode::Vertex) + .SetAttribute(0, 0, dawn::VertexFormat::FloatR32, 0) .GetResult(); // Oh no, attribute 0 is set twice AssertWillBeError(device.CreateInputStateBuilder()) - .SetInput(0, 0, nxt::InputStepMode::Vertex) - .SetAttribute(0, 0, nxt::VertexFormat::FloatR32, 0) - .SetAttribute(0, 0, nxt::VertexFormat::FloatR32, 0) + .SetInput(0, 0, dawn::InputStepMode::Vertex) + .SetAttribute(0, 0, dawn::VertexFormat::FloatR32, 0) + .SetAttribute(0, 0, dawn::VertexFormat::FloatR32, 0) .GetResult(); } @@ -165,14 +165,14 @@ TEST_F(InputStateTest, AlreadySetAttribute) { TEST_F(InputStateTest, SetAttributeOutOfBounds) { // Control case, setting last attribute AssertWillBeSuccess(device.CreateInputStateBuilder()) - .SetInput(0, 0, nxt::InputStepMode::Vertex) - .SetAttribute(kMaxVertexAttributes - 1, 0, nxt::VertexFormat::FloatR32, 0) + .SetInput(0, 0, dawn::InputStepMode::Vertex) + .SetAttribute(kMaxVertexAttributes - 1, 0, dawn::VertexFormat::FloatR32, 0) .GetResult(); // Test OOB AssertWillBeError(device.CreateInputStateBuilder()) - .SetInput(0, 0, nxt::InputStepMode::Vertex) - .SetAttribute(kMaxVertexAttributes, 0, nxt::VertexFormat::FloatR32, 0) + .SetInput(0, 0, dawn::InputStepMode::Vertex) + .SetAttribute(kMaxVertexAttributes, 0, dawn::VertexFormat::FloatR32, 0) .GetResult(); } @@ -180,14 +180,14 @@ TEST_F(InputStateTest, SetAttributeOutOfBounds) { TEST_F(InputStateTest, RequireInputForAttribute) { // Control case AssertWillBeSuccess(device.CreateInputStateBuilder()) - .SetInput(0, 0, nxt::InputStepMode::Vertex) - .SetAttribute(0, 0, nxt::VertexFormat::FloatR32, 0) + .SetInput(0, 0, dawn::InputStepMode::Vertex) + .SetAttribute(0, 0, dawn::VertexFormat::FloatR32, 0) .GetResult(); // Attribute 0 uses input 1 which doesn't exist AssertWillBeError(device.CreateInputStateBuilder()) - .SetInput(0, 0, nxt::InputStepMode::Vertex) - .SetAttribute(0, 1, nxt::VertexFormat::FloatR32, 0) + .SetInput(0, 0, dawn::InputStepMode::Vertex) + .SetAttribute(0, 1, dawn::VertexFormat::FloatR32, 0) .GetResult(); } @@ -195,13 +195,13 @@ TEST_F(InputStateTest, RequireInputForAttribute) { TEST_F(InputStateTest, SetAttributeOOBCheckForInputs) { // Control case AssertWillBeSuccess(device.CreateInputStateBuilder()) - .SetInput(0, 0, nxt::InputStepMode::Vertex) - .SetAttribute(0, 0, nxt::VertexFormat::FloatR32, 0) + .SetInput(0, 0, dawn::InputStepMode::Vertex) + .SetAttribute(0, 0, dawn::VertexFormat::FloatR32, 0) .GetResult(); // Could crash if we didn't check for OOB AssertWillBeError(device.CreateInputStateBuilder()) - .SetInput(0, 0, nxt::InputStepMode::Vertex) - .SetAttribute(0, 1000000, nxt::VertexFormat::FloatR32, 0) + .SetInput(0, 0, dawn::InputStepMode::Vertex) + .SetAttribute(0, 1000000, dawn::VertexFormat::FloatR32, 0) .GetResult(); } diff --git a/src/tests/unittests/validation/PushConstantsValidationTests.cpp b/src/tests/unittests/validation/PushConstantsValidationTests.cpp index ccf99c402c..d51fc85dda 100644 --- a/src/tests/unittests/validation/PushConstantsValidationTests.cpp +++ b/src/tests/unittests/validation/PushConstantsValidationTests.cpp @@ -23,17 +23,17 @@ using namespace testing; class PushConstantTest : public ValidationTest { protected: - nxt::Queue queue; + dawn::Queue queue; uint32_t constants[kMaxPushConstants] = {0}; void TestCreateShaderModule(bool success, std::string vertexSource) { - nxt::ShaderModuleBuilder builder; + dawn::ShaderModuleBuilder builder; if (success) { builder = AssertWillBeSuccess(device.CreateShaderModuleBuilder()); } else { builder = AssertWillBeError(device.CreateShaderModuleBuilder()); } - utils::FillShaderModuleBuilder(builder, nxt::ShaderStage::Vertex, vertexSource.c_str()); + utils::FillShaderModuleBuilder(builder, dawn::ShaderStage::Vertex, vertexSource.c_str()); builder.GetResult(); } @@ -51,22 +51,22 @@ TEST_F(PushConstantTest, Success) { AssertWillBeSuccess(device.CreateCommandBufferBuilder()) // PushConstants in a compute pass .BeginComputePass() - .SetPushConstants(nxt::ShaderStageBit::Compute, 0, 1, constants) + .SetPushConstants(dawn::ShaderStageBit::Compute, 0, 1, constants) .EndComputePass() // PushConstants in a render pass .BeginRenderPass(renderpassData.renderPass) - .SetPushConstants(nxt::ShaderStageBit::Vertex | nxt::ShaderStageBit::Fragment, 0, 1, constants) + .SetPushConstants(dawn::ShaderStageBit::Vertex | dawn::ShaderStageBit::Fragment, 0, 1, constants) .EndRenderPass() // Setting all constants .BeginComputePass() - .SetPushConstants(nxt::ShaderStageBit::Compute, 0, kMaxPushConstants, constants) + .SetPushConstants(dawn::ShaderStageBit::Compute, 0, kMaxPushConstants, constants) .EndComputePass() // Setting constants at an offset .BeginComputePass() - .SetPushConstants(nxt::ShaderStageBit::Compute, kMaxPushConstants - 1, 1, constants) + .SetPushConstants(dawn::ShaderStageBit::Compute, kMaxPushConstants - 1, 1, constants) .EndComputePass() .GetResult(); @@ -80,7 +80,7 @@ TEST_F(PushConstantTest, SetPushConstantsOOB) { { AssertWillBeSuccess(device.CreateCommandBufferBuilder()) .BeginComputePass() - .SetPushConstants(nxt::ShaderStageBit::Compute, 0, kMaxPushConstants, constants) + .SetPushConstants(dawn::ShaderStageBit::Compute, 0, kMaxPushConstants, constants) .EndComputePass() .GetResult(); } @@ -89,7 +89,7 @@ TEST_F(PushConstantTest, SetPushConstantsOOB) { { AssertWillBeError(device.CreateCommandBufferBuilder()) .BeginComputePass() - .SetPushConstants(nxt::ShaderStageBit::Compute, 0, kMaxPushConstants + 1, constants) + .SetPushConstants(dawn::ShaderStageBit::Compute, 0, kMaxPushConstants + 1, constants) .EndComputePass() .GetResult(); } @@ -98,7 +98,7 @@ TEST_F(PushConstantTest, SetPushConstantsOOB) { { AssertWillBeError(device.CreateCommandBufferBuilder()) .BeginComputePass() - .SetPushConstants(nxt::ShaderStageBit::Compute, 1, kMaxPushConstants, constants) + .SetPushConstants(dawn::ShaderStageBit::Compute, 1, kMaxPushConstants, constants) .EndComputePass() .GetResult(); } @@ -111,11 +111,11 @@ TEST_F(PushConstantTest, NotInPass) { // Setting outside of any pass is invalid. { AssertWillBeError(device.CreateCommandBufferBuilder()) - .SetPushConstants(nxt::ShaderStageBit::Compute, 0, 1, constants) + .SetPushConstants(dawn::ShaderStageBit::Compute, 0, 1, constants) .GetResult(); AssertWillBeError(device.CreateCommandBufferBuilder()) - .SetPushConstants(nxt::ShaderStageBit::Vertex, 0, 1, constants) + .SetPushConstants(dawn::ShaderStageBit::Vertex, 0, 1, constants) .GetResult(); } } @@ -126,7 +126,7 @@ TEST_F(PushConstantTest, StageForComputePass) { { AssertWillBeSuccess(device.CreateCommandBufferBuilder()) .BeginComputePass() - .SetPushConstants(nxt::ShaderStageBit::Compute, 0, 1, constants) + .SetPushConstants(dawn::ShaderStageBit::Compute, 0, 1, constants) .EndComputePass() .GetResult(); } @@ -135,7 +135,7 @@ TEST_F(PushConstantTest, StageForComputePass) { { AssertWillBeError(device.CreateCommandBufferBuilder()) .BeginComputePass() - .SetPushConstants(nxt::ShaderStageBit::Vertex, 0, 1, constants) + .SetPushConstants(dawn::ShaderStageBit::Vertex, 0, 1, constants) .EndComputePass() .GetResult(); } @@ -144,7 +144,7 @@ TEST_F(PushConstantTest, StageForComputePass) { { AssertWillBeSuccess(device.CreateCommandBufferBuilder()) .BeginComputePass() - .SetPushConstants(nxt::ShaderStageBit::None, 0, 1, constants) + .SetPushConstants(dawn::ShaderStageBit::None, 0, 1, constants) .EndComputePass() .GetResult(); } @@ -158,7 +158,7 @@ TEST_F(PushConstantTest, StageForRenderPass) { { AssertWillBeSuccess(device.CreateCommandBufferBuilder()) .BeginRenderPass(renderpassData.renderPass) - .SetPushConstants(nxt::ShaderStageBit::Vertex | nxt::ShaderStageBit::Fragment, 0, 1, constants) + .SetPushConstants(dawn::ShaderStageBit::Vertex | dawn::ShaderStageBit::Fragment, 0, 1, constants) .EndRenderPass() .GetResult(); } @@ -167,7 +167,7 @@ TEST_F(PushConstantTest, StageForRenderPass) { { AssertWillBeError(device.CreateCommandBufferBuilder()) .BeginRenderPass(renderpassData.renderPass) - .SetPushConstants(nxt::ShaderStageBit::Compute, 0, 1, constants) + .SetPushConstants(dawn::ShaderStageBit::Compute, 0, 1, constants) .EndRenderPass() .GetResult(); } @@ -176,7 +176,7 @@ TEST_F(PushConstantTest, StageForRenderPass) { { AssertWillBeSuccess(device.CreateCommandBufferBuilder()) .BeginRenderPass(renderpassData.renderPass) - .SetPushConstants(nxt::ShaderStageBit::None, 0, 1, constants) + .SetPushConstants(dawn::ShaderStageBit::None, 0, 1, constants) .EndRenderPass() .GetResult(); } diff --git a/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp b/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp index 11801a5f8f..5a3efc9f7d 100644 --- a/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp +++ b/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp @@ -21,13 +21,13 @@ namespace { class RenderPassDescriptorValidationTest : public ValidationTest { }; -nxt::TextureView Create2DAttachment(nxt::Device& device, uint32_t width, uint32_t height, nxt::TextureFormat format) { - nxt::Texture attachment = device.CreateTextureBuilder() - .SetDimension(nxt::TextureDimension::e2D) +dawn::TextureView Create2DAttachment(dawn::Device& device, uint32_t width, uint32_t height, dawn::TextureFormat format) { + dawn::Texture attachment = device.CreateTextureBuilder() + .SetDimension(dawn::TextureDimension::e2D) .SetExtent(width, height, 1) .SetFormat(format) .SetMipLevels(1) - .SetAllowedUsage(nxt::TextureUsageBit::OutputAttachment) + .SetAllowedUsage(dawn::TextureUsageBit::OutputAttachment) .GetResult(); return attachment.CreateTextureViewBuilder() @@ -44,16 +44,16 @@ TEST_F(RenderPassDescriptorValidationTest, Empty) { TEST_F(RenderPassDescriptorValidationTest, OneAttachment) { // One color attachment { - nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm); + dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm); AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder()) - .SetColorAttachment(0, color, nxt::LoadOp::Clear) + .SetColorAttachment(0, color, dawn::LoadOp::Clear) .GetResult(); } // One depth-stencil attachment { - nxt::TextureView depthStencil = Create2DAttachment(device, 1, 1, nxt::TextureFormat::D32FloatS8Uint); + dawn::TextureView depthStencil = Create2DAttachment(device, 1, 1, dawn::TextureFormat::D32FloatS8Uint); AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder()) - .SetDepthStencilAttachment(depthStencil, nxt::LoadOp::Clear, nxt::LoadOp::Clear) + .SetDepthStencilAttachment(depthStencil, dawn::LoadOp::Clear, dawn::LoadOp::Clear) .GetResult(); } } @@ -62,31 +62,31 @@ TEST_F(RenderPassDescriptorValidationTest, OneAttachment) { TEST_F(RenderPassDescriptorValidationTest, ColorAttachmentOutOfBounds) { // For setting the color attachment, control case { - nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm); + dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm); AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder()) - .SetColorAttachment(kMaxColorAttachments - 1, color, nxt::LoadOp::Clear) + .SetColorAttachment(kMaxColorAttachments - 1, color, dawn::LoadOp::Clear) .GetResult(); } // For setting the color attachment, OOB { - nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm); + dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm); AssertWillBeError(device.CreateRenderPassDescriptorBuilder()) - .SetColorAttachment(kMaxColorAttachments, color, nxt::LoadOp::Clear) + .SetColorAttachment(kMaxColorAttachments, color, dawn::LoadOp::Clear) .GetResult(); } - nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm); + dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm); // For setting the clear color, control case { AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder()) - .SetColorAttachment(0, color, nxt::LoadOp::Clear) + .SetColorAttachment(0, color, dawn::LoadOp::Clear) .SetColorAttachmentClearColor(kMaxColorAttachments - 1, 0.0f, 0.0f, 0.0f, 0.0f) .GetResult(); } // For setting the clear color, OOB { AssertWillBeError(device.CreateRenderPassDescriptorBuilder()) - .SetColorAttachment(0, color, nxt::LoadOp::Clear) + .SetColorAttachment(0, color, dawn::LoadOp::Clear) .SetColorAttachmentClearColor(kMaxColorAttachments, 0.0f, 0.0f, 0.0f, 0.0f) .GetResult(); } @@ -94,26 +94,26 @@ TEST_F(RenderPassDescriptorValidationTest, ColorAttachmentOutOfBounds) { // Test setting a clear value without an attachment and vice-versa is ok. TEST_F(RenderPassDescriptorValidationTest, ClearAndAttachmentMismatchIsOk) { - nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm); + dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm); // For cleared attachment 0 doesn't get a color, clear color for 1 is unused { AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder()) - .SetColorAttachment(0, color, nxt::LoadOp::Clear) + .SetColorAttachment(0, color, dawn::LoadOp::Clear) .SetColorAttachmentClearColor(1, 0.0f, 0.0f, 0.0f, 0.0f) .GetResult(); } // Clear depth stencil doesn't get values { - nxt::TextureView depthStencil = Create2DAttachment(device, 1, 1, nxt::TextureFormat::D32FloatS8Uint); + dawn::TextureView depthStencil = Create2DAttachment(device, 1, 1, dawn::TextureFormat::D32FloatS8Uint); AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder()) - .SetDepthStencilAttachment(depthStencil, nxt::LoadOp::Clear, nxt::LoadOp::Clear) + .SetDepthStencilAttachment(depthStencil, dawn::LoadOp::Clear, dawn::LoadOp::Clear) .GetResult(); } // Clear values for depth-stencil when it isn't used { AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder()) - .SetColorAttachment(0, color, nxt::LoadOp::Clear) + .SetColorAttachment(0, color, dawn::LoadOp::Clear) .SetDepthStencilAttachmentClearValue(0.0f, 0) .GetResult(); } @@ -121,56 +121,56 @@ TEST_F(RenderPassDescriptorValidationTest, ClearAndAttachmentMismatchIsOk) { // Attachments must have the same size TEST_F(RenderPassDescriptorValidationTest, SizeMustMatch) { - nxt::TextureView color1x1A = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm); - nxt::TextureView color1x1B = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm); - nxt::TextureView color2x2 = Create2DAttachment(device, 2, 2, nxt::TextureFormat::R8G8B8A8Unorm); - nxt::TextureView depthStencil1x1 = Create2DAttachment(device, 1, 1, nxt::TextureFormat::D32FloatS8Uint); - nxt::TextureView depthStencil2x2 = Create2DAttachment(device, 2, 2, nxt::TextureFormat::D32FloatS8Uint); + dawn::TextureView color1x1A = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm); + dawn::TextureView color1x1B = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm); + dawn::TextureView color2x2 = Create2DAttachment(device, 2, 2, dawn::TextureFormat::R8G8B8A8Unorm); + dawn::TextureView depthStencil1x1 = Create2DAttachment(device, 1, 1, dawn::TextureFormat::D32FloatS8Uint); + dawn::TextureView depthStencil2x2 = Create2DAttachment(device, 2, 2, dawn::TextureFormat::D32FloatS8Uint); // Control case: all the same size (1x1) { AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder()) - .SetColorAttachment(0, color1x1A, nxt::LoadOp::Clear) - .SetColorAttachment(1, color1x1B, nxt::LoadOp::Clear) - .SetDepthStencilAttachment(depthStencil1x1, nxt::LoadOp::Clear, nxt::LoadOp::Clear) + .SetColorAttachment(0, color1x1A, dawn::LoadOp::Clear) + .SetColorAttachment(1, color1x1B, dawn::LoadOp::Clear) + .SetDepthStencilAttachment(depthStencil1x1, dawn::LoadOp::Clear, dawn::LoadOp::Clear) .GetResult(); } // One of the color attachments has a different size { AssertWillBeError(device.CreateRenderPassDescriptorBuilder()) - .SetColorAttachment(0, color1x1A, nxt::LoadOp::Clear) - .SetColorAttachment(1, color2x2, nxt::LoadOp::Clear) - .SetDepthStencilAttachment(depthStencil1x1, nxt::LoadOp::Clear, nxt::LoadOp::Clear) + .SetColorAttachment(0, color1x1A, dawn::LoadOp::Clear) + .SetColorAttachment(1, color2x2, dawn::LoadOp::Clear) + .SetDepthStencilAttachment(depthStencil1x1, dawn::LoadOp::Clear, dawn::LoadOp::Clear) .GetResult(); } // The depth stencil attachment has a different size { AssertWillBeError(device.CreateRenderPassDescriptorBuilder()) - .SetColorAttachment(0, color1x1A, nxt::LoadOp::Clear) - .SetColorAttachment(1, color1x1B, nxt::LoadOp::Clear) - .SetDepthStencilAttachment(depthStencil2x2, nxt::LoadOp::Clear, nxt::LoadOp::Clear) + .SetColorAttachment(0, color1x1A, dawn::LoadOp::Clear) + .SetColorAttachment(1, color1x1B, dawn::LoadOp::Clear) + .SetDepthStencilAttachment(depthStencil2x2, dawn::LoadOp::Clear, dawn::LoadOp::Clear) .GetResult(); } } // Attachments formats must match whether they are used for color or depth-stencil TEST_F(RenderPassDescriptorValidationTest, FormatMismatch) { - nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm); - nxt::TextureView depthStencil = Create2DAttachment(device, 1, 1, nxt::TextureFormat::D32FloatS8Uint); + dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm); + dawn::TextureView depthStencil = Create2DAttachment(device, 1, 1, dawn::TextureFormat::D32FloatS8Uint); // Using depth-stencil for color { AssertWillBeError(device.CreateRenderPassDescriptorBuilder()) - .SetColorAttachment(0, depthStencil, nxt::LoadOp::Clear) + .SetColorAttachment(0, depthStencil, dawn::LoadOp::Clear) .GetResult(); } // Using color for depth-stencil { AssertWillBeError(device.CreateRenderPassDescriptorBuilder()) - .SetDepthStencilAttachment(color, nxt::LoadOp::Clear, nxt::LoadOp::Clear) + .SetDepthStencilAttachment(color, dawn::LoadOp::Clear, dawn::LoadOp::Clear) .GetResult(); } } diff --git a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp index ec2a3609d8..e132c1071e 100644 --- a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp +++ b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp @@ -24,20 +24,20 @@ class RenderPipelineValidationTest : public ValidationTest { renderpass = CreateSimpleRenderPass(); - nxt::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, nullptr); + dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, nullptr); inputState = device.CreateInputStateBuilder().GetResult(); blendState = device.CreateBlendStateBuilder().GetResult(); - vsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, R"( + vsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, R"( #version 450 void main() { gl_Position = vec4(0.0, 0.0, 0.0, 1.0); })" ); - fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"( + fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"( #version 450 layout(location = 0) out vec4 fragColor; void main() { @@ -45,21 +45,21 @@ class RenderPipelineValidationTest : public ValidationTest { })"); } - nxt::RenderPipelineBuilder& AddDefaultStates(nxt::RenderPipelineBuilder&& builder) { - builder.SetColorAttachmentFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) + dawn::RenderPipelineBuilder& AddDefaultStates(dawn::RenderPipelineBuilder&& builder) { + builder.SetColorAttachmentFormat(0, dawn::TextureFormat::R8G8B8A8Unorm) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") - .SetPrimitiveTopology(nxt::PrimitiveTopology::TriangleList); + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") + .SetPrimitiveTopology(dawn::PrimitiveTopology::TriangleList); return builder; } - nxt::RenderPassDescriptor renderpass; - nxt::ShaderModule vsModule; - nxt::ShaderModule fsModule; - nxt::InputState inputState; - nxt::BlendState blendState; - nxt::PipelineLayout pipelineLayout; + dawn::RenderPassDescriptor renderpass; + dawn::ShaderModule vsModule; + dawn::ShaderModule fsModule; + dawn::InputState inputState; + dawn::BlendState blendState; + dawn::PipelineLayout pipelineLayout; }; // Test cases where creation should succeed @@ -81,20 +81,20 @@ TEST_F(RenderPipelineValidationTest, CreationMissingProperty) { // Vertex stage not set { AssertWillBeError(device.CreateRenderPipelineBuilder()) - .SetColorAttachmentFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(0, dawn::TextureFormat::R8G8B8A8Unorm) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") - .SetPrimitiveTopology(nxt::PrimitiveTopology::TriangleList) + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") + .SetPrimitiveTopology(dawn::PrimitiveTopology::TriangleList) .GetResult(); } // Fragment stage not set { AssertWillBeError(device.CreateRenderPipelineBuilder()) - .SetColorAttachmentFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(0, dawn::TextureFormat::R8G8B8A8Unorm) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetPrimitiveTopology(nxt::PrimitiveTopology::TriangleList) + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetPrimitiveTopology(dawn::PrimitiveTopology::TriangleList) .GetResult(); } @@ -102,9 +102,9 @@ TEST_F(RenderPipelineValidationTest, CreationMissingProperty) { { AssertWillBeError(device.CreateRenderPipelineBuilder()) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") - .SetPrimitiveTopology(nxt::PrimitiveTopology::TriangleList) + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") + .SetPrimitiveTopology(dawn::PrimitiveTopology::TriangleList) .GetResult(); } } @@ -114,21 +114,21 @@ TEST_F(RenderPipelineValidationTest, BlendState) { { // This one succeeds because attachment 0 is the color attachment AssertWillBeSuccess(device.CreateRenderPipelineBuilder()) - .SetColorAttachmentFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(0, dawn::TextureFormat::R8G8B8A8Unorm) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") - .SetPrimitiveTopology(nxt::PrimitiveTopology::TriangleList) + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") + .SetPrimitiveTopology(dawn::PrimitiveTopology::TriangleList) .SetColorAttachmentBlendState(0, blendState) .GetResult(); // This fails because attachment 1 is not one of the color attachments AssertWillBeError(device.CreateRenderPipelineBuilder()) - .SetColorAttachmentFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(0, dawn::TextureFormat::R8G8B8A8Unorm) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") - .SetPrimitiveTopology(nxt::PrimitiveTopology::TriangleList) + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") + .SetPrimitiveTopology(dawn::PrimitiveTopology::TriangleList) .SetColorAttachmentBlendState(1, blendState) .GetResult(); } @@ -154,20 +154,20 @@ TEST_F(RenderPipelineValidationTest, DISABLED_TodoCreationMissingProperty) { // Fails because pipeline layout is not set { AssertWillBeError(device.CreateRenderPipelineBuilder()) - .SetColorAttachmentFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") - .SetPrimitiveTopology(nxt::PrimitiveTopology::TriangleList) + .SetColorAttachmentFormat(0, dawn::TextureFormat::R8G8B8A8Unorm) + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") + .SetPrimitiveTopology(dawn::PrimitiveTopology::TriangleList) .GetResult(); } // Fails because primitive topology is not set { AssertWillBeError(device.CreateRenderPipelineBuilder()) - .SetColorAttachmentFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) + .SetColorAttachmentFormat(0, dawn::TextureFormat::R8G8B8A8Unorm) .SetLayout(pipelineLayout) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .GetResult(); } } @@ -184,21 +184,21 @@ TEST_F(RenderPipelineValidationTest, DISABLED_CreationDuplicates) { // Fails because primitive topology is set twice { AddDefaultStates(AssertWillBeError(device.CreateRenderPipelineBuilder())) - .SetPrimitiveTopology(nxt::PrimitiveTopology::TriangleList) + .SetPrimitiveTopology(dawn::PrimitiveTopology::TriangleList) .GetResult(); } // Fails because vertex stage is set twice { AddDefaultStates(AssertWillBeError(device.CreateRenderPipelineBuilder())) - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .GetResult(); } // Fails because fragment stage is set twice { AddDefaultStates(AssertWillBeError(device.CreateRenderPipelineBuilder())) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") .GetResult(); } diff --git a/src/tests/unittests/validation/ValidationTest.cpp b/src/tests/unittests/validation/ValidationTest.cpp index 620162c290..9a0cf3d9f7 100644 --- a/src/tests/unittests/validation/ValidationTest.cpp +++ b/src/tests/unittests/validation/ValidationTest.cpp @@ -28,7 +28,7 @@ ValidationTest::ValidationTest() { backend::null::Init(&procs, &cDevice); nxtSetProcs(&procs); - device = nxt::Device::Acquire(cDevice); + device = dawn::Device::Acquire(cDevice); device.SetErrorCallback(ValidationTest::OnDeviceError, static_cast(reinterpret_cast(this))); } @@ -36,7 +36,7 @@ ValidationTest::ValidationTest() { ValidationTest::~ValidationTest() { // We need to destroy NXT objects before setting the procs to null otherwise the nxt*Release // will call a nullptr - device = nxt::Device(); + device = dawn::Device(); nxtSetProcs(nullptr); } @@ -69,19 +69,19 @@ bool ValidationTest::EndExpectDeviceError() { return mError; } -nxt::RenderPassDescriptor ValidationTest::CreateSimpleRenderPass() { +dawn::RenderPassDescriptor ValidationTest::CreateSimpleRenderPass() { auto colorBuffer = device.CreateTextureBuilder() - .SetDimension(nxt::TextureDimension::e2D) + .SetDimension(dawn::TextureDimension::e2D) .SetExtent(640, 480, 1) - .SetFormat(nxt::TextureFormat::R8G8B8A8Unorm) + .SetFormat(dawn::TextureFormat::R8G8B8A8Unorm) .SetMipLevels(1) - .SetAllowedUsage(nxt::TextureUsageBit::OutputAttachment) + .SetAllowedUsage(dawn::TextureUsageBit::OutputAttachment) .GetResult(); auto colorView = colorBuffer.CreateTextureViewBuilder() .GetResult(); return device.CreateRenderPassDescriptorBuilder() - .SetColorAttachment(0, colorView, nxt::LoadOp::Clear) + .SetColorAttachment(0, colorView, dawn::LoadOp::Clear) .GetResult(); } @@ -99,7 +99,7 @@ void ValidationTest::OnDeviceError(const char* message, nxtCallbackUserdata user self->mError = true; } -void ValidationTest::OnBuilderErrorStatus(nxtBuilderErrorStatus status, const char* message, nxt::CallbackUserdata userdata1, nxt::CallbackUserdata userdata2) { +void ValidationTest::OnBuilderErrorStatus(nxtBuilderErrorStatus status, const char* message, dawn::CallbackUserdata userdata1, dawn::CallbackUserdata userdata2) { auto* self = reinterpret_cast(static_cast(userdata1)); size_t index = static_cast(userdata2); @@ -116,20 +116,20 @@ ValidationTest::DummyRenderPass ValidationTest::CreateDummyRenderPass() { DummyRenderPass dummy; dummy.width = 400; dummy.height = 400; - dummy.attachmentFormat = nxt::TextureFormat::R8G8B8A8Unorm; + dummy.attachmentFormat = dawn::TextureFormat::R8G8B8A8Unorm; dummy.attachment = AssertWillBeSuccess(device.CreateTextureBuilder()) - .SetDimension(nxt::TextureDimension::e2D) + .SetDimension(dawn::TextureDimension::e2D) .SetExtent(dummy.width, dummy.height, 1) .SetFormat(dummy.attachmentFormat) .SetMipLevels(1) - .SetAllowedUsage(nxt::TextureUsageBit::OutputAttachment) + .SetAllowedUsage(dawn::TextureUsageBit::OutputAttachment) .GetResult(); - nxt::TextureView view = AssertWillBeSuccess(dummy.attachment.CreateTextureViewBuilder()).GetResult(); + dawn::TextureView view = AssertWillBeSuccess(dummy.attachment.CreateTextureViewBuilder()).GetResult(); dummy.renderPass = AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder()) - .SetColorAttachment(0, view, nxt::LoadOp::Clear) + .SetColorAttachment(0, view, dawn::LoadOp::Clear) .GetResult(); return dummy; diff --git a/src/tests/unittests/validation/ValidationTest.h b/src/tests/unittests/validation/ValidationTest.h index 7f9eda8898..c2da40cb99 100644 --- a/src/tests/unittests/validation/ValidationTest.h +++ b/src/tests/unittests/validation/ValidationTest.h @@ -34,7 +34,7 @@ class ValidationTest : public testing::Test { // Use these methods to add expectations on the validation of a builder. The expectations are // checked on test teardown. Adding an expectation is done like the following: // - // nxt::Foo foo = AssertWillBe[Success|Error](device.CreateFooBuilder(), "my foo") + // dawn::Foo foo = AssertWillBe[Success|Error](device.CreateFooBuilder(), "my foo") // .SetBar(1) // .GetResult(); // @@ -48,21 +48,21 @@ class ValidationTest : public testing::Test { void StartExpectDeviceError(); bool EndExpectDeviceError(); - nxt::RenderPassDescriptor CreateSimpleRenderPass(); + dawn::RenderPassDescriptor CreateSimpleRenderPass(); // Helper functions to create objects to test validation. struct DummyRenderPass { - nxt::RenderPassDescriptor renderPass; - nxt::Texture attachment; - nxt::TextureFormat attachmentFormat; + dawn::RenderPassDescriptor renderPass; + dawn::Texture attachment; + dawn::TextureFormat attachmentFormat; uint32_t width; uint32_t height; }; DummyRenderPass CreateDummyRenderPass(); protected: - nxt::Device device; + dawn::Device device; private: static void OnDeviceError(const char* message, nxtCallbackUserdata userdata); @@ -82,7 +82,7 @@ class ValidationTest : public testing::Test { template Builder AddExpectation(Builder& builder, std::string debugName, bool expectSuccess); - static void OnBuilderErrorStatus(nxtBuilderErrorStatus status, const char* message, nxt::CallbackUserdata userdata1, nxt::CallbackUserdata userdata2); + static void OnBuilderErrorStatus(nxtBuilderErrorStatus status, const char* message, dawn::CallbackUserdata userdata1, dawn::CallbackUserdata userdata2); }; // Template implementation details diff --git a/src/tests/unittests/validation/VertexBufferValidationTests.cpp b/src/tests/unittests/validation/VertexBufferValidationTests.cpp index f6e0e12cc0..bedc827ef9 100644 --- a/src/tests/unittests/validation/VertexBufferValidationTests.cpp +++ b/src/tests/unittests/validation/VertexBufferValidationTests.cpp @@ -25,7 +25,7 @@ class VertexBufferValidationTest : public ValidationTest { renderpass = CreateSimpleRenderPass(); - fsModule = utils::CreateShaderModule(device, nxt::ShaderStage::Fragment, R"( + fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"( #version 450 layout(location = 0) out vec4 fragColor; void main() { @@ -34,18 +34,18 @@ class VertexBufferValidationTest : public ValidationTest { } template - std::array MakeVertexBuffers() { - std::array buffers; + std::array MakeVertexBuffers() { + std::array buffers; for (auto& buffer : buffers) { buffer = device.CreateBufferBuilder() .SetSize(256) - .SetAllowedUsage(nxt::BufferUsageBit::Vertex) + .SetAllowedUsage(dawn::BufferUsageBit::Vertex) .GetResult(); } return buffers; } - nxt::ShaderModule MakeVertexShader(unsigned int numInputs) { + dawn::ShaderModule MakeVertexShader(unsigned int numInputs) { std::ostringstream vs; vs << "#version 450\n"; for (unsigned int i = 0; i < numInputs; ++i) { @@ -64,29 +64,29 @@ class VertexBufferValidationTest : public ValidationTest { vs << "}\n"; - return utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, vs.str().c_str()); + return utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, vs.str().c_str()); } - nxt::InputState MakeInputState(unsigned int numInputs) { + dawn::InputState MakeInputState(unsigned int numInputs) { auto builder = device.CreateInputStateBuilder(); for (unsigned int i = 0; i < numInputs; ++i) { - builder.SetAttribute(i, i, nxt::VertexFormat::FloatR32G32B32, 0); - builder.SetInput(i, 0, nxt::InputStepMode::Vertex); + builder.SetAttribute(i, i, dawn::VertexFormat::FloatR32G32B32, 0); + builder.SetInput(i, 0, dawn::InputStepMode::Vertex); } return builder.GetResult(); } - nxt::RenderPipeline MakeRenderPipeline(const nxt::ShaderModule& vsModule, const nxt::InputState& inputState) { + dawn::RenderPipeline MakeRenderPipeline(const dawn::ShaderModule& vsModule, const dawn::InputState& inputState) { return device.CreateRenderPipelineBuilder() - .SetColorAttachmentFormat(0, nxt::TextureFormat::R8G8B8A8Unorm) - .SetStage(nxt::ShaderStage::Vertex, vsModule, "main") - .SetStage(nxt::ShaderStage::Fragment, fsModule, "main") + .SetColorAttachmentFormat(0, dawn::TextureFormat::R8G8B8A8Unorm) + .SetStage(dawn::ShaderStage::Vertex, vsModule, "main") + .SetStage(dawn::ShaderStage::Fragment, fsModule, "main") .SetInputState(inputState) .GetResult(); } - nxt::RenderPassDescriptor renderpass; - nxt::ShaderModule fsModule; + dawn::RenderPassDescriptor renderpass; + dawn::ShaderModule fsModule; }; TEST_F(VertexBufferValidationTest, VertexInputsInheritedBetweenPipelines) {