Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

kdashg
Copy link
Contributor

@kdashg kdashg commented Mar 26, 2020

@kdashg kdashg added programming model wgsl WebGPU Shading Language Issues labels Mar 26, 2020
Copy link

@damyanp damyanp left a comment

Choose a reason for hiding this comment

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

Thank you for putting this together @jdashg . This does seem like it should meet our goals for allowing a rich debugging experience where WGSL is used as an intermediate language.

@kdashg kdashg requested a review from Kangz April 14, 2020 00:57
@Kangz
Copy link
Contributor

Kangz commented Apr 14, 2020

TL;DR The combination of these two PRs #645 and #646 make source maps normative and I want to make sure we are aware of it when we make decisions on them.

While I very much agree with the sentiment in this issue that this is a good thing, I believe it will be the first time that source maps are added in an application-visible way to the Web platform. AFAIK previous usages only interact with the devtools and are not observable programmatically.

The addition of sourcemaps here and the mapped* members in #646 mean that the interpretation of sourcemaps by the browser is visible to the application and we now need to have a normative specification of sourcemaps and of the relationship between non-mapped and mapped source position. That's unless we say that mapped* are pure hints to the application and cannot be relied to be portable.

@damyanp
Copy link

damyanp commented Apr 15, 2020

If we don't make them normative then I wonder what would prevent them becoming vendor-specified opaque blobs?

@kdashg
Copy link
Contributor Author

kdashg commented Apr 16, 2020

There's already a cross-browser spec for this, and the way I referenced it here does make it normative.
The existing spec is for ensuring that sourcemaps are cross-UA interoperable. Though there's no programatic way to validate this at the moment (I think?), there's pre-existing vested interest by UAs in ensuring cross-compatibility.
I think the main difference here is that we're making this cross-compatibility observable, but I don't think we need much more work do make this happen. I suppose we should reach out to our source-maps colleagues and check!

spec/index.bs Outdated
};
</script>

{{GPUShaderModuleDescriptor/sourceMap}}, if defined, is interpreted as a source-map-v3 format.
Copy link
Contributor

@dneto0 dneto0 Apr 21, 2020

Choose a reason for hiding this comment

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

What happens if there's a sourcemap v4? Should there be another field that specifies the version of the sourcemap? Or would you require a new GPUShaerModuleDescriptor when that time comes?

Copy link
Contributor

Choose a reason for hiding this comment

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

[from meeting] Source map spec has a version field at the top level.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will s/is interpreted as/MAY be interpreted as/

@grorg
Copy link
Contributor

grorg commented Apr 21, 2020

Discussed at the 2020-04-21 meeting.

Copy link
Contributor

@litherum litherum left a comment

Choose a reason for hiding this comment

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

I just chatted with our team about this. We are comfortable with this pull request.

We're a little concerned about future-proofing this API; in particular, source maps are a big space with lots of work being done for WebAssembly. It's unlikely that the "source-map-v3" will stand the test of time, so we need to have a good story for future evolution of this API.

One possible story is "the type of sourceMap is just an object, so browsers can support whatever format they want in there and authors can migrate to better formats as they are supported." This is an okay start, but could possibly lead to fragmentation because this format doesn't actually affect behavior, so browsers are less incentivized to match each other. Developer tools for WebGPU are very important to us. Perhaps there is a better solution out there.

@kainino0x
Copy link
Contributor

As I was talking about on the call, I think the solution used by source maps for JavaScript is a good one: there's no breakable API surface that cares about what the format of the source map is. The browsers need only to support it in their dev tools. If the application wants to apply source mapping to errors, it can do so with a userspace source map library. They ship their source maps along with that library so there's no possibility of breakage.

Taking that approach is compatible with this PR as-is, but requires mappedLine et al to be removed from #646.

Did you happen to get feedback from your team on that approach?

@litherum
Copy link
Contributor

litherum commented Apr 24, 2020

The case we’re worried about is browser A switches to some proprietary source map format, an author develops a page in that browser using this proprietary format, someone else opens that page in Safari’s Web Inspector, sees unreadable shader contents in the relevant panel, and thinks that Safai’s dev tools are worse than browser A's.

@kainino0x
Copy link
Contributor

But that's exactly the situation with JavaScript source maps. What makes WGSL special?

I also assume each browser would probably reuse the implementation it uses for JS for WGSL, so I really don't think WGSL source maps would diverge faster than JS source maps. Unless we are talking about some format that's somehow conceptually far better than source maps, in which case a browser's dev tools would actually be concretely better for supporting that new format.

@litherum
Copy link
Contributor

But that's exactly the situation with JavaScript source maps. What makes WGSL special?

Our representatives to ECMA are concerned about this too.

@grorg
Copy link
Contributor

grorg commented May 1, 2020

@jdashg do you think this should be discussed again at the WebGPU meeting or the WGSL meeting?

@kdashg
Copy link
Contributor Author

kdashg commented May 4, 2020

For topics that straddle the API/shader boundary, I think the main group is best. In my mind the language meetings are like a sub-group that reports up to the main group, so topics that concern everyone would default to the full main CG meeting.

@kvark
Copy link
Contributor

kvark commented May 7, 2020

One idea that came up in a discussion with @jdashg is making this an extension. That would allow us to still test this with the CTS, and yet allow to iterate on that later. For example, if sourcemap v4 standard comes out, we can just release a new extension.

@kainino0x kainino0x merged commit 68331a1 into gpuweb:master May 18, 2020
JusSn pushed a commit to JusSn/gpuweb that referenced this pull request Jun 8, 2020
* Add GPUShaderModuleDescriptor/sourceMap.

* Dictionary members are optional unless required, s/non-null/defined/.

* `sourceMap` MAY be a source-map-v3 format, but it's not required.
JusSn pushed a commit to JusSn/gpuweb that referenced this pull request Jun 8, 2020
* Add GPUShaderModuleDescriptor/sourceMap.

* Dictionary members are optional unless required, s/non-null/defined/.

* `sourceMap` MAY be a source-map-v3 format, but it's not required.
ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this pull request Sep 6, 2022
'clear' has been renamed to 'discard' in the spec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
programming model wgsl WebGPU Shading Language Issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants