Merge pull request #1 from zachsaw/master

Update from original
Tagged scripts that was released with MPDN v2.9.0.
Added work in progress branch
Bug fix

ImageProcessor didn't allocate new textures when shaders were added during playback.
Improved texture allocation

Mark a texture as 'stolen' when it has been stolen by another filter.
Do not allow 'stolen' textures to be reused.
Only reuse textures if "f.LastDependentIndex < FilterIndex" to prevent a shader from reading and writing to the same texture.
Added a dummy filter to SourceFilter to allow OutputRenderTarget to be reused, 

This method should probably be replaced by something nicer, but it seems to work (more or less). For example, using 8 shaders will cause textures to be reused in the following way:
filter 2 steals texture of filter 0 
filter 3 steals texture of filter 1 
filter 4 steals texture of filter 2 
filter 5 steals texture of filter 3 
filter 6 steals texture of filter 4 
filter 7 steals texture of filter 5 
(Note this is what actually happened, not just theoretical)

This way I also discovered another bug: AllocateTextures is called before SourceFilter.OutputTexture has a value, making it impossible to reuse that texture (note that texture -1 is never 'stolen'). Maybe call AllocateTextures just before rendering? (allocating textures seems to be fast enough for this to work)
Same thing happens to the OuputDummy filter (texture -2).
Fixed ImageProcessor not calling AllocateTexture() when new config has been accepted.
Changed LoadInputs to use SetConstant/SetTextureConstant via register index instead of identifier, except for 'size' argument. This improves compatibility with legacy shaders.
Merge pull request #2 from Shiandow/patch-1

Bug fix: ImageProcessor didn't allocate new textures when shaders were added during playback.
Merge pull request #4 from Shiandow/patch-2

Improved texture allocation
Removed my fix for ImageProcessor not re-allocating texture - Shiandow's method is better.
Improved Texture Allocation #2

Instead of reusing textures by saving a reference to the Texture itself we now save a reference to the Filter that owns this texture.

This is necessary to be able to reuse InputRenderTarget and OutputRenderTarget since those textures can be replaced at any time by MPDN, without updating the references in the filters that reused them.
Allocate textues in GetFrame()
Removed AllocateTextures()
Removed AllocateTextures from On***SizeChanged.
Merge pull request #2 from Shiandow/master

Oops
Remove AllocateTexture in SetupRenderChain

Almost forgot that one.
Earlier bug-fix is now somewhat unnecessary.
Merge pull request #5 from Shiandow/patch-1

Improved Texture Allocation #2
Replaced m_OwnsTexture with (m_TextureOwner == null).
Changed SourceFilter and OutputDummy OutputSize to use Renderer.Input/OutputSize which is available at the point where OnInput/OutputSizeChanged() is called.
This allows us to move AllocateTextures output Render() which should reduce CPU usage.
Refactored RenderScript to force implementors to return IFilter via GetFilter();
Fixed 10L from previous check-in. Forgot to put the Renderer == null check back in after refactoring.
Added call to DeallocateTextures() in OnInputSizeChanged and OnOutputSizeChanged to ensure textures are deallocated if filter has changed.
Merge pull request #7 from zachsaw/work

Cumulative changes from work branch.