Rendering (CreateStateBlock) alternative...

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Un1v
Just popping in
Just popping in
Posts: 1
Joined: Wed Jan 16, 2013 03:48

Rendering (CreateStateBlock) alternative...

Postby Un1v » Wed Jan 16, 2013 04:00

Hey, CEGUI Team / Users since 2 Days I have a problem with my CEGUI Setup the initialization works fine Font's get loaded and all get's Rendered so far no error ...
But I have a big problem, I'm using CreateStateBlock to Capture and re-apply the States of the DirectX Device and the Game (GTA: San Andreas) has many lag spikes with it, now I'm seraching a way to get it work without the CreateStateBlock, now you asking you what I mean I show you :

Image

This bug appears, when I don't re-apply the old States my Question is now how the hell I can get it working without damn lag spikes I'm not a advanced DirectX Programmer...

Some informations:
I using the DirectX Render, and Rendering in "Present" with a VTable- Hook..
Game: GTA: San Andreas (with MP Addon San Andreas Multiplayer maybe it is causing the problems but anyways I want to run it in the mp mode)
CEGUI.log : http://pastebin.com/rZurEaTL (to short it)
sorry, for my bad English I hope you understand what i mean.

Anyways, thanks for you answers.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Rendering (CreateStateBlock) alternative...

Postby CrazyEddie » Wed Jan 16, 2013 10:18

Ok, this post will contain some bleeding obvious stuff and perhaps some stuff that you did not think of - who knows? :)

Basically what you need to think about is why it is neccessary to save and reapply states and consider what altertaives are open to you.

The reason you save and reapply states is two-fold in this case. The first reason is because CEGUI only sets the bare minimum of states (for performance reasons) and expects all other states to be at their default values. The second reason is that the game you're hooking in to does not expect some states to change in the middle of the rendering process.

Now, if you're not resetting all states (or applying a specially made 'defaults' state block) prior to calling CEGUIs rendering function, and CEGUI is being rendered correctly, it may be safe to discount the first reason above - and infact if you're not doing anything in that regard and have no issues, you have implicitly already done just that :)

The second case is obviously neccessary as is evidenced by the issues you're seeing when you do not apply the state block. So you need to consider alternatives to the current recipe of:
1) Save all states
2) Render CEGUI
3) Restore all states.

First, I would consider the possibility that there is a fair chance that each time arriving at step 1, the states are the same or very similar. As such, it might be possible to save the states the first time and then just reapply that same state block (step 3) each frame - skipping the step of creating the state block, which IMO will cause a large part of the hit. You might have to account for different stages in there though - such as being at the pre-game menus and in the actual game play or whatever. Note that I'm not saying this will definitely work, I have no idea, I'm just sharing my thought process with you.

Second, if saving all states is causing a hit, you might have to do some work (could be a lot of work) and discover precisely what states you need to save and be selective about saving and resetting just those significant states - you might do that by querying the states, or you might do it by creating state blocks more selectively.

Third, and maybe optimal solution is to have some combination of the things I've mentioned in the two paragraphs above.

Hope this gives some ideas about the kind of things you need to be thinking about.

Good luck,

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 5 guests