VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
visutwin::canvas::MetalVertexBuffer Class Reference

#include <platform/graphics/metal/metalVertexBuffer.h>

Inheritance diagram for visutwin::canvas::MetalVertexBuffer:
[legend]

Public Member Functions

 MetalVertexBuffer (GraphicsDevice *device, const std::shared_ptr< VertexFormat > &format, int numVertices, MTL::Buffer *externalBuffer)
 MetalVertexBuffer (GraphicsDevice *graphicsDevice, const std::shared_ptr< VertexFormat > &format, int numVertices, const VertexBufferOptions &options=VertexBufferOptions{})
void * nativeBuffer () const override
MTL::Buffer * raw () const
void unlock () override
Public Member Functions inherited from visutwin::canvas::VertexBuffer
std::shared_ptr< VertexFormatformat () const
int numVertices () const
bool setData (const std::vector< uint8_t > &data)
const std::vector< uint8_t > & storage () const
 VertexBuffer (GraphicsDevice *graphicsDevice, std::shared_ptr< VertexFormat > format, int numVertices, const VertexBufferOptions &options=VertexBufferOptions{})
virtual ~VertexBuffer ()

Additional Inherited Members

Protected Member Functions inherited from visutwin::canvas::VertexBuffer
 VertexBuffer (GraphicsDevice *device, std::shared_ptr< VertexFormat > format, int numVertices, int numBytes)
Protected Attributes inherited from visutwin::canvas::VertexBuffer
GraphicsDevice_device
std::vector< uint8_t > _storage

Detailed Description

A Metal implementation of the VertexBuffer.

Definition at line 16 of file metalVertexBuffer.h.

Constructor & Destructor Documentation

◆ MetalVertexBuffer() [1/2]

visutwin::canvas::MetalVertexBuffer::MetalVertexBuffer ( GraphicsDevice * graphicsDevice,
const std::shared_ptr< VertexFormat > & format,
int numVertices,
const VertexBufferOptions & options = VertexBufferOptions{} )

◆ MetalVertexBuffer() [2/2]

visutwin::canvas::MetalVertexBuffer::MetalVertexBuffer ( GraphicsDevice * device,
const std::shared_ptr< VertexFormat > & format,
int numVertices,
MTL::Buffer * externalBuffer )

Zero-copy constructor: adopts an externally-created MTL::Buffer. Used for GPU compute output (e.g., Marching Cubes) where the buffer is already filled by the GPU and no CPU-side copy is needed.

Definition at line 19 of file metalVertexBuffer.cpp.

References visutwin::canvas::gpu::MetalBuffer::adoptBuffer(), visutwin::canvas::VertexBuffer::format(), visutwin::canvas::gpu::MetalBuffer::MetalBuffer(), visutwin::canvas::VertexBuffer::numVertices(), visutwin::canvas::gpu::MetalBuffer::size(), and visutwin::canvas::VertexBuffer::VertexBuffer().

Member Function Documentation

◆ nativeBuffer()

void * visutwin::canvas::MetalVertexBuffer::nativeBuffer ( ) const
inlineoverridevirtual

Reimplemented from visutwin::canvas::VertexBuffer.

Definition at line 32 of file metalVertexBuffer.h.

References raw().

◆ raw()

MTL::Buffer * visutwin::canvas::MetalVertexBuffer::raw ( ) const
inlinenodiscard

Definition at line 30 of file metalVertexBuffer.h.

References visutwin::canvas::gpu::MetalBuffer::raw().

Referenced by nativeBuffer().

◆ unlock()

void visutwin::canvas::MetalVertexBuffer::unlock ( )
overridevirtual

The documentation for this class was generated from the following files: