Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 5138438b500796279ab122bbcce0c1af840579d0 https://github.com/WebKit/WebKit/commit/5138438b500796279ab122bbcce0c1af840579d0 Author: Geoffrey Garen <gga...@apple.com> Date: 2024-10-21 (Mon, 21 Oct 2024)
Changed paths: M Source/WTF/WTF.xcodeproj/project.pbxproj M Source/WTF/wtf/CMakeLists.txt M Source/WTF/wtf/Compiler.h M Source/WTF/wtf/FastFloat.cpp M Source/WTF/wtf/FastFloat.h A Source/WTF/wtf/IndexedRange.h M Source/WTF/wtf/ReferenceWrapperVector.h M Source/WTF/wtf/dtoa/utils.h M Source/WebGPU/Configurations/Base.xcconfig M Source/WebGPU/WGSL/AST/ASTBinaryExpression.h M Source/WebGPU/WGSL/AST/ASTBuilder.cpp M Source/WebGPU/WGSL/AST/ASTBuilder.h M Source/WebGPU/WGSL/AST/ASTUnaryExpression.h M Source/WebGPU/WGSL/Lexer.cpp M Source/WebGPU/WGSL/MangleNames.cpp M Source/WebGPU/WGSL/Parser.cpp M Source/WebGPU/WGSL/Types.h M Source/WebGPU/WebGPU/Adapter.mm M Source/WebGPU/WebGPU/BindGroup.mm M Source/WebGPU/WebGPU/BindGroupLayout.h M Source/WebGPU/WebGPU/BindGroupLayout.mm M Source/WebGPU/WebGPU/Buffer.mm M Source/WebGPU/WebGPU/CommandEncoder.mm M Source/WebGPU/WebGPU/ComputePassEncoder.h M Source/WebGPU/WebGPU/ComputePassEncoder.mm M Source/WebGPU/WebGPU/ComputePipeline.mm M Source/WebGPU/WebGPU/Pipeline.h M Source/WebGPU/WebGPU/Pipeline.mm M Source/WebGPU/WebGPU/PipelineLayout.mm M Source/WebGPU/WebGPU/PresentationContextIOSurface.mm M Source/WebGPU/WebGPU/Queue.mm M Source/WebGPU/WebGPU/RenderBundle.mm M Source/WebGPU/WebGPU/RenderBundleEncoder.mm M Source/WebGPU/WebGPU/RenderPassEncoder.h M Source/WebGPU/WebGPU/RenderPassEncoder.mm M Source/WebGPU/WebGPU/RenderPipeline.mm M Source/WebGPU/WebGPU/ShaderModule.mm M Source/WebGPU/WebGPU/Texture.mm M Source/WebGPU/WebGPU/WebGPU.h Log Message: ----------- Enforce -Wunsafe-buffer-usage in Source/WebGPU https://bugs.webkit.org/show_bug.cgi?id=281792 rdar://138218909 Reviewed by Mike Wyrzykowski. Added an IndexedRange class so you can access the iteration index in a safe range-based for loop: for (auto [ index, value ] : IndexedRange(collection)) { ... } Deployed std::array and std::span in lots of places. Added a parseHexDouble helper because, hilariously, it is the year 2024 and there is no bounds-check aware option for hex parsing of 16bit characters in C or C++. I chose to make xxxSpan() member functions for most WGPU API types, rather than modifying the types themselves, in order to keep the existing API stable and reduce the scope of change. * Source/WTF/WTF.xcodeproj/project.pbxproj: * Source/WTF/wtf/CMakeLists.txt: * Source/WTF/wtf/Compiler.h: * Source/WTF/wtf/IndexedRange.h: Added. (WTF::IndexedRangeIterator::IndexedRangeIterator): (WTF::IndexedRangeIterator::operator++): (WTF::IndexedRangeIterator::operator*): (WTF::IndexedRangeIterator::operator== const): (WTF::IndexedRange::IndexedRange): (WTF::IndexedRange::begin): (WTF::IndexedRange::end): * Source/WTF/wtf/ReferenceWrapperVector.h: (WTF::ReferenceWrapperVectorIterator::operator++): (WTF::ReferenceWrapperVectorIterator::operator--): (WTF::ReferenceWrapperVectorConstIterator::operator++): (WTF::ReferenceWrapperVectorConstIterator::operator--): * Source/WTF/wtf/dtoa/utils.h: * Source/WebGPU/Configurations/Base.xcconfig: * Source/WebGPU/WGSL/AST/ASTBinaryExpression.h: (WGSL::AST::toASCIILiteral): * Source/WebGPU/WGSL/AST/ASTBuilder.cpp: (WGSL::AST::Builder::Builder): (WGSL::AST::Builder::allocateArena): (WGSL::AST::Builder::saveCurrentState): (WGSL::AST::Builder::restore): (WGSL::AST::Builder::arena): Deleted. * Source/WebGPU/WGSL/AST/ASTBuilder.h: (WGSL::AST::Builder::construct): * Source/WebGPU/WGSL/AST/ASTUnaryExpression.h: (WGSL::AST::toASCIILiteral): * Source/WebGPU/WGSL/MangleNames.cpp: (WGSL::MangledName::toString const): * Source/WebGPU/WGSL/Parser.cpp: (WGSL::Parser<Lexer>::maybeSplitToken): * Source/WebGPU/WGSL/Types.h: (WGSL::Types::PrimitiveStruct::>>): * Source/WebGPU/WebGPU/Adapter.mm: (WebGPU::Adapter::requestDevice): * Source/WebGPU/WebGPU/BindGroup.mm: (WebGPU::Device::createExternalTextureFromPixelBuffer const): (WebGPU::Device::createBindGroup): * Source/WebGPU/WebGPU/BindGroupLayout.h: * Source/WebGPU/WebGPU/BindGroupLayout.mm: (WebGPU::Device::createBindGroupLayout): (WebGPU::BindGroupLayout::errorValidatingDynamicOffsets const): * Source/WebGPU/WebGPU/Buffer.mm: (WebGPU::span): (WebGPU::Buffer::getMappedRange): (WebGPU::Buffer::getBufferContents): * Source/WebGPU/WebGPU/CommandEncoder.mm: (WebGPU::CommandEncoder::beginRenderPass): * Source/WebGPU/WebGPU/ComputePassEncoder.h: * Source/WebGPU/WebGPU/ComputePassEncoder.mm: (WebGPU::ComputePassEncoder::setBindGroup): (wgpuComputePassEncoderSetBindGroup): * Source/WebGPU/WebGPU/ComputePipeline.mm: * Source/WebGPU/WebGPU/Pipeline.h: * Source/WebGPU/WebGPU/Pipeline.mm: (WebGPU::createLibrary): * Source/WebGPU/WebGPU/PipelineLayout.mm: (WebGPU::Device::createPipelineLayout): * Source/WebGPU/WebGPU/PresentationContextIOSurface.mm: (WebGPU::PresentationContextIOSurface::configure): * Source/WebGPU/WebGPU/Queue.mm: (WebGPU::Queue::writeBuffer): (WebGPU::Queue::writeTexture): (wgpuQueueSubmit): * Source/WebGPU/WebGPU/RenderBundle.mm: (WebGPU::RenderBundle::updateMinMaxDepths): (WebGPU::RenderBundle::validateRenderPass const): * Source/WebGPU/WebGPU/RenderBundleEncoder.mm: (WebGPU::makeRenderBundleICBWithResources): (WebGPU::Device::createRenderBundleEncoder): (WebGPU::makeSpanFromBuffer): (WebGPU::RenderBundleEncoder::executePreDrawCommands): (WebGPU::RenderBundleEncoder::setBindGroup): * Source/WebGPU/WebGPU/RenderPassEncoder.h: * Source/WebGPU/WebGPU/RenderPassEncoder.mm: (WebGPU::m_maxDrawCount): (WebGPU::RenderPassEncoder::setBindGroup): (wgpuRenderPassEncoderExecuteBundles): (wgpuRenderPassEncoderSetBindGroup): * Source/WebGPU/WebGPU/RenderPipeline.mm: (WebGPU::createVertexDescriptor): (WebGPU::Device::addPipelineLayouts): (WebGPU::RenderPipeline::validateRenderBundle const): * Source/WebGPU/WebGPU/ShaderModule.mm: (WebGPU::earlyCompileShaderModule): * Source/WebGPU/WebGPU/Texture.mm: (WebGPU::Device::createTexture): * Source/WebGPU/WebGPU/WebGPU.h: (span): Canonical link: https://commits.webkit.org/285506@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes