sdlSetGpuTextureName function gpu

void sdlSetGpuTextureName(
  1. Pointer<SdlGpuDevice> device,
  2. Pointer<SdlGpuTexture> texture,
  3. String? text
)

Sets an arbitrary string constant to label a texture.

You should use SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING with SDL_CreateGPUTexture instead of this function to avoid thread safety issues.

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

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

\since This function is available since SDL 3.2.0.

\sa SDL_CreateGPUTexture

extern SDL_DECLSPEC void SDLCALL SDL_SetGPUTextureName( SDL_GPUDevice *device, SDL_GPUTexture *texture, const char *text)

Implementation

void sdlSetGpuTextureName(
  Pointer<SdlGpuDevice> device,
  Pointer<SdlGpuTexture> texture,
  String? text,
) {
  final sdlSetGpuTextureNameLookupFunction = _libSdl
      .lookupFunction<
        Void Function(
          Pointer<SdlGpuDevice> device,
          Pointer<SdlGpuTexture> texture,
          Pointer<Utf8> text,
        ),
        void Function(
          Pointer<SdlGpuDevice> device,
          Pointer<SdlGpuTexture> texture,
          Pointer<Utf8> text,
        )
      >('SDL_SetGPUTextureName');
  final textPointer = text != null ? text.toNativeUtf8() : nullptr;
  final result = sdlSetGpuTextureNameLookupFunction(
    device,
    texture,
    textPointer,
  );
  calloc.free(textPointer);
  return result;
}