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

Apply draw offset in vertex shaders; data-list reverse button, editbox scrolling #221

Merged
merged 8 commits into from
Jul 26, 2021

Conversation

dhardy
Copy link
Collaborator

@dhardy dhardy commented Jul 25, 2021

The clip-region offsets are now applied by the vertex shaders, thus:

  • DrawHandle::draw_device no longer returns an Offset which needs to be applied in user and theme code.
  • The bg_common bind group contains scale and offset data and must be updated for each clip region. This is a fairly small extra cost, and might instead use push-constants later. This change will be helpful if we decide to add indirect rendering to textures in the future.
  • To avoid precision loss (visually apparent as "drunk text"), the maximum offset is reduced from 2^31 to approx 2^24. This is still sufficient for most purposes and should be possible to work around for ListView.

Additionally,

  • The gallery now uses a ScrollLabel for the multi-lingual text label, enabling selection
  • EditField now updates its required field on text edits, thus fixing scrolling of contents
  • data-list and data-list-view examples have reverse-direction buttons (with fixes for reversed ListView)
  • added Directional::Reversed type and reversed method

Since the shaders already had an offset, the only extra work
is a few bind-group uploads, while this saves the themes and
uses of draw_device having to do manual offsets.

Caveat: f32 has a lower pixel-precise offset limit than i32,
thus large scroll offsets result in a panic with easy-cast
checks enabled (debug builds) and "drunk text" otherwise.
@dhardy dhardy merged commit ea13b0f into master Jul 26, 2021
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.

1 participant