Fix crashing in rare cases on Intel GPUs.

This commit is contained in:
UnknownShadow200 2016-01-13 16:46:15 +11:00
parent 7c7bc4e79d
commit 56cb2b49a8
2 changed files with 5 additions and 5 deletions

View File

@ -126,7 +126,7 @@ namespace ClassicalSharp {
// have our legs just crossed over the '0' point? // have our legs just crossed over the '0' point?
float oldLegRot = (float)Math.Sin( walkTimeO ); float oldLegRot = (float)Math.Sin( walkTimeO );
float newLegRot = (float)Math.Sin( walkTimeN ); float newLegRot = (float)Math.Sin( walkTimeN );
return (Math.Sign( oldLegRot ) != Math.Sign( newLegRot )); return Math.Sign( oldLegRot ) != Math.Sign( newLegRot );
} }
SoundType GetSound( ref bool anyNonAir ) { SoundType GetSound( ref bool anyNonAir ) {

View File

@ -42,10 +42,10 @@ namespace ClassicalSharp {
public int spriteIndex, spriteCount; public int spriteIndex, spriteCount;
public void ExpandToCapacity() { public void ExpandToCapacity() {
vCount = ( iCount / 6 ) * 4; vCount = iCount / 6 * 4;
if( vertices == null || vCount > vertices.Length ) { if( vertices == null || (vCount + 1) > vertices.Length ) {
vertices = new VertexPos3fTex2fCol4b[vCount]; vertices = new VertexPos3fTex2fCol4b[vCount + 1];
} }
vIndex.left = spriteCount / 6 * 4; vIndex.left = spriteCount / 6 * 4;
vIndex.right = vIndex.left + Count.left / 6 * 4; vIndex.right = vIndex.left + Count.left / 6 * 4;
@ -92,7 +92,7 @@ namespace ClassicalSharp {
if( part.iCount == 0 ) return; if( part.iCount == 0 ) return;
ChunkPartInfo info; ChunkPartInfo info;
info.VbId = graphics.CreateVb( part.vertices, VertexFormat.Pos3fTex2fCol4b, part.vCount ); info.VbId = graphics.CreateVb( part.vertices, VertexFormat.Pos3fTex2fCol4b, part.vCount + 1 );
info.IndicesCount = part.iCount; info.IndicesCount = part.iCount;
info.leftCount = (ushort)part.Count.left; info.rightCount = (ushort)part.Count.right; info.leftCount = (ushort)part.Count.left; info.rightCount = (ushort)part.Count.right;
info.frontCount = (ushort)part.Count.front; info.backCount = (ushort)part.Count.back; info.frontCount = (ushort)part.Count.front; info.backCount = (ushort)part.Count.back;