Jump to content
  • Advertisement
Sign in to follow this  
Ripiz

DX11 [C++, DX11] CEGUI crashes system

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

I'm trying to implement CEGUI, however when I tried to add FPS counter I've encountered a problem - it causes my system to crash. There no bluescreen or error message, just everything freezes, however music continues playing, maybe only driver/GPU crashes? Another interesting thing, when I create WARP device it works correctly, doesn't throw any errors, etc. To be precise, system crashes when SwapChain->Present() is called. If I do not draw FPS counter it works fine (GUI elements are rendered without any issues). Maybe anyone know what's the issue or how to fix it? Here's some relevant code:

CEGUI initialization code:
CEGUI::Direct3D11Renderer *renderer = &CEGUI::Direct3D11Renderer::bootstrapSystem(pDevice, pDeviceContext);

CEGUI::DefaultResourceProvider* rp = (CEGUI::DefaultResourceProvider*)(CEGUI::System::getSingleton().getResourceProvider());
rp->setResourceGroupDirectory("schemes", "datafiles/schemes/");
rp->setResourceGroupDirectory("imagesets", "datafiles/imagesets/");
rp->setResourceGroupDirectory("fonts", "datafiles/fonts/");
rp->setResourceGroupDirectory("looknfeels", "datafiles/looknfeel/");
rp->setResourceGroupDirectory("layouts", "datafiles/layouts/");

CEGUI::Scheme::setDefaultResourceGroup("schemes");
CEGUI::Imageset::setDefaultResourceGroup("imagesets");
CEGUI::Font::setDefaultResourceGroup("fonts");
CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
CEGUI::WindowManager::setDefaultResourceGroup("layouts");

CEGUI::XMLParser* parser = CEGUI::System::getSingleton().getXMLParser();
if(parser->isPropertyPresent("SchemaDefaultResourceGroup"))
parser->setProperty("SchemaDefaultResourceGroup", "schemas");

CEGUI::SchemeManager::getSingleton().create(CEGUI::String("TaharezLook.scheme"));
CEGUI::System::getSingleton().setDefaultFont("DejaVuSans-10");
CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
CEGUI::Window *myRoot = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "_MasterRoot");
CEGUI::System::getSingleton().setGUISheet(myRoot);

CEGUI::Window *wnd = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/FrameWindow", "Demo Window");
myRoot->addChildWindow(wnd);
wnd->setPosition(CEGUI::UVector2(cegui_reldim(0.25f), cegui_reldim( 0.25f)));
wnd->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.5f)));
wnd->setMaxSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_reldim( 1.0f)));
wnd->setMinSize(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.1f)));
wnd->setText("Hello world!");



Rendering loop:
void CALLBACK OnFrameRender(ID3D11Device *pd3dDevice, ID3D11DeviceContext *pd3dImmediateContext, double fTime, float fElapsedTime, void *pUserContext) {
float ClearColor[4] = {0.2, 0.2, 0.7, 0};
ID3D11RenderTargetView *pRTV = DXUTGetD3D11RenderTargetView();
pDeviceContext->ClearRenderTargetView(pRTV, ClearColor);

// Clear the depth stencil
ID3D11DepthStencilView *pDSV = DXUTGetD3D11DepthStencilView();
pDeviceContext->ClearDepthStencilView(pDSV, D3D11_CLEAR_DEPTH, 1, 0);

pDeviceContext->OMSetRenderTargets(1, &pRTV, pDSV);

static CEGUI::Direct3D11GeometryBuffer *buffer = 0;
if(!buffer)
buffer = (CEGUI::Direct3D11GeometryBuffer*)&CEGUI::System::getSingleton().getRenderer()->createGeometryBuffer();

const CEGUI::Rect scrn(CEGUI::Vector2(0, 0), CEGUI::System::getSingleton().getRenderer()->getDisplaySize());
buffer->setClippingRegion(scrn);

buffer->reset();
wstring wstr = wstring(DXUTGetFrameStats(DXUTIsVsyncEnabled())) + wstring(L"\n") + wstring(DXUTGetDeviceStats());
size_t length = wstr.length() + 1;
char *string = new char[length];
wcstombs(string, wstr.c_str(), length);
CEGUI::System::getSingleton().getDefaultFont()->drawText(*buffer, CEGUI::String(string), CEGUI::Vector2(0, 0), 0, CEGUI::colour(0xFFFFFFFF));
delete[] string;
buffer->draw();

CEGUI::System::getSingleton().renderGUI();
}



Let me know if I forgot to provide any information.

Thank you.

Share this post


Link to post
Share on other sites
Advertisement
Issue solved, partially. I don't know what was the problem, but if I render FPS counter after rendering GUI it works correctly.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!