sdlSetGpuBufferName function gpu

void sdlSetGpuBufferName(
  1. Pointer<SdlGpuDevice> device,
  2. Pointer<SdlGpuBuffer> buffer,
  3. String? text
)

Sets an arbitrary string constant to label a buffer.

You should use SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING with SDL_CreateGPUBuffer instead of this function to avoid thread safety issues.

\param device a GPU Context. \param buffer a buffer to attach the name to. \param text a UTF-8 string constant to mark as the name of the buffer.

\threadsafety This function is not thread safe, you must make sure the buffer is not simultaneously used by any other thread.

\since This function is available since SDL 3.2.0.

\sa SDL_CreateGPUBuffer

extern SDL_DECLSPEC void SDLCALL SDL_SetGPUBufferName( SDL_GPUDevice *device, SDL_GPUBuffer *buffer, const char *text)

Implementation

void sdlSetGpuBufferName(
  Pointer<SdlGpuDevice> device,
  Pointer<SdlGpuBuffer> buffer,
  String? text,
) {
  final sdlSetGpuBufferNameLookupFunction = _libSdl
      .lookupFunction<
        Void Function(
          Pointer<SdlGpuDevice> device,
          Pointer<SdlGpuBuffer> buffer,
          Pointer<Utf8> text,
        ),
        void Function(
          Pointer<SdlGpuDevice> device,
          Pointer<SdlGpuBuffer> buffer,
          Pointer<Utf8> text,
        )
      >('SDL_SetGPUBufferName');
  final textPointer = text != null ? text.toNativeUtf8() : nullptr;
  final result = sdlSetGpuBufferNameLookupFunction(device, buffer, textPointer);
  calloc.free(textPointer);
  return result;
}