Better HN
topnewbestaskshowjobs
Log inSign up

raphlinus

14,081 karma · joined Mar 7, 2014 (12y ago) · 1,887 submissions

I do research on fundamental UI technology and 2D graphics, with a focus on Rust and fonts. @raph@mastodon.online
Submissions

comment 6y ago · link · parent

I'm interested in using this to test piet-gpu on single board computers, as I think having super performant 2D graphics on low-ish end hardware is interesting.

Lazy HN: does this support Vulkan 1.2? Descriptor indexing? Memory model? Subgroup size control?

Will it work on a Pine RockPro64? If so, what's the least-hassle way to get up-to-date drivers? If someone is interested in helping get piet-gpu running on the hardware, let me know.

comment 6y ago · link · parent

I think this might have flown better if you had included the first half of the tweet: Anti-vaxxers immediately jump on any report of possible adverse events in a vaccine trial (which are thoroughly investigated, of course).

That really puts the second half in context.

comment 6y ago · link · parent

And a self-followup: I wrote https://github.com/linebender/piet-gpu/issues/49 to track this in piet-gpu.

comment 6y ago · link · parent

> or somehow convince a GPU to do it.

I'm about 90% sure this is possible using techniques broadly similar to piet-gpu. The problem is a lot less constrained if you have access to compute shaders (ie WebGPU), otherwise it looks a lot like RAVG (Nehab and Hoppe) and you have kinda nasty branching and memory access patterns in the fragment shader, plus still having to do coarse rasterization on CPU.

One of the operational challenges here is that the renderer would likely be a one-off, as the requirements are just so different than most other clients of a 2D rendering engine.

There's been a bit of discussion on #gpu on xi.zulipchat.com. I consider this an interesting problem but can't really justify spending time on Flash-specific features myself.

comment 6y ago · link · parent

Thanks, good to know. I am interested in a fully GPU-accelerated solution, but it is not easy, and I make no promises if or when I will get there. I would be interested in discussing my ideas.

comment 6y ago · link · parent

I could research this myself, but will ask lazy HN instead. One of the big challenges in presenting Flash well is "conflation artifacts," which are the seams that appear when compositing antialiased vector shapes. The old software renderer in Flash had very clever techniques for avoiding these, but browser 2D renderers generally don't. (The actual story is a bit more complex, as Skia is careful to avoid conflation artifacts within a shape, but the compositing rules in the HTML5 spec almost seem to require them for compositing multiple shapes). Thus, Shumway and the other Flash emulators had artifacts which detracted from the visual quality.

A particularly good paper explaining the problem (and how the NV_path_rendering extension solves it) is "GPU-accelerated Path Rendering", Kilgard and Bolz, 2012.

Does Ruffle solve these? If so, how?

comment 6y ago · link · parent

Not all the time, and I personally don't consider it nice that you would assume that. There are indications in the story that the organizers know something about the full story, and I doubt they would actively perpetuate a fraud.

For reference, I started programming when I was 6, did a little hardware design (easy stuff, interfacing DACs and RAM chips to 8 bit CPUs), wrote an assembler at 9, got a patent when I was 12, etc. My dad did a lot to inspire me and provide me with resources, and had some knowledge of electrical stuff (he had been an electrician in the Navy in WW2), but all the programming I did was very much mine. So it's not hard at all for me to believe that this young man completed a training course intended to get people up to speed on this technology.

comment 6y ago · link · parent

There is work on making proofs portable from one system to another. One effort is Dedukti, which is based on the idea that "lambda pi modulo" is a universal logic for theorem provers. A less ambitious effort is OpenTheory, which from what I can tell is mostly about being able to interoperate between different HOL flavors.

And one of the efforts I personally find most interesting is Metamath Zero, which attempts to be an interchange format among other things, with connections to HOL and Lean. See section 5 of: https://arxiv.org/abs/1910.10703

I think there are many provers which theoretically could be used for this effort, and am not convinced Lean is the absolute best, but I applaud the community for actually going ahead and doing it, instead of farting around with tools and hoping the library will magically happen (a valid critique of HoTT in my opinion).

comment 6y ago · link · parent

Yes, there's a very deep correspondence. My RustLab talk is about pretty much exactly this topic.

comment 6y ago · link · parent

Thanks for the kind words. My thinking has evolved since that video; my blog at https://raphlinus.github.io/ is a good place to check.

As flohofwoe suggests in a sibling, combining an imgui-like API with an actual retained widget tree would be something of the best of both worlds. That is indeed pretty close to what the Crochet prototype does. We're not trying to exactly match the imgui but it's pretty close. In particular, getting actions back from widgets (like button presses) is the return value from calling the widget-creating function. That's a notable difference from, say, Jetpack Compose, which is fairly imgui-like on widget creation but pretty much uses callbacks for those actions. Crochet does solve the page tearing problem (though the current implementation is hacky, don't look too closely under the hood).

