这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@kdashg
Copy link
Contributor

@kdashg kdashg commented Mar 26, 2020

@kdashg
Copy link
Contributor Author

kdashg commented Mar 26, 2020

Sorry y'all. :)

@kainino0x
Copy link
Contributor

Title says GPUQueue.mapBuffer but the PR has GPUBuffer.map?

@kdashg
Copy link
Contributor Author

kdashg commented Mar 26, 2020

Haha, I got bit by git commit -a --amend --no-edit 🙃

@Kangz Kangz changed the title GPUQueue.mapBuffer() with subranges. GPUBuffer.map() with subranges. Mar 30, 2020
@kdashg kdashg changed the title GPUBuffer.map() with subranges. GPUBuffer.mapRange() with subranges. Mar 30, 2020
Copy link
Contributor

@kvark kvark left a comment

Choose a reason for hiding this comment

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

Left some notes here. What's also critically missing is a description of differences with #605 in the PR (not the spec).
One important difference that I noticed so far is that there are no limitations on what buffers can be mappable at all, while #605 requires them to basically be staging buffers. This changes the semantics or the API and implementation complexity quite a bit.


If size is zero, {{GPUBuffer/map}} treats it as an effective size of buffer-length-starting-at-offset.
Effective size of a mapping must not be zero.
{{GPUBuffer/map}} fails (and rejects) if the range overlaps with already-mapped ranges in GPUBuffer.
Copy link
Contributor

Choose a reason for hiding this comment

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

any alignment rules here?

If |getMappedRange| succeeds, the subrange is set to the "visible" state.

It is an error if |unmapRange| specifies range that:
* Is not "mapped" or "visible".
Copy link
Contributor

Choose a reason for hiding this comment

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

does a range even have a single "state" in this approach? If I map 0..10 but then 0..4 become "visible", then the whole 0..10 doesn't have a single state that we can talk about

If size is zero, {{GPUBuffer/map}} treats it as an effective size of buffer-length-starting-at-offset.
Effective size of a mapping must not be zero.
{{GPUBuffer/map}} fails (and rejects) if the range overlaps with already-mapped ranges in GPUBuffer.
{{GPUBuffer/map}}'s Promise resolves before {{GPUFence/onCompletion}}'s Promise for any
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's consider this scenario:

  • user submits work X on part A of a buffer
  • user requests to map part B of the buffer, B doesn't intersect with A
  • user submits work Y on part A of the buffer

The rules you specify basically guarantee that the mapping resolves while part A is still being used by the GPU. So this proposal requires the implementation to track buffer sub-ranges independently. I think it's essential to write it down clearly (i.e. what the implementations are supposed to do) instead of implying.

@Kangz
Copy link
Contributor

Kangz commented Apr 20, 2020

Closing since we agreed on a mapAsync similar to #605

@Kangz Kangz closed this Apr 20, 2020
ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this pull request Sep 6, 2022
order of conditions was flipped in WGSL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants