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

[WGSL] Textures and samplers shouldn't be references #11929

Conversation

tadeuzagallo
Copy link
Member

@tadeuzagallo tadeuzagallo commented Mar 24, 2023

889edf2

[WGSL] Textures and samplers shouldn't be references
https://bugs.webkit.org/show_bug.cgi?id=254425
rdar://107188253

Reviewed by Myles C. Maxfield.

When converting globals to argument buffers, most values become references, but
that doesn't apply to textures and samplers. Add logic to check the type of the
global instead of unconditionally converting it to a reference.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::insertStructs):

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

c248a69

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ›  gtk
❌ πŸ§ͺ api-ios ❌ πŸ§ͺ mac-wk1 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ›  tv ❌ πŸ§ͺ mac-wk2 ⏳ πŸ§ͺ api-gtk
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch βœ… πŸ§ͺ mac-wk2-stress
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch-sim

@tadeuzagallo tadeuzagallo self-assigned this Mar 24, 2023
@tadeuzagallo tadeuzagallo added the WebGPU For bugs in WebGPU label Mar 24, 2023
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 24, 2023
Comment on lines +250 to +251
if (shouldBeReference)
memberType = adoptRef(*new AST::ReferenceTypeName(span, WTFMove(memberType)));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is the right design, but how confident are we that this actually works on all metal devices that we support? The output program would be something like

kernel void foo(texture2d<float> foo) {
    ...
    texture2d<float> bar = foo;
    ...
}

I guess I should try to do the research to make sure this actually works everywhere.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like yes this is supposed to work everywhere.

Copy link
Contributor

@djg djg left a comment

Choose a reason for hiding this comment

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

:shipit:

@tadeuzagallo tadeuzagallo added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Mar 28, 2023
https://bugs.webkit.org/show_bug.cgi?id=254425
rdar://107188253

Reviewed by Myles C. Maxfield.

When converting globals to argument buffers, most values become references, but
that doesn't apply to textures and samplers. Add logic to check the type of the
global instead of unconditionally converting it to a reference.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::insertStructs):

Canonical link: https://commits.webkit.org/262200@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/WGSL-Textures-and-samplers-shouldnt-be-references branch from c248a69 to 889edf2 Compare March 28, 2023 09:02
@webkit-commit-queue
Copy link
Collaborator

Committed 262200@main (889edf2): https://commits.webkit.org/262200@main

Reviewed commits have been landed. Closing PR #11929 and removing active labels.

@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Mar 28, 2023
@webkit-commit-queue webkit-commit-queue merged commit 889edf2 into WebKit:main Mar 28, 2023
@tadeuzagallo tadeuzagallo deleted the eng/WGSL-Textures-and-samplers-shouldnt-be-references branch May 17, 2023 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebGPU For bugs in WebGPU
Projects
None yet
6 participants