Another note - the Dear ImGui implementation has become a lot more sophisticated over the years, and is no longer a simplistic implementation of the immediate mode GUI concept. It has unique id's for widgets, its text processing has become better, etc.

comment 6y ago · link · parent

xi-editor does use xi-rope as its main text storage data structure. This part worked well; the problems with xi were much more around the CRDT and the fully async design. I did a RustLab talk on the use of immutable data structures (of which rope is a good example) for incremental UI, and this will be published soonish.

comment 6y ago · link · parent

It depends hugely on the workload. Ropes are ideal for editing sessions, where you have a sequence of small edits on a large string. But if the string is small, just storing it contiguously is simpler and faster.

They're also good for forming larger strings by concatenating smaller ones. But if you can structure your code so that it just appends to a buffer, for example, by threading a mutable string buffer reference through function calls rather than returning strings, that's also faster.

So, as with most such tradeoffs, it depends on what you're trying to do.

comment 6y ago · link · parent

Those four are listed specially as having optional emoji presentation: https://unicode.org/emoji/charts/emoji-variants.html

These all have Emoji_Presentation=No as specified in emoji-data.txt, for precisely this reason (to avoid discrepancies in rendering), but most platforms don't respect these defaults, as it's common to get strings containing emoji from mobile devices, which usually default to emoji presentation. I talk about this a little in my recent "Text layout is a loose hierarchy of segmentation" blog post.

comment 6y ago · link · parent

Yeah, I didn't get much into justification, or that deeply into language-specific requirements. For Arabic, a good resource is https://www.w3.org/TR/alreq/ and it goes into considerable detail on kashida among other issues. Maybe I should add a block that has references to these documents, as they're a great resource.

comment 6y ago · link · parent

It is of course still used and supported, because of Microsoft's deep commitment to backwards compatibility, but DirectWrite has been the recommended replacement since Windows 7 (and it was backported to Vista with Platform Update).

1036.

Text layout is a loose hierarchy of segmentation(raphlinus.github.io ↗)

13 points · by raphlinus · 6y ago · 2 comments

comment 6y ago · link · parent

Here's my translation into simpler English, with the caveat that I'm only about 90% sure it captures the original intent:

The article is not biased or out of date at all. Most people can't figure out how to get around "secure boot" technology, which has the effect of locking people out. Big companies, both those that make hardware and software, work together to lock ordinary people out of creating alternatives. If an independent creator were to make something good, the big companies would just make their own version, that would be just as good for most users.

Yeah, this article seems like it accurately predicted the future when it was written.

comment 6y ago · link · parent

I can second this recommendation. Our Quaker Meeting was on Yahoo Groups for 12 years, but we also saw the clear signs that it was going to shut down, so migrated to groups.io a few months ago. Generally it's been quite smooth. It took a while for the moderators to figure out the reply policy settings we needed, but now it's pretty nicely tuned. (I was only tangentially involved, I'm on the committee but am responsible for a different part of communications, so in part this was a test of how well it works for users who aren't PhD computer scientists).

comment 6y ago · link · parent

No worries, clear communication around this area is difficult.

SwiftUI and Jetpack Compose are completely different beasts, though they might look similar from the outside. SwiftUI relies heavily on observable objects and basically a shared-mutable-state architecture. I believe that adapting it into Rust would be a nightmare.

Jetpack Compose, on the other hand, lets the app logic build the UI with method calls that resemble immediate mode GUI (though there are of course important differences, as it is building a retained widget tree). These updates are mediated through a mutable context object ("Composer" in the Jetpack Compose world), which adapts quite nicely into the Rust world. In particular, it does not depend on shared mutable references.

I strongly believe that it is possible to express UI in Rust quite naturally and expressively. I've written a fair amount about this recently and have provided evidence in the form of the existing Druid work and the Crochet research prototype, which represents an evolution of its reactive architecture to better support dynamic reconfiguration (a current weak spot in Druid). Of course, we won't know for sure til we get there, but in the meantime it would be nice if the naysayers at least made informed criticism.

comment 6y ago · link · parent

I don't think that's an accurate summary of my blog post. I've never thought building GUI in Rust would be straightforward. I'll try for a tl;dr summary, as it might be useful to this thread:

Building a GUI toolkit is a huge task, with many subtasks that are themselves serious efforts (2D drawing, text, reactive architecture, etc). The Druid project has been engaging these problems and coming up with pretty good solutions. Trying to rush the effort (for example, by trying to lash together existing modules) won't be helpful. In coming months, the project will continue focus on trying to deliver one application, the Runebender font editor, rather than trying to be a general purpose GUI toolkit product. We've been growing a really good community and there are lots of opportunities to learn more about GUI technology and help the project along.

