Version: 2022.1
언어: 한국어

ComputeBuffer.GetNativeBufferPtr

매뉴얼로 전환
public IntPtr GetNativeBufferPtr ();

반환

IntPtr Pointer to the underlying graphics API buffer.

설명

Retrieve a native (underlying graphics API) pointer to the buffer.

Use this function to retrieve a pointer/handle corresponding to the compute buffer, as it is represented in the native graphics API. This can be used to enable compute buffer data manipulation from native code plugins.

Note: When you use the Unity APIs to modify the buffer data, it changes the underlying graphics API native pointer. Call GetNativeBufferPtr to get the new native pointer.

The type of data returned depends on the underlying graphics API: ID3D11Buffer on D3D11, ID3D12Resource on D3D12, buffer "name" (as GLuint) on OpenGL/ES, MTLBuffer on Metal. Platforms that do not support compute shaders will always return NULL.

Note that calling this function when using multi-threaded rendering will synchronize with the rendering thread (a slow operation), so best practice is to set up needed buffer pointers only at initialization time.

See Also: Native code plugins.