5,801 karma · joined September 23, 2013
Hmmm... needs `sudo`.
They accused me of using just "all 1s" (which is, naturally, cheating). Ai contraire!
The count of the number of digits in the decimal representation of the number of unique primes in the prime factorization of the natural numbers.
The best part is that even pretty young kids can compute this sequence; by the first "2" is at 2*3*5*7*11*13*17*19*23*29!
(Hopefully I got that right; the phone doesn't make it easy to type!)
I kind of disagree. I think what's happened is the bank would prefer you to believe that. Imagine I kept my money at the bank, and deposited $10000 with the teller. Immediately afterward a robber follows in and steals that $10000 from the teller. Does the bank say "oh no Mr. TheChao! A robber stole your $10000!". I mean, no? The bank got robbed. Just because the bank's digital security is more tied one-to-one to dollars and its easier for a robber to steal from "my till" doesn't mean it was me who was robbed. It's the bank's job to stop that.
But why!? You know what'd be cool? If we started supporting control statements that were a bit more sophisticated!
``` do { } while (c) { if (x) break foo; } else { case foo : ...; default : ...; } ```
Models are infinitely willing to code. The code they produce makes me want to pour one out for Knuth.
On the flip side, if a triangle is 'really big' we need a guard band to either reject or subdivide triangles. The first one is fairly cheap -- we're throwing away the triangle! -- the second one is a better user experience, but requires synthesizing primitives. (The worst case is that a single triangle becomes 5 triangles, I think.) Each of those triangles needs its Z and 1/Z calculated in fixed precision. The precision of that fixed precision (though) can be clamped to the local tile; so, even though the global precision might need to be 25.25 (or whatever), the tile-local precision is only 4.9 (or whatever), with an intermediate 24.24 that can be handled with a float-float patch-up. The computation should all occur in the triangle's barycentric space: that means you need the inverted barycentric mapping to invert the guard band into the triangle's barycentric space. You do that because it lets you control the fixed point calculations better. (You can leave off the inverted determinant multiplication until the last moment.)
When I say "deferred attribute synthesis" I mean that we don't calculate attributes in the vertex shader. Instead, we calculate the barycentric, Z, and 1/Z values and pass those along. When we fire up the tile walker for the triangle (in general we only need 1-3 tiles), we calculate the attributes "on the fly, as they're used" and then let the compiler do CSE to fold down the replicated constructions.
There are examples in the open source version of my rasterizer: OpenSWR.org.