   really basic HLSL questions
  Hey,Just trying to learn HLSL after having a reasonably ok grasp of the fixed function pipeline in Direct3D9I want to stick with D3D9 (my video card is old) but move to shaders. I'd ideally like to keep things simple and allow myself to add an OpenGL renderer in future, so i'm not using the effects framework.Here are my questions:1: I have numerous render state settings I need to replicate in a pixel shader. For example, one blend- SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA)and another one as example,SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ZERO);SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR);What is the best way to write shader code to do these various blends?Do I make one big shader and use if () blocks, using a constant table to tell the shader what type of blend to use? I've been told that using conditional blocks like this in a shader is really bad (and i'd ideally like to use vs and ps 2.0 to keep things compatible with older cards)do I make seperate pixel shaders for each blend mode I want? It just seems sorta..messy to me to do things like this.2: Really stupid question, many blends require to blend with the pixel value thats already in the backbuffer, so you can eg blend a pane of glass on top of a scene. How do you access the backbuffer pixel value? When I say backbuffer I just mean wherever d3d is currently rendering to.Those are the only two questions I can think of for now actually. Any help would be appreciated :)   
  I think that most people would still set render states to do things like alpha blending and what not rather than writing a shader to do the same behavior. Most of the time using the render states makes a lot more sense than writing a shader for it.Where shaders come in handy is when you want to do more complex things, like deferred rendering, different kinds of lighting models, postfx like motion blur, etc. So generally you would use a combination of render states and shaders.   ;  Oh right, I didn't realise those render states still actually worked when you use shaders!Thats good to know, thanks :)   