vulkan 1.3.226 copy "vulkan: ^1.3.226" to clipboard
vulkan: ^1.3.226 copied to clipboard

Vulkan 1.3 FFI bindings for Dart. Supports Linux and Windows.

example/example.dart

import 'dart:ffi';
import 'package:ffi/ffi.dart';
import 'package:vulkan/vulkan.dart';

void main() {
  final ai = calloc<VkApplicationInfo>();
  ai.ref
    ..sType = VK_STRUCTURE_TYPE_APPLICATION_INFO
    ..pNext = nullptr
    ..pApplicationName = 'Application'.toNativeUtf8()
    ..applicationVersion = makeVersion(1, 0, 0)
    ..pEngineName = 'Engine'.toNativeUtf8()
    ..engineVersion = 0
    ..apiVersion = makeVersion(1, 0, 0);

  final ici = calloc<VkInstanceCreateInfo>();
  ici.ref
    ..sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
    ..pNext = nullptr
    ..flags = 0
    ..pApplicationInfo = ai
    ..enabledExtensionCount = 0
    ..ppEnabledExtensionNames = nullptr
    ..enabledLayerCount = 0
    ..ppEnabledLayerNames = nullptr;

  final instance = calloc<Pointer<VkInstance>>();
  final result = vkCreateInstance(ici, nullptr, instance);
  print(result == VK_SUCCESS
      ? 'Vulkan instance succesfully created'
      : 'Failed to create Vulkan insatnce');

  vkDestroyInstance(instance.value, nullptr);
}

int makeVersion(int major, int minor, int patch) =>
    ((major) << 22) | ((minor) << 12) | (patch);
15
likes
140
pub points
17%
popularity

Publisher

unverified uploader

Vulkan 1.3 FFI bindings for Dart. Supports Linux and Windows.

Repository (GitLab)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

More

Packages that depend on vulkan