Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle 2024-08 spec. rename of image copy APIs #6618

Conversation

ErichDonGubler
Copy link
Member

@ErichDonGubler ErichDonGubler commented Nov 26, 2024

Resolves #6617.

Recommended review experience is commit-by-commit. Each individual commit should pass CI!

This commit was authored by running the following Nushell script, using
the `nu` binary and the lovely `fastmod` tool:

```nushell
# Copy-pasted from the OP in [`gpuweb`gfx-rs#4838](gpuweb/gpuweb#4838).
let renames_table = '
Type 	Old 	New 	Used in
dict 	GPUImageDataLayout 	GPUTexelCopyBufferLayout 	"writeTexture,
parent type of ↙"
dict 	GPUImageCopyBuffer 	"GPUTexelCopyBufferInfo
extends ↑" 	T2B, B2T
dict 	GPUImageCopyTexture 	GPUTexelCopyTextureInfo 	T2B, B2T, T2T, writeTexture
dict 	GPUImageCopyTextureTagged 	"GPUCopyExternalImageDestInfo
extends ↑" 	copyExternalImageToTexture
dict 	GPUImageCopyExternalImage 	GPUCopyExternalImageSourceInfo 	copyExternalImageToTexture
union 	GPUImageCopyExternalImageSource 	GPUCopyExternalImageSource 	member of ↖
'

let renames_table = $renames_table
  | from tsv
  | select 'Old ' 'New '
  | rename old new
  | update new { $in | lines | get 0 } # only the first line has the renamed symbol identifier
  | update old { strip_gpu_prefix | str trim }
  | update new { strip_gpu_prefix | str trim }
  | sort-by old | reverse # Replace most specific symbol names first (some have the same "word segments" but with fewer segments)

def strip_gpu_prefix []: string -> string {
  $in | str replace --regex '^GPU' ''
}

# Rename image APIs.
for entry in $renames_table {
  fastmod --accept-all --fixed-strings $entry.old $entry.new --iglob '!CHANGELOG.md' --iglob "!xtask/src/vendor_web_sys.rs" --iglob '!wgpu/src/backend/webgpu/webgpu_sys/' --iglob '!deno_webgpu/' --iglob '!wgpu/src/backend/webgpu.rs'
}
cargo fmt
```

…and cleaning up `deno_webgpu/`'s Rust compilation errors.
@ErichDonGubler ErichDonGubler changed the title refactor!: handle 2024-08 spec. rename of image copy APIs Handle 2024-08 spec. rename of image copy APIs Nov 26, 2024
@crowlKats
Copy link
Collaborator

Would you be able to update the deno JS file & the structs with those names that deno defines as well? If not, no worries and I can do it

@ErichDonGubler
Copy link
Member Author

@crowlKats: I've handled the rename in deno_webgpu with a new stand-alone commit at the tip of this PR. I haven't tested JS execution, but deno_webgpu still compiles for me.

@ErichDonGubler ErichDonGubler self-assigned this Nov 26, 2024
@ErichDonGubler ErichDonGubler added the kind: refactor Making existing function faster or nicer label Nov 26, 2024
@ErichDonGubler
Copy link
Member Author

Just holding off on merging here until @crowlKats confirms that things look okay on the Deno end of this PR.

Copy link
Collaborator

@crowlKats crowlKats left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect, LGTM, thanks!

@ErichDonGubler ErichDonGubler merged commit 170f457 into gfx-rs:trunk Nov 27, 2024
27 checks passed
@ErichDonGubler ErichDonGubler deleted the 2024-09-image-transfer-renames branch November 27, 2024 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: refactor Making existing function faster or nicer
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Handle 2024-08 spec. renames in image copy APIs
3 participants