Hi everyone!
- I want to write a simple program which uses CUDA to fill D3D window with blue color! The SDK has “SimpleD3D9” and “SimpleD3D10”, but these two use vertex buffer! So,i changed the code to use back buffer instead External Media!
// Init
IDirectSurface9* pBackBuffer = 0;
// In InitD3D
HRESULT hr = g_pD3DDevice->GetBackBuffer(/*.........*/,&<b>pBackBuffer</b>)
// In runtest
// Register <b>pBackBuffer</b> with CUDA
// In runCUDA
// Map pBackBuffer and get the pointer
// call the kernel
// In kernel
kernel<<32,128>(/*...*/)
__global__ void kernel(unsigned int* pos)
{
// This code is for testing only....
const unsigned int idx = gridDim.x*blockIdx.x + ThreadIdx.x;
pos[idx] = 0xff;
}
-
It works normally (i can see a part of window with blue color)! But if i increase the size of D3D window largar than 512x600 External Media, the kernel dont work at all External Media (i can see black screen only)!
-
So, i switch to D3D10, but… the same with D3D9! Only black screen… External Media !
-
I just want an example which use CUDA to fill the buffer which a specified color! (I dont want to use texture, it is much more slower than using back buffer External Media)
Thank External Media!
(note: These images is for fun only, dont blame me External Media)