First thing is that I vaguely understand what you are trying to do, but
i did not get what your question is..
Do you mean
" How do i create a texture,
Fill it with color-data
How to Bind that texture for use with your pixel shader
Is your question about how to do the above three ?
You did the above two but, nothing changes ?
I need to create a Texture from scratch using (the texture is viewport sized):
Texture tex = new Texture(... );
All textures(surfaces) are created from scratch using D3DDevice->CreateTexture.
Standard textures (loaded from image files) are pow-2 dimensions
only & their data can be changed only by Lock, MemCopy and then Unlock.
To create a texture of your viewport dimensions & then change its data
with a pixel-shader or such, you must create a RenderTarget.
Pass D3DUSAGE_RENDERTARGET as the Usage parameter of CreateTexture
// After creating it set it as render-target instead of the framebuffer.
D3DDevice->SetRenderTarget( ScreenTex->pSurface );
// Set your pixelshader to render whatever values(output) u want.
D3DDevice->SetPixelShader( mumboJumboShader->d3DShader )
// Upload your shader constants
D3DDevice->SetVertexShaderConstant( Index, &Local_To_Screen_Matrix )
// Draw geometry onto which the pixel shader is applied to
D3DDevice->DrawPrimitive( ... )
//Restore render-target to default FrameBuffer
D3DDevice->SetRenderTarget( NULL );
// Now you can use your ScreenTex as a standard texture.
D3DDevice->SetTexture( ... ScreenTex.. );
Note that on PC, you cannot read & write to a surface at the same time.
if u set the rt with Device->SetRenderTarget( ScreenTex )
You cannot call Device->SetTexture( ScreenTex )
untill you restore fb with SetRenderTarget( NULL );