Created
August 24, 2023 21:43
-
-
Save ExpandingMan/8c66fcc233695ccf9241f323a6f5604e to your computer and use it in GitHub Desktop.
VisRTX segfault on release device if device was not used
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <alloca.h> | |
#include <errno.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
// anari | |
#include "anari/anari.h" | |
#define ANARI_EXTENSION_UTILITY_IMPL | |
#include "anari/frontend/anari_extension_utility.h" | |
void statusFunc(const void *userData, | |
ANARIDevice device, | |
ANARIObject source, | |
ANARIDataType sourceType, | |
ANARIStatusSeverity severity, | |
ANARIStatusCode code, | |
const char *message) | |
{ | |
(void)userData; | |
(void)device; | |
(void)source; | |
(void)sourceType; | |
(void)code; | |
if (severity == ANARI_SEVERITY_FATAL_ERROR) { | |
fprintf(stderr, "[FATAL] %s\n", message); | |
} else if (severity == ANARI_SEVERITY_ERROR) { | |
fprintf(stderr, "[ERROR] %s\n", message); | |
} else if (severity == ANARI_SEVERITY_WARNING) { | |
fprintf(stderr, "[WARN ] %s\n", message); | |
} else if (severity == ANARI_SEVERITY_PERFORMANCE_WARNING) { | |
fprintf(stderr, "[PERF ] %s\n", message); | |
} else if (severity == ANARI_SEVERITY_INFO) { | |
fprintf(stderr, "[INFO ] %s\n", message); | |
} else if (severity == ANARI_SEVERITY_DEBUG) { | |
fprintf(stderr, "[DEBUG] %s\n", message); | |
} | |
} | |
/******************************************************************/ | |
int main(int argc, const char **argv) { | |
printf("initialize ANARI..."); | |
ANARILibrary lib = anariLoadLibrary("visrtx", statusFunc, NULL); | |
// query available devices | |
const char **devices = anariGetDeviceSubtypes(lib); | |
if (!devices) { | |
puts("No devices anounced."); | |
} else { | |
puts("Available devices:"); | |
for (const char **d = devices; *d != NULL; d++) | |
printf(" - %s\n", *d); | |
} | |
ANARIDevice dev = anariNewDevice(lib, "default"); | |
anariRelease(dev, dev); | |
anariUnloadLibrary(lib); | |
printf("done!\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment