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

Skip to content

Conversation

kvark
Copy link
Contributor

@kvark kvark commented Aug 11, 2020

Closes #745
Closes #296
Likely conflicts with #972 (sorry!)

We describe the internal set of flags an implementation considers to track the resource usage, how they map to the descriptor flags provided by the user, and how they are validated. The "mutable"/"immutable" usage distinction is gone, and instead we have a list possible sets of compatible usages, as mentioned in #972 (comment). It also includes clarifying the notion of a "subresource" as outlined in #972 (comment)

This PR needs more work on naming and editing, so that it looks better. Input is invited!


Preview | Diff

@kvark kvark requested a review from kainino0x August 11, 2020 21:39
Copy link
Contributor

@Kangz Kangz left a comment

Choose a reason for hiding this comment

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

It looks like a great improvement. I'm not 100% sure how to make the usage classes nice though.

spec/index.bs Outdated
- {[=copy-source=] | [=input=] | [=uniform=] | [=storage-read=]} - in any combination
- [=copy-destination=] - singular usage
- {[=storage=] | [=storage-read=]} - in any combination
- [=attachment=] - singular usage
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we going to have a separate rule that disallows using a subresource for multiple attachments in the same pass?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since doing that doesn't match any of the allowed sets, the current spec automatically disallows this

Copy link
Contributor Author

@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.

Thank you for all the reviews! Hopefully addressed everything now

spec/index.bs Outdated
- {[=copy-source=] | [=input=] | [=uniform=] | [=storage-read=]} - in any combination
- [=copy-destination=] - singular usage
- {[=storage=] | [=storage-read=]} - in any combination
- [=attachment=] - singular usage
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since doing that doesn't match any of the allowed sets, the current spec automatically disallows this

spec/index.bs Outdated
- {[=internal usage/input=] | [=internal usage/constant=] | [=internal usage/storage-read=]} - in any combination
- {[=internal usage/storage=] | [=internal usage/storage-read=]} - in any combination
- [=internal usage/attachment=] - singular usage
- {[=internal usage/attachment-read=] | [=internal usage/storage-read=] | [=internal usage/constant=]} - in any combination
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not bundle this line with the first one? They seem to be split just because one talks about buffers and on about textures?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, we can merge them. But it kinda nice to have separate cases for buffers and textures...

Copy link
Contributor

@kainino0x kainino0x Aug 15, 2020

Choose a reason for hiding this comment

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

I think it's good to have them separate for buffers and textures. Maybe the two lists of sets should actually be separate: a buffer binding must be in one of these sets: (...), a texture binding must be in one of these sets: (...) (not separating the usages, just the lists of sets)? I think there would be fairly minimal duplication between the two lists.

Copy link
Contributor

@kainino0x kainino0x left a comment

Choose a reason for hiding this comment

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

LGTM except for the attachment issue (continued below).


I can't figure out how to reply to this thread (github why) so starting it again:

Are we going to have a separate rule that disallows using a subresource for multiple attachments in the same pass?

Since doing that doesn't match any of the allowed sets, the current spec automatically disallows this

I'm confused, doesn't using it for multiple attachments mean the set is set(['attachment', 'attachment']), which is set(['attachment']), which is a subset of this allowed set?

is "singular usage" supposed to imply that this doesn't happen?


we can certainly have less classes. I'm not sure if we should strive to the minimum though? The rules don't make any simpler because of that, but the ease of understanding could be different. For example, I find the "input" and "constant" distinct in my mind, even though they are not handled differently by the rules. I'm open to other opinions, of course :)

No strong preference. On the one hand, naming both "input" and "constant" in the compatibility set is a bit more explicit/self-documenting (though I don't think the meaning of the names is SO apparent that it helps that much with self-documentation). On the other, it kind of makes sense to merge all of the readonly usages into one, so they're simplified.

@kvark
Copy link
Contributor Author

kvark commented Aug 17, 2020

Thanks @kainino0x !
I did another small pass, and changed the allowed sets to be "allowed multisets", which is what we are really trying to enforce here, mathematically speaking :)
As for the question of combining input + constants - I'm fine either way. I'm hesitating to do this because the idea of "let's combine all read-only usages together" is unfeasible in the extreme: the "storage-read" has to be separate anyway. So pushing it further wouldn't make it more elegant or simpler.

@kvark
Copy link
Contributor Author

kvark commented Aug 17, 2020

Not sure why CI isn't happy, it's passing for me locally

@Kangz
Copy link
Contributor

Kangz commented Aug 17, 2020

As discussed offline, we should probably disallow readonly-storage-texture and writeonly-storage-texture from being used in combination because it will just encourage people to emulate storage-texture by adding two bindings (without having the guarantees for it). This restriction should be lifted with the storage-texture feature.

@kvark
Copy link
Contributor Author

kvark commented Aug 17, 2020

@Kangz this is already in this PR fwiw

Copy link
Contributor

@kainino0x kainino0x left a comment

Choose a reason for hiding this comment

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

A suggestion on how to write this, but otherwise LGTM

Copy link
Contributor

@kainino0x kainino0x left a comment

Choose a reason for hiding this comment

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

LGTM!

@kainino0x kainino0x merged commit cfd7e48 into gpuweb:main Aug 19, 2020
@kvark kvark deleted the internal-usage branch August 19, 2020 20:27
@grorg
Copy link
Contributor

grorg commented Aug 24, 2020

Discussed at the 2020-08-24 meeting.

ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this pull request Sep 6, 2022
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.

Describe "shadow" usage bits Remove variations of "read-only" usages?
4 participants