Crash to Code 4 when zoom by changing _cameraExtent
by Michael Malandra · in Torque X 2D · 05/16/2010 (10:54 pm) · 11 replies
Hey everyone,
I have a question regarding the _cameraExtent functionality. Here is my issue.
I get a crash to a Code 4 when i change the _cameraExtent from (100,52.333) to (91, y) on the 360. I do this by decreasing the _cameraExtent by new Vector2(0.25f) every tick. This crash does not occur on the PC.
Things to note:
1. )When i change the _cameraExtent from (100,52.333) to (92, y), it does not crash.
2. ) This only crashes when i set <UseDisplaySizeForBackbuffer> to true in the torqueSettings.xml file. If it is set to false, I can zoom the camera's extent to whatever distance I want.
I have several options as to how I can fix this. One would be to remove the zoom functionality, and the other would be to set the <UseDisplaySizeForBackbuffer> to false. I really don't want to do either because I like the functionality of the zoom and because when I set <UseDisplaySizeForBackbuffer> to false, the splash screens and menu screens are stretched.
Also, I'm curious as to why this crashes when zooming in with the <UseDisplaySizeForBackbuffer> set to true.
Any ideas as to what is going on here/ what I should do?
Thanks!
I have a question regarding the _cameraExtent functionality. Here is my issue.
I get a crash to a Code 4 when i change the _cameraExtent from (100,52.333) to (91, y) on the 360. I do this by decreasing the _cameraExtent by new Vector2(0.25f) every tick. This crash does not occur on the PC.
Things to note:
1. )When i change the _cameraExtent from (100,52.333) to (92, y), it does not crash.
2. ) This only crashes when i set <UseDisplaySizeForBackbuffer> to true in the torqueSettings.xml file. If it is set to false, I can zoom the camera's extent to whatever distance I want.
I have several options as to how I can fix this. One would be to remove the zoom functionality, and the other would be to set the <UseDisplaySizeForBackbuffer> to false. I really don't want to do either because I like the functionality of the zoom and because when I set <UseDisplaySizeForBackbuffer> to false, the splash screens and menu screens are stretched.
Also, I'm curious as to why this crashes when zooming in with the <UseDisplaySizeForBackbuffer> set to true.
Any ideas as to what is going on here/ what I should do?
Thanks!
#2
Here is the full exception information:
An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
Additional information: The operation was aborted. You may not modify a resource that has been set on a device, or after it has been used within a tiling bracket.
Here is the complete block of code where this bug occurs.
In my scene I have two emitters that each are visible when the camera zooms, each with their own separate material. They are both Infinite and of Area type.
I'm taking a look at the call stack now to see whats up, but I am really clueless as to what is going on here.
05/17/2010 (7:18 pm)
I just ran it in the debugger. It breaks on the line _indexBuffer.Instance.SetData<short>(_indexScratch, 0, indexOffset);in the T2DParticleEffect.Render method with the exception
An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
Here is the full exception information:
An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
Additional information: The operation was aborted. You may not modify a resource that has been set on a device, or after it has been used within a tiling bracket.
Here is the complete block of code where this bug occurs.
if (vertexCount != 0 && indexCount != 0 && vertexOffset > 0 && indexOffset > 0)
{
// Transfer Vertex Scratch to Vertex Buffer.
GFXDevice.Instance.Device.Vertices[0].SetSource(null, 0, 0);
_vertexBuffer.Instance.SetData<GFXVertexFormat.PCTTBN>(_vertexScratch, 0, vertexOffset);
GFXDevice.Instance.Device.Indices = null;
// Transfer Index Scratch to Index Buffer.
_indexBuffer.Instance.SetData<short>(_indexScratch, 0, indexOffset);
}In my scene I have two emitters that each are visible when the camera zooms, each with their own separate material. They are both Infinite and of Area type.
I'm taking a look at the call stack now to see whats up, but I am really clueless as to what is going on here.
#3
05/17/2010 (8:07 pm)
I should also mention that my Display Size is 1080p. It will crash on 1080p or 1080i. When I switch to 720p or 480p, it does not crash. However, i do get terrible flickering black lines that eminate from the upper right corner of the screen when running the game in 480p on all of my splash screens and guibitmaps, but we'll save that issue for another thread.
#4
just seen this thread. Does the error happen also using the fixed engine?
Pino
05/17/2010 (11:01 pm)
Hey there,just seen this thread. Does the error happen also using the fixed engine?
Pino
#5
This issue has existed for a while now. Here are some threads about it:
www.torquepowered.com/community/forums/viewthread/82275/1#comment-655059
www.torquepowered.com/community/forums/viewthread/100439
Sorry, but you pretty much HAVE to set your options like this:
05/17/2010 (11:15 pm)
The issue is most likely predicate tiling. When using 1080p, you are MUCH more likely to cause the XBox360 to trigger predicate tiling mode. Torque X just can't handle it currently.This issue has existed for a while now. Here are some threads about it:
www.torquepowered.com/community/forums/viewthread/82275/1#comment-655059
www.torquepowered.com/community/forums/viewthread/100439
Sorry, but you pretty much HAVE to set your options like this:
<XboxGraphicsManagerSettings>
<UseDisplaySizeForBackbuffer>false</UseDisplaySizeForBackbuffer>
<PreferredBackBufferHeight>720</PreferredBackBufferHeight>
<PreferredBackBufferWidth>1280</PreferredBackBufferWidth>
</XboxGraphicsManagerSettings>
#6
05/17/2010 (11:21 pm)
I would also recommend that you never use 1080 as your backbuffer. As you can see one of those threads are mine. Even using C++ this has caused issues for the AAA studios. Most xbox games are 720 at best anyway. I have read that halo is some odd resolution like 520 and scaled up.
#7
And halo is at 540p ... definitely odd. ;)
--RB
05/18/2010 (4:04 am)
I'm gonna back Henry up on that. 720p is the recommended resolution for an Xbox 360 game.And halo is at 540p ... definitely odd. ;)
--RB
#8
when you zoom, it shouldn't involve the back buffer at all right?
it's just changing the camera properties of the view that will get drawn onto the static sized (720p or 1080p) backbuffer.
or am I way off?
05/18/2010 (8:11 am)
i would have thought that adjusting the the camera stats (viewable area) wasn't causing the issue... rather, dynamically changing the backbuffer would cause it.when you zoom, it shouldn't involve the back buffer at all right?
it's just changing the camera properties of the view that will get drawn onto the static sized (720p or 1080p) backbuffer.
or am I way off?
#9
I even went as far as changing the size of the backbuffer to 480p when the display height is 480 and 720 for everything else.
I do this by changing the _graphicsManager's preffered backbuffer height and width to the correct ratio then running the manager's ApplyChanges function, as seen below:
However, I may just get rid of that, since everything runs fine when the backbuffer remains at 1280*720 while in 480p.
Thanks again everyone!
05/19/2010 (7:15 pm)
Ok. I went ahead and did everything you guys said I should, and now no more problems. I even went as far as changing the size of the backbuffer to 480p when the display height is 480 and 720 for everything else.
I do this by changing the _graphicsManager's preffered backbuffer height and width to the correct ratio then running the manager's ApplyChanges function, as seen below:
_graphicsManager.PreferredBackBufferHeight = 480; _graphicsManager.PreferredBackBufferWidth = 854; _graphicsManager.ApplyChanges();
However, I may just get rid of that, since everything runs fine when the backbuffer remains at 1280*720 while in 480p.
Thanks again everyone!
#10
I can easily fix it by setting the ResizeToDisplayAspectRatioWithFixedHeight to true, but that all seems backwards to me.
05/19/2010 (7:31 pm)
One more thing to note. Whenever the game runs in 480p, whether it is normal or widescreen format, the engine seems to think that the display width of the screen is 640. This causes some issues when using the T2DSceneCamera property ResizeToDisplayAspectRatioWithFixedWidth set to true, namely the game becomes stretched. Does anyone know why this happens? I can easily fix it by setting the ResizeToDisplayAspectRatioWithFixedHeight to true, but that all seems backwards to me.
#11
the Xbox doesn't have a 854x480 resolution so it will resize it to fit the standard 480p (4:3) which is 640x480 so that is the backbuffer and camera setting you need to use to avoid distorsions.
In my games I have 2 copies of all my scene files, one for 720p (16:9) and one for 600p (4:3). The difference in the 600p, besides the camera settings, is that all the scene objects are properly scaled down by 30% (in average) so that to properly manage both 16:9 and 4:3 on the Xbox I don't need to have different graphics but just different scene files.
To properly support all the PC aspect ratios the same principle applies: creating one scene file for each aspect ratio will cover it properly.
05/20/2010 (1:59 am)
Hi,the Xbox doesn't have a 854x480 resolution so it will resize it to fit the standard 480p (4:3) which is 640x480 so that is the backbuffer and camera setting you need to use to avoid distorsions.
In my games I have 2 copies of all my scene files, one for 720p (16:9) and one for 600p (4:3). The difference in the 600p, besides the camera settings, is that all the scene objects are properly scaled down by 30% (in average) so that to properly manage both 16:9 and 4:3 on the Xbox I don't need to have different graphics but just different scene files.
To properly support all the PC aspect ratios the same principle applies: creating one scene file for each aspect ratio will cover it properly.
Torque Owner Ron Barbosa
Disposable Fun
Good luck...
--RB