diff --git a/BUILD.gn b/BUILD.gn index 617f58dc9f..cf9d1c0062 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -658,13 +658,13 @@ static_library("dawn_utils") { "src/utils/ComboRenderBundleEncoderDescriptor.h", "src/utils/ComboRenderPipelineDescriptor.cpp", "src/utils/ComboRenderPipelineDescriptor.h", - "src/utils/DawnHelpers.cpp", - "src/utils/DawnHelpers.h", "src/utils/SystemUtils.cpp", "src/utils/SystemUtils.h", "src/utils/TerribleCommandBuffer.cpp", "src/utils/TerribleCommandBuffer.h", "src/utils/Timer.h", + "src/utils/WGPUHelpers.cpp", + "src/utils/WGPUHelpers.h", ] if (is_win) { diff --git a/examples/Animometer.cpp b/examples/Animometer.cpp index 4216fbfa05..6d83f5feae 100644 --- a/examples/Animometer.cpp +++ b/examples/Animometer.cpp @@ -15,19 +15,19 @@ #include "SampleUtils.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" #include "utils/SystemUtils.h" +#include "utils/WGPUHelpers.h" #include #include #include -dawn::Device device; -dawn::Queue queue; -dawn::SwapChain swapchain; -dawn::RenderPipeline pipeline; -dawn::BindGroup bindGroup; -dawn::Buffer ubo; +wgpu::Device device; +wgpu::Queue queue; +wgpu::SwapChain swapchain; +wgpu::RenderPipeline pipeline; +wgpu::BindGroup bindGroup; +wgpu::Buffer ubo; float RandomFloat(float min, float max) { float zeroOne = rand() / float(RAND_MAX); @@ -52,10 +52,10 @@ void init() { queue = device.CreateQueue(); swapchain = GetSwapChain(device); - swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment, + swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment, 640, 480); - dawn::ShaderModule vsModule = + wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"( #version 450 @@ -103,7 +103,7 @@ void init() { gl_Position = vec4(xpos, ypos, 0.0, 1.0); })"); - dawn::ShaderModule fsModule = + wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"( #version 450 layout(location = 0) out vec4 fragColor; @@ -112,8 +112,8 @@ void init() { fragColor = v_color; })"); - dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout( - device, {{0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer, true}}); + wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout( + device, {{0, wgpu::ShaderStage::Vertex, wgpu::BindingType::UniformBuffer, true}}); utils::ComboRenderPipelineDescriptor descriptor(device); descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl); @@ -133,9 +133,9 @@ void init() { data.scalarOffset = RandomFloat(0.0f, 10.0f); } - dawn::BufferDescriptor bufferDesc; + wgpu::BufferDescriptor bufferDesc; bufferDesc.size = kNumTriangles * sizeof(ShaderData); - bufferDesc.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::Uniform; + bufferDesc.usage = wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::Uniform; ubo = device.CreateBuffer(&bufferDesc); bindGroup = @@ -143,7 +143,7 @@ void init() { } void frame() { - dawn::Texture backbuffer = swapchain.GetNextTexture(); + wgpu::Texture backbuffer = swapchain.GetNextTexture(); static int f = 0; f++; @@ -153,9 +153,9 @@ void frame() { ubo.SetSubData(0, kNumTriangles * sizeof(ShaderData), shaderData.data()); utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateView()}); - dawn::CommandEncoder encoder = device.CreateCommandEncoder(); + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { - dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); pass.SetPipeline(pipeline); for (size_t i = 0; i < kNumTriangles; i++) { @@ -167,7 +167,7 @@ void frame() { pass.EndPass(); } - dawn::CommandBuffer commands = encoder.Finish(); + wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); swapchain.Present(backbuffer); DoFlush(); diff --git a/examples/CHelloTriangle.cpp b/examples/CHelloTriangle.cpp index f66f514c1d..493f1a8a9b 100644 --- a/examples/CHelloTriangle.cpp +++ b/examples/CHelloTriangle.cpp @@ -14,30 +14,29 @@ #include "SampleUtils.h" -#include "utils/DawnHelpers.h" #include "utils/SystemUtils.h" +#include "utils/WGPUHelpers.h" -DawnDevice device; -DawnQueue queue; -DawnSwapChain swapchain; -DawnRenderPipeline pipeline; +WGPUDevice device; +WGPUQueue queue; +WGPUSwapChain swapchain; +WGPURenderPipeline pipeline; -DawnTextureFormat swapChainFormat; +WGPUTextureFormat swapChainFormat; void init() { device = CreateCppDawnDevice().Release(); - queue = dawnDeviceCreateQueue(device); + queue = wgpuDeviceCreateQueue(device); { - DawnSwapChainDescriptor descriptor; + WGPUSwapChainDescriptor descriptor; descriptor.nextInChain = nullptr; descriptor.label = nullptr; descriptor.implementation = GetSwapChainImplementation(); - swapchain = dawnDeviceCreateSwapChain(device, &descriptor); + swapchain = wgpuDeviceCreateSwapChain(device, &descriptor); } - swapChainFormat = static_cast(GetPreferredSwapChainTextureFormat()); - dawnSwapChainConfigure(swapchain, swapChainFormat, DAWN_TEXTURE_USAGE_OUTPUT_ATTACHMENT, 640, - 480); + swapChainFormat = static_cast(GetPreferredSwapChainTextureFormat()); + wgpuSwapChainConfigure(swapchain, swapChainFormat, WGPUTextureUsage_OutputAttachment, 640, 480); const char* vs = "#version 450\n" @@ -45,8 +44,8 @@ void init() { "void main() {\n" " gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n" "}\n"; - DawnShaderModule vsModule = - utils::CreateShaderModule(dawn::Device(device), utils::SingleShaderStage::Vertex, vs) + WGPUShaderModule vsModule = + utils::CreateShaderModule(wgpu::Device(device), utils::SingleShaderStage::Vertex, vs) .Release(); const char* fs = @@ -55,11 +54,11 @@ void init() { "void main() {\n" " fragColor = vec4(1.0, 0.0, 0.0, 1.0);\n" "}\n"; - DawnShaderModule fsModule = + WGPUShaderModule fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs).Release(); { - DawnRenderPipelineDescriptor descriptor; + WGPURenderPipelineDescriptor descriptor; descriptor.label = nullptr; descriptor.nextInChain = nullptr; @@ -67,7 +66,7 @@ void init() { descriptor.vertexStage.module = vsModule; descriptor.vertexStage.entryPoint = "main"; - DawnProgrammableStageDescriptor fragmentStage; + WGPUProgrammableStageDescriptor fragmentStage; fragmentStage.nextInChain = nullptr; fragmentStage.module = fsModule; fragmentStage.entryPoint = "main"; @@ -75,91 +74,91 @@ void init() { descriptor.sampleCount = 1; - DawnBlendDescriptor blendDescriptor; - blendDescriptor.operation = DAWN_BLEND_OPERATION_ADD; - blendDescriptor.srcFactor = DAWN_BLEND_FACTOR_ONE; - blendDescriptor.dstFactor = DAWN_BLEND_FACTOR_ONE; - DawnColorStateDescriptor colorStateDescriptor; + WGPUBlendDescriptor blendDescriptor; + blendDescriptor.operation = WGPUBlendOperation_Add; + blendDescriptor.srcFactor = WGPUBlendFactor_One; + blendDescriptor.dstFactor = WGPUBlendFactor_One; + WGPUColorStateDescriptor colorStateDescriptor; colorStateDescriptor.nextInChain = nullptr; colorStateDescriptor.format = swapChainFormat; colorStateDescriptor.alphaBlend = blendDescriptor; colorStateDescriptor.colorBlend = blendDescriptor; - colorStateDescriptor.writeMask = DAWN_COLOR_WRITE_MASK_ALL; + colorStateDescriptor.writeMask = WGPUColorWriteMask_All; descriptor.colorStateCount = 1; descriptor.colorStates = &colorStateDescriptor; - DawnPipelineLayoutDescriptor pl; + WGPUPipelineLayoutDescriptor pl; pl.nextInChain = nullptr; pl.label = nullptr; pl.bindGroupLayoutCount = 0; pl.bindGroupLayouts = nullptr; - descriptor.layout = dawnDeviceCreatePipelineLayout(device, &pl); + descriptor.layout = wgpuDeviceCreatePipelineLayout(device, &pl); - DawnVertexInputDescriptor vertexInput; + WGPUVertexInputDescriptor vertexInput; vertexInput.nextInChain = nullptr; - vertexInput.indexFormat = DAWN_INDEX_FORMAT_UINT32; + vertexInput.indexFormat = WGPUIndexFormat_Uint32; vertexInput.bufferCount = 0; vertexInput.buffers = nullptr; descriptor.vertexInput = &vertexInput; - DawnRasterizationStateDescriptor rasterizationState; + WGPURasterizationStateDescriptor rasterizationState; rasterizationState.nextInChain = nullptr; - rasterizationState.frontFace = DAWN_FRONT_FACE_CCW; - rasterizationState.cullMode = DAWN_CULL_MODE_NONE; + rasterizationState.frontFace = WGPUFrontFace_CCW; + rasterizationState.cullMode = WGPUCullMode_None; rasterizationState.depthBias = 0; rasterizationState.depthBiasSlopeScale = 0.0; rasterizationState.depthBiasClamp = 0.0; descriptor.rasterizationState = &rasterizationState; - descriptor.primitiveTopology = DAWN_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; + descriptor.primitiveTopology = WGPUPrimitiveTopology_TriangleList; descriptor.sampleMask = 0xFFFFFFFF; descriptor.alphaToCoverageEnabled = false; descriptor.depthStencilState = nullptr; - pipeline = dawnDeviceCreateRenderPipeline(device, &descriptor); + pipeline = wgpuDeviceCreateRenderPipeline(device, &descriptor); } - dawnShaderModuleRelease(vsModule); - dawnShaderModuleRelease(fsModule); + wgpuShaderModuleRelease(vsModule); + wgpuShaderModuleRelease(fsModule); } void frame() { - DawnTexture backbuffer = dawnSwapChainGetNextTexture(swapchain); - DawnTextureView backbufferView = dawnTextureCreateView(backbuffer, nullptr); - DawnRenderPassDescriptor renderpassInfo; + WGPUTexture backbuffer = wgpuSwapChainGetNextTexture(swapchain); + WGPUTextureView backbufferView = wgpuTextureCreateView(backbuffer, nullptr); + WGPURenderPassDescriptor renderpassInfo; renderpassInfo.nextInChain = nullptr; renderpassInfo.label = nullptr; - DawnRenderPassColorAttachmentDescriptor colorAttachment; + WGPURenderPassColorAttachmentDescriptor colorAttachment; { colorAttachment.attachment = backbufferView; colorAttachment.resolveTarget = nullptr; colorAttachment.clearColor = { 0.0f, 0.0f, 0.0f, 0.0f }; - colorAttachment.loadOp = DAWN_LOAD_OP_CLEAR; - colorAttachment.storeOp = DAWN_STORE_OP_STORE; + colorAttachment.loadOp = WGPULoadOp_Clear; + colorAttachment.storeOp = WGPUStoreOp_Store; renderpassInfo.colorAttachmentCount = 1; renderpassInfo.colorAttachments = &colorAttachment; renderpassInfo.depthStencilAttachment = nullptr; } - DawnCommandBuffer commands; + WGPUCommandBuffer commands; { - DawnCommandEncoder encoder = dawnDeviceCreateCommandEncoder(device, nullptr); + WGPUCommandEncoder encoder = wgpuDeviceCreateCommandEncoder(device, nullptr); - DawnRenderPassEncoder pass = dawnCommandEncoderBeginRenderPass(encoder, &renderpassInfo); - dawnRenderPassEncoderSetPipeline(pass, pipeline); - dawnRenderPassEncoderDraw(pass, 3, 1, 0, 0); - dawnRenderPassEncoderEndPass(pass); - dawnRenderPassEncoderRelease(pass); + WGPURenderPassEncoder pass = wgpuCommandEncoderBeginRenderPass(encoder, &renderpassInfo); + wgpuRenderPassEncoderSetPipeline(pass, pipeline); + wgpuRenderPassEncoderDraw(pass, 3, 1, 0, 0); + wgpuRenderPassEncoderEndPass(pass); + wgpuRenderPassEncoderRelease(pass); - commands = dawnCommandEncoderFinish(encoder, nullptr); - dawnCommandEncoderRelease(encoder); + commands = wgpuCommandEncoderFinish(encoder, nullptr); + wgpuCommandEncoderRelease(encoder); } - dawnQueueSubmit(queue, 1, &commands); - dawnCommandBufferRelease(commands); - dawnSwapChainPresent(swapchain, backbuffer); - dawnTextureViewRelease(backbufferView); + wgpuQueueSubmit(queue, 1, &commands); + wgpuCommandBufferRelease(commands); + wgpuSwapChainPresent(swapchain, backbuffer); + wgpuTextureViewRelease(backbufferView); DoFlush(); } diff --git a/examples/ComputeBoids.cpp b/examples/ComputeBoids.cpp index 4cb95f757e..2c85a0f84c 100644 --- a/examples/ComputeBoids.cpp +++ b/examples/ComputeBoids.cpp @@ -15,8 +15,8 @@ #include "SampleUtils.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" #include "utils/SystemUtils.h" +#include "utils/WGPUHelpers.h" #include #include @@ -24,19 +24,19 @@ #include -dawn::Device device; -dawn::Queue queue; -dawn::SwapChain swapchain; -dawn::TextureView depthStencilView; +wgpu::Device device; +wgpu::Queue queue; +wgpu::SwapChain swapchain; +wgpu::TextureView depthStencilView; -dawn::Buffer modelBuffer; -std::array particleBuffers; +wgpu::Buffer modelBuffer; +std::array particleBuffers; -dawn::RenderPipeline renderPipeline; +wgpu::RenderPipeline renderPipeline; -dawn::Buffer updateParams; -dawn::ComputePipeline updatePipeline; -std::array updateBGs; +wgpu::Buffer updateParams; +wgpu::ComputePipeline updatePipeline; +std::array updateBGs; size_t pingpong = 0; @@ -65,11 +65,11 @@ void initBuffers() { {0.00, 0.02}, }; modelBuffer = - utils::CreateBufferFromData(device, model, sizeof(model), dawn::BufferUsage::Vertex); + utils::CreateBufferFromData(device, model, sizeof(model), wgpu::BufferUsage::Vertex); SimParams params = { 0.04f, 0.1f, 0.025f, 0.025f, 0.02f, 0.05f, 0.005f, kNumParticles }; updateParams = - utils::CreateBufferFromData(device, ¶ms, sizeof(params), dawn::BufferUsage::Uniform); + utils::CreateBufferFromData(device, ¶ms, sizeof(params), wgpu::BufferUsage::Uniform); std::vector initialParticles(kNumParticles); { @@ -83,10 +83,10 @@ void initBuffers() { } for (size_t i = 0; i < 2; i++) { - dawn::BufferDescriptor descriptor; + wgpu::BufferDescriptor descriptor; descriptor.size = sizeof(Particle) * kNumParticles; descriptor.usage = - dawn::BufferUsage::CopyDst | dawn::BufferUsage::Vertex | dawn::BufferUsage::Storage; + wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::Vertex | wgpu::BufferUsage::Storage; particleBuffers[i] = device.CreateBuffer(&descriptor); particleBuffers[i].SetSubData(0, @@ -96,7 +96,7 @@ void initBuffers() { } void initRender() { - dawn::ShaderModule vsModule = + wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"( #version 450 layout(location = 0) in vec2 a_particlePos; @@ -110,7 +110,7 @@ void initRender() { } )"); - dawn::ShaderModule fsModule = + wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"( #version 450 layout(location = 0) out vec4 fragColor; @@ -127,27 +127,27 @@ void initRender() { descriptor.cVertexInput.bufferCount = 2; descriptor.cVertexInput.cBuffers[0].stride = sizeof(Particle); - descriptor.cVertexInput.cBuffers[0].stepMode = dawn::InputStepMode::Instance; + descriptor.cVertexInput.cBuffers[0].stepMode = wgpu::InputStepMode::Instance; descriptor.cVertexInput.cBuffers[0].attributeCount = 2; descriptor.cVertexInput.cAttributes[0].offset = offsetof(Particle, pos); - descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float2; + descriptor.cVertexInput.cAttributes[0].format = wgpu::VertexFormat::Float2; descriptor.cVertexInput.cAttributes[1].shaderLocation = 1; descriptor.cVertexInput.cAttributes[1].offset = offsetof(Particle, vel); - descriptor.cVertexInput.cAttributes[1].format = dawn::VertexFormat::Float2; + descriptor.cVertexInput.cAttributes[1].format = wgpu::VertexFormat::Float2; descriptor.cVertexInput.cBuffers[1].stride = sizeof(glm::vec2); descriptor.cVertexInput.cBuffers[1].attributeCount = 1; descriptor.cVertexInput.cBuffers[1].attributes = &descriptor.cVertexInput.cAttributes[2]; descriptor.cVertexInput.cAttributes[2].shaderLocation = 2; - descriptor.cVertexInput.cAttributes[2].format = dawn::VertexFormat::Float2; + descriptor.cVertexInput.cAttributes[2].format = wgpu::VertexFormat::Float2; descriptor.depthStencilState = &descriptor.cDepthStencilState; - descriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8; + descriptor.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8; descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat(); renderPipeline = device.CreateRenderPipeline(&descriptor); } void initSim() { - dawn::ShaderModule module = + wgpu::ShaderModule module = utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"( #version 450 @@ -239,14 +239,14 @@ void initSim() { auto bgl = utils::MakeBindGroupLayout( device, { - {0, dawn::ShaderStage::Compute, dawn::BindingType::UniformBuffer}, - {1, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer}, - {2, dawn::ShaderStage::Compute, dawn::BindingType::StorageBuffer}, + {0, wgpu::ShaderStage::Compute, wgpu::BindingType::UniformBuffer}, + {1, wgpu::ShaderStage::Compute, wgpu::BindingType::StorageBuffer}, + {2, wgpu::ShaderStage::Compute, wgpu::BindingType::StorageBuffer}, }); - dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl); + wgpu::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl); - dawn::ComputePipelineDescriptor csDesc; + wgpu::ComputePipelineDescriptor csDesc; csDesc.layout = pl; csDesc.computeStage.module = module; csDesc.computeStage.entryPoint = "main"; @@ -261,12 +261,12 @@ void initSim() { } } -dawn::CommandBuffer createCommandBuffer(const dawn::Texture backbuffer, size_t i) { +wgpu::CommandBuffer createCommandBuffer(const wgpu::Texture backbuffer, size_t i) { auto& bufferDst = particleBuffers[(i + 1) % 2]; - dawn::CommandEncoder encoder = device.CreateCommandEncoder(); + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { - dawn::ComputePassEncoder pass = encoder.BeginComputePass(); + wgpu::ComputePassEncoder pass = encoder.BeginComputePass(); pass.SetPipeline(updatePipeline); pass.SetBindGroup(0, updateBGs[i]); pass.Dispatch(kNumParticles, 1, 1); @@ -275,7 +275,7 @@ dawn::CommandBuffer createCommandBuffer(const dawn::Texture backbuffer, size_t i { utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateView()}, depthStencilView); - dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); pass.SetPipeline(renderPipeline); pass.SetVertexBuffer(0, bufferDst); pass.SetVertexBuffer(1, modelBuffer); @@ -291,7 +291,7 @@ void init() { queue = device.CreateQueue(); swapchain = GetSwapChain(device); - swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment, + swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment, 640, 480); initBuffers(); @@ -300,9 +300,9 @@ void init() { } void frame() { - dawn::Texture backbuffer = swapchain.GetNextTexture(); + wgpu::Texture backbuffer = swapchain.GetNextTexture(); - dawn::CommandBuffer commandBuffer = createCommandBuffer(backbuffer, pingpong); + wgpu::CommandBuffer commandBuffer = createCommandBuffer(backbuffer, pingpong); queue.Submit(1, &commandBuffer); swapchain.Present(backbuffer); DoFlush(); diff --git a/examples/CppHelloTriangle.cpp b/examples/CppHelloTriangle.cpp index 2437e3a521..4a8ecffd01 100644 --- a/examples/CppHelloTriangle.cpp +++ b/examples/CppHelloTriangle.cpp @@ -15,31 +15,31 @@ #include "SampleUtils.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" #include "utils/SystemUtils.h" +#include "utils/WGPUHelpers.h" #include -dawn::Device device; +wgpu::Device device; -dawn::Buffer indexBuffer; -dawn::Buffer vertexBuffer; +wgpu::Buffer indexBuffer; +wgpu::Buffer vertexBuffer; -dawn::Texture texture; -dawn::Sampler sampler; +wgpu::Texture texture; +wgpu::Sampler sampler; -dawn::Queue queue; -dawn::SwapChain swapchain; -dawn::TextureView depthStencilView; -dawn::RenderPipeline pipeline; -dawn::BindGroup bindGroup; +wgpu::Queue queue; +wgpu::SwapChain swapchain; +wgpu::TextureView depthStencilView; +wgpu::RenderPipeline pipeline; +wgpu::BindGroup bindGroup; void initBuffers() { static const uint32_t indexData[3] = { 0, 1, 2, }; indexBuffer = - utils::CreateBufferFromData(device, indexData, sizeof(indexData), dawn::BufferUsage::Index); + utils::CreateBufferFromData(device, indexData, sizeof(indexData), wgpu::BufferUsage::Index); static const float vertexData[12] = { 0.0f, 0.5f, 0.0f, 1.0f, @@ -47,23 +47,23 @@ void initBuffers() { 0.5f, -0.5f, 0.0f, 1.0f, }; vertexBuffer = utils::CreateBufferFromData(device, vertexData, sizeof(vertexData), - dawn::BufferUsage::Vertex); + wgpu::BufferUsage::Vertex); } void initTextures() { - dawn::TextureDescriptor descriptor; - descriptor.dimension = dawn::TextureDimension::e2D; + wgpu::TextureDescriptor descriptor; + descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = 1024; descriptor.size.height = 1024; descriptor.size.depth = 1; descriptor.arrayLayerCount = 1; descriptor.sampleCount = 1; - descriptor.format = dawn::TextureFormat::RGBA8Unorm; + descriptor.format = wgpu::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1; - descriptor.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled; + descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled; texture = device.CreateTexture(&descriptor); - dawn::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor(); + wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor(); sampler = device.CreateSampler(&samplerDesc); // Initialize the texture with arbitrary data until we can load images @@ -72,16 +72,16 @@ void initTextures() { data[i] = static_cast(i % 253); } - dawn::Buffer stagingBuffer = utils::CreateBufferFromData( - device, data.data(), static_cast(data.size()), dawn::BufferUsage::CopySrc); - dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0); - dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0}); - dawn::Extent3D copySize = {1024, 1024, 1}; + wgpu::Buffer stagingBuffer = utils::CreateBufferFromData( + device, data.data(), static_cast(data.size()), wgpu::BufferUsage::CopySrc); + wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0); + wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0}); + wgpu::Extent3D copySize = {1024, 1024, 1}; - dawn::CommandEncoder encoder = device.CreateCommandEncoder(); + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size); - dawn::CommandBuffer copy = encoder.Finish(); + wgpu::CommandBuffer copy = encoder.Finish(); queue.Submit(1, ©); } @@ -90,13 +90,13 @@ void init() { queue = device.CreateQueue(); swapchain = GetSwapChain(device); - swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment, + swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment, 640, 480); initBuffers(); initTextures(); - dawn::ShaderModule vsModule = + wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"( #version 450 layout(location = 0) in vec4 pos; @@ -104,7 +104,7 @@ void init() { gl_Position = pos; })"); - dawn::ShaderModule fsModule = + wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"( #version 450 layout(set = 0, binding = 0) uniform sampler mySampler; @@ -117,11 +117,11 @@ void init() { auto bgl = utils::MakeBindGroupLayout( device, { - {0, dawn::ShaderStage::Fragment, dawn::BindingType::Sampler}, - {1, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture}, + {0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}, + {1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture}, }); - dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl); + wgpu::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl); depthStencilView = CreateDefaultDepthStencilView(device); @@ -132,14 +132,14 @@ void init() { descriptor.cVertexInput.bufferCount = 1; descriptor.cVertexInput.cBuffers[0].stride = 4 * sizeof(float); descriptor.cVertexInput.cBuffers[0].attributeCount = 1; - descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float4; + descriptor.cVertexInput.cAttributes[0].format = wgpu::VertexFormat::Float4; descriptor.depthStencilState = &descriptor.cDepthStencilState; - descriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8; + descriptor.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8; descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat(); pipeline = device.CreateRenderPipeline(&descriptor); - dawn::TextureView view = texture.CreateView(); + wgpu::TextureView view = texture.CreateView(); bindGroup = utils::MakeBindGroup(device, bgl, { {0, sampler}, @@ -153,12 +153,12 @@ void frame() { s.b += 0.02f; if (s.b >= 1.0f) {s.b = 0.0f;} - dawn::Texture backbuffer = swapchain.GetNextTexture(); + wgpu::Texture backbuffer = swapchain.GetNextTexture(); utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateView()}, depthStencilView); - dawn::CommandEncoder encoder = device.CreateCommandEncoder(); + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { - dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); pass.SetPipeline(pipeline); pass.SetBindGroup(0, bindGroup); pass.SetVertexBuffer(0, vertexBuffer); @@ -167,7 +167,7 @@ void frame() { pass.EndPass(); } - dawn::CommandBuffer commands = encoder.Finish(); + wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); swapchain.Present(backbuffer); DoFlush(); diff --git a/examples/CubeReflection.cpp b/examples/CubeReflection.cpp index ac712a6a91..8875c272c9 100644 --- a/examples/CubeReflection.cpp +++ b/examples/CubeReflection.cpp @@ -15,32 +15,32 @@ #include "SampleUtils.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" #include "utils/SystemUtils.h" +#include "utils/WGPUHelpers.h" #include #include #include #include -dawn::Device device; +wgpu::Device device; -dawn::Buffer indexBuffer; -dawn::Buffer vertexBuffer; -dawn::Buffer planeBuffer; -dawn::Buffer cameraBuffer; -dawn::Buffer transformBuffer[2]; +wgpu::Buffer indexBuffer; +wgpu::Buffer vertexBuffer; +wgpu::Buffer planeBuffer; +wgpu::Buffer cameraBuffer; +wgpu::Buffer transformBuffer[2]; -dawn::BindGroup cameraBindGroup; -dawn::BindGroup bindGroup[2]; -dawn::BindGroup cubeTransformBindGroup[2]; +wgpu::BindGroup cameraBindGroup; +wgpu::BindGroup bindGroup[2]; +wgpu::BindGroup cubeTransformBindGroup[2]; -dawn::Queue queue; -dawn::SwapChain swapchain; -dawn::TextureView depthStencilView; -dawn::RenderPipeline pipeline; -dawn::RenderPipeline planePipeline; -dawn::RenderPipeline reflectionPipeline; +wgpu::Queue queue; +wgpu::SwapChain swapchain; +wgpu::TextureView depthStencilView; +wgpu::RenderPipeline pipeline; +wgpu::RenderPipeline planePipeline; +wgpu::RenderPipeline reflectionPipeline; void initBuffers() { static const uint32_t indexData[6*6] = { @@ -63,7 +63,7 @@ void initBuffers() { 20, 22, 23 }; indexBuffer = - utils::CreateBufferFromData(device, indexData, sizeof(indexData), dawn::BufferUsage::Index); + utils::CreateBufferFromData(device, indexData, sizeof(indexData), wgpu::BufferUsage::Index); static const float vertexData[6 * 4 * 6] = { -1.0, -1.0, 1.0, 1.0, 0.0, 0.0, @@ -97,7 +97,7 @@ void initBuffers() { -1.0, 1.0, -1.0, 1.0, 1.0, 1.0 }; vertexBuffer = utils::CreateBufferFromData(device, vertexData, sizeof(vertexData), - dawn::BufferUsage::Vertex); + wgpu::BufferUsage::Vertex); static const float planeData[6 * 4] = { -2.0, -1.0, -2.0, 0.5, 0.5, 0.5, @@ -106,7 +106,7 @@ void initBuffers() { -2.0, -1.0, 2.0, 0.5, 0.5, 0.5, }; planeBuffer = utils::CreateBufferFromData(device, planeData, sizeof(planeData), - dawn::BufferUsage::Vertex); + wgpu::BufferUsage::Vertex); } struct CameraData { @@ -119,12 +119,12 @@ void init() { queue = device.CreateQueue(); swapchain = GetSwapChain(device); - swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment, + swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment, 640, 480); initBuffers(); - dawn::ShaderModule vsModule = + wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"( #version 450 layout(set = 0, binding = 0) uniform cameraData { @@ -142,7 +142,7 @@ void init() { gl_Position = camera.proj * camera.view * modelMatrix * vec4(pos, 1.0); })"); - dawn::ShaderModule fsModule = + wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"( #version 450 layout(location = 2) in vec3 f_col; @@ -151,7 +151,7 @@ void init() { fragColor = vec4(f_col, 1.0); })"); - dawn::ShaderModule fsReflectionModule = + wgpu::ShaderModule fsReflectionModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"( #version 450 layout(location = 2) in vec3 f_col; @@ -162,34 +162,34 @@ void init() { utils::ComboVertexInputDescriptor vertexInput; vertexInput.cBuffers[0].attributeCount = 2; - vertexInput.cAttributes[0].format = dawn::VertexFormat::Float3; + vertexInput.cAttributes[0].format = wgpu::VertexFormat::Float3; vertexInput.cAttributes[1].shaderLocation = 1; vertexInput.cAttributes[1].offset = 3 * sizeof(float); - vertexInput.cAttributes[1].format = dawn::VertexFormat::Float3; + vertexInput.cAttributes[1].format = wgpu::VertexFormat::Float3; vertexInput.bufferCount = 1; vertexInput.cBuffers[0].stride = 6 * sizeof(float); auto bgl = utils::MakeBindGroupLayout( device, { - {0, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer}, - {1, dawn::ShaderStage::Vertex, dawn::BindingType::UniformBuffer}, + {0, wgpu::ShaderStage::Vertex, wgpu::BindingType::UniformBuffer}, + {1, wgpu::ShaderStage::Vertex, wgpu::BindingType::UniformBuffer}, }); - dawn::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl); + wgpu::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl); - dawn::BufferDescriptor cameraBufDesc; + wgpu::BufferDescriptor cameraBufDesc; cameraBufDesc.size = sizeof(CameraData); - cameraBufDesc.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::Uniform; + cameraBufDesc.usage = wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::Uniform; cameraBuffer = device.CreateBuffer(&cameraBufDesc); glm::mat4 transform(1.0); transformBuffer[0] = utils::CreateBufferFromData(device, &transform, sizeof(glm::mat4), - dawn::BufferUsage::Uniform); + wgpu::BufferUsage::Uniform); transform = glm::translate(transform, glm::vec3(0.f, -2.f, 0.f)); transformBuffer[1] = utils::CreateBufferFromData(device, &transform, sizeof(glm::mat4), - dawn::BufferUsage::Uniform); + wgpu::BufferUsage::Uniform); bindGroup[0] = utils::MakeBindGroup(device, bgl, { {0, cameraBuffer, 0, sizeof(CameraData)}, @@ -209,10 +209,10 @@ void init() { descriptor.cFragmentStage.module = fsModule; descriptor.vertexInput = &vertexInput; descriptor.depthStencilState = &descriptor.cDepthStencilState; - descriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8; + descriptor.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8; descriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat(); descriptor.cDepthStencilState.depthWriteEnabled = true; - descriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less; + descriptor.cDepthStencilState.depthCompare = wgpu::CompareFunction::Less; pipeline = device.CreateRenderPipeline(&descriptor); @@ -222,11 +222,11 @@ void init() { pDescriptor.cFragmentStage.module = fsModule; pDescriptor.vertexInput = &vertexInput; pDescriptor.depthStencilState = &pDescriptor.cDepthStencilState; - pDescriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8; + pDescriptor.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8; pDescriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat(); - pDescriptor.cDepthStencilState.stencilFront.passOp = dawn::StencilOperation::Replace; - pDescriptor.cDepthStencilState.stencilBack.passOp = dawn::StencilOperation::Replace; - pDescriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less; + pDescriptor.cDepthStencilState.stencilFront.passOp = wgpu::StencilOperation::Replace; + pDescriptor.cDepthStencilState.stencilBack.passOp = wgpu::StencilOperation::Replace; + pDescriptor.cDepthStencilState.depthCompare = wgpu::CompareFunction::Less; planePipeline = device.CreateRenderPipeline(&pDescriptor); @@ -236,14 +236,14 @@ void init() { rfDescriptor.cFragmentStage.module = fsReflectionModule; rfDescriptor.vertexInput = &vertexInput; rfDescriptor.depthStencilState = &rfDescriptor.cDepthStencilState; - rfDescriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8; + rfDescriptor.cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8; rfDescriptor.cColorStates[0].format = GetPreferredSwapChainTextureFormat(); - rfDescriptor.cDepthStencilState.stencilFront.compare = dawn::CompareFunction::Equal; - rfDescriptor.cDepthStencilState.stencilBack.compare = dawn::CompareFunction::Equal; - rfDescriptor.cDepthStencilState.stencilFront.passOp = dawn::StencilOperation::Replace; - rfDescriptor.cDepthStencilState.stencilBack.passOp = dawn::StencilOperation::Replace; + rfDescriptor.cDepthStencilState.stencilFront.compare = wgpu::CompareFunction::Equal; + rfDescriptor.cDepthStencilState.stencilBack.compare = wgpu::CompareFunction::Equal; + rfDescriptor.cDepthStencilState.stencilFront.passOp = wgpu::StencilOperation::Replace; + rfDescriptor.cDepthStencilState.stencilBack.passOp = wgpu::StencilOperation::Replace; rfDescriptor.cDepthStencilState.depthWriteEnabled = true; - rfDescriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less; + rfDescriptor.cDepthStencilState.depthCompare = wgpu::CompareFunction::Less; reflectionPipeline = device.CreateRenderPipeline(&rfDescriptor); @@ -264,12 +264,12 @@ void frame() { cameraBuffer.SetSubData(0, sizeof(CameraData), &cameraData); - dawn::Texture backbuffer = swapchain.GetNextTexture(); + wgpu::Texture backbuffer = swapchain.GetNextTexture(); utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateView()}, depthStencilView); - dawn::CommandEncoder encoder = device.CreateCommandEncoder(); + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); { - dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass); pass.SetPipeline(pipeline); pass.SetBindGroup(0, bindGroup[0]); pass.SetVertexBuffer(0, vertexBuffer); @@ -290,7 +290,7 @@ void frame() { pass.EndPass(); } - dawn::CommandBuffer commands = encoder.Finish(); + wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); swapchain.Present(backbuffer); DoFlush(); diff --git a/examples/SampleUtils.cpp b/examples/SampleUtils.cpp index 7aa9a643aa..46d6c9a10c 100644 --- a/examples/SampleUtils.cpp +++ b/examples/SampleUtils.cpp @@ -19,10 +19,8 @@ #include "utils/BackendBinding.h" #include "utils/TerribleCommandBuffer.h" -#include #include #include -#include #include #include #include @@ -32,18 +30,18 @@ #include #include -void PrintDeviceError(DawnErrorType errorType, const char* message, void*) { +void PrintDeviceError(WGPUErrorType errorType, const char* message, void*) { switch (errorType) { - case DAWN_ERROR_TYPE_VALIDATION: + case WGPUErrorType_Validation: std::cout << "Validation "; break; - case DAWN_ERROR_TYPE_OUT_OF_MEMORY: + case WGPUErrorType_OutOfMemory: std::cout << "Out of memory "; break; - case DAWN_ERROR_TYPE_UNKNOWN: + case WGPUErrorType_Unknown: std::cout << "Unknown "; break; - case DAWN_ERROR_TYPE_DEVICE_LOST: + case WGPUErrorType_DeviceLost: std::cout << "Device lost "; break; default: @@ -88,17 +86,17 @@ static dawn_wire::WireClient* wireClient = nullptr; static utils::TerribleCommandBuffer* c2sBuf = nullptr; static utils::TerribleCommandBuffer* s2cBuf = nullptr; -dawn::Device CreateCppDawnDevice() { +wgpu::Device CreateCppDawnDevice() { glfwSetErrorCallback(PrintGLFWError); if (!glfwInit()) { - return dawn::Device(); + return wgpu::Device(); } // Create the test window and discover adapters using it (esp. for OpenGL) utils::SetupGLFWWindowHintsForBackend(backendType); window = glfwCreateWindow(640, 480, "Dawn window", nullptr, nullptr); if (!window) { - return dawn::Device(); + return wgpu::Device(); } instance = std::make_unique(); @@ -116,16 +114,16 @@ dawn::Device CreateCppDawnDevice() { backendAdapter = *adapterIt; } - DawnDevice backendDevice = backendAdapter.CreateDevice(); + WGPUDevice backendDevice = backendAdapter.CreateDevice(); DawnProcTable backendProcs = dawn_native::GetProcs(); binding = utils::CreateBinding(backendType, window, backendDevice); if (binding == nullptr) { - return dawn::Device(); + return wgpu::Device(); } // Choose whether to use the backend procs and devices directly, or set up the wire. - DawnDevice cDevice = nullptr; + WGPUDevice cDevice = nullptr; DawnProcTable procs; switch (cmdBufType) { @@ -151,7 +149,7 @@ dawn::Device CreateCppDawnDevice() { clientDesc.serializer = c2sBuf; wireClient = new dawn_wire::WireClient(clientDesc); - DawnDevice clientDevice = wireClient->GetDevice(); + WGPUDevice clientDevice = wireClient->GetDevice(); DawnProcTable clientProcs = wireClient->GetProcs(); s2cBuf->SetHandler(wireClient); @@ -163,35 +161,35 @@ dawn::Device CreateCppDawnDevice() { dawnProcSetProcs(&procs); procs.deviceSetUncapturedErrorCallback(cDevice, PrintDeviceError, nullptr); - return dawn::Device::Acquire(cDevice); + return wgpu::Device::Acquire(cDevice); } uint64_t GetSwapChainImplementation() { return binding->GetSwapChainImplementation(); } -dawn::TextureFormat GetPreferredSwapChainTextureFormat() { +wgpu::TextureFormat GetPreferredSwapChainTextureFormat() { DoFlush(); - return static_cast(binding->GetPreferredSwapChainTextureFormat()); + return static_cast(binding->GetPreferredSwapChainTextureFormat()); } -dawn::SwapChain GetSwapChain(const dawn::Device &device) { - dawn::SwapChainDescriptor swapChainDesc; +wgpu::SwapChain GetSwapChain(const wgpu::Device& device) { + wgpu::SwapChainDescriptor swapChainDesc; swapChainDesc.implementation = GetSwapChainImplementation(); return device.CreateSwapChain(&swapChainDesc); } -dawn::TextureView CreateDefaultDepthStencilView(const dawn::Device& device) { - dawn::TextureDescriptor descriptor; - descriptor.dimension = dawn::TextureDimension::e2D; +wgpu::TextureView CreateDefaultDepthStencilView(const wgpu::Device& device) { + wgpu::TextureDescriptor descriptor; + descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = 640; descriptor.size.height = 480; descriptor.size.depth = 1; descriptor.arrayLayerCount = 1; descriptor.sampleCount = 1; - descriptor.format = dawn::TextureFormat::Depth24PlusStencil8; + descriptor.format = wgpu::TextureFormat::Depth24PlusStencil8; descriptor.mipLevelCount = 1; - descriptor.usage = dawn::TextureUsage::OutputAttachment; + descriptor.usage = wgpu::TextureUsage::OutputAttachment; auto depthStencilTexture = device.CreateTexture(&descriptor); return depthStencilTexture.CreateView(); } diff --git a/examples/SampleUtils.h b/examples/SampleUtils.h index 3540109bf9..8c6fdd78a1 100644 --- a/examples/SampleUtils.h +++ b/examples/SampleUtils.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include +#include bool InitSample(int argc, const char** argv); void DoFlush(); @@ -22,8 +22,8 @@ bool ShouldQuit(); struct GLFWwindow; struct GLFWwindow* GetGLFWWindow(); -dawn::Device CreateCppDawnDevice(); +wgpu::Device CreateCppDawnDevice(); uint64_t GetSwapChainImplementation(); -dawn::TextureFormat GetPreferredSwapChainTextureFormat(); -dawn::SwapChain GetSwapChain(const dawn::Device& device); -dawn::TextureView CreateDefaultDepthStencilView(const dawn::Device& device); +wgpu::TextureFormat GetPreferredSwapChainTextureFormat(); +wgpu::SwapChain GetSwapChain(const wgpu::Device& device); +wgpu::TextureView CreateDefaultDepthStencilView(const wgpu::Device& device); diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index 12a9b84206..ccf4af6b8e 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp @@ -22,9 +22,9 @@ #include "dawn_native/DawnNative.h" #include "dawn_wire/WireClient.h" #include "dawn_wire/WireServer.h" -#include "utils/DawnHelpers.h" #include "utils/SystemUtils.h" #include "utils/TerribleCommandBuffer.h" +#include "utils/WGPUHelpers.h" #include #include diff --git a/src/tests/end2end/BasicTests.cpp b/src/tests/end2end/BasicTests.cpp index d5bb75467c..69f33237ee 100644 --- a/src/tests/end2end/BasicTests.cpp +++ b/src/tests/end2end/BasicTests.cpp @@ -14,7 +14,7 @@ #include "tests/DawnTest.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class BasicTests : public DawnTest { }; diff --git a/src/tests/end2end/BindGroupTests.cpp b/src/tests/end2end/BindGroupTests.cpp index d1ef43a5c9..c0cc1892af 100644 --- a/src/tests/end2end/BindGroupTests.cpp +++ b/src/tests/end2end/BindGroupTests.cpp @@ -17,7 +17,7 @@ #include "common/Math.h" #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" constexpr static unsigned int kRTSize = 8; diff --git a/src/tests/end2end/ClipSpaceTests.cpp b/src/tests/end2end/ClipSpaceTests.cpp index 6d5e9da9a9..e694a687e2 100644 --- a/src/tests/end2end/ClipSpaceTests.cpp +++ b/src/tests/end2end/ClipSpaceTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class ClipSpaceTest : public DawnTest { protected: diff --git a/src/tests/end2end/ColorStateTests.cpp b/src/tests/end2end/ColorStateTests.cpp index ef049b71b2..998671851a 100644 --- a/src/tests/end2end/ColorStateTests.cpp +++ b/src/tests/end2end/ColorStateTests.cpp @@ -20,7 +20,7 @@ #include "common/Assert.h" #include "common/Constants.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" constexpr static unsigned int kRTSize = 64; diff --git a/src/tests/end2end/CompressedTextureFormatTests.cpp b/src/tests/end2end/CompressedTextureFormatTests.cpp index 5f52fa69e8..797d67546b 100644 --- a/src/tests/end2end/CompressedTextureFormatTests.cpp +++ b/src/tests/end2end/CompressedTextureFormatTests.cpp @@ -18,7 +18,7 @@ #include "common/Constants.h" #include "common/Math.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" // The helper struct to configure the copies between buffers and textures. struct CopyConfig { diff --git a/src/tests/end2end/ComputeCopyStorageBufferTests.cpp b/src/tests/end2end/ComputeCopyStorageBufferTests.cpp index 0e8020a281..f2de18ceaa 100644 --- a/src/tests/end2end/ComputeCopyStorageBufferTests.cpp +++ b/src/tests/end2end/ComputeCopyStorageBufferTests.cpp @@ -14,7 +14,7 @@ #include "tests/DawnTest.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" #include diff --git a/src/tests/end2end/ComputeIndirectTests.cpp b/src/tests/end2end/ComputeIndirectTests.cpp index 1b77c00431..0d11f1edfe 100644 --- a/src/tests/end2end/ComputeIndirectTests.cpp +++ b/src/tests/end2end/ComputeIndirectTests.cpp @@ -15,7 +15,7 @@ #include "dawn/dawncpp.h" #include "tests/DawnTest.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" #include #include diff --git a/src/tests/end2end/ComputeSharedMemoryTests.cpp b/src/tests/end2end/ComputeSharedMemoryTests.cpp index 61337a6571..1657cbd451 100644 --- a/src/tests/end2end/ComputeSharedMemoryTests.cpp +++ b/src/tests/end2end/ComputeSharedMemoryTests.cpp @@ -14,7 +14,7 @@ #include "tests/DawnTest.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" #include diff --git a/src/tests/end2end/ComputeStorageBufferBarrierTests.cpp b/src/tests/end2end/ComputeStorageBufferBarrierTests.cpp index 57d42df662..6c0cf48888 100644 --- a/src/tests/end2end/ComputeStorageBufferBarrierTests.cpp +++ b/src/tests/end2end/ComputeStorageBufferBarrierTests.cpp @@ -14,7 +14,7 @@ #include "tests/DawnTest.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class ComputeStorageBufferBarrierTests : public DawnTest { protected: diff --git a/src/tests/end2end/CopyTests.cpp b/src/tests/end2end/CopyTests.cpp index 6ddc04e40c..e182b64367 100644 --- a/src/tests/end2end/CopyTests.cpp +++ b/src/tests/end2end/CopyTests.cpp @@ -17,7 +17,7 @@ #include #include "common/Constants.h" #include "common/Math.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class CopyTests : public DawnTest { protected: diff --git a/src/tests/end2end/CullingTests.cpp b/src/tests/end2end/CullingTests.cpp index b1788d7f5e..e939746dea 100644 --- a/src/tests/end2end/CullingTests.cpp +++ b/src/tests/end2end/CullingTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class CullingTest : public DawnTest { protected: diff --git a/src/tests/end2end/D3D12ResourceWrappingTests.cpp b/src/tests/end2end/D3D12ResourceWrappingTests.cpp index eed8e147b1..eef8b20ae1 100644 --- a/src/tests/end2end/D3D12ResourceWrappingTests.cpp +++ b/src/tests/end2end/D3D12ResourceWrappingTests.cpp @@ -21,7 +21,7 @@ #include "dawn_native/D3D12Backend.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" using Microsoft::WRL::ComPtr; diff --git a/src/tests/end2end/DebugMarkerTests.cpp b/src/tests/end2end/DebugMarkerTests.cpp index a40ded518c..96ac1ea16c 100644 --- a/src/tests/end2end/DebugMarkerTests.cpp +++ b/src/tests/end2end/DebugMarkerTests.cpp @@ -14,7 +14,7 @@ #include "tests/DawnTest.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class DebugMarkerTests : public DawnTest {}; diff --git a/src/tests/end2end/DepthStencilStateTests.cpp b/src/tests/end2end/DepthStencilStateTests.cpp index b798de16d9..95d922bd2c 100644 --- a/src/tests/end2end/DepthStencilStateTests.cpp +++ b/src/tests/end2end/DepthStencilStateTests.cpp @@ -16,7 +16,7 @@ #include "common/Assert.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" constexpr static unsigned int kRTSize = 64; diff --git a/src/tests/end2end/DestroyTests.cpp b/src/tests/end2end/DestroyTests.cpp index 302b89cb20..c06ed7023f 100644 --- a/src/tests/end2end/DestroyTests.cpp +++ b/src/tests/end2end/DestroyTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" constexpr uint32_t kRTSize = 4; diff --git a/src/tests/end2end/DrawIndexedIndirectTests.cpp b/src/tests/end2end/DrawIndexedIndirectTests.cpp index 759c831d87..3ba971ccca 100644 --- a/src/tests/end2end/DrawIndexedIndirectTests.cpp +++ b/src/tests/end2end/DrawIndexedIndirectTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" constexpr uint32_t kRTSize = 4; diff --git a/src/tests/end2end/DrawIndexedTests.cpp b/src/tests/end2end/DrawIndexedTests.cpp index 61a601640e..d1f2472731 100644 --- a/src/tests/end2end/DrawIndexedTests.cpp +++ b/src/tests/end2end/DrawIndexedTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" constexpr uint32_t kRTSize = 4; diff --git a/src/tests/end2end/DrawIndirectTests.cpp b/src/tests/end2end/DrawIndirectTests.cpp index 25b687f7de..97b8a7b83a 100644 --- a/src/tests/end2end/DrawIndirectTests.cpp +++ b/src/tests/end2end/DrawIndirectTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" constexpr uint32_t kRTSize = 4; diff --git a/src/tests/end2end/DrawTests.cpp b/src/tests/end2end/DrawTests.cpp index f72db587ed..6eecdbb6dd 100644 --- a/src/tests/end2end/DrawTests.cpp +++ b/src/tests/end2end/DrawTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" constexpr uint32_t kRTSize = 4; diff --git a/src/tests/end2end/DynamicBufferOffsetTests.cpp b/src/tests/end2end/DynamicBufferOffsetTests.cpp index b44ca6ef99..34e9f1cbfe 100644 --- a/src/tests/end2end/DynamicBufferOffsetTests.cpp +++ b/src/tests/end2end/DynamicBufferOffsetTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" constexpr uint32_t kRTSize = 400; constexpr uint32_t kBufferElementsCount = kMinDynamicBufferOffsetAlignment / sizeof(uint32_t) + 2; diff --git a/src/tests/end2end/IOSurfaceWrappingTests.cpp b/src/tests/end2end/IOSurfaceWrappingTests.cpp index 176c6d2b92..669192019d 100644 --- a/src/tests/end2end/IOSurfaceWrappingTests.cpp +++ b/src/tests/end2end/IOSurfaceWrappingTests.cpp @@ -16,7 +16,7 @@ #include "dawn_native/MetalBackend.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" #include #include diff --git a/src/tests/end2end/IndexFormatTests.cpp b/src/tests/end2end/IndexFormatTests.cpp index fa3710aba2..393ac08f46 100644 --- a/src/tests/end2end/IndexFormatTests.cpp +++ b/src/tests/end2end/IndexFormatTests.cpp @@ -16,7 +16,7 @@ #include "common/Assert.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" constexpr uint32_t kRTSize = 400; diff --git a/src/tests/end2end/MultisampledRenderingTests.cpp b/src/tests/end2end/MultisampledRenderingTests.cpp index 9f04cd6098..e6565aba5f 100644 --- a/src/tests/end2end/MultisampledRenderingTests.cpp +++ b/src/tests/end2end/MultisampledRenderingTests.cpp @@ -16,7 +16,7 @@ #include "common/Assert.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class MultisampledRenderingTest : public DawnTest { protected: diff --git a/src/tests/end2end/NonzeroTextureCreationTests.cpp b/src/tests/end2end/NonzeroTextureCreationTests.cpp index 13f0428122..0a31d30dd2 100644 --- a/src/tests/end2end/NonzeroTextureCreationTests.cpp +++ b/src/tests/end2end/NonzeroTextureCreationTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class NonzeroTextureCreationTests : public DawnTest { protected: diff --git a/src/tests/end2end/ObjectCachingTests.cpp b/src/tests/end2end/ObjectCachingTests.cpp index dcc86f850f..33fcddb5b1 100644 --- a/src/tests/end2end/ObjectCachingTests.cpp +++ b/src/tests/end2end/ObjectCachingTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class ObjectCachingTest : public DawnTest {}; diff --git a/src/tests/end2end/OpArrayLengthTests.cpp b/src/tests/end2end/OpArrayLengthTests.cpp index 770b97341d..d76c061087 100644 --- a/src/tests/end2end/OpArrayLengthTests.cpp +++ b/src/tests/end2end/OpArrayLengthTests.cpp @@ -16,7 +16,7 @@ #include "common/Assert.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class OpArrayLengthTest : public DawnTest { protected: diff --git a/src/tests/end2end/PrimitiveTopologyTests.cpp b/src/tests/end2end/PrimitiveTopologyTests.cpp index 7218de3e0c..bc774b95d5 100644 --- a/src/tests/end2end/PrimitiveTopologyTests.cpp +++ b/src/tests/end2end/PrimitiveTopologyTests.cpp @@ -16,7 +16,7 @@ #include "common/Assert.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" // Primitive topology tests work by drawing the following vertices with all the different primitive topology states: // ------------------------------------- diff --git a/src/tests/end2end/RenderBundleTests.cpp b/src/tests/end2end/RenderBundleTests.cpp index 831aa5972f..f8d374c47c 100644 --- a/src/tests/end2end/RenderBundleTests.cpp +++ b/src/tests/end2end/RenderBundleTests.cpp @@ -16,7 +16,7 @@ #include "utils/ComboRenderBundleEncoderDescriptor.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" constexpr uint32_t kRTSize = 4; constexpr RGBA8 kColors[2] = {RGBA8(0, 255, 0, 255), RGBA8(0, 0, 255, 255)}; diff --git a/src/tests/end2end/RenderPassLoadOpTests.cpp b/src/tests/end2end/RenderPassLoadOpTests.cpp index 9669235211..827d47fddb 100644 --- a/src/tests/end2end/RenderPassLoadOpTests.cpp +++ b/src/tests/end2end/RenderPassLoadOpTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" #include diff --git a/src/tests/end2end/RenderPassTests.cpp b/src/tests/end2end/RenderPassTests.cpp index cd3823300a..b40605697d 100644 --- a/src/tests/end2end/RenderPassTests.cpp +++ b/src/tests/end2end/RenderPassTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" constexpr uint32_t kRTSize = 16; constexpr dawn::TextureFormat kFormat = dawn::TextureFormat::RGBA8Unorm; diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp index 0497679030..a94e4ebe85 100644 --- a/src/tests/end2end/SamplerTests.cpp +++ b/src/tests/end2end/SamplerTests.cpp @@ -19,7 +19,7 @@ #include "common/Assert.h" #include "common/Constants.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" constexpr static unsigned int kRTSize = 64; diff --git a/src/tests/end2end/ScissorTests.cpp b/src/tests/end2end/ScissorTests.cpp index b7fa6130e8..25429f8ab0 100644 --- a/src/tests/end2end/ScissorTests.cpp +++ b/src/tests/end2end/ScissorTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class ScissorTest: public DawnTest { protected: diff --git a/src/tests/end2end/TextureFormatTests.cpp b/src/tests/end2end/TextureFormatTests.cpp index 5dacacae59..d985a540d6 100644 --- a/src/tests/end2end/TextureFormatTests.cpp +++ b/src/tests/end2end/TextureFormatTests.cpp @@ -17,7 +17,7 @@ #include "common/Assert.h" #include "common/Math.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" #include diff --git a/src/tests/end2end/TextureViewTests.cpp b/src/tests/end2end/TextureViewTests.cpp index 30cafbf9c5..ea2d1e2151 100644 --- a/src/tests/end2end/TextureViewTests.cpp +++ b/src/tests/end2end/TextureViewTests.cpp @@ -18,7 +18,7 @@ #include "common/Constants.h" #include "common/Math.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" #include diff --git a/src/tests/end2end/TextureZeroInitTests.cpp b/src/tests/end2end/TextureZeroInitTests.cpp index 5239438ce6..1512250a87 100644 --- a/src/tests/end2end/TextureZeroInitTests.cpp +++ b/src/tests/end2end/TextureZeroInitTests.cpp @@ -16,7 +16,7 @@ #include "common/Math.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class TextureZeroInitTest : public DawnTest { protected: diff --git a/src/tests/end2end/VertexFormatTests.cpp b/src/tests/end2end/VertexFormatTests.cpp index 4cc8e0a295..fc19081d87 100644 --- a/src/tests/end2end/VertexFormatTests.cpp +++ b/src/tests/end2end/VertexFormatTests.cpp @@ -17,7 +17,7 @@ #include "common/Assert.h" #include "common/Math.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" // Vertex format tests all work the same way: the test will render a triangle. // Each test will set up a vertex buffer, and the vertex shader will check that diff --git a/src/tests/end2end/VertexInputTests.cpp b/src/tests/end2end/VertexInputTests.cpp index 23efd6655c..42e41eaa04 100644 --- a/src/tests/end2end/VertexInputTests.cpp +++ b/src/tests/end2end/VertexInputTests.cpp @@ -16,7 +16,7 @@ #include "common/Assert.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" using dawn::InputStepMode; using dawn::VertexFormat; diff --git a/src/tests/end2end/ViewportOrientationTests.cpp b/src/tests/end2end/ViewportOrientationTests.cpp index 4f70df51a3..a7539418fe 100644 --- a/src/tests/end2end/ViewportOrientationTests.cpp +++ b/src/tests/end2end/ViewportOrientationTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class ViewportOrientationTests : public DawnTest {}; diff --git a/src/tests/end2end/ViewportTests.cpp b/src/tests/end2end/ViewportTests.cpp index 9257fe641f..2e60a46249 100644 --- a/src/tests/end2end/ViewportTests.cpp +++ b/src/tests/end2end/ViewportTests.cpp @@ -15,7 +15,7 @@ #include "tests/DawnTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class ViewportTest : public DawnTest { protected: diff --git a/src/tests/perf_tests/BufferUploadPerf.cpp b/src/tests/perf_tests/BufferUploadPerf.cpp index 8eeb1ca377..f192772683 100644 --- a/src/tests/perf_tests/BufferUploadPerf.cpp +++ b/src/tests/perf_tests/BufferUploadPerf.cpp @@ -15,7 +15,7 @@ #include "tests/perf_tests/DawnPerfTest.h" #include "tests/ParamGenerator.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" namespace { diff --git a/src/tests/unittests/validation/BindGroupValidationTests.cpp b/src/tests/unittests/validation/BindGroupValidationTests.cpp index 327fe4c125..3844b160ac 100644 --- a/src/tests/unittests/validation/BindGroupValidationTests.cpp +++ b/src/tests/unittests/validation/BindGroupValidationTests.cpp @@ -17,7 +17,7 @@ #include "common/Assert.h" #include "common/Constants.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class BindGroupValidationTest : public ValidationTest { public: diff --git a/src/tests/unittests/validation/CommandBufferValidationTests.cpp b/src/tests/unittests/validation/CommandBufferValidationTests.cpp index e78bec8390..6bdae68e92 100644 --- a/src/tests/unittests/validation/CommandBufferValidationTests.cpp +++ b/src/tests/unittests/validation/CommandBufferValidationTests.cpp @@ -14,7 +14,7 @@ #include "tests/unittests/validation/ValidationTest.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class CommandBufferValidationTest : public ValidationTest { }; diff --git a/src/tests/unittests/validation/ComputeIndirectValidationTests.cpp b/src/tests/unittests/validation/ComputeIndirectValidationTests.cpp index 202a00f304..93551ed969 100644 --- a/src/tests/unittests/validation/ComputeIndirectValidationTests.cpp +++ b/src/tests/unittests/validation/ComputeIndirectValidationTests.cpp @@ -15,7 +15,7 @@ #include #include #include "tests/unittests/validation/ValidationTest.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class ComputeIndirectValidationTest : public ValidationTest { protected: diff --git a/src/tests/unittests/validation/ComputePassValidationTests.cpp b/src/tests/unittests/validation/ComputePassValidationTests.cpp index 582f4c27a2..5560604081 100644 --- a/src/tests/unittests/validation/ComputePassValidationTests.cpp +++ b/src/tests/unittests/validation/ComputePassValidationTests.cpp @@ -14,7 +14,7 @@ #include "tests/unittests/validation/ValidationTest.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class ComputePassValidationTest : public ValidationTest {}; diff --git a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp index 8ac90fb6e3..4f6a5d20f6 100644 --- a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp +++ b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp @@ -16,7 +16,7 @@ #include "common/Constants.h" #include "common/Math.h" #include "tests/unittests/validation/ValidationTest.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class CopyCommandTest : public ValidationTest { protected: diff --git a/src/tests/unittests/validation/DebugMarkerValidationTests.cpp b/src/tests/unittests/validation/DebugMarkerValidationTests.cpp index cc0a583007..7a343dbf82 100644 --- a/src/tests/unittests/validation/DebugMarkerValidationTests.cpp +++ b/src/tests/unittests/validation/DebugMarkerValidationTests.cpp @@ -14,7 +14,7 @@ #include "tests/unittests/validation/ValidationTest.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class DebugMarkerValidationTest : public ValidationTest {}; diff --git a/src/tests/unittests/validation/DrawIndirectValidationTests.cpp b/src/tests/unittests/validation/DrawIndirectValidationTests.cpp index aa44305c3b..61818ddbb1 100644 --- a/src/tests/unittests/validation/DrawIndirectValidationTests.cpp +++ b/src/tests/unittests/validation/DrawIndirectValidationTests.cpp @@ -16,7 +16,7 @@ #include #include "tests/unittests/validation/ValidationTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class DrawIndirectValidationTest : public ValidationTest { protected: diff --git a/src/tests/unittests/validation/QueueSubmitValidationTests.cpp b/src/tests/unittests/validation/QueueSubmitValidationTests.cpp index 8d3777ba4d..0f2a2e881d 100644 --- a/src/tests/unittests/validation/QueueSubmitValidationTests.cpp +++ b/src/tests/unittests/validation/QueueSubmitValidationTests.cpp @@ -14,7 +14,7 @@ #include "tests/unittests/validation/ValidationTest.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" namespace { diff --git a/src/tests/unittests/validation/RenderBundleValidationTests.cpp b/src/tests/unittests/validation/RenderBundleValidationTests.cpp index 9e9175fde6..3c962700f8 100644 --- a/src/tests/unittests/validation/RenderBundleValidationTests.cpp +++ b/src/tests/unittests/validation/RenderBundleValidationTests.cpp @@ -18,7 +18,7 @@ #include "utils/ComboRenderBundleEncoderDescriptor.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" namespace { diff --git a/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp b/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp index bf7e67da02..6a31293930 100644 --- a/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp +++ b/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp @@ -16,7 +16,7 @@ #include "common/Constants.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" namespace { diff --git a/src/tests/unittests/validation/RenderPassValidationTests.cpp b/src/tests/unittests/validation/RenderPassValidationTests.cpp index 8197fdf58a..573a301f4d 100644 --- a/src/tests/unittests/validation/RenderPassValidationTests.cpp +++ b/src/tests/unittests/validation/RenderPassValidationTests.cpp @@ -17,7 +17,7 @@ #include "common/Constants.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" namespace { diff --git a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp index 4be8f671e4..f26a16cca4 100644 --- a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp +++ b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp @@ -16,7 +16,7 @@ #include "common/Constants.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" #include diff --git a/src/tests/unittests/validation/SamplerValidationTests.cpp b/src/tests/unittests/validation/SamplerValidationTests.cpp index 82bf2b25db..ed79f31ec0 100644 --- a/src/tests/unittests/validation/SamplerValidationTests.cpp +++ b/src/tests/unittests/validation/SamplerValidationTests.cpp @@ -14,7 +14,7 @@ #include "tests/unittests/validation/ValidationTest.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" #include diff --git a/src/tests/unittests/validation/ShaderModuleValidationTests.cpp b/src/tests/unittests/validation/ShaderModuleValidationTests.cpp index 6826ce7e64..828124f495 100644 --- a/src/tests/unittests/validation/ShaderModuleValidationTests.cpp +++ b/src/tests/unittests/validation/ShaderModuleValidationTests.cpp @@ -16,7 +16,7 @@ #include "tests/unittests/validation/ValidationTest.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" #include diff --git a/src/tests/unittests/validation/TextureValidationTests.cpp b/src/tests/unittests/validation/TextureValidationTests.cpp index baf0d8ab58..7f46602aed 100644 --- a/src/tests/unittests/validation/TextureValidationTests.cpp +++ b/src/tests/unittests/validation/TextureValidationTests.cpp @@ -16,7 +16,7 @@ #include "common/Constants.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" namespace { diff --git a/src/tests/unittests/validation/VertexBufferValidationTests.cpp b/src/tests/unittests/validation/VertexBufferValidationTests.cpp index 512c18b781..6e0ebbed49 100644 --- a/src/tests/unittests/validation/VertexBufferValidationTests.cpp +++ b/src/tests/unittests/validation/VertexBufferValidationTests.cpp @@ -17,7 +17,7 @@ #include "tests/unittests/validation/ValidationTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class VertexBufferValidationTest : public ValidationTest { protected: diff --git a/src/tests/unittests/validation/VertexInputValidationTests.cpp b/src/tests/unittests/validation/VertexInputValidationTests.cpp index 5e4600e834..2350a599f3 100644 --- a/src/tests/unittests/validation/VertexInputValidationTests.cpp +++ b/src/tests/unittests/validation/VertexInputValidationTests.cpp @@ -15,7 +15,7 @@ #include "tests/unittests/validation/ValidationTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" class VertexInputTest : public ValidationTest { protected: diff --git a/src/tests/white_box/VulkanImageWrappingTests.cpp b/src/tests/white_box/VulkanImageWrappingTests.cpp index 3c8207b951..ec5eec35a9 100644 --- a/src/tests/white_box/VulkanImageWrappingTests.cpp +++ b/src/tests/white_box/VulkanImageWrappingTests.cpp @@ -22,8 +22,8 @@ #include "dawn_native/vulkan/FencedDeleter.h" #include "dawn_native/vulkan/ResourceMemoryAllocatorVk.h" #include "dawn_native/vulkan/TextureVk.h" -#include "utils/DawnHelpers.h" #include "utils/SystemUtils.h" +#include "utils/WGPUHelpers.h" // TODO(crbug.com/966500): Intel is disabled until upgrade is finished diff --git a/src/utils/BackendBinding.cpp b/src/utils/BackendBinding.cpp index 39ec8cfb4f..54aa6078dc 100644 --- a/src/utils/BackendBinding.cpp +++ b/src/utils/BackendBinding.cpp @@ -25,22 +25,22 @@ namespace utils { #if defined(DAWN_ENABLE_BACKEND_D3D12) - BackendBinding* CreateD3D12Binding(GLFWwindow* window, DawnDevice device); + BackendBinding* CreateD3D12Binding(GLFWwindow* window, WGPUDevice device); #endif #if defined(DAWN_ENABLE_BACKEND_METAL) - BackendBinding* CreateMetalBinding(GLFWwindow* window, DawnDevice device); + BackendBinding* CreateMetalBinding(GLFWwindow* window, WGPUDevice device); #endif #if defined(DAWN_ENABLE_BACKEND_NULL) - BackendBinding* CreateNullBinding(GLFWwindow* window, DawnDevice device); + BackendBinding* CreateNullBinding(GLFWwindow* window, WGPUDevice device); #endif #if defined(DAWN_ENABLE_BACKEND_OPENGL) - BackendBinding* CreateOpenGLBinding(GLFWwindow* window, DawnDevice device); + BackendBinding* CreateOpenGLBinding(GLFWwindow* window, WGPUDevice device); #endif #if defined(DAWN_ENABLE_BACKEND_VULKAN) - BackendBinding* CreateVulkanBinding(GLFWwindow* window, DawnDevice device); + BackendBinding* CreateVulkanBinding(GLFWwindow* window, WGPUDevice device); #endif - BackendBinding::BackendBinding(GLFWwindow* window, DawnDevice device) + BackendBinding::BackendBinding(GLFWwindow* window, WGPUDevice device) : mWindow(window), mDevice(device) { } @@ -75,7 +75,7 @@ namespace utils { BackendBinding* CreateBinding(dawn_native::BackendType type, GLFWwindow* window, - DawnDevice device) { + WGPUDevice device) { switch (type) { #if defined(DAWN_ENABLE_BACKEND_D3D12) case dawn_native::BackendType::D3D12: diff --git a/src/utils/BackendBinding.h b/src/utils/BackendBinding.h index 26b8a82712..f8d35b09d6 100644 --- a/src/utils/BackendBinding.h +++ b/src/utils/BackendBinding.h @@ -15,7 +15,7 @@ #ifndef UTILS_BACKENDBINDING_H_ #define UTILS_BACKENDBINDING_H_ -#include "dawn/dawn.h" +#include "dawn/webgpu.h" #include "dawn_native/DawnNative.h" struct GLFWwindow; @@ -27,13 +27,13 @@ namespace utils { virtual ~BackendBinding() = default; virtual uint64_t GetSwapChainImplementation() = 0; - virtual DawnTextureFormat GetPreferredSwapChainTextureFormat() = 0; + virtual WGPUTextureFormat GetPreferredSwapChainTextureFormat() = 0; protected: - BackendBinding(GLFWwindow* window, DawnDevice device); + BackendBinding(GLFWwindow* window, WGPUDevice device); GLFWwindow* mWindow = nullptr; - DawnDevice mDevice = nullptr; + WGPUDevice mDevice = nullptr; }; void SetupGLFWWindowHintsForBackend(dawn_native::BackendType type); @@ -42,7 +42,7 @@ namespace utils { dawn_native::BackendType type); BackendBinding* CreateBinding(dawn_native::BackendType type, GLFWwindow* window, - DawnDevice device); + WGPUDevice device); } // namespace utils diff --git a/src/utils/ComboRenderBundleEncoderDescriptor.cpp b/src/utils/ComboRenderBundleEncoderDescriptor.cpp index 82427379ed..8b076e11d9 100644 --- a/src/utils/ComboRenderBundleEncoderDescriptor.cpp +++ b/src/utils/ComboRenderBundleEncoderDescriptor.cpp @@ -14,12 +14,12 @@ #include "utils/ComboRenderBundleEncoderDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" namespace utils { ComboRenderBundleEncoderDescriptor::ComboRenderBundleEncoderDescriptor() { - dawn::RenderBundleEncoderDescriptor* descriptor = this; + wgpu::RenderBundleEncoderDescriptor* descriptor = this; descriptor->colorFormatsCount = 0; descriptor->colorFormats = &cColorFormats[0]; diff --git a/src/utils/ComboRenderBundleEncoderDescriptor.h b/src/utils/ComboRenderBundleEncoderDescriptor.h index dbf833583d..cd6044b59e 100644 --- a/src/utils/ComboRenderBundleEncoderDescriptor.h +++ b/src/utils/ComboRenderBundleEncoderDescriptor.h @@ -15,7 +15,7 @@ #ifndef UTILS_COMBORENDERBUNDLEENCODERDESCRIPTOR_H_ #define UTILS_COMBORENDERBUNDLEENCODERDESCRIPTOR_H_ -#include +#include #include "common/Constants.h" @@ -23,11 +23,11 @@ namespace utils { - class ComboRenderBundleEncoderDescriptor : public dawn::RenderBundleEncoderDescriptor { + class ComboRenderBundleEncoderDescriptor : public wgpu::RenderBundleEncoderDescriptor { public: ComboRenderBundleEncoderDescriptor(); - std::array cColorFormats; + std::array cColorFormats; }; } // namespace utils diff --git a/src/utils/ComboRenderPipelineDescriptor.cpp b/src/utils/ComboRenderPipelineDescriptor.cpp index 66be4dee0a..072e216389 100644 --- a/src/utils/ComboRenderPipelineDescriptor.cpp +++ b/src/utils/ComboRenderPipelineDescriptor.cpp @@ -14,27 +14,27 @@ #include "utils/ComboRenderPipelineDescriptor.h" -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" namespace utils { ComboVertexInputDescriptor::ComboVertexInputDescriptor() { - dawn::VertexInputDescriptor* descriptor = this; + wgpu::VertexInputDescriptor* descriptor = this; - descriptor->indexFormat = dawn::IndexFormat::Uint32; + descriptor->indexFormat = wgpu::IndexFormat::Uint32; descriptor->bufferCount = 0; // Fill the default values for vertexBuffers and vertexAttributes in buffers. - dawn::VertexAttributeDescriptor vertexAttribute; + wgpu::VertexAttributeDescriptor vertexAttribute; vertexAttribute.shaderLocation = 0; vertexAttribute.offset = 0; - vertexAttribute.format = dawn::VertexFormat::Float; + vertexAttribute.format = wgpu::VertexFormat::Float; for (uint32_t i = 0; i < kMaxVertexAttributes; ++i) { cAttributes[i] = vertexAttribute; } for (uint32_t i = 0; i < kMaxVertexBuffers; ++i) { cBuffers[i].stride = 0; - cBuffers[i].stepMode = dawn::InputStepMode::Vertex; + cBuffers[i].stepMode = wgpu::InputStepMode::Vertex; cBuffers[i].attributeCount = 0; cBuffers[i].attributes = nullptr; } @@ -46,10 +46,10 @@ namespace utils { descriptor->buffers = &cBuffers[0]; } - ComboRenderPipelineDescriptor::ComboRenderPipelineDescriptor(const dawn::Device& device) { - dawn::RenderPipelineDescriptor* descriptor = this; + ComboRenderPipelineDescriptor::ComboRenderPipelineDescriptor(const wgpu::Device& device) { + wgpu::RenderPipelineDescriptor* descriptor = this; - descriptor->primitiveTopology = dawn::PrimitiveTopology::TriangleList; + descriptor->primitiveTopology = wgpu::PrimitiveTopology::TriangleList; descriptor->sampleCount = 1; // Set defaults for the vertex stage descriptor. @@ -66,8 +66,8 @@ namespace utils { // Set defaults for the rasterization state descriptor. { - cRasterizationState.frontFace = dawn::FrontFace::CCW; - cRasterizationState.cullMode = dawn::CullMode::None; + cRasterizationState.frontFace = wgpu::FrontFace::CCW; + cRasterizationState.cullMode = wgpu::CullMode::None; cRasterizationState.depthBias = 0; cRasterizationState.depthBiasSlopeScale = 0.0; @@ -80,15 +80,15 @@ namespace utils { descriptor->colorStateCount = 1; descriptor->colorStates = cColorStates.data(); - dawn::BlendDescriptor blend; - blend.operation = dawn::BlendOperation::Add; - blend.srcFactor = dawn::BlendFactor::One; - blend.dstFactor = dawn::BlendFactor::Zero; - dawn::ColorStateDescriptor colorStateDescriptor; - colorStateDescriptor.format = dawn::TextureFormat::RGBA8Unorm; + wgpu::BlendDescriptor blend; + blend.operation = wgpu::BlendOperation::Add; + blend.srcFactor = wgpu::BlendFactor::One; + blend.dstFactor = wgpu::BlendFactor::Zero; + wgpu::ColorStateDescriptor colorStateDescriptor; + colorStateDescriptor.format = wgpu::TextureFormat::RGBA8Unorm; colorStateDescriptor.alphaBlend = blend; colorStateDescriptor.colorBlend = blend; - colorStateDescriptor.writeMask = dawn::ColorWriteMask::All; + colorStateDescriptor.writeMask = wgpu::ColorWriteMask::All; for (uint32_t i = 0; i < kMaxColorAttachments; ++i) { cColorStates[i] = colorStateDescriptor; } @@ -96,15 +96,15 @@ namespace utils { // Set defaults for the depth stencil state descriptors. { - dawn::StencilStateFaceDescriptor stencilFace; - stencilFace.compare = dawn::CompareFunction::Always; - stencilFace.failOp = dawn::StencilOperation::Keep; - stencilFace.depthFailOp = dawn::StencilOperation::Keep; - stencilFace.passOp = dawn::StencilOperation::Keep; + wgpu::StencilStateFaceDescriptor stencilFace; + stencilFace.compare = wgpu::CompareFunction::Always; + stencilFace.failOp = wgpu::StencilOperation::Keep; + stencilFace.depthFailOp = wgpu::StencilOperation::Keep; + stencilFace.passOp = wgpu::StencilOperation::Keep; - cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8; + cDepthStencilState.format = wgpu::TextureFormat::Depth24PlusStencil8; cDepthStencilState.depthWriteEnabled = false; - cDepthStencilState.depthCompare = dawn::CompareFunction::Always; + cDepthStencilState.depthCompare = wgpu::CompareFunction::Always; cDepthStencilState.stencilBack = stencilFace; cDepthStencilState.stencilFront = stencilFace; cDepthStencilState.stencilReadMask = 0xff; diff --git a/src/utils/ComboRenderPipelineDescriptor.h b/src/utils/ComboRenderPipelineDescriptor.h index 2be2f0ac92..178f8adbab 100644 --- a/src/utils/ComboRenderPipelineDescriptor.h +++ b/src/utils/ComboRenderPipelineDescriptor.h @@ -15,7 +15,7 @@ #ifndef UTILS_COMBORENDERPIPELINEDESCRIPTOR_H_ #define UTILS_COMBORENDERPIPELINEDESCRIPTOR_H_ -#include +#include #include "common/Constants.h" @@ -23,29 +23,29 @@ namespace utils { - class ComboVertexInputDescriptor : public dawn::VertexInputDescriptor { + class ComboVertexInputDescriptor : public wgpu::VertexInputDescriptor { public: ComboVertexInputDescriptor(); - std::array cBuffers; - std::array cAttributes; + std::array cBuffers; + std::array cAttributes; }; - class ComboRenderPipelineDescriptor : public dawn::RenderPipelineDescriptor { + class ComboRenderPipelineDescriptor : public wgpu::RenderPipelineDescriptor { public: - ComboRenderPipelineDescriptor(const dawn::Device& device); + ComboRenderPipelineDescriptor(const wgpu::Device& device); ComboRenderPipelineDescriptor(const ComboRenderPipelineDescriptor&) = delete; ComboRenderPipelineDescriptor& operator=(const ComboRenderPipelineDescriptor&) = delete; ComboRenderPipelineDescriptor(ComboRenderPipelineDescriptor&&) = delete; ComboRenderPipelineDescriptor& operator=(ComboRenderPipelineDescriptor&&) = delete; - dawn::ProgrammableStageDescriptor cFragmentStage; + wgpu::ProgrammableStageDescriptor cFragmentStage; ComboVertexInputDescriptor cVertexInput; - dawn::RasterizationStateDescriptor cRasterizationState; - std::array cColorStates; - dawn::DepthStencilStateDescriptor cDepthStencilState; + wgpu::RasterizationStateDescriptor cRasterizationState; + std::array cColorStates; + wgpu::DepthStencilStateDescriptor cDepthStencilState; }; } // namespace utils diff --git a/src/utils/D3D12Binding.cpp b/src/utils/D3D12Binding.cpp index b2f48809b5..1708b14782 100644 --- a/src/utils/D3D12Binding.cpp +++ b/src/utils/D3D12Binding.cpp @@ -27,7 +27,7 @@ namespace utils { class D3D12Binding : public BackendBinding { public: - D3D12Binding(GLFWwindow* window, DawnDevice device) : BackendBinding(window, device) { + D3D12Binding(GLFWwindow* window, WGPUDevice device) : BackendBinding(window, device) { } uint64_t GetSwapChainImplementation() override { @@ -39,7 +39,7 @@ namespace utils { return reinterpret_cast(&mSwapchainImpl); } - DawnTextureFormat GetPreferredSwapChainTextureFormat() override { + WGPUTextureFormat GetPreferredSwapChainTextureFormat() override { ASSERT(mSwapchainImpl.userData != nullptr); return dawn_native::d3d12::GetNativeSwapChainPreferredFormat(&mSwapchainImpl); } @@ -48,7 +48,7 @@ namespace utils { DawnSwapChainImplementation mSwapchainImpl = {}; }; - BackendBinding* CreateD3D12Binding(GLFWwindow* window, DawnDevice device) { + BackendBinding* CreateD3D12Binding(GLFWwindow* window, WGPUDevice device) { return new D3D12Binding(window, device); } diff --git a/src/utils/MetalBinding.mm b/src/utils/MetalBinding.mm index 0dbdb4d738..d8875d54e2 100644 --- a/src/utils/MetalBinding.mm +++ b/src/utils/MetalBinding.mm @@ -42,11 +42,11 @@ namespace utils { mCommandQueue = ctx->queue; } - DawnSwapChainError Configure(DawnTextureFormat format, - DawnTextureUsage usage, + DawnSwapChainError Configure(WGPUTextureFormat format, + WGPUTextureUsage usage, uint32_t width, uint32_t height) { - if (format != DAWN_TEXTURE_FORMAT_BGRA8_UNORM) { + if (format != WGPUTextureFormat_BGRA8Unorm) { return "unsupported format"; } ASSERT(width > 0); @@ -65,7 +65,7 @@ namespace utils { [mLayer setDrawableSize:size]; constexpr uint32_t kFramebufferOnlyTextureUsages = - DAWN_TEXTURE_USAGE_OUTPUT_ATTACHMENT | DAWN_TEXTURE_USAGE_PRESENT; + WGPUTextureUsage_OutputAttachment | WGPUTextureUsage_Present; bool hasOnlyFramebufferUsages = !(usage & (~kFramebufferOnlyTextureUsages)); if (hasOnlyFramebufferUsages) { [mLayer setFramebufferOnly:YES]; @@ -110,7 +110,7 @@ namespace utils { class MetalBinding : public BackendBinding { public: - MetalBinding(GLFWwindow* window, DawnDevice device) : BackendBinding(window, device) { + MetalBinding(GLFWwindow* window, WGPUDevice device) : BackendBinding(window, device) { } uint64_t GetSwapChainImplementation() override { @@ -121,15 +121,15 @@ namespace utils { return reinterpret_cast(&mSwapchainImpl); } - DawnTextureFormat GetPreferredSwapChainTextureFormat() override { - return DAWN_TEXTURE_FORMAT_BGRA8_UNORM; + WGPUTextureFormat GetPreferredSwapChainTextureFormat() override { + return WGPUTextureFormat_BGRA8Unorm; } private: DawnSwapChainImplementation mSwapchainImpl = {}; }; - BackendBinding* CreateMetalBinding(GLFWwindow* window, DawnDevice device) { + BackendBinding* CreateMetalBinding(GLFWwindow* window, WGPUDevice device) { return new MetalBinding(window, device); } } diff --git a/src/utils/NullBinding.cpp b/src/utils/NullBinding.cpp index da268e5d78..f47b81c674 100644 --- a/src/utils/NullBinding.cpp +++ b/src/utils/NullBinding.cpp @@ -23,7 +23,7 @@ namespace utils { class NullBinding : public BackendBinding { public: - NullBinding(GLFWwindow* window, DawnDevice device) : BackendBinding(window, device) { + NullBinding(GLFWwindow* window, WGPUDevice device) : BackendBinding(window, device) { } uint64_t GetSwapChainImplementation() override { @@ -32,15 +32,15 @@ namespace utils { } return reinterpret_cast(&mSwapchainImpl); } - DawnTextureFormat GetPreferredSwapChainTextureFormat() override { - return DAWN_TEXTURE_FORMAT_RGBA8_UNORM; + WGPUTextureFormat GetPreferredSwapChainTextureFormat() override { + return WGPUTextureFormat_RGBA8Unorm; } private: DawnSwapChainImplementation mSwapchainImpl = {}; }; - BackendBinding* CreateNullBinding(GLFWwindow* window, DawnDevice device) { + BackendBinding* CreateNullBinding(GLFWwindow* window, WGPUDevice device) { return new NullBinding(window, device); } diff --git a/src/utils/OpenGLBinding.cpp b/src/utils/OpenGLBinding.cpp index 4a20e5d4c3..f48f426c7c 100644 --- a/src/utils/OpenGLBinding.cpp +++ b/src/utils/OpenGLBinding.cpp @@ -27,7 +27,7 @@ namespace utils { class OpenGLBinding : public BackendBinding { public: - OpenGLBinding(GLFWwindow* window, DawnDevice device) : BackendBinding(window, device) { + OpenGLBinding(GLFWwindow* window, WGPUDevice device) : BackendBinding(window, device) { } uint64_t GetSwapChainImplementation() override { @@ -40,7 +40,7 @@ namespace utils { return reinterpret_cast(&mSwapchainImpl); } - DawnTextureFormat GetPreferredSwapChainTextureFormat() override { + WGPUTextureFormat GetPreferredSwapChainTextureFormat() override { return dawn_native::opengl::GetNativeSwapChainPreferredFormat(&mSwapchainImpl); } @@ -48,7 +48,7 @@ namespace utils { DawnSwapChainImplementation mSwapchainImpl = {}; }; - BackendBinding* CreateOpenGLBinding(GLFWwindow* window, DawnDevice device) { + BackendBinding* CreateOpenGLBinding(GLFWwindow* window, WGPUDevice device) { return new OpenGLBinding(window, device); } diff --git a/src/utils/VulkanBinding.cpp b/src/utils/VulkanBinding.cpp index 61386a4eb1..577c3bce6b 100644 --- a/src/utils/VulkanBinding.cpp +++ b/src/utils/VulkanBinding.cpp @@ -26,7 +26,7 @@ namespace utils { class VulkanBinding : public BackendBinding { public: - VulkanBinding(GLFWwindow* window, DawnDevice device) : BackendBinding(window, device) { + VulkanBinding(GLFWwindow* window, WGPUDevice device) : BackendBinding(window, device) { } uint64_t GetSwapChainImplementation() override { @@ -41,7 +41,7 @@ namespace utils { } return reinterpret_cast(&mSwapchainImpl); } - DawnTextureFormat GetPreferredSwapChainTextureFormat() override { + WGPUTextureFormat GetPreferredSwapChainTextureFormat() override { ASSERT(mSwapchainImpl.userData != nullptr); return dawn_native::vulkan::GetNativeSwapChainPreferredFormat(&mSwapchainImpl); } @@ -50,7 +50,7 @@ namespace utils { DawnSwapChainImplementation mSwapchainImpl = {}; }; - BackendBinding* CreateVulkanBinding(GLFWwindow* window, DawnDevice device) { + BackendBinding* CreateVulkanBinding(GLFWwindow* window, WGPUDevice device) { return new VulkanBinding(window, device); } diff --git a/src/utils/DawnHelpers.cpp b/src/utils/WGPUHelpers.cpp similarity index 74% rename from src/utils/DawnHelpers.cpp rename to src/utils/WGPUHelpers.cpp index 1ad9adf09e..dcf8a2baad 100644 --- a/src/utils/DawnHelpers.cpp +++ b/src/utils/WGPUHelpers.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "utils/DawnHelpers.h" +#include "utils/WGPUHelpers.h" #include "common/Assert.h" #include "common/Constants.h" @@ -41,8 +41,8 @@ namespace utils { } } - dawn::ShaderModule CreateShaderModuleFromResult( - const dawn::Device& device, + wgpu::ShaderModule CreateShaderModuleFromResult( + const wgpu::Device& device, const shaderc::SpvCompilationResult& result) { // result.cend and result.cbegin return pointers to uint32_t. const uint32_t* resultBegin = result.cbegin(); @@ -51,7 +51,7 @@ namespace utils { ptrdiff_t resultSize = resultEnd - resultBegin; // SetSource takes data as uint32_t*. - dawn::ShaderModuleDescriptor descriptor; + wgpu::ShaderModuleDescriptor descriptor; descriptor.codeSize = static_cast(resultSize); descriptor.code = result.cbegin(); return device.CreateShaderModule(&descriptor); @@ -59,7 +59,7 @@ namespace utils { } // anonymous namespace - dawn::ShaderModule CreateShaderModule(const dawn::Device& device, + wgpu::ShaderModule CreateShaderModule(const wgpu::Device& device, SingleShaderStage stage, const char* source) { shaderc_shader_kind kind = ShadercShaderKind(stage); @@ -102,7 +102,7 @@ namespace utils { return CreateShaderModuleFromResult(device, result); } - dawn::ShaderModule CreateShaderModuleFromASM(const dawn::Device& device, const char* source) { + wgpu::ShaderModule CreateShaderModuleFromASM(const wgpu::Device& device, const char* source) { shaderc::Compiler compiler; shaderc::SpvCompilationResult result = compiler.AssembleToSpv(source, strlen(source)); if (result.GetCompilationStatus() != shaderc_compilation_status_success) { @@ -113,38 +113,38 @@ namespace utils { return CreateShaderModuleFromResult(device, result); } - dawn::Buffer CreateBufferFromData(const dawn::Device& device, + wgpu::Buffer CreateBufferFromData(const wgpu::Device& device, const void* data, uint64_t size, - dawn::BufferUsage usage) { - dawn::BufferDescriptor descriptor; + wgpu::BufferUsage usage) { + wgpu::BufferDescriptor descriptor; descriptor.size = size; - descriptor.usage = usage | dawn::BufferUsage::CopyDst; + descriptor.usage = usage | wgpu::BufferUsage::CopyDst; - dawn::Buffer buffer = device.CreateBuffer(&descriptor); + wgpu::Buffer buffer = device.CreateBuffer(&descriptor); buffer.SetSubData(0, size, data); return buffer; } ComboRenderPassDescriptor::ComboRenderPassDescriptor( - std::initializer_list colorAttachmentInfo, - dawn::TextureView depthStencil) { + std::initializer_list colorAttachmentInfo, + wgpu::TextureView depthStencil) { for (uint32_t i = 0; i < kMaxColorAttachments; ++i) { - cColorAttachments[i].loadOp = dawn::LoadOp::Clear; - cColorAttachments[i].storeOp = dawn::StoreOp::Store; + cColorAttachments[i].loadOp = wgpu::LoadOp::Clear; + cColorAttachments[i].storeOp = wgpu::StoreOp::Store; cColorAttachments[i].clearColor = {0.0f, 0.0f, 0.0f, 0.0f}; } cDepthStencilAttachmentInfo.clearDepth = 1.0f; cDepthStencilAttachmentInfo.clearStencil = 0; - cDepthStencilAttachmentInfo.depthLoadOp = dawn::LoadOp::Clear; - cDepthStencilAttachmentInfo.depthStoreOp = dawn::StoreOp::Store; - cDepthStencilAttachmentInfo.stencilLoadOp = dawn::LoadOp::Clear; - cDepthStencilAttachmentInfo.stencilStoreOp = dawn::StoreOp::Store; + cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Clear; + cDepthStencilAttachmentInfo.depthStoreOp = wgpu::StoreOp::Store; + cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Clear; + cDepthStencilAttachmentInfo.stencilStoreOp = wgpu::StoreOp::Store; colorAttachmentCount = static_cast(colorAttachmentInfo.size()); uint32_t colorAttachmentIndex = 0; - for (const dawn::TextureView& colorAttachment : colorAttachmentInfo) { + for (const wgpu::TextureView& colorAttachment : colorAttachmentInfo) { if (colorAttachment.Get() != nullptr) { cColorAttachments[colorAttachmentIndex].attachment = colorAttachment; } @@ -182,14 +182,14 @@ namespace utils { : width(0), height(0), color(nullptr), - colorFormat(dawn::TextureFormat::RGBA8Unorm), + colorFormat(wgpu::TextureFormat::RGBA8Unorm), renderPassInfo({}) { } BasicRenderPass::BasicRenderPass(uint32_t texWidth, uint32_t texHeight, - dawn::Texture colorAttachment, - dawn::TextureFormat textureFormat) + wgpu::Texture colorAttachment, + wgpu::TextureFormat textureFormat) : width(texWidth), height(texHeight), color(colorAttachment), @@ -197,13 +197,13 @@ namespace utils { renderPassInfo({colorAttachment.CreateView()}) { } - BasicRenderPass CreateBasicRenderPass(const dawn::Device& device, + BasicRenderPass CreateBasicRenderPass(const wgpu::Device& device, uint32_t width, uint32_t height) { DAWN_ASSERT(width > 0 && height > 0); - dawn::TextureDescriptor descriptor; - descriptor.dimension = dawn::TextureDimension::e2D; + wgpu::TextureDescriptor descriptor; + descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = width; descriptor.size.height = height; descriptor.size.depth = 1; @@ -211,17 +211,17 @@ namespace utils { descriptor.sampleCount = 1; descriptor.format = BasicRenderPass::kDefaultColorFormat; descriptor.mipLevelCount = 1; - descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc; - dawn::Texture color = device.CreateTexture(&descriptor); + descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc; + wgpu::Texture color = device.CreateTexture(&descriptor); return BasicRenderPass(width, height, color); } - dawn::BufferCopyView CreateBufferCopyView(dawn::Buffer buffer, + wgpu::BufferCopyView CreateBufferCopyView(wgpu::Buffer buffer, uint64_t offset, uint32_t rowPitch, uint32_t imageHeight) { - dawn::BufferCopyView bufferCopyView; + wgpu::BufferCopyView bufferCopyView; bufferCopyView.buffer = buffer; bufferCopyView.offset = offset; bufferCopyView.rowPitch = rowPitch; @@ -230,11 +230,11 @@ namespace utils { return bufferCopyView; } - dawn::TextureCopyView CreateTextureCopyView(dawn::Texture texture, + wgpu::TextureCopyView CreateTextureCopyView(wgpu::Texture texture, uint32_t mipLevel, uint32_t arrayLayer, - dawn::Origin3D origin) { - dawn::TextureCopyView textureCopyView; + wgpu::Origin3D origin) { + wgpu::TextureCopyView textureCopyView; textureCopyView.texture = texture; textureCopyView.mipLevel = mipLevel; textureCopyView.arrayLayer = arrayLayer; @@ -243,25 +243,25 @@ namespace utils { return textureCopyView; } - dawn::SamplerDescriptor GetDefaultSamplerDescriptor() { - dawn::SamplerDescriptor desc; + wgpu::SamplerDescriptor GetDefaultSamplerDescriptor() { + wgpu::SamplerDescriptor desc; - desc.minFilter = dawn::FilterMode::Linear; - desc.magFilter = dawn::FilterMode::Linear; - desc.mipmapFilter = dawn::FilterMode::Linear; - desc.addressModeU = dawn::AddressMode::Repeat; - desc.addressModeV = dawn::AddressMode::Repeat; - desc.addressModeW = dawn::AddressMode::Repeat; + desc.minFilter = wgpu::FilterMode::Linear; + desc.magFilter = wgpu::FilterMode::Linear; + desc.mipmapFilter = wgpu::FilterMode::Linear; + desc.addressModeU = wgpu::AddressMode::Repeat; + desc.addressModeV = wgpu::AddressMode::Repeat; + desc.addressModeW = wgpu::AddressMode::Repeat; desc.lodMinClamp = kLodMin; desc.lodMaxClamp = kLodMax; - desc.compare = dawn::CompareFunction::Never; + desc.compare = wgpu::CompareFunction::Never; return desc; } - dawn::PipelineLayout MakeBasicPipelineLayout(const dawn::Device& device, - const dawn::BindGroupLayout* bindGroupLayout) { - dawn::PipelineLayoutDescriptor descriptor; + wgpu::PipelineLayout MakeBasicPipelineLayout(const wgpu::Device& device, + const wgpu::BindGroupLayout* bindGroupLayout) { + wgpu::PipelineLayoutDescriptor descriptor; if (bindGroupLayout != nullptr) { descriptor.bindGroupLayoutCount = 1; descriptor.bindGroupLayouts = bindGroupLayout; @@ -272,43 +272,43 @@ namespace utils { return device.CreatePipelineLayout(&descriptor); } - dawn::BindGroupLayout MakeBindGroupLayout( - const dawn::Device& device, - std::initializer_list bindingsInitializer) { - constexpr dawn::ShaderStage kNoStages{}; + wgpu::BindGroupLayout MakeBindGroupLayout( + const wgpu::Device& device, + std::initializer_list bindingsInitializer) { + constexpr wgpu::ShaderStage kNoStages{}; - std::vector bindings; - for (const dawn::BindGroupLayoutBinding& binding : bindingsInitializer) { + std::vector bindings; + for (const wgpu::BindGroupLayoutBinding& binding : bindingsInitializer) { if (binding.visibility != kNoStages) { bindings.push_back(binding); } } - dawn::BindGroupLayoutDescriptor descriptor; + wgpu::BindGroupLayoutDescriptor descriptor; descriptor.bindingCount = static_cast(bindings.size()); descriptor.bindings = bindings.data(); return device.CreateBindGroupLayout(&descriptor); } BindingInitializationHelper::BindingInitializationHelper(uint32_t binding, - const dawn::Sampler& sampler) + const wgpu::Sampler& sampler) : binding(binding), sampler(sampler) { } BindingInitializationHelper::BindingInitializationHelper(uint32_t binding, - const dawn::TextureView& textureView) + const wgpu::TextureView& textureView) : binding(binding), textureView(textureView) { } BindingInitializationHelper::BindingInitializationHelper(uint32_t binding, - const dawn::Buffer& buffer, + const wgpu::Buffer& buffer, uint64_t offset, uint64_t size) : binding(binding), buffer(buffer), offset(offset), size(size) { } - dawn::BindGroupBinding BindingInitializationHelper::GetAsBinding() const { - dawn::BindGroupBinding result; + wgpu::BindGroupBinding BindingInitializationHelper::GetAsBinding() const { + wgpu::BindGroupBinding result; result.binding = binding; result.sampler = sampler; @@ -320,16 +320,16 @@ namespace utils { return result; } - dawn::BindGroup MakeBindGroup( - const dawn::Device& device, - const dawn::BindGroupLayout& layout, + wgpu::BindGroup MakeBindGroup( + const wgpu::Device& device, + const wgpu::BindGroupLayout& layout, std::initializer_list bindingsInitializer) { - std::vector bindings; + std::vector bindings; for (const BindingInitializationHelper& helper : bindingsInitializer) { bindings.push_back(helper.GetAsBinding()); } - dawn::BindGroupDescriptor descriptor; + wgpu::BindGroupDescriptor descriptor; descriptor.layout = layout; descriptor.bindingCount = bindings.size(); descriptor.bindings = bindings.data(); diff --git a/src/utils/DawnHelpers.h b/src/utils/WGPUHelpers.h similarity index 61% rename from src/utils/DawnHelpers.h rename to src/utils/WGPUHelpers.h index 337ae8508c..643016631f 100644 --- a/src/utils/DawnHelpers.h +++ b/src/utils/WGPUHelpers.h @@ -15,7 +15,7 @@ #ifndef UTILS_DAWNHELPERS_H_ #define UTILS_DAWNHELPERS_H_ -#include +#include #include #include @@ -28,42 +28,42 @@ namespace utils { enum class SingleShaderStage { Vertex, Fragment, Compute }; - dawn::ShaderModule CreateShaderModule(const dawn::Device& device, + wgpu::ShaderModule CreateShaderModule(const wgpu::Device& device, SingleShaderStage stage, const char* source); - dawn::ShaderModule CreateShaderModuleFromASM(const dawn::Device& device, const char* source); + wgpu::ShaderModule CreateShaderModuleFromASM(const wgpu::Device& device, const char* source); - dawn::Buffer CreateBufferFromData(const dawn::Device& device, + wgpu::Buffer CreateBufferFromData(const wgpu::Device& device, const void* data, uint64_t size, - dawn::BufferUsage usage); + wgpu::BufferUsage usage); template - dawn::Buffer CreateBufferFromData(const dawn::Device& device, - dawn::BufferUsage usage, + wgpu::Buffer CreateBufferFromData(const wgpu::Device& device, + wgpu::BufferUsage usage, std::initializer_list data) { return CreateBufferFromData(device, data.begin(), uint32_t(sizeof(T) * data.size()), usage); } - dawn::BufferCopyView CreateBufferCopyView(dawn::Buffer buffer, + wgpu::BufferCopyView CreateBufferCopyView(wgpu::Buffer buffer, uint64_t offset, uint32_t rowPitch, uint32_t imageHeight); - dawn::TextureCopyView CreateTextureCopyView(dawn::Texture texture, + wgpu::TextureCopyView CreateTextureCopyView(wgpu::Texture texture, uint32_t level, uint32_t slice, - dawn::Origin3D origin); + wgpu::Origin3D origin); - struct ComboRenderPassDescriptor : public dawn::RenderPassDescriptor { + struct ComboRenderPassDescriptor : public wgpu::RenderPassDescriptor { public: - ComboRenderPassDescriptor(std::initializer_list colorAttachmentInfo, - dawn::TextureView depthStencil = dawn::TextureView()); + ComboRenderPassDescriptor(std::initializer_list colorAttachmentInfo, + wgpu::TextureView depthStencil = wgpu::TextureView()); const ComboRenderPassDescriptor& operator=( const ComboRenderPassDescriptor& otherRenderPass); - std::array + std::array cColorAttachments; - dawn::RenderPassDepthStencilAttachmentDescriptor cDepthStencilAttachmentInfo; + wgpu::RenderPassDepthStencilAttachmentDescriptor cDepthStencilAttachmentInfo; }; struct BasicRenderPass { @@ -71,27 +71,27 @@ namespace utils { BasicRenderPass(); BasicRenderPass(uint32_t width, uint32_t height, - dawn::Texture color, - dawn::TextureFormat texture = kDefaultColorFormat); + wgpu::Texture color, + wgpu::TextureFormat texture = kDefaultColorFormat); - static constexpr dawn::TextureFormat kDefaultColorFormat = dawn::TextureFormat::RGBA8Unorm; + static constexpr wgpu::TextureFormat kDefaultColorFormat = wgpu::TextureFormat::RGBA8Unorm; uint32_t width; uint32_t height; - dawn::Texture color; - dawn::TextureFormat colorFormat; + wgpu::Texture color; + wgpu::TextureFormat colorFormat; utils::ComboRenderPassDescriptor renderPassInfo; }; - BasicRenderPass CreateBasicRenderPass(const dawn::Device& device, + BasicRenderPass CreateBasicRenderPass(const wgpu::Device& device, uint32_t width, uint32_t height); - dawn::SamplerDescriptor GetDefaultSamplerDescriptor(); - dawn::PipelineLayout MakeBasicPipelineLayout(const dawn::Device& device, - const dawn::BindGroupLayout* bindGroupLayout); - dawn::BindGroupLayout MakeBindGroupLayout( - const dawn::Device& device, - std::initializer_list bindingsInitializer); + wgpu::SamplerDescriptor GetDefaultSamplerDescriptor(); + wgpu::PipelineLayout MakeBasicPipelineLayout(const wgpu::Device& device, + const wgpu::BindGroupLayout* bindGroupLayout); + wgpu::BindGroupLayout MakeBindGroupLayout( + const wgpu::Device& device, + std::initializer_list bindingsInitializer); // Helpers to make creating bind groups look nicer: // @@ -104,26 +104,26 @@ namespace utils { // Structure with one constructor per-type of bindings, so that the initializer_list accepts // bindings with the right type and no extra information. struct BindingInitializationHelper { - BindingInitializationHelper(uint32_t binding, const dawn::Sampler& sampler); - BindingInitializationHelper(uint32_t binding, const dawn::TextureView& textureView); + BindingInitializationHelper(uint32_t binding, const wgpu::Sampler& sampler); + BindingInitializationHelper(uint32_t binding, const wgpu::TextureView& textureView); BindingInitializationHelper(uint32_t binding, - const dawn::Buffer& buffer, + const wgpu::Buffer& buffer, uint64_t offset, uint64_t size); - dawn::BindGroupBinding GetAsBinding() const; + wgpu::BindGroupBinding GetAsBinding() const; uint32_t binding; - dawn::Sampler sampler; - dawn::TextureView textureView; - dawn::Buffer buffer; + wgpu::Sampler sampler; + wgpu::TextureView textureView; + wgpu::Buffer buffer; uint64_t offset = 0; uint64_t size = 0; }; - dawn::BindGroup MakeBindGroup( - const dawn::Device& device, - const dawn::BindGroupLayout& layout, + wgpu::BindGroup MakeBindGroup( + const wgpu::Device& device, + const wgpu::BindGroupLayout& layout, std::initializer_list bindingsInitializer); } // namespace utils