Game Development Community

BUG?? This device does not support 32-bit indices

by jleni · in Torque X 2D · 04/07/2008 (1:53 pm) · 9 replies

I was following airplane tutorial and I received this error for TorqueX library.

Problem seems to be related to my notebook video card (Intel GMA950), however, TXB works ok and tiles show perfect there.

I tried changing in the engine source code to work with 16 bits but make the tiles to show wrongly. (I've just changed an enum, I can spend more time on that if it is necesary)

According to DirectX10:

"An index buffer contains a sequential set of 16-bit or 32-bit indices; each index is used to identify a vertex in a vertex buffer."

GMA950 seems not to support 32bits indices but that doesn't mean XNA should work. I think that Torque X should request device capabilities before creating the tiles.

My notebook may not be the latest but it is running Vista Ultimate, 2Gb RAM, Core2Duo, intel chipset, etc. I think that TorqueX should accomodate to 16 indices buffers as XNA allows.

Has this problem been talked here before?
If someone from GG can help I could work on fixing the engine on work with this very common video card.

We are working on a project that uses TorqueX and it would be very disappointing to tell our customers that it doesn't work on most notebooks that have an integrated video card from intel (such as GMA950)

About the author


#1
04/09/2008 (3:52 pm)
Any updates on this thread? Anyone from TorqueX team could help?
#2
04/11/2008 (1:24 pm)
Please don't let this post die..
How can it be possible we don't get any support ?
We are trusting our game on torqueX, we find a real bug, and don't get any answer from you guys? We have even offered to help in fixing this up. !!
#3
04/11/2008 (7:05 pm)
This posting is a little confusing and I don't really undertand the problem. What is the actual error message? Also is this only for the Airplane tutorial or for any tutorial or even any XNA-based game? And the video card is an Intel GMA950? Do you know if it has Pixel/Vertex Shader 2.0 support? And lastly, can you verify your Direct X version in the control panel? Keep in mind that TXB is written in native C++ code, whereas Torque X gmaes are written in XNA. So, unfortunately, the behavior won't be the same between the two runtimes. Hopefully, with more information, we can better get to the heart of the problem.

John K.
#4
04/11/2008 (8:00 pm)
John,
Thanks for answering. I'll try t

The video card I am using is the following. It comes integrated in a lot of notebooks
http://www.intel.com/products/chipsets/gma950/index.htm

Regarding the problem, forget about airplane tutorial. It happens on any TorqueX game. I have to do this to reproduce:

1) Create a StartGame 2D
2) Open TXB and add a tilemap
3) Edit the tiles and put someting, save
4) Go to c# express and run

This is the exception I receive:

This device does not support 32-bit indices. Use IndexElementSize.SixteenBits or a type that has a size of two bytes.

This is the source line at ResourceManager.cs

DynamicIndexBuffer ib = new DynamicIndexBuffer(GFXDevice.Instance.Device, sizeInBytes, profile._bufferUsage, indexElementSize);

indexElementSize is IndexElementSize.ThirtyTwoBits

