Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 66035f0df72081e8a186bbcfe25042046f586069
      
https://github.com/WebKit/WebKit/commit/66035f0df72081e8a186bbcfe25042046f586069
  Author: Geoffrey Garen <[email protected]>
  Date:   2025-11-18 (Tue, 18 Nov 2025)

  Changed paths:
    M Source/WebGPU/WebGPU/BindGroup.mm
    M Source/WebGPU/WebGPU/Sampler.h
    M Source/WebGPU/WebGPU/Sampler.mm

  Log Message:
  -----------
  [WebGPU] Clean up MTLSamplerState cache logic
https://bugs.webkit.org/show_bug.cgi?id=302729
rdar://164991782

Reviewed by Mike Wyrzykowski.

This patch does two things:

1. Remove the reinterpret_cast<uintptr_t> I just added for SaferCPP. Pointer =>
integer cast is technically memory-safe so long as you don't cast back. But it's
still sketchy. This patch replaces explicit pointer tracking with a use count.

2. Fix the cache eviction logic regression in 294328@main. I realized that the
reinterpret_cast logic was a no-op, so I considered just removing it, but Mike
and I discovered that the no-op was a regression. So let's fix it instead.

In extreme cases, we want to evict live entries from the cache and regenerate
them on demand. For example, if a program is churning Sampler allocations, and
GC is not keeping up -- similar to a problem we sometimes have with <canvas> --
we want to reclaim live MTLSamplers instead of just failing. We model this using
a strong + weak reference in the cache. We use our weak reference to detect
whether reclamation succeeds when we clear our strong reference.

Canonical link: https://commits.webkit.org/303218@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to