|
<< Click to Display Table of Contents >> Navigation: GPU Processing > Theory of operation > Using the GPU Processing Tool > GPU Processing pipeline |
It doesn’t take many changes to our first simple application to create a shader pipeline.
It just requires a second Texture created by D3DCreateTexture to store the result of a second render pass.
Of course we need to load a second shader file as well.
A second change requires modifications in our execution loop.
Here we have to use the first texture target as the input to another call to in D3DRender.
The second RenderTarget is used as the destination for this call.
Thus we reached the goal of keeping the image on the GPU as long as possible.
This is the modified execution loop.
Assuming the second shader is named m_D3DShader2 and the second Texture is called m_D3DTextureDst2:
void CMyApp : ImageSnapedCvimagectrl1()
{
// copy image to src texture, the second input texture was set using a button
D3DWriteImageToObject(m_ImgSrc, -1, m_D3DTextureSrc, -1);
// ...and render it to the dst surface
D3DRender(m_D3DTextureSrc, m_ D3DTextureDst, m_ D3DShader);
// ...and render it to the dst2 texture
D3DRender(m_D3DTextureDst, m_ D3DtextureDst2, m_ D3DShader);
// update image data
D3DUpdate(m_D3DMirror);
// refresh the display
m_cvDispD3D.Refresh();
}