This is the call stack
> Torque.dll!GarageGames.Torque.Core.ResourceManager.CreateIndexBuffer(GarageGames.Torque.Core.D3DIndexBufferProfile profile = {GarageGames.Torque.Core.D3DIndexBufferProfile}, int sizeInBytes = 1696, Microsoft.Xna.Framework.Graphics.IndexElementSize indexElementSize = ThirtyTwoBits) Line 437 C#
Torque.dll!GarageGames.Torque.T2D.T2DTileLayer.Render(GarageGames.Torque.SceneGraph.SceneRenderState srs = {GarageGames.Torque.SceneGraph.SceneRenderState:
GFXDevice:GarageGames.Torque.GFX.GFXDevice
SceneGraph:GarageGames.Torque.T2D.T2DSceneGraph
CameraTransform:{ {M11:1 M12:0 M13:0 M14:0} {M21:0 M22:1 M23:0 M24:0} {M31:0 M32:0 M33:1 M34:0} {M41:0 M42:0 M43:20 M44:1} }
World(Top):{ {M11:1 M12:0 M13:0 M14:0} {M21:0 M22:1 M23:0 M24:0} {M31:0 M32:0 M33:1 M34:0} {M41:0 M42:0 M43:0 M44:1} }
View:{ {M11:1 M12:0 M13:0 M14:0} {M21:0 M22:1 M23:0 M24:0} {M31:0 M32:0 M33:1 M34:0} {M41:0 M42:0 M43:-20 M44:1} }
Projection:{ {M11:0.02 M12:0 M13:0 M14:0} {M21:0 M22:-0.02666667 M23:0 M24:0} {M31:0 M32:0 M33:-0.01 M34:0} {M41:0 M42:0 M43:0 M44:1} }
IsPreload:False
}) Line 696 + 0x2a bytes C#
Torque.dll!GarageGames.Torque.T2D.T2DSceneGraph._RenderObjects(GarageGames.Torque.Core.TorqueObjectType renderMask = {GarageGames.Torque.Core.TorqueObjectType}, float aspectRatio = 1.33333337) Line 343 + 0x22 bytes C#
Torque.dll!GarageGames.Torque.SceneGraph.BaseSceneGraph.PreRender(GarageGames.Torque.GFX.GFXDevice gfx = {GarageGames.Torque.GFX.GFXDevice}, GarageGames.Torque.Core.TorqueObjectType renderMask = {GarageGames.Torque.Core.TorqueObjectType}, GarageGames.Torque.Core.TorqueObjectType noRenderMask = {GarageGames.Torque.Core.TorqueObjectType}, float aspectRatio = 1.33333337) Line 487 + 0x18 bytes C#
Torque.dll!GarageGames.Torque.GUI.GUISceneview.OnRender(Microsoft.Xna.Framework.Vector2 offset = {X:0 Y:0}, GarageGames.Torque.MathUtil.RectangleF updateRect = {GarageGames.Torque.MathUtil.RectangleF}) Line 113 + 0x78 bytes C#
Torque.dll!GarageGames.Torque.GUI.GUICanvas.OnRender(Microsoft.Xna.Framework.Vector2 offset = {X:0 Y:0}, GarageGames.Torque.MathUtil.RectangleF updateRect = {GarageGames.Torque.MathUtil.RectangleF}) Line 206 + 0x53 bytes C#
Torque.dll!GarageGames.Torque.GUI.GUICanvas.RenderFrame() Line 127 + 0x41 bytes C#
Torque.dll!GarageGames.Torque.XNA.TorqueEngineComponent.Draw(Microsoft.Xna.Framework.GameTime gameTime = {Microsoft.Xna.Framework.GameTime}) Line 499 + 0x10 bytes C#
[External Code]
Torque.dll!GarageGames.Torque.GameUtil.TorqueGame.Draw(Microsoft.Xna.Framework.GameTime gameTime = {Microsoft.Xna.Framework.GameTime}) Line 200 + 0xa bytes C#
[External Code]
Game.exe!StarterGame2D.Game.Main() Line 45 + 0xe bytes C#




Ok, I decided to change the code at T2DTileLayer.cs from:

_indexBuffer = ResourceManager.Instance.CreateIndexBuffer(ResourceProfiles.ManualDynamicIBProfile, _renderIndexCount * sizeof(int), IndexElementSize.ThirtyTwoBits);

to

_indexBuffer = ResourceManager.Instance.CreateIndexBuffer(ResourceProfiles.ManualDynamicIBProfile, _renderIndexCount * sizeof(int), IndexElementSize.SixteenBits);


Now I don't receive the exception anymore BUT the image now is distorted....


According to Intel the video card supports:

