#### Archived

This topic is now archived and is closed to further replies.

# Error with setting up hardware processing in DX8

This topic is 6095 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Ok, I wrote a program that so far, sets up direct3d8, a vertex buffer, puts the vertices for a pyramid into the buffer, and draws it to scene. it works perfectly. my problem is that when i want to try using hardware acceleration (using the D3DCREATE_HARDWARE_VERTEXPROCESSING flag in direct3D->CreateDevice function) my program compiles the same, but i get a runtime error saying the "instruction at 0x00000000 cannot access memory at 0x00000000" I have no idea where this error is coming from, but when I create the d3ddevice with D3DCREATE_SOFTWARE_VERTEXPROCESSING I don''t get any errors whatsoever. The code for my calling the device looks like this: direct3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, cWnd->window, deviceflags, &presentParameters, &device )) ) cWnd->window is the HWND the program runs in, deviceflags is the global i made that is either D3DCREATE_SOFTWARE_VERTEXPROCESSING or D3DCREATE_HARDWARE_VERTEXPROCESSING.

##### Share on other sites
Sounds like CreateDevice failed when you use D3DCREATE_SOFTWARE_VERTEXPROCESSING, which means that your LPDIRECT3DDEVICE8 object is NULL. Have you checked the return value from IDirect3D8->CreateDevice() to see if it returns D3D_OK? You should always check the return value from such class that create objects.... that is a minimum. It''s very bad programming practice to not detect failure of such calls and not respond to them. I suspect that either your video card doesn''t support TnL or you have faulty drivers.

##### Share on other sites
Sorry, I meant that it sounds like it fails when you use D3DCREATE_HARDWARE_VERTEXPROCESSING, and not D3DCREATE_SOFTWARE_VERTEXPROCESSING. Sorry for the mixup.

##### Share on other sites
  if ( D3D_OK != (direct3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, cWnd->window, deviceflags, &presentParameters, &device )) )return false;

ok, that''s what i''ve got in my d3dinit() function to set up the device, it returns d3d_ok even when using D3DCREATE_HARDWARE_VERTEXPROCESSING (if it didn''t it would exit the program immediately upon trying to create it).

there must be something else in my program (maybe the vertex buffers, those are the only other DX components) that have a conflict with hardware processing? im really lost here, scrambling through every line of code =/

##### Share on other sites
I''ve just solved my own problem. The problem was that I had two vertex buffer, one raw and one processed. The processed vertex buffer just had an extra RHW component. I processed the raw data into the other buffer using the ProcessVertices() function, and then used that as the streamsource for DrawPrimitive... This worked fine in software mode, but in hardware mode, it wants to process the raw data while doing the draw primitive, so... i got rid of the extra "processed buffer", and just made one raw buffer that the hardware can process itself while doing DrawPrimitive().

1. 1
2. 2
3. 3
Rutin
24
4. 4
JoeJ
18
5. 5

• 14
• 23
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631766
• Total Posts
3002228
×