I'm a bit biased, perhaps, but I'm extremely optimistic about the prospects for GUI in Rust. But if people are impatient and hoping for a solution they can deploy right now, no, it's not there yet.

comment 6y ago · link · parent

Not to mention a serious breakdown in the availability of schooling and childcare. This will affect some people a lot more than others, so it should be possible to infer its relative importance.

comment 6y ago · link · parent

I suspect https://github.com/JuliaLang/julia/pull/29700 might be one of them. As the original post states, rounding is (a) amenable to hardware acceleration, (b) easy to get wrong or slow, and (c) possible to test exhaustively.

comment 6y ago · link · parent

MathJax can do synchronous also, but it's a config option. The fact that it defaults to async really saddles it with the perception that it's incredibly slow. The async operation basically forces the browser to through many, many rounds of relayout, when in most cases it would be much more efficient to do it in one batch.

comment 6y ago · link · parent

My wish is that this case be decided clearly. Either APIs can be copyrighted, or they cannot. Either outcome has potentially good consequences, for open source in particular.

Obviously if APIs cannot be copyrighted, then a ton of open source work geared towards making things compatible remains viable. Wine is one of the most obvious, but I can think of many others. Efforts to port CUDA code to non-Nvidia hardware. A potential effort to reimplement SwiftUI. And there are many more.

On the other hand, if APIs can be copyrighted, then buyers now know that there's a single-source risk for any API that's not released under a permissive open source license. So, to continue this example, Apple has the legal right to shut down any port of code written in SwiftUI to non-Apple hardware, and similarly for CUDA. This would immediately increase interest in actually open source alternatives; Flutter already exists, a Vulkan based runtime could be developed for TensorFlow, etc.

Sadly, I think this outcome is unlikely. What's more likely is that the ruling will be specific to the facts of the case. That basically means that there won't be clear guidance that you need to run away from proprietary APIs, but also not clear guidance that you can continue to rely on open source interop projects. Rather, any time any of this gets sticky, the only way through the mess will be to pay lawyers millions of dollars. That will have the effect of making it easier for the big players to dominate the market further, and harder for independent people to play. That's very much to the advantage of those in power, so I'm pretty sure that's what we'll see.

comment 6y ago · link · parent

It's not obvious to me that this is the case. Chris Olah and others talk about "superposition" as a mechanism to explain "polysemantic" neurons that arise in image classifiers. To me, that suggests (using very vague, hand-wavy terms) that the optimization process is attempting to pack in as many concepts as possible into the finite parameter space. Certainly the scaling of GPT-3 suggests that these larger models are not necessarily any sparser than smaller ones.

[1]: https://distill.pub/2020/circuits/zoom-in/

comment 6y ago · link · parent

Yes, it is a difference in philosophy. Here is a blog post from 3 years ago where the libs team explored making an official set of libs to more closely match a "batteries included" experience: https://blog.rust-lang.org/2017/05/05/libz-blitz.html

This effort did not end up succeeding. Instead, a more organic, informal process seems to be working pretty well. Lists like this seem to be useful, even if none is officially blessed.

comment 6y ago · link · parent

I think I understand the intensity of emotion here. Open source is a really high trust community, more so than a lot of real-world spaces. Yet, it's adjacent to some other areas where poorly tuned incentives cause bad behavior. Spamming for free t-shirts is a relatively harmless manifestation. It's just some attention, though attention is our most valuable resource. I'm also reminded of cases where people take over undermaintained plugins to insert malicious behavior; it's the same kind of thing, just farther along on the badness scale.

I'd love it if we're able to preserve the high trust nature of open source. I also wouldn't be surprised if it starts eroding. If that's the case, this kind of thing is the tip of the spear, and in that light it makes sense to get pretty upset about it.

comment 6y ago · link · parent

1. As your question touches on, it was. The codebase has grown organically from its start as xi-win.

2. The xi-editor project had other problems which I've written about extensively in my retrospective.

3. It's hard to compete against MS VS Code. When I started xi, the competitive landscape had a huge gap between performant and feature-rich but bloated editors.

4. We got funding for the font editor project.

comment 6y ago · link · parent

On keyboard handling, https://github.com/linebender/druid/issues/1040 is the main tracking issue. That references a number of PR's, of which 1049 is the core of the platform keyboard handling. I'd be very pleased for other people doing this (including winit) to use this as a model, as a fair amount of study went into getting it right, especially on Windows.

Regarding IME, we haven't done it yet (we're trying to be fairly conservative in our roadmapping), but we plan to wire up actual composition regions and so on, and hope to plumb IME to it using a cross-platform abstraction. My understanding of the winit code is that it varies a lot from platform to platform, but seems to mostly be synthesizing keyboard events (ReceivedCharacter) when an IME request such as "insertText" happens.

comment 6y ago · link · parent

A major motivation of the Crochet prototype is the Rust implementation of the widget tree can be driven by scripts.
1
343536
63