- Up to 4 pixels per clock rendering
- Microsoft* DirectX* 9 Hardware Acceleration Features:
- Pixel Shader 2.0
- Volumetric Textures
- Shadow Maps
- Slope Scale Depth Bias
- Two-Sided Microsoft* DirectX* 9 Vertex Shader 3.0 and Transform and Lighting supported in software through highly optimized Processor Specific Geometry Pipeline (PSGP)
- Texture Decompression for DirectX* and
- OpenGL* 1.4 support plus ARB_vertex_buffer and EXT_shadow_funcs extensions and TexEnv shader caching
#5
04/11/2008 (8:16 pm)
Thanks for the details, just a couple of more questions...

1. If you create a new game project from the StarterGame 2D template, do nothing but run it. That crashes too? Or is it only when tilemaps area added to a scene?

2. Does the SpaceWar (the basic XNA for Windows Game Template) also cause you problems?

3. Regarding your fix, what do you mean distorted, compressed or whacky colors?

4. Have you verified that you have the very latest software drivers for your video card?

John K.
#6
04/11/2008 (8:34 pm)
1. It is only when tilemaps are added. I've run the other tutorials and it runs very well (FPS, TankBuster, SplitScreen, LightingDemo2D, Microbe, etc)

2. SpaceWar runs well

3. Tile Count 10 x 10. Tile Size 20 x 20. Centered 0,0. Flood Fill with GarageGames logo.
The result is not easy to understand. Screen is black with some red/blue/white lines coming from the upper-left corner.

4. I have the lastest drivers
#7
04/15/2008 (6:02 am)
John,
Any news about this? Could you reproduce it or find what we are talking about?
If there is anything we can do to help, please tell me
#8
04/15/2008 (10:36 am)
John,

I think this is exactly what is happening:

http://msdn2.microsoft.com/en-us/library/bb219721.aspx#I_notice_that_32bit_indices_are_a_supported_type_can_I_use_them_on_all_devices



By the way, this is DXDIAG output about my machine... which is not VERY OLD, it is running DirectX 10

------------------
System Information
------------------
Time of this report: 4/15/2008, 14:24:29
Machine name: NOMAD3
Operating System: Windows Vista Ultimate (6.0, Build 6001) Service Pack 1 (6001.longhorn_rtm.080118-1840)
Language: English (Regional Setting: English)
System Manufacturer: LENOVO
System Model: 0768AFU
BIOS: Ver 1.00PARTTBL
Processor: Intel(R) Core(TM)2 CPU T5500 @ 1.66GHz (2 CPUs), ~1.7GHz
Memory: 2550MB RAM
Page File: 1573MB used, 2414MB available
Windows Dir: C:\Windows
DirectX Version: DirectX 10
DX Setup Parameters: Not found
DxDiag Version: 6.00.6001.18000 32bit Unicode

---------------
Display Devices
---------------
Card name: Mobile Intel(R) 945 Express Chipset Family
Manufacturer: Intel Corporation
Chip type: Intel(R) GMA 950
DAC type: Internal
Device Key: Enum\PCI\VEN_8086&DEV_27A2&SUBSYS_206217AA&REV_03
Display Memory: 256 MB
Dedicated Memory: 0 MB
Shared Memory: 256 MB
Current Mode: 1280 x 800 (32 bit) (60Hz)
Monitor: Generic PnP Monitor
Driver Name: igdumd32.dll
Driver Version: 7.14.0010.1437 (English)
DDI Version: 9Ex
Driver Attributes: Final Retail
Driver Date/Size: 2/11/2008 19:36:08, 3301376 bytes
WHQL Logo'd: Yes
WHQL Date Stamp:
Device Identifier: {D7B78E66-64E2-11CF-8771-6800A2C2CA35}
Vendor ID: 0x8086
Device ID: 0x27A2
SubSys ID: 0x206217AA
Revision ID: 0x0003
Revision ID: 0x0003
Video Accel: ModeMPEG2_A ModeMPEG2_C
#9
04/15/2008 (1:25 pm)
John,
I think we solved the problem... I am copying the working source code. I think you should check for the device capabilities and choose whether to use int (32-bits) or short (16-bits).
This is only a quick hack, but it seems to be working now with these changes in

