[SOLVED]Strange problem with HAL device

Started by
11 comments, last by BMW 10 years, 3 months ago

But we're all fresh out of crystal balls, so perhaps you would like to post how you are creating the index buffer, how you are binding it to the pipeline, and how you're issuing the draw call?

Creating:


g_pD3DDevice->CreateIndexBuffer(size, D3DUSAGE_WRITEONLY | D3DUSAGE_SOFTWAREPROCESSING, D3DFMT_INDEX32, D3DPOOL_DEFAULT, &g_pIB, NULL)

Binding:


g_pD3DDevice->SetIndices(g_pIB);

Drawing:


g_pD3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, primitives * 2, 0, primitives);

And if it helps, this is how I create the device (the software vertex processing device is used as my hardware doesn't support hardware vertex processing):


D3DPRESENT_PARAMETERS D3Dpp;

ZeroMemory(&D3Dpp, sizeof(D3DPRESENT_PARAMETERS));

D3Dpp.AutoDepthStencilFormat = D3DFMT_D16;
D3Dpp.BackBufferCount = 1;
D3Dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
D3Dpp.BackBufferHeight = pGame->screenHeight;
D3Dpp.BackBufferWidth = pGame->screenWidth;
D3Dpp.EnableAutoDepthStencil = TRUE;
D3Dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
D3Dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
D3Dpp.Windowed = !pGame->fullscreen;
D3Dpp.hDeviceWindow = hWnd;

if(!(SUCCEEDED(g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
    D3DCREATE_MIXED_VERTEXPROCESSING, &D3Dpp, &g_pD3DDevice))))
{
    if(!(SUCCEEDED(g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
        D3DCREATE_SOFTWARE_VERTEXPROCESSING, &D3Dpp, &g_pD3DDevice))))
    {
        return false;
    }
}
Advertisement
I'd have a look at the device capabilities using IDirect3D9::GetDeviceCaps or the caps viewer tool from the SDK and check if you're not hitting a limit somewhere. In particular, since you're using 32-bit indices, check if MaxVertexIndex is greater than 0xFFFF.

I'd have a look at the device capabilities using IDirect3D9::GetDeviceCaps or the caps viewer tool from the SDK and check if you're not hitting a limit somewhere. In particular, since you're using 32-bit indices, check if MaxVertexIndex is greater than 0xFFFF.

Thank you.

MaxVertexIndex was 0xFFFE.

Problem Solved.

This topic is closed to new replies.

Advertisement