Module: SDL2::Vulkan

Defined in:
ext/sdl2_vulkan/sdl2_vulkan.c

Class Method Summary collapse

Class Method Details

.load_library(*args) ⇒ Object

Loads the Vulkan library. If ‘path` is given, it will be used; otherwise the library will be searched for dynamically. Raises an error if the library could not be loaded.



21
22
23
24
25
26
27
# File 'ext/sdl2_vulkan/sdl2_vulkan.c', line 21

static VALUE Vulkan_load_library(int argc, VALUE *argv, VALUE self) {
  const char *path = NULL;
  if (argc > 0 && !NIL_P(argv[0])) path = StringValuePtr(argv[0]);
  int result = SDL_Vulkan_LoadLibrary(path);
  if (result != 0) rb_raise(rb_eRuntimeError, "Failed to load Vulkan library: %s", SDL_GetError());
  return self;
}

.unload_libraryObject

Unloads the Vulkan library.



32
33
34
35
# File 'ext/sdl2_vulkan/sdl2_vulkan.c', line 32

static VALUE Vulkan_unload_library(VALUE self) {
  SDL_Vulkan_UnloadLibrary();
  return self;
}

.vk_get_instance_proc_addrObject

Returns an integer value which is the memory address of the vkGetInstanceProcAddr function. The integer value will need to be converted into something more useful, for instance using [Fiddle](github.com/ruby/fiddle). Returns ‘nil` if the address would be NULL.



44
45
46
# File 'ext/sdl2_vulkan/sdl2_vulkan.c', line 44

static VALUE Vulkan_get_vk_get_instance_proc_addr(VALUE self) {
  return PTR2NUM(SDL_Vulkan_GetVkGetInstanceProcAddr());
}