
| ati Interview with Maurice Ribble & Roger Descheneaux |
Driverheaven: What are you job descriptions within ATI? Roger: I'm a Software Engineer working on OpenGL device drivers. I mostly work on developing drivers for future products. Maurice: My official title is Software Engineer, but that isn't very descriptive. An actual job description would be that I work on the OpenGL driver team at ATI and solve whatever problems come up. Each person has their specialization and I focus mostly on performance bugs, game optimizations, and other performance related tasks. Being more descriptive than that is difficult because the exact details of what I do change from day to day. That's one of the things I like about this job.
Driverheaven: How long have you worked for ATI? Roger: I've been at ATI since January of 2001. I worked on the original Radeon 9700 drivers. Before I was at ATI I worked at IBM, also developing OpenGL drivers. Maurice: I've been working at ATI for about 2.5 years. I came straight out of college so I spent a lot of my first year just coming up to speed.
Driverheaven: Do you enjoy working there? Roger and Maurice: Sure, and not just because we get to play games at work. We get to work on cutting-edge products with the coolest hardware around, with interesting projects that flex our problem-solving skills, and of course, having ATI's huge pool of smart people whose brains we can pick when we get stuck helps too. What's not to like? :-)
Driverheaven: Tell us a normal working day in your life. Roger: Work? It's all like play to me. :-) When I come in to work in the morning I usually integrate all the changes that people have made to the driver since I went home. The OpenGL driver team is very much a cross-site effort. We have active development in Silicon Valley; Marlboro, MA (where I work); Orlando, FL; and Germany. I rebuild the driver and read my email while I'm doing that. Then I usually start straight to work on writing code or fixing bugs. Part of what I'm doing depends on the development cycle. Early in the hardware lifecycle I'm learning about future hardware and reading specs, talking to the hardware team, and so on. Later I'm planning the design and writing code, and then I'm fixing bugs and working on performance. There's never a clear line- all the work overlaps to some extent- but I usually concentrate on one thing or another. The OpenGL team is large, of course, and different people work on different things. This is just the sort of thing I work on. Maurice: Get in in the morning check my email, and look at the web. If my email or a graphics enthusiast site brings up any oddities in performance I'll take a quick look at that. Otherwise I'll go and start working on one of the tasks on my list of things to do.
Driverheaven: Is it true you guys did this in your spare time? Roger: Yes. We were talking one day about neat things to put into the driver, and we had this idea for the SMARTSHADER concept. It seemed like a pretty neat thing to do, so I talked to my team lead about it. His response was, "It seems interesting, but we can't justify working on that when there's more important development going on." We didn't disagree with that. SMARTSHADER is kind of a neat toy, but that's all it is. Still, we kind of got hooked on the idea. So I asked, "But if I work on it in my spare time, can we still put it in the driver?" My team lead agreed to that. Spare time for us meant weekends. The SMARTSHADER techniques, both the original ones and the programmable one, were done mostly late Friday nights and Saturday afternoons.
Driverheaven: What inspired you to do this? Roger + Maurice: I think part of it was that this was the first time we could. The Radeon 9700 had power to spare in the pixel shaders. We were getting Quake 3 scores in the hundreds of frames per second. We also had PS2.0 class shaders, and we just started getting ideas, thinking, "Wouldn't it be nice if we could do this? Hey, and that? And that?" We had the power and the functionality, and we wanted to put it to use. Roger: As for working on it nights and weekends in our spare time- I think every programmer gets an itch he wants to scratch from time to time. Sometimes you just get an idea in your head and you just have to write the code. I'm just glad ATI let us do it. :-)
Driverheaven: How much time in development has this taken? Roger: I'd say about a month of weekends for each set of work. It wasn't something we did all at once- just a bit here and there. We seldom both worked on it at once. I think I started both projects, worked on it for a while, got a little sick of it, Maurice worked on it for a while, then I went back to it. We talked to each other about different effects that we'd like. Maurice: I've probably spent 70 hours on it.
Driverheaven: Will programmable smartshader ever be supported officially? Roger: That's something for marketing to decide. I kind of doubt it, though. It's kind of fun, but I don't think enough people are interested enough in it to justify spending a lot of engineering cycles developing and supporting it. Maurice: Personally I hope not. It's currently one ugly hack (albeit an isolated hack) in our driver. For something to be supported I think it should cover corner cases and it's not possible for smartshader to work with every app. If it's officially supported we'd get bugs saying app xyz doesn't work with it and what would we say if it's not possible for app xyz to work with smartshader? It's a cool feature, but not something that should be able to create bugs that take time away from more important driver work.
Driverheaven: How easy is it to write a shader? Roger + Maurice: The original ones were a pain. We designed pseudo-code algorithms, then hard-coded them by writing code to individually write all the bits in all the hardware registers. It was messy. The new programmable ones were a lot easier. We built it on top of the ARB_fragment_program framework and just added a scripting language. The scripting language was designed to do exactly what we wanted, so it is the right tool for the job. Maurice converted a dozen shaders from the old method to the new method in a few hours. There are still a lot of things which could be better. Our error reporting currently isn't that great, which makes them tough to debug.
Driverheaven: Do you think this tool can educate people about shaders? Roger + Maurice: No doubt it will educate some people about shaders. Some people will be interested in how the effects work and will read the shaders, and maybe they'll start tweaking them just for fun. It most likely won't keep hordes of people up late studying shader programming, but some people will find it interesting enough to learn something. Some of the shaders are complicated, but some of them are remarkably simple. The "Black & White" shader, for example, is pretty straightforward.
Driverheaven: Do you think its a tool that game developers may find a use for? Possibly to apply radeon only effects to games? Roger: SMARTSHADER is really a way for the end user to hook his shader into a game. For game developers, the easiest thing to do is to just add the shader code as a post-processing step to the game. SMARTSHADER is a way for people who didn't develop the game and who don't have the source to add their own tweaks to it. Maurice: OpenGL is a pretty standardized API, and I don't think developers should go around the API and rely on nonstandard behavior.
Driverheaven: What can an end user do with programmable smartshader? Maurice: End users should be able to do most post processing effects. Some complex things might need to get broken up into multiple passes and become too slow to use interactively, but they can still be done. I'm sure there are some sweet effects people can come up with. I think imagination is one of the biggest limiting factors on what can be done with this. Roger: The end user can do anything we did in the non-programmable SMARTSHADER. We ported all of our internal shaders to the programmable method (and added a few more besides). The end user can allocate and free buffers, read in textures, perform simple logical operations, and apply shaders to buffers.
Driverheaven: Is there any effect that you would like to see attempted by end users that you havent had time to do? Roger: We always talked about a Matrix-like effect, with the glowing green symbols scrolling down the screen. That was hard, though, and required some artistic ability. I can write code, but I'm pretty bad in the art department. :-) It always seemed like you could add other things, like a logo or a clock to the screen by just texturing onto the final image. I don't think we provide the time of day. Maybe we should add that to the language. :-) Maurice: The old-movie effect could be improved a lot, too, by making the image look dirty and texturing bits of imperfection onto the image. The Matrix has lots of different ASCII effects and some of them would be extremely difficult, and probably not look very good without an artist to tweak each frame like they do in the movie. That said even if it usually doesn't look very good it would still be cool to see someone try. I'm sure there are people out there in the field of image processing that could come up with lots more cool ideas.
Driverheaven: When designing smartshader/the tool were you ever concerned that it may be used to cheat within games? For example if someone found out how to apply a transparency shader to wall textures - they could see where other players were. Have you "anti cheats" hard coded into this? Roger: We thought about this quite a bit. We don't have anti-cheats as such, but we did avoid putting in features which would aid cheating. For example, programmable SMARTSHADER lets you perform operations on a buffer and to use a buffer as a texture. It won't let you use the depth buffer, though. Since the depth buffer contains information not visible to the player, you could use that information to cheat. Maurice: We don't believe transparent walls are possible since people only have access to the final frame buffer. It would be like someone taking a picture of the outside of a house with a camera, and then trying to see through the walls by using Photoshop.
Driverheaven: Was there anything you would have liked to add or will be adding to programmable smartshader ? Maurice: It would have been nice to clean things up a little as far as how the smartshader scripting language works, and maybe add some better error logs. We probably won't be adding much if anything in the future unless the response to this is very strong. Roger: I just thought of the clock thing a few minutes ago. :-) We have a timer, but I don't think we have a time-of-day clock. I also considered adding simple rendering effects, like letting people draw points, lines, and triangles. That turned out to be more work than we really had time for, though. It's a lot to put into a little scripting language that you did in a few weekends.
Driverheaven: Can you run through one of the Smartshader Effects, and detail to our users what each line in the code means? Roger + Maurice: Sure. Here's the Green ASCII shader. It uses a lot of the functionality of the scripting language. This program converts the image on the screen into ASCII characters. The algorithm generally works like this: 1. Divide the screen into a series of 8x10 blocks,
and average the brightnesses of all the pixels in that box. shader asciiPixelShader
= "!!ARBfp1.0 #grayscale factors # numChar-1, charWidth # windowWidth/charWidth,
windowHight/charHeight # charWidth, charHeight # 1/asciiTexWidth,
1/asciiTexHeight # charWidth/( trunc(windowWidth/charWidth)*charWidth
), charHeight/( trunc(windowHight/charHeight)*charHeight ) TEMP temp0; OUTPUT oColor = result.color; MUL temp2, fragment.texcoord[0],
const2; These are vector operations. This multiply will multiply the first component of the texture coordinate by the first part of the constant, the second part by the second constant, and so on. The result temporary is a 4-component vector. FRC temp0, temp2; SUB temp2, temp2,
temp0; MUL temp2, temp2,
const5; MUL temp0, temp0,
const3; TEX temp1, temp2,
texture[0], 2D; DP3 temp1, temp1,
const0; If you’re not familiar with it, a dot product will multiply the first component of temp 1 by the first component of const 0, the second by the second, the third by the third, and add up the result. So temp1 was the pixel from the frame buffer with red, green, and blue components, and we’ve converted it to the brightness of the pixel in the frame buffer. The next four instructions use the brightness that we just computed to find the start of the character we’re looking up in the list of characters. We know how bright it is, so we skip over to the right until we find the start of the letter which is the proper brightness. MUL temp1, temp1,
const1.rrrr; FRC temp2, temp1; SUB temp1, temp1,
temp2; MUL temp1, temp1,
const1.gggg; ADD temp0.r, temp1,
temp0; MUL temp0, temp0,
const4; TEX oColor.g, temp0,
texture[1], 2D; END"; shader copyPixelShader
= surface temp1 = allocsurf(width/2,
height/2); surface ascii = allocsurf(8*64,
10); The “allocsurf” command in the Programmable SMARTSHADER language will create a temporary work area for you to use. The values in these work areas will remain constant unless the window is resized. “Width” and “height” are constants provided by Programmable SMARTSHADER which match the width and height of the window you’re in. load_texture(1, 8*64,
10, 1, "ubyte", "ascii8x10.raw"); texture[0].magfilter
= "linear"; texture[0].source
= backbuffer; texture[0].source
= temp1; texture[0].source
= temp2; texture[0].source
= temp3; asciiPixelShader.constant[0]
= {width/8, height/10, 0, 0}; asciiPixelShader.constant[1]
= {8/(trunc(width/8)*8), 10/(trunc(height/10)*10), 0, 0}; texture[0].magfilter
= "nearest"; texture[0].source
= temp4; destination backbuffer; apply asciiPixelShader;
Driverheaven: Thank you very much for taking the time to talk to Driverheaven readers. Any closing remarks? Roger: We hope people have fun with the new programmable SMARTSHADER toy. If people have ideas, post them in the forums. We don't talk much, but we pay attention. Maurice: It's been a pleasure. And too bad you didn't ask about any of our unannounced hardware. We engineers just might have slipped... (Just kidding!)
|