"He who lives without folly isn't so wise as he thinks."
- Francois De La Rochefoucauld
More pages: 1 ... 11 ... 21 ... 31 ... 41 ... 51 ... 61 ... 71 ... 80 81 82 83 84 85 86 87 88 89 90 ... 101 ... 111 ... 121 ... 131 ... 141 ... 151 ... 161 ... 171 ... 181 ... 191 ... 201 ... 211 ... 221 ... 231 ... 241 ... 251 ... 261 ... 271 ... 281 ... 291 ... 301 ... 311 ... 321 ... 331 ... 341 ... 351 ... 361 ... 365
Query FailedHumus
Monday, November 9, 2009

I assume they don't happen. For the paranoid it should be easy enough to verify on shader load that no two resource names collide.

Kristine
Monday, November 9, 2009

Very interesting stuff! But what about collisions?

Paya
Monday, November 9, 2009

This looks amazing, what physics engine did you use?

Humus
Sunday, November 8, 2009

I did a quick test with a short list of 8 typical resource names and random lookups in it, and made 100 million lookups in it. Using the strcmp() method it took 2.45s, and using the StringHash method it took 0.95s.

fjasdf
Sunday, November 8, 2009

Did you measure how much time you actually win with this?

Humus
Sunday, November 8, 2009

I thought about that idea, but I still need to match the string against run-time generated values that come out of the shader. I'm not sure if there are any reasonable way to look up the corresponding pointer in run-time out of a run-time string. I guess you could search the whole global variable memory area, but that sounds like a shaky approach.

blah
Sunday, November 8, 2009

With duplicate literal merging performed by the linker, maybe you could just use the pointer itself as a unique hash?

Humus
Friday, November 6, 2009

castano: Yeah, it's the manual unrolling that does the trick. Without it, compilers appear to stop trying to pre-compute it after a certain length. I found it to be 10 chars in MSVC 2008, which was a bit too short for me. With manual unroll it appears to work regardless of the length of the string (although I haven't tried super long strings).

Sopyer: I was recommended to use templates first like this using the solution in MaciejS's link. However, I wanted to keep my syntax, so after I found that the template trick worked I tried doing the same with constructors, and that worked fine too.

Rohit: No, it's not available yet.

Kayru: That's without unrolling though, isn't it?

More pages: 1 ... 11 ... 21 ... 31 ... 41 ... 51 ... 61 ... 71 ... 80 81 82 83 84 85 86 87 88 89 90 ... 101 ... 111 ... 121 ... 131 ... 141 ... 151 ... 161 ... 171 ... 181 ... 191 ... 201 ... 211 ... 221 ... 231 ... 241 ... 251 ... 261 ... 271 ... 281 ... 291 ... 301 ... 311 ... 321 ... 331 ... 341 ... 351 ... 361 ... 365