   [D3D9] Multiple Render Targets - again
  First of all I`d like to say Hi - I`m new here ;)Well here`s my problem - I`m developing an GPU ray tracer and I need to produce two textures out of my PS shader. I`ve googled for some examples, showing how to use MRTs in managed D3D9 and I came out with this (one RT for now, just for testing)://-------------------------------------------------//struct pixel{float4 color : COLOR0;};pixel create_primary_rays(pixelshader_input IN){pixel OUT = (pixel)0;Ray r;r.origin = float3(0,0,5);r.direction = raydir(IN.screenCoord.xy);OUT.color = float4(r.direction.xyz, 1);return OUT;}//-------------------------------------------------//RenderTexture = new Texture(device, RenderSurfaceSize, RenderSurfaceSize, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default);RenderSurface = RenderTexture.GetSurfaceLevel(0);//-------------------------------------------------//private void renderToGBuffer()   {  device.BeginScene();  using (Surface oldBuffer = device.GetBackBuffer(0,0,BackBufferType.Mono))  { device.SetRenderTarget(0, RenderSurface); device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.DarkSlateBlue, 1.0f, 0); rayGeneratorKernel.addParameter("rayDirMatrix", camera.rayDirMatrix); rayGeneratorKernel.execute("primaryrays"); device.SetRenderTarget(0, oldBuffer);  }    device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.DarkSlateBlue, 1.0f, 0);  texturingKernel.addParameter("myTexture", RenderTexture);  texturingKernel.execute("texturing");  using (Sprite spriteobject = new Sprite(device))  { spriteobject.Begin(SpriteFlags.DoNotSaveState); spriteobject.Transform = Matrix.Scaling(0.4f, 0.4f, 0.4f); spriteobject.Draw(RenderTexture, new Rectangle(0, 0, RenderSurfaceSize, RenderSurfaceSize), new Vector3(0, 0, 0), new Vector3(0, 0, 0), Color.White); spriteobject.End();  }  device.EndScene();  device.Present();  this.Invalidate();   }//-------------------------------------------------//But it generates black screen (and black sprite). The code works fine when I use RenderToSurface class, though I cannot achieve MRTs with it (or am I wrong ?)//-------------------------------------------------//protected override void OnPaint(PaintEventArgs e)   {  RtsHelper.BeginScene(RenderSurface);  device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.DarkSlateBlue, 1.0f, 0);  rayGeneratorKernel.addParameter("rayDirMatrix", camera.rayDirMatrix);  rayGeneratorKernel.execute("primaryrays");  RtsHelper.EndScene(Filter.None);  device.BeginScene();  device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.DarkSlateBlue, 1.0f, 0);  texturingKernel.addParameter("myTexture", RenderTexture);  texturingKernel.execute("texturing");  using (Sprite spriteobject = new Sprite(device))  { spriteobject.Begin(SpriteFlags.DoNotSaveState); spriteobject.Transform = Matrix.Scaling(0.4f, 0.4f, 0.4f); spriteobject.Draw(RenderTexture, new Rectangle(0, 0, RenderSurfaceSize, RenderSurfaceSize), new Vector3(0, 0, 0), new Vector3(0, 0, 0), Color.White); spriteobject.End();  }  UpdateFramerate();  device.EndScene();  device.Present();  this.Invalidate();   }//-------------------------------------------------//So, what am I doing wrong? Why doesn`t MRT work ??   