Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateBuffer()

unsafe void Microsoft.Xna.Framework.Graphics.VertexBuffer.CreateBuffer ( VertexDeclaration vertexDeclaration,
uint dwVertexCount,
uint usage,
_D3DPOOL pool )
inlineprotected

Definition at line 436 of file VertexBuffer.cs.

437 {
438 isDisposed = false;
439 if (vertexDeclaration.isDisposed)
440 {
442 }
443 GraphicsDevice parent = ((GraphicsResource)vertexDeclaration)._parent;
444 GraphicsDevice parent2 = _parent;
445 if (parent != parent2)
446 {
447 vertexDeclaration.Bind(parent2);
448 }
449 uint num = (uint)vertexDeclaration._vertexStride * dwVertexCount;
450 int maxVertexBufferSize = _parent._profileCapabilities.MaxVertexBufferSize;
451 if (num > (uint)maxVertexBufferSize)
452 {
453 _parent._profileCapabilities.ThrowNotSupportedException(FrameworkResources.ProfileTooBig, typeof(VertexBuffer).Name, maxVertexBufferSize);
454 }
455 fixed (IDirect3DVertexBuffer9** ptr = &pComPtr)
456 {
457 int num2 = *(int*)_parent.pComPtr + 104;
458 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, uint, uint, uint, _D3DPOOL, IDirect3DVertexBuffer9**, void**, int>)(int)(*(uint*)num2))((nint)_parent.pComPtr, num, _parent.GetBufferUsage(usage), 0u, pool, ptr, null);
459 if (num3 < 0)
460 {
461 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
462 }
463 _usage = usage;
464 _size = num;
465 _pool = (uint)pool;
466 _vertexCount = dwVertexCount;
467 _vertexDeclaration = vertexDeclaration;
468 if ((usage & 8) == 8 && pool == (_D3DPOOL)1 && (pBufferData = _003CModule_003E.new_005B_005D(num)) == null)
469 {
470 throw new InsufficientMemoryException();
471 }
472 }
473 }
unsafe IDirect3DVertexBuffer9 * pComPtr

References Microsoft.Xna.Framework.Graphics.GraphicsResource.GraphicsResource(), Microsoft.Xna.Framework.Graphics.GraphicsDevice._parent, Microsoft.Xna.Framework.Graphics.GraphicsResource._parent, Microsoft.Xna.Framework.Graphics.VertexBuffer._pool, Microsoft.Xna.Framework.Graphics.GraphicsDevice._profileCapabilities, Microsoft.Xna.Framework.Graphics.VertexBuffer._size, Microsoft.Xna.Framework.Graphics.VertexBuffer._usage, Microsoft.Xna.Framework.Graphics.VertexBuffer._vertexCount, Microsoft.Xna.Framework.Graphics.VertexBuffer._vertexDeclaration, Microsoft.Xna.Framework.Graphics.VertexDeclaration._vertexStride, Microsoft.Xna.Framework.Graphics.VertexDeclaration.Bind(), Microsoft.Xna.Framework.Graphics.GraphicsDevice.GetBufferUsage(), Microsoft.Xna.Framework.Graphics.GraphicsHelpers.GetExceptionFromResult(), Microsoft.Xna.Framework.Graphics.GraphicsResource.isDisposed, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.MaxVertexBufferSize, Microsoft.Xna.Framework.Graphics.GraphicsResource.Name, Microsoft.Xna.Framework.Graphics.VertexBuffer.pBufferData, Microsoft.Xna.Framework.Graphics.GraphicsDevice.pComPtr, Microsoft.Xna.Framework.Graphics.VertexBuffer.pComPtr, Microsoft.Xna.Framework.FrameworkResources.ProfileTooBig, and Microsoft.Xna.Framework.Graphics.ProfileCapabilities.ThrowNotSupportedException().

Referenced by Microsoft.Xna.Framework.Graphics.DynamicVertexBuffer.DynamicVertexBuffer(), Microsoft.Xna.Framework.Graphics.DynamicVertexBuffer.DynamicVertexBuffer(), Microsoft.Xna.Framework.Graphics.VertexBuffer.VertexBuffer(), and Microsoft.Xna.Framework.Graphics.VertexBuffer.VertexBuffer().