We have commented out and marked old code lines

T2DTileLayer.cs Line 682:

if (tileCount != 0)
{
// We now know how many tiles we're going to render. Is our index buffer big enough?
if (_indexBuffer.IsNull)
// index buffer cleared out...start over with size
_renderIndexCount = 0;
if (tileCount * 6 > _renderIndexCount)
{
if (!_indexBuffer.IsNull)
{
_indexBuffer.Instance.Dispose();
_indexBuffer.Invalidate();
}
_renderIndexCount = tileCount * 8; // go a little higher than current max

// HACK: _indexBuffer = ResourceManager.Instance.CreateIndexBuffer(ResourceProfiles.ManualDynamicIBProfile, _renderIndexCount * sizeof(int), IndexElementSize.ThirtyTwoBits);
_indexBuffer = ResourceManager.Instance.CreateIndexBuffer(ResourceProfiles.ManualDynamicIBProfile, _renderIndexCount * sizeof(int), IndexElementSize.SixteenBits);
}

// HACK: int[] indexScratch = TorqueUtil.GetScratchArray(tileCount * 6);
short[] indexScratch = TorqueUtil.GetScratchArray(tileCount * 6);

// render tile types in batches
int idx = 0;
srs.World.Push();
srs.World.MultiplyMatrixLocal(mapToWorld);
Matrix worldTransform = srs.World.Top;
VertexDeclaration vd = GFXVertexFormat.GetVertexDeclaration(srs.Gfx.Device);
for (int i = 0; i < _renderedTileTypes.Count; i++)
{
T2DTileType tileType = _renderedTileTypes[i];

RenderInstance ri = SceneRenderer.RenderManager.AllocateInstance();

ri.Type = RenderInstance.RenderInstanceType.Mesh2D;

ri.ObjectTransform = worldTransform;

ri.PrimitiveType = PrimitiveType.TriangleList;
ri.VertexDeclaration = vd;

ri.VertexBuffer = _vb.Instance;
ri.VertexSize = GFXVertexFormat.VertexSize;
ri.BaseVertex = 0;
ri.VertexCount = 4 * (int)_mapSize.X * (int)_mapSize.Y;
ri.IndexBuffer = _indexBuffer.Instance;
ri.StartIndex = idx;
ri.PrimitiveCount = tileType._renderTiles.Count * 2;

ri.Opacity = VisibilityLevel;
ri.UTextureAddressMode = TextureAddressMode.Clamp;
ri.VTextureAddressMode = TextureAddressMode.Clamp;

ri.Material = tileType.Material;

// fill up index buffer
for (int j = 0; j < tileType._renderTiles.Count; j++)
{
int tileIdx = tileType._renderTiles[j];

indexScratch[idx++] = (short)(4 * tileIdx + 0); // HACK: indexScratch[idx++] = 4 * tileIdx + 0;
indexScratch[idx++] =(short)( 4 * tileIdx + 1); // HACK: indexScratch[idx++] = 4 * tileIdx + 1;
indexScratch[idx++] = (short)(4 * tileIdx + 2); // HACK: indexScratch[idx++] = 4 * tileIdx + 2;
indexScratch[idx++] = (short)(4 * tileIdx + 0); // HACK: indexScratch[idx++] = 4 * tileIdx + 0;
indexScratch[idx++] = (short)(4 * tileIdx + 2); // HACK: indexScratch[idx++] = 4 * tileIdx + 2;
indexScratch[idx++] = (short)(4 * tileIdx + 3); // HACK: indexScratch[idx++] = 4 * tileIdx + 3;
}
tileType._renderTiles.Clear();

SceneRenderer.RenderManager.AddInstance(ri);
}
srs.World.Pop();

// rendered all the batches
_renderedTileTypes.Clear();

// set index data
GFXDevice.Instance.Device.Indices = null;

//HACK: _indexBuffer.Instance.SetData(indexScratch, 0, idx);
_indexBuffer.Instance.SetData(indexScratch, 0, idx);
}