luma.gl/docs/api-guide/resources.md
2022-02-06 13:21:32 -08:00

1.9 KiB

GPU Resources

GPU resources come in a few different flavors

  • Resources that represent actual memory uploaded to the GPU are Buffer and Texture.
  • Resources that hold executable GPU code, such as Shader, Renderpipeline and ComputePipeline.
  • Other GPU resources tend to hold validated settings or state (usually these are GPU driver objects rather)

Creating GPU Resources

The Device class provides methods for creating GPU resources

luma.gl provides a consistent API

Resource creation method Description
`device.createBuffer(props: BufferProps ArrayBuffer
`device.createTexture(props: TextureProps Promise
device.createSampler(props: SamplerProps): Sampler Create a Sampler.
device.createFramebuffer(props: FramebufferProps): Framebuffer Create a Framebuffer.
device.createShader(props: ShaderProps): Shader Create a Shader.
device.createRenderPipeline(props: RenderPipelineProps): RenderPipeline Create a RenderPipeline (aka program)
device.createComputePipeline(props: ComputePipelineProps): ComputePipeline Create a ComputePipeline (aka program)
beginRenderPass(props: RenderPassProps): RenderPass Create a RenderPass.
beginComputePass(props?: ComputePassProps): ComputePass Create a ComputePass which can be used to bind data and run compute operations using compute pipelines.
getDefaultRenderPass(): RenderPass A default RenderPass is provided for applications that don't need to create multiple or specially configured render passes.