2022-02-21 Myles C. Maxfield [WebGPU] Fix release build https://bugs.webkit.org/show_bug.cgi?id=237004 Unreviewed. If you include WTF, you must have set NDEBUG in release builds. * Configurations/Base.xcconfig: 2022-02-21 Myles C. Maxfield [WebGPU] Fix iOS build https://bugs.webkit.org/show_bug.cgi?id=237000 The lowPower selector doesn't exist on iOS. Unreviewed. * WebGPU/Instance.mm: (WebGPU::sortedDevices): (WebGPU::Instance::requestAdapter): 2022-02-21 Myles C. Maxfield [WebGPU] Tracer bullet part 12: Migrate from C function callbacks to blocks https://bugs.webkit.org/show_bug.cgi?id=236934 Reviewed by Dean Jackson. For all the C function pointer / userdata pairs, simply create a parallel entry point which accepts a block instead. * WebGPU/Adapter.mm: (wgpuAdapterRequestDeviceWithBlock): * WebGPU/Buffer.mm: (wgpuBufferMapAsyncWithBlock): * WebGPU/CommandEncoder.mm: (wgpuCommandEncoderSetLabel): * WebGPU/ComputePipeline.mm: (wgpuComputePipelineSetLabel): * WebGPU/Device.mm: (wgpuDeviceCreateComputePipelineAsyncWithBlock): (wgpuDeviceCreateRenderPipelineAsyncWithBlock): (wgpuDevicePopErrorScopeWithBlock): (wgpuDeviceSetDeviceLostCallbackWithBlock): (wgpuDeviceSetUncapturedErrorCallbackWithBlock): * WebGPU/Instance.mm: (wgpuInstanceRequestAdapterWithBlock): * WebGPU/Queue.mm: (wgpuQueueOnSubmittedWorkDoneWithBlock): (wgpuQueueSetLabel): * WebGPU/RenderPipeline.mm: (wgpuRenderPipelineSetLabel): * WebGPU/ShaderModule.mm: (wgpuShaderModuleGetCompilationInfoWithBlock): (wgpuShaderModuleSetLabel): * WebGPU/Surface.mm: (wgpuSurfaceGetPreferredFormat): * WebGPU/SwapChain.mm: (wgpuSwapChainPresent): * WebGPU/WebGPUExt.h: 2022-02-21 Myles C. Maxfield [WebGPU] Tracer bullet part 11: Implement shader creation methods https://bugs.webkit.org/show_bug.cgi?id=236933 Reviewed by Dean Jackson. This implements Device::createShaderModule() and Device::createComputePipeline(). The async versions (neither the WebGPU nor the Metal flavor) aren't implemented yet; this is just the first basic implementation. * WebGPU/ComputePipeline.mm: (WebGPU::createLibrary): (WebGPU::createConstantValues): (WebGPU::createFunction): (WebGPU::createComputePipelineState): (WebGPU::Device::createComputePipeline): (WebGPU::Device::createComputePipelineAsync): * WebGPU/PipelineLayout.h: * WebGPU/PipelineLayout.mm: (WebGPU::PipelineLayout::operator== const): (WebGPU::PipelineLayout::operator!= const): * WebGPU/ShaderModule.h: (WebGPU::ShaderModule::create): * WebGPU/ShaderModule.mm: (WebGPU::findShaderModuleParameters): (WebGPU::ShaderModule::createLibrary): (WebGPU::earlyCompileShaderModule): (WebGPU::Device::createShaderModule): (WebGPU::ShaderModule::ShaderModule): (WebGPU::CompilationMessageData::CompilationMessageData): (WebGPU::convertMessages): (WebGPU::ShaderModule::getCompilationInfo): (WebGPU::ShaderModule::setLabel): (WebGPU::ShaderModule::convertPipelineLayout): (WebGPU::ShaderModule::ast const): (WebGPU::ShaderModule::pipelineLayoutHint const): (WebGPU::ShaderModule::entryPointInformation const): 2022-02-21 Myles C. Maxfield [WebGPU] Tracer bullet part 10: Implement setLabel() and Metal accessors https://bugs.webkit.org/show_bug.cgi?id=236910 Reviewed by Dean Jackson. By adding a few various trivial functions in classes that need them, this patch completely finishes the implementation of CommandBuffer, QuerySet, RenderBundle, Sampler, and TextureView classes (other than their creation functions). * WebGPU/Buffer.mm: (WebGPU::Buffer::setLabel): * WebGPU/CommandBuffer.h: (WebGPU::CommandBuffer::commandBuffer const): * WebGPU/CommandBuffer.mm: (WebGPU::CommandBuffer::CommandBuffer): (WebGPU::CommandBuffer::setLabel): * WebGPU/CommandEncoder.mm: (WebGPU::CommandEncoder::CommandEncoder): (WebGPU::CommandEncoder::setLabel): * WebGPU/ComputePassEncoder.mm: (WebGPU::ComputePassEncoder::ComputePassEncoder): (WebGPU::ComputePassEncoder::setLabel): * WebGPU/ComputePipeline.h: (WebGPU::ComputePipeline::computePipelineState const): * WebGPU/ComputePipeline.mm: (WebGPU::ComputePipeline::ComputePipeline): (WebGPU::ComputePipeline::setLabel): * WebGPU/QuerySet.h: (WebGPU::QuerySet::counterSampleBuffer const): * WebGPU/QuerySet.mm: (WebGPU::QuerySet::QuerySet): (WebGPU::QuerySet::setLabel): * WebGPU/Queue.mm: (WebGPU::Queue::Queue): (WebGPU::Queue::setLabel): * WebGPU/RenderBundle.h: (WebGPU::RenderBundle::indirectCommandBuffer const): * WebGPU/RenderBundle.mm: (WebGPU::RenderBundle::RenderBundle): (WebGPU::RenderBundle::setLabel): * WebGPU/RenderBundleEncoder.mm: (WebGPU::RenderBundleEncoder::RenderBundleEncoder): (WebGPU::RenderBundleEncoder::setLabel): * WebGPU/RenderPassEncoder.mm: (WebGPU::RenderPassEncoder::RenderPassEncoder): (WebGPU::RenderPassEncoder::setLabel): * WebGPU/RenderPipeline.h: (WebGPU::RenderPipeline::renderPipelineState const): * WebGPU/RenderPipeline.mm: (WebGPU::RenderPipeline::RenderPipeline): (WebGPU::RenderPipeline::setLabel): * WebGPU/Sampler.mm: (WebGPU::Sampler::setLabel): * WebGPU/ShaderModule.h: (WebGPU::ShaderModule::library const): * WebGPU/ShaderModule.mm: (WebGPU::ShaderModule::ShaderModule): (WebGPU::ShaderModule::setLabel): * WebGPU/Texture.h: (WebGPU::Texture::texture const): * WebGPU/Texture.mm: (WebGPU::Texture::Texture): (WebGPU::Texture::setLabel): * WebGPU/TextureView.mm: (WebGPU::TextureView::setLabel): 2022-02-21 Myles C. Maxfield [WebGPU] Tracer bullet part 9: Basic implementation of bindings https://bugs.webkit.org/show_bug.cgi?id=236903 Reviewed by Dean Jackson. This is a basic implementation of the BindGroup, BindGroupLayout, and PipelineLayout methods. Eventually we'll want to suballocate multiple BindGroups so they coexist within the same Buffer, but this is an initial simple implementation that doesn't do that. * WebGPU/BindGroup.h: (WebGPU::BindGroup::vertexArgumentBuffer const): (WebGPU::BindGroup::fragmentArgumentBuffer const): (WebGPU::BindGroup::computeArgumentBuffer const): * WebGPU/BindGroup.mm: (WebGPU::bufferIsPresent): (WebGPU::samplerIsPresent): (WebGPU::textureViewIsPresent): (WebGPU::Device::createBindGroup): (WebGPU::BindGroup::BindGroup): (WebGPU::BindGroup::setLabel): * WebGPU/BindGroupLayout.h: (WebGPU::BindGroupLayout::vertexArgumentEncoder const): (WebGPU::BindGroupLayout::fragmentArgumentEncoder const): (WebGPU::BindGroupLayout::computeArgumentEncoder const): * WebGPU/BindGroupLayout.mm: (WebGPU::isPresent): (WebGPU::createArgumentDescriptor): (WebGPU::Device::createBindGroupLayout): (WebGPU::BindGroupLayout::BindGroupLayout): (WebGPU::BindGroupLayout::setLabel): (WebGPU::BindGroupLayout::encodedLength const): * WebGPU/Buffer.h: (WebGPU::Buffer::buffer const): * WebGPU/Buffer.mm: (WebGPU::Buffer::Buffer): * WebGPU/PipelineLayout.h: (WebGPU::PipelineLayout::create): (WebGPU::PipelineLayout::numberOfBindGroupLayouts const): (WebGPU::PipelineLayout::bindGroupLayout const): * WebGPU/PipelineLayout.mm: (WebGPU::Device::createPipelineLayout): (WebGPU::PipelineLayout::PipelineLayout): (WebGPU::PipelineLayout::setLabel): * WebGPU/Sampler.h: (WebGPU::Sampler::samplerState const): * WebGPU/Sampler.mm: (WebGPU::Sampler::Sampler): * WebGPU/TextureView.h: (WebGPU::TextureView::texture const): * WebGPU/TextureView.mm: (WebGPU::TextureView::TextureView): 2022-02-21 Myles C. Maxfield [WebGPU] Tracer bullet part 8: Basic implementation of device creation routines https://bugs.webkit.org/show_bug.cgi?id=236902 Reviewed by Dean Jackson. This is a basic implementation of the Instance, Adapter, and Device methods. Device limits are not implemented yet, so for now we claim every limits is 0. * WebGPU/Adapter.mm: (WebGPU::Adapter::Adapter): (WebGPU::Adapter::enumerateFeatures): (WebGPU::Adapter::getLimits): (WebGPU::Adapter::getProperties): (WebGPU::Adapter::hasFeature): (WebGPU::deviceMeetsRequiredLimits): (WebGPU::Adapter::requestDevice): * WebGPU/Device.h: * WebGPU/Device.mm: (WebGPU::Device::create): (WebGPU::Device::Device): (WebGPU::Device::destroy): (WebGPU::Device::enumerateFeatures): (WebGPU::Device::getLimits): (WebGPU::Device::getQueue): (WebGPU::Device::hasFeature): (WebGPU::Device::popErrorScope): (WebGPU::Device::pushErrorScope): (WebGPU::Device::setDeviceLostCallback): (WebGPU::Device::setUncapturedErrorCallback): (WebGPU::Device::setLabel): * WebGPU/Instance.mm: (WebGPU::sortedDevices): (WebGPU::Instance::requestAdapter): 2022-02-21 Myles C. Maxfield [WebGPU] Tracer bullet part 7: Clean up includes a bit https://bugs.webkit.org/show_bug.cgi?id=236900 Reviewed by Dean Jackson. We can put includes that literally every file uses into a single place. * WebGPU/Adapter.h: * WebGPU/Adapter.mm: * WebGPU/BindGroup.h: * WebGPU/BindGroup.mm: * WebGPU/BindGroupLayout.h: * WebGPU/BindGroupLayout.mm: * WebGPU/Buffer.h: * WebGPU/Buffer.mm: * WebGPU/CommandBuffer.h: * WebGPU/CommandBuffer.mm: * WebGPU/CommandEncoder.h: * WebGPU/CommandEncoder.mm: * WebGPU/ComputePassEncoder.h: * WebGPU/ComputePassEncoder.mm: * WebGPU/ComputePipeline.h: * WebGPU/ComputePipeline.mm: * WebGPU/Device.h: * WebGPU/Device.mm: * WebGPU/Instance.h: * WebGPU/Instance.mm: * WebGPU/PipelineLayout.h: * WebGPU/PipelineLayout.mm: * WebGPU/QuerySet.h: * WebGPU/QuerySet.mm: * WebGPU/Queue.h: * WebGPU/Queue.mm: * WebGPU/RenderBundle.h: * WebGPU/RenderBundle.mm: * WebGPU/RenderBundleEncoder.h: * WebGPU/RenderBundleEncoder.mm: * WebGPU/RenderPassEncoder.h: * WebGPU/RenderPassEncoder.mm: * WebGPU/RenderPipeline.h: * WebGPU/RenderPipeline.mm: * WebGPU/Sampler.h: * WebGPU/Sampler.mm: * WebGPU/ShaderModule.h: * WebGPU/ShaderModule.mm: * WebGPU/Surface.h: * WebGPU/Surface.mm: * WebGPU/SwapChain.h: * WebGPU/SwapChain.mm: * WebGPU/Texture.h: * WebGPU/Texture.mm: * WebGPU/TextureView.h: * WebGPU/TextureView.mm: * WebGPU/config.h: 2022-02-21 Myles C. Maxfield [WebGPU] Tracer bullet part 6: Give a RunLoop to Instance https://bugs.webkit.org/show_bug.cgi?id=236899 Reviewed by Dean Jackson. The shared header has a function, wgpuInstanceProcessEvents(), which is supposed to synchronously call all outstanding callbacks. A natural way to do this is to hook this up to [NSRunLoop runMode:beforeDate:]. * WebGPU/Instance.h: (WebGPU::Instance::runLoop const): (WebGPU::Instance::create): Deleted. * WebGPU/Instance.mm: (WebGPU::Instance::create): (WebGPU::Instance::Instance): (WebGPU::Instance::createSurface): (WebGPU::Instance::processEvents): (wgpuCreateInstance): 2022-02-21 Myles C. Maxfield [WebGPU] Tracer bullet part 5: Give Metal objects to WebGPU objects https://bugs.webkit.org/show_bug.cgi?id=236898 Reviewed by Dean Jackson. Each WebGPU object gets its own backing Metal object. * WebGPU/Adapter.h: (WebGPU::Adapter::create): * WebGPU/Adapter.mm: (WebGPU::Adapter::Adapter): * WebGPU/BindGroup.h: (WebGPU::BindGroup::create): * WebGPU/BindGroup.mm: (WebGPU::Device::createBindGroup): (WebGPU::BindGroup::BindGroup): * WebGPU/BindGroupLayout.h: (WebGPU::BindGroupLayout::create): * WebGPU/BindGroupLayout.mm: (WebGPU::Device::createBindGroupLayout): (WebGPU::BindGroupLayout::BindGroupLayout): * WebGPU/Buffer.h: (WebGPU::Buffer::create): * WebGPU/Buffer.mm: (WebGPU::Device::createBuffer): (WebGPU::Buffer::Buffer): * WebGPU/CommandBuffer.h: (WebGPU::CommandBuffer::create): * WebGPU/CommandBuffer.mm: (WebGPU::CommandBuffer::CommandBuffer): * WebGPU/CommandEncoder.h: (WebGPU::CommandEncoder::create): * WebGPU/CommandEncoder.mm: (WebGPU::Device::createCommandEncoder): (WebGPU::CommandEncoder::CommandEncoder): (WebGPU::CommandEncoder::beginComputePass): (WebGPU::CommandEncoder::beginRenderPass): (WebGPU::CommandEncoder::finish): * WebGPU/ComputePassEncoder.h: (WebGPU::ComputePassEncoder::create): * WebGPU/ComputePassEncoder.mm: (WebGPU::ComputePassEncoder::ComputePassEncoder): * WebGPU/ComputePipeline.h: (WebGPU::ComputePipeline::create): * WebGPU/ComputePipeline.mm: (WebGPU::Device::createComputePipeline): (WebGPU::ComputePipeline::ComputePipeline): (WebGPU::ComputePipeline::getBindGroupLayout): * WebGPU/Device.h: (WebGPU::Device::create): Deleted. * WebGPU/Device.mm: (WebGPU::Device::create): (WebGPU::Device::Device): (WebGPU::Device::getQueue): * WebGPU/Instance.h: * WebGPU/Instance.mm: (WebGPU::Instance::requestAdapter): (wgpuInstanceRequestAdapter): * WebGPU/QuerySet.h: (WebGPU::QuerySet::create): * WebGPU/QuerySet.mm: (WebGPU::Device::createQuerySet): (WebGPU::QuerySet::QuerySet): * WebGPU/Queue.h: (WebGPU::Queue::create): * WebGPU/Queue.mm: (WebGPU::Queue::Queue): * WebGPU/RenderBundle.h: (WebGPU::RenderBundle::create): * WebGPU/RenderBundle.mm: (WebGPU::RenderBundle::RenderBundle): * WebGPU/RenderBundleEncoder.h: (WebGPU::RenderBundleEncoder::create): * WebGPU/RenderBundleEncoder.mm: (WebGPU::Device::createRenderBundleEncoder): (WebGPU::RenderBundleEncoder::RenderBundleEncoder): (WebGPU::RenderBundleEncoder::finish): * WebGPU/RenderPassEncoder.h: (WebGPU::RenderPassEncoder::create): * WebGPU/RenderPassEncoder.mm: (WebGPU::RenderPassEncoder::RenderPassEncoder): * WebGPU/RenderPipeline.h: (WebGPU::RenderPipeline::create): * WebGPU/RenderPipeline.mm: (WebGPU::Device::createRenderPipeline): (WebGPU::RenderPipeline::RenderPipeline): (WebGPU::RenderPipeline::getBindGroupLayout): * WebGPU/Sampler.h: (WebGPU::Sampler::create): * WebGPU/Sampler.mm: (WebGPU::Device::createSampler): (WebGPU::Sampler::Sampler): * WebGPU/ShaderModule.h: (WebGPU::ShaderModule::create): * WebGPU/ShaderModule.mm: (WebGPU::Device::createShaderModule): (WebGPU::ShaderModule::ShaderModule): * WebGPU/SwapChain.mm: (WebGPU::SwapChain::getCurrentTextureView): * WebGPU/Texture.h: (WebGPU::Texture::create): * WebGPU/Texture.mm: (WebGPU::Device::createTexture): (WebGPU::Texture::Texture): (WebGPU::Texture::createView): * WebGPU/TextureView.h: (WebGPU::TextureView::create): * WebGPU/TextureView.mm: (WebGPU::TextureView::TextureView): * WebGPU/config.h: 2022-02-21 Myles C. Maxfield [WebGPU] Tracer bullet part 4: Move Device's construction methods to the files of the things they create https://bugs.webkit.org/show_bug.cgi?id=236891 Reviewed by Dean Jackson. Device is kind of a factory object, and has lots of methods which create other objects in the API. To avoid Device.cpp becoming a catch-all place for tons of unrelated creation routines, this patch moves the routine that creates an X into X.mm. * WebGPU/BindGroup.mm: (WebGPU::Device::createBindGroup): * WebGPU/BindGroupLayout.mm: (WebGPU::Device::createBindGroupLayout): * WebGPU/Buffer.mm: (WebGPU::Device::createBuffer): * WebGPU/CommandEncoder.mm: (WebGPU::Device::createCommandEncoder): * WebGPU/ComputePipeline.mm: (WebGPU::Device::createComputePipeline): (WebGPU::Device::createComputePipelineAsync): * WebGPU/Device.mm: (WebGPU::Device::createBindGroup): Deleted. (WebGPU::Device::createBindGroupLayout): Deleted. (WebGPU::Device::createBuffer): Deleted. (WebGPU::Device::createCommandEncoder): Deleted. (WebGPU::Device::createComputePipeline): Deleted. (WebGPU::Device::createComputePipelineAsync): Deleted. (WebGPU::Device::createPipelineLayout): Deleted. (WebGPU::Device::createQuerySet): Deleted. (WebGPU::Device::createRenderBundleEncoder): Deleted. (WebGPU::Device::createRenderPipeline): Deleted. (WebGPU::Device::createRenderPipelineAsync): Deleted. (WebGPU::Device::createSampler): Deleted. (WebGPU::Device::createShaderModule): Deleted. (WebGPU::Device::createSwapChain): Deleted. (WebGPU::Device::createTexture): Deleted. * WebGPU/PipelineLayout.mm: (WebGPU::Device::createPipelineLayout): * WebGPU/QuerySet.mm: (WebGPU::Device::createQuerySet): * WebGPU/RenderBundleEncoder.mm: (WebGPU::Device::createRenderBundleEncoder): * WebGPU/RenderPipeline.mm: (WebGPU::Device::createRenderPipeline): (WebGPU::Device::createRenderPipelineAsync): * WebGPU/Sampler.mm: (WebGPU::Device::createSampler): * WebGPU/ShaderModule.mm: (WebGPU::Device::createShaderModule): * WebGPU/SwapChain.mm: (WebGPU::Device::createSwapChain): * WebGPU/Texture.mm: (WebGPU::Device::createTexture): 2022-02-21 Myles C. Maxfield [WebGPU] Tracer bullet part 3: Tweak WGSL API https://bugs.webkit.org/show_bug.cgi?id=236889 Reviewed by Dean Jackson. - Give SuccessfulCheck a move constructor - Use UniqueRef instead of std::unique_ptr - Allow specialization constants to be looked up by name - Model missing pipeline layouts as absent from the HashMap, rather than using an optional type * WGSL/WGSL.cpp: (WGSL::prepare): (WGSL::SuccessfulCheck::~SuccessfulCheck): Deleted. * WGSL/WGSL.h: 2022-02-21 Myles C. Maxfield [WebGPU] WebGPU.xcodeproj cannot be opened on Big Sur's Xcode https://bugs.webkit.org/show_bug.cgi?id=236982 Unreviewed. Just change the project version number from 55 to 51, like the rest of the projects in WebKit. * WebGPU.xcodeproj/project.pbxproj: 2022-02-18 Myles C. Maxfield [WebGPU] Any object-creation function that takes a descriptor can fail https://bugs.webkit.org/show_bug.cgi?id=236855 Reviewed by Dean Jackson. Generally, we view allocation failure as catastrophic, and crash. Because of that, I originally made these methods return Refs, because I expected the failure case to cause intentional crashes rather than return nullptr. However, descriptors the shared header have a nextInChain pointer, which allows callers to pass in extra extension-specific structs, as a linked list. If the WebGPU implementation sees one of these extra structs that it doesn't know what to do with, it has to fail. That means that it's possible to fail in a way other than an allocation failure, which means these functions have to return RefPtrs instead of Refs. * WebGPU/Adapter.h: * WebGPU/Adapter.mm: (WebGPU::Adapter::requestDevice): (wgpuAdapterRequestDevice): * WebGPU/CommandEncoder.h: * WebGPU/CommandEncoder.mm: (WebGPU::CommandEncoder::beginComputePass): (WebGPU::CommandEncoder::beginRenderPass): (WebGPU::CommandEncoder::finish): (wgpuCommandEncoderBeginComputePass): (wgpuCommandEncoderBeginRenderPass): (wgpuCommandEncoderFinish): * WebGPU/Device.h: * WebGPU/Device.mm: (WebGPU::Device::createBindGroup): (WebGPU::Device::createBindGroupLayout): (WebGPU::Device::createBuffer): (WebGPU::Device::createCommandEncoder): (WebGPU::Device::createComputePipeline): (WebGPU::Device::createComputePipelineAsync): (WebGPU::Device::createPipelineLayout): (WebGPU::Device::createQuerySet): (WebGPU::Device::createRenderBundleEncoder): (WebGPU::Device::createRenderPipeline): (WebGPU::Device::createRenderPipelineAsync): (WebGPU::Device::createSampler): (WebGPU::Device::createShaderModule): (WebGPU::Device::createSwapChain): (WebGPU::Device::createTexture): (WebGPU::Device::getQueue): (wgpuDeviceCreateBindGroup): (wgpuDeviceCreateBindGroupLayout): (wgpuDeviceCreateBuffer): (wgpuDeviceCreateCommandEncoder): (wgpuDeviceCreateComputePipeline): (wgpuDeviceCreateComputePipelineAsync): (wgpuDeviceCreatePipelineLayout): (wgpuDeviceCreateQuerySet): (wgpuDeviceCreateRenderBundleEncoder): (wgpuDeviceCreateRenderPipeline): (wgpuDeviceCreateRenderPipelineAsync): (wgpuDeviceCreateSampler): (wgpuDeviceCreateShaderModule): (wgpuDeviceCreateSwapChain): (wgpuDeviceCreateTexture): (wgpuDeviceGetQueue): * WebGPU/Instance.h: * WebGPU/Instance.mm: (WebGPU::Instance::createSurface): (wgpuInstanceCreateSurface): * WebGPU/RenderBundleEncoder.h: * WebGPU/RenderBundleEncoder.mm: (WebGPU::RenderBundleEncoder::finish): (wgpuRenderBundleEncoderFinish): * WebGPU/Texture.h: * WebGPU/Texture.mm: (WebGPU::Texture::createView): (wgpuTextureCreateView): 2022-02-18 Robert Jenner Unreviewed, reverting r290149. Broke Debug Builds. Reverted changeset: "Generate compile_commands.json on macOS Builds" https://bugs.webkit.org/show_bug.cgi?id=235686 https://commits.webkit.org/r290149 2022-02-18 Elliott Williams [XCBuild] "All Modules" workspace builds building out of order https://bugs.webkit.org/show_bug.cgi?id=236813 Reviewed by Alexey Proskuryakov. Add product dependency on WTF. WGSL uses its headers without linking against it. * Configurations/WGSL.xcconfig: * WebGPU.xcodeproj/project.pbxproj: 2022-02-18 Brandon Stewart Generate compile_commands.json on macOS Builds https://bugs.webkit.org/show_bug.cgi?id=235686 Reviewed by Saam Barati. Add support for generating compile_commands.json file to WebKit. compile_commands.json can be used by tools like clangd to provide code complete, refactoring, formatting, and cross references. Steps to generate the compile commands file: make r EXPORT_COMPILE_COMMANDS=YES generate-compile-commands WebKitBuild/Release * Configurations/DebugRelease.xcconfig: 2022-02-18 Saam Barati Add LC_SOURCE_VERSION to compile targets https://bugs.webkit.org/show_bug.cgi?id=236720 Reviewed by Michael Saboff. * Configurations/Version.xcconfig: * Configurations/WGSL.xcconfig: * Configurations/WGSLUnitTests.xcconfig: * Configurations/WebGPU.xcconfig: 2022-02-17 Myles C. Maxfield [WebGPU] Add a playground example target https://bugs.webkit.org/show_bug.cgi?id=236742 Reviewed by Dean Jackson. It's just a little playground where you can call WebGPU functions. It's not built by any script or included in any other targets - it's just for the WebGPU developers to play around with WebGPU functions. * CommandLinePlayground/main.swift: Added. * Configurations/CommandLinePlayground.xcconfig: Added. * WebGPU.xcodeproj/project.pbxproj: * WebGPU/WebGPU.modulemap: 2022-02-15 Myles C. Maxfield [WebGPU] Update IDLs and stubs to latest version of the spec https://bugs.webkit.org/show_bug.cgi?id=236639 Reviewed by Dean Jackson. * WebGPU/Adapter.h: * WebGPU/Adapter.mm: (WebGPU::Adapter::enumerateFeatures): (wgpuAdapterEnumerateFeatures): (WebGPU::Adapter::getFeatureAtIndex): Deleted. (wgpuAdapterGetFeatureAtIndex): Deleted. * WebGPU/CommandEncoder.h: * WebGPU/CommandEncoder.mm: (WebGPU::CommandEncoder::clearBuffer): (wgpuCommandEncoderClearBuffer): (WebGPU::CommandEncoder::fillBuffer): Deleted. (wgpuCommandEncoderFillBuffer): Deleted. * WebGPU/ComputePassEncoder.h: * WebGPU/ComputePassEncoder.mm: (WebGPU::ComputePassEncoder::writeTimestamp): Deleted. (wgpuComputePassEncoderWriteTimestamp): Deleted. * WebGPU/Device.h: * WebGPU/Device.mm: (WebGPU::Device::enumerateFeatures): (WebGPU::Device::hasFeature): (wgpuDeviceEnumerateFeatures): (wgpuDeviceHasFeature): * WebGPU/Instance.mm: (wgpuGetProcAddress): * WebGPU/RenderPassEncoder.h: * WebGPU/RenderPassEncoder.mm: (WebGPU::RenderPassEncoder::writeTimestamp): Deleted. (wgpuRenderPassEncoderWriteTimestamp): Deleted. * WebGPU/ShaderModule.h: * WebGPU/ShaderModule.mm: (WebGPU::ShaderModule::getCompilationInfo): (wgpuShaderModuleGetCompilationInfo): * WebGPU/WebGPU.h: * WebGPU/WebGPUExt.h: 2022-02-15 Robin Morisset [WGSL] Implement enough of the lexer for the simplest shaders https://bugs.webkit.org/show_bug.cgi?id=233276 Reviewed by Myles Maxfield. There is just enough of the lexer in this patch to pass the unit tests (also added by the patch). The lexer is templated by the character size, following the code from JSC's lexer. I did not use a lexer generator like lex for a few reasons: - It would have made the build system(s) even more of a nightmare - It would have made it harder to give accurate and customized error messages - If we ever decide to do anything exotic to the grammar of the language, it could have made it much harder The lexing of floating point literals is a bit hacky, and probably has some precision issues in corner cases, but it passed all simple unit tests, so for now I just left it as is with a FIXME, to be fixed once we can run the full CTS. The TokenType includes an `Invalid` value. I could instead have used std::optional everywhere. I made this choice for two reasons: - space efficiency: we don't use an extra word of memory for the variant's tag - (although this part could be solved by using https://github.com/akrzemi1/markable) - ease of use and time efficiency: everywhere that we check for a given TokenType, we would have to first check that the Token is not nullopt, and then check the TokenType. * Configurations/WGSLUnitTests.xcconfig: * WGSL/Lexer.cpp: Added. (WGSL::Lexer::lex): (WGSL::Lexer::shift): (WGSL::Lexer::peek): (WGSL::Lexer::skipWhitespace): (WGSL::Lexer::isAtEndOfFile const): (WGSL::Lexer::parseDecimalInteger): (WGSL::Lexer::parseDecimalFloatExponent): (WGSL::Lexer::parseIntegerLiteralSuffix): (WGSL::Lexer::isWhiteSpace): (WGSL::Lexer::isIdentifierStart): (WGSL::Lexer::isValidIdentifierCharacter): (WGSL::Lexer::isDecimal): (WGSL::Lexer::isHexadecimal): (WGSL::Lexer::readDecimal): (WGSL::Lexer::readHexadecimal): (WGSL::Lexer::isWhiteSpace): (WGSL::Lexer::isIdentifierStart): (WGSL::Lexer::isValidIdentifierCharacter): (WGSL::Lexer::isDecimal): (WGSL::Lexer::isHexadecimal): (WGSL::Lexer::readDecimal): (WGSL::Lexer::readHexadecimal): * WGSL/Lexer.h: Added. (WGSL::Lexer::Lexer): (WGSL::Lexer::currentPosition const): (WGSL::Lexer::currentOffset const): (WGSL::Lexer::currentTokenLength const): (WGSL::Lexer::makeToken): (WGSL::Lexer::makeLiteralToken): (WGSL::Lexer::makeIdentifierToken): * WGSL/SourceSpan.h: Added. (WGSL::SourceSpan::SourceSpan): * WGSL/Token.cpp: Added. (WGSL::toString): * WGSL/Token.h: Added. (WGSL::Token::Token): (WGSL::Token::operator=): (WGSL::Token::~Token): * WGSL/WGSL.cpp: (WGSL::staticCheck): * WGSLUnitTests/WGSLLexerTests.mm: Added. (-[WGSLLexerTests testLexerOnSingleTokens]): (-[WGSLLexerTests testLexerOnComputeShader]): (-[WGSLLexerTests testLexerOnGraphicsShader]): * WGSLUnitTests/WGSLUnitTests.mm: Removed. (-[WGSLUnitTests testExample]): Deleted. * WebGPU.xcodeproj/project.pbxproj: 2022-01-26 Myles C. Maxfield [WebGPU] Make sure WGSLUnitTests can call into WGSL https://bugs.webkit.org/show_bug.cgi?id=235630 Reviewed by Dean Jackson. * WGSL/WGSL.cpp: (WGSL::staticCheck): Apparently /usr/local/include/AssertMacros.h #defines "check" (WGSL::check): Deleted. * WGSL/WGSL.h: * WGSLUnitTests/WGSLUnitTests.mm: (-[WGSLUnitTests testExample]): 2022-01-25 Myles C. Maxfield [WebGPU] Fix WGSLUnitTests build https://bugs.webkit.org/show_bug.cgi?id=235628 Unreviewed. * Configurations/WGSLUnitTests.xcconfig: 2022-01-25 Commit Queue Unreviewed, reverting r288606. https://bugs.webkit.org/show_bug.cgi?id=235629 Should never have been committed Reverted changeset: "[WebGPU] Fix WGSLUnitTests build" https://bugs.webkit.org/show_bug.cgi?id=235628 https://commits.webkit.org/r288606 2022-01-25 Myles C. Maxfield [WebGPU] Fix WGSLUnitTests build https://bugs.webkit.org/show_bug.cgi?id=235628 Unreviewed. * Configurations/WGSLUnitTests.xcconfig: 2022-01-18 Alex Christensen Use c++2a instead of gnu++2a for Cocoa builds https://bugs.webkit.org/show_bug.cgi?id=234936 Reviewed by Sam Weinig. * Configurations/Base.xcconfig: 2022-01-12 Elliott Williams [Xcode] Configure each project for the legacy build system https://bugs.webkit.org/show_bug.cgi?id=235091 Reviewed by Darin Adler. * WebGPU.xcodeproj/project.pbxproj: 2022-01-10 Alex Christensen Start using C++20 https://bugs.webkit.org/show_bug.cgi?id=233963 Reviewed by Yusuke Suzuki. * Configurations/Base.xcconfig: 2022-01-07 Alex Christensen Unreviewed, reverting r287698. Broke an internal build Reverted changeset: "Start using C++20" https://bugs.webkit.org/show_bug.cgi?id=233963 https://commits.webkit.org/r287698 2022-01-06 Alex Christensen Start using C++20 https://bugs.webkit.org/show_bug.cgi?id=233963 Reviewed by Yusuke Suzuki. * Configurations/Base.xcconfig: 2022-01-01 Jeff Miller Update user-visible copyright strings to include 2022 https://bugs.webkit.org/show_bug.cgi?id=234263 Reviewed by Anders Carlsson. * Info.plist: 2021-12-21 Michael Saboff Fix symlinks for alternate root framework locations https://bugs.webkit.org/show_bug.cgi?id=234567 Reviewed by Filip Pizlo. Moved OUTPUT_ALTERNATE_ROOT_PATH in create symlink script from outputFileListPaths to outputPaths. * WebGPU.xcodeproj/project.pbxproj: 2021-12-16 Michael Saboff https://bugs.webkit.org/show_bug.cgi?id=234173 Update Install Paths for build system changes Reviewed by Filip Pizlo. Added build variables and build step to create symlinks pointing to the alternate build locations from the current framework install location. * Configurations/WebGPU.xcconfig: * Scripts: Added. * Scripts/create-symlink-to-altroot.sh: Added. * WebGPU.xcodeproj/project.pbxproj: 2021-12-13 Elliott Williams Deployment target for macOS 11+ does not follow minor version bumps https://bugs.webkit.org/show_bug.cgi?id=233906 Reviewed by Alexey Proskuryakov. * Configurations/DebugRelease.xcconfig: 2021-12-10 Michael Saboff https://bugs.webkit.org/show_bug.cgi?id=234173 Update Install Paths for build system changes Reviewed by Yusuke Suzuki. Updated install paths for changes in the build system that use a system path prefix. * Configurations/WebGPU.xcconfig: 2021-12-07 Myles C. Maxfield [WebGPU] Fix MacCatalyst build https://bugs.webkit.org/show_bug.cgi?id=233920 Unreviewed. Taken from JavaScriptCore.xcodeproj. * Configurations/WebGPU.xcconfig: 2021-12-02 Myles C. Maxfield [WebGPU] Hook up navigator.gpu.requestAdapter() https://bugs.webkit.org/show_bug.cgi?id=233619 Just hook up enough for Instance::requestAdapter() to not fail. Reviewed by Dean Jackson. * WebGPU/Adapter.mm: (WebGPU::Adapter::getLimits): * WebGPU/Instance.mm: (WebGPU::Instance::requestAdapter): (wgpuCreateInstance): (wgpuInstanceRequestAdapter): 2021-11-29 Myles C. Maxfield [WebGPU] Make WebGPU.framework's classes reference counted https://bugs.webkit.org/show_bug.cgi?id=233547 Reviewed by Dean Jackson. This is a fairly mechanical change of replacing constructors with calls to create(), and changing instances to Ref<...>, and using -> instead of . There's one somewhat interesting design choice here. The header has things like: typedef struct WGPUAdapterImpl* WGPUAdapter; But we're using C++ so we want to have something like namespace WebGPU { class Adapter : public RefCounted { ... }; } So we need to have some way of connecting these two things. This patch opts to do this like so: struct WGPUAdapterImpl { Ref adapter; }; This isn't perfect, because it means that all method calls require a double dereference: one to dereference the WGPUAdapter to get the WGPUAdapterImpl, and one to dereference the Ref to get the Adapter. This is the most elegant solution for now, because it doesn't require any reinterpret_cast<>()'ing. This patch chooses this elegant solution, because premature optimization is the root of all evil. * WebGPU/Adapter.h: (WebGPU::Adapter::create): * WebGPU/Adapter.mm: (WebGPU::Adapter::requestDevice): (wgpuAdapterGetLimits): (wgpuAdapterGetProperties): (wgpuAdapterHasFeature): (wgpuAdapterGetFeatureAtIndex): (wgpuAdapterRequestDevice): * WebGPU/BindGroup.h: (WebGPU::BindGroup::create): * WebGPU/BindGroup.mm: (wgpuBindGroupSetLabel): * WebGPU/BindGroupLayout.h: (WebGPU::BindGroupLayout::create): * WebGPU/BindGroupLayout.mm: (wgpuBindGroupLayoutSetLabel): * WebGPU/Buffer.h: (WebGPU::Buffer::create): * WebGPU/Buffer.mm: (WebGPU::Buffer::mapAsync): (wgpuBufferDestroy): (wgpuBufferGetConstMappedRange): (wgpuBufferGetMappedRange): (wgpuBufferMapAsync): (wgpuBufferUnmap): (wgpuBufferSetLabel): * WebGPU/CommandBuffer.h: (WebGPU::CommandBuffer::create): * WebGPU/CommandBuffer.mm: (wgpuCommandBufferSetLabel): * WebGPU/CommandEncoder.h: (WebGPU::CommandEncoder::create): * WebGPU/CommandEncoder.mm: (WebGPU::CommandEncoder::beginComputePass): (WebGPU::CommandEncoder::beginRenderPass): (WebGPU::CommandEncoder::finish): (wgpuCommandEncoderBeginComputePass): (wgpuCommandEncoderBeginRenderPass): (wgpuCommandEncoderCopyBufferToBuffer): (wgpuCommandEncoderCopyBufferToTexture): (wgpuCommandEncoderCopyTextureToBuffer): (wgpuCommandEncoderCopyTextureToTexture): (wgpuCommandEncoderFillBuffer): (wgpuCommandEncoderFinish): (wgpuCommandEncoderInsertDebugMarker): (wgpuCommandEncoderPopDebugGroup): (wgpuCommandEncoderPushDebugGroup): (wgpuCommandEncoderResolveQuerySet): (wgpuCommandEncoderWriteTimestamp): (wgpuCommandEncoderSetLabel): * WebGPU/ComputePassEncoder.h: (WebGPU::ComputePassEncoder::create): * WebGPU/ComputePassEncoder.mm: (wgpuComputePassEncoderBeginPipelineStatisticsQuery): (wgpuComputePassEncoderDispatch): (wgpuComputePassEncoderDispatchIndirect): (wgpuComputePassEncoderEndPass): (wgpuComputePassEncoderEndPipelineStatisticsQuery): (wgpuComputePassEncoderInsertDebugMarker): (wgpuComputePassEncoderPopDebugGroup): (wgpuComputePassEncoderPushDebugGroup): (wgpuComputePassEncoderSetBindGroup): (wgpuComputePassEncoderSetPipeline): (wgpuComputePassEncoderWriteTimestamp): (wgpuComputePassEncoderSetLabel): * WebGPU/ComputePipeline.h: (WebGPU::ComputePipeline::create): * WebGPU/ComputePipeline.mm: (WebGPU::ComputePipeline::getBindGroupLayout): (wgpuComputePipelineGetBindGroupLayout): (wgpuComputePipelineSetLabel): * WebGPU/Device.h: (WebGPU::Device::create): * WebGPU/Device.mm: (WebGPU::Device::createBindGroup): (WebGPU::Device::createBindGroupLayout): (WebGPU::Device::createBuffer): (WebGPU::Device::createCommandEncoder): (WebGPU::Device::createComputePipeline): (WebGPU::Device::createComputePipelineAsync): (WebGPU::Device::createPipelineLayout): (WebGPU::Device::createQuerySet): (WebGPU::Device::createRenderBundleEncoder): (WebGPU::Device::createRenderPipeline): (WebGPU::Device::createRenderPipelineAsync): (WebGPU::Device::createSampler): (WebGPU::Device::createShaderModule): (WebGPU::Device::createSwapChain): (WebGPU::Device::createTexture): (WebGPU::Device::getQueue): (WebGPU::Device::popErrorScope): (WebGPU::Device::setDeviceLostCallback): (WebGPU::Device::setUncapturedErrorCallback): (wgpuDeviceCreateBindGroup): (wgpuDeviceCreateBindGroupLayout): (wgpuDeviceCreateBuffer): (wgpuDeviceCreateCommandEncoder): (wgpuDeviceCreateComputePipeline): (wgpuDeviceCreateComputePipelineAsync): (wgpuDeviceCreatePipelineLayout): (wgpuDeviceCreateQuerySet): (wgpuDeviceCreateRenderBundleEncoder): (wgpuDeviceCreateRenderPipeline): (wgpuDeviceCreateRenderPipelineAsync): (wgpuDeviceCreateSampler): (wgpuDeviceCreateShaderModule): (wgpuDeviceCreateSwapChain): (wgpuDeviceCreateTexture): (wgpuDeviceDestroy): (wgpuDeviceGetLimits): (wgpuDeviceGetQueue): (wgpuDevicePopErrorScope): (wgpuDevicePushErrorScope): (wgpuDeviceSetDeviceLostCallback): (wgpuDeviceSetUncapturedErrorCallback): (wgpuDeviceSetLabel): * WebGPU/Instance.h: (WebGPU::Instance::create): * WebGPU/Instance.mm: (WebGPU::Instance::createSurface): (WebGPU::Instance::requestAdapter): (wgpuInstanceCreateSurface): (wgpuInstanceProcessEvents): (wgpuInstanceRequestAdapter): * WebGPU/PipelineLayout.h: (WebGPU::PipelineLayout::create): * WebGPU/PipelineLayout.mm: (wgpuPipelineLayoutSetLabel): * WebGPU/QuerySet.h: (WebGPU::QuerySet::create): * WebGPU/QuerySet.mm: (wgpuQuerySetDestroy): (wgpuQuerySetSetLabel): * WebGPU/Queue.h: (WebGPU::Queue::create): * WebGPU/Queue.mm: (WebGPU::Queue::onSubmittedWorkDone): (wgpuQueueOnSubmittedWorkDone): (wgpuQueueSubmit): (wgpuQueueWriteBuffer): (wgpuQueueWriteTexture): (wgpuQueueSetLabel): * WebGPU/RenderBundle.h: (WebGPU::RenderBundle::create): * WebGPU/RenderBundle.mm: (wgpuRenderBundleSetLabel): * WebGPU/RenderBundleEncoder.h: (WebGPU::RenderBundleEncoder::create): * WebGPU/RenderBundleEncoder.mm: (WebGPU::RenderBundleEncoder::finish): (wgpuRenderBundleEncoderDraw): (wgpuRenderBundleEncoderDrawIndexed): (wgpuRenderBundleEncoderDrawIndexedIndirect): (wgpuRenderBundleEncoderDrawIndirect): (wgpuRenderBundleEncoderFinish): (wgpuRenderBundleEncoderInsertDebugMarker): (wgpuRenderBundleEncoderPopDebugGroup): (wgpuRenderBundleEncoderPushDebugGroup): (wgpuRenderBundleEncoderSetBindGroup): (wgpuRenderBundleEncoderSetIndexBuffer): (wgpuRenderBundleEncoderSetPipeline): (wgpuRenderBundleEncoderSetVertexBuffer): (wgpuRenderBundleEncoderSetLabel): * WebGPU/RenderPassEncoder.h: (WebGPU::RenderPassEncoder::create): * WebGPU/RenderPassEncoder.mm: (wgpuRenderPassEncoderBeginOcclusionQuery): (wgpuRenderPassEncoderBeginPipelineStatisticsQuery): (wgpuRenderPassEncoderDraw): (wgpuRenderPassEncoderDrawIndexed): (wgpuRenderPassEncoderDrawIndexedIndirect): (wgpuRenderPassEncoderDrawIndirect): (wgpuRenderPassEncoderEndOcclusionQuery): (wgpuRenderPassEncoderEndPass): (wgpuRenderPassEncoderEndPipelineStatisticsQuery): (wgpuRenderPassEncoderExecuteBundles): (wgpuRenderPassEncoderInsertDebugMarker): (wgpuRenderPassEncoderPopDebugGroup): (wgpuRenderPassEncoderPushDebugGroup): (wgpuRenderPassEncoderSetBindGroup): (wgpuRenderPassEncoderSetBlendConstant): (wgpuRenderPassEncoderSetIndexBuffer): (wgpuRenderPassEncoderSetPipeline): (wgpuRenderPassEncoderSetScissorRect): (wgpuRenderPassEncoderSetStencilReference): (wgpuRenderPassEncoderSetVertexBuffer): (wgpuRenderPassEncoderSetViewport): (wgpuRenderPassEncoderWriteTimestamp): (wgpuRenderPassEncoderSetLabel): * WebGPU/RenderPipeline.h: (WebGPU::RenderPipeline::create): * WebGPU/RenderPipeline.mm: (WebGPU::RenderPipeline::getBindGroupLayout): (wgpuRenderPipelineGetBindGroupLayout): (wgpuRenderPipelineSetLabel): * WebGPU/Sampler.h: (WebGPU::Sampler::create): * WebGPU/Sampler.mm: (wgpuSamplerSetLabel): * WebGPU/ShaderModule.h: (WebGPU::ShaderModule::create): * WebGPU/ShaderModule.mm: (wgpuShaderModuleSetLabel): * WebGPU/Surface.h: (WebGPU::Surface::create): * WebGPU/Surface.mm: (wgpuSurfaceGetPreferredFormat): * WebGPU/SwapChain.h: (WebGPU::SwapChain::create): * WebGPU/SwapChain.mm: (WebGPU::SwapChain::getCurrentTextureView): (wgpuSwapChainGetCurrentTextureView): (wgpuSwapChainPresent): * WebGPU/Texture.h: (WebGPU::Texture::create): * WebGPU/Texture.mm: (WebGPU::Texture::createView): (wgpuTextureCreateView): (wgpuTextureDestroy): (wgpuTextureSetLabel): * WebGPU/TextureView.h: (WebGPU::TextureView::create): * WebGPU/TextureView.mm: (wgpuTextureViewSetLabel): 2021-11-16 Myles C. Maxfield [WebGPU] Add WGSLUnitTests XCTest target for WebGPU https://bugs.webkit.org/show_bug.cgi?id=233227 Reviewed by Robin Morisset. For now, this new target isn't hooked up to any automated testing - it's just a local target which developers can run. * Configurations/WGSLUnitTests.xcconfig: Added. * WGSLUnitTests/WGSLUnitTests.mm: Added. (-[WGSLUnitTests testExample]): * WebGPU.xcodeproj/project.pbxproj: * WebGPU.xcodeproj/xcshareddata/xcschemes/WGSL.xcscheme: * WebGPU.xcodeproj/xcshareddata/xcschemes/WGSLUnitTests.xcscheme: Copied from Source/WebGPU/WebGPU.xcodeproj/xcshareddata/xcschemes/WGSL.xcscheme. 2021-11-14 Myles C. Maxfield [WebGPU] Add necessary additions to WebGPU.framework https://bugs.webkit.org/show_bug.cgi?id=233091 Reviewed by Dean Jackson. WebGPU.framework's header file is lagging a bit behind the official WebGPU API. This updates a companion header, WebGPUExt.h, with the necessary additions. I don't want to modify the primary header, WebGPU.h, because it's shared among multiple projects, so coordination is necessary to modify it. * WebGPU/Adapter.h: * WebGPU/Adapter.mm: (WebGPU::Adapter::getFeatureAtIndex): (wgpuAdapterGetFeatureAtIndex): * WebGPU/BindGroup.h: * WebGPU/BindGroup.mm: (WebGPU::BindGroup::setLabel): (wgpuBindGroupSetLabel): * WebGPU/BindGroupLayout.h: * WebGPU/BindGroupLayout.mm: (WebGPU::BindGroupLayout::setLabel): (wgpuBindGroupLayoutSetLabel): * WebGPU/Buffer.h: * WebGPU/Buffer.mm: (WebGPU::Buffer::setLabel): (wgpuBufferSetLabel): * WebGPU/CommandBuffer.h: * WebGPU/CommandBuffer.mm: (WebGPU::CommandBuffer::setLabel): (wgpuCommandBufferSetLabel): * WebGPU/CommandEncoder.h: * WebGPU/CommandEncoder.mm: (WebGPU::CommandEncoder::fillBuffer): (WebGPU::CommandEncoder::setLabel): (wgpuCommandEncoderFillBuffer): (wgpuCommandEncoderSetLabel): * WebGPU/ComputePassEncoder.h: * WebGPU/ComputePassEncoder.mm: (WebGPU::ComputePassEncoder::setLabel): (wgpuComputePassEncoderSetLabel): * WebGPU/Device.h: * WebGPU/Device.mm: (WebGPU::Device::setLabel): (wgpuDeviceSetLabel): * WebGPU/Instance.mm: (wgpuGetProcAddress): * WebGPU/PipelineLayout.h: * WebGPU/PipelineLayout.mm: (WebGPU::PipelineLayout::setLabel): (wgpuPipelineLayoutSetLabel): * WebGPU/QuerySet.h: * WebGPU/QuerySet.mm: (WebGPU::QuerySet::setLabel): (wgpuQuerySetSetLabel): * WebGPU/Queue.h: * WebGPU/Queue.mm: (WebGPU::Queue::setLabel): (wgpuQueueSetLabel): * WebGPU/RenderBundle.h: * WebGPU/RenderBundle.mm: (WebGPU::RenderBundle::setLabel): (wgpuRenderBundleSetLabel): * WebGPU/RenderBundleEncoder.h: * WebGPU/RenderBundleEncoder.mm: (WebGPU::RenderBundleEncoder::setLabel): (wgpuRenderBundleEncoderSetLabel): * WebGPU/RenderPassEncoder.h: * WebGPU/RenderPassEncoder.mm: (WebGPU::RenderPassEncoder::setLabel): (wgpuRenderPassEncoderSetLabel): * WebGPU/Sampler.h: * WebGPU/Sampler.mm: (WebGPU::Sampler::setLabel): (wgpuSamplerSetLabel): * WebGPU/Texture.h: * WebGPU/Texture.mm: (WebGPU::Texture::setLabel): (wgpuTextureSetLabel): * WebGPU/TextureView.h: * WebGPU/TextureView.mm: (WebGPU::TextureView::setLabel): (wgpuTextureViewSetLabel): * WebGPU/WebGPUExt.h: 2021-11-09 Myles C. Maxfield [WebGPU] Stub out methods in WebGPU.framework https://bugs.webkit.org/show_bug.cgi?id=232872 Reviewed by Dean Jackson. This creates empty implementations for all the methods in WebGPU.framework. This means that there are now implementations for every API call, so PAL can successfully call into WebGPU.framework and link with it. * Configurations/Version.xcconfig: Added. * Configurations/WebGPU.xcconfig: * WebGPU.xcodeproj/project.pbxproj: * WebGPU/Adapter.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/Adapter.mm: Added. (WebGPU::Adapter::getLimits): (WebGPU::Adapter::getProperties): (WebGPU::Adapter::hasFeature): (WebGPU::Adapter::requestDevice): (wgpuAdapterRelease): (wgpuAdapterGetLimits): (wgpuAdapterGetProperties): (wgpuAdapterHasFeature): (wgpuAdapterRequestDevice): * WebGPU/BindGroup.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/BindGroup.mm: Copied from Source/WebGPU/WebGPU/WebGPUObjC.mm. (wgpuBindGroupRelease): * WebGPU/BindGroupLayout.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/BindGroupLayout.mm: Renamed from Source/WebGPU/WebGPU/WebGPU.cpp. (wgpuBindGroupLayoutRelease): * WebGPU/Buffer.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/Buffer.mm: Added. (WebGPU::Buffer::destroy): (WebGPU::Buffer::getConstMappedRange): (WebGPU::Buffer::getMappedRange): (WebGPU::Buffer::mapAsync): (WebGPU::Buffer::unmap): (wgpuBufferRelease): (wgpuBufferDestroy): (wgpuBufferGetConstMappedRange): (wgpuBufferGetMappedRange): (wgpuBufferMapAsync): (wgpuBufferUnmap): * WebGPU/CommandBuffer.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/CommandBuffer.mm: Copied from Source/WebGPU/WebGPU/WebGPUObjC.mm. (wgpuCommandBufferRelease): * WebGPU/CommandEncoder.h: Added. * WebGPU/CommandEncoder.mm: Added. (WebGPU::CommandEncoder::beginComputePass): (WebGPU::CommandEncoder::beginRenderPass): (WebGPU::CommandEncoder::copyBufferToBuffer): (WebGPU::CommandEncoder::copyBufferToTexture): (WebGPU::CommandEncoder::copyTextureToBuffer): (WebGPU::CommandEncoder::copyTextureToTexture): (WebGPU::CommandEncoder::finish): (WebGPU::CommandEncoder::insertDebugMarker): (WebGPU::CommandEncoder::popDebugGroup): (WebGPU::CommandEncoder::pushDebugGroup): (WebGPU::CommandEncoder::resolveQuerySet): (WebGPU::CommandEncoder::writeTimestamp): (wgpuCommandEncoderRelease): (wgpuCommandEncoderBeginComputePass): (wgpuCommandEncoderBeginRenderPass): (wgpuCommandEncoderCopyBufferToBuffer): (wgpuCommandEncoderCopyBufferToTexture): (wgpuCommandEncoderCopyTextureToBuffer): (wgpuCommandEncoderCopyTextureToTexture): (wgpuCommandEncoderFinish): (wgpuCommandEncoderInsertDebugMarker): (wgpuCommandEncoderPopDebugGroup): (wgpuCommandEncoderPushDebugGroup): (wgpuCommandEncoderResolveQuerySet): (wgpuCommandEncoderWriteTimestamp): * WebGPU/ComputePassEncoder.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/ComputePassEncoder.mm: Added. (WebGPU::ComputePassEncoder::beginPipelineStatisticsQuery): (WebGPU::ComputePassEncoder::dispatch): (WebGPU::ComputePassEncoder::dispatchIndirect): (WebGPU::ComputePassEncoder::endPass): (WebGPU::ComputePassEncoder::endPipelineStatisticsQuery): (WebGPU::ComputePassEncoder::insertDebugMarker): (WebGPU::ComputePassEncoder::popDebugGroup): (WebGPU::ComputePassEncoder::pushDebugGroup): (WebGPU::ComputePassEncoder::setBindGroup): (WebGPU::ComputePassEncoder::setPipeline): (WebGPU::ComputePassEncoder::writeTimestamp): (wgpuComputePassEncoderRelease): (wgpuComputePassEncoderBeginPipelineStatisticsQuery): (wgpuComputePassEncoderDispatch): (wgpuComputePassEncoderDispatchIndirect): (wgpuComputePassEncoderEndPass): (wgpuComputePassEncoderEndPipelineStatisticsQuery): (wgpuComputePassEncoderInsertDebugMarker): (wgpuComputePassEncoderPopDebugGroup): (wgpuComputePassEncoderPushDebugGroup): (wgpuComputePassEncoderSetBindGroup): (wgpuComputePassEncoderSetPipeline): (wgpuComputePassEncoderWriteTimestamp): * WebGPU/ComputePipeline.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/ComputePipeline.mm: Copied from Source/WebGPU/WebGPU/WebGPUObjC.mm. (WebGPU::ComputePipeline::getBindGroupLayout): (WebGPU::ComputePipeline::setLabel): (wgpuComputePipelineRelease): (wgpuComputePipelineGetBindGroupLayout): (wgpuComputePipelineSetLabel): * WebGPU/Device.h: Added. * WebGPU/Device.mm: Added. (WebGPU::Device::createBindGroup): (WebGPU::Device::createBindGroupLayout): (WebGPU::Device::createBuffer): (WebGPU::Device::createCommandEncoder): (WebGPU::Device::createComputePipeline): (WebGPU::Device::createComputePipelineAsync): (WebGPU::Device::createPipelineLayout): (WebGPU::Device::createQuerySet): (WebGPU::Device::createRenderBundleEncoder): (WebGPU::Device::createRenderPipeline): (WebGPU::Device::createRenderPipelineAsync): (WebGPU::Device::createSampler): (WebGPU::Device::createShaderModule): (WebGPU::Device::createSwapChain): (WebGPU::Device::createTexture): (WebGPU::Device::destroy): (WebGPU::Device::getLimits): (WebGPU::Device::getQueue): (WebGPU::Device::popErrorScope): (WebGPU::Device::pushErrorScope): (WebGPU::Device::setDeviceLostCallback): (WebGPU::Device::setUncapturedErrorCallback): (wgpuDeviceRelease): (wgpuDeviceCreateBindGroup): (wgpuDeviceCreateBindGroupLayout): (wgpuDeviceCreateBuffer): (wgpuDeviceCreateCommandEncoder): (wgpuDeviceCreateComputePipeline): (wgpuDeviceCreateComputePipelineAsync): (wgpuDeviceCreatePipelineLayout): (wgpuDeviceCreateQuerySet): (wgpuDeviceCreateRenderBundleEncoder): (wgpuDeviceCreateRenderPipeline): (wgpuDeviceCreateRenderPipelineAsync): (wgpuDeviceCreateSampler): (wgpuDeviceCreateShaderModule): (wgpuDeviceCreateSwapChain): (wgpuDeviceCreateTexture): (wgpuDeviceDestroy): (wgpuDeviceGetLimits): (wgpuDeviceGetQueue): (wgpuDevicePopErrorScope): (wgpuDevicePushErrorScope): (wgpuDeviceSetDeviceLostCallback): (wgpuDeviceSetUncapturedErrorCallback): * WebGPU/ExportMacros.h: * WebGPU/Instance.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/Instance.mm: Added. (WebGPU::Instance::createSurface): (WebGPU::Instance::processEvents): (WebGPU::Instance::requestAdapter): (wgpuInstanceRelease): (wgpuCreateInstance): (wgpuGetProcAddress): (wgpuInstanceCreateSurface): (wgpuInstanceProcessEvents): (wgpuInstanceRequestAdapter): * WebGPU/PipelineLayout.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/PipelineLayout.mm: Copied from Source/WebGPU/WebGPU/WebGPUObjC.mm. (wgpuPipelineLayoutRelease): * WebGPU/QuerySet.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/QuerySet.mm: Copied from Source/WebGPU/WebGPU/WebGPUObjC.mm. (WebGPU::QuerySet::destroy): (wgpuQuerySetRelease): (wgpuQuerySetDestroy): * WebGPU/Queue.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/Queue.mm: Added. (WebGPU::Queue::onSubmittedWorkDone): (WebGPU::Queue::submit): (WebGPU::Queue::writeBuffer): (WebGPU::Queue::writeTexture): (wgpuQueueRelease): (wgpuQueueOnSubmittedWorkDone): (wgpuQueueSubmit): (wgpuQueueWriteBuffer): (wgpuQueueWriteTexture): * WebGPU/RenderBundle.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/RenderBundle.mm: Copied from Source/WebGPU/WebGPU/WebGPUObjC.mm. (wgpuRenderBundleRelease): * WebGPU/RenderBundleEncoder.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/RenderBundleEncoder.mm: Added. (WebGPU::RenderBundleEncoder::draw): (WebGPU::RenderBundleEncoder::drawIndexed): (WebGPU::RenderBundleEncoder::drawIndexedIndirect): (WebGPU::RenderBundleEncoder::drawIndirect): (WebGPU::RenderBundleEncoder::finish): (WebGPU::RenderBundleEncoder::insertDebugMarker): (WebGPU::RenderBundleEncoder::popDebugGroup): (WebGPU::RenderBundleEncoder::pushDebugGroup): (WebGPU::RenderBundleEncoder::setBindGroup): (WebGPU::RenderBundleEncoder::setIndexBuffer): (WebGPU::RenderBundleEncoder::setPipeline): (WebGPU::RenderBundleEncoder::setVertexBuffer): (wgpuRenderBundleEncoderRelease): (wgpuRenderBundleEncoderDraw): (wgpuRenderBundleEncoderDrawIndexed): (wgpuRenderBundleEncoderDrawIndexedIndirect): (wgpuRenderBundleEncoderDrawIndirect): (wgpuRenderBundleEncoderFinish): (wgpuRenderBundleEncoderInsertDebugMarker): (wgpuRenderBundleEncoderPopDebugGroup): (wgpuRenderBundleEncoderPushDebugGroup): (wgpuRenderBundleEncoderSetBindGroup): (wgpuRenderBundleEncoderSetIndexBuffer): (wgpuRenderBundleEncoderSetPipeline): (wgpuRenderBundleEncoderSetVertexBuffer): * WebGPU/RenderPassEncoder.h: Added. * WebGPU/RenderPassEncoder.mm: Added. (WebGPU::RenderPassEncoder::beginOcclusionQuery): (WebGPU::RenderPassEncoder::beginPipelineStatisticsQuery): (WebGPU::RenderPassEncoder::draw): (WebGPU::RenderPassEncoder::drawIndexed): (WebGPU::RenderPassEncoder::drawIndexedIndirect): (WebGPU::RenderPassEncoder::drawIndirect): (WebGPU::RenderPassEncoder::endOcclusionQuery): (WebGPU::RenderPassEncoder::endPass): (WebGPU::RenderPassEncoder::endPipelineStatisticsQuery): (WebGPU::RenderPassEncoder::executeBundles): (WebGPU::RenderPassEncoder::insertDebugMarker): (WebGPU::RenderPassEncoder::popDebugGroup): (WebGPU::RenderPassEncoder::pushDebugGroup): (WebGPU::RenderPassEncoder::setBindGroup): (WebGPU::RenderPassEncoder::setBlendConstant): (WebGPU::RenderPassEncoder::setIndexBuffer): (WebGPU::RenderPassEncoder::setPipeline): (WebGPU::RenderPassEncoder::setScissorRect): (WebGPU::RenderPassEncoder::setStencilReference): (WebGPU::RenderPassEncoder::setVertexBuffer): (WebGPU::RenderPassEncoder::setViewport): (WebGPU::RenderPassEncoder::writeTimestamp): (wgpuRenderPassEncoderRelease): (wgpuRenderPassEncoderBeginOcclusionQuery): (wgpuRenderPassEncoderBeginPipelineStatisticsQuery): (wgpuRenderPassEncoderDraw): (wgpuRenderPassEncoderDrawIndexed): (wgpuRenderPassEncoderDrawIndexedIndirect): (wgpuRenderPassEncoderDrawIndirect): (wgpuRenderPassEncoderEndOcclusionQuery): (wgpuRenderPassEncoderEndPass): (wgpuRenderPassEncoderEndPipelineStatisticsQuery): (wgpuRenderPassEncoderExecuteBundles): (wgpuRenderPassEncoderInsertDebugMarker): (wgpuRenderPassEncoderPopDebugGroup): (wgpuRenderPassEncoderPushDebugGroup): (wgpuRenderPassEncoderSetBindGroup): (wgpuRenderPassEncoderSetBlendConstant): (wgpuRenderPassEncoderSetIndexBuffer): (wgpuRenderPassEncoderSetPipeline): (wgpuRenderPassEncoderSetScissorRect): (wgpuRenderPassEncoderSetStencilReference): (wgpuRenderPassEncoderSetVertexBuffer): (wgpuRenderPassEncoderSetViewport): (wgpuRenderPassEncoderWriteTimestamp): * WebGPU/RenderPipeline.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/RenderPipeline.mm: Copied from Source/WebGPU/WebGPU/WebGPUObjC.mm. (WebGPU::RenderPipeline::getBindGroupLayout): (WebGPU::RenderPipeline::setLabel): (wgpuRenderPipelineRelease): (wgpuRenderPipelineGetBindGroupLayout): (wgpuRenderPipelineSetLabel): * WebGPU/Sampler.h: Renamed from Source/WebGPU/WebGPU/WebGPUObjC.h. * WebGPU/Sampler.mm: Copied from Source/WebGPU/WebGPU/WebGPUObjC.mm. (wgpuSamplerRelease): * WebGPU/ShaderModule.h: * WebGPU/ShaderModule.mm: Copied from Source/WebGPU/WebGPU/WebGPUObjC.mm. (WebGPU::ShaderModule::setLabel): (wgpuShaderModuleRelease): (wgpuShaderModuleSetLabel): * WebGPU/Surface.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/Surface.mm: Copied from Source/WebGPU/WebGPU/WebGPUObjC.mm. (WebGPU::Surface::getPreferredFormat): (wgpuSurfaceRelease): (wgpuSurfaceGetPreferredFormat): * WebGPU/SwapChain.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/SwapChain.mm: Copied from Source/WebGPU/WebGPU/WebGPUObjC.mm. (WebGPU::SwapChain::getCurrentTextureView): (WebGPU::SwapChain::present): (wgpuSwapChainRelease): (wgpuSwapChainGetCurrentTextureView): (wgpuSwapChainPresent): * WebGPU/Texture.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/Texture.mm: Copied from Source/WebGPU/WebGPU/WebGPUObjC.mm. (WebGPU::Texture::createView): (WebGPU::Texture::destroy): (wgpuTextureRelease): (wgpuTextureCreateView): (wgpuTextureDestroy): * WebGPU/TextureView.h: Copied from Source/WebGPU/WebGPU/ShaderModule.h. * WebGPU/TextureView.mm: Renamed from Source/WebGPU/WebGPU/WebGPUObjC.mm. (wgpuTextureViewRelease): * WebGPU/WebGPU.modulemap: Added. * WebGPU/WebGPUExt.h: Added. 2021-10-19 Myles C. Maxfield Make WebGPU.xcodeproj and WebGPU.framework https://bugs.webkit.org/show_bug.cgi?id=231661 Reviewed by Dean Jackson and Robin Morisset. We've gotten some requests to be able to use WebGPU from native code, without requiring all of WebKit. This patch creates a new Xcode project that creates a new framework for WebGPU, so these internal users can build it / include it in their own projects. This project has two targets: One for WGSL and one for WebGPU. WGSL creates a static library, and WebGPU links with it, and produces a framework. This patch implements one dummy function from each of them. * Configurations/Base.xcconfig: Added. * Configurations/DebugRelease.xcconfig: Added. * Configurations/SDKVariant.xcconfig: Added. * Configurations/WGSL.xcconfig: Added. * Configurations/WebGPU.xcconfig: Added. * Info.plist: Added. * Makefile: Added. * WGSL/AST.h: Added. * WGSL/WGSL.cpp: Added. (WGSL::check): (WGSL::SuccessfulCheck::~SuccessfulCheck): * WGSL/WGSL.h: Added. * WGSL/config.h: Added. * WebGPU.xcodeproj/project.pbxproj: Added. * WebGPU.xcodeproj/xcshareddata/xcschemes/WGSL.xcscheme: Added. * WebGPU.xcodeproj/xcshareddata/xcschemes/WebGPU.xcscheme: Added. * WebGPU/ExportMacros.h: Added. * WebGPU/ShaderModule.h: Added. * WebGPU/WebGPU.cpp: Added. (wgpuDeviceCreateShaderModule): * WebGPU/WebGPU.h: Added. * WebGPU/WebGPUObjC.h: Added. * WebGPU/WebGPUObjC.mm: Added. (objcFunction): * WebGPU/config.h: Added.