[0027] Shader Execution Reordering: rename "ReorderThread" to "MaybeReorderThread"#378
Conversation
|
I'd suggest TryReorderThread(), the "Try" has some precedence in other APIs IIRC. Maybe maybe does as well though :). |
So I did have a version that used Try, and I felt icky doing that one because I strongly expect a function called TryXXX to return a boolean indicating whether it did or did not do what was asked. |
The suggestion came from https://doc.rust-lang.org/beta/std/mem/union.MaybeUninit.html - it other places Try also got suggested but it wouldn't have my preference since it would imply a slightly different behavior: "try to do this operation and return success/failure", rather then "I'll do this, or not". |
|
Could we instead add a feature flag that indicates whether |
I think we should consider adding the feature flag regardless, but I don't think that changes the feedback on the name. When authoring / reading shaders, you don't necessarily know what device it will run on so the "Maybe" clue I think still has value. |
|
My $0.02: I like Both "maybe" and "try" have usage in the C++ standard. The general convention is "try" returns something indicating if it was successful (https://en.cppreference.com/w/cpp/thread/unique_lock/try_lock, https://en.cppreference.com/w/cpp/container/map/try_emplace, https://en.cppreference.com/w/cpp/thread/latch/try_wait, etc...). The only usage I see for "maybe" is to have the compiler ignore something if it occurs (https://en.cppreference.com/w/cpp/language/attributes/maybe_unused).
|
As noted by @Jasper-Bekkers in this comment, "MaybeReorderThread" may a better name to make it clear that some implementations may not actually reorder threads at this point.