Closed raphlinus closed 3 years ago
Actually implementing Eq
is the tricky part here, we'd have to decide what that means? I find in general with this sort of thing what I tend to be interested in is a very strict form of equality, approximately equal to, "is this thing a clone or bitwise copy of that thing"? In which case defining Eq
in terms of bitwise equality of underlying floats seems reasonable to me.
Yes, I was thinking bitwise. The actual thing I care about is "will generate an identical GPU-side representation" for which bitwise is appropriate.
I'm implementing gradients in piet-gpu, and one of the things I'm running into is being able to determine whether a gradient ramp is new or already in the cache. There are a number of ways to deal with this, but the most direct is to impl
Hash
onGradientStop
, so it can be used as a key in a hashmap.This is messy, because a gradient stop contains a float, and also because it means we have to hash color, but I think it's worth it.
Opening an issue first in case people want to discuss.