Branchless selections

Some CPU instructions sets offer a way of selecting bits from either of two registers based on the bits of a third register. For example, the SPUs of the CELL in the PS3 have the selb instruction:

selb rt,ra,rb,rc

The result of selb is placed in rt and each bit of rt is either the corresponding bit from ra (if the bit in rc is 0) or from rb (if the bit in rc is 1). Read the rest of this entry »

Comments (18)

Floating-point tolerances revisited

For several years now I’ve participated in the physics tutorial session at GDC (along with Jim Van Verth, Gino van den Bergen, Erin Catto, Brian ‘Squirrel’ Eiserloh, and Marq Singer). One section I’ve covered in some detail is robustness and within this area I’ve stressed (amongst other things) the importance of distinguishing between absolute and relative tolerances when performing comparisons of floating-point numbers.

I won’t go into details about why you would want to care about how your floating-point numbers are compared. (Detailed information can be found in part in my GDC presentation slides and in much more depth in my book.) Here I will assume you already know why you care, and I will just note that absolute and relative tolerances are tested as Read the rest of this entry »

Comments (5)

Order your graphics draw calls around!

A while ago a local developer (hi Rick) asked about what I thought was the best way of ordering draw calls for sending to the graphics chip. As the topic came up again in a discussion at work recently, I thought I’d share my thoughts about what I think is the best approach these days. Read the rest of this entry »

Comments (27)

Memory-efficient pathfinding

Third time’s a charm they say, and as I’ve talked about pathfinding twice before (in Don’t follow the shortest path! and Aiding pathfinding with cellular automata) I thought I’d charm everyone with a third pathfinding article. This time I’ll talk about how we can reduce the memory consumption on a commonly used pathfinding algorithm by about a magnitude! Read the rest of this entry »

Comments (11)

Be more functional

Since I’ve dissed patterns and OOP recently (and rightly so) I thought I’d be a little positive and recycle an email I sent a friend a while ago. This someone was curious about functional languages after I had mentioned them over dinner as he had no experience with them. I absolutely think that if all you have ever used is an imperative language (exemplified by C++, Java, C# and other similar crap) I highly recommend spending (at least) several days learning a functional language. You’ll be a better programmer for it. (And why not learn some logic programming too, while you’re at it.) Read the rest of this entry »

Comments (41)

Design patterns are from hell^2!

Some anonymous soul emailed me regarding my “Design patterns are from hell!” post, arguing that “somehow, knowing patterns exist is the same as knowing different data structures exist” and that “understanding the different ways for creating objects (hello creational patterns) is like understanding the implications of deciding to use a dequeue rather than an array or rather than a linked list.”

I was also bravely asked what I thought about these statements. Well, guess what, since one can never diss design patterns enough, this is what I think… Read the rest of this entry »

Comments (47)

Posts and links you should have read

I thought I’d post another summary of some (mostly) recent blog posts and links that are worthy of a read, in case you didn’t read them already. Here goes… Read the rest of this entry »

Comments (5)

“Refactor,” what a dumbass term!

When did “rewrite” become “rewrite from scratch?!” In my 30 years of writing code, rewrite never meant rewriting from scratch — until the programming cults arrived on the scene at the beginning of the century, that is. Before them, “rewrite from scratch” meant — lo and behold — rewrite from scratch, and a plain “rewrite” meant what the cultists successfully have named “refactor.”

What a classic textbook example from Lifton’s list of 8 factors of thought reform: #6 - make them speak your secret language!

Bah.

Comments (9)

Advanced bit manipulation-fu

There are lots of things I think a good programmer should understand, and understand well. One, of course, is that OOP amounts to BSE for programmers. Another, and the topic of today, is that good programmers should know how to manipulate bits in their sleep. (No, not those bits!) Read the rest of this entry »

Comments (21)

SIGGRAPH and books

It’s SIGGRAPH 2008 time! That’s exciting to me, but not for the reason you think. I really couldn’t care much less for the conference itself. I mean, who needs to hear about yet another shadow mapping algorithm, when we know there will be another 10 presented in the next year, and 10 more in the year after that, ad nauseum. I’m not particularly thrilled about going to paper presentations when just about every paper is already on the net, neatly collected and categorized on Ke-Sen Huang’s amazing conference index page. All the cool people I like to hang out with go to GDC and not SIGGRAPH so there’s not much in terms of networking. And the classes at SIGGRAPH just put me to sleep with their academic droning, overall lack of excitement, and no understanding of who actually attends their lectures and what they want to hear. Ugh. Read the rest of this entry »

Comments (3)

« Previous entries · Next entries »