System.InvalidOperationException at ORTS.CABTextureManager.DisassembleFrames[T] (Cab texture causing exception with Bernina Bahn rolling stock)

Bug #1162110 reported by disc
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Open Rails
Fix Released
Low
James Ross
Ubuntu
Invalid
Undecided
Unassigned

Bug Description

I'm getting the following error with a bernina bahn rolling stock, and it seems it's caused by the cab textures.
Error: System.InvalidOperationException: The size of the data passed in is too l
arge or too small for this resource.
   at Microsoft.Xna.Framework.Graphics.Texture.ValidateTotalSize(_D3DSURFACE_DES
C* __unnamed000, UInt32 dwLockWidth, UInt32 dwLockHeight, UInt32 dwFormatSize, U
Int32 dwElementSize, UInt32 elementCount)
   at Microsoft.Xna.Framework.Graphics.Texture2D.CopyData[T](Int32 level, Nullab
le`1 rect, T[] data, Int32 startIndex, Int32 elementCount, UInt32 options, Boole
an isSetting)
   at Microsoft.Xna.Framework.Graphics.Texture2D.GetData[T](Int32 level, Nullabl
e`1 rect, T[] data, Int32 startIndex, Int32 elementCount)
   at ORTS.CABTextureManager.DisassembleFrames[T](GraphicsDevice graphicsDevice,
 Texture2D texture, Point controlSize, Int32 frameCount, Point frameGrid, Textur
e2D[] frames, Point frameSize, Point copySize, Point textureSize, T[] buffer)
   at ORTS.CABTextureManager.Disassemble(GraphicsDevice graphicsDevice, Texture2
D texture, Point controlSize, Int32 frameCount, Point frameGrid, String fileName
)
   at ORTS.CABTextureManager.DisassembleTexture(GraphicsDevice graphicsDevice, S
tring fileName, Int32 width, Int32 height, Int32 frameCount, Int32 framesX, Int3
2 framesY)
   at ORTS.CabViewDiscreteRenderer..ctor(CVCWithFrames cvc, Viewer3D viewer, MST
SLocomotive car, CabShader shader)
   at ORTS.CabRenderer..ctor(Viewer3D viewer, MSTSLocomotive car)
   at ORTS.MSTSLocomotiveViewer.LoadForPlayer()
   at ORTS.TrainDrawer.Load()
   at ORTS.World.Load()
   at ORTS.Viewer3D.Load()
   at ORTS.LoaderProcess.Load()
   at ORTS.LoaderProcess.DoLoad()
   at ORTS.LoaderProcess.LoaderThread()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
ontextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

the trainset can be downloaded here: http://rhbformsts.spoorpunt.nl/BerninaBahn.php

The consist which i used for testing, and causes error is: RhB 417 Bernina Express.con

Revision history for this message
Stefan PAITONI (stefan-paitoni) wrote :

I got also this bug. It seems that the Dxt1 textures on CAB of RhB_Gem type engin is implied.
Some more informations in the Elvas Tower forum.

Stefan

Revision history for this message
disc (disc86543) wrote :

Yes as i see the problem is that these have non power of two sized cab textures. I see texture with 703x 711 resolution, 1024*768, etc.
That is very rare if a game engine don't have problems with such texture resolutions.

Changed in or:
status: New → Confirmed
importance: Undecided → Low
milestone: none → 0.9
tags: added: cabs graphics
Changed in or:
status: Confirmed → Triaged
Revision history for this message
Jijun Tang (jtang-h) wrote :

I could not re-produce this bug using 417 consists. Seems to be fixed by the newer version?

Revision history for this message
disc (disc86543) wrote :

i couldn't find that consists, but if a Gem loco is driven, that still causing this error.

452 Tirano-St. Moritz default activty is using this, and causes error.
I don't know about recent update i downloaded the trainset 1-2 weeks ago.

Revision history for this message
Jijun Tang (jtang-h) wrote :

I think it is fixed. Could you please check with the latest code?

Revision history for this message
disc (disc86543) wrote :

I get the same error in current v1565

Revision history for this message
Jijun Tang (jtang-h) wrote :

Strange, I used the 452 activity and did not encounter any problem. I think the texture file may be damaged.

Revision history for this message
disc (disc86543) wrote :

I've reinstalled the full rolling stock, with updates, still the same error... Couldn't be the drivers or the GPU? non power of two textures aren't widely supported... actually it shouldn't work at all.

Revision history for this message
Jijun Tang (jtang-h) wrote :

This may be the case. I will try to use another computer (with lame GPU) to check it.

Changed in or:
assignee: nobody → Jijun Tang (jtang-h)
Revision history for this message
disc (disc86543) wrote :

I've looked at GPU info, and for opengl the "non-power of two texture support" extension is supported by my gpu, so it is probably with directx too. So not the gpu is the problem.

Revision history for this message
James Ross (twpol) wrote :

Fixed the crash in V1598.

summary: - Cab texture causing exception with Bernina Bahn rolling stock
+ System.InvalidOperationException at
+ ORTS.CABTextureManager.DisassembleFrames[T] (Cab texture causing
+ exception with Bernina Bahn rolling stock)
tags: added: crash
Changed in or:
status: Triaged → Fix Committed
assignee: Jijun Tang (jtang-h) → James Ross (twpol)
James Ross (twpol)
Changed in or:
status: Fix Committed → Fix Released
Revision history for this message
Paul White (paulw2u) wrote :

Closing redundant Ubuntu task

Changed in ubuntu:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.