XNA Framework HiDef profile requires TextureFilter to be Point when using texture format -1

Jul 7, 2012 at 1:35 PM

I've just spent several days tearing my hair out trying to identify the cause of the above error in my game, having finally just resolved it i thought i'd post here in the hope it may be of some use to anyone else experiencing this dreaded error.

After MUCH random hacking i identified my player character as being the item which triggered the error if it was submitted to the ObjectManager, however this was very strange since my NPCs and Player both inherit from the same base Character class which in turn inherits from SceneObject and all use the same Effect for drawing. After a little more hacking i realised that the only difference was that i was submitting the player character in the IGF GameState Initialize method whereas everything else is submitted during an Update call. My fix was simply to move my player initialization into the IGF OnSessionStarted event and everything is thankfully now working. 

This doesn't really identify the root cause of the error which perhaps Phillipe may be able to shed some light on. I've based my game code pretty closely on the Ace On Steroids sample and my main GamePlay state is loaded using a LoadingGameState (at the moment copied almost directly from the AOS code). My suspicion is that during the Initialize call in the GamePlay state that the Loading state is still doing some rendering which combined with the Sunburn rendering causes the error.

The lesson though appears to be - don't submit sceneobjects during the Initialize method.

Jul 9, 2012 at 8:56 AM

Hi bamyazi,

This error can be caused by 2 potential issues:

A. Thread sync on ObjectManager.

The ObjectManager isn't thread safe as it is used by the SunBurn RenderManager (forward or deferred) within the LoadingGameState instance while you are adding a new SceneObject to it... Therefore changing the internal collection of SceneObject instances thus throwing an exception.

B. GraphicsDevice already in use

Similar to A., you cannot use a GraphicsDevice from 2 different threads and thus it'd throw an exception.

Still, what I believe is strange in your case is that you should get some clues on the Exception being thrown as they should be specialized. I'll have to dig into it to see what's going on.


As for your solution of moving things to OnSessionStarted, that's effectivelly a good place to put your scene setup.

I'm quite unsatisfied on the current asynchronous loading scheme and I'll probably get to think about it and make a better implementation (especially the fact of using GameState for both...).

Another solution you could look at is to use the GameState.OnLoadingCompleted event and bind your scene setup there ;)

As a general rule, you should always consider interacting with ObjectManager only when the Loading finishes.

Jul 11, 2012 at 11:57 AM

Thanks Phillipe -  I briefly had the problem occur again - moving all my scene setup into LoadingCompleted seems to do the trick.

Jul 12, 2012 at 12:24 AM
Edited Jul 12, 2012 at 12:25 AM

Interesting. Another point to note down for the texture filtering exception, I guess. :D

Glad you finally ran this down, Bamyazi. Bummed me out all I could do was help you rule out causes after everything I went through with the error myself.