mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
feat(vkbridge): Vulkan bridge core - codegen, wire runtime, server, client ICD, WSI
Generated from vk.xml 1.3.247; server shares host-visible memory via a self-tested strategy (hostptr/dmabuf/ahb). vulkaninfo runs through it on host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KZqR8XUE8czvGzEpgSCVQR
This commit is contained in:
1 parent
8ac555664a
commit
a8fd343fc1
67 files changed
+82811
No files matched your search
@@ -0,0 +1,231 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Command buffers: vkCmd* calls are encoded into the command buffer's own stream (no round trip
|
||||
* each); vkEndCommandBuffer sends the stream in one message and the server replays it.
|
||||
*
|
||||
* Stream entry: u32 command id, u32 payload bytes, payload (8-aligned), padded to 8.
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "vkb_client.h"
|
||||
#include "gen/vkb_client_gen.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static __thread vkb_cmdbuf *tls_encoding;
|
||||
|
||||
int vkb_cb_begin_is_secondary(const VkCommandBufferBeginInfo *s)
|
||||
{
|
||||
(void)s;
|
||||
return tls_encoding && tls_encoding->level == VK_COMMAND_BUFFER_LEVEL_SECONDARY;
|
||||
}
|
||||
|
||||
vkb_enc *vkb_cmd_record_begin(VkCommandBuffer commandBuffer, uint32_t cmd)
|
||||
{
|
||||
vkb_cmdbuf *cb = vkb_cb(commandBuffer);
|
||||
if (!cb->recording) {
|
||||
VKB_ONCE(VKB_LOG_WARN, "%s on a command buffer that is not recording (ignored; logged once)", vkb_cmd_names[cmd]);
|
||||
return NULL;
|
||||
}
|
||||
vkb_enc *e = &cb->stream;
|
||||
/* entries start 8-aligned */
|
||||
while (e->len & 7) vkb_enc_u8(e, 0);
|
||||
vkb_enc_u32(e, cmd);
|
||||
vkb_enc_u32(e, 0);
|
||||
cb->entry = e->len;
|
||||
return e;
|
||||
}
|
||||
|
||||
void vkb_cmd_record_end(VkCommandBuffer commandBuffer)
|
||||
{
|
||||
vkb_cmdbuf *cb = vkb_cb(commandBuffer);
|
||||
vkb_enc *e = &cb->stream;
|
||||
if (e->oom) {
|
||||
cb->broken = 1;
|
||||
return;
|
||||
}
|
||||
if (e->nfds) {
|
||||
VKB_ERR("internal: a recorded command carries a file descriptor");
|
||||
cb->broken = 1;
|
||||
e->nfds = 0;
|
||||
}
|
||||
uint32_t n = (uint32_t)(e->len - cb->entry);
|
||||
memcpy(e->buf + cb->entry - 4, &n, 4);
|
||||
}
|
||||
|
||||
static void stream_reset(vkb_cmdbuf *cb)
|
||||
{
|
||||
if (cb->stream.cap > (8u << 20)) {
|
||||
vkb_enc_free(&cb->stream);
|
||||
vkb_enc_init(&cb->stream);
|
||||
} else {
|
||||
vkb_enc_reset(&cb->stream);
|
||||
}
|
||||
cb->recording = 0;
|
||||
cb->broken = 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ pools */
|
||||
|
||||
static vkb_cmdpool *pool_get(vkb_device *dev, VkCommandPool pool, int create)
|
||||
{
|
||||
vkb_cmdpool *p = vkb_map_get(&dev->pools, (uint64_t)pool);
|
||||
if (!p && create) {
|
||||
p = calloc(1, sizeof(*p));
|
||||
vkb_map_put(&dev->pools, (uint64_t)pool, p);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
static void cmdbuf_free(vkb_cmdbuf *cb)
|
||||
{
|
||||
vkb_enc_free(&cb->stream);
|
||||
free(cb);
|
||||
}
|
||||
|
||||
void vkb_cmdpool_free(vkb_cmdpool *p)
|
||||
{
|
||||
vkb_cmdbuf *cb = p->head;
|
||||
while (cb) {
|
||||
vkb_cmdbuf *n = cb->pool_next;
|
||||
cmdbuf_free(cb);
|
||||
cb = n;
|
||||
}
|
||||
free(p);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo,
|
||||
VkCommandBuffer *pCommandBuffers)
|
||||
{
|
||||
VkResult r = vkb_wire_vkAllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
|
||||
if (r != VK_SUCCESS) {
|
||||
for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) pCommandBuffers[i] = VK_NULL_HANDLE;
|
||||
return r;
|
||||
}
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
vkb_cmdpool *p = pool_get(dev, pAllocateInfo->commandPool, 1);
|
||||
for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) {
|
||||
vkb_cmdbuf *cb = vkb_cb(pCommandBuffers[i]);
|
||||
if (!cb) continue;
|
||||
cb->pool = pAllocateInfo->commandPool;
|
||||
cb->level = pAllocateInfo->level;
|
||||
cb->pool_next = p->head;
|
||||
cb->pool_prev = NULL;
|
||||
if (p->head) p->head->pool_prev = cb;
|
||||
p->head = cb;
|
||||
}
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
|
||||
const VkCommandBuffer *pCommandBuffers)
|
||||
{
|
||||
vkb_wire_vkFreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers);
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
vkb_cmdpool *p = pool_get(dev, commandPool, 0);
|
||||
for (uint32_t i = 0; i < commandBufferCount; i++) {
|
||||
vkb_cmdbuf *cb = vkb_cb(pCommandBuffers[i]);
|
||||
if (!cb) continue;
|
||||
if (p) {
|
||||
if (cb->pool_prev) cb->pool_prev->pool_next = cb->pool_next;
|
||||
else if (p->head == cb) p->head = cb->pool_next;
|
||||
if (cb->pool_next) cb->pool_next->pool_prev = cb->pool_prev;
|
||||
}
|
||||
cmdbuf_free(cb);
|
||||
}
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!commandPool) return;
|
||||
vkb_wire_vkDestroyCommandPool(device, commandPool, pAllocator);
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
vkb_cmdpool *p = vkb_map_remove(&dev->pools, (uint64_t)commandPool);
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
if (p) vkb_cmdpool_free(p);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags)
|
||||
{
|
||||
VkResult r = vkb_wire_vkResetCommandPool(device, commandPool, flags);
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
vkb_cmdpool *p = pool_get(dev, commandPool, 0);
|
||||
for (vkb_cmdbuf *cb = p ? p->head : NULL; cb; cb = cb->pool_next) stream_reset(cb);
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ recording */
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo)
|
||||
{
|
||||
vkb_cmdbuf *cb = vkb_cb(commandBuffer);
|
||||
stream_reset(cb);
|
||||
cb->recording = 1;
|
||||
vkb_enc *e = vkb_cmd_record_begin(commandBuffer, VKB_CMD_vkBeginCommandBuffer);
|
||||
vkb_enc_u64(e, cb->obj.remote);
|
||||
tls_encoding = cb;
|
||||
vkb_enc_u8(e, pBeginInfo != NULL);
|
||||
if (pBeginInfo) vkb_enc_VkCommandBufferBeginInfo(e, pBeginInfo);
|
||||
tls_encoding = NULL;
|
||||
vkb_cmd_record_end(commandBuffer);
|
||||
return cb->broken ? VK_ERROR_OUT_OF_HOST_MEMORY : VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEndCommandBuffer(VkCommandBuffer commandBuffer)
|
||||
{
|
||||
vkb_cmdbuf *cb = vkb_cb(commandBuffer);
|
||||
if (!cb->recording) return VK_SUCCESS;
|
||||
cb->recording = 0;
|
||||
if (cb->broken || cb->stream.oom) {
|
||||
VKB_ERR("command buffer could not be recorded (out of memory)");
|
||||
stream_reset(cb);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
vkb_call c;
|
||||
vkb_call_begin(&c, VKB_CMD_vkEndCommandBuffer, cb->obj.table);
|
||||
vkb_enc_u64(&c.e, cb->obj.remote);
|
||||
vkb_enc_blob(&c.e, cb->stream.buf ? cb->stream.buf : (const void *)"", cb->stream.len);
|
||||
VkResult r = VK_ERROR_DEVICE_LOST;
|
||||
if (vkb_call_exec(&c)) {
|
||||
r = (VkResult)vkb_dec_u32(&c.d);
|
||||
vkb_call_end(&c);
|
||||
}
|
||||
stream_reset(cb);
|
||||
return r;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags)
|
||||
{
|
||||
stream_reset(vkb_cb(commandBuffer));
|
||||
return vkb_wire_vkResetCommandBuffer(commandBuffer, flags);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount,
|
||||
const VkCommandBuffer *pCommandBuffers)
|
||||
{
|
||||
vkb_wire_vkCmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers);
|
||||
}
|
||||
|
||||
/* Debug labels never reach the driver. */
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkCmdBeginDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT *pLabelInfo)
|
||||
{
|
||||
(void)commandBuffer;
|
||||
(void)pLabelInfo;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkCmdEndDebugUtilsLabelEXT(VkCommandBuffer commandBuffer)
|
||||
{
|
||||
(void)commandBuffer;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkCmdInsertDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT *pLabelInfo)
|
||||
{
|
||||
(void)commandBuffer;
|
||||
(void)pLabelInfo;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* Minimal Xlib declarations for the bridge ICD: it never links libX11, it only needs the types
|
||||
* vulkan_xlib.h names and looks up XGetXCBConnection at run time. */
|
||||
#ifndef VKB_COMPAT_XLIB_H
|
||||
#define VKB_COMPAT_XLIB_H
|
||||
typedef struct _XDisplay Display;
|
||||
typedef unsigned long XID;
|
||||
typedef XID Window;
|
||||
typedef unsigned long VisualID;
|
||||
#endif
|
||||
@@ -0,0 +1,37 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* Minimal xcb declarations for the bridge ICD: libxcb is opened at run time (dlopen), so only the
|
||||
* types and the few request/reply layouts the software present path uses are declared here. */
|
||||
#ifndef VKB_COMPAT_XCB_H
|
||||
#define VKB_COMPAT_XCB_H
|
||||
#include <stdint.h>
|
||||
typedef struct xcb_connection_t xcb_connection_t;
|
||||
typedef uint32_t xcb_window_t;
|
||||
typedef uint32_t xcb_visualid_t;
|
||||
typedef uint32_t xcb_drawable_t;
|
||||
typedef uint32_t xcb_gcontext_t;
|
||||
typedef uint32_t xcb_pixmap_t;
|
||||
typedef struct { unsigned int sequence; } xcb_void_cookie_t;
|
||||
typedef struct { unsigned int sequence; } xcb_get_geometry_cookie_t;
|
||||
typedef struct {
|
||||
uint8_t response_type;
|
||||
uint8_t depth;
|
||||
uint16_t sequence;
|
||||
uint32_t length;
|
||||
xcb_window_t root;
|
||||
int16_t x, y;
|
||||
uint16_t width, height, border_width;
|
||||
uint8_t pad0[2];
|
||||
} xcb_get_geometry_reply_t;
|
||||
typedef struct {
|
||||
uint8_t response_type;
|
||||
uint8_t error_code;
|
||||
uint16_t sequence;
|
||||
uint32_t resource_id;
|
||||
uint16_t minor_code;
|
||||
uint8_t major_code;
|
||||
uint8_t pad0;
|
||||
uint32_t pad[5];
|
||||
uint32_t full_sequence;
|
||||
} xcb_generic_error_t;
|
||||
#define XCB_IMAGE_FORMAT_Z_PIXMAP 2
|
||||
#endif
|
||||
@@ -0,0 +1,449 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Client transport: one Unix-socket connection per thread (the server mirrors it with one thread),
|
||||
* so calls from different threads run in parallel exactly as they would on a local driver.
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "vkb_client.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/un.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* ------------------------------------------------------------------ logging */
|
||||
|
||||
static int log_level_v = -1;
|
||||
static FILE *log_file;
|
||||
static pthread_mutex_t log_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
int vkb_log_level(void)
|
||||
{
|
||||
if (log_level_v < 0) {
|
||||
const char *d = getenv("VKBRIDGE_DEBUG");
|
||||
log_level_v = d && *d && strcmp(d, "0") ? VKB_LOG_DEBUG : VKB_LOG_WARN;
|
||||
const char *v = getenv("VKBRIDGE_LOG_LEVEL");
|
||||
if (v) log_level_v = atoi(v);
|
||||
const char *f = getenv("VKBRIDGE_CLIENT_LOG");
|
||||
if (f && *f) log_file = fopen(f, "ae");
|
||||
}
|
||||
return log_level_v;
|
||||
}
|
||||
|
||||
void vkb_log(int level, const char *fmt, ...)
|
||||
{
|
||||
if (level > vkb_log_level()) return;
|
||||
char msg[2048];
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(msg, sizeof(msg), fmt, ap);
|
||||
va_end(ap);
|
||||
static const char *const tags[] = {"error", "warning", "info", "debug"};
|
||||
char comm[32] = "?";
|
||||
FILE *cf = fopen("/proc/self/comm", "re");
|
||||
if (cf) {
|
||||
if (fgets(comm, sizeof(comm), cf)) comm[strcspn(comm, "\n")] = 0;
|
||||
fclose(cf);
|
||||
}
|
||||
pthread_mutex_lock(&log_lock);
|
||||
fprintf(stderr, "vkbridge %s [%s %d]: %s\n", tags[level & 3], comm, getpid(), msg);
|
||||
if (log_file) {
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
struct tm tm;
|
||||
localtime_r(&ts.tv_sec, &tm);
|
||||
fprintf(log_file, "%02d:%02d:%02d.%03ld vkbridge-client %s [%s %d]: %s\n", tm.tm_hour, tm.tm_min, tm.tm_sec,
|
||||
ts.tv_nsec / 1000000, tags[level & 3], comm, getpid(), msg);
|
||||
fflush(log_file);
|
||||
}
|
||||
pthread_mutex_unlock(&log_lock);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ connection */
|
||||
|
||||
typedef struct vkb_conn {
|
||||
int sock;
|
||||
int dead;
|
||||
uint32_t epoch;
|
||||
vkb_enc enc; /* reused request buffer */
|
||||
uint8_t *in;
|
||||
size_t incap;
|
||||
vkb_arena arena;
|
||||
int busy;
|
||||
} vkb_conn;
|
||||
|
||||
static uint64_t process_token;
|
||||
static uint32_t fork_epoch;
|
||||
static pthread_key_t conn_key;
|
||||
static pthread_once_t conn_once = PTHREAD_ONCE_INIT;
|
||||
static __thread vkb_conn *tls_conn;
|
||||
|
||||
static void conn_free(vkb_conn *c)
|
||||
{
|
||||
if (!c) return;
|
||||
if (c->sock >= 0) close(c->sock);
|
||||
vkb_enc_free(&c->enc);
|
||||
free(c->in);
|
||||
vkb_arena_free(&c->arena);
|
||||
free(c);
|
||||
}
|
||||
|
||||
static void conn_thread_exit(void *p)
|
||||
{
|
||||
conn_free(p);
|
||||
}
|
||||
|
||||
static void atfork_child(void)
|
||||
{
|
||||
/* The child must not talk on the parent's sockets: new token, new connections. */
|
||||
fork_epoch++;
|
||||
process_token = 0;
|
||||
tls_conn = NULL; /* the old one is leaked deliberately: its socket belongs to the parent too */
|
||||
}
|
||||
|
||||
static void conn_init_once(void)
|
||||
{
|
||||
pthread_key_create(&conn_key, conn_thread_exit);
|
||||
pthread_atfork(NULL, NULL, atfork_child);
|
||||
}
|
||||
|
||||
void vkb_conn_after_fork(void) { atfork_child(); }
|
||||
|
||||
static uint64_t make_token(void)
|
||||
{
|
||||
uint64_t t = 0;
|
||||
int fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC);
|
||||
if (fd >= 0) {
|
||||
if (read(fd, &t, sizeof(t)) != sizeof(t)) t = 0;
|
||||
close(fd);
|
||||
}
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
t ^= ((uint64_t)getpid() << 32) ^ (uint64_t)ts.tv_nsec ^ (uint64_t)ts.tv_sec * 1000003u;
|
||||
return t ? t : 1;
|
||||
}
|
||||
|
||||
static const char *socket_path(void)
|
||||
{
|
||||
const char *p = getenv(VKB_DEFAULT_SOCKET_ENV);
|
||||
if (p && *p) return p;
|
||||
static char buf[256];
|
||||
const char *rd = getenv("XDG_RUNTIME_DIR");
|
||||
snprintf(buf, sizeof(buf), "%s/vkbridge.sock", rd && *rd ? rd : "/tmp");
|
||||
return buf;
|
||||
}
|
||||
|
||||
static int do_connect(vkb_conn *c)
|
||||
{
|
||||
const char *path = socket_path();
|
||||
struct sockaddr_un a;
|
||||
memset(&a, 0, sizeof(a));
|
||||
a.sun_family = AF_UNIX;
|
||||
if (strlen(path) >= sizeof(a.sun_path)) {
|
||||
VKB_ERR("socket path too long: %s", path);
|
||||
return -1;
|
||||
}
|
||||
strcpy(a.sun_path, path);
|
||||
int s = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||
if (s < 0) return -1;
|
||||
if (connect(s, (struct sockaddr *)&a, sizeof(a)) < 0) {
|
||||
VKB_ONCE(VKB_LOG_ERROR, "cannot reach the Vulkan bridge server at %s: %s", path, strerror(errno));
|
||||
close(s);
|
||||
return -1;
|
||||
}
|
||||
c->sock = s;
|
||||
/* Hello: protocol check and which process this thread belongs to. */
|
||||
if (!process_token) process_token = make_token();
|
||||
vkb_enc e;
|
||||
vkb_enc_init(&e);
|
||||
vkb_enc_u64(&e, VKB_PROTOCOL_HASH);
|
||||
vkb_enc_u64(&e, process_token);
|
||||
vkb_enc_u32(&e, (uint32_t)getpid());
|
||||
char comm[64] = "?";
|
||||
FILE *f = fopen("/proc/self/comm", "re");
|
||||
if (f) {
|
||||
if (fgets(comm, sizeof(comm), f)) comm[strcspn(comm, "\n")] = 0;
|
||||
fclose(f);
|
||||
}
|
||||
vkb_enc_str(&e, comm);
|
||||
vkb_msg_hdr h = {VKB_MAGIC, (uint32_t)e.len, VKB_CMD_vkbHello, 0, 0, 0};
|
||||
int ok = vkb_send_msg(s, &h, e.buf, NULL, 0) == 0;
|
||||
vkb_enc_free(&e);
|
||||
int fds[VKB_MAX_FDS], nfds = 0;
|
||||
vkb_msg_hdr rh;
|
||||
if (ok) ok = vkb_recv_msg(s, &rh, &c->in, &c->incap, fds, &nfds) == 0 && rh.cmd == VKB_ST_OK && rh.size >= 12;
|
||||
if (ok) {
|
||||
uint64_t sh;
|
||||
uint32_t accepted;
|
||||
memcpy(&sh, c->in, 8);
|
||||
memcpy(&accepted, c->in + 8, 4);
|
||||
if (!accepted) {
|
||||
VKB_ONCE(VKB_LOG_ERROR, "the bridge server speaks protocol %016llx, this driver %016llx; update DroidDeck's Linux side",
|
||||
(unsigned long long)sh, (unsigned long long)VKB_PROTOCOL_HASH);
|
||||
ok = 0;
|
||||
}
|
||||
}
|
||||
if (!ok) {
|
||||
close(s);
|
||||
c->sock = -1;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static vkb_conn *get_conn(void)
|
||||
{
|
||||
pthread_once(&conn_once, conn_init_once);
|
||||
vkb_conn *c = tls_conn;
|
||||
if (c && c->epoch != fork_epoch) c = tls_conn = NULL;
|
||||
if (c) return c->dead ? NULL : c;
|
||||
c = calloc(1, sizeof(*c));
|
||||
if (!c) return NULL;
|
||||
c->sock = -1;
|
||||
c->epoch = fork_epoch;
|
||||
vkb_enc_init(&c->enc);
|
||||
if (do_connect(c) < 0) {
|
||||
c->dead = 1;
|
||||
}
|
||||
tls_conn = c;
|
||||
pthread_setspecific(conn_key, c);
|
||||
return c->dead ? NULL : c;
|
||||
}
|
||||
|
||||
int vkb_connected(void)
|
||||
{
|
||||
return get_conn() != NULL;
|
||||
}
|
||||
|
||||
void vkb_call_begin(vkb_call *c, uint32_t cmd, uint32_t table)
|
||||
{
|
||||
memset(c, 0, sizeof(*c));
|
||||
c->cmd = cmd;
|
||||
c->table = table;
|
||||
c->conn = get_conn();
|
||||
if (c->conn && !c->conn->busy) {
|
||||
c->conn->busy = 1;
|
||||
c->e = c->conn->enc;
|
||||
vkb_enc_reset(&c->e);
|
||||
} else {
|
||||
/* No connection, or a nested call: encode into a private buffer. */
|
||||
if (c->conn && c->conn->busy) VKB_ERR("internal: nested bridge call (%s)", vkb_cmd_names[cmd]);
|
||||
vkb_enc_init(&c->e);
|
||||
c->flags |= 0x80000000u;
|
||||
}
|
||||
}
|
||||
|
||||
static void release_enc(vkb_call *c)
|
||||
{
|
||||
if (c->flags & 0x80000000u) {
|
||||
vkb_enc_free(&c->e);
|
||||
} else if (c->conn) {
|
||||
c->conn->enc = c->e;
|
||||
c->conn->busy = 0;
|
||||
/* Don't keep a huge buffer around after one big message. */
|
||||
if (c->conn->enc.cap > (16u << 20)) {
|
||||
vkb_enc_free(&c->conn->enc);
|
||||
vkb_enc_init(&c->conn->enc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int vkb_call_exec(vkb_call *c)
|
||||
{
|
||||
vkb_conn *conn = c->conn;
|
||||
if (!conn || conn->dead || (c->flags & 0x80000000u)) {
|
||||
release_enc(c);
|
||||
c->conn = NULL;
|
||||
return 0;
|
||||
}
|
||||
if (c->e.oom) {
|
||||
VKB_ERR("%s: request could not be encoded", vkb_cmd_names[c->cmd]);
|
||||
release_enc(c);
|
||||
c->conn = NULL;
|
||||
return 0;
|
||||
}
|
||||
vkb_msg_hdr h = {VKB_MAGIC, (uint32_t)c->e.len, c->cmd, c->table, (uint32_t)c->e.nfds, c->flags & VKB_F_NOREPLY};
|
||||
if (vkb_send_msg(conn->sock, &h, c->e.buf, c->e.fds, c->e.nfds) < 0) {
|
||||
VKB_ERR("%s: lost the bridge server (%s)", vkb_cmd_names[c->cmd], strerror(errno));
|
||||
conn->dead = 1;
|
||||
release_enc(c);
|
||||
c->conn = NULL;
|
||||
return 0;
|
||||
}
|
||||
release_enc(c);
|
||||
if (c->flags & VKB_F_NOREPLY) {
|
||||
c->conn = NULL;
|
||||
return 1;
|
||||
}
|
||||
int fds[VKB_MAX_FDS], nfds = 0;
|
||||
vkb_msg_hdr rh;
|
||||
if (vkb_recv_msg(conn->sock, &rh, &conn->in, &conn->incap, fds, &nfds) < 0) {
|
||||
VKB_ERR("%s: lost the bridge server while waiting for the reply", vkb_cmd_names[c->cmd]);
|
||||
conn->dead = 1;
|
||||
c->conn = NULL;
|
||||
return 0;
|
||||
}
|
||||
if (rh.cmd != VKB_ST_OK) {
|
||||
static const char *const why[] = {"ok", "malformed request", "the driver lacks this command", "unknown object"};
|
||||
VKB_ERR("%s: the server refused the call (%s)", vkb_cmd_names[c->cmd], rh.cmd < 4 ? why[rh.cmd] : "?");
|
||||
for (int i = 0; i < nfds; i++) close(fds[i]);
|
||||
c->conn = NULL;
|
||||
return 0;
|
||||
}
|
||||
/* The decoder keeps fds in a per-call array. */
|
||||
static __thread int call_fds[VKB_MAX_FDS];
|
||||
memcpy(call_fds, fds, sizeof(int) * (size_t)nfds);
|
||||
vkb_dec_init(&c->d, conn->in, rh.size, &conn->arena, call_fds, nfds);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void vkb_call_end(vkb_call *c)
|
||||
{
|
||||
if (!c->conn) return;
|
||||
if (c->d.err) VKB_ERR("%s: malformed reply", vkb_cmd_names[c->cmd]);
|
||||
vkb_dec_close_untaken(&c->d);
|
||||
vkb_arena_reset(&c->conn->arena);
|
||||
c->conn = NULL;
|
||||
}
|
||||
|
||||
uint32_t vkb_table_of(const void *h)
|
||||
{
|
||||
return h ? ((const vkb_object *)h)->table : 0;
|
||||
}
|
||||
|
||||
uint64_t vkb_remote(const void *h)
|
||||
{
|
||||
return h ? ((const vkb_object *)h)->remote : 0;
|
||||
}
|
||||
|
||||
int vkb_memfd(const char *name, size_t size)
|
||||
{
|
||||
int fd = (int)syscall(SYS_memfd_create, name, 1u /* MFD_CLOEXEC */);
|
||||
if (fd < 0) {
|
||||
/* No memfd (old kernel or a filter): an unlinked file in the runtime dir. */
|
||||
char path[256];
|
||||
const char *rd = getenv("XDG_RUNTIME_DIR");
|
||||
snprintf(path, sizeof(path), "%s/vkbridge-XXXXXX", rd && *rd ? rd : "/tmp");
|
||||
fd = mkostemp(path, O_CLOEXEC);
|
||||
if (fd < 0) return -1;
|
||||
unlink(path);
|
||||
}
|
||||
if (ftruncate(fd, (off_t)size) < 0) {
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ hash map */
|
||||
|
||||
void vkb_map_init(vkb_map *m)
|
||||
{
|
||||
memset(m, 0, sizeof(*m));
|
||||
pthread_mutex_init(&m->lock, NULL);
|
||||
}
|
||||
|
||||
void vkb_map_destroy(vkb_map *m)
|
||||
{
|
||||
free(m->keys);
|
||||
free(m->vals);
|
||||
pthread_mutex_destroy(&m->lock);
|
||||
memset(m, 0, sizeof(*m));
|
||||
}
|
||||
|
||||
static uint32_t hash64(uint64_t k)
|
||||
{
|
||||
k ^= k >> 33;
|
||||
k *= 0xff51afd7ed558ccdull;
|
||||
k ^= k >> 33;
|
||||
return (uint32_t)k;
|
||||
}
|
||||
|
||||
/* Keys are never 0 (VK_NULL_HANDLE); 0 marks an empty slot, ~0 a deleted one. */
|
||||
#define TOMB (~(uint64_t)0)
|
||||
|
||||
static void map_rehash(vkb_map *m, uint32_t ncap)
|
||||
{
|
||||
uint64_t *ok = m->keys;
|
||||
void **ov = m->vals;
|
||||
uint32_t oc = m->cap;
|
||||
m->keys = calloc(ncap, sizeof(uint64_t));
|
||||
m->vals = calloc(ncap, sizeof(void *));
|
||||
m->cap = ncap;
|
||||
m->count = 0;
|
||||
for (uint32_t i = 0; i < oc; i++) {
|
||||
if (ok[i] && ok[i] != TOMB) {
|
||||
uint32_t j = hash64(ok[i]) & (ncap - 1);
|
||||
while (m->keys[j]) j = (j + 1) & (ncap - 1);
|
||||
m->keys[j] = ok[i];
|
||||
m->vals[j] = ov[i];
|
||||
m->count++;
|
||||
}
|
||||
}
|
||||
free(ok);
|
||||
free(ov);
|
||||
}
|
||||
|
||||
void vkb_map_put(vkb_map *m, uint64_t k, void *v)
|
||||
{
|
||||
if (!k) return;
|
||||
pthread_mutex_lock(&m->lock);
|
||||
if (!m->cap || (m->count + 1) * 2 > m->cap) map_rehash(m, m->cap ? m->cap * 2 : 64);
|
||||
uint32_t j = hash64(k) & (m->cap - 1);
|
||||
int64_t tomb = -1;
|
||||
while (m->keys[j]) {
|
||||
if (m->keys[j] == k) {
|
||||
m->vals[j] = v;
|
||||
pthread_mutex_unlock(&m->lock);
|
||||
return;
|
||||
}
|
||||
if (m->keys[j] == TOMB && tomb < 0) tomb = j;
|
||||
j = (j + 1) & (m->cap - 1);
|
||||
}
|
||||
if (tomb >= 0) j = (uint32_t)tomb;
|
||||
m->keys[j] = k;
|
||||
m->vals[j] = v;
|
||||
m->count++;
|
||||
pthread_mutex_unlock(&m->lock);
|
||||
}
|
||||
|
||||
static int64_t map_find(vkb_map *m, uint64_t k)
|
||||
{
|
||||
if (!m->cap || !k) return -1;
|
||||
uint32_t j = hash64(k) & (m->cap - 1);
|
||||
for (uint32_t n = 0; n < m->cap && m->keys[j]; n++) {
|
||||
if (m->keys[j] == k) return j;
|
||||
j = (j + 1) & (m->cap - 1);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void *vkb_map_get(vkb_map *m, uint64_t k)
|
||||
{
|
||||
pthread_mutex_lock(&m->lock);
|
||||
int64_t j = map_find(m, k);
|
||||
void *v = j >= 0 ? m->vals[j] : NULL;
|
||||
pthread_mutex_unlock(&m->lock);
|
||||
return v;
|
||||
}
|
||||
|
||||
void *vkb_map_remove(vkb_map *m, uint64_t k)
|
||||
{
|
||||
pthread_mutex_lock(&m->lock);
|
||||
int64_t j = map_find(m, k);
|
||||
void *v = NULL;
|
||||
if (j >= 0) {
|
||||
v = m->vals[j];
|
||||
m->keys[j] = TOMB;
|
||||
m->vals[j] = NULL;
|
||||
/* count keeps tombstones, so the table rehashes before it fills with them */
|
||||
}
|
||||
pthread_mutex_unlock(&m->lock);
|
||||
return v;
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Descriptor update templates and private data.
|
||||
*
|
||||
* A template's data is laid out by the app (offsets and strides into its own structures). The
|
||||
* server's copy of the template is created with packed entries instead, and every update packs
|
||||
* the app's data the same way before sending it, so the server passes the blob straight on.
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "vkb_client.h"
|
||||
#include "gen/vkb_client_gen.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
typedef struct vkb_template {
|
||||
uint32_t count;
|
||||
size_t size; /* packed bytes */
|
||||
VkDescriptorUpdateTemplateEntry *app; /* the app's entries */
|
||||
size_t *packed; /* packed offset per entry */
|
||||
size_t *elem; /* element size per entry (inline: 1) */
|
||||
} vkb_template;
|
||||
|
||||
static size_t elem_size(VkDescriptorType t)
|
||||
{
|
||||
switch (t) {
|
||||
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
||||
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
|
||||
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
|
||||
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
|
||||
return sizeof(VkDescriptorImageInfo);
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
||||
return sizeof(VkDescriptorBufferInfo);
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
|
||||
return sizeof(VkBufferView);
|
||||
case VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK:
|
||||
return 1;
|
||||
default:
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDescriptorUpdateTemplate *pTemplate)
|
||||
{
|
||||
uint32_t n = pCreateInfo->descriptorUpdateEntryCount;
|
||||
vkb_template *t = calloc(1, sizeof(*t));
|
||||
t->count = n;
|
||||
t->app = calloc(n ? n : 1, sizeof(*t->app));
|
||||
t->packed = calloc(n ? n : 1, sizeof(size_t));
|
||||
t->elem = calloc(n ? n : 1, sizeof(size_t));
|
||||
VkDescriptorUpdateTemplateEntry *packed = calloc(n ? n : 1, sizeof(*packed));
|
||||
size_t off = 0;
|
||||
for (uint32_t i = 0; i < n; i++) {
|
||||
const VkDescriptorUpdateTemplateEntry *e = &pCreateInfo->pDescriptorUpdateEntries[i];
|
||||
t->app[i] = *e;
|
||||
size_t es = elem_size(e->descriptorType);
|
||||
t->elem[i] = es;
|
||||
t->packed[i] = off;
|
||||
packed[i] = *e;
|
||||
packed[i].offset = off;
|
||||
packed[i].stride = es;
|
||||
off += (es * e->descriptorCount + 7) & ~(size_t)7;
|
||||
}
|
||||
t->size = off;
|
||||
VkDescriptorUpdateTemplateCreateInfo ci = *pCreateInfo;
|
||||
ci.pDescriptorUpdateEntries = packed;
|
||||
VkResult r = vkb_wire_vkCreateDescriptorUpdateTemplate(device, &ci, pAllocator, pTemplate);
|
||||
free(packed);
|
||||
if (r != VK_SUCCESS) {
|
||||
free(t->app);
|
||||
free(t->packed);
|
||||
free(t->elem);
|
||||
free(t);
|
||||
return r;
|
||||
}
|
||||
vkb_map_put(&vkb_dev(device)->templates, (uint64_t)*pTemplate, t);
|
||||
return r;
|
||||
}
|
||||
|
||||
static void template_free(vkb_template *t)
|
||||
{
|
||||
if (!t) return;
|
||||
free(t->app);
|
||||
free(t->packed);
|
||||
free(t->elem);
|
||||
free(t);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate tmpl,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!tmpl) return;
|
||||
template_free(vkb_map_remove(&vkb_dev(device)->templates, (uint64_t)tmpl));
|
||||
vkb_wire_vkDestroyDescriptorUpdateTemplate(device, tmpl, pAllocator);
|
||||
}
|
||||
|
||||
static void pack(const vkb_template *t, const void *pData, uint8_t *out)
|
||||
{
|
||||
const uint8_t *src = pData;
|
||||
for (uint32_t i = 0; i < t->count; i++) {
|
||||
const VkDescriptorUpdateTemplateEntry *e = &t->app[i];
|
||||
uint8_t *dst = out + t->packed[i];
|
||||
if (e->descriptorType == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK) {
|
||||
memcpy(dst, src + e->offset, e->descriptorCount);
|
||||
continue;
|
||||
}
|
||||
size_t es = t->elem[i];
|
||||
for (uint32_t j = 0; j < e->descriptorCount; j++) memcpy(dst + j * es, src + e->offset + (size_t)j * e->stride, es);
|
||||
}
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkUpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet set, VkDescriptorUpdateTemplate tmpl,
|
||||
const void *pData)
|
||||
{
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
vkb_template *t = vkb_map_get(&dev->templates, (uint64_t)tmpl);
|
||||
if (!t) {
|
||||
VKB_ERR("vkUpdateDescriptorSetWithTemplate with an unknown template");
|
||||
return;
|
||||
}
|
||||
vkb_call c;
|
||||
vkb_call_begin(&c, VKB_CMD_vkbDescUpdateRaw, dev->obj.table);
|
||||
vkb_enc_u64(&c.e, dev->obj.remote);
|
||||
vkb_enc_bytes(&c.e, &set, sizeof(set));
|
||||
vkb_enc_bytes(&c.e, &tmpl, sizeof(tmpl));
|
||||
/* Packed straight into the request. */
|
||||
vkb_enc_u8(&c.e, 1);
|
||||
vkb_enc_u64(&c.e, t->size);
|
||||
size_t at = vkb_enc_raw(&c.e, NULL, t->size);
|
||||
if (!c.e.oom) pack(t, pData, c.e.buf + at);
|
||||
if (vkb_call_exec(&c)) vkb_call_end(&c);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkCmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplate tmpl,
|
||||
VkPipelineLayout layout, uint32_t set, const void *pData)
|
||||
{
|
||||
vkb_cmdbuf *cb = vkb_cb(commandBuffer);
|
||||
vkb_template *t = vkb_map_get(&cb->device->templates, (uint64_t)tmpl);
|
||||
if (!t) {
|
||||
VKB_ERR("vkCmdPushDescriptorSetWithTemplateKHR with an unknown template");
|
||||
return;
|
||||
}
|
||||
vkb_enc *e = vkb_cmd_record_begin(commandBuffer, VKB_CMD_vkbPushDescRaw);
|
||||
if (!e) return;
|
||||
vkb_enc_u64(e, cb->obj.remote);
|
||||
vkb_enc_bytes(e, &tmpl, sizeof(tmpl));
|
||||
vkb_enc_bytes(e, &layout, sizeof(layout));
|
||||
vkb_enc_u32(e, set);
|
||||
vkb_enc_u8(e, 1);
|
||||
vkb_enc_u64(e, t->size);
|
||||
size_t at = vkb_enc_raw(e, NULL, t->size);
|
||||
if (!e->oom) pack(t, pData, e->buf + at);
|
||||
vkb_cmd_record_end(commandBuffer);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ private data (client-local) */
|
||||
|
||||
typedef struct vkb_private_slot {
|
||||
vkb_map values;
|
||||
} vkb_private_slot;
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreatePrivateDataSlot(VkDevice device, const VkPrivateDataSlotCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkPrivateDataSlot *pSlot)
|
||||
{
|
||||
(void)device;
|
||||
(void)pCreateInfo;
|
||||
(void)pAllocator;
|
||||
vkb_private_slot *s = calloc(1, sizeof(*s));
|
||||
if (!s) return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
vkb_map_init(&s->values);
|
||||
*pSlot = (VkPrivateDataSlot)(uintptr_t)s;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyPrivateDataSlot(VkDevice device, VkPrivateDataSlot slot, const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
(void)device;
|
||||
(void)pAllocator;
|
||||
vkb_private_slot *s = (vkb_private_slot *)(uintptr_t)slot;
|
||||
if (!s) return;
|
||||
vkb_map_destroy(&s->values);
|
||||
free(s);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkSetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle,
|
||||
VkPrivateDataSlot slot, uint64_t data)
|
||||
{
|
||||
(void)device;
|
||||
(void)objectType;
|
||||
vkb_private_slot *s = (vkb_private_slot *)(uintptr_t)slot;
|
||||
vkb_map_put(&s->values, objectHandle, (void *)(uintptr_t)data);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle,
|
||||
VkPrivateDataSlot slot, uint64_t *pData)
|
||||
{
|
||||
(void)device;
|
||||
(void)objectType;
|
||||
vkb_private_slot *s = (vkb_private_slot *)(uintptr_t)slot;
|
||||
*pData = (uint64_t)(uintptr_t)vkb_map_get(&s->values, objectHandle);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ debug utils (no-ops) */
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo)
|
||||
{
|
||||
(void)device;
|
||||
(void)pNameInfo;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo)
|
||||
{
|
||||
(void)device;
|
||||
(void)pTagInfo;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkQueueBeginDebugUtilsLabelEXT(VkQueue queue, const VkDebugUtilsLabelEXT *pLabelInfo)
|
||||
{
|
||||
(void)queue;
|
||||
(void)pLabelInfo;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkQueueEndDebugUtilsLabelEXT(VkQueue queue)
|
||||
{
|
||||
(void)queue;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkQueueInsertDebugUtilsLabelEXT(VkQueue queue, const VkDebugUtilsLabelEXT *pLabelInfo)
|
||||
{
|
||||
(void)queue;
|
||||
(void)pLabelInfo;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT *pMessenger)
|
||||
{
|
||||
(void)instance;
|
||||
(void)pCreateInfo;
|
||||
(void)pAllocator;
|
||||
static uint64_t next = 1;
|
||||
*pMessenger = (VkDebugUtilsMessengerEXT)(uintptr_t)__atomic_fetch_add(&next, 1, __ATOMIC_RELAXED);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
(void)instance;
|
||||
(void)messenger;
|
||||
(void)pAllocator;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkSubmitDebugUtilsMessageEXT(VkInstance instance, VkDebugUtilsMessageSeverityFlagBitsEXT severity,
|
||||
VkDebugUtilsMessageTypeFlagsEXT types,
|
||||
const VkDebugUtilsMessengerCallbackDataEXT *pData)
|
||||
{
|
||||
(void)instance;
|
||||
(void)severity;
|
||||
(void)types;
|
||||
(void)pData;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Client side of feature emulation (Phase 4 fills this in).
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "emu.h"
|
||||
|
||||
const VkExtensionProperties *vkb_emu_extensions(vkb_physdev *pd, uint32_t *n)
|
||||
{
|
||||
(void)pd;
|
||||
*n = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void vkb_emu_patch_limits(vkb_physdev *pd, VkPhysicalDeviceProperties *p) { (void)pd; (void)p; }
|
||||
void vkb_emu_patch_properties_chain(vkb_physdev *pd, VkBaseOutStructure *b) { (void)pd; (void)b; }
|
||||
void vkb_emu_patch_features(vkb_physdev *pd, VkPhysicalDeviceFeatures *f) { (void)pd; (void)f; }
|
||||
void vkb_emu_patch_features_chain(vkb_physdev *pd, VkBaseOutStructure *b) { (void)pd; (void)b; }
|
||||
|
||||
int vkb_emu_format_properties(vkb_physdev *pd, VkFormat format, VkFormatProperties *fp, VkFormatProperties2 *fp2)
|
||||
{
|
||||
(void)pd; (void)format; (void)fp; (void)fp2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
VkFormat vkb_emu_real_format(vkb_physdev *pd, VkFormat format, VkImageUsageFlags *usage, VkImageCreateFlags *flags)
|
||||
{
|
||||
(void)pd; (void)usage; (void)flags;
|
||||
return format;
|
||||
}
|
||||
|
||||
int vkb_emu_is_emulated_format(vkb_physdev *pd, VkFormat format) { (void)pd; (void)format; return 0; }
|
||||
void vkb_emu_image_create_info(vkb_device *dev, VkImageCreateInfo *ci) { (void)dev; (void)ci; }
|
||||
void vkb_emu_image_created(vkb_device *dev, const VkImageCreateInfo *ci, VkImage image) { (void)dev; (void)ci; (void)image; }
|
||||
void vkb_emu_image_destroyed(vkb_device *dev, VkImage image) { (void)dev; (void)image; }
|
||||
@@ -0,0 +1,24 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Client side of feature emulation: reporting what the server emulates (see server_emu.c).
|
||||
*/
|
||||
#ifndef VKB_CLIENT_EMU_H
|
||||
#define VKB_CLIENT_EMU_H
|
||||
|
||||
#include "vkb_client.h"
|
||||
|
||||
const VkExtensionProperties *vkb_emu_extensions(vkb_physdev *pd, uint32_t *n);
|
||||
void vkb_emu_patch_limits(vkb_physdev *pd, VkPhysicalDeviceProperties *p);
|
||||
void vkb_emu_patch_properties_chain(vkb_physdev *pd, VkBaseOutStructure *b);
|
||||
void vkb_emu_patch_features(vkb_physdev *pd, VkPhysicalDeviceFeatures *f);
|
||||
void vkb_emu_patch_features_chain(vkb_physdev *pd, VkBaseOutStructure *b);
|
||||
/* 1 = handled (format is emulated). fp2 may be NULL. */
|
||||
int vkb_emu_format_properties(vkb_physdev *pd, VkFormat format, VkFormatProperties *fp, VkFormatProperties2 *fp2);
|
||||
/* The format the server really uses for an emulated one (usage/flags adjusted); else format. */
|
||||
VkFormat vkb_emu_real_format(vkb_physdev *pd, VkFormat format, VkImageUsageFlags *usage, VkImageCreateFlags *flags);
|
||||
int vkb_emu_is_emulated_format(vkb_physdev *pd, VkFormat format);
|
||||
void vkb_emu_image_create_info(vkb_device *dev, VkImageCreateInfo *ci);
|
||||
void vkb_emu_image_created(vkb_device *dev, const VkImageCreateInfo *ci, VkImage image);
|
||||
void vkb_emu_image_destroyed(vkb_device *dev, VkImage image);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,586 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Loader interface, instances, physical devices, devices and queues.
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "vkb_client.h"
|
||||
#include "gen/vkb_client_gen.h"
|
||||
#include "wsi.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* ------------------------------------------------------------------ proc lookup */
|
||||
|
||||
static int proc_cmp(const void *a, const void *b)
|
||||
{
|
||||
return strcmp(((const vkb_proc_desc *)a)->name, ((const vkb_proc_desc *)b)->name);
|
||||
}
|
||||
|
||||
static vkb_proc_desc *sorted_procs;
|
||||
static pthread_once_t procs_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
static void procs_init(void)
|
||||
{
|
||||
sorted_procs = malloc(vkb_client_proc_count * sizeof(vkb_proc_desc));
|
||||
memcpy(sorted_procs, vkb_client_procs, vkb_client_proc_count * sizeof(vkb_proc_desc));
|
||||
qsort(sorted_procs, vkb_client_proc_count, sizeof(vkb_proc_desc), proc_cmp);
|
||||
}
|
||||
|
||||
static const vkb_proc_desc *find_proc(const char *name)
|
||||
{
|
||||
pthread_once(&procs_once, procs_init);
|
||||
vkb_proc_desc key = {name, NULL, 0, NULL};
|
||||
return bsearch(&key, sorted_procs, vkb_client_proc_count, sizeof(vkb_proc_desc), proc_cmp);
|
||||
}
|
||||
|
||||
int vkb_device_ext_enabled(const vkb_device *d, const char *name)
|
||||
{
|
||||
for (uint32_t i = 0; i < d->enabled_ext_count; i++)
|
||||
if (!strcmp(d->enabled_exts[i], name)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
PFN_vkVoidFunction vkb_lookup_proc(const char *name, int level_max, vkb_device *dev, vkb_instance *inst)
|
||||
{
|
||||
(void)inst;
|
||||
if (!name) return NULL;
|
||||
const vkb_proc_desc *p = find_proc(name);
|
||||
if (!p) return NULL;
|
||||
if (level_max == VKB_LEVEL_DEVICE) {
|
||||
if (p->level != VKB_LEVEL_DEVICE) return NULL;
|
||||
if (dev && p->ext && !vkb_device_ext_enabled(dev, p->ext)) return NULL;
|
||||
}
|
||||
return p->fn;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ loader entry points */
|
||||
|
||||
VKB_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *pVersion)
|
||||
{
|
||||
if (*pVersion > 5) *pVersion = 5;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKB_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char *pName)
|
||||
{
|
||||
if (!pName) return NULL;
|
||||
if (!instance) {
|
||||
const vkb_proc_desc *p = find_proc(pName);
|
||||
if (!p) return NULL;
|
||||
if (p->level == VKB_LEVEL_GLOBAL || !strcmp(pName, "vkGetInstanceProcAddr")) return p->fn;
|
||||
return NULL;
|
||||
}
|
||||
return vkb_lookup_proc(pName, VKB_LEVEL_DEVICE + 1, NULL, vkb_inst(instance));
|
||||
}
|
||||
|
||||
VKB_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(VkInstance instance, const char *pName)
|
||||
{
|
||||
const vkb_proc_desc *p = find_proc(pName);
|
||||
if (!p || p->level != VKB_LEVEL_PHYSDEV) return NULL;
|
||||
(void)instance;
|
||||
return p->fn;
|
||||
}
|
||||
|
||||
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkb_ep_vkGetInstanceProcAddr(VkInstance instance, const char *pName)
|
||||
{
|
||||
return vk_icdGetInstanceProcAddr(instance, pName);
|
||||
}
|
||||
|
||||
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkb_ep_vkGetDeviceProcAddr(VkDevice device, const char *pName)
|
||||
{
|
||||
return vkb_lookup_proc(pName, VKB_LEVEL_DEVICE, vkb_dev(device), NULL);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ wrapping server objects */
|
||||
|
||||
void *vkb_wrap(VkObjectType type, const void *parent, uint64_t remote)
|
||||
{
|
||||
if (!remote) return NULL;
|
||||
switch (type) {
|
||||
case VK_OBJECT_TYPE_PHYSICAL_DEVICE: {
|
||||
vkb_instance *inst = (vkb_instance *)parent;
|
||||
pthread_mutex_lock(&inst->lock);
|
||||
vkb_physdev *pd = inst->pds;
|
||||
while (pd && pd->obj.remote != remote) pd = pd->list_next;
|
||||
if (!pd) {
|
||||
pd = calloc(1, sizeof(*pd));
|
||||
pd->obj.loader.loaderMagic = ICD_LOADER_MAGIC;
|
||||
pd->obj.type = type;
|
||||
pd->obj.remote = remote;
|
||||
pd->obj.table = inst->obj.table;
|
||||
pd->instance = inst;
|
||||
pthread_mutex_init(&pd->lock, NULL);
|
||||
pd->list_next = inst->pds;
|
||||
inst->pds = pd;
|
||||
}
|
||||
pthread_mutex_unlock(&inst->lock);
|
||||
return pd;
|
||||
}
|
||||
case VK_OBJECT_TYPE_QUEUE: {
|
||||
vkb_device *dev = (vkb_device *)parent;
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
vkb_queue *q = dev->queues;
|
||||
while (q && q->obj.remote != remote) q = q->next;
|
||||
if (!q) {
|
||||
q = calloc(1, sizeof(*q));
|
||||
q->obj.loader.loaderMagic = ICD_LOADER_MAGIC;
|
||||
q->obj.type = type;
|
||||
q->obj.remote = remote;
|
||||
q->obj.table = dev->obj.table;
|
||||
q->device = dev;
|
||||
q->next = dev->queues;
|
||||
dev->queues = q;
|
||||
}
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
return q;
|
||||
}
|
||||
case VK_OBJECT_TYPE_COMMAND_BUFFER: {
|
||||
vkb_device *dev = (vkb_device *)parent;
|
||||
vkb_cmdbuf *cb = calloc(1, sizeof(*cb));
|
||||
cb->obj.loader.loaderMagic = ICD_LOADER_MAGIC;
|
||||
cb->obj.type = type;
|
||||
cb->obj.remote = remote;
|
||||
cb->obj.table = dev->obj.table;
|
||||
cb->device = dev;
|
||||
vkb_enc_init(&cb->stream);
|
||||
return cb;
|
||||
}
|
||||
default:
|
||||
VKB_ERR("internal: cannot wrap object type %d", type);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ instance */
|
||||
|
||||
static uint32_t server_instance_version(void)
|
||||
{
|
||||
static uint32_t v;
|
||||
if (!v) {
|
||||
uint32_t sv = VK_API_VERSION_1_0;
|
||||
if (vkb_wire_vkEnumerateInstanceVersion(&sv) != VK_SUCCESS) return VK_API_VERSION_1_0;
|
||||
v = sv < VKB_API_VERSION ? sv : VKB_API_VERSION;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEnumerateInstanceVersion(uint32_t *pApiVersion)
|
||||
{
|
||||
if (!vkb_connected()) {
|
||||
*pApiVersion = VK_API_VERSION_1_0;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
*pApiVersion = server_instance_version();
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static const char *const client_instance_exts[] = {
|
||||
"VK_KHR_surface", "VK_KHR_wayland_surface", "VK_KHR_xcb_surface", "VK_KHR_xlib_surface",
|
||||
"VK_EXT_headless_surface", "VK_KHR_get_surface_capabilities2", "VK_EXT_swapchain_colorspace",
|
||||
"VK_EXT_debug_utils",
|
||||
};
|
||||
|
||||
static int bridged_ext(const char *name, int device)
|
||||
{
|
||||
for (int i = 0; i < VKB_EXT_COUNT; i++)
|
||||
if (vkb_exts[i].device == device && !vkb_exts[i].client && !strcmp(vkb_exts[i].name, name)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static VkResult fill_props(const VkExtensionProperties *list, uint32_t n, uint32_t *pCount, VkExtensionProperties *out)
|
||||
{
|
||||
if (!out) {
|
||||
*pCount = n;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
uint32_t c = *pCount < n ? *pCount : n;
|
||||
memcpy(out, list, c * sizeof(*out));
|
||||
*pCount = c;
|
||||
return c < n ? VK_INCOMPLETE : VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount,
|
||||
VkExtensionProperties *pProperties)
|
||||
{
|
||||
if (pLayerName) return VK_ERROR_LAYER_NOT_PRESENT;
|
||||
static VkExtensionProperties *list;
|
||||
static uint32_t count;
|
||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
pthread_mutex_lock(&lock);
|
||||
if (!list) {
|
||||
if (!vkb_connected()) {
|
||||
/* No server: offer nothing, and vkCreateInstance will say the driver is incompatible. */
|
||||
pthread_mutex_unlock(&lock);
|
||||
*pPropertyCount = 0;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
uint32_t n = 0;
|
||||
vkb_wire_vkEnumerateInstanceExtensionProperties(NULL, &n, NULL);
|
||||
VkExtensionProperties *srv = calloc(n + 1, sizeof(*srv));
|
||||
vkb_wire_vkEnumerateInstanceExtensionProperties(NULL, &n, srv);
|
||||
size_t nc = sizeof(client_instance_exts) / sizeof(client_instance_exts[0]);
|
||||
list = calloc(n + nc, sizeof(*list));
|
||||
for (uint32_t i = 0; i < n; i++)
|
||||
if (bridged_ext(srv[i].extensionName, 0)) list[count++] = srv[i];
|
||||
for (size_t i = 0; i < nc; i++) {
|
||||
snprintf(list[count].extensionName, sizeof(list[count].extensionName), "%s", client_instance_exts[i]);
|
||||
list[count].specVersion = 1;
|
||||
if (!strcmp(client_instance_exts[i], "VK_KHR_surface")) list[count].specVersion = 25;
|
||||
if (!strcmp(client_instance_exts[i], "VK_KHR_wayland_surface")) list[count].specVersion = 6;
|
||||
if (!strcmp(client_instance_exts[i], "VK_KHR_xcb_surface")) list[count].specVersion = 6;
|
||||
if (!strcmp(client_instance_exts[i], "VK_KHR_xlib_surface")) list[count].specVersion = 6;
|
||||
if (!strcmp(client_instance_exts[i], "VK_EXT_swapchain_colorspace")) list[count].specVersion = 4;
|
||||
if (!strcmp(client_instance_exts[i], "VK_EXT_debug_utils")) list[count].specVersion = 2;
|
||||
count++;
|
||||
}
|
||||
free(srv);
|
||||
}
|
||||
pthread_mutex_unlock(&lock);
|
||||
return fill_props(list, count, pPropertyCount, pProperties);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount, VkLayerProperties *pProperties)
|
||||
{
|
||||
(void)pProperties;
|
||||
*pPropertyCount = 0;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static int is_client_instance_ext(const char *n)
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(client_instance_exts) / sizeof(client_instance_exts[0]); i++)
|
||||
if (!strcmp(client_instance_exts[i], n)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
|
||||
VkInstance *pInstance)
|
||||
{
|
||||
(void)pAllocator;
|
||||
if (!vkb_connected()) return VK_ERROR_INCOMPATIBLE_DRIVER;
|
||||
vkb_instance *inst = calloc(1, sizeof(*inst));
|
||||
if (!inst) return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
inst->obj.loader.loaderMagic = ICD_LOADER_MAGIC;
|
||||
inst->obj.type = VK_OBJECT_TYPE_INSTANCE;
|
||||
pthread_mutex_init(&inst->lock, NULL);
|
||||
|
||||
VkInstanceCreateInfo ci = *pCreateInfo;
|
||||
const char **exts = calloc(ci.enabledExtensionCount + 1, sizeof(char *));
|
||||
uint32_t n = 0;
|
||||
for (uint32_t i = 0; i < ci.enabledExtensionCount; i++) {
|
||||
const char *e = ci.ppEnabledExtensionNames[i];
|
||||
if (is_client_instance_ext(e)) {
|
||||
if (!strcmp(e, "VK_KHR_surface")) inst->ext_surface = 1;
|
||||
else if (!strcmp(e, "VK_KHR_wayland_surface")) inst->ext_wayland = 1;
|
||||
else if (!strcmp(e, "VK_KHR_xcb_surface")) inst->ext_xcb = 1;
|
||||
else if (!strcmp(e, "VK_KHR_xlib_surface")) inst->ext_xlib = 1;
|
||||
else if (!strcmp(e, "VK_EXT_headless_surface")) inst->ext_headless = 1;
|
||||
else if (!strcmp(e, "VK_KHR_get_surface_capabilities2")) inst->ext_surface_caps2 = 1;
|
||||
else if (!strcmp(e, "VK_EXT_debug_utils")) inst->ext_debug_utils = 1;
|
||||
continue;
|
||||
}
|
||||
exts[n++] = e;
|
||||
}
|
||||
ci.enabledExtensionCount = n;
|
||||
ci.ppEnabledExtensionNames = exts;
|
||||
ci.enabledLayerCount = 0;
|
||||
ci.ppEnabledLayerNames = NULL;
|
||||
VkApplicationInfo app;
|
||||
uint32_t api = server_instance_version();
|
||||
if (ci.pApplicationInfo) {
|
||||
app = *ci.pApplicationInfo;
|
||||
if (app.apiVersion > api) app.apiVersion = api;
|
||||
ci.pApplicationInfo = &app;
|
||||
inst->api_version = app.apiVersion ? app.apiVersion : VK_API_VERSION_1_0;
|
||||
} else {
|
||||
inst->api_version = VK_API_VERSION_1_0;
|
||||
}
|
||||
|
||||
vkb_call c;
|
||||
vkb_call_begin(&c, VKB_CMD_vkCreateInstance, 0);
|
||||
vkb_enc_u8(&c.e, 1);
|
||||
vkb_enc_VkInstanceCreateInfo(&c.e, &ci);
|
||||
vkb_enc_u8(&c.e, 1);
|
||||
free(exts);
|
||||
if (!vkb_call_exec(&c)) {
|
||||
free(inst);
|
||||
return VK_ERROR_INITIALIZATION_FAILED;
|
||||
}
|
||||
VkResult r = (VkResult)vkb_dec_u32(&c.d);
|
||||
inst->obj.remote = vkb_dec_u64(&c.d);
|
||||
inst->obj.table = vkb_dec_u32(&c.d);
|
||||
vkb_call_end(&c);
|
||||
if (r != VK_SUCCESS) {
|
||||
free(inst);
|
||||
return r;
|
||||
}
|
||||
VKB_INFO("instance created (Vulkan %u.%u)", VK_API_VERSION_MAJOR(inst->api_version), VK_API_VERSION_MINOR(inst->api_version));
|
||||
*pInstance = (VkInstance)inst;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
(void)pAllocator;
|
||||
if (!instance) return;
|
||||
vkb_instance *inst = vkb_inst(instance);
|
||||
vkb_call c;
|
||||
vkb_call_begin(&c, VKB_CMD_vkDestroyInstance, inst->obj.table);
|
||||
vkb_enc_u64(&c.e, inst->obj.remote);
|
||||
if (vkb_call_exec(&c)) vkb_call_end(&c);
|
||||
vkb_physdev *pd = inst->pds;
|
||||
while (pd) {
|
||||
vkb_physdev *n = pd->list_next;
|
||||
free(pd->exts);
|
||||
pthread_mutex_destroy(&pd->lock);
|
||||
free(pd);
|
||||
pd = n;
|
||||
}
|
||||
pthread_mutex_destroy(&inst->lock);
|
||||
free(inst);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ physical devices */
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pCount, VkPhysicalDevice *pDevices)
|
||||
{
|
||||
VkResult r = vkb_wire_vkEnumeratePhysicalDevices(instance, pCount, pDevices);
|
||||
if (pDevices && (r == VK_SUCCESS || r == VK_INCOMPLETE)) {
|
||||
for (uint32_t i = 0; i < *pCount; i++) vkb_physdev_ready(vkb_pd(pDevices[i]));
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t *pCount,
|
||||
VkPhysicalDeviceGroupProperties *pGroups)
|
||||
{
|
||||
/* One group per device: what a single-GPU driver reports. */
|
||||
uint32_t n = 0;
|
||||
VkResult r = vkb_ep_vkEnumeratePhysicalDevices(instance, &n, NULL);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
if (!pGroups) {
|
||||
*pCount = n;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
VkPhysicalDevice *pds = calloc(n ? n : 1, sizeof(*pds));
|
||||
r = vkb_ep_vkEnumeratePhysicalDevices(instance, &n, pds);
|
||||
uint32_t c = *pCount < n ? *pCount : n;
|
||||
for (uint32_t i = 0; i < c; i++) {
|
||||
pGroups[i].physicalDeviceCount = 1;
|
||||
memset(pGroups[i].physicalDevices, 0, sizeof(pGroups[i].physicalDevices));
|
||||
pGroups[i].physicalDevices[0] = pds[i];
|
||||
pGroups[i].subsetAllocation = VK_FALSE;
|
||||
}
|
||||
free(pds);
|
||||
*pCount = c;
|
||||
return c < n ? VK_INCOMPLETE : r;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName,
|
||||
uint32_t *pPropertyCount, VkExtensionProperties *pProperties)
|
||||
{
|
||||
if (pLayerName) return VK_ERROR_LAYER_NOT_PRESENT;
|
||||
vkb_physdev *pd = vkb_pd(physicalDevice);
|
||||
if (!vkb_physdev_ready(pd)) {
|
||||
*pPropertyCount = 0;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
return fill_props(pd->exts, pd->next, pPropertyCount, pProperties);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount,
|
||||
VkLayerProperties *pProperties)
|
||||
{
|
||||
(void)physicalDevice;
|
||||
(void)pProperties;
|
||||
*pPropertyCount = 0;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ device */
|
||||
|
||||
static const char *const client_device_exts[] = {
|
||||
"VK_KHR_swapchain", "VK_KHR_incremental_present", "VK_KHR_swapchain_mutable_format",
|
||||
};
|
||||
|
||||
int vkb_is_client_device_ext(const char *n)
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(client_device_exts) / sizeof(client_device_exts[0]); i++)
|
||||
if (!strcmp(client_device_exts[i], n)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *const *vkb_client_device_exts(uint32_t *n)
|
||||
{
|
||||
*n = sizeof(client_device_exts) / sizeof(client_device_exts[0]);
|
||||
return client_device_exts;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkDevice *pDevice)
|
||||
{
|
||||
(void)pAllocator;
|
||||
vkb_physdev *pd = vkb_pd(physicalDevice);
|
||||
if (!vkb_physdev_ready(pd)) return VK_ERROR_INITIALIZATION_FAILED;
|
||||
vkb_device *dev = calloc(1, sizeof(*dev));
|
||||
if (!dev) return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
dev->obj.loader.loaderMagic = ICD_LOADER_MAGIC;
|
||||
dev->obj.type = VK_OBJECT_TYPE_DEVICE;
|
||||
dev->pd = pd;
|
||||
dev->instance = pd->instance;
|
||||
pthread_mutex_init(&dev->lock, NULL);
|
||||
|
||||
VkDeviceCreateInfo ci = *pCreateInfo;
|
||||
const char **server_exts = calloc(ci.enabledExtensionCount + 1, sizeof(char *));
|
||||
dev->enabled_exts = calloc(ci.enabledExtensionCount + 1, sizeof(char *));
|
||||
uint32_t n = 0;
|
||||
for (uint32_t i = 0; i < ci.enabledExtensionCount; i++) {
|
||||
const char *e = ci.ppEnabledExtensionNames[i];
|
||||
dev->enabled_exts[dev->enabled_ext_count++] = strdup(e);
|
||||
if (!strcmp(e, "VK_KHR_swapchain")) dev->ext_swapchain = 1;
|
||||
if (vkb_is_client_device_ext(e)) continue;
|
||||
server_exts[n++] = e;
|
||||
}
|
||||
ci.enabledExtensionCount = n;
|
||||
ci.ppEnabledExtensionNames = server_exts;
|
||||
ci.enabledLayerCount = 0;
|
||||
ci.ppEnabledLayerNames = NULL;
|
||||
|
||||
vkb_call c;
|
||||
vkb_call_begin(&c, VKB_CMD_vkCreateDevice, pd->obj.table);
|
||||
vkb_enc_u64(&c.e, pd->obj.remote);
|
||||
vkb_enc_u8(&c.e, 1);
|
||||
vkb_enc_VkDeviceCreateInfo(&c.e, &ci);
|
||||
vkb_enc_u8(&c.e, 1);
|
||||
free(server_exts);
|
||||
VkResult r;
|
||||
if (!vkb_call_exec(&c)) {
|
||||
r = VK_ERROR_INITIALIZATION_FAILED;
|
||||
} else {
|
||||
r = (VkResult)vkb_dec_u32(&c.d);
|
||||
dev->obj.remote = vkb_dec_u64(&c.d);
|
||||
dev->obj.table = vkb_dec_u32(&c.d);
|
||||
vkb_call_end(&c);
|
||||
}
|
||||
if (r != VK_SUCCESS) {
|
||||
for (uint32_t i = 0; i < dev->enabled_ext_count; i++) free((void *)dev->enabled_exts[i]);
|
||||
free(dev->enabled_exts);
|
||||
free(dev);
|
||||
return r;
|
||||
}
|
||||
vkb_map_init(&dev->memories);
|
||||
vkb_map_init(&dev->templates);
|
||||
vkb_map_init(&dev->pools);
|
||||
vkb_map_init(&dev->unshared);
|
||||
vkb_map_init(&dev->shared_images);
|
||||
vkb_memory_init_device(dev);
|
||||
VKB_INFO("device created on %s", pd->props.deviceName);
|
||||
*pDevice = (VkDevice)dev;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
(void)pAllocator;
|
||||
if (!device) return;
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
vkb_call c;
|
||||
vkb_call_begin(&c, VKB_CMD_vkDestroyDevice, dev->obj.table);
|
||||
vkb_enc_u64(&c.e, dev->obj.remote);
|
||||
if (vkb_call_exec(&c)) vkb_call_end(&c);
|
||||
vkb_queue *q = dev->queues;
|
||||
while (q) {
|
||||
vkb_queue *n = q->next;
|
||||
free(q);
|
||||
q = n;
|
||||
}
|
||||
/* Mapped memory the app never freed. */
|
||||
for (uint32_t i = 0; i < dev->memories.cap; i++) {
|
||||
if (dev->memories.keys[i] && dev->memories.keys[i] != ~(uint64_t)0) {
|
||||
vkb_memory *m = dev->memories.vals[i];
|
||||
extern void vkb_memory_unmap_free(vkb_memory * m);
|
||||
vkb_memory_unmap_free(m);
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < dev->pools.cap; i++) {
|
||||
if (dev->pools.keys[i] && dev->pools.keys[i] != ~(uint64_t)0) {
|
||||
extern void vkb_cmdpool_free(vkb_cmdpool * p);
|
||||
vkb_cmdpool_free(dev->pools.vals[i]);
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < dev->templates.cap; i++)
|
||||
if (dev->templates.keys[i] && dev->templates.keys[i] != ~(uint64_t)0) free(dev->templates.vals[i]);
|
||||
vkb_map_destroy(&dev->memories);
|
||||
vkb_map_destroy(&dev->templates);
|
||||
vkb_map_destroy(&dev->pools);
|
||||
vkb_map_destroy(&dev->unshared);
|
||||
vkb_map_destroy(&dev->shared_images);
|
||||
for (uint32_t i = 0; i < dev->enabled_ext_count; i++) free((void *)dev->enabled_exts[i]);
|
||||
free(dev->enabled_exts);
|
||||
pthread_mutex_destroy(&dev->lock);
|
||||
free(dev);
|
||||
}
|
||||
|
||||
static void queue_set_info(VkQueue q, uint32_t family, uint32_t index)
|
||||
{
|
||||
if (!q) return;
|
||||
vkb_queue *vq = (vkb_queue *)q;
|
||||
vq->family = family;
|
||||
vq->index = index;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue)
|
||||
{
|
||||
vkb_wire_vkGetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue);
|
||||
queue_set_info(*pQueue, queueFamilyIndex, queueIndex);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue)
|
||||
{
|
||||
vkb_wire_vkGetDeviceQueue2(device, pQueueInfo, pQueue);
|
||||
queue_set_info(*pQueue, pQueueInfo->queueFamilyIndex, pQueueInfo->queueIndex);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ queues and sync */
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence)
|
||||
{
|
||||
return vkb_wire_vkQueueSubmit(queue, submitCount, pSubmits, fence);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkQueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2 *pSubmits, VkFence fence)
|
||||
{
|
||||
return vkb_wire_vkQueueSubmit2(queue, submitCount, pSubmits, fence);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkQueueWaitIdle(VkQueue queue)
|
||||
{
|
||||
return vkb_wire_vkQueueWaitIdle(queue);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkDeviceWaitIdle(VkDevice device)
|
||||
{
|
||||
return vkb_wire_vkDeviceWaitIdle(device);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll,
|
||||
uint64_t timeout)
|
||||
{
|
||||
return vkb_wire_vkWaitForFences(device, fenceCount, pFences, waitAll, timeout);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetFenceStatus(VkDevice device, VkFence fence)
|
||||
{
|
||||
return vkb_wire_vkGetFenceStatus(device, fence);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkWaitSemaphores(VkDevice device, const VkSemaphoreWaitInfo *pWaitInfo, uint64_t timeout)
|
||||
{
|
||||
return vkb_wire_vkWaitSemaphores(device, pWaitInfo, timeout);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetSemaphoreCounterValue(VkDevice device, VkSemaphore semaphore, uint64_t *pValue)
|
||||
{
|
||||
return vkb_wire_vkGetSemaphoreCounterValue(device, semaphore, pValue);
|
||||
}
|
||||
@@ -0,0 +1,433 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Device memory on the client side: the memory-type translation of physdev.c applied to every
|
||||
* allocation and requirement, and mapping of shared allocations (server_memory.c explains how
|
||||
* they are shared).
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "vkb_client.h"
|
||||
#include "gen/vkb_client_gen.h"
|
||||
#include "emu.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void vkb_memory_init_device(vkb_device *d)
|
||||
{
|
||||
(void)d;
|
||||
}
|
||||
|
||||
void vkb_memory_unmap_free(vkb_memory *m)
|
||||
{
|
||||
if (m->ptr) munmap(m->ptr, (size_t)m->size);
|
||||
free(m);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ resources */
|
||||
|
||||
/* Shallow copy of a pNext chain (known structures only), in one malloc'd block (*mem). */
|
||||
void *vkb_chain_clone(const void *pNext, void **mem)
|
||||
{
|
||||
size_t total = 0;
|
||||
for (const VkBaseInStructure *b = pNext; b; b = b->pNext) total += (vkb_struct_size(b->sType) + 15) & ~(size_t)15;
|
||||
uint8_t *block = calloc(1, total ? total : 16);
|
||||
*mem = block;
|
||||
VkBaseOutStructure *head = NULL, *prev = NULL;
|
||||
size_t off = 0;
|
||||
for (const VkBaseInStructure *b = pNext; b; b = b->pNext) {
|
||||
size_t sz = vkb_struct_size(b->sType);
|
||||
if (!sz) continue;
|
||||
VkBaseOutStructure *n = (VkBaseOutStructure *)(block + off);
|
||||
memcpy(n, b, sz);
|
||||
n->pNext = NULL;
|
||||
off += (sz + 15) & ~(size_t)15;
|
||||
if (prev) prev->pNext = n;
|
||||
else head = n;
|
||||
prev = n;
|
||||
}
|
||||
return head;
|
||||
}
|
||||
|
||||
static int can_share(vkb_device *dev)
|
||||
{
|
||||
return dev->pd->info.strategy != VKB_MEM_NONE && dev->pd->info.buffer_handle_types;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer)
|
||||
{
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
if (!can_share(dev) || (pCreateInfo->flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT)) {
|
||||
VkResult r = vkb_wire_vkCreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
|
||||
if (r == VK_SUCCESS) vkb_map_put(&dev->unshared, (uint64_t)*pBuffer, (void *)1);
|
||||
return r;
|
||||
}
|
||||
/* Every buffer may be bound to shared memory: say so at creation, as the spec requires. */
|
||||
VkBufferCreateInfo ci = *pCreateInfo;
|
||||
VkExternalMemoryBufferCreateInfo ext = {VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO, ci.pNext,
|
||||
dev->pd->info.buffer_handle_types};
|
||||
int had = 0;
|
||||
for (VkBaseOutStructure *b = (VkBaseOutStructure *)ci.pNext; b; b = b->pNext) {
|
||||
if (b->sType == VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO) had = 1;
|
||||
}
|
||||
VkResult r;
|
||||
if (had) {
|
||||
/* The app has its own external handle types: ours are added to a copy of its chain. */
|
||||
void *mem = NULL;
|
||||
ci.pNext = vkb_chain_clone(ci.pNext, &mem);
|
||||
for (VkBaseOutStructure *b = (VkBaseOutStructure *)ci.pNext; b; b = b->pNext)
|
||||
if (b->sType == VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO)
|
||||
((VkExternalMemoryBufferCreateInfo *)b)->handleTypes |= dev->pd->info.buffer_handle_types;
|
||||
r = vkb_wire_vkCreateBuffer(device, &ci, pAllocator, pBuffer);
|
||||
free(mem);
|
||||
if (r != VK_SUCCESS && r != VK_ERROR_OUT_OF_HOST_MEMORY && r != VK_ERROR_OUT_OF_DEVICE_MEMORY) {
|
||||
r = vkb_wire_vkCreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
|
||||
if (r == VK_SUCCESS) vkb_map_put(&dev->unshared, (uint64_t)*pBuffer, (void *)1);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
ci.pNext = &ext;
|
||||
r = vkb_wire_vkCreateBuffer(device, &ci, pAllocator, pBuffer);
|
||||
if (r != VK_SUCCESS && r != VK_ERROR_OUT_OF_HOST_MEMORY && r != VK_ERROR_OUT_OF_DEVICE_MEMORY) {
|
||||
VKB_ONCE(VKB_LOG_WARN, "a buffer cannot be created shareable (%d); it gets device-only memory (logged once)", r);
|
||||
r = vkb_wire_vkCreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
|
||||
if (r == VK_SUCCESS) vkb_map_put(&dev->unshared, (uint64_t)*pBuffer, (void *)1);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!buffer) return;
|
||||
vkb_map_remove(&vkb_dev(device)->unshared, (uint64_t)buffer);
|
||||
vkb_wire_vkDestroyBuffer(device, buffer, pAllocator);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkImage *pImage)
|
||||
{
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
VkImageCreateInfo ci = *pCreateInfo;
|
||||
vkb_emu_image_create_info(dev, &ci);
|
||||
/* Linear images may be mapped by the app: those get the shared handle type when allowed. */
|
||||
if (can_share(dev) && ci.tiling == VK_IMAGE_TILING_LINEAR && !(ci.flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT)) {
|
||||
int had = 0;
|
||||
for (VkBaseOutStructure *b = (VkBaseOutStructure *)ci.pNext; b; b = b->pNext)
|
||||
had |= b->sType == VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO;
|
||||
if (!had) {
|
||||
VkExternalMemoryImageCreateInfo ext = {VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO, ci.pNext,
|
||||
dev->pd->info.buffer_handle_types};
|
||||
VkImageCreateInfo c2 = ci;
|
||||
c2.pNext = &ext;
|
||||
VkResult r = vkb_wire_vkCreateImage(device, &c2, pAllocator, pImage);
|
||||
if (r == VK_SUCCESS) {
|
||||
vkb_map_put(&dev->shared_images, (uint64_t)*pImage, (void *)1);
|
||||
vkb_emu_image_created(dev, pCreateInfo, *pImage);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
}
|
||||
VkResult r = vkb_wire_vkCreateImage(device, &ci, pAllocator, pImage);
|
||||
if (r == VK_SUCCESS) vkb_emu_image_created(dev, pCreateInfo, *pImage);
|
||||
return r;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (!image) return;
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
vkb_map_remove(&dev->shared_images, (uint64_t)image);
|
||||
vkb_emu_image_destroyed(dev, image);
|
||||
vkb_wire_vkDestroyImage(device, image, pAllocator);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ requirements */
|
||||
|
||||
static void fix_reqs(vkb_device *dev, VkMemoryRequirements *r, int allow_shared)
|
||||
{
|
||||
r->memoryTypeBits = vkb_mem_bits_to_client(dev->pd, r->memoryTypeBits, allow_shared);
|
||||
}
|
||||
|
||||
static int buffer_shareable(vkb_device *dev, VkBuffer b)
|
||||
{
|
||||
return can_share(dev) && !vkb_map_get(&dev->unshared, (uint64_t)b);
|
||||
}
|
||||
|
||||
static int image_shareable(vkb_device *dev, VkImage i)
|
||||
{
|
||||
return vkb_map_get(&dev->shared_images, (uint64_t)i) != NULL;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements *pReq)
|
||||
{
|
||||
vkb_wire_vkGetBufferMemoryRequirements(device, buffer, pReq);
|
||||
fix_reqs(vkb_dev(device), pReq, buffer_shareable(vkb_dev(device), buffer));
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2 *pInfo,
|
||||
VkMemoryRequirements2 *pReq)
|
||||
{
|
||||
vkb_wire_vkGetBufferMemoryRequirements2(device, pInfo, pReq);
|
||||
fix_reqs(vkb_dev(device), &pReq->memoryRequirements, buffer_shareable(vkb_dev(device), pInfo->buffer));
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pReq)
|
||||
{
|
||||
vkb_wire_vkGetImageMemoryRequirements(device, image, pReq);
|
||||
fix_reqs(vkb_dev(device), pReq, image_shareable(vkb_dev(device), image));
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2 *pInfo,
|
||||
VkMemoryRequirements2 *pReq)
|
||||
{
|
||||
vkb_wire_vkGetImageMemoryRequirements2(device, pInfo, pReq);
|
||||
fix_reqs(vkb_dev(device), &pReq->memoryRequirements, image_shareable(vkb_dev(device), pInfo->image));
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetDeviceBufferMemoryRequirements(VkDevice device, const VkDeviceBufferMemoryRequirements *pInfo,
|
||||
VkMemoryRequirements2 *pReq)
|
||||
{
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
if (!can_share(dev)) {
|
||||
vkb_wire_vkGetDeviceBufferMemoryRequirements(device, pInfo, pReq);
|
||||
fix_reqs(dev, &pReq->memoryRequirements, 0);
|
||||
return;
|
||||
}
|
||||
VkBufferCreateInfo ci = *pInfo->pCreateInfo;
|
||||
VkExternalMemoryBufferCreateInfo ext = {VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO, ci.pNext,
|
||||
dev->pd->info.buffer_handle_types};
|
||||
int had = 0;
|
||||
for (VkBaseOutStructure *b = (VkBaseOutStructure *)ci.pNext; b; b = b->pNext)
|
||||
had |= b->sType == VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO;
|
||||
if (!had) ci.pNext = &ext;
|
||||
VkDeviceBufferMemoryRequirements info = *pInfo;
|
||||
info.pCreateInfo = &ci;
|
||||
vkb_wire_vkGetDeviceBufferMemoryRequirements(device, &info, pReq);
|
||||
fix_reqs(dev, &pReq->memoryRequirements, 1);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetDeviceImageMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements *pInfo,
|
||||
VkMemoryRequirements2 *pReq)
|
||||
{
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
VkImageCreateInfo ci = *pInfo->pCreateInfo;
|
||||
vkb_emu_image_create_info(dev, &ci);
|
||||
VkDeviceImageMemoryRequirements info = *pInfo;
|
||||
info.pCreateInfo = &ci;
|
||||
vkb_wire_vkGetDeviceImageMemoryRequirements(device, &info, pReq);
|
||||
fix_reqs(dev, &pReq->memoryRequirements, 0);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pCount,
|
||||
VkSparseImageMemoryRequirements *pReq)
|
||||
{
|
||||
vkb_wire_vkGetImageSparseMemoryRequirements(device, image, pCount, pReq);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2 *pInfo,
|
||||
uint32_t *pCount, VkSparseImageMemoryRequirements2 *pReq)
|
||||
{
|
||||
vkb_wire_vkGetImageSparseMemoryRequirements2(device, pInfo, pCount, pReq);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetDeviceImageSparseMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements *pInfo,
|
||||
uint32_t *pCount, VkSparseImageMemoryRequirements2 *pReq)
|
||||
{
|
||||
vkb_wire_vkGetDeviceImageSparseMemoryRequirements(device, pInfo, pCount, pReq);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetMemoryFdPropertiesKHR(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, int fd,
|
||||
VkMemoryFdPropertiesKHR *pProps)
|
||||
{
|
||||
VkResult r = vkb_wire_vkGetMemoryFdPropertiesKHR(device, handleType, fd, pProps);
|
||||
if (r == VK_SUCCESS) pProps->memoryTypeBits = vkb_mem_bits_to_client(vkb_dev(device)->pd, pProps->memoryTypeBits, 0);
|
||||
return r;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize offset)
|
||||
{
|
||||
return vkb_wire_vkBindBufferMemory(device, buffer, memory, offset);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkBindBufferMemory2(VkDevice device, uint32_t n, const VkBindBufferMemoryInfo *p)
|
||||
{
|
||||
return vkb_wire_vkBindBufferMemory2(device, n, p);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize offset)
|
||||
{
|
||||
return vkb_wire_vkBindImageMemory(device, image, memory, offset);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkBindImageMemory2(VkDevice device, uint32_t n, const VkBindImageMemoryInfo *p)
|
||||
{
|
||||
return vkb_wire_vkBindImageMemory2(device, n, p);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource,
|
||||
VkSubresourceLayout *pLayout)
|
||||
{
|
||||
vkb_wire_vkGetImageSubresourceLayout(device, image, pSubresource, pLayout);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ allocation and mapping */
|
||||
|
||||
static void close_import_fds(const void *pNext)
|
||||
{
|
||||
for (const VkBaseInStructure *b = pNext; b; b = b->pNext) {
|
||||
if (b->sType == VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR) {
|
||||
int fd = ((const VkImportMemoryFdInfoKHR *)b)->fd;
|
||||
if (fd >= 0) close(fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory)
|
||||
{
|
||||
(void)pAllocator;
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
vkb_physdev *pd = dev->pd;
|
||||
uint32_t ct = pAllocateInfo->memoryTypeIndex;
|
||||
if (ct >= pd->client_mem.memoryTypeCount) return VK_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
VkMemoryAllocateInfo ai = *pAllocateInfo;
|
||||
ai.memoryTypeIndex = pd->type_map[ct].server_type;
|
||||
int shared = pd->type_map[ct].shared;
|
||||
/* An app-imported dma-buf/opaque fd keeps its own memory; it is not one of our shared pages. */
|
||||
for (const VkBaseInStructure *b = ai.pNext; b; b = b->pNext)
|
||||
if (b->sType == VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR) shared = 0;
|
||||
uint32_t strategy = pd->info.strategy;
|
||||
int memfd = -1;
|
||||
void *ptr = NULL;
|
||||
if (shared && strategy == VKB_MEM_HOSTPTR) {
|
||||
VkDeviceSize a = pd->info.import_alignment ? pd->info.import_alignment : 4096;
|
||||
ai.allocationSize = (ai.allocationSize + a - 1) & ~(a - 1);
|
||||
memfd = vkb_memfd("vkbridge-memory", (size_t)ai.allocationSize);
|
||||
if (memfd < 0) return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
ptr = mmap(NULL, (size_t)ai.allocationSize, PROT_READ | PROT_WRITE, MAP_SHARED, memfd, 0);
|
||||
if (ptr == MAP_FAILED) {
|
||||
close(memfd);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
}
|
||||
vkb_call c;
|
||||
vkb_call_begin(&c, VKB_CMD_vkAllocateMemory, dev->obj.table);
|
||||
vkb_enc_u64(&c.e, dev->obj.remote);
|
||||
vkb_enc_u8(&c.e, 1);
|
||||
vkb_enc_VkMemoryAllocateInfo(&c.e, &ai);
|
||||
vkb_enc_u32(&c.e, shared ? VKB_ALLOC_SHARED : VKB_ALLOC_PLAIN);
|
||||
vkb_enc_fd(&c.e, memfd);
|
||||
int ok = vkb_call_exec(&c);
|
||||
if (memfd >= 0) close(memfd);
|
||||
if (!ok) {
|
||||
if (ptr) munmap(ptr, (size_t)ai.allocationSize);
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
}
|
||||
VkResult r = (VkResult)vkb_dec_u32(&c.d);
|
||||
VkDeviceMemory mem = (VkDeviceMemory)vkb_dec_u64(&c.d);
|
||||
int fd = vkb_dec_fd(&c.d);
|
||||
uint64_t size = vkb_dec_u64(&c.d);
|
||||
vkb_call_end(&c);
|
||||
if (r != VK_SUCCESS) {
|
||||
if (ptr) munmap(ptr, (size_t)ai.allocationSize);
|
||||
if (fd >= 0) close(fd);
|
||||
return r;
|
||||
}
|
||||
/* The import succeeded: the fd the app handed over now belongs to the implementation, and the
|
||||
* server holds its own copy. */
|
||||
close_import_fds(pAllocateInfo->pNext);
|
||||
vkb_memory *m = calloc(1, sizeof(*m));
|
||||
m->client_type = ct;
|
||||
m->shared = shared;
|
||||
m->size = shared && strategy == VKB_MEM_HOSTPTR ? ai.allocationSize : size;
|
||||
if (shared && strategy != VKB_MEM_HOSTPTR) {
|
||||
if (fd < 0) {
|
||||
VKB_ERR("shared allocation came back without its dma-buf");
|
||||
} else {
|
||||
ptr = mmap(NULL, (size_t)m->size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (ptr == MAP_FAILED) {
|
||||
VKB_ERR("cannot map shared memory (%llu bytes): %s", (unsigned long long)m->size, strerror(errno));
|
||||
ptr = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fd >= 0) close(fd);
|
||||
m->ptr = ptr;
|
||||
vkb_map_put(&dev->memories, (uint64_t)mem, m);
|
||||
*pMemory = mem;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
(void)pAllocator;
|
||||
if (!memory) return;
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
vkb_memory *m = vkb_map_remove(&dev->memories, (uint64_t)memory);
|
||||
vkb_call c;
|
||||
vkb_call_begin(&c, VKB_CMD_vkFreeMemory, dev->obj.table);
|
||||
vkb_enc_u64(&c.e, dev->obj.remote);
|
||||
vkb_enc_u64(&c.e, (uint64_t)memory);
|
||||
if (vkb_call_exec(&c)) vkb_call_end(&c);
|
||||
if (m) vkb_memory_unmap_free(m);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size,
|
||||
VkMemoryMapFlags flags, void **ppData)
|
||||
{
|
||||
(void)size;
|
||||
(void)flags;
|
||||
vkb_memory *m = vkb_map_get(&vkb_dev(device)->memories, (uint64_t)memory);
|
||||
if (!m || !m->ptr) {
|
||||
VKB_ONCE(VKB_LOG_WARN, "vkMapMemory on memory that is not host-visible through the bridge (logged once)");
|
||||
*ppData = NULL;
|
||||
return VK_ERROR_MEMORY_MAP_FAILED;
|
||||
}
|
||||
*ppData = (uint8_t *)m->ptr + offset;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkUnmapMemory(VkDevice device, VkDeviceMemory memory)
|
||||
{
|
||||
/* The mapping stays until vkFreeMemory: mapping again is free, and nothing else reuses it. */
|
||||
(void)device;
|
||||
(void)memory;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkMapMemory2KHR(VkDevice device, const VkMemoryMapInfoKHR *pInfo, void **ppData)
|
||||
{
|
||||
return vkb_ep_vkMapMemory(device, pInfo->memory, pInfo->offset, pInfo->size, pInfo->flags, ppData);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkUnmapMemory2KHR(VkDevice device, const VkMemoryUnmapInfoKHR *pInfo)
|
||||
{
|
||||
(void)device;
|
||||
(void)pInfo;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult ranges_call(VkDevice device, uint32_t cmd, uint32_t n, const VkMappedMemoryRange *r)
|
||||
{
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
vkb_call c;
|
||||
vkb_call_begin(&c, cmd, dev->obj.table);
|
||||
vkb_enc_u64(&c.e, dev->obj.remote);
|
||||
vkb_enc_u32(&c.e, n);
|
||||
for (uint32_t i = 0; i < n; i++) vkb_enc_VkMappedMemoryRange(&c.e, &r[i]);
|
||||
if (!vkb_call_exec(&c)) return VK_ERROR_DEVICE_LOST;
|
||||
VkResult res = (VkResult)vkb_dec_u32(&c.d);
|
||||
vkb_call_end(&c);
|
||||
return res;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkFlushMappedMemoryRanges(VkDevice device, uint32_t n, const VkMappedMemoryRange *r)
|
||||
{
|
||||
return ranges_call(device, VKB_CMD_vkFlushMappedMemoryRanges, n, r);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t n, const VkMappedMemoryRange *r)
|
||||
{
|
||||
return ranges_call(device, VKB_CMD_vkInvalidateMappedMemoryRanges, n, r);
|
||||
}
|
||||
@@ -0,0 +1,367 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Physical device queries: what the app sees is the server's GPU, with the bridge's memory
|
||||
* model, its extension list and the features the server emulates.
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "vkb_client.h"
|
||||
#include "gen/vkb_client_gen.h"
|
||||
#include "emu.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
const char *const *vkb_client_device_exts(uint32_t *n);
|
||||
|
||||
/* ------------------------------------------------------------------ memory model */
|
||||
|
||||
/*
|
||||
* Images and GPU-only buffers live in memory the client never maps; host-visible memory must be
|
||||
* shared pages (server_memory.c), which only buffers (and the rare linear image) can use. So the
|
||||
* app gets a discrete-GPU-like view: device-local types without host access, and host-visible
|
||||
* types (shared) that only resources able to use them list in their memoryTypeBits.
|
||||
*/
|
||||
static void build_memory_model(vkb_physdev *pd)
|
||||
{
|
||||
const VkPhysicalDeviceMemoryProperties *s = &pd->server_mem;
|
||||
VkPhysicalDeviceMemoryProperties *c = &pd->client_mem;
|
||||
memset(c, 0, sizeof(*c));
|
||||
uint32_t share = pd->info.strategy != VKB_MEM_NONE ? pd->info.shareable_types : 0;
|
||||
int pure_dl = -1;
|
||||
for (uint32_t t = 0; t < s->memoryTypeCount; t++) {
|
||||
VkMemoryPropertyFlags f = s->memoryTypes[t].propertyFlags;
|
||||
if ((f & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) && !(f & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) &&
|
||||
!(f & VK_MEMORY_PROPERTY_PROTECTED_BIT)) {
|
||||
pure_dl = (int)t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int uma = pure_dl < 0;
|
||||
/* Heaps: the server's, plus (UMA) a host heap for shared types so they are not "device local". */
|
||||
for (uint32_t h = 0; h < s->memoryHeapCount; h++) {
|
||||
c->memoryHeaps[h] = s->memoryHeaps[h];
|
||||
pd->heap_map[h] = h;
|
||||
}
|
||||
c->memoryHeapCount = s->memoryHeapCount;
|
||||
uint32_t host_heap = UINT32_MAX;
|
||||
|
||||
struct cand {
|
||||
VkMemoryPropertyFlags flags;
|
||||
uint32_t heap, server;
|
||||
uint8_t shared;
|
||||
} cands[VK_MAX_MEMORY_TYPES * 2];
|
||||
uint32_t nc = 0;
|
||||
if (uma) {
|
||||
/* A device-local type with no host access, backed by the first device-local type. */
|
||||
for (uint32_t t = 0; t < s->memoryTypeCount; t++) {
|
||||
VkMemoryPropertyFlags f = s->memoryTypes[t].propertyFlags;
|
||||
if ((f & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) && !(f & VK_MEMORY_PROPERTY_PROTECTED_BIT)) {
|
||||
cands[nc++] = (struct cand){VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, s->memoryTypes[t].heapIndex, t, 0};
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (uint32_t t = 0; t < s->memoryTypeCount && nc < VK_MAX_MEMORY_TYPES; t++) {
|
||||
VkMemoryPropertyFlags f = s->memoryTypes[t].propertyFlags;
|
||||
uint32_t heap = s->memoryTypes[t].heapIndex;
|
||||
if (!(f & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) {
|
||||
cands[nc++] = (struct cand){f, heap, t, 0};
|
||||
continue;
|
||||
}
|
||||
if (!(share & (1u << t))) continue; /* host-visible but not shareable: not offered */
|
||||
VkMemoryPropertyFlags cf = f;
|
||||
if (!(pd->info.coherent_types & (1u << t))) cf &= ~VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
|
||||
if (uma) {
|
||||
cf &= ~VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
|
||||
if (host_heap == UINT32_MAX && c->memoryHeapCount < VK_MAX_MEMORY_HEAPS) {
|
||||
host_heap = c->memoryHeapCount++;
|
||||
c->memoryHeaps[host_heap] = s->memoryHeaps[heap];
|
||||
c->memoryHeaps[host_heap].flags &= ~VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
|
||||
pd->heap_map[host_heap] = heap;
|
||||
}
|
||||
if (host_heap != UINT32_MAX) heap = host_heap;
|
||||
}
|
||||
/* Two client types with identical flags on one heap are pointless: keep the first. */
|
||||
int dup = 0;
|
||||
for (uint32_t i = 0; i < nc; i++) dup |= cands[i].flags == cf && cands[i].heap == heap;
|
||||
if (!dup) cands[nc++] = (struct cand){cf, heap, t, 1};
|
||||
}
|
||||
/* Order: fewer property bits first, which satisfies the spec's subset ordering. */
|
||||
for (uint32_t i = 1; i < nc; i++) {
|
||||
struct cand x = cands[i];
|
||||
uint32_t j = i;
|
||||
while (j > 0 && __builtin_popcount(cands[j - 1].flags) > __builtin_popcount(x.flags)) {
|
||||
cands[j] = cands[j - 1];
|
||||
j--;
|
||||
}
|
||||
cands[j] = x;
|
||||
}
|
||||
if (nc > VK_MAX_MEMORY_TYPES) nc = VK_MAX_MEMORY_TYPES;
|
||||
c->memoryTypeCount = nc;
|
||||
for (uint32_t i = 0; i < nc; i++) {
|
||||
c->memoryTypes[i].propertyFlags = cands[i].flags;
|
||||
c->memoryTypes[i].heapIndex = cands[i].heap;
|
||||
pd->type_map[i].server_type = cands[i].server;
|
||||
pd->type_map[i].shared = cands[i].shared;
|
||||
}
|
||||
for (uint32_t i = 0; i < nc; i++)
|
||||
VKB_DBG("memory type %u: flags 0x%x heap %u -> server type %u%s", i, c->memoryTypes[i].propertyFlags,
|
||||
c->memoryTypes[i].heapIndex, pd->type_map[i].server_type, pd->type_map[i].shared ? " (shared)" : "");
|
||||
}
|
||||
|
||||
uint32_t vkb_mem_bits_to_client(vkb_physdev *pd, uint32_t server_bits, int allow_shared)
|
||||
{
|
||||
uint32_t bits = 0;
|
||||
for (uint32_t i = 0; i < pd->client_mem.memoryTypeCount; i++) {
|
||||
if (!(server_bits & (1u << pd->type_map[i].server_type))) continue;
|
||||
if (pd->type_map[i].shared && !allow_shared) continue;
|
||||
bits |= 1u << i;
|
||||
}
|
||||
return bits;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ setup */
|
||||
|
||||
static int bridged_device_ext(const char *name)
|
||||
{
|
||||
for (int i = 0; i < VKB_EXT_COUNT; i++)
|
||||
if (vkb_exts[i].device && !vkb_exts[i].client && !strcmp(vkb_exts[i].name, name)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vkb_physdev_ready(vkb_physdev *pd)
|
||||
{
|
||||
if (pd->ready) return pd->ready > 0;
|
||||
pthread_mutex_lock(&pd->lock);
|
||||
if (pd->ready) {
|
||||
pthread_mutex_unlock(&pd->lock);
|
||||
return pd->ready > 0;
|
||||
}
|
||||
vkb_call c;
|
||||
vkb_call_begin(&c, VKB_CMD_vkbQueryServer, pd->obj.table);
|
||||
vkb_enc_u64(&c.e, pd->obj.remote);
|
||||
if (!vkb_call_exec(&c)) {
|
||||
pd->ready = -1;
|
||||
pthread_mutex_unlock(&pd->lock);
|
||||
return 0;
|
||||
}
|
||||
vkb_dec_raw_into(&c.d, &pd->info, sizeof(pd->info));
|
||||
vkb_call_end(&c);
|
||||
vkb_wire_vkGetPhysicalDeviceProperties((VkPhysicalDevice)pd, &pd->props);
|
||||
vkb_wire_vkGetPhysicalDeviceMemoryProperties((VkPhysicalDevice)pd, &pd->server_mem);
|
||||
build_memory_model(pd);
|
||||
|
||||
uint32_t n = 0;
|
||||
vkb_wire_vkEnumerateDeviceExtensionProperties((VkPhysicalDevice)pd, NULL, &n, NULL);
|
||||
VkExtensionProperties *srv = calloc(n + 1, sizeof(*srv));
|
||||
vkb_wire_vkEnumerateDeviceExtensionProperties((VkPhysicalDevice)pd, NULL, &n, srv);
|
||||
uint32_t ncl = 0;
|
||||
const char *const *cl = vkb_client_device_exts(&ncl);
|
||||
uint32_t nemu = 0;
|
||||
const VkExtensionProperties *emu = vkb_emu_extensions(pd, &nemu);
|
||||
pd->exts = calloc(n + ncl + nemu + 1, sizeof(VkExtensionProperties));
|
||||
pd->next = 0;
|
||||
for (uint32_t i = 0; i < n; i++)
|
||||
if (bridged_device_ext(srv[i].extensionName)) pd->exts[pd->next++] = srv[i];
|
||||
for (uint32_t i = 0; i < nemu; i++) {
|
||||
int dup = 0;
|
||||
for (uint32_t j = 0; j < pd->next; j++) dup |= !strcmp(pd->exts[j].extensionName, emu[i].extensionName);
|
||||
if (!dup) pd->exts[pd->next++] = emu[i];
|
||||
}
|
||||
for (uint32_t i = 0; i < ncl; i++) {
|
||||
VkExtensionProperties *e = &pd->exts[pd->next++];
|
||||
snprintf(e->extensionName, sizeof(e->extensionName), "%s", cl[i]);
|
||||
e->specVersion = !strcmp(cl[i], "VK_KHR_swapchain") ? 70 : !strcmp(cl[i], "VK_KHR_incremental_present") ? 2 : 1;
|
||||
}
|
||||
free(srv);
|
||||
VKB_INFO("%s: %u extensions offered, memory sharing %s, emulation 0x%x", pd->props.deviceName, pd->next,
|
||||
vkb_mem_strategy_name(pd->info.strategy), pd->info.emu);
|
||||
pd->ready = 1;
|
||||
pthread_mutex_unlock(&pd->lock);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ properties */
|
||||
|
||||
static void patch_props(vkb_physdev *pd, VkPhysicalDeviceProperties *p)
|
||||
{
|
||||
if (p->apiVersion > VKB_API_VERSION) p->apiVersion = VKB_API_VERSION;
|
||||
(void)pd;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties)
|
||||
{
|
||||
vkb_physdev *pd = vkb_pd(physicalDevice);
|
||||
if (vkb_physdev_ready(pd)) *pProperties = pd->props;
|
||||
else vkb_wire_vkGetPhysicalDeviceProperties(physicalDevice, pProperties);
|
||||
patch_props(pd, pProperties);
|
||||
vkb_emu_patch_limits(pd, pProperties);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties)
|
||||
{
|
||||
vkb_physdev *pd = vkb_pd(physicalDevice);
|
||||
vkb_wire_vkGetPhysicalDeviceProperties2(physicalDevice, pProperties);
|
||||
patch_props(pd, &pProperties->properties);
|
||||
vkb_emu_patch_limits(pd, &pProperties->properties);
|
||||
for (VkBaseOutStructure *b = (VkBaseOutStructure *)pProperties->pNext; b; b = b->pNext) {
|
||||
if (b->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES) {
|
||||
VkPhysicalDeviceDriverProperties *d = (VkPhysicalDeviceDriverProperties *)b;
|
||||
size_t l = strlen(d->driverInfo);
|
||||
if (l + 12 < sizeof(d->driverInfo)) strcat(d->driverInfo, " (vkbridge)");
|
||||
}
|
||||
vkb_emu_patch_properties_chain(pd, b);
|
||||
}
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures)
|
||||
{
|
||||
vkb_wire_vkGetPhysicalDeviceFeatures(physicalDevice, pFeatures);
|
||||
vkb_emu_patch_features(vkb_pd(physicalDevice), pFeatures);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 *pFeatures)
|
||||
{
|
||||
vkb_wire_vkGetPhysicalDeviceFeatures2(physicalDevice, pFeatures);
|
||||
vkb_emu_patch_features(vkb_pd(physicalDevice), &pFeatures->features);
|
||||
for (VkBaseOutStructure *b = (VkBaseOutStructure *)pFeatures->pNext; b; b = b->pNext)
|
||||
vkb_emu_patch_features_chain(vkb_pd(physicalDevice), b);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceMemoryProperties *pMemoryProperties)
|
||||
{
|
||||
vkb_physdev *pd = vkb_pd(physicalDevice);
|
||||
if (!vkb_physdev_ready(pd)) {
|
||||
memset(pMemoryProperties, 0, sizeof(*pMemoryProperties));
|
||||
return;
|
||||
}
|
||||
*pMemoryProperties = pd->client_mem;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceMemoryProperties2 *pMemoryProperties)
|
||||
{
|
||||
vkb_physdev *pd = vkb_pd(physicalDevice);
|
||||
VkPhysicalDeviceMemoryBudgetPropertiesEXT *budget = NULL;
|
||||
for (VkBaseOutStructure *b = (VkBaseOutStructure *)pMemoryProperties->pNext; b; b = b->pNext)
|
||||
if (b->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT) budget = (void *)b;
|
||||
vkb_wire_vkGetPhysicalDeviceMemoryProperties2(physicalDevice, pMemoryProperties);
|
||||
if (!vkb_physdev_ready(pd)) return;
|
||||
pMemoryProperties->memoryProperties = pd->client_mem;
|
||||
if (budget) {
|
||||
VkDeviceSize b[VK_MAX_MEMORY_HEAPS], u[VK_MAX_MEMORY_HEAPS];
|
||||
memcpy(b, budget->heapBudget, sizeof(b));
|
||||
memcpy(u, budget->heapUsage, sizeof(u));
|
||||
memset(budget->heapBudget, 0, sizeof(budget->heapBudget));
|
||||
memset(budget->heapUsage, 0, sizeof(budget->heapUsage));
|
||||
for (uint32_t h = 0; h < pd->client_mem.memoryHeapCount; h++) {
|
||||
budget->heapBudget[h] = b[pd->heap_map[h]];
|
||||
budget->heapUsage[h] = u[pd->heap_map[h]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount,
|
||||
VkQueueFamilyProperties *pProps)
|
||||
{
|
||||
vkb_wire_vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pCount, pProps);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t *pCount,
|
||||
VkQueueFamilyProperties2 *pProps)
|
||||
{
|
||||
vkb_wire_vkGetPhysicalDeviceQueueFamilyProperties2(physicalDevice, pCount, pProps);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format,
|
||||
VkFormatProperties *pFormatProperties)
|
||||
{
|
||||
if (vkb_emu_format_properties(vkb_pd(physicalDevice), format, pFormatProperties, NULL)) return;
|
||||
vkb_wire_vkGetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format,
|
||||
VkFormatProperties2 *pFormatProperties)
|
||||
{
|
||||
if (vkb_emu_format_properties(vkb_pd(physicalDevice), format, &pFormatProperties->formatProperties, pFormatProperties)) return;
|
||||
vkb_wire_vkGetPhysicalDeviceFormatProperties2(physicalDevice, format, pFormatProperties);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format,
|
||||
VkImageType type, VkImageTiling tiling,
|
||||
VkImageUsageFlags usage, VkImageCreateFlags flags,
|
||||
VkImageFormatProperties *pProps)
|
||||
{
|
||||
VkFormat real = vkb_emu_real_format(vkb_pd(physicalDevice), format, &usage, &flags);
|
||||
return vkb_wire_vkGetPhysicalDeviceImageFormatProperties(physicalDevice, real, type, tiling, usage, flags, pProps);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceImageFormatInfo2 *pInfo,
|
||||
VkImageFormatProperties2 *pProps)
|
||||
{
|
||||
VkPhysicalDeviceImageFormatInfo2 info = *pInfo;
|
||||
info.format = vkb_emu_real_format(vkb_pd(physicalDevice), pInfo->format, &info.usage, &info.flags);
|
||||
return vkb_wire_vkGetPhysicalDeviceImageFormatProperties2(physicalDevice, &info, pProps);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format,
|
||||
VkImageType type, VkSampleCountFlagBits samples,
|
||||
VkImageUsageFlags usage, VkImageTiling tiling,
|
||||
uint32_t *pCount, VkSparseImageFormatProperties *pProps)
|
||||
{
|
||||
if (vkb_emu_is_emulated_format(vkb_pd(physicalDevice), format)) {
|
||||
*pCount = 0;
|
||||
return;
|
||||
}
|
||||
vkb_wire_vkGetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pCount, pProps);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceSparseImageFormatInfo2 *pInfo,
|
||||
uint32_t *pCount, VkSparseImageFormatProperties2 *pProps)
|
||||
{
|
||||
if (vkb_emu_is_emulated_format(vkb_pd(physicalDevice), pInfo->format)) {
|
||||
*pCount = 0;
|
||||
return;
|
||||
}
|
||||
vkb_wire_vkGetPhysicalDeviceSparseImageFormatProperties2(physicalDevice, pInfo, pCount, pProps);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice, uint32_t *pToolCount,
|
||||
VkPhysicalDeviceToolProperties *pToolProperties)
|
||||
{
|
||||
(void)physicalDevice;
|
||||
(void)pToolProperties;
|
||||
*pToolCount = 0;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceExternalBufferInfo *pInfo,
|
||||
VkExternalBufferProperties *pProps)
|
||||
{
|
||||
vkb_wire_vkGetPhysicalDeviceExternalBufferProperties(physicalDevice, pInfo, pProps);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceExternalSemaphoreInfo *pInfo,
|
||||
VkExternalSemaphoreProperties *pProps)
|
||||
{
|
||||
vkb_wire_vkGetPhysicalDeviceExternalSemaphoreProperties(physicalDevice, pInfo, pProps);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceExternalFenceInfo *pInfo,
|
||||
VkExternalFenceProperties *pProps)
|
||||
{
|
||||
vkb_wire_vkGetPhysicalDeviceExternalFenceProperties(physicalDevice, pInfo, pProps);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceMultisamplePropertiesEXT(VkPhysicalDevice physicalDevice,
|
||||
VkSampleCountFlagBits samples,
|
||||
VkMultisamplePropertiesEXT *pProps)
|
||||
{
|
||||
vkb_wire_vkGetPhysicalDeviceMultisamplePropertiesEXT(physicalDevice, samples, pProps);
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* DroidDeck Vulkan bridge - client ICD (libvulkan_droidbridge.so, glibc).
|
||||
*
|
||||
* A Vulkan driver for the Vulkan loader inside the Linux session. It owns no GPU: every call is
|
||||
* encoded and executed by the server (app/src/main/cpp/vkbridge) on the device's real driver.
|
||||
* Command buffers are recorded locally and shipped at vkEndCommandBuffer; mapped memory is
|
||||
* shared pages (see server_memory.c); presentation (WSI) is implemented here.
|
||||
*/
|
||||
#ifndef VKB_CLIENT_H
|
||||
#define VKB_CLIENT_H
|
||||
|
||||
#define VK_USE_PLATFORM_WAYLAND_KHR 1
|
||||
#define VK_USE_PLATFORM_XCB_KHR 1
|
||||
#define VK_USE_PLATFORM_XLIB_KHR 1
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "vkb_wire.h"
|
||||
#include "vkb_proto.h"
|
||||
#include "vkb_log.h"
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <vulkan/vk_icd.h>
|
||||
|
||||
#define VKB_EXPORT __attribute__((visibility("default")))
|
||||
#define VKB_API_VERSION VK_MAKE_API_VERSION(0, 1, 3, VK_HEADER_VERSION)
|
||||
|
||||
/* ------------------------------------------------------------------ small hash map (u64 -> ptr) */
|
||||
typedef struct vkb_map {
|
||||
uint64_t *keys;
|
||||
void **vals;
|
||||
uint32_t cap, count;
|
||||
pthread_mutex_t lock;
|
||||
} vkb_map;
|
||||
void vkb_map_init(vkb_map *m);
|
||||
void vkb_map_destroy(vkb_map *m);
|
||||
void vkb_map_put(vkb_map *m, uint64_t k, void *v);
|
||||
void *vkb_map_get(vkb_map *m, uint64_t k);
|
||||
void *vkb_map_remove(vkb_map *m, uint64_t k);
|
||||
|
||||
/* ------------------------------------------------------------------ dispatchable objects */
|
||||
typedef struct vkb_object {
|
||||
VK_LOADER_DATA loader; /* must be first: the loader keeps its dispatch pointer here */
|
||||
VkObjectType type;
|
||||
uint64_t remote; /* the server's handle */
|
||||
uint32_t table; /* the server's dispatch table for calls on this object */
|
||||
} vkb_object;
|
||||
|
||||
typedef struct vkb_mem_type_map {
|
||||
uint32_t server_type;
|
||||
uint8_t shared;
|
||||
} vkb_mem_type_map;
|
||||
|
||||
struct vkb_instance;
|
||||
|
||||
typedef struct vkb_physdev {
|
||||
vkb_object obj;
|
||||
struct vkb_instance *instance;
|
||||
vkb_server_pd_info info;
|
||||
VkPhysicalDeviceProperties props;
|
||||
VkPhysicalDeviceMemoryProperties server_mem;
|
||||
VkPhysicalDeviceMemoryProperties client_mem; /* what the app sees */
|
||||
vkb_mem_type_map type_map[VK_MAX_MEMORY_TYPES];
|
||||
uint32_t heap_map[VK_MAX_MEMORY_HEAPS]; /* client heap -> server heap */
|
||||
VkExtensionProperties *exts; /* filtered device extensions */
|
||||
uint32_t next;
|
||||
int ready;
|
||||
pthread_mutex_t lock;
|
||||
struct vkb_physdev *list_next;
|
||||
} vkb_physdev;
|
||||
|
||||
typedef struct vkb_instance {
|
||||
vkb_object obj;
|
||||
uint32_t api_version;
|
||||
vkb_physdev *pds;
|
||||
pthread_mutex_t lock;
|
||||
uint8_t ext_surface, ext_wayland, ext_xcb, ext_xlib, ext_headless, ext_surface_caps2, ext_debug_utils;
|
||||
} vkb_instance;
|
||||
|
||||
struct vkb_queue;
|
||||
|
||||
typedef struct vkb_device {
|
||||
vkb_object obj;
|
||||
vkb_physdev *pd;
|
||||
vkb_instance *instance;
|
||||
struct vkb_queue *queues;
|
||||
pthread_mutex_t lock;
|
||||
vkb_map memories; /* VkDeviceMemory -> vkb_memory* */
|
||||
vkb_map templates; /* VkDescriptorUpdateTemplate -> vkb_template* */
|
||||
vkb_map pools; /* VkCommandPool -> vkb_cmdpool* */
|
||||
vkb_map unshared; /* VkBuffer/VkImage that cannot live in shared memory -> (void*)1 */
|
||||
vkb_map shared_images; /* VkImage that may live in shared memory -> (void*)1 */
|
||||
const char **enabled_exts;
|
||||
uint32_t enabled_ext_count;
|
||||
uint8_t ext_swapchain;
|
||||
} vkb_device;
|
||||
|
||||
typedef struct vkb_queue {
|
||||
vkb_object obj;
|
||||
vkb_device *device;
|
||||
uint32_t family, index, flags;
|
||||
struct vkb_queue *next;
|
||||
} vkb_queue;
|
||||
|
||||
typedef struct vkb_cmdbuf {
|
||||
vkb_object obj;
|
||||
vkb_device *device;
|
||||
VkCommandPool pool;
|
||||
VkCommandBufferLevel level;
|
||||
vkb_enc stream;
|
||||
size_t entry; /* offset of the open entry's payload */
|
||||
int recording;
|
||||
int broken;
|
||||
struct vkb_cmdbuf *pool_next, *pool_prev;
|
||||
} vkb_cmdbuf;
|
||||
|
||||
typedef struct vkb_cmdpool {
|
||||
vkb_cmdbuf *head;
|
||||
} vkb_cmdpool;
|
||||
|
||||
typedef struct vkb_memory {
|
||||
void *ptr; /* client mapping (shared allocations) */
|
||||
VkDeviceSize size;
|
||||
uint32_t client_type;
|
||||
int shared;
|
||||
} vkb_memory;
|
||||
|
||||
static inline vkb_device *vkb_dev(VkDevice d) { return (vkb_device *)d; }
|
||||
static inline vkb_physdev *vkb_pd(VkPhysicalDevice p) { return (vkb_physdev *)p; }
|
||||
static inline vkb_instance *vkb_inst(VkInstance i) { return (vkb_instance *)i; }
|
||||
static inline vkb_cmdbuf *vkb_cb(VkCommandBuffer c) { return (vkb_cmdbuf *)c; }
|
||||
|
||||
/* ------------------------------------------------------------------ calls */
|
||||
typedef struct vkb_call {
|
||||
vkb_enc e;
|
||||
vkb_dec d;
|
||||
uint32_t cmd, table, flags;
|
||||
struct vkb_conn *conn;
|
||||
} vkb_call;
|
||||
|
||||
void vkb_call_begin(vkb_call *c, uint32_t cmd, uint32_t table);
|
||||
/* Sends the request and waits for the reply. 0 = failed (the call is already released). */
|
||||
int vkb_call_exec(vkb_call *c);
|
||||
void vkb_call_end(vkb_call *c);
|
||||
uint32_t vkb_table_of(const void *dispatchable);
|
||||
int vkb_connected(void);
|
||||
/* Per-thread transport cleanup for fork children. */
|
||||
void vkb_conn_after_fork(void);
|
||||
|
||||
/* Command streams (cmdbuf.c). */
|
||||
vkb_enc *vkb_cmd_record_begin(VkCommandBuffer cb, uint32_t cmd);
|
||||
void vkb_cmd_record_end(VkCommandBuffer cb);
|
||||
|
||||
/* Dispatchable objects created by the server (generated stubs call this). */
|
||||
void *vkb_wrap(VkObjectType type, const void *parent, uint64_t remote);
|
||||
|
||||
/* physdev.c */
|
||||
int vkb_physdev_ready(vkb_physdev *pd);
|
||||
uint32_t vkb_mem_bits_to_client(vkb_physdev *pd, uint32_t server_bits, int allow_shared);
|
||||
|
||||
/* memory.c */
|
||||
void vkb_memory_init_device(vkb_device *d);
|
||||
|
||||
/* icd.c */
|
||||
PFN_vkVoidFunction vkb_lookup_proc(const char *name, int level_max, vkb_device *dev, vkb_instance *inst);
|
||||
int vkb_device_ext_enabled(const vkb_device *d, const char *name);
|
||||
|
||||
/* memory.c */
|
||||
void *vkb_chain_clone(const void *pNext, void **mem);
|
||||
int vkb_is_client_device_ext(const char *n);
|
||||
|
||||
/* misc */
|
||||
int vkb_memfd(const char *name, size_t size);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,756 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Surfaces and swapchains (backend-independent part).
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "wsi.h"
|
||||
#include "gen/vkb_client_gen.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
const VkSurfaceFormatKHR vkb_wsi_formats[] = {
|
||||
{VK_FORMAT_B8G8R8A8_SRGB, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR},
|
||||
{VK_FORMAT_B8G8R8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR},
|
||||
{VK_FORMAT_R8G8B8A8_SRGB, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR},
|
||||
{VK_FORMAT_R8G8B8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR},
|
||||
};
|
||||
const uint32_t vkb_wsi_format_count = sizeof(vkb_wsi_formats) / sizeof(vkb_wsi_formats[0]);
|
||||
|
||||
#define FOURCC(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
|
||||
|
||||
uint32_t vkb_drm_format(VkFormat f)
|
||||
{
|
||||
switch (f) {
|
||||
case VK_FORMAT_B8G8R8A8_SRGB:
|
||||
case VK_FORMAT_B8G8R8A8_UNORM: return FOURCC('A', 'R', '2', '4');
|
||||
case VK_FORMAT_R8G8B8A8_SRGB:
|
||||
case VK_FORMAT_R8G8B8A8_UNORM: return FOURCC('A', 'B', '2', '4');
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static vkb_surface *surf(VkSurfaceKHR s) { return (vkb_surface *)(uintptr_t)s; }
|
||||
static vkb_swapchain *chain(VkSwapchainKHR s) { return (vkb_swapchain *)(uintptr_t)s; }
|
||||
|
||||
/* ------------------------------------------------------------------ surfaces */
|
||||
|
||||
static VkResult new_surface(enum vkb_surface_kind kind, VkSurfaceKHR *out, vkb_surface **ps)
|
||||
{
|
||||
vkb_surface *s = calloc(1, sizeof(*s));
|
||||
if (!s) return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
s->kind = kind;
|
||||
*ps = s;
|
||||
*out = (VkSurfaceKHR)(uintptr_t)s;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface)
|
||||
{
|
||||
(void)instance;
|
||||
(void)pAllocator;
|
||||
if (!vkb_wl_load()) return VK_ERROR_INITIALIZATION_FAILED;
|
||||
vkb_surface *s;
|
||||
VkResult r = new_surface(VKB_SURF_WAYLAND, pSurface, &s);
|
||||
if (r == VK_SUCCESS) {
|
||||
s->wl_display = pCreateInfo->display;
|
||||
s->wl_surface = pCreateInfo->surface;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface)
|
||||
{
|
||||
(void)instance;
|
||||
(void)pAllocator;
|
||||
if (!vkb_xcb_load()) return VK_ERROR_INITIALIZATION_FAILED;
|
||||
vkb_surface *s;
|
||||
VkResult r = new_surface(VKB_SURF_XCB, pSurface, &s);
|
||||
if (r == VK_SUCCESS) {
|
||||
s->xcb_conn = pCreateInfo->connection;
|
||||
s->xcb_window = pCreateInfo->window;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface)
|
||||
{
|
||||
(void)instance;
|
||||
(void)pAllocator;
|
||||
if (!vkb_xcb_load()) return VK_ERROR_INITIALIZATION_FAILED;
|
||||
void *conn = vkb_xlib_to_xcb(pCreateInfo->dpy);
|
||||
if (!conn) return VK_ERROR_INITIALIZATION_FAILED;
|
||||
vkb_surface *s;
|
||||
VkResult r = new_surface(VKB_SURF_XCB, pSurface, &s);
|
||||
if (r == VK_SUCCESS) {
|
||||
s->xcb_conn = conn;
|
||||
s->xcb_window = (uint32_t)pCreateInfo->window;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateHeadlessSurfaceEXT(VkInstance instance, const VkHeadlessSurfaceCreateInfoEXT *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface)
|
||||
{
|
||||
(void)instance;
|
||||
(void)pCreateInfo;
|
||||
(void)pAllocator;
|
||||
vkb_surface *s;
|
||||
return new_surface(VKB_SURF_HEADLESS, pSurface, &s);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
(void)instance;
|
||||
(void)pAllocator;
|
||||
free(surf(surface));
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkb_ep_vkGetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
|
||||
struct wl_display *display)
|
||||
{
|
||||
(void)physicalDevice;
|
||||
(void)queueFamilyIndex;
|
||||
(void)display;
|
||||
return vkb_wl_load() ? VK_TRUE : VK_FALSE;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkb_ep_vkGetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
|
||||
xcb_connection_t *connection, xcb_visualid_t visual_id)
|
||||
{
|
||||
(void)physicalDevice;
|
||||
(void)queueFamilyIndex;
|
||||
(void)connection;
|
||||
(void)visual_id;
|
||||
return vkb_xcb_load() ? VK_TRUE : VK_FALSE;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkb_ep_vkGetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
|
||||
Display *dpy, VisualID visualID)
|
||||
{
|
||||
(void)physicalDevice;
|
||||
(void)queueFamilyIndex;
|
||||
(void)dpy;
|
||||
(void)visualID;
|
||||
return vkb_xcb_load() ? VK_TRUE : VK_FALSE;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
|
||||
VkSurfaceKHR surface, VkBool32 *pSupported)
|
||||
{
|
||||
(void)surface;
|
||||
/* Presentation is a copy or a hand-over after the queue's work: any queue that can do
|
||||
* graphics or compute (or transfer) can present. */
|
||||
uint32_t n = 0;
|
||||
vkb_wire_vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &n, NULL);
|
||||
VkQueueFamilyProperties *qp = calloc(n ? n : 1, sizeof(*qp));
|
||||
vkb_wire_vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &n, qp);
|
||||
*pSupported = queueFamilyIndex < n &&
|
||||
(qp[queueFamilyIndex].queueFlags & (VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_TRANSFER_BIT));
|
||||
free(qp);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult surface_extent(vkb_surface *s, VkExtent2D *e)
|
||||
{
|
||||
switch (s->kind) {
|
||||
case VKB_SURF_WAYLAND: return vkb_wl_surface_extent(s, e);
|
||||
case VKB_SURF_XCB: return vkb_xcb_surface_extent(s, e);
|
||||
default:
|
||||
e->width = e->height = 0xFFFFFFFFu;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
static VkImageUsageFlags supported_usage(VkPhysicalDevice pd)
|
||||
{
|
||||
VkImageUsageFlags u = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT |
|
||||
VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
|
||||
VkFormatProperties fp;
|
||||
vkb_wire_vkGetPhysicalDeviceFormatProperties(pd, VK_FORMAT_B8G8R8A8_UNORM, &fp);
|
||||
if (fp.optimalTilingFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) u |= VK_IMAGE_USAGE_STORAGE_BIT;
|
||||
return u;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
|
||||
VkSurfaceCapabilitiesKHR *c)
|
||||
{
|
||||
vkb_surface *s = surf(surface);
|
||||
memset(c, 0, sizeof(*c));
|
||||
VkResult r = surface_extent(s, &c->currentExtent);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
c->minImageCount = s->kind == VKB_SURF_WAYLAND ? 3 : 2;
|
||||
c->maxImageCount = 8;
|
||||
c->minImageExtent = (VkExtent2D){1, 1};
|
||||
c->maxImageExtent = (VkExtent2D){16384, 16384};
|
||||
if (c->currentExtent.width != 0xFFFFFFFFu) {
|
||||
c->minImageExtent = c->maxImageExtent = c->currentExtent;
|
||||
if (!c->currentExtent.width || !c->currentExtent.height) c->minImageExtent = (VkExtent2D){0, 0};
|
||||
}
|
||||
c->maxImageArrayLayers = 1;
|
||||
c->supportedTransforms = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
|
||||
c->currentTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
|
||||
c->supportedCompositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR | VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR;
|
||||
if (s->kind == VKB_SURF_WAYLAND) c->supportedCompositeAlpha |= VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR;
|
||||
c->supportedUsageFlags = supported_usage(physicalDevice);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceSurfaceInfo2KHR *pInfo,
|
||||
VkSurfaceCapabilities2KHR *pCaps)
|
||||
{
|
||||
VkResult r = vkb_ep_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, pInfo->surface, &pCaps->surfaceCapabilities);
|
||||
for (VkBaseOutStructure *b = (VkBaseOutStructure *)pCaps->pNext; b; b = b->pNext) {
|
||||
if (b->sType == VK_STRUCTURE_TYPE_SURFACE_PROTECTED_CAPABILITIES_KHR)
|
||||
((VkSurfaceProtectedCapabilitiesKHR *)b)->supportsProtected = VK_FALSE;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
|
||||
uint32_t *pCount, VkSurfaceFormatKHR *pFormats)
|
||||
{
|
||||
(void)physicalDevice;
|
||||
(void)surface;
|
||||
if (!pFormats) {
|
||||
*pCount = vkb_wsi_format_count;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
uint32_t n = *pCount < vkb_wsi_format_count ? *pCount : vkb_wsi_format_count;
|
||||
memcpy(pFormats, vkb_wsi_formats, n * sizeof(*pFormats));
|
||||
*pCount = n;
|
||||
return n < vkb_wsi_format_count ? VK_INCOMPLETE : VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceSurfaceInfo2KHR *pInfo, uint32_t *pCount,
|
||||
VkSurfaceFormat2KHR *pFormats)
|
||||
{
|
||||
(void)physicalDevice;
|
||||
(void)pInfo;
|
||||
if (!pFormats) {
|
||||
*pCount = vkb_wsi_format_count;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
uint32_t n = *pCount < vkb_wsi_format_count ? *pCount : vkb_wsi_format_count;
|
||||
for (uint32_t i = 0; i < n; i++) pFormats[i].surfaceFormat = vkb_wsi_formats[i];
|
||||
*pCount = n;
|
||||
return n < vkb_wsi_format_count ? VK_INCOMPLETE : VK_SUCCESS;
|
||||
}
|
||||
|
||||
static const VkPresentModeKHR present_modes[] = {VK_PRESENT_MODE_FIFO_KHR, VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR};
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
|
||||
uint32_t *pCount, VkPresentModeKHR *pModes)
|
||||
{
|
||||
(void)physicalDevice;
|
||||
(void)surface;
|
||||
uint32_t total = 3;
|
||||
if (!pModes) {
|
||||
*pCount = total;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
uint32_t n = *pCount < total ? *pCount : total;
|
||||
memcpy(pModes, present_modes, n * sizeof(*pModes));
|
||||
*pCount = n;
|
||||
return n < total ? VK_INCOMPLETE : VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
|
||||
uint32_t *pRectCount, VkRect2D *pRects)
|
||||
{
|
||||
(void)physicalDevice;
|
||||
if (!pRects) {
|
||||
*pRectCount = 1;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
if (*pRectCount < 1) return VK_INCOMPLETE;
|
||||
VkExtent2D e;
|
||||
surface_extent(surf(surface), &e);
|
||||
if (e.width == 0xFFFFFFFFu) e = (VkExtent2D){16384, 16384};
|
||||
pRects[0] = (VkRect2D){{0, 0}, e};
|
||||
*pRectCount = 1;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetDeviceGroupPresentCapabilitiesKHR(VkDevice device, VkDeviceGroupPresentCapabilitiesKHR *pCaps)
|
||||
{
|
||||
(void)device;
|
||||
memset(pCaps->presentMask, 0, sizeof(pCaps->presentMask));
|
||||
pCaps->presentMask[0] = 1;
|
||||
pCaps->modes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface,
|
||||
VkDeviceGroupPresentModeFlagsKHR *pModes)
|
||||
{
|
||||
(void)device;
|
||||
(void)surface;
|
||||
*pModes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ swapchain images */
|
||||
|
||||
static uint32_t pick_type(vkb_device *dev, uint32_t bits, VkMemoryPropertyFlags want)
|
||||
{
|
||||
const VkPhysicalDeviceMemoryProperties *mp = &dev->pd->client_mem;
|
||||
for (uint32_t i = 0; i < mp->memoryTypeCount; i++)
|
||||
if ((bits & (1u << i)) && (mp->memoryTypes[i].propertyFlags & want) == want) return i;
|
||||
for (uint32_t i = 0; i < mp->memoryTypeCount; i++)
|
||||
if (bits & (1u << i)) return i;
|
||||
return UINT32_MAX;
|
||||
}
|
||||
|
||||
static int pd_has_ext(vkb_physdev *pd, const char *name)
|
||||
{
|
||||
for (uint32_t i = 0; i < pd->next; i++)
|
||||
if (!strcmp(pd->exts[i].extensionName, name)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* One swapchain image: exported as a linear dma-buf when `dmabuf`, else an ordinary image. */
|
||||
static VkResult create_image(vkb_swapchain *sc, vkb_swap_image *img, int dmabuf)
|
||||
{
|
||||
vkb_device *dev = sc->dev;
|
||||
VkDevice device = (VkDevice)dev;
|
||||
const VkSwapchainCreateInfoKHR *ci = &sc->info;
|
||||
VkImageCreateInfo ici = {VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO};
|
||||
ici.imageType = VK_IMAGE_TYPE_2D;
|
||||
ici.format = ci->imageFormat;
|
||||
ici.extent = (VkExtent3D){ci->imageExtent.width, ci->imageExtent.height, 1};
|
||||
ici.mipLevels = 1;
|
||||
ici.arrayLayers = ci->imageArrayLayers;
|
||||
ici.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
ici.tiling = VK_IMAGE_TILING_OPTIMAL;
|
||||
ici.usage = ci->imageUsage | (sc->copy_present || !dmabuf ? VK_IMAGE_USAGE_TRANSFER_SRC_BIT : 0);
|
||||
ici.sharingMode = ci->imageSharingMode;
|
||||
ici.queueFamilyIndexCount = ci->queueFamilyIndexCount;
|
||||
ici.pQueueFamilyIndices = ci->pQueueFamilyIndices;
|
||||
ici.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
if (ci->flags & VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR) ici.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
|
||||
VkImageFormatListCreateInfo fl = {VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO, NULL, sc->view_format_count, sc->view_formats};
|
||||
VkExternalMemoryImageCreateInfo ext = {VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO, NULL,
|
||||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT};
|
||||
uint64_t linear = 0; /* DRM_FORMAT_MOD_LINEAR */
|
||||
VkImageDrmFormatModifierListCreateInfoEXT mods = {VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT, NULL, 1, &linear};
|
||||
const void *chain = NULL;
|
||||
if (sc->view_format_count) {
|
||||
fl.pNext = chain;
|
||||
chain = &fl;
|
||||
}
|
||||
int use_mods = 0;
|
||||
if (dmabuf) {
|
||||
ext.pNext = chain;
|
||||
chain = &ext;
|
||||
if (pd_has_ext(dev->pd, "VK_EXT_image_drm_format_modifier")) {
|
||||
mods.pNext = chain;
|
||||
chain = &mods;
|
||||
ici.tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
|
||||
use_mods = 1;
|
||||
} else {
|
||||
ici.tiling = VK_IMAGE_TILING_LINEAR;
|
||||
}
|
||||
}
|
||||
ici.pNext = chain;
|
||||
VkResult r = vkb_wire_vkCreateImage(device, &ici, NULL, &img->image);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
VkMemoryRequirements req;
|
||||
vkb_ep_vkGetImageMemoryRequirements(device, img->image, &req);
|
||||
uint32_t type = pick_type(dev, req.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
|
||||
if (type == UINT32_MAX) return VK_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
VkMemoryDedicatedAllocateInfo ded = {VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO, NULL, img->image, VK_NULL_HANDLE};
|
||||
VkExportMemoryAllocateInfo exp = {VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO, &ded, VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT};
|
||||
VkMemoryAllocateInfo ai = {VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, dmabuf ? (const void *)&exp : (const void *)&ded, req.size, type};
|
||||
r = vkb_ep_vkAllocateMemory(device, &ai, NULL, &img->memory);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
r = vkb_wire_vkBindImageMemory(device, img->image, img->memory, 0);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
img->dmabuf_fd = -1;
|
||||
if (dmabuf) {
|
||||
VkMemoryGetFdInfoKHR gi = {VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR, NULL, img->memory, VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT};
|
||||
r = vkb_wire_vkGetMemoryFdKHR(device, &gi, &img->dmabuf_fd);
|
||||
if (r != VK_SUCCESS || img->dmabuf_fd < 0) return r != VK_SUCCESS ? r : VK_ERROR_INITIALIZATION_FAILED;
|
||||
VkImageSubresource sub = {use_mods ? VK_IMAGE_ASPECT_MEMORY_PLANE_0_BIT_EXT : VK_IMAGE_ASPECT_COLOR_BIT, 0, 0};
|
||||
VkSubresourceLayout lay;
|
||||
vkb_wire_vkGetImageSubresourceLayout(device, img->image, &sub, &lay);
|
||||
img->stride = (uint32_t)lay.rowPitch;
|
||||
img->offset = (uint32_t)lay.offset;
|
||||
img->modifier = 0;
|
||||
if (use_mods) {
|
||||
VkImageDrmFormatModifierPropertiesEXT mp = {VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT};
|
||||
if (vkb_wire_vkGetImageDrmFormatModifierPropertiesEXT(device, img->image, &mp) == VK_SUCCESS) img->modifier = mp.drmFormatModifier;
|
||||
}
|
||||
}
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static void destroy_image(vkb_swapchain *sc, vkb_swap_image *img)
|
||||
{
|
||||
VkDevice device = (VkDevice)sc->dev;
|
||||
if (img->dmabuf_fd >= 0) close(img->dmabuf_fd);
|
||||
if (img->image) vkb_ep_vkDestroyImage(device, img->image, NULL);
|
||||
if (img->memory) vkb_ep_vkFreeMemory(device, img->memory, NULL);
|
||||
}
|
||||
|
||||
static VkResult create_staging(vkb_swapchain *sc)
|
||||
{
|
||||
vkb_device *dev = sc->dev;
|
||||
VkDevice device = (VkDevice)dev;
|
||||
VkDeviceSize size = (VkDeviceSize)sc->info.imageExtent.width * sc->info.imageExtent.height * 4;
|
||||
VkBufferCreateInfo bci = {VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, NULL, 0, size, VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
||||
VK_SHARING_MODE_EXCLUSIVE, 0, NULL};
|
||||
VkResult r = vkb_ep_vkCreateBuffer(device, &bci, NULL, &sc->staging);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
VkMemoryRequirements req;
|
||||
vkb_ep_vkGetBufferMemoryRequirements(device, sc->staging, &req);
|
||||
uint32_t type = pick_type(dev, req.memoryTypeBits,
|
||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT);
|
||||
if (type == UINT32_MAX || !(dev->pd->client_mem.memoryTypes[type].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))
|
||||
type = pick_type(dev, req.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
|
||||
if (type == UINT32_MAX || !(dev->pd->client_mem.memoryTypes[type].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) {
|
||||
VKB_ERR("swapchain: no host-visible memory to read frames back into");
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
VkMemoryAllocateInfo ai = {VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, NULL, req.size, type};
|
||||
r = vkb_ep_vkAllocateMemory(device, &ai, NULL, &sc->staging_mem);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
r = vkb_wire_vkBindBufferMemory(device, sc->staging, sc->staging_mem, 0);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
void *p = NULL;
|
||||
r = vkb_ep_vkMapMemory(device, sc->staging_mem, 0, VK_WHOLE_SIZE, 0, &p);
|
||||
sc->staging_ptr = p;
|
||||
sc->staging_size = size;
|
||||
return r;
|
||||
}
|
||||
|
||||
static VkResult ensure_copy_cbs(vkb_swapchain *sc, uint32_t family)
|
||||
{
|
||||
VkDevice device = (VkDevice)sc->dev;
|
||||
if (sc->pool && sc->pool_family == family) return VK_SUCCESS;
|
||||
if (sc->pool) {
|
||||
vkb_ep_vkDestroyCommandPool(device, sc->pool, NULL);
|
||||
sc->pool = VK_NULL_HANDLE;
|
||||
}
|
||||
VkCommandPoolCreateInfo pci = {VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, NULL, 0, family};
|
||||
VkResult r = vkb_wire_vkCreateCommandPool(device, &pci, NULL, &sc->pool);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
sc->pool_family = family;
|
||||
VkCommandBufferAllocateInfo cai = {VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, NULL, sc->pool, VK_COMMAND_BUFFER_LEVEL_PRIMARY, sc->count};
|
||||
r = vkb_ep_vkAllocateCommandBuffers(device, &cai, sc->copy_cbs);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
for (uint32_t i = 0; i < sc->count; i++) {
|
||||
VkCommandBuffer cb = sc->copy_cbs[i];
|
||||
VkCommandBufferBeginInfo bi = {VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, NULL, 0, NULL};
|
||||
vkb_ep_vkBeginCommandBuffer(cb, &bi);
|
||||
VkImageMemoryBarrier b = {VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, NULL, VK_ACCESS_MEMORY_WRITE_BIT, VK_ACCESS_TRANSFER_READ_BIT,
|
||||
VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_QUEUE_FAMILY_IGNORED,
|
||||
VK_QUEUE_FAMILY_IGNORED, sc->images[i].image, {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}};
|
||||
vkb_wire_vkCmdPipelineBarrier(cb, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 1, &b);
|
||||
VkBufferImageCopy region = {0, 0, 0, {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, {0, 0, 0},
|
||||
{sc->info.imageExtent.width, sc->info.imageExtent.height, 1}};
|
||||
vkb_wire_vkCmdCopyImageToBuffer(cb, sc->images[i].image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, sc->staging, 1, ®ion);
|
||||
b.srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
|
||||
b.dstAccessMask = 0;
|
||||
b.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
|
||||
b.newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
|
||||
VkMemoryBarrier hb = {VK_STRUCTURE_TYPE_MEMORY_BARRIER, NULL, VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT};
|
||||
vkb_wire_vkCmdPipelineBarrier(cb, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT | VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 1,
|
||||
&hb, 0, NULL, 1, &b);
|
||||
r = vkb_ep_vkEndCommandBuffer(cb);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
}
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
/* Waits (on the CPU) for the app's rendering into image `index`, reading it back when needed. */
|
||||
VkResult vkb_wsi_wait_rendering(vkb_swapchain *sc, VkQueue queue, uint32_t index, uint32_t nwait, const VkSemaphore *wait)
|
||||
{
|
||||
VkDevice device = (VkDevice)sc->dev;
|
||||
VkPipelineStageFlags *stages = alloca((nwait ? nwait : 1) * sizeof(VkPipelineStageFlags));
|
||||
for (uint32_t i = 0; i < nwait; i++) stages[i] = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
|
||||
VkSubmitInfo si = {VK_STRUCTURE_TYPE_SUBMIT_INFO, NULL, nwait, wait, stages, 0, NULL, 0, NULL};
|
||||
if (sc->copy_present) {
|
||||
VkResult r = ensure_copy_cbs(sc, ((vkb_queue *)queue)->family);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
si.commandBufferCount = 1;
|
||||
si.pCommandBuffers = &sc->copy_cbs[index];
|
||||
}
|
||||
VkResult r = vkb_wire_vkQueueSubmit(queue, 1, &si, sc->fence);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
r = vkb_wire_vkWaitForFences(device, 1, &sc->fence, VK_TRUE, 10ull * 1000 * 1000 * 1000);
|
||||
vkb_wire_vkResetFences(device, 1, &sc->fence);
|
||||
if (r == VK_TIMEOUT) {
|
||||
VKB_ERR("swapchain: a frame took more than 10 s to render");
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ swapchain */
|
||||
|
||||
static void swapchain_free(vkb_swapchain *sc)
|
||||
{
|
||||
VkDevice device = (VkDevice)sc->dev;
|
||||
if (sc->backend && sc->backend->destroy) sc->backend->destroy(sc);
|
||||
for (uint32_t i = 0; i < sc->count; i++) destroy_image(sc, &sc->images[i]);
|
||||
if (sc->pool) vkb_ep_vkDestroyCommandPool(device, sc->pool, NULL);
|
||||
if (sc->fence) vkb_wire_vkDestroyFence(device, sc->fence, NULL);
|
||||
if (sc->staging) vkb_ep_vkDestroyBuffer(device, sc->staging, NULL);
|
||||
if (sc->staging_mem) vkb_ep_vkFreeMemory(device, sc->staging_mem, NULL);
|
||||
free(sc->images);
|
||||
free(sc->copy_cbs);
|
||||
free(sc->view_formats);
|
||||
pthread_mutex_destroy(&sc->lock);
|
||||
free(sc);
|
||||
}
|
||||
|
||||
static VkResult swapchain_build(vkb_swapchain *sc, int dmabuf)
|
||||
{
|
||||
VkDevice device = (VkDevice)sc->dev;
|
||||
sc->dmabuf = dmabuf;
|
||||
for (uint32_t i = 0; i < sc->count; i++) {
|
||||
VkResult r = create_image(sc, &sc->images[i], dmabuf);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
sc->images[i].chain = sc;
|
||||
}
|
||||
if (sc->copy_present) {
|
||||
VkResult r = create_staging(sc);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
}
|
||||
VkFenceCreateInfo fci = {VK_STRUCTURE_TYPE_FENCE_CREATE_INFO};
|
||||
VkResult r = vkb_wire_vkCreateFence(device, &fci, NULL, &sc->fence);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
return sc->backend->init(sc);
|
||||
}
|
||||
|
||||
static void swapchain_teardown(vkb_swapchain *sc)
|
||||
{
|
||||
VkDevice device = (VkDevice)sc->dev;
|
||||
if (sc->backend && sc->backend->destroy) sc->backend->destroy(sc);
|
||||
sc->bdata = NULL;
|
||||
for (uint32_t i = 0; i < sc->count; i++) {
|
||||
destroy_image(sc, &sc->images[i]);
|
||||
memset(&sc->images[i], 0, sizeof(sc->images[i]));
|
||||
sc->images[i].dmabuf_fd = -1;
|
||||
}
|
||||
if (sc->fence) vkb_wire_vkDestroyFence(device, sc->fence, NULL);
|
||||
sc->fence = VK_NULL_HANDLE;
|
||||
if (sc->staging) vkb_ep_vkDestroyBuffer(device, sc->staging, NULL);
|
||||
if (sc->staging_mem) vkb_ep_vkFreeMemory(device, sc->staging_mem, NULL);
|
||||
sc->staging = VK_NULL_HANDLE;
|
||||
sc->staging_mem = VK_NULL_HANDLE;
|
||||
sc->staging_ptr = NULL;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain)
|
||||
{
|
||||
(void)pAllocator;
|
||||
vkb_device *dev = vkb_dev(device);
|
||||
vkb_surface *s = surf(pCreateInfo->surface);
|
||||
if (pCreateInfo->oldSwapchain) chain(pCreateInfo->oldSwapchain)->retired = 1;
|
||||
vkb_swapchain *sc = calloc(1, sizeof(*sc));
|
||||
if (!sc) return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
pthread_mutex_init(&sc->lock, NULL);
|
||||
sc->dev = dev;
|
||||
sc->surface = s;
|
||||
sc->info = *pCreateInfo;
|
||||
sc->info.pNext = NULL;
|
||||
sc->info.pQueueFamilyIndices = NULL;
|
||||
sc->info.queueFamilyIndexCount = 0;
|
||||
sc->info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||
for (const VkBaseInStructure *b = pCreateInfo->pNext; b; b = b->pNext) {
|
||||
if (b->sType == VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO) {
|
||||
const VkImageFormatListCreateInfo *fl = (const void *)b;
|
||||
sc->view_formats = calloc(fl->viewFormatCount + 1, sizeof(VkFormat));
|
||||
memcpy(sc->view_formats, fl->pViewFormats, fl->viewFormatCount * sizeof(VkFormat));
|
||||
sc->view_format_count = fl->viewFormatCount;
|
||||
}
|
||||
}
|
||||
sc->count = pCreateInfo->minImageCount < 2 ? 2 : pCreateInfo->minImageCount;
|
||||
if (s->kind == VKB_SURF_WAYLAND && sc->count < 3) sc->count = 3;
|
||||
sc->images = calloc(sc->count, sizeof(vkb_swap_image));
|
||||
sc->copy_cbs = calloc(sc->count, sizeof(VkCommandBuffer));
|
||||
for (uint32_t i = 0; i < sc->count; i++) sc->images[i].dmabuf_fd = -1;
|
||||
VkResult r;
|
||||
switch (s->kind) {
|
||||
case VKB_SURF_WAYLAND:
|
||||
sc->backend = &vkb_wsi_wayland_backend;
|
||||
sc->copy_present = getenv("VKBRIDGE_WSI_SHM") != NULL;
|
||||
r = swapchain_build(sc, !sc->copy_present);
|
||||
if (r != VK_SUCCESS && !sc->copy_present) {
|
||||
VKB_WARN("Wayland: no dma-buf presentation (%d); falling back to copies through shared memory", r);
|
||||
swapchain_teardown(sc);
|
||||
sc->copy_present = 1;
|
||||
r = swapchain_build(sc, 0);
|
||||
}
|
||||
break;
|
||||
case VKB_SURF_XCB:
|
||||
sc->backend = &vkb_wsi_x11_backend;
|
||||
sc->copy_present = 1;
|
||||
r = swapchain_build(sc, 0);
|
||||
break;
|
||||
default:
|
||||
sc->backend = &vkb_wsi_headless_backend;
|
||||
r = swapchain_build(sc, 0);
|
||||
break;
|
||||
}
|
||||
if (r != VK_SUCCESS) {
|
||||
VKB_ERR("swapchain creation failed: %d", r);
|
||||
swapchain_free(sc);
|
||||
return r;
|
||||
}
|
||||
VKB_INFO("swapchain %ux%u format %d, %u images, %s", sc->info.imageExtent.width, sc->info.imageExtent.height, sc->info.imageFormat,
|
||||
sc->count, sc->copy_present ? "presented by copy" : sc->dmabuf ? "presented as dma-bufs" : "headless");
|
||||
*pSwapchain = (VkSwapchainKHR)(uintptr_t)sc;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
(void)pAllocator;
|
||||
if (!swapchain) return;
|
||||
vkb_swapchain *sc = chain(swapchain);
|
||||
/* Images may still be in use by the GPU (present waits are CPU-side, so not by us). */
|
||||
vkb_wire_vkDeviceWaitIdle(device);
|
||||
swapchain_free(sc);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pCount, VkImage *pImages)
|
||||
{
|
||||
(void)device;
|
||||
vkb_swapchain *sc = chain(swapchain);
|
||||
if (!pImages) {
|
||||
*pCount = sc->count;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
uint32_t n = *pCount < sc->count ? *pCount : sc->count;
|
||||
for (uint32_t i = 0; i < n; i++) pImages[i] = sc->images[i].image;
|
||||
*pCount = n;
|
||||
return n < sc->count ? VK_INCOMPLETE : VK_SUCCESS;
|
||||
}
|
||||
|
||||
/* Signals the app's semaphore/fence for an acquired image (no GPU work is involved). */
|
||||
static VkResult signal_acquire(vkb_device *dev, VkSemaphore sem, VkFence fence)
|
||||
{
|
||||
VkDevice device = (VkDevice)dev;
|
||||
if (sem) {
|
||||
VkImportSemaphoreFdInfoKHR si = {VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR, NULL, sem, VK_SEMAPHORE_IMPORT_TEMPORARY_BIT,
|
||||
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT, -1};
|
||||
VkResult r = vkb_wire_vkImportSemaphoreFdKHR(device, &si);
|
||||
if (r != VK_SUCCESS) {
|
||||
/* No sync-fd import: signal it with an empty submit. */
|
||||
if (!dev->queues) return VK_ERROR_SURFACE_LOST_KHR;
|
||||
VkSubmitInfo s = {VK_STRUCTURE_TYPE_SUBMIT_INFO, NULL, 0, NULL, NULL, 0, NULL, 1, &sem};
|
||||
r = vkb_wire_vkQueueSubmit((VkQueue)dev->queues, 1, &s, fence);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
if (fence) {
|
||||
VkImportFenceFdInfoKHR fi = {VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR, NULL, fence, VK_FENCE_IMPORT_TEMPORARY_BIT,
|
||||
VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT, -1};
|
||||
VkResult r = vkb_wire_vkImportFenceFdKHR(device, &fi);
|
||||
if (r != VK_SUCCESS) {
|
||||
if (!dev->queues) return VK_ERROR_SURFACE_LOST_KHR;
|
||||
r = vkb_wire_vkQueueSubmit((VkQueue)dev->queues, 0, NULL, fence);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static uint64_t now_ns(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return (uint64_t)ts.tv_sec * 1000000000ull + (uint64_t)ts.tv_nsec;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore,
|
||||
VkFence fence, uint32_t *pImageIndex)
|
||||
{
|
||||
vkb_swapchain *sc = chain(swapchain);
|
||||
if (sc->retired) return VK_ERROR_OUT_OF_DATE_KHR;
|
||||
if (sc->status != VK_SUCCESS) return sc->status;
|
||||
uint64_t deadline = timeout == UINT64_MAX ? UINT64_MAX : now_ns() + timeout;
|
||||
for (;;) {
|
||||
pthread_mutex_lock(&sc->lock);
|
||||
for (uint32_t i = 0; i < sc->count; i++) {
|
||||
if (!sc->images[i].busy && !sc->images[i].acquired) {
|
||||
sc->images[i].acquired = 1;
|
||||
pthread_mutex_unlock(&sc->lock);
|
||||
VkResult r = signal_acquire(vkb_dev(device), semaphore, fence);
|
||||
if (r != VK_SUCCESS) return r;
|
||||
*pImageIndex = i;
|
||||
return sc->status;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&sc->lock);
|
||||
uint64_t now = now_ns();
|
||||
if (timeout == 0) return VK_NOT_READY;
|
||||
if (now >= deadline) return VK_TIMEOUT;
|
||||
VkResult r = sc->backend->wait_free(sc, deadline == UINT64_MAX ? UINT64_MAX : deadline - now);
|
||||
if (r < 0) {
|
||||
sc->status = r;
|
||||
return r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pInfo, uint32_t *pImageIndex)
|
||||
{
|
||||
return vkb_ep_vkAcquireNextImageKHR(device, pInfo->swapchain, pInfo->timeout, pInfo->semaphore, pInfo->fence, pImageIndex);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo)
|
||||
{
|
||||
const VkPresentRegionsKHR *regions = NULL;
|
||||
for (const VkBaseInStructure *b = pPresentInfo->pNext; b; b = b->pNext)
|
||||
if (b->sType == VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR) regions = (const void *)b;
|
||||
VkResult worst = VK_SUCCESS;
|
||||
for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) {
|
||||
vkb_swapchain *sc = chain(pPresentInfo->pSwapchains[i]);
|
||||
uint32_t index = pPresentInfo->pImageIndices[i];
|
||||
VkResult r = sc->status;
|
||||
if (index >= sc->count) r = VK_ERROR_OUT_OF_DATE_KHR;
|
||||
if (r >= 0) {
|
||||
r = vkb_wsi_wait_rendering(sc, queue, index, i == 0 ? pPresentInfo->waitSemaphoreCount : 0, pPresentInfo->pWaitSemaphores);
|
||||
}
|
||||
pthread_mutex_lock(&sc->lock);
|
||||
if (index < sc->count) {
|
||||
sc->images[index].acquired = 0;
|
||||
sc->images[index].busy = sc->dmabuf && !sc->copy_present;
|
||||
}
|
||||
pthread_mutex_unlock(&sc->lock);
|
||||
if (r >= 0) {
|
||||
r = sc->backend->present(sc, index, regions && i < regions->swapchainCount ? ®ions->pRegions[i] : NULL);
|
||||
sc->presents++;
|
||||
}
|
||||
if (r < 0) {
|
||||
pthread_mutex_lock(&sc->lock);
|
||||
if (index < sc->count) sc->images[index].busy = 0;
|
||||
pthread_mutex_unlock(&sc->lock);
|
||||
if (r == VK_ERROR_OUT_OF_DATE_KHR || r == VK_ERROR_SURFACE_LOST_KHR) sc->status = r;
|
||||
}
|
||||
if (r == VK_SUCCESS && sc->status == VK_SUBOPTIMAL_KHR) r = VK_SUBOPTIMAL_KHR;
|
||||
if (pPresentInfo->pResults) pPresentInfo->pResults[i] = r;
|
||||
if (r < 0 && (worst >= 0 || r == VK_ERROR_DEVICE_LOST)) worst = r;
|
||||
else if (worst == VK_SUCCESS && r == VK_SUBOPTIMAL_KHR) worst = r;
|
||||
}
|
||||
return worst;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ headless */
|
||||
|
||||
static VkResult hl_init(vkb_swapchain *sc) { (void)sc; return VK_SUCCESS; }
|
||||
static VkResult hl_present(vkb_swapchain *sc, uint32_t i, const VkPresentRegionKHR *r) { (void)sc; (void)i; (void)r; return VK_SUCCESS; }
|
||||
static VkResult hl_wait(vkb_swapchain *sc, uint64_t t) { (void)sc; (void)t; return VK_TIMEOUT; }
|
||||
static void hl_destroy(vkb_swapchain *sc) { (void)sc; }
|
||||
const vkb_wsi_backend vkb_wsi_headless_backend = {hl_init, hl_present, hl_wait, hl_destroy};
|
||||
@@ -0,0 +1,99 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Window-system integration implemented by the bridge client: the server's GPU has no Linux
|
||||
* window systems, so swapchains are built here from ordinary images and handed to the
|
||||
* compositor as dma-bufs (Wayland, zwp_linux_dmabuf_v1) or copied out through shared memory
|
||||
* (Wayland wl_shm, X11 PutImage), or not shown at all (VK_EXT_headless_surface).
|
||||
*/
|
||||
#ifndef VKB_WSI_H
|
||||
#define VKB_WSI_H
|
||||
|
||||
#include "vkb_client.h"
|
||||
|
||||
struct wl_display;
|
||||
struct wl_surface;
|
||||
|
||||
enum vkb_surface_kind { VKB_SURF_WAYLAND, VKB_SURF_XCB, VKB_SURF_HEADLESS };
|
||||
|
||||
typedef struct vkb_surface {
|
||||
enum vkb_surface_kind kind;
|
||||
struct wl_display *wl_display;
|
||||
struct wl_surface *wl_surface;
|
||||
void *xcb_conn; /* xcb_connection_t* */
|
||||
uint32_t xcb_window;
|
||||
struct vkb_wl_display_info *wl_info; /* cached formats/modifiers per wl_display */
|
||||
} vkb_surface;
|
||||
|
||||
typedef struct vkb_swapchain vkb_swapchain;
|
||||
|
||||
typedef struct vkb_swap_image {
|
||||
VkImage image;
|
||||
VkDeviceMemory memory;
|
||||
int busy; /* held by the compositor (or acquired by the app) */
|
||||
int acquired;
|
||||
void *backend; /* backend per-image data (wl_buffer...) */
|
||||
uint32_t stride, offset;
|
||||
uint64_t modifier;
|
||||
int dmabuf_fd;
|
||||
vkb_swapchain *chain;
|
||||
} vkb_swap_image;
|
||||
|
||||
typedef struct vkb_wsi_backend {
|
||||
/* Called after images exist; may fail (e.g. no dma-buf support) - the generic code then
|
||||
* retries with copy_present = 1. */
|
||||
VkResult (*init)(vkb_swapchain *sc);
|
||||
/* The image's rendering is complete (and, with copy_present, its pixels are in sc->staging). */
|
||||
VkResult (*present)(vkb_swapchain *sc, uint32_t index, const VkPresentRegionKHR *region);
|
||||
/* Wait until an image may be acquired (dispatching events); 0 timeout = poll. */
|
||||
VkResult (*wait_free)(vkb_swapchain *sc, uint64_t timeout_ns);
|
||||
void (*destroy)(vkb_swapchain *sc);
|
||||
} vkb_wsi_backend;
|
||||
|
||||
struct vkb_swapchain {
|
||||
vkb_device *dev;
|
||||
vkb_surface *surface;
|
||||
VkSwapchainCreateInfoKHR info;
|
||||
VkFormat *view_formats;
|
||||
uint32_t view_format_count;
|
||||
uint32_t count;
|
||||
vkb_swap_image *images;
|
||||
const vkb_wsi_backend *backend;
|
||||
void *bdata;
|
||||
int dmabuf; /* images are exported dma-bufs */
|
||||
int copy_present; /* pixels are read back into `staging` at present */
|
||||
/* Read-back resources (copy_present). */
|
||||
VkBuffer staging;
|
||||
VkDeviceMemory staging_mem;
|
||||
uint8_t *staging_ptr;
|
||||
VkDeviceSize staging_size;
|
||||
VkCommandPool pool;
|
||||
uint32_t pool_family;
|
||||
VkCommandBuffer *copy_cbs;
|
||||
VkFence fence;
|
||||
VkResult status; /* VK_ERROR_OUT_OF_DATE_KHR / SURFACE_LOST once broken */
|
||||
pthread_mutex_t lock;
|
||||
uint64_t presents;
|
||||
int retired;
|
||||
};
|
||||
|
||||
/* Formats every surface offers. */
|
||||
extern const VkSurfaceFormatKHR vkb_wsi_formats[];
|
||||
extern const uint32_t vkb_wsi_format_count;
|
||||
|
||||
/* Wayland */
|
||||
extern const vkb_wsi_backend vkb_wsi_wayland_backend;
|
||||
int vkb_wl_load(void);
|
||||
VkResult vkb_wl_surface_extent(vkb_surface *s, VkExtent2D *e);
|
||||
/* X11 */
|
||||
extern const vkb_wsi_backend vkb_wsi_x11_backend;
|
||||
int vkb_xcb_load(void);
|
||||
VkResult vkb_xcb_surface_extent(vkb_surface *s, VkExtent2D *e);
|
||||
void *vkb_xlib_to_xcb(void *dpy);
|
||||
/* Headless */
|
||||
extern const vkb_wsi_backend vkb_wsi_headless_backend;
|
||||
|
||||
/* Helpers in wsi.c */
|
||||
uint32_t vkb_drm_format(VkFormat f);
|
||||
VkResult vkb_wsi_wait_rendering(vkb_swapchain *sc, VkQueue queue, uint32_t index, uint32_t nwait, const VkSemaphore *wait);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,558 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Wayland presentation.
|
||||
*
|
||||
* - dma-buf: swapchain images are linear exportable images; each becomes a wl_buffer through
|
||||
* zwp_linux_dmabuf_v1 once, and a present is attach + commit (no copy). This is the path for
|
||||
* gamescope (and its WSI layer, which turns X11 games' swapchains into Wayland ones).
|
||||
* - wl_shm: for compositors without dma-buf (KWin compositing in software on the desktop): the
|
||||
* frame is read back and copied into a shared-memory buffer.
|
||||
*
|
||||
* libwayland-client is opened at run time, so the driver loads in programs that never touch
|
||||
* Wayland. Our objects live on a private event queue, like Mesa's WSI.
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "wsi.h"
|
||||
#include "gen/vkb_client_gen.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <poll.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* ------------------------------------------------------------------ libwayland-client */
|
||||
|
||||
struct wl_proxy;
|
||||
struct wl_event_queue;
|
||||
struct wl_message {
|
||||
const char *name;
|
||||
const char *signature;
|
||||
const struct wl_interface **types;
|
||||
};
|
||||
struct wl_interface {
|
||||
const char *name;
|
||||
int version;
|
||||
int method_count;
|
||||
const struct wl_message *methods;
|
||||
int event_count;
|
||||
const struct wl_message *events;
|
||||
};
|
||||
|
||||
static struct {
|
||||
void *lib;
|
||||
struct wl_proxy *(*proxy_marshal_constructor)(struct wl_proxy *, uint32_t, const struct wl_interface *, ...);
|
||||
struct wl_proxy *(*proxy_marshal_constructor_versioned)(struct wl_proxy *, uint32_t, const struct wl_interface *, uint32_t, ...);
|
||||
void (*proxy_marshal)(struct wl_proxy *, uint32_t, ...);
|
||||
int (*proxy_add_listener)(struct wl_proxy *, void (**)(void), void *);
|
||||
void (*proxy_destroy)(struct wl_proxy *);
|
||||
void *(*proxy_create_wrapper)(void *);
|
||||
void (*proxy_wrapper_destroy)(void *);
|
||||
void (*proxy_set_queue)(struct wl_proxy *, struct wl_event_queue *);
|
||||
uint32_t (*proxy_get_version)(struct wl_proxy *);
|
||||
struct wl_event_queue *(*display_create_queue)(struct wl_display *);
|
||||
void (*event_queue_destroy)(struct wl_event_queue *);
|
||||
int (*display_roundtrip_queue)(struct wl_display *, struct wl_event_queue *);
|
||||
int (*display_dispatch_queue_pending)(struct wl_display *, struct wl_event_queue *);
|
||||
int (*display_prepare_read_queue)(struct wl_display *, struct wl_event_queue *);
|
||||
int (*display_read_events)(struct wl_display *);
|
||||
void (*display_cancel_read)(struct wl_display *);
|
||||
int (*display_flush)(struct wl_display *);
|
||||
int (*display_get_fd)(struct wl_display *);
|
||||
int (*display_get_error)(struct wl_display *);
|
||||
const struct wl_interface *registry_iface, *callback_iface, *buffer_iface, *shm_iface, *shm_pool_iface;
|
||||
} wl;
|
||||
|
||||
int vkb_wl_load(void)
|
||||
{
|
||||
static int state;
|
||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
pthread_mutex_lock(&lock);
|
||||
if (!state) {
|
||||
wl.lib = dlopen("libwayland-client.so.0", RTLD_NOW | RTLD_LOCAL);
|
||||
state = -1;
|
||||
if (wl.lib) {
|
||||
#define L(f, n) (*(void **)&wl.f = dlsym(wl.lib, n))
|
||||
int ok = 1;
|
||||
ok &= !!L(proxy_marshal_constructor, "wl_proxy_marshal_constructor");
|
||||
ok &= !!L(proxy_marshal_constructor_versioned, "wl_proxy_marshal_constructor_versioned");
|
||||
ok &= !!L(proxy_marshal, "wl_proxy_marshal");
|
||||
ok &= !!L(proxy_add_listener, "wl_proxy_add_listener");
|
||||
ok &= !!L(proxy_destroy, "wl_proxy_destroy");
|
||||
ok &= !!L(proxy_create_wrapper, "wl_proxy_create_wrapper");
|
||||
ok &= !!L(proxy_wrapper_destroy, "wl_proxy_wrapper_destroy");
|
||||
ok &= !!L(proxy_set_queue, "wl_proxy_set_queue");
|
||||
ok &= !!L(proxy_get_version, "wl_proxy_get_version");
|
||||
ok &= !!L(display_create_queue, "wl_display_create_queue");
|
||||
ok &= !!L(event_queue_destroy, "wl_event_queue_destroy");
|
||||
ok &= !!L(display_roundtrip_queue, "wl_display_roundtrip_queue");
|
||||
ok &= !!L(display_dispatch_queue_pending, "wl_display_dispatch_queue_pending");
|
||||
ok &= !!L(display_prepare_read_queue, "wl_display_prepare_read_queue");
|
||||
ok &= !!L(display_read_events, "wl_display_read_events");
|
||||
ok &= !!L(display_cancel_read, "wl_display_cancel_read");
|
||||
ok &= !!L(display_flush, "wl_display_flush");
|
||||
ok &= !!L(display_get_fd, "wl_display_get_fd");
|
||||
ok &= !!L(display_get_error, "wl_display_get_error");
|
||||
ok &= !!L(registry_iface, "wl_registry_interface");
|
||||
ok &= !!L(callback_iface, "wl_callback_interface");
|
||||
ok &= !!L(buffer_iface, "wl_buffer_interface");
|
||||
ok &= !!L(shm_iface, "wl_shm_interface");
|
||||
ok &= !!L(shm_pool_iface, "wl_shm_pool_interface");
|
||||
#undef L
|
||||
if (ok) state = 1;
|
||||
else VKB_ERR("libwayland-client lacks functions this driver needs");
|
||||
} else {
|
||||
VKB_WARN("no libwayland-client: %s", dlerror());
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&lock);
|
||||
return state > 0;
|
||||
}
|
||||
|
||||
/* zwp_linux_dmabuf_v1 / zwp_linux_buffer_params_v1, as wayland-scanner would emit them. */
|
||||
static const struct wl_interface params_iface;
|
||||
static const struct wl_interface *dmabuf_types[8];
|
||||
static const struct wl_message dmabuf_requests[] = {
|
||||
{"destroy", "", dmabuf_types + 0},
|
||||
{"create_params", "n", dmabuf_types + 6},
|
||||
};
|
||||
static const struct wl_message dmabuf_events[] = {
|
||||
{"format", "u", dmabuf_types + 0},
|
||||
{"modifier", "3uuu", dmabuf_types + 0},
|
||||
};
|
||||
static const struct wl_interface dmabuf_iface = {"zwp_linux_dmabuf_v1", 3, 2, dmabuf_requests, 2, dmabuf_events};
|
||||
static const struct wl_message params_requests[] = {
|
||||
{"destroy", "", dmabuf_types + 0},
|
||||
{"add", "huuuuu", dmabuf_types + 0},
|
||||
{"create", "iiuu", dmabuf_types + 0},
|
||||
{"create_immed", "2niiuu", dmabuf_types + 7},
|
||||
};
|
||||
static const struct wl_message params_events[] = {
|
||||
{"created", "n", dmabuf_types + 7},
|
||||
{"failed", "", dmabuf_types + 0},
|
||||
};
|
||||
static const struct wl_interface params_iface = {"zwp_linux_buffer_params_v1", 3, 4, params_requests, 2, params_events};
|
||||
|
||||
static void init_types(void)
|
||||
{
|
||||
/* types[0..5] stay NULL (no object arguments); [6] = params, [7] = wl_buffer */
|
||||
dmabuf_types[6] = ¶ms_iface;
|
||||
dmabuf_types[7] = wl.buffer_iface;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ per-swapchain state */
|
||||
|
||||
#define WL_DISPLAY_GET_REGISTRY 1
|
||||
#define WL_REGISTRY_BIND 0
|
||||
#define WL_SURFACE_ATTACH 1
|
||||
#define WL_SURFACE_DAMAGE 2
|
||||
#define WL_SURFACE_FRAME 3
|
||||
#define WL_SURFACE_COMMIT 6
|
||||
#define WL_SURFACE_DAMAGE_BUFFER 9
|
||||
#define WL_BUFFER_DESTROY 0
|
||||
#define WL_SHM_CREATE_POOL 0
|
||||
#define WL_SHM_POOL_CREATE_BUFFER 0
|
||||
#define WL_SHM_POOL_DESTROY 1
|
||||
#define DMABUF_DESTROY 0
|
||||
#define DMABUF_CREATE_PARAMS 1
|
||||
#define PARAMS_DESTROY 0
|
||||
#define PARAMS_ADD 1
|
||||
#define PARAMS_CREATE_IMMED 3
|
||||
#define WL_SHM_FORMAT_ARGB8888 0u
|
||||
#define WL_SHM_FORMAT_XRGB8888 1u
|
||||
#define FOURCC(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
|
||||
#define DRM_XRGB8888 FOURCC('X', 'R', '2', '4')
|
||||
#define DRM_ARGB8888 FOURCC('A', 'R', '2', '4')
|
||||
#define DRM_XBGR8888 FOURCC('X', 'B', '2', '4')
|
||||
#define DRM_ABGR8888 FOURCC('A', 'B', '2', '4')
|
||||
#define MAX_FMTS 64
|
||||
|
||||
typedef struct shm_buf {
|
||||
struct wl_proxy *buffer;
|
||||
uint8_t *ptr;
|
||||
int busy;
|
||||
} shm_buf;
|
||||
|
||||
typedef struct wl_state {
|
||||
struct wl_display *display;
|
||||
struct wl_event_queue *queue;
|
||||
void *display_wrapper;
|
||||
void *surface_wrapper;
|
||||
struct wl_proxy *registry;
|
||||
struct wl_proxy *shm;
|
||||
struct wl_proxy *dmabuf;
|
||||
uint32_t dmabuf_version;
|
||||
uint32_t shm_formats[MAX_FMTS];
|
||||
int nshm;
|
||||
struct { uint32_t format; uint64_t modifier; } dmabuf_mods[256];
|
||||
int nmods;
|
||||
uint32_t dmabuf_formats[MAX_FMTS];
|
||||
int nformats;
|
||||
struct wl_proxy **buffers; /* dma-buf wl_buffers, one per image */
|
||||
shm_buf *shm_bufs;
|
||||
int nshm_bufs;
|
||||
struct wl_proxy *shm_pool;
|
||||
uint8_t *shm_map;
|
||||
size_t shm_size;
|
||||
uint32_t shm_stride, shm_format;
|
||||
int swizzle; /* RGBA frame into an ARGB/XRGB shm buffer */
|
||||
struct wl_proxy *frame; /* pending frame callback */
|
||||
vkb_swapchain *sc;
|
||||
} wl_state;
|
||||
|
||||
static void registry_global(void *data, struct wl_proxy *reg, uint32_t name, const char *iface, uint32_t version)
|
||||
{
|
||||
wl_state *s = data;
|
||||
if (!strcmp(iface, "wl_shm") && !s->shm) {
|
||||
s->shm = wl.proxy_marshal_constructor_versioned(reg, WL_REGISTRY_BIND, wl.shm_iface, 1, name, wl.shm_iface->name, 1, NULL);
|
||||
} else if (!strcmp(iface, "zwp_linux_dmabuf_v1") && !s->dmabuf && version >= 2) {
|
||||
uint32_t v = version < 3 ? version : 3;
|
||||
s->dmabuf = wl.proxy_marshal_constructor_versioned(reg, WL_REGISTRY_BIND, &dmabuf_iface, v, name, dmabuf_iface.name, v, NULL);
|
||||
s->dmabuf_version = v;
|
||||
}
|
||||
}
|
||||
|
||||
static void registry_global_remove(void *data, struct wl_proxy *reg, uint32_t name)
|
||||
{
|
||||
(void)data;
|
||||
(void)reg;
|
||||
(void)name;
|
||||
}
|
||||
|
||||
static const void *registry_listener[] = {(void *)registry_global, (void *)registry_global_remove};
|
||||
|
||||
static void shm_format(void *data, struct wl_proxy *shm, uint32_t format)
|
||||
{
|
||||
(void)shm;
|
||||
wl_state *s = data;
|
||||
if (s->nshm < MAX_FMTS) s->shm_formats[s->nshm++] = format;
|
||||
}
|
||||
|
||||
static const void *shm_listener[] = {(void *)shm_format};
|
||||
|
||||
static void dmabuf_format(void *data, struct wl_proxy *d, uint32_t format)
|
||||
{
|
||||
(void)d;
|
||||
wl_state *s = data;
|
||||
if (s->nformats < MAX_FMTS) s->dmabuf_formats[s->nformats++] = format;
|
||||
}
|
||||
|
||||
static void dmabuf_modifier(void *data, struct wl_proxy *d, uint32_t format, uint32_t hi, uint32_t lo)
|
||||
{
|
||||
(void)d;
|
||||
wl_state *s = data;
|
||||
if (s->nmods < 256) {
|
||||
s->dmabuf_mods[s->nmods].format = format;
|
||||
s->dmabuf_mods[s->nmods].modifier = ((uint64_t)hi << 32) | lo;
|
||||
s->nmods++;
|
||||
}
|
||||
}
|
||||
|
||||
static const void *dmabuf_listener[] = {(void *)dmabuf_format, (void *)dmabuf_modifier};
|
||||
|
||||
static void buffer_release(void *data, struct wl_proxy *buffer)
|
||||
{
|
||||
(void)buffer;
|
||||
vkb_swap_image *img = data;
|
||||
pthread_mutex_lock(&img->chain->lock);
|
||||
img->busy = 0;
|
||||
pthread_mutex_unlock(&img->chain->lock);
|
||||
}
|
||||
|
||||
static const void *buffer_listener[] = {(void *)buffer_release};
|
||||
|
||||
static void shm_buffer_release(void *data, struct wl_proxy *buffer)
|
||||
{
|
||||
(void)buffer;
|
||||
((shm_buf *)data)->busy = 0;
|
||||
}
|
||||
|
||||
static const void *shm_buffer_listener[] = {(void *)shm_buffer_release};
|
||||
|
||||
static void frame_done(void *data, struct wl_proxy *cb, uint32_t t)
|
||||
{
|
||||
(void)t;
|
||||
wl_state *s = data;
|
||||
if (s->frame == cb) s->frame = NULL;
|
||||
wl.proxy_destroy(cb);
|
||||
}
|
||||
|
||||
static const void *frame_listener[] = {(void *)frame_done};
|
||||
|
||||
/* Dispatch our queue, waiting up to timeout_ns for events. -1 on a dead connection. */
|
||||
static int dispatch_timeout(wl_state *s, uint64_t timeout_ns)
|
||||
{
|
||||
if (wl.display_dispatch_queue_pending(s->display, s->queue) < 0) return -1;
|
||||
while (wl.display_prepare_read_queue(s->display, s->queue) != 0) {
|
||||
if (wl.display_dispatch_queue_pending(s->display, s->queue) < 0) return -1;
|
||||
}
|
||||
if (wl.display_flush(s->display) < 0 && errno != EAGAIN) {
|
||||
wl.display_cancel_read(s->display);
|
||||
return -1;
|
||||
}
|
||||
struct pollfd p = {wl.display_get_fd(s->display), POLLIN, 0};
|
||||
int ms = timeout_ns == UINT64_MAX ? -1 : (int)((timeout_ns + 999999) / 1000000);
|
||||
int r = poll(&p, 1, ms);
|
||||
if (r <= 0) {
|
||||
wl.display_cancel_read(s->display);
|
||||
return r < 0 && errno != EINTR ? -1 : 0;
|
||||
}
|
||||
if (wl.display_read_events(s->display) < 0) return -1;
|
||||
return wl.display_dispatch_queue_pending(s->display, s->queue) < 0 ? -1 : 1;
|
||||
}
|
||||
|
||||
static int has_u32(const uint32_t *a, int n, uint32_t v)
|
||||
{
|
||||
for (int i = 0; i < n; i++)
|
||||
if (a[i] == v) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dmabuf_supports(wl_state *s, uint32_t fourcc, uint64_t modifier)
|
||||
{
|
||||
if (s->nmods) {
|
||||
for (int i = 0; i < s->nmods; i++) {
|
||||
/* DRM_FORMAT_MOD_INVALID means "implicit": treat as linear for our linear buffers. */
|
||||
if (s->dmabuf_mods[i].format == fourcc &&
|
||||
(s->dmabuf_mods[i].modifier == modifier || s->dmabuf_mods[i].modifier == 0x00ffffffffffffffull))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return has_u32(s->dmabuf_formats, s->nformats, fourcc);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ backend */
|
||||
|
||||
VkResult vkb_wl_surface_extent(vkb_surface *s, VkExtent2D *e)
|
||||
{
|
||||
(void)s;
|
||||
e->width = e->height = 0xFFFFFFFFu;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static void wl_teardown(wl_state *s);
|
||||
|
||||
static VkResult wl_init(vkb_swapchain *sc)
|
||||
{
|
||||
vkb_surface *surface = sc->surface;
|
||||
wl_state *s = calloc(1, sizeof(*s));
|
||||
sc->bdata = s;
|
||||
s->sc = sc;
|
||||
s->display = surface->wl_display;
|
||||
init_types();
|
||||
s->queue = wl.display_create_queue(s->display);
|
||||
s->display_wrapper = wl.proxy_create_wrapper(s->display);
|
||||
wl.proxy_set_queue(s->display_wrapper, s->queue);
|
||||
s->surface_wrapper = wl.proxy_create_wrapper(surface->wl_surface);
|
||||
wl.proxy_set_queue(s->surface_wrapper, s->queue);
|
||||
s->registry = wl.proxy_marshal_constructor(s->display_wrapper, WL_DISPLAY_GET_REGISTRY, wl.registry_iface, NULL);
|
||||
wl.proxy_add_listener(s->registry, (void (**)(void))registry_listener, s);
|
||||
if (wl.display_roundtrip_queue(s->display, s->queue) < 0) return VK_ERROR_SURFACE_LOST_KHR;
|
||||
if (s->shm) wl.proxy_add_listener(s->shm, (void (**)(void))shm_listener, s);
|
||||
if (s->dmabuf) wl.proxy_add_listener(s->dmabuf, (void (**)(void))dmabuf_listener, s);
|
||||
if (wl.display_roundtrip_queue(s->display, s->queue) < 0) return VK_ERROR_SURFACE_LOST_KHR;
|
||||
|
||||
uint32_t w = sc->info.imageExtent.width, h = sc->info.imageExtent.height;
|
||||
int opaque = sc->info.compositeAlpha == VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
||||
int rgba = sc->info.imageFormat == VK_FORMAT_R8G8B8A8_UNORM || sc->info.imageFormat == VK_FORMAT_R8G8B8A8_SRGB;
|
||||
if (!sc->copy_present) {
|
||||
if (!s->dmabuf) {
|
||||
VKB_INFO("Wayland: the compositor has no zwp_linux_dmabuf_v1");
|
||||
return VK_ERROR_FEATURE_NOT_PRESENT;
|
||||
}
|
||||
uint32_t fourcc = rgba ? (opaque ? DRM_XBGR8888 : DRM_ABGR8888) : (opaque ? DRM_XRGB8888 : DRM_ARGB8888);
|
||||
uint64_t mod = sc->images[0].modifier;
|
||||
if (!dmabuf_supports(s, fourcc, mod)) {
|
||||
uint32_t alt = rgba ? DRM_ABGR8888 : DRM_ARGB8888;
|
||||
if (!dmabuf_supports(s, alt, mod)) {
|
||||
VKB_INFO("Wayland: the compositor takes no %.4s dma-buf with modifier 0x%llx", (char *)&fourcc, (unsigned long long)mod);
|
||||
return VK_ERROR_FORMAT_NOT_SUPPORTED;
|
||||
}
|
||||
fourcc = alt;
|
||||
}
|
||||
s->buffers = calloc(sc->count, sizeof(*s->buffers));
|
||||
for (uint32_t i = 0; i < sc->count; i++) {
|
||||
vkb_swap_image *img = &sc->images[i];
|
||||
struct wl_proxy *params = wl.proxy_marshal_constructor(s->dmabuf, DMABUF_CREATE_PARAMS, ¶ms_iface, NULL);
|
||||
wl.proxy_marshal(params, PARAMS_ADD, img->dmabuf_fd, 0u, img->offset, img->stride, (uint32_t)(img->modifier >> 32),
|
||||
(uint32_t)(img->modifier & 0xffffffffu));
|
||||
s->buffers[i] = wl.proxy_marshal_constructor(params, PARAMS_CREATE_IMMED, wl.buffer_iface, NULL, (int32_t)w, (int32_t)h, fourcc, 0u);
|
||||
wl.proxy_marshal(params, PARAMS_DESTROY);
|
||||
wl.proxy_destroy(params);
|
||||
wl.proxy_add_listener(s->buffers[i], (void (**)(void))buffer_listener, img);
|
||||
}
|
||||
if (wl.display_roundtrip_queue(s->display, s->queue) < 0 || wl.display_get_error(s->display)) {
|
||||
VKB_ERR("Wayland: the compositor refused the dma-bufs");
|
||||
return VK_ERROR_SURFACE_LOST_KHR;
|
||||
}
|
||||
VKB_INFO("Wayland: %u dma-buf buffers %ux%u %.4s, stride %u, modifier 0x%llx", sc->count, w, h, (char *)&fourcc,
|
||||
sc->images[0].stride, (unsigned long long)sc->images[0].modifier);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
if (!s->shm) {
|
||||
VKB_ERR("Wayland: the compositor offers neither dma-buf nor wl_shm");
|
||||
return VK_ERROR_SURFACE_LOST_KHR;
|
||||
}
|
||||
uint32_t fmt;
|
||||
if (rgba && has_u32(s->shm_formats, s->nshm, opaque ? DRM_XBGR8888 : DRM_ABGR8888)) {
|
||||
fmt = opaque ? DRM_XBGR8888 : DRM_ABGR8888;
|
||||
} else {
|
||||
fmt = opaque ? WL_SHM_FORMAT_XRGB8888 : WL_SHM_FORMAT_ARGB8888;
|
||||
s->swizzle = rgba;
|
||||
}
|
||||
s->shm_format = fmt;
|
||||
s->shm_stride = w * 4;
|
||||
s->nshm_bufs = (int)sc->count + 1;
|
||||
size_t one = (size_t)s->shm_stride * h;
|
||||
s->shm_size = one * (size_t)s->nshm_bufs;
|
||||
int fd = vkb_memfd("vkbridge-wl-shm", s->shm_size);
|
||||
if (fd < 0) return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
s->shm_map = mmap(NULL, s->shm_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (s->shm_map == MAP_FAILED) {
|
||||
s->shm_map = NULL;
|
||||
close(fd);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
s->shm_pool = wl.proxy_marshal_constructor(s->shm, WL_SHM_CREATE_POOL, wl.shm_pool_iface, NULL, fd, (int32_t)s->shm_size);
|
||||
close(fd);
|
||||
s->shm_bufs = calloc((size_t)s->nshm_bufs, sizeof(shm_buf));
|
||||
for (int i = 0; i < s->nshm_bufs; i++) {
|
||||
s->shm_bufs[i].ptr = s->shm_map + one * (size_t)i;
|
||||
s->shm_bufs[i].buffer = wl.proxy_marshal_constructor(s->shm_pool, WL_SHM_POOL_CREATE_BUFFER, wl.buffer_iface, NULL,
|
||||
(int32_t)(one * (size_t)i), (int32_t)w, (int32_t)h, (int32_t)s->shm_stride, fmt);
|
||||
wl.proxy_add_listener(s->shm_bufs[i].buffer, (void (**)(void))shm_buffer_listener, &s->shm_bufs[i]);
|
||||
}
|
||||
VKB_INFO("Wayland: presenting %ux%u through wl_shm (format 0x%x%s)", w, h, fmt, s->swizzle ? ", swizzled" : "");
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static void copy_frame(wl_state *s, const uint8_t *src, uint8_t *dst, uint32_t w, uint32_t h)
|
||||
{
|
||||
size_t row = (size_t)w * 4;
|
||||
if (!s->swizzle) {
|
||||
memcpy(dst, src, row * h);
|
||||
return;
|
||||
}
|
||||
for (size_t i = 0; i < (size_t)w * h; i++) {
|
||||
dst[i * 4 + 0] = src[i * 4 + 2];
|
||||
dst[i * 4 + 1] = src[i * 4 + 1];
|
||||
dst[i * 4 + 2] = src[i * 4 + 0];
|
||||
dst[i * 4 + 3] = src[i * 4 + 3];
|
||||
}
|
||||
}
|
||||
|
||||
static VkResult wl_present(vkb_swapchain *sc, uint32_t index, const VkPresentRegionKHR *region)
|
||||
{
|
||||
wl_state *s = sc->bdata;
|
||||
uint32_t w = sc->info.imageExtent.width, h = sc->info.imageExtent.height;
|
||||
if (wl.display_get_error(s->display)) return VK_ERROR_SURFACE_LOST_KHR;
|
||||
/* FIFO: one frame per compositor frame callback (bounded, so a hidden window cannot hang
|
||||
* the game forever). */
|
||||
if (sc->info.presentMode == VK_PRESENT_MODE_FIFO_KHR || sc->info.presentMode == VK_PRESENT_MODE_FIFO_RELAXED_KHR) {
|
||||
struct timespec t0;
|
||||
clock_gettime(CLOCK_MONOTONIC, &t0);
|
||||
while (s->frame) {
|
||||
if (dispatch_timeout(s, 20000000ull) < 0) return VK_ERROR_SURFACE_LOST_KHR;
|
||||
struct timespec t1;
|
||||
clock_gettime(CLOCK_MONOTONIC, &t1);
|
||||
if ((t1.tv_sec - t0.tv_sec) * 1000 + (t1.tv_nsec - t0.tv_nsec) / 1000000 > 250) break;
|
||||
}
|
||||
}
|
||||
struct wl_proxy *buffer;
|
||||
if (!sc->copy_present) {
|
||||
buffer = s->buffers[index];
|
||||
} else {
|
||||
shm_buf *b = NULL;
|
||||
for (int tries = 0; !b && tries < 50; tries++) {
|
||||
for (int i = 0; i < s->nshm_bufs; i++)
|
||||
if (!s->shm_bufs[i].busy) {
|
||||
b = &s->shm_bufs[i];
|
||||
break;
|
||||
}
|
||||
if (!b && dispatch_timeout(s, 10000000ull) < 0) return VK_ERROR_SURFACE_LOST_KHR;
|
||||
}
|
||||
if (!b) return VK_SUCCESS; /* compositor holds every buffer: drop this frame */
|
||||
copy_frame(s, sc->staging_ptr, b->ptr, w, h);
|
||||
b->busy = 1;
|
||||
buffer = b->buffer;
|
||||
}
|
||||
if (sc->info.presentMode == VK_PRESENT_MODE_FIFO_KHR || sc->info.presentMode == VK_PRESENT_MODE_FIFO_RELAXED_KHR) {
|
||||
if (s->frame) wl.proxy_destroy(s->frame);
|
||||
s->frame = wl.proxy_marshal_constructor(s->surface_wrapper, WL_SURFACE_FRAME, wl.callback_iface, NULL);
|
||||
wl.proxy_add_listener(s->frame, (void (**)(void))frame_listener, s);
|
||||
}
|
||||
wl.proxy_marshal(s->surface_wrapper, WL_SURFACE_ATTACH, buffer, 0, 0);
|
||||
int v4 = wl.proxy_get_version(s->surface_wrapper) >= 4;
|
||||
if (region && region->rectangleCount && region->pRectangles) {
|
||||
for (uint32_t i = 0; i < region->rectangleCount; i++) {
|
||||
const VkRectLayerKHR *r = ®ion->pRectangles[i];
|
||||
wl.proxy_marshal(s->surface_wrapper, v4 ? WL_SURFACE_DAMAGE_BUFFER : WL_SURFACE_DAMAGE, r->offset.x, r->offset.y,
|
||||
(int32_t)r->extent.width, (int32_t)r->extent.height);
|
||||
}
|
||||
} else {
|
||||
wl.proxy_marshal(s->surface_wrapper, v4 ? WL_SURFACE_DAMAGE_BUFFER : WL_SURFACE_DAMAGE, 0, 0, (int32_t)w, (int32_t)h);
|
||||
}
|
||||
wl.proxy_marshal(s->surface_wrapper, WL_SURFACE_COMMIT);
|
||||
wl.display_flush(s->display);
|
||||
if (wl.display_dispatch_queue_pending(s->display, s->queue) < 0) return VK_ERROR_SURFACE_LOST_KHR;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult wl_wait_free(vkb_swapchain *sc, uint64_t timeout_ns)
|
||||
{
|
||||
wl_state *s = sc->bdata;
|
||||
int r = dispatch_timeout(s, timeout_ns);
|
||||
if (r < 0) return VK_ERROR_SURFACE_LOST_KHR;
|
||||
return r == 0 ? VK_TIMEOUT : VK_SUCCESS;
|
||||
}
|
||||
|
||||
static void wl_teardown(wl_state *s)
|
||||
{
|
||||
if (!s) return;
|
||||
vkb_swapchain *sc = s->sc;
|
||||
if (s->frame) wl.proxy_destroy(s->frame);
|
||||
if (s->buffers) {
|
||||
for (uint32_t i = 0; i < sc->count; i++)
|
||||
if (s->buffers[i]) {
|
||||
wl.proxy_marshal(s->buffers[i], WL_BUFFER_DESTROY);
|
||||
wl.proxy_destroy(s->buffers[i]);
|
||||
}
|
||||
free(s->buffers);
|
||||
}
|
||||
if (s->shm_bufs) {
|
||||
for (int i = 0; i < s->nshm_bufs; i++)
|
||||
if (s->shm_bufs[i].buffer) {
|
||||
wl.proxy_marshal(s->shm_bufs[i].buffer, WL_BUFFER_DESTROY);
|
||||
wl.proxy_destroy(s->shm_bufs[i].buffer);
|
||||
}
|
||||
free(s->shm_bufs);
|
||||
}
|
||||
if (s->shm_pool) {
|
||||
wl.proxy_marshal(s->shm_pool, WL_SHM_POOL_DESTROY);
|
||||
wl.proxy_destroy(s->shm_pool);
|
||||
}
|
||||
if (s->shm_map) munmap(s->shm_map, s->shm_size);
|
||||
if (s->dmabuf) {
|
||||
wl.proxy_marshal(s->dmabuf, DMABUF_DESTROY);
|
||||
wl.proxy_destroy(s->dmabuf);
|
||||
}
|
||||
if (s->shm) wl.proxy_destroy(s->shm);
|
||||
if (s->registry) wl.proxy_destroy(s->registry);
|
||||
if (s->surface_wrapper) wl.proxy_wrapper_destroy(s->surface_wrapper);
|
||||
if (s->display_wrapper) wl.proxy_wrapper_destroy(s->display_wrapper);
|
||||
if (s->display) wl.display_flush(s->display);
|
||||
if (s->queue) wl.event_queue_destroy(s->queue);
|
||||
free(s);
|
||||
}
|
||||
|
||||
static void wl_destroy(vkb_swapchain *sc)
|
||||
{
|
||||
wl_teardown(sc->bdata);
|
||||
sc->bdata = NULL;
|
||||
}
|
||||
|
||||
const vkb_wsi_backend vkb_wsi_wayland_backend = {wl_init, wl_present, wl_wait_free, wl_destroy};
|
||||
@@ -0,0 +1,162 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* X11 presentation, software path: the frame is read back and drawn with PutImage. Used only
|
||||
* when nothing better exists - under gamescope its WSI layer turns X11 swapchains into Wayland
|
||||
* ones before they reach this driver. libxcb (and libX11-xcb for Xlib surfaces) is opened at
|
||||
* run time.
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "wsi.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <string.h>
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
static struct {
|
||||
void *lib, *x11xcb;
|
||||
xcb_get_geometry_cookie_t (*get_geometry)(xcb_connection_t *, xcb_drawable_t);
|
||||
xcb_get_geometry_reply_t *(*get_geometry_reply)(xcb_connection_t *, xcb_get_geometry_cookie_t, xcb_generic_error_t **);
|
||||
xcb_void_cookie_t (*put_image)(xcb_connection_t *, uint8_t, xcb_drawable_t, xcb_gcontext_t, uint16_t, uint16_t, int16_t, int16_t,
|
||||
uint8_t, uint8_t, uint32_t, const uint8_t *);
|
||||
xcb_void_cookie_t (*create_gc)(xcb_connection_t *, xcb_gcontext_t, xcb_drawable_t, uint32_t, const void *);
|
||||
xcb_void_cookie_t (*free_gc)(xcb_connection_t *, xcb_gcontext_t);
|
||||
uint32_t (*generate_id)(xcb_connection_t *);
|
||||
uint32_t (*get_maximum_request_length)(xcb_connection_t *);
|
||||
int (*flush)(xcb_connection_t *);
|
||||
int (*connection_has_error)(xcb_connection_t *);
|
||||
xcb_connection_t *(*xlib_get_xcb)(void *);
|
||||
} x;
|
||||
|
||||
int vkb_xcb_load(void)
|
||||
{
|
||||
static int state;
|
||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
pthread_mutex_lock(&lock);
|
||||
if (!state) {
|
||||
state = -1;
|
||||
x.lib = dlopen("libxcb.so.1", RTLD_NOW | RTLD_LOCAL);
|
||||
if (x.lib) {
|
||||
#define L(f, n) (*(void **)&x.f = dlsym(x.lib, n))
|
||||
int ok = 1;
|
||||
ok &= !!L(get_geometry, "xcb_get_geometry");
|
||||
ok &= !!L(get_geometry_reply, "xcb_get_geometry_reply");
|
||||
ok &= !!L(put_image, "xcb_put_image");
|
||||
ok &= !!L(create_gc, "xcb_create_gc");
|
||||
ok &= !!L(free_gc, "xcb_free_gc");
|
||||
ok &= !!L(generate_id, "xcb_generate_id");
|
||||
ok &= !!L(get_maximum_request_length, "xcb_get_maximum_request_length");
|
||||
ok &= !!L(flush, "xcb_flush");
|
||||
ok &= !!L(connection_has_error, "xcb_connection_has_error");
|
||||
#undef L
|
||||
if (ok) state = 1;
|
||||
}
|
||||
x.x11xcb = dlopen("libX11-xcb.so.1", RTLD_NOW | RTLD_LOCAL);
|
||||
if (x.x11xcb) *(void **)&x.xlib_get_xcb = dlsym(x.x11xcb, "XGetXCBConnection");
|
||||
if (state < 0) VKB_WARN("no usable libxcb: X11 presentation unavailable");
|
||||
}
|
||||
pthread_mutex_unlock(&lock);
|
||||
return state > 0;
|
||||
}
|
||||
|
||||
void *vkb_xlib_to_xcb(void *dpy)
|
||||
{
|
||||
if (!vkb_xcb_load() || !x.xlib_get_xcb) return NULL;
|
||||
return x.xlib_get_xcb(dpy);
|
||||
}
|
||||
|
||||
static int geometry(vkb_surface *s, uint32_t *w, uint32_t *h, uint8_t *depth)
|
||||
{
|
||||
xcb_get_geometry_reply_t *g = x.get_geometry_reply(s->xcb_conn, x.get_geometry(s->xcb_conn, s->xcb_window), NULL);
|
||||
if (!g) return 0;
|
||||
*w = g->width;
|
||||
*h = g->height;
|
||||
if (depth) *depth = g->depth;
|
||||
free(g);
|
||||
return 1;
|
||||
}
|
||||
|
||||
VkResult vkb_xcb_surface_extent(vkb_surface *s, VkExtent2D *e)
|
||||
{
|
||||
uint32_t w, h;
|
||||
if (!geometry(s, &w, &h, NULL)) return VK_ERROR_SURFACE_LOST_KHR;
|
||||
e->width = w;
|
||||
e->height = h;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
typedef struct x11_state {
|
||||
xcb_gcontext_t gc;
|
||||
uint8_t depth;
|
||||
uint8_t *swz;
|
||||
} x11_state;
|
||||
|
||||
static VkResult x11_init(vkb_swapchain *sc)
|
||||
{
|
||||
vkb_surface *s = sc->surface;
|
||||
x11_state *st = calloc(1, sizeof(*st));
|
||||
sc->bdata = st;
|
||||
uint32_t w, h;
|
||||
if (!geometry(s, &w, &h, &st->depth)) return VK_ERROR_SURFACE_LOST_KHR;
|
||||
if (st->depth != 24 && st->depth != 32) {
|
||||
VKB_ERR("X11: window depth %u is not supported by the software present path", st->depth);
|
||||
return VK_ERROR_SURFACE_LOST_KHR;
|
||||
}
|
||||
st->gc = x.generate_id(s->xcb_conn);
|
||||
x.create_gc(s->xcb_conn, st->gc, s->xcb_window, 0, NULL);
|
||||
VKB_INFO("X11: presenting %ux%u by PutImage (software path)", sc->info.imageExtent.width, sc->info.imageExtent.height);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult x11_present(vkb_swapchain *sc, uint32_t index, const VkPresentRegionKHR *region)
|
||||
{
|
||||
(void)index;
|
||||
(void)region;
|
||||
vkb_surface *s = sc->surface;
|
||||
x11_state *st = sc->bdata;
|
||||
if (x.connection_has_error(s->xcb_conn)) return VK_ERROR_SURFACE_LOST_KHR;
|
||||
uint32_t w = sc->info.imageExtent.width, h = sc->info.imageExtent.height;
|
||||
const uint8_t *src = sc->staging_ptr;
|
||||
int rgba = sc->info.imageFormat == VK_FORMAT_R8G8B8A8_UNORM || sc->info.imageFormat == VK_FORMAT_R8G8B8A8_SRGB;
|
||||
if (rgba) {
|
||||
if (!st->swz) st->swz = malloc((size_t)w * h * 4);
|
||||
for (size_t i = 0; i < (size_t)w * h; i++) {
|
||||
st->swz[i * 4 + 0] = src[i * 4 + 2];
|
||||
st->swz[i * 4 + 1] = src[i * 4 + 1];
|
||||
st->swz[i * 4 + 2] = src[i * 4 + 0];
|
||||
st->swz[i * 4 + 3] = src[i * 4 + 3];
|
||||
}
|
||||
src = st->swz;
|
||||
}
|
||||
/* Split into requests that fit the server's maximum request length (in 4-byte units). */
|
||||
size_t max = (size_t)x.get_maximum_request_length(s->xcb_conn) * 4;
|
||||
size_t row = (size_t)w * 4;
|
||||
uint32_t rows = max > 64 + row ? (uint32_t)((max - 64) / row) : 1;
|
||||
for (uint32_t y = 0; y < h; y += rows) {
|
||||
uint32_t n = h - y < rows ? h - y : rows;
|
||||
x.put_image(s->xcb_conn, XCB_IMAGE_FORMAT_Z_PIXMAP, s->xcb_window, st->gc, (uint16_t)w, (uint16_t)n, 0, (int16_t)y, 0, st->depth,
|
||||
(uint32_t)(row * n), src + row * y);
|
||||
}
|
||||
x.flush(s->xcb_conn);
|
||||
uint32_t cw, ch;
|
||||
if (geometry(s, &cw, &ch, NULL) && (cw != w || ch != h)) sc->status = VK_SUBOPTIMAL_KHR;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult x11_wait_free(vkb_swapchain *sc, uint64_t timeout_ns)
|
||||
{
|
||||
(void)sc;
|
||||
(void)timeout_ns;
|
||||
return VK_TIMEOUT; /* images are free as soon as their present returns */
|
||||
}
|
||||
|
||||
static void x11_destroy(vkb_swapchain *sc)
|
||||
{
|
||||
x11_state *st = sc->bdata;
|
||||
if (!st) return;
|
||||
if (st->gc) x.free_gc(sc->surface->xcb_conn, st->gc);
|
||||
free(st->swz);
|
||||
free(st);
|
||||
sc->bdata = NULL;
|
||||
}
|
||||
|
||||
const vkb_wsi_backend vkb_wsi_x11_backend = {x11_init, x11_present, x11_wait_free, x11_destroy};
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,397 @@
|
||||
/* Generated by tools/vkbridge/codegen/gen_vkbridge.py from vk.xml 1.3.247 - do not edit. */
|
||||
|
||||
#ifndef VKB_CLIENT_GEN_H
|
||||
#define VKB_CLIENT_GEN_H
|
||||
#include "vkb_gen.h"
|
||||
VkResult vkb_wire_vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers);
|
||||
VkResult vkb_wire_vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets);
|
||||
VkResult vkb_wire_vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory);
|
||||
VkResult vkb_wire_vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo);
|
||||
VkResult vkb_wire_vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset);
|
||||
VkResult vkb_wire_vkBindBufferMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos);
|
||||
VkResult vkb_wire_vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset);
|
||||
VkResult vkb_wire_vkBindImageMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo* pBindInfos);
|
||||
void vkb_wire_vkCmdBeginConditionalRenderingEXT(VkCommandBuffer commandBuffer, const VkConditionalRenderingBeginInfoEXT* pConditionalRenderingBegin);
|
||||
void vkb_wire_vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags);
|
||||
void vkb_wire_vkCmdBeginQueryIndexedEXT(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags, uint32_t index);
|
||||
void vkb_wire_vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents);
|
||||
void vkb_wire_vkCmdBeginRenderPass2(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, const VkSubpassBeginInfo* pSubpassBeginInfo);
|
||||
void vkb_wire_vkCmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo);
|
||||
void vkb_wire_vkCmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer, uint32_t counterBufferCount, const VkBuffer* pCounterBuffers, const VkDeviceSize* pCounterBufferOffsets);
|
||||
void vkb_wire_vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets);
|
||||
void vkb_wire_vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType);
|
||||
void vkb_wire_vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline);
|
||||
void vkb_wire_vkCmdBindTransformFeedbackBuffersEXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes);
|
||||
void vkb_wire_vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets);
|
||||
void vkb_wire_vkCmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes, const VkDeviceSize* pStrides);
|
||||
void vkb_wire_vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter);
|
||||
void vkb_wire_vkCmdBlitImage2(VkCommandBuffer commandBuffer, const VkBlitImageInfo2* pBlitImageInfo);
|
||||
void vkb_wire_vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects);
|
||||
void vkb_wire_vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
|
||||
void vkb_wire_vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
|
||||
void vkb_wire_vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions);
|
||||
void vkb_wire_vkCmdCopyBuffer2(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2* pCopyBufferInfo);
|
||||
void vkb_wire_vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions);
|
||||
void vkb_wire_vkCmdCopyBufferToImage2(VkCommandBuffer commandBuffer, const VkCopyBufferToImageInfo2* pCopyBufferToImageInfo);
|
||||
void vkb_wire_vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions);
|
||||
void vkb_wire_vkCmdCopyImage2(VkCommandBuffer commandBuffer, const VkCopyImageInfo2* pCopyImageInfo);
|
||||
void vkb_wire_vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions);
|
||||
void vkb_wire_vkCmdCopyImageToBuffer2(VkCommandBuffer commandBuffer, const VkCopyImageToBufferInfo2* pCopyImageToBufferInfo);
|
||||
void vkb_wire_vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags);
|
||||
void vkb_wire_vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ);
|
||||
void vkb_wire_vkCmdDispatchBase(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ);
|
||||
void vkb_wire_vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset);
|
||||
void vkb_wire_vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance);
|
||||
void vkb_wire_vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance);
|
||||
void vkb_wire_vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride);
|
||||
void vkb_wire_vkCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride);
|
||||
void vkb_wire_vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride);
|
||||
void vkb_wire_vkCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount, uint32_t firstInstance, VkBuffer counterBuffer, VkDeviceSize counterBufferOffset, uint32_t counterOffset, uint32_t vertexStride);
|
||||
void vkb_wire_vkCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride);
|
||||
void vkb_wire_vkCmdDrawMultiEXT(VkCommandBuffer commandBuffer, uint32_t drawCount, const VkMultiDrawInfoEXT* pVertexInfo, uint32_t instanceCount, uint32_t firstInstance, uint32_t stride);
|
||||
void vkb_wire_vkCmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer, uint32_t drawCount, const VkMultiDrawIndexedInfoEXT* pIndexInfo, uint32_t instanceCount, uint32_t firstInstance, uint32_t stride, const int32_t* pVertexOffset);
|
||||
void vkb_wire_vkCmdEndConditionalRenderingEXT(VkCommandBuffer commandBuffer);
|
||||
void vkb_wire_vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query);
|
||||
void vkb_wire_vkCmdEndQueryIndexedEXT(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, uint32_t index);
|
||||
void vkb_wire_vkCmdEndRenderPass(VkCommandBuffer commandBuffer);
|
||||
void vkb_wire_vkCmdEndRenderPass2(VkCommandBuffer commandBuffer, const VkSubpassEndInfo* pSubpassEndInfo);
|
||||
void vkb_wire_vkCmdEndRendering(VkCommandBuffer commandBuffer);
|
||||
void vkb_wire_vkCmdEndTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer, uint32_t counterBufferCount, const VkBuffer* pCounterBuffers, const VkDeviceSize* pCounterBufferOffsets);
|
||||
void vkb_wire_vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers);
|
||||
void vkb_wire_vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data);
|
||||
void vkb_wire_vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents);
|
||||
void vkb_wire_vkCmdNextSubpass2(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo* pSubpassBeginInfo, const VkSubpassEndInfo* pSubpassEndInfo);
|
||||
void vkb_wire_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers);
|
||||
void vkb_wire_vkCmdPipelineBarrier2(VkCommandBuffer commandBuffer, const VkDependencyInfo* pDependencyInfo);
|
||||
void vkb_wire_vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues);
|
||||
void vkb_wire_vkCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites);
|
||||
void vkb_wire_vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask);
|
||||
void vkb_wire_vkCmdResetEvent2(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags2 stageMask);
|
||||
void vkb_wire_vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount);
|
||||
void vkb_wire_vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions);
|
||||
void vkb_wire_vkCmdResolveImage2(VkCommandBuffer commandBuffer, const VkResolveImageInfo2* pResolveImageInfo);
|
||||
void vkb_wire_vkCmdSetAlphaToCoverageEnableEXT(VkCommandBuffer commandBuffer, VkBool32 alphaToCoverageEnable);
|
||||
void vkb_wire_vkCmdSetAlphaToOneEnableEXT(VkCommandBuffer commandBuffer, VkBool32 alphaToOneEnable);
|
||||
void vkb_wire_vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]);
|
||||
void vkb_wire_vkCmdSetColorBlendAdvancedEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorBlendAdvancedEXT* pColorBlendAdvanced);
|
||||
void vkb_wire_vkCmdSetColorBlendEnableEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkBool32* pColorBlendEnables);
|
||||
void vkb_wire_vkCmdSetColorBlendEquationEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorBlendEquationEXT* pColorBlendEquations);
|
||||
void vkb_wire_vkCmdSetColorWriteEnableEXT(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkBool32* pColorWriteEnables);
|
||||
void vkb_wire_vkCmdSetColorWriteMaskEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorComponentFlags* pColorWriteMasks);
|
||||
void vkb_wire_vkCmdSetConservativeRasterizationModeEXT(VkCommandBuffer commandBuffer, VkConservativeRasterizationModeEXT conservativeRasterizationMode);
|
||||
void vkb_wire_vkCmdSetCoverageModulationModeNV(VkCommandBuffer commandBuffer, VkCoverageModulationModeNV coverageModulationMode);
|
||||
void vkb_wire_vkCmdSetCoverageModulationTableEnableNV(VkCommandBuffer commandBuffer, VkBool32 coverageModulationTableEnable);
|
||||
void vkb_wire_vkCmdSetCoverageModulationTableNV(VkCommandBuffer commandBuffer, uint32_t coverageModulationTableCount, const float* pCoverageModulationTable);
|
||||
void vkb_wire_vkCmdSetCoverageReductionModeNV(VkCommandBuffer commandBuffer, VkCoverageReductionModeNV coverageReductionMode);
|
||||
void vkb_wire_vkCmdSetCoverageToColorEnableNV(VkCommandBuffer commandBuffer, VkBool32 coverageToColorEnable);
|
||||
void vkb_wire_vkCmdSetCoverageToColorLocationNV(VkCommandBuffer commandBuffer, uint32_t coverageToColorLocation);
|
||||
void vkb_wire_vkCmdSetCullMode(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode);
|
||||
void vkb_wire_vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor);
|
||||
void vkb_wire_vkCmdSetDepthBiasEnable(VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable);
|
||||
void vkb_wire_vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds);
|
||||
void vkb_wire_vkCmdSetDepthBoundsTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthBoundsTestEnable);
|
||||
void vkb_wire_vkCmdSetDepthClampEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthClampEnable);
|
||||
void vkb_wire_vkCmdSetDepthClipEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthClipEnable);
|
||||
void vkb_wire_vkCmdSetDepthClipNegativeOneToOneEXT(VkCommandBuffer commandBuffer, VkBool32 negativeOneToOne);
|
||||
void vkb_wire_vkCmdSetDepthCompareOp(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp);
|
||||
void vkb_wire_vkCmdSetDepthTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable);
|
||||
void vkb_wire_vkCmdSetDepthWriteEnable(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable);
|
||||
void vkb_wire_vkCmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask);
|
||||
void vkb_wire_vkCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D* pDiscardRectangles);
|
||||
void vkb_wire_vkCmdSetDiscardRectangleEnableEXT(VkCommandBuffer commandBuffer, VkBool32 discardRectangleEnable);
|
||||
void vkb_wire_vkCmdSetDiscardRectangleModeEXT(VkCommandBuffer commandBuffer, VkDiscardRectangleModeEXT discardRectangleMode);
|
||||
void vkb_wire_vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask);
|
||||
void vkb_wire_vkCmdSetEvent2(VkCommandBuffer commandBuffer, VkEvent event, const VkDependencyInfo* pDependencyInfo);
|
||||
void vkb_wire_vkCmdSetExtraPrimitiveOverestimationSizeEXT(VkCommandBuffer commandBuffer, float extraPrimitiveOverestimationSize);
|
||||
void vkb_wire_vkCmdSetFragmentShadingRateKHR(VkCommandBuffer commandBuffer, const VkExtent2D* pFragmentSize, const VkFragmentShadingRateCombinerOpKHR combinerOps[2]);
|
||||
void vkb_wire_vkCmdSetFrontFace(VkCommandBuffer commandBuffer, VkFrontFace frontFace);
|
||||
void vkb_wire_vkCmdSetLineRasterizationModeEXT(VkCommandBuffer commandBuffer, VkLineRasterizationModeEXT lineRasterizationMode);
|
||||
void vkb_wire_vkCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, uint16_t lineStipplePattern);
|
||||
void vkb_wire_vkCmdSetLineStippleEnableEXT(VkCommandBuffer commandBuffer, VkBool32 stippledLineEnable);
|
||||
void vkb_wire_vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth);
|
||||
void vkb_wire_vkCmdSetLogicOpEXT(VkCommandBuffer commandBuffer, VkLogicOp logicOp);
|
||||
void vkb_wire_vkCmdSetLogicOpEnableEXT(VkCommandBuffer commandBuffer, VkBool32 logicOpEnable);
|
||||
void vkb_wire_vkCmdSetPatchControlPointsEXT(VkCommandBuffer commandBuffer, uint32_t patchControlPoints);
|
||||
void vkb_wire_vkCmdSetPolygonModeEXT(VkCommandBuffer commandBuffer, VkPolygonMode polygonMode);
|
||||
void vkb_wire_vkCmdSetPrimitiveRestartEnable(VkCommandBuffer commandBuffer, VkBool32 primitiveRestartEnable);
|
||||
void vkb_wire_vkCmdSetPrimitiveTopology(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology);
|
||||
void vkb_wire_vkCmdSetProvokingVertexModeEXT(VkCommandBuffer commandBuffer, VkProvokingVertexModeEXT provokingVertexMode);
|
||||
void vkb_wire_vkCmdSetRasterizationSamplesEXT(VkCommandBuffer commandBuffer, VkSampleCountFlagBits rasterizationSamples);
|
||||
void vkb_wire_vkCmdSetRasterizationStreamEXT(VkCommandBuffer commandBuffer, uint32_t rasterizationStream);
|
||||
void vkb_wire_vkCmdSetRasterizerDiscardEnable(VkCommandBuffer commandBuffer, VkBool32 rasterizerDiscardEnable);
|
||||
void vkb_wire_vkCmdSetRepresentativeFragmentTestEnableNV(VkCommandBuffer commandBuffer, VkBool32 representativeFragmentTestEnable);
|
||||
void vkb_wire_vkCmdSetSampleLocationsEXT(VkCommandBuffer commandBuffer, const VkSampleLocationsInfoEXT* pSampleLocationsInfo);
|
||||
void vkb_wire_vkCmdSetSampleLocationsEnableEXT(VkCommandBuffer commandBuffer, VkBool32 sampleLocationsEnable);
|
||||
void vkb_wire_vkCmdSetSampleMaskEXT(VkCommandBuffer commandBuffer, VkSampleCountFlagBits samples, const VkSampleMask* pSampleMask);
|
||||
void vkb_wire_vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors);
|
||||
void vkb_wire_vkCmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D* pScissors);
|
||||
void vkb_wire_vkCmdSetShadingRateImageEnableNV(VkCommandBuffer commandBuffer, VkBool32 shadingRateImageEnable);
|
||||
void vkb_wire_vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask);
|
||||
void vkb_wire_vkCmdSetStencilOp(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp);
|
||||
void vkb_wire_vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference);
|
||||
void vkb_wire_vkCmdSetStencilTestEnable(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable);
|
||||
void vkb_wire_vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask);
|
||||
void vkb_wire_vkCmdSetTessellationDomainOriginEXT(VkCommandBuffer commandBuffer, VkTessellationDomainOrigin domainOrigin);
|
||||
void vkb_wire_vkCmdSetVertexInputEXT(VkCommandBuffer commandBuffer, uint32_t vertexBindingDescriptionCount, const VkVertexInputBindingDescription2EXT* pVertexBindingDescriptions, uint32_t vertexAttributeDescriptionCount, const VkVertexInputAttributeDescription2EXT* pVertexAttributeDescriptions);
|
||||
void vkb_wire_vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports);
|
||||
void vkb_wire_vkCmdSetViewportSwizzleNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportSwizzleNV* pViewportSwizzles);
|
||||
void vkb_wire_vkCmdSetViewportWScalingEnableNV(VkCommandBuffer commandBuffer, VkBool32 viewportWScalingEnable);
|
||||
void vkb_wire_vkCmdSetViewportWithCount(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport* pViewports);
|
||||
void vkb_wire_vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData);
|
||||
void vkb_wire_vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers);
|
||||
void vkb_wire_vkCmdWaitEvents2(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, const VkDependencyInfo* pDependencyInfos);
|
||||
void vkb_wire_vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query);
|
||||
void vkb_wire_vkCmdWriteTimestamp2(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkQueryPool queryPool, uint32_t query);
|
||||
VkResult vkb_wire_vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer);
|
||||
VkResult vkb_wire_vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView);
|
||||
VkResult vkb_wire_vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool);
|
||||
VkResult vkb_wire_vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);
|
||||
VkResult vkb_wire_vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool);
|
||||
VkResult vkb_wire_vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout);
|
||||
VkResult vkb_wire_vkCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate);
|
||||
VkResult vkb_wire_vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice);
|
||||
VkResult vkb_wire_vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent);
|
||||
VkResult vkb_wire_vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence);
|
||||
VkResult vkb_wire_vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer);
|
||||
VkResult vkb_wire_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);
|
||||
VkResult vkb_wire_vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage);
|
||||
VkResult vkb_wire_vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView);
|
||||
VkResult vkb_wire_vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance);
|
||||
VkResult vkb_wire_vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache);
|
||||
VkResult vkb_wire_vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout);
|
||||
VkResult vkb_wire_vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool);
|
||||
VkResult vkb_wire_vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass);
|
||||
VkResult vkb_wire_vkCreateRenderPass2(VkDevice device, const VkRenderPassCreateInfo2* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass);
|
||||
VkResult vkb_wire_vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler);
|
||||
VkResult vkb_wire_vkCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion);
|
||||
VkResult vkb_wire_vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore);
|
||||
VkResult vkb_wire_vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule);
|
||||
void vkb_wire_vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator);
|
||||
void vkb_wire_vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator);
|
||||
VkResult vkb_wire_vkDeviceWaitIdle(VkDevice device);
|
||||
VkResult vkb_wire_vkEndCommandBuffer(VkCommandBuffer commandBuffer);
|
||||
VkResult vkb_wire_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
|
||||
VkResult vkb_wire_vkEnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
|
||||
VkResult vkb_wire_vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties);
|
||||
VkResult vkb_wire_vkEnumerateInstanceVersion(uint32_t* pApiVersion);
|
||||
VkResult vkb_wire_vkEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties);
|
||||
VkResult vkb_wire_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
|
||||
VkResult vkb_wire_vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges);
|
||||
void vkb_wire_vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers);
|
||||
VkResult vkb_wire_vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets);
|
||||
void vkb_wire_vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator);
|
||||
VkDeviceAddress vkb_wire_vkGetBufferDeviceAddress(VkDevice device, const VkBufferDeviceAddressInfo* pInfo);
|
||||
void vkb_wire_vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements);
|
||||
void vkb_wire_vkGetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements);
|
||||
uint64_t vkb_wire_vkGetBufferOpaqueCaptureAddress(VkDevice device, const VkBufferDeviceAddressInfo* pInfo);
|
||||
VkResult vkb_wire_vkGetCalibratedTimestampsEXT(VkDevice device, uint32_t timestampCount, const VkCalibratedTimestampInfoEXT* pTimestampInfos, uint64_t* pTimestamps, uint64_t* pMaxDeviation);
|
||||
void vkb_wire_vkGetDescriptorSetLayoutSupport(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport);
|
||||
void vkb_wire_vkGetDeviceBufferMemoryRequirements(VkDevice device, const VkDeviceBufferMemoryRequirements* pInfo, VkMemoryRequirements2* pMemoryRequirements);
|
||||
void vkb_wire_vkGetDeviceGroupPeerMemoryFeatures(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags* pPeerMemoryFeatures);
|
||||
void vkb_wire_vkGetDeviceImageMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements* pInfo, VkMemoryRequirements2* pMemoryRequirements);
|
||||
void vkb_wire_vkGetDeviceImageSparseMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements);
|
||||
void vkb_wire_vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes);
|
||||
uint64_t vkb_wire_vkGetDeviceMemoryOpaqueCaptureAddress(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo);
|
||||
void vkb_wire_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue);
|
||||
void vkb_wire_vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2* pQueueInfo, VkQueue* pQueue);
|
||||
VkResult vkb_wire_vkGetEventStatus(VkDevice device, VkEvent event);
|
||||
VkResult vkb_wire_vkGetFenceFdKHR(VkDevice device, const VkFenceGetFdInfoKHR* pGetFdInfo, int* pFd);
|
||||
VkResult vkb_wire_vkGetFenceStatus(VkDevice device, VkFence fence);
|
||||
VkResult vkb_wire_vkGetImageDrmFormatModifierPropertiesEXT(VkDevice device, VkImage image, VkImageDrmFormatModifierPropertiesEXT* pProperties);
|
||||
void vkb_wire_vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements);
|
||||
void vkb_wire_vkGetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements);
|
||||
void vkb_wire_vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements);
|
||||
void vkb_wire_vkGetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements);
|
||||
void vkb_wire_vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout);
|
||||
void vkb_wire_vkGetImageSubresourceLayout2EXT(VkDevice device, VkImage image, const VkImageSubresource2EXT* pSubresource, VkSubresourceLayout2EXT* pLayout);
|
||||
VkResult vkb_wire_vkGetMemoryFdKHR(VkDevice device, const VkMemoryGetFdInfoKHR* pGetFdInfo, int* pFd);
|
||||
VkResult vkb_wire_vkGetMemoryFdPropertiesKHR(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, int fd, VkMemoryFdPropertiesKHR* pMemoryFdProperties);
|
||||
VkResult vkb_wire_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice physicalDevice, uint32_t* pTimeDomainCount, VkTimeDomainEXT* pTimeDomains);
|
||||
void vkb_wire_vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties);
|
||||
void vkb_wire_vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties);
|
||||
void vkb_wire_vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties);
|
||||
void vkb_wire_vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures);
|
||||
void vkb_wire_vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures);
|
||||
void vkb_wire_vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties);
|
||||
void vkb_wire_vkGetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2* pFormatProperties);
|
||||
VkResult vkb_wire_vkGetPhysicalDeviceFragmentShadingRatesKHR(VkPhysicalDevice physicalDevice, uint32_t* pFragmentShadingRateCount, VkPhysicalDeviceFragmentShadingRateKHR* pFragmentShadingRates);
|
||||
VkResult vkb_wire_vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties);
|
||||
VkResult vkb_wire_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, VkImageFormatProperties2* pImageFormatProperties);
|
||||
void vkb_wire_vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties);
|
||||
void vkb_wire_vkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2* pMemoryProperties);
|
||||
void vkb_wire_vkGetPhysicalDeviceMultisamplePropertiesEXT(VkPhysicalDevice physicalDevice, VkSampleCountFlagBits samples, VkMultisamplePropertiesEXT* pMultisampleProperties);
|
||||
void vkb_wire_vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties);
|
||||
void vkb_wire_vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2* pProperties);
|
||||
void vkb_wire_vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties);
|
||||
void vkb_wire_vkGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2* pQueueFamilyProperties);
|
||||
void vkb_wire_vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties);
|
||||
void vkb_wire_vkGetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties);
|
||||
VkResult vkb_wire_vkGetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice, uint32_t* pToolCount, VkPhysicalDeviceToolProperties* pToolProperties);
|
||||
VkResult vkb_wire_vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData);
|
||||
VkResult vkb_wire_vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags);
|
||||
void vkb_wire_vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity);
|
||||
VkResult vkb_wire_vkGetSemaphoreCounterValue(VkDevice device, VkSemaphore semaphore, uint64_t* pValue);
|
||||
VkResult vkb_wire_vkGetSemaphoreFdKHR(VkDevice device, const VkSemaphoreGetFdInfoKHR* pGetFdInfo, int* pFd);
|
||||
void vkb_wire_vkGetShaderModuleCreateInfoIdentifierEXT(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, VkShaderModuleIdentifierEXT* pIdentifier);
|
||||
void vkb_wire_vkGetShaderModuleIdentifierEXT(VkDevice device, VkShaderModule shaderModule, VkShaderModuleIdentifierEXT* pIdentifier);
|
||||
VkResult vkb_wire_vkImportFenceFdKHR(VkDevice device, const VkImportFenceFdInfoKHR* pImportFenceFdInfo);
|
||||
VkResult vkb_wire_vkImportSemaphoreFdKHR(VkDevice device, const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo);
|
||||
VkResult vkb_wire_vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges);
|
||||
VkResult vkb_wire_vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches);
|
||||
VkResult vkb_wire_vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence);
|
||||
VkResult vkb_wire_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence);
|
||||
VkResult vkb_wire_vkQueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2* pSubmits, VkFence fence);
|
||||
VkResult vkb_wire_vkQueueWaitIdle(VkQueue queue);
|
||||
VkResult vkb_wire_vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags);
|
||||
VkResult vkb_wire_vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags);
|
||||
VkResult vkb_wire_vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags);
|
||||
VkResult vkb_wire_vkResetEvent(VkDevice device, VkEvent event);
|
||||
VkResult vkb_wire_vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences);
|
||||
void vkb_wire_vkResetQueryPool(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount);
|
||||
void vkb_wire_vkSetDeviceMemoryPriorityEXT(VkDevice device, VkDeviceMemory memory, float priority);
|
||||
VkResult vkb_wire_vkSetEvent(VkDevice device, VkEvent event);
|
||||
VkResult vkb_wire_vkSignalSemaphore(VkDevice device, const VkSemaphoreSignalInfo* pSignalInfo);
|
||||
void vkb_wire_vkTrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags);
|
||||
void vkb_wire_vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies);
|
||||
VkResult vkb_wire_vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout);
|
||||
VkResult vkb_wire_vkWaitSemaphores(VkDevice device, const VkSemaphoreWaitInfo* pWaitInfo, uint64_t timeout);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR* pAcquireInfo, uint32_t* pImageIndex);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkBindBufferMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkBindImageMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo* pBindInfos);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkCmdBeginDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT* pLabelInfo);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkCmdEndDebugUtilsLabelEXT(VkCommandBuffer commandBuffer);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkCmdInsertDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT* pLabelInfo);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkCmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplate descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void* pData);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugUtilsMessengerEXT* pMessenger);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateHeadlessSurfaceEXT(VkInstance instance, const VkHeadlessSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreatePrivateDataSlot(VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkCreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger, const VkAllocationCallbacks* pAllocator);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroyPrivateDataSlot(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkDeviceWaitIdle(VkDevice device);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEndCommandBuffer(VkCommandBuffer commandBuffer);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEnumerateInstanceVersion(uint32_t* pApiVersion);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetDeviceBufferMemoryRequirements(VkDevice device, const VkDeviceBufferMemoryRequirements* pInfo, VkMemoryRequirements2* pMemoryRequirements);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetDeviceGroupPresentCapabilitiesKHR(VkDevice device, VkDeviceGroupPresentCapabilitiesKHR* pDeviceGroupPresentCapabilities);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHR* pModes);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetDeviceImageMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements* pInfo, VkMemoryRequirements2* pMemoryRequirements);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetDeviceImageSparseMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements);
|
||||
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkb_ep_vkGetDeviceProcAddr(VkDevice device, const char* pName);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2* pQueueInfo, VkQueue* pQueue);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetFenceStatus(VkDevice device, VkFence fence);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout);
|
||||
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkb_ep_vkGetInstanceProcAddr(VkInstance instance, const char* pName);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetMemoryFdPropertiesKHR(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, int fd, VkMemoryFdPropertiesKHR* pMemoryFdProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2* pFormatProperties);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, VkImageFormatProperties2* pImageFormatProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2* pMemoryProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceMultisamplePropertiesEXT(VkPhysicalDevice physicalDevice, VkSampleCountFlagBits samples, VkMultisamplePropertiesEXT* pMultisampleProperties);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pRectCount, VkRect2D* pRects);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2* pProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2* pQueueFamilyProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, VkSurfaceCapabilities2KHR* pSurfaceCapabilities);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, uint32_t* pSurfaceFormatCount, VkSurfaceFormat2KHR* pSurfaceFormats);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice, uint32_t* pToolCount, VkPhysicalDeviceToolProperties* pToolProperties);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkb_ep_vkGetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkb_ep_vkGetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkb_ep_vkGetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkGetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetSemaphoreCounterValue(VkDevice device, VkSemaphore semaphore, uint64_t* pValue);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkMapMemory2KHR(VkDevice device, const VkMemoryMapInfoKHR* pMemoryMapInfo, void** ppData);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkQueueBeginDebugUtilsLabelEXT(VkQueue queue, const VkDebugUtilsLabelEXT* pLabelInfo);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkQueueEndDebugUtilsLabelEXT(VkQueue queue);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkQueueInsertDebugUtilsLabelEXT(VkQueue queue, const VkDebugUtilsLabelEXT* pLabelInfo);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* pPresentInfo);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkQueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2* pSubmits, VkFence fence);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkQueueWaitIdle(VkQueue queue);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT* pNameInfo);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT* pTagInfo);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkSetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkSubmitDebugUtilsMessageEXT(VkInstance instance, VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageTypes, const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkUnmapMemory(VkDevice device, VkDeviceMemory memory);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkUnmapMemory2KHR(VkDevice device, const VkMemoryUnmapInfoKHR* pMemoryUnmapInfo);
|
||||
VKAPI_ATTR void VKAPI_CALL vkb_ep_vkUpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void* pData);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkWaitSemaphores(VkDevice device, const VkSemaphoreWaitInfo* pWaitInfo, uint64_t timeout);
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,285 @@
|
||||
/* Generated by tools/vkbridge/codegen/gen_vkbridge.py from vk.xml 1.3.247 - do not edit. */
|
||||
|
||||
#ifndef VKB_SERVER_GEN_H
|
||||
#define VKB_SERVER_GEN_H
|
||||
#include "vkb_gen.h"
|
||||
typedef struct vkb_srv_call vkb_srv_call;
|
||||
typedef void (*vkb_srv_handler)(vkb_srv_call *c);
|
||||
extern const vkb_srv_handler vkb_srv_handlers[VKB_CMD_COUNT];
|
||||
void vkb_sv_vkAllocateCommandBuffers(vkb_srv_call *c);
|
||||
void vkb_sv_vkAllocateDescriptorSets(vkb_srv_call *c);
|
||||
void vkb_sv_vkAllocateMemory(vkb_srv_call *c);
|
||||
void vkb_sv_vkBeginCommandBuffer(vkb_srv_call *c);
|
||||
void vkb_sv_vkBindBufferMemory(vkb_srv_call *c);
|
||||
void vkb_sv_vkBindBufferMemory2(vkb_srv_call *c);
|
||||
void vkb_sv_vkBindImageMemory(vkb_srv_call *c);
|
||||
void vkb_sv_vkBindImageMemory2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBeginConditionalRenderingEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBeginQuery(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBeginQueryIndexedEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBeginRenderPass(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBeginRenderPass2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBeginRendering(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBeginTransformFeedbackEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBindDescriptorSets(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBindIndexBuffer(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBindPipeline(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBindTransformFeedbackBuffersEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBindVertexBuffers(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBindVertexBuffers2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBlitImage(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdBlitImage2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdClearAttachments(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdClearColorImage(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdClearDepthStencilImage(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdCopyBuffer(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdCopyBuffer2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdCopyBufferToImage(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdCopyBufferToImage2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdCopyImage(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdCopyImage2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdCopyImageToBuffer(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdCopyImageToBuffer2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdCopyQueryPoolResults(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdDispatch(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdDispatchBase(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdDispatchIndirect(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdDraw(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdDrawIndexed(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdDrawIndexedIndirect(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdDrawIndexedIndirectCount(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdDrawIndirect(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdDrawIndirectByteCountEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdDrawIndirectCount(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdDrawMultiEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdDrawMultiIndexedEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdEndConditionalRenderingEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdEndQuery(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdEndQueryIndexedEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdEndRenderPass(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdEndRenderPass2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdEndRendering(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdEndTransformFeedbackEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdExecuteCommands(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdFillBuffer(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdNextSubpass(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdNextSubpass2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdPipelineBarrier(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdPipelineBarrier2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdPushConstants(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdPushDescriptorSetKHR(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdResetEvent(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdResetEvent2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdResetQueryPool(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdResolveImage(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdResolveImage2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetAlphaToCoverageEnableEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetAlphaToOneEnableEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetBlendConstants(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetColorBlendAdvancedEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetColorBlendEnableEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetColorBlendEquationEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetColorWriteEnableEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetColorWriteMaskEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetConservativeRasterizationModeEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetCoverageModulationModeNV(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetCoverageModulationTableEnableNV(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetCoverageModulationTableNV(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetCoverageReductionModeNV(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetCoverageToColorEnableNV(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetCoverageToColorLocationNV(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetCullMode(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetDepthBias(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetDepthBiasEnable(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetDepthBounds(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetDepthBoundsTestEnable(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetDepthClampEnableEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetDepthClipEnableEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetDepthClipNegativeOneToOneEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetDepthCompareOp(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetDepthTestEnable(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetDepthWriteEnable(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetDeviceMask(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetDiscardRectangleEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetDiscardRectangleEnableEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetDiscardRectangleModeEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetEvent(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetEvent2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetExtraPrimitiveOverestimationSizeEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetFragmentShadingRateKHR(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetFrontFace(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetLineRasterizationModeEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetLineStippleEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetLineStippleEnableEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetLineWidth(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetLogicOpEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetLogicOpEnableEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetPatchControlPointsEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetPolygonModeEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetPrimitiveRestartEnable(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetPrimitiveTopology(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetProvokingVertexModeEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetRasterizationSamplesEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetRasterizationStreamEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetRasterizerDiscardEnable(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetRepresentativeFragmentTestEnableNV(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetSampleLocationsEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetSampleLocationsEnableEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetSampleMaskEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetScissor(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetScissorWithCount(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetShadingRateImageEnableNV(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetStencilCompareMask(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetStencilOp(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetStencilReference(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetStencilTestEnable(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetStencilWriteMask(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetTessellationDomainOriginEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetVertexInputEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetViewport(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetViewportSwizzleNV(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetViewportWScalingEnableNV(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdSetViewportWithCount(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdUpdateBuffer(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdWaitEvents(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdWaitEvents2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdWriteTimestamp(vkb_srv_call *c);
|
||||
void vkb_sv_vkCmdWriteTimestamp2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateBuffer(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateBufferView(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateCommandPool(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateComputePipelines(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateDescriptorPool(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateDescriptorSetLayout(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateDescriptorUpdateTemplate(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateDevice(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateEvent(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateFence(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateFramebuffer(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateGraphicsPipelines(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateImage(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateImageView(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateInstance(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreatePipelineCache(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreatePipelineLayout(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateQueryPool(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateRenderPass(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateRenderPass2(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateSampler(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateSamplerYcbcrConversion(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateSemaphore(vkb_srv_call *c);
|
||||
void vkb_sv_vkCreateShaderModule(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyBuffer(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyBufferView(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyCommandPool(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyDescriptorPool(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyDescriptorSetLayout(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyDescriptorUpdateTemplate(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyDevice(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyEvent(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyFence(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyFramebuffer(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyImage(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyImageView(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyInstance(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyPipeline(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyPipelineCache(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyPipelineLayout(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyQueryPool(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyRenderPass(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroySampler(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroySamplerYcbcrConversion(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroySemaphore(vkb_srv_call *c);
|
||||
void vkb_sv_vkDestroyShaderModule(vkb_srv_call *c);
|
||||
void vkb_sv_vkDeviceWaitIdle(vkb_srv_call *c);
|
||||
void vkb_sv_vkEndCommandBuffer(vkb_srv_call *c);
|
||||
void vkb_sv_vkEnumerateDeviceExtensionProperties(vkb_srv_call *c);
|
||||
void vkb_sv_vkEnumerateInstanceExtensionProperties(vkb_srv_call *c);
|
||||
void vkb_sv_vkEnumerateInstanceLayerProperties(vkb_srv_call *c);
|
||||
void vkb_sv_vkEnumerateInstanceVersion(vkb_srv_call *c);
|
||||
void vkb_sv_vkEnumeratePhysicalDeviceGroups(vkb_srv_call *c);
|
||||
void vkb_sv_vkEnumeratePhysicalDevices(vkb_srv_call *c);
|
||||
void vkb_sv_vkFlushMappedMemoryRanges(vkb_srv_call *c);
|
||||
void vkb_sv_vkFreeCommandBuffers(vkb_srv_call *c);
|
||||
void vkb_sv_vkFreeDescriptorSets(vkb_srv_call *c);
|
||||
void vkb_sv_vkFreeMemory(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetBufferDeviceAddress(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetBufferMemoryRequirements(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetBufferMemoryRequirements2(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetBufferOpaqueCaptureAddress(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetCalibratedTimestampsEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetDescriptorSetLayoutSupport(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetDeviceBufferMemoryRequirements(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetDeviceGroupPeerMemoryFeatures(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetDeviceImageMemoryRequirements(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetDeviceImageSparseMemoryRequirements(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetDeviceMemoryCommitment(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetDeviceMemoryOpaqueCaptureAddress(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetDeviceQueue(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetDeviceQueue2(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetEventStatus(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetFenceFdKHR(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetFenceStatus(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetImageDrmFormatModifierPropertiesEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetImageMemoryRequirements(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetImageMemoryRequirements2(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetImageSparseMemoryRequirements(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetImageSparseMemoryRequirements2(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetImageSubresourceLayout(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetImageSubresourceLayout2EXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetMemoryFdKHR(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetMemoryFdPropertiesKHR(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceExternalBufferProperties(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceExternalFenceProperties(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceExternalSemaphoreProperties(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceFeatures(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceFeatures2(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceFormatProperties(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceFormatProperties2(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceFragmentShadingRatesKHR(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceImageFormatProperties(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceImageFormatProperties2(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceMemoryProperties(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceMemoryProperties2(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceMultisamplePropertiesEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceProperties(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceProperties2(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceQueueFamilyProperties(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceQueueFamilyProperties2(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceSparseImageFormatProperties(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceSparseImageFormatProperties2(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPhysicalDeviceToolProperties(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetPipelineCacheData(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetQueryPoolResults(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetRenderAreaGranularity(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetSemaphoreCounterValue(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetSemaphoreFdKHR(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetShaderModuleCreateInfoIdentifierEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkGetShaderModuleIdentifierEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkImportFenceFdKHR(vkb_srv_call *c);
|
||||
void vkb_sv_vkImportSemaphoreFdKHR(vkb_srv_call *c);
|
||||
void vkb_sv_vkInvalidateMappedMemoryRanges(vkb_srv_call *c);
|
||||
void vkb_sv_vkMergePipelineCaches(vkb_srv_call *c);
|
||||
void vkb_sv_vkQueueBindSparse(vkb_srv_call *c);
|
||||
void vkb_sv_vkQueueSubmit(vkb_srv_call *c);
|
||||
void vkb_sv_vkQueueSubmit2(vkb_srv_call *c);
|
||||
void vkb_sv_vkQueueWaitIdle(vkb_srv_call *c);
|
||||
void vkb_sv_vkResetCommandBuffer(vkb_srv_call *c);
|
||||
void vkb_sv_vkResetCommandPool(vkb_srv_call *c);
|
||||
void vkb_sv_vkResetDescriptorPool(vkb_srv_call *c);
|
||||
void vkb_sv_vkResetEvent(vkb_srv_call *c);
|
||||
void vkb_sv_vkResetFences(vkb_srv_call *c);
|
||||
void vkb_sv_vkResetQueryPool(vkb_srv_call *c);
|
||||
void vkb_sv_vkSetDeviceMemoryPriorityEXT(vkb_srv_call *c);
|
||||
void vkb_sv_vkSetEvent(vkb_srv_call *c);
|
||||
void vkb_sv_vkSignalSemaphore(vkb_srv_call *c);
|
||||
void vkb_sv_vkTrimCommandPool(vkb_srv_call *c);
|
||||
void vkb_sv_vkUpdateDescriptorSets(vkb_srv_call *c);
|
||||
void vkb_sv_vkWaitForFences(vkb_srv_call *c);
|
||||
void vkb_sv_vkWaitSemaphores(vkb_srv_call *c);
|
||||
void vkb_sv_vkbHello(vkb_srv_call *c);
|
||||
void vkb_sv_vkbQueryServer(vkb_srv_call *c);
|
||||
void vkb_sv_vkbDescUpdateRaw(vkb_srv_call *c);
|
||||
void vkb_sv_vkbPushDescRaw(vkb_srv_call *c);
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
#ifndef VKB_LOG_H
|
||||
#define VKB_LOG_H
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define VKB_LOG_ERROR 0
|
||||
#define VKB_LOG_WARN 1
|
||||
#define VKB_LOG_INFO 2
|
||||
#define VKB_LOG_DEBUG 3
|
||||
|
||||
/* Each side provides the sink (client: stderr + optional file; server: logcat + file). */
|
||||
void vkb_log(int level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
int vkb_log_level(void);
|
||||
|
||||
#define VKB_ERR(...) vkb_log(VKB_LOG_ERROR, __VA_ARGS__)
|
||||
#define VKB_WARN(...) vkb_log(VKB_LOG_WARN, __VA_ARGS__)
|
||||
#define VKB_INFO(...) vkb_log(VKB_LOG_INFO, __VA_ARGS__)
|
||||
#define VKB_DBG(...) do { if (vkb_log_level() >= VKB_LOG_DEBUG) vkb_log(VKB_LOG_DEBUG, __VA_ARGS__); } while (0)
|
||||
|
||||
/* Logs a message only the first time this call site is reached. */
|
||||
#define VKB_ONCE(level, ...) do { static int once_; if (!__atomic_exchange_n(&once_, 1, __ATOMIC_RELAXED)) vkb_log(level, __VA_ARGS__); } while (0)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Bridge-specific (non-Vulkan) parts of the protocol: hello, server query, memory sharing.
|
||||
*/
|
||||
#ifndef VKB_PROTO_H
|
||||
#define VKB_PROTO_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define VKB_DEFAULT_SOCKET_ENV "VKBRIDGE_SOCKET"
|
||||
|
||||
/* How host-visible memory is shared between the client's address space and the GPU. */
|
||||
enum vkb_mem_strategy {
|
||||
VKB_MEM_NONE = 0, /* no sharing works: host-visible memory is not offered */
|
||||
VKB_MEM_HOSTPTR = 1, /* client memfd, server imports it (VK_EXT_external_memory_host) */
|
||||
VKB_MEM_DMABUF = 2, /* server exports a dma-buf (VK_EXT_external_memory_dma_buf), client mmaps */
|
||||
VKB_MEM_AHB = 3, /* server allocates an AHardwareBuffer (BLOB), client mmaps its dma-buf */
|
||||
};
|
||||
|
||||
static inline const char *vkb_mem_strategy_name(uint32_t s)
|
||||
{
|
||||
switch (s) {
|
||||
case VKB_MEM_HOSTPTR: return "hostptr";
|
||||
case VKB_MEM_DMABUF: return "dmabuf";
|
||||
case VKB_MEM_AHB: return "ahb";
|
||||
default: return "none";
|
||||
}
|
||||
}
|
||||
|
||||
/* Emulated features (server rewrites resources/shaders; client reports them as supported). */
|
||||
#define VKB_EMU_BCN (1u << 0) /* BC1-BC7 textures decoded on upload */
|
||||
#define VKB_EMU_DIVISOR (1u << 1) /* VK_EXT_vertex_attribute_divisor */
|
||||
#define VKB_EMU_CLIP_DISTANCE (1u << 2) /* shaderClipDistance */
|
||||
#define VKB_EMU_CULL_DISTANCE (1u << 3) /* shaderCullDistance (accepted, not applied) */
|
||||
#define VKB_EMU_POINT_SIZE (1u << 4) /* strip PointSize from geometry/tessellation stages */
|
||||
#define VKB_EMU_DEPTH_CLIP (1u << 5) /* VK_EXT_depth_clip_enable via depthClamp */
|
||||
|
||||
/* vkbQueryServer reply (per physical device). */
|
||||
typedef struct vkb_server_pd_info {
|
||||
uint32_t strategy; /* enum vkb_mem_strategy */
|
||||
uint32_t buffer_handle_types; /* VkExternalMemoryHandleTypeFlags to put on buffers */
|
||||
uint32_t shareable_types; /* server memory type bits that can be shared */
|
||||
uint32_t coherent_types; /* of those, verified coherent without flushes */
|
||||
uint64_t import_alignment; /* hostptr: minImportedHostPointerAlignment */
|
||||
uint32_t emu; /* VKB_EMU_* the server will perform */
|
||||
uint32_t emu_available; /* VKB_EMU_* the server could perform */
|
||||
uint32_t real_api_version;
|
||||
uint32_t reserved[7];
|
||||
} vkb_server_pd_info;
|
||||
|
||||
/* vkAllocateMemory wire extras (after VkMemoryAllocateInfo). */
|
||||
#define VKB_ALLOC_PLAIN 0u
|
||||
#define VKB_ALLOC_SHARED 1u
|
||||
|
||||
/* Extra structure the client hangs on create infos to tell the server which shared handle
|
||||
* types were injected (so the server can remove them if the driver refuses). Not on the wire. */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* What the generated server handlers need from the server: the per-call context.
|
||||
*/
|
||||
#ifndef VKB_SERVER_IFACE_H
|
||||
#define VKB_SERVER_IFACE_H
|
||||
|
||||
#include "vkb_wire.h"
|
||||
|
||||
struct vkb_srv_table;
|
||||
struct vkb_srv_conn;
|
||||
|
||||
struct vkb_srv_call {
|
||||
vkb_dec d; /* request */
|
||||
vkb_enc r; /* reply payload */
|
||||
vkb_dispatch *dt; /* dispatch for the table named in the request */
|
||||
struct vkb_srv_table *table; /* NULL for global commands */
|
||||
struct vkb_srv_conn *conn;
|
||||
uint32_t status; /* reply status (VKB_ST_*) */
|
||||
int close_after[VKB_MAX_FDS]; /* server fds to close once the reply is sent */
|
||||
int nclose;
|
||||
int in_stream; /* replaying a command buffer stream */
|
||||
};
|
||||
|
||||
void vkb_srv_bad_message(struct vkb_srv_call *c);
|
||||
void vkb_srv_missing(struct vkb_srv_call *c, const char *name);
|
||||
void vkb_srv_close_after_send(struct vkb_srv_call *c, int fd);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,691 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
#include "vkb_wire.h"
|
||||
#include "vkb_log.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/uio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* ------------------------------------------------------------------ arena */
|
||||
|
||||
struct vkb_arena_block {
|
||||
vkb_arena_block *next;
|
||||
size_t used, cap;
|
||||
/* data follows, 16-aligned */
|
||||
};
|
||||
|
||||
#define ARENA_HDR ((sizeof(vkb_arena_block) + 15) & ~(size_t)15)
|
||||
|
||||
void *vkb_arena_alloc(vkb_arena *a, size_t n)
|
||||
{
|
||||
n = (n + 15) & ~(size_t)15;
|
||||
if (n == 0) n = 16;
|
||||
vkb_arena_block *b = a->head;
|
||||
if (!b || b->cap - b->used < n) {
|
||||
size_t cap = n > 65536 ? n : 65536;
|
||||
b = malloc(ARENA_HDR + cap);
|
||||
if (!b) return NULL;
|
||||
b->next = a->head;
|
||||
b->used = 0;
|
||||
b->cap = cap;
|
||||
a->head = b;
|
||||
}
|
||||
void *p = (uint8_t *)b + ARENA_HDR + b->used;
|
||||
b->used += n;
|
||||
a->used_total += n;
|
||||
memset(p, 0, n);
|
||||
return p;
|
||||
}
|
||||
|
||||
void vkb_arena_reset(vkb_arena *a)
|
||||
{
|
||||
/* Keep the most recent block if it is the default size; free the rest. */
|
||||
vkb_arena_block *b = a->head, *keep = NULL;
|
||||
while (b) {
|
||||
vkb_arena_block *n = b->next;
|
||||
if (!keep && b->cap == 65536) {
|
||||
keep = b;
|
||||
keep->next = NULL;
|
||||
keep->used = 0;
|
||||
} else {
|
||||
free(b);
|
||||
}
|
||||
b = n;
|
||||
}
|
||||
a->head = keep;
|
||||
a->used_total = 0;
|
||||
}
|
||||
|
||||
void vkb_arena_free(vkb_arena *a)
|
||||
{
|
||||
vkb_arena_block *b = a->head;
|
||||
while (b) {
|
||||
vkb_arena_block *n = b->next;
|
||||
free(b);
|
||||
b = n;
|
||||
}
|
||||
a->head = NULL;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ encoder */
|
||||
|
||||
void vkb_enc_init(vkb_enc *e)
|
||||
{
|
||||
memset(e, 0, sizeof(*e));
|
||||
}
|
||||
|
||||
void vkb_enc_reset(vkb_enc *e)
|
||||
{
|
||||
e->len = 0;
|
||||
e->nfds = 0;
|
||||
e->oom = 0;
|
||||
}
|
||||
|
||||
void vkb_enc_free(vkb_enc *e)
|
||||
{
|
||||
free(e->buf);
|
||||
memset(e, 0, sizeof(*e));
|
||||
}
|
||||
|
||||
static int enc_grow(vkb_enc *e, size_t add)
|
||||
{
|
||||
if (e->oom) return 0;
|
||||
size_t need = e->len + add;
|
||||
if (need <= e->cap) return 1;
|
||||
size_t cap = e->cap ? e->cap : 4096;
|
||||
while (cap < need) cap *= 2;
|
||||
uint8_t *nb = realloc(e->buf, cap);
|
||||
if (!nb) {
|
||||
e->oom = 1;
|
||||
return 0;
|
||||
}
|
||||
e->buf = nb;
|
||||
e->cap = cap;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void vkb_enc_bytes(vkb_enc *e, const void *p, size_t n)
|
||||
{
|
||||
if (!n || !enc_grow(e, n)) return;
|
||||
if (p) memcpy(e->buf + e->len, p, n);
|
||||
else memset(e->buf + e->len, 0, n);
|
||||
e->len += n;
|
||||
}
|
||||
|
||||
void vkb_enc_u8(vkb_enc *e, uint8_t v) { vkb_enc_bytes(e, &v, 1); }
|
||||
void vkb_enc_u32(vkb_enc *e, uint32_t v) { vkb_enc_bytes(e, &v, 4); }
|
||||
void vkb_enc_u64(vkb_enc *e, uint64_t v) { vkb_enc_bytes(e, &v, 8); }
|
||||
|
||||
static void enc_align(vkb_enc *e)
|
||||
{
|
||||
size_t pad = (8 - (e->len & 7)) & 7;
|
||||
if (pad) vkb_enc_bytes(e, NULL, pad);
|
||||
}
|
||||
|
||||
size_t vkb_enc_raw(vkb_enc *e, const void *p, size_t n)
|
||||
{
|
||||
enc_align(e);
|
||||
size_t off = e->len;
|
||||
vkb_enc_bytes(e, p, n);
|
||||
return off;
|
||||
}
|
||||
|
||||
void vkb_enc_patch_u64(vkb_enc *e, size_t off, uint64_t v)
|
||||
{
|
||||
if (e->oom || off + 8 > e->len) return;
|
||||
memcpy(e->buf + off, &v, 8);
|
||||
}
|
||||
|
||||
void vkb_enc_str(vkb_enc *e, const char *s)
|
||||
{
|
||||
if (!s) {
|
||||
vkb_enc_u8(e, 0);
|
||||
return;
|
||||
}
|
||||
uint32_t n = (uint32_t)strlen(s);
|
||||
vkb_enc_u8(e, 1);
|
||||
vkb_enc_u32(e, n);
|
||||
vkb_enc_bytes(e, s, n);
|
||||
}
|
||||
|
||||
void vkb_enc_strarray(vkb_enc *e, const char *const *a, uint32_t n)
|
||||
{
|
||||
if (!a) {
|
||||
vkb_enc_u8(e, 0);
|
||||
return;
|
||||
}
|
||||
vkb_enc_u8(e, 1);
|
||||
vkb_enc_u32(e, n);
|
||||
for (uint32_t i = 0; i < n; i++) vkb_enc_str(e, a[i]);
|
||||
}
|
||||
|
||||
void vkb_enc_blob(vkb_enc *e, const void *p, size_t n)
|
||||
{
|
||||
if (!p) {
|
||||
vkb_enc_u8(e, 0);
|
||||
return;
|
||||
}
|
||||
vkb_enc_u8(e, 1);
|
||||
vkb_enc_u64(e, n);
|
||||
vkb_enc_raw(e, p, n);
|
||||
}
|
||||
|
||||
void vkb_enc_fd(vkb_enc *e, int fd)
|
||||
{
|
||||
if (fd < 0) {
|
||||
vkb_enc_u32(e, VKB_FD_NONE);
|
||||
return;
|
||||
}
|
||||
if (e->nfds >= VKB_MAX_FDS) {
|
||||
VKB_ERR("too many file descriptors in one message");
|
||||
e->oom = 1;
|
||||
return;
|
||||
}
|
||||
e->fds[e->nfds] = fd;
|
||||
vkb_enc_u32(e, (uint32_t)e->nfds);
|
||||
e->nfds++;
|
||||
}
|
||||
|
||||
void vkb_enc_append(vkb_enc *e, const vkb_enc *src)
|
||||
{
|
||||
enc_align(e);
|
||||
/* fd indices inside src are relative to src; a stream that carries fds is not appendable. */
|
||||
if (src->nfds) {
|
||||
VKB_ERR("internal: appending a message that carries file descriptors");
|
||||
e->oom = 1;
|
||||
return;
|
||||
}
|
||||
vkb_enc_bytes(e, src->buf, src->len);
|
||||
}
|
||||
|
||||
static const VkBaseInStructure *next_known(const void *p)
|
||||
{
|
||||
const VkBaseInStructure *b = p;
|
||||
while (b) {
|
||||
if (vkb_struct_size(b->sType)) return b;
|
||||
VKB_ONCE(VKB_LOG_WARN, "pNext: structure type %d is not bridged; dropped (logged once)", (int)b->sType);
|
||||
b = b->pNext;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void vkb_enc_chain(vkb_enc *e, const void *pNext)
|
||||
{
|
||||
const VkBaseInStructure *b = next_known(pNext);
|
||||
if (!b) {
|
||||
vkb_enc_u32(e, VKB_CHAIN_END);
|
||||
return;
|
||||
}
|
||||
vkb_enc_u32(e, (uint32_t)b->sType);
|
||||
vkb_enc_chain_elem(e, b);
|
||||
}
|
||||
|
||||
/* Out-structs that carry a caller-provided array (two-call idiom inside a struct). */
|
||||
static int out_array_info(VkStructureType t, size_t *count_off, size_t *ptr_off, size_t *elem)
|
||||
{
|
||||
switch ((int)t) {
|
||||
case VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT:
|
||||
*count_off = offsetof(VkDrmFormatModifierPropertiesListEXT, drmFormatModifierCount);
|
||||
*ptr_off = offsetof(VkDrmFormatModifierPropertiesListEXT, pDrmFormatModifierProperties);
|
||||
*elem = sizeof(VkDrmFormatModifierPropertiesEXT);
|
||||
return 1;
|
||||
case VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_2_EXT:
|
||||
*count_off = offsetof(VkDrmFormatModifierPropertiesList2EXT, drmFormatModifierCount);
|
||||
*ptr_off = offsetof(VkDrmFormatModifierPropertiesList2EXT, pDrmFormatModifierProperties);
|
||||
*elem = sizeof(VkDrmFormatModifierProperties2EXT);
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static const VkBaseInStructure *next_known_out(const void *p)
|
||||
{
|
||||
const VkBaseInStructure *b = p;
|
||||
while (b) {
|
||||
if (vkb_struct_size(b->sType)) return b;
|
||||
VKB_ONCE(VKB_LOG_WARN, "output pNext: structure type %d is not bridged; left unfilled (logged once)", (int)b->sType);
|
||||
b = b->pNext;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void vkb_enc_out_template(vkb_enc *e, const void *s, size_t size)
|
||||
{
|
||||
vkb_enc_raw(e, s, size);
|
||||
const VkBaseInStructure *b = next_known_out(((const VkBaseInStructure *)s)->pNext);
|
||||
while (b) {
|
||||
size_t sz = vkb_struct_size(b->sType);
|
||||
vkb_enc_u32(e, (uint32_t)b->sType);
|
||||
vkb_enc_raw(e, b, sz);
|
||||
size_t co, po, el;
|
||||
if (out_array_info(b->sType, &co, &po, &el)) {
|
||||
const void *arr;
|
||||
memcpy(&arr, (const uint8_t *)b + po, sizeof(arr));
|
||||
vkb_enc_u8(e, arr != NULL);
|
||||
}
|
||||
b = next_known_out(b->pNext);
|
||||
}
|
||||
vkb_enc_u32(e, VKB_CHAIN_END);
|
||||
}
|
||||
|
||||
void vkb_enc_out_struct(vkb_enc *e, const void *s, size_t size)
|
||||
{
|
||||
vkb_enc_raw(e, s, size);
|
||||
const VkBaseInStructure *b = ((const VkBaseInStructure *)s)->pNext;
|
||||
for (; b; b = b->pNext) {
|
||||
size_t sz = vkb_struct_size(b->sType);
|
||||
if (!sz) continue;
|
||||
vkb_enc_u32(e, (uint32_t)b->sType);
|
||||
vkb_enc_raw(e, b, sz);
|
||||
size_t co, po, el;
|
||||
if (out_array_info(b->sType, &co, &po, &el)) {
|
||||
const void *arr;
|
||||
uint32_t n;
|
||||
memcpy(&arr, (const uint8_t *)b + po, sizeof(arr));
|
||||
memcpy(&n, (const uint8_t *)b + co, 4);
|
||||
vkb_enc_u8(e, arr != NULL);
|
||||
if (arr) {
|
||||
vkb_enc_u32(e, n);
|
||||
vkb_enc_raw(e, arr, (size_t)n * el);
|
||||
}
|
||||
}
|
||||
}
|
||||
vkb_enc_u32(e, VKB_CHAIN_END);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ decoder */
|
||||
|
||||
void vkb_dec_init(vkb_dec *d, const void *buf, size_t len, vkb_arena *a, int *fds, int nfds)
|
||||
{
|
||||
memset(d, 0, sizeof(*d));
|
||||
d->buf = buf;
|
||||
d->len = len;
|
||||
d->arena = a;
|
||||
d->fds = fds;
|
||||
d->nfds = nfds;
|
||||
}
|
||||
|
||||
void vkb_dec_bytes(vkb_dec *d, void *dst, size_t n)
|
||||
{
|
||||
if (d->err || d->len - d->pos < n) {
|
||||
d->err = 1;
|
||||
if (dst) memset(dst, 0, n);
|
||||
return;
|
||||
}
|
||||
if (dst) memcpy(dst, d->buf + d->pos, n);
|
||||
d->pos += n;
|
||||
}
|
||||
|
||||
uint8_t vkb_dec_u8(vkb_dec *d) { uint8_t v; vkb_dec_bytes(d, &v, 1); return v; }
|
||||
uint32_t vkb_dec_u32(vkb_dec *d) { uint32_t v; vkb_dec_bytes(d, &v, 4); return v; }
|
||||
uint64_t vkb_dec_u64(vkb_dec *d) { uint64_t v; vkb_dec_bytes(d, &v, 8); return v; }
|
||||
|
||||
static void dec_align(vkb_dec *d)
|
||||
{
|
||||
size_t pad = (8 - (d->pos & 7)) & 7;
|
||||
if (d->len - d->pos < pad) {
|
||||
d->err = 1;
|
||||
return;
|
||||
}
|
||||
d->pos += pad;
|
||||
}
|
||||
|
||||
void vkb_dec_raw_into(vkb_dec *d, void *dst, size_t n)
|
||||
{
|
||||
dec_align(d);
|
||||
vkb_dec_bytes(d, dst, n);
|
||||
}
|
||||
|
||||
const void *vkb_dec_raw_view(vkb_dec *d, size_t n)
|
||||
{
|
||||
dec_align(d);
|
||||
if (d->err || d->len - d->pos < n) {
|
||||
d->err = 1;
|
||||
return NULL;
|
||||
}
|
||||
const void *p = d->buf + d->pos;
|
||||
d->pos += n;
|
||||
return p;
|
||||
}
|
||||
|
||||
void *vkb_dec_alloc(vkb_dec *d, size_t n)
|
||||
{
|
||||
if (d->err) return NULL;
|
||||
if (n > ((size_t)1 << 32)) {
|
||||
d->err = 1;
|
||||
return NULL;
|
||||
}
|
||||
void *p = vkb_arena_alloc(d->arena, n);
|
||||
if (!p) d->err = 1;
|
||||
return p;
|
||||
}
|
||||
|
||||
void *vkb_dec_alloc_zero(vkb_dec *d, size_t n) { return vkb_dec_alloc(d, n); }
|
||||
|
||||
const char *vkb_dec_str(vkb_dec *d)
|
||||
{
|
||||
if (!vkb_dec_u8(d)) return NULL;
|
||||
uint32_t n = vkb_dec_u32(d);
|
||||
if (d->err || d->len - d->pos < n) {
|
||||
d->err = 1;
|
||||
return NULL;
|
||||
}
|
||||
char *s = vkb_dec_alloc(d, (size_t)n + 1);
|
||||
if (!s) return NULL;
|
||||
memcpy(s, d->buf + d->pos, n);
|
||||
s[n] = 0;
|
||||
d->pos += n;
|
||||
return s;
|
||||
}
|
||||
|
||||
const char *const *vkb_dec_strarray(vkb_dec *d)
|
||||
{
|
||||
if (!vkb_dec_u8(d)) return NULL;
|
||||
uint32_t n = vkb_dec_u32(d);
|
||||
if (d->err || n > (d->len - d->pos)) {
|
||||
d->err = 1;
|
||||
return NULL;
|
||||
}
|
||||
const char **a = vkb_dec_alloc(d, (size_t)(n ? n : 1) * sizeof(char *));
|
||||
for (uint32_t i = 0; a && i < n; i++) a[i] = vkb_dec_str(d);
|
||||
return a;
|
||||
}
|
||||
|
||||
const void *vkb_dec_blob(vkb_dec *d, size_t *n)
|
||||
{
|
||||
if (!vkb_dec_u8(d)) {
|
||||
if (n) *n = 0;
|
||||
return NULL;
|
||||
}
|
||||
uint64_t sz = vkb_dec_u64(d);
|
||||
if (n) *n = (size_t)sz;
|
||||
return vkb_dec_raw_view(d, (size_t)sz);
|
||||
}
|
||||
|
||||
void vkb_dec_blob_into(vkb_dec *d, void *dst, size_t cap)
|
||||
{
|
||||
size_t n = 0;
|
||||
const void *p = vkb_dec_blob(d, &n);
|
||||
if (p && dst) memcpy(dst, p, n < cap ? n : cap);
|
||||
}
|
||||
|
||||
int vkb_dec_fd(vkb_dec *d)
|
||||
{
|
||||
uint32_t i = vkb_dec_u32(d);
|
||||
if (i == VKB_FD_NONE || d->err) return -1;
|
||||
if ((int)i >= d->nfds || (d->fd_taken & (1u << i))) {
|
||||
d->err = 1;
|
||||
return -1;
|
||||
}
|
||||
d->fd_taken |= 1u << i;
|
||||
return d->fds[i];
|
||||
}
|
||||
|
||||
void vkb_dec_close_untaken(vkb_dec *d)
|
||||
{
|
||||
for (int i = 0; i < d->nfds; i++) {
|
||||
if (!(d->fd_taken & (1u << i)) && d->fds[i] >= 0) close(d->fds[i]);
|
||||
}
|
||||
d->fd_taken = 0xffffffffu;
|
||||
}
|
||||
|
||||
const void *vkb_dec_chain(vkb_dec *d)
|
||||
{
|
||||
uint32_t t = vkb_dec_u32(d);
|
||||
if (d->err || t == VKB_CHAIN_END) return NULL;
|
||||
size_t sz = vkb_struct_size((VkStructureType)t);
|
||||
if (!sz) {
|
||||
VKB_ERR("protocol: unknown structure type %u in a chain", t);
|
||||
d->err = 1;
|
||||
return NULL;
|
||||
}
|
||||
void *p = vkb_dec_alloc(d, sz);
|
||||
if (!p) return NULL;
|
||||
vkb_dec_chain_elem(d, (VkStructureType)t, p);
|
||||
return p;
|
||||
}
|
||||
|
||||
void vkb_dec_out_template(vkb_dec *d, void *dst, size_t size)
|
||||
{
|
||||
vkb_dec_raw_into(d, dst, size);
|
||||
VkBaseOutStructure *prev = dst;
|
||||
prev->pNext = NULL;
|
||||
for (;;) {
|
||||
uint32_t t = vkb_dec_u32(d);
|
||||
if (d->err || t == VKB_CHAIN_END) break;
|
||||
size_t sz = vkb_struct_size((VkStructureType)t);
|
||||
if (!sz) {
|
||||
d->err = 1;
|
||||
break;
|
||||
}
|
||||
VkBaseOutStructure *el = vkb_dec_alloc(d, sz);
|
||||
if (!el) break;
|
||||
vkb_dec_raw_into(d, el, sz);
|
||||
el->pNext = NULL;
|
||||
size_t co, po, es;
|
||||
if (out_array_info((VkStructureType)t, &co, &po, &es)) {
|
||||
void *arr = NULL;
|
||||
if (vkb_dec_u8(d)) {
|
||||
uint32_t n;
|
||||
memcpy(&n, (uint8_t *)el + co, 4);
|
||||
arr = vkb_dec_alloc(d, (size_t)(n ? n : 1) * es);
|
||||
}
|
||||
memcpy((uint8_t *)el + po, &arr, sizeof(arr));
|
||||
}
|
||||
prev->pNext = el;
|
||||
prev = el;
|
||||
}
|
||||
}
|
||||
|
||||
void vkb_dec_out_struct(vkb_dec *d, void *dst, size_t size)
|
||||
{
|
||||
VkBaseOutStructure *top = dst;
|
||||
VkBaseOutStructure *keep = top->pNext;
|
||||
vkb_dec_raw_into(d, dst, size);
|
||||
top->pNext = keep;
|
||||
VkBaseOutStructure *app = (VkBaseOutStructure *)next_known_out(keep);
|
||||
for (;;) {
|
||||
uint32_t t = vkb_dec_u32(d);
|
||||
if (d->err || t == VKB_CHAIN_END) break;
|
||||
size_t sz = vkb_struct_size((VkStructureType)t);
|
||||
const uint8_t *src = vkb_dec_raw_view(d, sz);
|
||||
if (!src || !sz) {
|
||||
d->err = 1;
|
||||
break;
|
||||
}
|
||||
size_t co, po, es;
|
||||
int has_arr = out_array_info((VkStructureType)t, &co, &po, &es);
|
||||
uint8_t arr_present = has_arr ? vkb_dec_u8(d) : 0;
|
||||
uint32_t arr_n = 0;
|
||||
const uint8_t *arr_src = NULL;
|
||||
if (arr_present) {
|
||||
arr_n = vkb_dec_u32(d);
|
||||
arr_src = vkb_dec_raw_view(d, (size_t)arr_n * es);
|
||||
}
|
||||
if (!app || (uint32_t)app->sType != t) {
|
||||
/* The server answered for a structure we did not send: protocol mismatch. */
|
||||
d->err = 1;
|
||||
break;
|
||||
}
|
||||
VkBaseOutStructure *keep_next = app->pNext;
|
||||
uint32_t cap = 0;
|
||||
void *app_arr = NULL;
|
||||
if (has_arr) {
|
||||
memcpy(&cap, (uint8_t *)app + co, 4);
|
||||
memcpy(&app_arr, (uint8_t *)app + po, sizeof(app_arr));
|
||||
}
|
||||
memcpy(app, src, sz);
|
||||
app->pNext = keep_next;
|
||||
if (has_arr) {
|
||||
memcpy((uint8_t *)app + po, &app_arr, sizeof(app_arr));
|
||||
if (app_arr && arr_src) {
|
||||
uint32_t n = arr_n < cap ? arr_n : cap;
|
||||
memcpy(app_arr, arr_src, (size_t)n * es);
|
||||
memcpy((uint8_t *)app + co, &n, 4);
|
||||
}
|
||||
}
|
||||
app = (VkBaseOutStructure *)next_known_out(keep_next);
|
||||
}
|
||||
}
|
||||
|
||||
void vkb_close_fd(int fd)
|
||||
{
|
||||
if (fd >= 0) close(fd);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ predicates */
|
||||
|
||||
int vkb_desc_has_image(VkDescriptorType t)
|
||||
{
|
||||
return t == VK_DESCRIPTOR_TYPE_SAMPLER || t == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER ||
|
||||
t == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE || t == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE ||
|
||||
t == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT || t == VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM ||
|
||||
t == VK_DESCRIPTOR_TYPE_BLOCK_MATCH_IMAGE_QCOM;
|
||||
}
|
||||
|
||||
int vkb_desc_has_buffer(VkDescriptorType t)
|
||||
{
|
||||
return t == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER || t == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER ||
|
||||
t == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC || t == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC;
|
||||
}
|
||||
|
||||
int vkb_desc_has_texel(VkDescriptorType t)
|
||||
{
|
||||
return t == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER || t == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
|
||||
}
|
||||
|
||||
int vkb_gp_has_tess(const VkGraphicsPipelineCreateInfo *s)
|
||||
{
|
||||
if (!s->pStages) return 1; /* library pieces: trust the pointer */
|
||||
for (uint32_t i = 0; i < s->stageCount; i++) {
|
||||
if (s->pStages[i].stage & (VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT | VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ transport */
|
||||
|
||||
int vkb_send_msg(int sock, const vkb_msg_hdr *h, const void *payload, const int *fds, int nfds)
|
||||
{
|
||||
struct iovec iov[2];
|
||||
iov[0].iov_base = (void *)h;
|
||||
iov[0].iov_len = sizeof(*h);
|
||||
iov[1].iov_base = (void *)payload;
|
||||
iov[1].iov_len = h->size;
|
||||
union {
|
||||
char buf[CMSG_SPACE(sizeof(int) * VKB_MAX_FDS)];
|
||||
struct cmsghdr align;
|
||||
} cm;
|
||||
struct msghdr msg;
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
msg.msg_iov = iov;
|
||||
msg.msg_iovlen = h->size ? 2 : 1;
|
||||
if (nfds > 0) {
|
||||
memset(&cm, 0, sizeof(cm));
|
||||
msg.msg_control = cm.buf;
|
||||
msg.msg_controllen = CMSG_SPACE(sizeof(int) * nfds);
|
||||
struct cmsghdr *c = CMSG_FIRSTHDR(&msg);
|
||||
c->cmsg_level = SOL_SOCKET;
|
||||
c->cmsg_type = SCM_RIGHTS;
|
||||
c->cmsg_len = CMSG_LEN(sizeof(int) * nfds);
|
||||
memcpy(CMSG_DATA(c), fds, sizeof(int) * nfds);
|
||||
}
|
||||
size_t total = sizeof(*h) + h->size;
|
||||
size_t sent = 0;
|
||||
while (sent < total) {
|
||||
ssize_t r = sendmsg(sock, &msg, MSG_NOSIGNAL);
|
||||
if (r < 0) {
|
||||
if (errno == EINTR) continue;
|
||||
return -1;
|
||||
}
|
||||
sent += (size_t)r;
|
||||
if (sent >= total) break;
|
||||
/* Partial write: advance the iovecs; fds went with the first chunk. */
|
||||
msg.msg_control = NULL;
|
||||
msg.msg_controllen = 0;
|
||||
size_t skip = (size_t)r;
|
||||
while (msg.msg_iovlen && skip >= msg.msg_iov[0].iov_len) {
|
||||
skip -= msg.msg_iov[0].iov_len;
|
||||
msg.msg_iov++;
|
||||
msg.msg_iovlen--;
|
||||
}
|
||||
if (msg.msg_iovlen) {
|
||||
msg.msg_iov[0].iov_base = (uint8_t *)msg.msg_iov[0].iov_base + skip;
|
||||
msg.msg_iov[0].iov_len -= skip;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int read_full(int sock, void *buf, size_t n)
|
||||
{
|
||||
size_t got = 0;
|
||||
while (got < n) {
|
||||
ssize_t r = recv(sock, (uint8_t *)buf + got, n - got, 0);
|
||||
if (r == 0) return -1;
|
||||
if (r < 0) {
|
||||
if (errno == EINTR) continue;
|
||||
return -1;
|
||||
}
|
||||
got += (size_t)r;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vkb_recv_msg(int sock, vkb_msg_hdr *h, uint8_t **payload, size_t *cap, int *fds, int *nfds)
|
||||
{
|
||||
union {
|
||||
char buf[CMSG_SPACE(sizeof(int) * VKB_MAX_FDS)];
|
||||
struct cmsghdr align;
|
||||
} cm;
|
||||
struct iovec iov = {h, sizeof(*h)};
|
||||
struct msghdr msg;
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
msg.msg_iov = &iov;
|
||||
msg.msg_iovlen = 1;
|
||||
msg.msg_control = cm.buf;
|
||||
msg.msg_controllen = sizeof(cm.buf);
|
||||
*nfds = 0;
|
||||
ssize_t r;
|
||||
do {
|
||||
r = recvmsg(sock, &msg, MSG_CMSG_CLOEXEC);
|
||||
} while (r < 0 && errno == EINTR);
|
||||
if (r <= 0) return -1;
|
||||
for (struct cmsghdr *c = CMSG_FIRSTHDR(&msg); c; c = CMSG_NXTHDR(&msg, c)) {
|
||||
if (c->cmsg_level == SOL_SOCKET && c->cmsg_type == SCM_RIGHTS) {
|
||||
int n = (int)((c->cmsg_len - CMSG_LEN(0)) / sizeof(int));
|
||||
for (int i = 0; i < n; i++) {
|
||||
int fd;
|
||||
memcpy(&fd, CMSG_DATA(c) + i * sizeof(int), sizeof(int));
|
||||
if (*nfds < VKB_MAX_FDS) fds[(*nfds)++] = fd;
|
||||
else close(fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((size_t)r < sizeof(*h) && read_full(sock, (uint8_t *)h + r, sizeof(*h) - (size_t)r) < 0) goto fail;
|
||||
if (h->magic != VKB_MAGIC) {
|
||||
VKB_ERR("transport: bad message magic 0x%08x", h->magic);
|
||||
goto fail;
|
||||
}
|
||||
if (h->size) {
|
||||
if (h->size > *cap) {
|
||||
size_t nc = *cap ? *cap : 65536;
|
||||
while (nc < h->size) nc *= 2;
|
||||
uint8_t *nb = realloc(*payload, nc);
|
||||
if (!nb) goto fail;
|
||||
*payload = nb;
|
||||
*cap = nc;
|
||||
}
|
||||
if (read_full(sock, *payload, h->size) < 0) goto fail;
|
||||
}
|
||||
return 0;
|
||||
fail:
|
||||
for (int i = 0; i < *nfds; i++) close(fds[i]);
|
||||
*nfds = 0;
|
||||
return -1;
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Wire primitives shared by the bridge's client ICD (glibc) and server (bionic).
|
||||
* See tools/vkbridge/README.md for the protocol.
|
||||
*/
|
||||
#ifndef VKB_WIRE_H
|
||||
#define VKB_WIRE_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "gen/vkb_gen.h"
|
||||
|
||||
#define VKB_MAX_FDS 16
|
||||
#define VKB_CHAIN_END 0x7FFFFFFFu
|
||||
#define VKB_FD_NONE 0xFFFFFFFFu
|
||||
|
||||
/* ---- arena: per-call scratch memory on the decoding side ---- */
|
||||
typedef struct vkb_arena_block vkb_arena_block;
|
||||
typedef struct vkb_arena {
|
||||
vkb_arena_block *head;
|
||||
size_t used_total;
|
||||
} vkb_arena;
|
||||
void *vkb_arena_alloc(vkb_arena *a, size_t n);
|
||||
void vkb_arena_reset(vkb_arena *a);
|
||||
void vkb_arena_free(vkb_arena *a);
|
||||
|
||||
/* ---- encoder ---- */
|
||||
struct vkb_enc {
|
||||
uint8_t *buf;
|
||||
size_t len, cap;
|
||||
int fds[VKB_MAX_FDS];
|
||||
int nfds;
|
||||
int oom;
|
||||
};
|
||||
void vkb_enc_init(vkb_enc *e);
|
||||
void vkb_enc_reset(vkb_enc *e); /* keeps the buffer */
|
||||
void vkb_enc_free(vkb_enc *e);
|
||||
void vkb_enc_bytes(vkb_enc *e, const void *p, size_t n);
|
||||
void vkb_enc_u8(vkb_enc *e, uint8_t v);
|
||||
void vkb_enc_u32(vkb_enc *e, uint32_t v);
|
||||
void vkb_enc_u64(vkb_enc *e, uint64_t v);
|
||||
size_t vkb_enc_raw(vkb_enc *e, const void *p, size_t n); /* 8-aligned; returns offset */
|
||||
void vkb_enc_patch_u64(vkb_enc *e, size_t off, uint64_t v);
|
||||
void vkb_enc_str(vkb_enc *e, const char *s);
|
||||
void vkb_enc_strarray(vkb_enc *e, const char *const *a, uint32_t n);
|
||||
void vkb_enc_blob(vkb_enc *e, const void *p, size_t n);
|
||||
void vkb_enc_fd(vkb_enc *e, int fd); /* sent with the message */
|
||||
void vkb_enc_chain(vkb_enc *e, const void *pNext);
|
||||
void vkb_enc_out_template(vkb_enc *e, const void *s, size_t size); /* client */
|
||||
void vkb_enc_out_struct(vkb_enc *e, const void *s, size_t size); /* server */
|
||||
void vkb_enc_append(vkb_enc *e, const vkb_enc *src); /* bytes + fds */
|
||||
|
||||
/* ---- decoder ---- */
|
||||
struct vkb_dec {
|
||||
const uint8_t *buf;
|
||||
size_t pos, len;
|
||||
int err;
|
||||
vkb_arena *arena;
|
||||
int *fds;
|
||||
int nfds;
|
||||
uint32_t fd_taken; /* bitmask of fds handed out */
|
||||
};
|
||||
void vkb_dec_init(vkb_dec *d, const void *buf, size_t len, vkb_arena *a, int *fds, int nfds);
|
||||
void vkb_dec_bytes(vkb_dec *d, void *dst, size_t n);
|
||||
uint8_t vkb_dec_u8(vkb_dec *d);
|
||||
uint32_t vkb_dec_u32(vkb_dec *d);
|
||||
uint64_t vkb_dec_u64(vkb_dec *d);
|
||||
void vkb_dec_raw_into(vkb_dec *d, void *dst, size_t n);
|
||||
const void *vkb_dec_raw_view(vkb_dec *d, size_t n);
|
||||
void *vkb_dec_alloc(vkb_dec *d, size_t n); /* zeroed */
|
||||
void *vkb_dec_alloc_zero(vkb_dec *d, size_t n);
|
||||
const char *vkb_dec_str(vkb_dec *d);
|
||||
const char *const *vkb_dec_strarray(vkb_dec *d);
|
||||
const void *vkb_dec_blob(vkb_dec *d, size_t *n);
|
||||
void vkb_dec_blob_into(vkb_dec *d, void *dst, size_t cap);
|
||||
int vkb_dec_fd(vkb_dec *d); /* caller owns the fd */
|
||||
const void *vkb_dec_chain(vkb_dec *d);
|
||||
void vkb_dec_out_template(vkb_dec *d, void *dst, size_t size); /* server */
|
||||
void vkb_dec_out_struct(vkb_dec *d, void *dst, size_t size); /* client */
|
||||
void vkb_dec_close_untaken(vkb_dec *d);
|
||||
|
||||
void vkb_close_fd(int fd);
|
||||
|
||||
/* Descriptor-type predicates used by generated encoders. */
|
||||
int vkb_desc_has_image(VkDescriptorType t);
|
||||
int vkb_desc_has_buffer(VkDescriptorType t);
|
||||
int vkb_desc_has_texel(VkDescriptorType t);
|
||||
int vkb_gp_has_tess(const VkGraphicsPipelineCreateInfo *s);
|
||||
/* Defined per side: on the client it consults the command buffer's level. */
|
||||
int vkb_cb_begin_is_secondary(const VkCommandBufferBeginInfo *s);
|
||||
|
||||
/* Defined per side: client maps a dispatchable handle to the server's value; server: identity. */
|
||||
uint64_t vkb_remote(const void *dispatchable);
|
||||
|
||||
/* ---- transport ---- */
|
||||
typedef struct vkb_msg_hdr {
|
||||
uint32_t magic; /* VKB_MAGIC */
|
||||
uint32_t size; /* payload bytes after the header */
|
||||
uint32_t cmd; /* request: command id; reply: status (0 = ok) */
|
||||
uint32_t table; /* request: server dispatch table id */
|
||||
uint32_t nfds;
|
||||
uint32_t flags;
|
||||
} vkb_msg_hdr;
|
||||
#define VKB_MAGIC 0x31424b56u /* "VKB1" */
|
||||
#define VKB_F_NOREPLY 1u
|
||||
|
||||
/* Reply status codes (vkb_msg_hdr.cmd in replies). */
|
||||
#define VKB_ST_OK 0u
|
||||
#define VKB_ST_BAD_MESSAGE 1u
|
||||
#define VKB_ST_MISSING 2u
|
||||
#define VKB_ST_BAD_TABLE 3u
|
||||
|
||||
int vkb_send_msg(int sock, const vkb_msg_hdr *h, const void *payload, const int *fds, int nfds);
|
||||
/* Receives one message; *payload is malloc'd (or reused when *cap suffices). Returns 0 on
|
||||
* success, -1 on EOF/error. fds[] receives up to VKB_MAX_FDS descriptors. */
|
||||
int vkb_recv_msg(int sock, vkb_msg_hdr *h, uint8_t **payload, size_t *cap, int *fds, int *nfds);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1 @@
|
||||
out/
|
||||
@@ -0,0 +1,39 @@
|
||||
# Host (x86_64 Linux) build of both bridge halves, for testing against the desktop's own Vulkan
|
||||
# driver: the server loads libvulkan.so.1 (pick a driver with VK_DRIVER_FILES in ITS environment),
|
||||
# the client ICD is what test programs load (VK_DRIVER_FILES=$(OUT)/vkbridge_icd.json).
|
||||
# make -C tools/vkbridge/host build
|
||||
# make -C tools/vkbridge/host test vulkaninfo + vkcube-headless smoke tests
|
||||
ROOT := $(abspath ../../..)
|
||||
VKB := $(ROOT)/tools/vkbridge
|
||||
SRV := $(ROOT)/app/src/main/cpp/vkbridge
|
||||
OUT ?= $(VKB)/host/out
|
||||
CC ?= gcc
|
||||
CFLAGS ?= -O1 -g
|
||||
WARN := -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare
|
||||
INC := -I$(VKB)/third_party/Vulkan-Headers-1.3.247/include -I$(VKB)/common -I$(VKB)/common/gen
|
||||
COMMON_SRC := $(VKB)/common/vkb_wire.c $(VKB)/common/gen/vkb_gen_structs.c
|
||||
SERVER_SRC := $(wildcard $(SRV)/*.c) $(VKB)/common/gen/vkb_gen_server.c $(COMMON_SRC)
|
||||
CLIENT_SRC := $(wildcard $(VKB)/client/*.c) $(VKB)/common/gen/vkb_gen_client.c $(COMMON_SRC)
|
||||
|
||||
all: $(OUT)/vkbridge-server $(OUT)/libvulkan_droidbridge.so $(OUT)/vkbridge_icd.json
|
||||
|
||||
$(OUT)/vkbridge-server: $(SERVER_SRC) $(wildcard $(SRV)/*.h $(VKB)/common/*.h $(VKB)/common/gen/*.h)
|
||||
@mkdir -p $(OUT)
|
||||
$(CC) $(CFLAGS) $(WARN) $(INC) -I$(SRV) -o $@ $(SERVER_SRC) -ldl -lpthread -lm
|
||||
|
||||
$(OUT)/libvulkan_droidbridge.so: $(CLIENT_SRC) $(wildcard $(VKB)/client/*.h $(VKB)/common/*.h $(VKB)/common/gen/*.h)
|
||||
@mkdir -p $(OUT)
|
||||
$(CC) $(CFLAGS) $(WARN) -fPIC -shared -fvisibility=hidden -DVKB_CLIENT $(INC) -I$(VKB)/client -I$(VKB)/client/compat \
|
||||
-o $@ $(CLIENT_SRC) -ldl -lpthread -Wl,--no-undefined
|
||||
|
||||
$(OUT)/vkbridge_icd.json:
|
||||
@mkdir -p $(OUT)
|
||||
printf '{"file_format_version":"1.0.0","ICD":{"library_path":"%s","api_version":"1.3.247"}}\n' "$(OUT)/libvulkan_droidbridge.so" > $@
|
||||
|
||||
test: all
|
||||
$(VKB)/host/run_tests.sh $(OUT)
|
||||
|
||||
clean:
|
||||
rm -rf $(OUT)
|
||||
|
||||
.PHONY: all test clean
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
Vendored
+310
@@ -0,0 +1,310 @@
|
||||
#ifndef VULKAN_VIDEO_CODEC_H264STD_H_
|
||||
#define VULKAN_VIDEO_CODEC_H264STD_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define vulkan_video_codec_h264std 1
|
||||
#include <stdint.h>
|
||||
#define STD_VIDEO_H264_CPB_CNT_LIST_SIZE 32
|
||||
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS 6
|
||||
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS 16
|
||||
#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS 6
|
||||
#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS 64
|
||||
#define STD_VIDEO_H264_MAX_NUM_LIST_REF 32
|
||||
#define STD_VIDEO_H264_MAX_CHROMA_PLANES 2
|
||||
|
||||
typedef enum StdVideoH264ChromaFormatIdc {
|
||||
STD_VIDEO_H264_CHROMA_FORMAT_IDC_MONOCHROME = 0,
|
||||
STD_VIDEO_H264_CHROMA_FORMAT_IDC_420 = 1,
|
||||
STD_VIDEO_H264_CHROMA_FORMAT_IDC_422 = 2,
|
||||
STD_VIDEO_H264_CHROMA_FORMAT_IDC_444 = 3,
|
||||
STD_VIDEO_H264_CHROMA_FORMAT_IDC_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H264_CHROMA_FORMAT_IDC_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH264ChromaFormatIdc;
|
||||
|
||||
typedef enum StdVideoH264ProfileIdc {
|
||||
STD_VIDEO_H264_PROFILE_IDC_BASELINE = 66,
|
||||
STD_VIDEO_H264_PROFILE_IDC_MAIN = 77,
|
||||
STD_VIDEO_H264_PROFILE_IDC_HIGH = 100,
|
||||
STD_VIDEO_H264_PROFILE_IDC_HIGH_444_PREDICTIVE = 244,
|
||||
STD_VIDEO_H264_PROFILE_IDC_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H264_PROFILE_IDC_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH264ProfileIdc;
|
||||
|
||||
typedef enum StdVideoH264LevelIdc {
|
||||
STD_VIDEO_H264_LEVEL_IDC_1_0 = 0,
|
||||
STD_VIDEO_H264_LEVEL_IDC_1_1 = 1,
|
||||
STD_VIDEO_H264_LEVEL_IDC_1_2 = 2,
|
||||
STD_VIDEO_H264_LEVEL_IDC_1_3 = 3,
|
||||
STD_VIDEO_H264_LEVEL_IDC_2_0 = 4,
|
||||
STD_VIDEO_H264_LEVEL_IDC_2_1 = 5,
|
||||
STD_VIDEO_H264_LEVEL_IDC_2_2 = 6,
|
||||
STD_VIDEO_H264_LEVEL_IDC_3_0 = 7,
|
||||
STD_VIDEO_H264_LEVEL_IDC_3_1 = 8,
|
||||
STD_VIDEO_H264_LEVEL_IDC_3_2 = 9,
|
||||
STD_VIDEO_H264_LEVEL_IDC_4_0 = 10,
|
||||
STD_VIDEO_H264_LEVEL_IDC_4_1 = 11,
|
||||
STD_VIDEO_H264_LEVEL_IDC_4_2 = 12,
|
||||
STD_VIDEO_H264_LEVEL_IDC_5_0 = 13,
|
||||
STD_VIDEO_H264_LEVEL_IDC_5_1 = 14,
|
||||
STD_VIDEO_H264_LEVEL_IDC_5_2 = 15,
|
||||
STD_VIDEO_H264_LEVEL_IDC_6_0 = 16,
|
||||
STD_VIDEO_H264_LEVEL_IDC_6_1 = 17,
|
||||
STD_VIDEO_H264_LEVEL_IDC_6_2 = 18,
|
||||
STD_VIDEO_H264_LEVEL_IDC_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H264_LEVEL_IDC_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH264LevelIdc;
|
||||
|
||||
typedef enum StdVideoH264PocType {
|
||||
STD_VIDEO_H264_POC_TYPE_0 = 0,
|
||||
STD_VIDEO_H264_POC_TYPE_1 = 1,
|
||||
STD_VIDEO_H264_POC_TYPE_2 = 2,
|
||||
STD_VIDEO_H264_POC_TYPE_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H264_POC_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH264PocType;
|
||||
|
||||
typedef enum StdVideoH264AspectRatioIdc {
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_UNSPECIFIED = 0,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_SQUARE = 1,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_12_11 = 2,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_10_11 = 3,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_16_11 = 4,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_40_33 = 5,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_24_11 = 6,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_20_11 = 7,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_32_11 = 8,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_80_33 = 9,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_18_11 = 10,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_15_11 = 11,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_64_33 = 12,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_160_99 = 13,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_4_3 = 14,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_3_2 = 15,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_2_1 = 16,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_EXTENDED_SAR = 255,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H264_ASPECT_RATIO_IDC_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH264AspectRatioIdc;
|
||||
|
||||
typedef enum StdVideoH264WeightedBipredIdc {
|
||||
STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_DEFAULT = 0,
|
||||
STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_EXPLICIT = 1,
|
||||
STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_IMPLICIT = 2,
|
||||
STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH264WeightedBipredIdc;
|
||||
|
||||
typedef enum StdVideoH264ModificationOfPicNumsIdc {
|
||||
STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_SHORT_TERM_SUBTRACT = 0,
|
||||
STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_SHORT_TERM_ADD = 1,
|
||||
STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_LONG_TERM = 2,
|
||||
STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_END = 3,
|
||||
STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH264ModificationOfPicNumsIdc;
|
||||
|
||||
typedef enum StdVideoH264MemMgmtControlOp {
|
||||
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_END = 0,
|
||||
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_SHORT_TERM = 1,
|
||||
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_LONG_TERM = 2,
|
||||
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MARK_LONG_TERM = 3,
|
||||
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_SET_MAX_LONG_TERM_INDEX = 4,
|
||||
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_ALL = 5,
|
||||
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MARK_CURRENT_AS_LONG_TERM = 6,
|
||||
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH264MemMgmtControlOp;
|
||||
|
||||
typedef enum StdVideoH264CabacInitIdc {
|
||||
STD_VIDEO_H264_CABAC_INIT_IDC_0 = 0,
|
||||
STD_VIDEO_H264_CABAC_INIT_IDC_1 = 1,
|
||||
STD_VIDEO_H264_CABAC_INIT_IDC_2 = 2,
|
||||
STD_VIDEO_H264_CABAC_INIT_IDC_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H264_CABAC_INIT_IDC_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH264CabacInitIdc;
|
||||
|
||||
typedef enum StdVideoH264DisableDeblockingFilterIdc {
|
||||
STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_DISABLED = 0,
|
||||
STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_ENABLED = 1,
|
||||
STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_PARTIAL = 2,
|
||||
STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH264DisableDeblockingFilterIdc;
|
||||
|
||||
typedef enum StdVideoH264SliceType {
|
||||
STD_VIDEO_H264_SLICE_TYPE_P = 0,
|
||||
STD_VIDEO_H264_SLICE_TYPE_B = 1,
|
||||
STD_VIDEO_H264_SLICE_TYPE_I = 2,
|
||||
STD_VIDEO_H264_SLICE_TYPE_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H264_SLICE_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH264SliceType;
|
||||
|
||||
typedef enum StdVideoH264PictureType {
|
||||
STD_VIDEO_H264_PICTURE_TYPE_P = 0,
|
||||
STD_VIDEO_H264_PICTURE_TYPE_B = 1,
|
||||
STD_VIDEO_H264_PICTURE_TYPE_I = 2,
|
||||
STD_VIDEO_H264_PICTURE_TYPE_IDR = 5,
|
||||
STD_VIDEO_H264_PICTURE_TYPE_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H264_PICTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH264PictureType;
|
||||
|
||||
typedef enum StdVideoH264NonVclNaluType {
|
||||
STD_VIDEO_H264_NON_VCL_NALU_TYPE_SPS = 0,
|
||||
STD_VIDEO_H264_NON_VCL_NALU_TYPE_PPS = 1,
|
||||
STD_VIDEO_H264_NON_VCL_NALU_TYPE_AUD = 2,
|
||||
STD_VIDEO_H264_NON_VCL_NALU_TYPE_PREFIX = 3,
|
||||
STD_VIDEO_H264_NON_VCL_NALU_TYPE_END_OF_SEQUENCE = 4,
|
||||
STD_VIDEO_H264_NON_VCL_NALU_TYPE_END_OF_STREAM = 5,
|
||||
STD_VIDEO_H264_NON_VCL_NALU_TYPE_PRECODED = 6,
|
||||
STD_VIDEO_H264_NON_VCL_NALU_TYPE_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H264_NON_VCL_NALU_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH264NonVclNaluType;
|
||||
typedef struct StdVideoH264SpsVuiFlags {
|
||||
uint32_t aspect_ratio_info_present_flag : 1;
|
||||
uint32_t overscan_info_present_flag : 1;
|
||||
uint32_t overscan_appropriate_flag : 1;
|
||||
uint32_t video_signal_type_present_flag : 1;
|
||||
uint32_t video_full_range_flag : 1;
|
||||
uint32_t color_description_present_flag : 1;
|
||||
uint32_t chroma_loc_info_present_flag : 1;
|
||||
uint32_t timing_info_present_flag : 1;
|
||||
uint32_t fixed_frame_rate_flag : 1;
|
||||
uint32_t bitstream_restriction_flag : 1;
|
||||
uint32_t nal_hrd_parameters_present_flag : 1;
|
||||
uint32_t vcl_hrd_parameters_present_flag : 1;
|
||||
} StdVideoH264SpsVuiFlags;
|
||||
|
||||
typedef struct StdVideoH264HrdParameters {
|
||||
uint8_t cpb_cnt_minus1;
|
||||
uint8_t bit_rate_scale;
|
||||
uint8_t cpb_size_scale;
|
||||
uint8_t reserved1;
|
||||
uint32_t bit_rate_value_minus1[STD_VIDEO_H264_CPB_CNT_LIST_SIZE];
|
||||
uint32_t cpb_size_value_minus1[STD_VIDEO_H264_CPB_CNT_LIST_SIZE];
|
||||
uint8_t cbr_flag[STD_VIDEO_H264_CPB_CNT_LIST_SIZE];
|
||||
uint32_t initial_cpb_removal_delay_length_minus1;
|
||||
uint32_t cpb_removal_delay_length_minus1;
|
||||
uint32_t dpb_output_delay_length_minus1;
|
||||
uint32_t time_offset_length;
|
||||
} StdVideoH264HrdParameters;
|
||||
|
||||
typedef struct StdVideoH264SequenceParameterSetVui {
|
||||
StdVideoH264SpsVuiFlags flags;
|
||||
StdVideoH264AspectRatioIdc aspect_ratio_idc;
|
||||
uint16_t sar_width;
|
||||
uint16_t sar_height;
|
||||
uint8_t video_format;
|
||||
uint8_t colour_primaries;
|
||||
uint8_t transfer_characteristics;
|
||||
uint8_t matrix_coefficients;
|
||||
uint32_t num_units_in_tick;
|
||||
uint32_t time_scale;
|
||||
uint8_t max_num_reorder_frames;
|
||||
uint8_t max_dec_frame_buffering;
|
||||
uint8_t chroma_sample_loc_type_top_field;
|
||||
uint8_t chroma_sample_loc_type_bottom_field;
|
||||
uint32_t reserved1;
|
||||
const StdVideoH264HrdParameters* pHrdParameters;
|
||||
} StdVideoH264SequenceParameterSetVui;
|
||||
|
||||
typedef struct StdVideoH264SpsFlags {
|
||||
uint32_t constraint_set0_flag : 1;
|
||||
uint32_t constraint_set1_flag : 1;
|
||||
uint32_t constraint_set2_flag : 1;
|
||||
uint32_t constraint_set3_flag : 1;
|
||||
uint32_t constraint_set4_flag : 1;
|
||||
uint32_t constraint_set5_flag : 1;
|
||||
uint32_t direct_8x8_inference_flag : 1;
|
||||
uint32_t mb_adaptive_frame_field_flag : 1;
|
||||
uint32_t frame_mbs_only_flag : 1;
|
||||
uint32_t delta_pic_order_always_zero_flag : 1;
|
||||
uint32_t separate_colour_plane_flag : 1;
|
||||
uint32_t gaps_in_frame_num_value_allowed_flag : 1;
|
||||
uint32_t qpprime_y_zero_transform_bypass_flag : 1;
|
||||
uint32_t frame_cropping_flag : 1;
|
||||
uint32_t seq_scaling_matrix_present_flag : 1;
|
||||
uint32_t vui_parameters_present_flag : 1;
|
||||
} StdVideoH264SpsFlags;
|
||||
|
||||
typedef struct StdVideoH264ScalingLists {
|
||||
uint16_t scaling_list_present_mask;
|
||||
uint16_t use_default_scaling_matrix_mask;
|
||||
uint8_t ScalingList4x4[STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS][STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS];
|
||||
uint8_t ScalingList8x8[STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS][STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS];
|
||||
} StdVideoH264ScalingLists;
|
||||
|
||||
typedef struct StdVideoH264SequenceParameterSet {
|
||||
StdVideoH264SpsFlags flags;
|
||||
StdVideoH264ProfileIdc profile_idc;
|
||||
StdVideoH264LevelIdc level_idc;
|
||||
StdVideoH264ChromaFormatIdc chroma_format_idc;
|
||||
uint8_t seq_parameter_set_id;
|
||||
uint8_t bit_depth_luma_minus8;
|
||||
uint8_t bit_depth_chroma_minus8;
|
||||
uint8_t log2_max_frame_num_minus4;
|
||||
StdVideoH264PocType pic_order_cnt_type;
|
||||
int32_t offset_for_non_ref_pic;
|
||||
int32_t offset_for_top_to_bottom_field;
|
||||
uint8_t log2_max_pic_order_cnt_lsb_minus4;
|
||||
uint8_t num_ref_frames_in_pic_order_cnt_cycle;
|
||||
uint8_t max_num_ref_frames;
|
||||
uint8_t reserved1;
|
||||
uint32_t pic_width_in_mbs_minus1;
|
||||
uint32_t pic_height_in_map_units_minus1;
|
||||
uint32_t frame_crop_left_offset;
|
||||
uint32_t frame_crop_right_offset;
|
||||
uint32_t frame_crop_top_offset;
|
||||
uint32_t frame_crop_bottom_offset;
|
||||
uint32_t reserved2;
|
||||
const int32_t* pOffsetForRefFrame;
|
||||
const StdVideoH264ScalingLists* pScalingLists;
|
||||
const StdVideoH264SequenceParameterSetVui* pSequenceParameterSetVui;
|
||||
} StdVideoH264SequenceParameterSet;
|
||||
|
||||
typedef struct StdVideoH264PpsFlags {
|
||||
uint32_t transform_8x8_mode_flag : 1;
|
||||
uint32_t redundant_pic_cnt_present_flag : 1;
|
||||
uint32_t constrained_intra_pred_flag : 1;
|
||||
uint32_t deblocking_filter_control_present_flag : 1;
|
||||
uint32_t weighted_pred_flag : 1;
|
||||
uint32_t bottom_field_pic_order_in_frame_present_flag : 1;
|
||||
uint32_t entropy_coding_mode_flag : 1;
|
||||
uint32_t pic_scaling_matrix_present_flag : 1;
|
||||
} StdVideoH264PpsFlags;
|
||||
|
||||
typedef struct StdVideoH264PictureParameterSet {
|
||||
StdVideoH264PpsFlags flags;
|
||||
uint8_t seq_parameter_set_id;
|
||||
uint8_t pic_parameter_set_id;
|
||||
uint8_t num_ref_idx_l0_default_active_minus1;
|
||||
uint8_t num_ref_idx_l1_default_active_minus1;
|
||||
StdVideoH264WeightedBipredIdc weighted_bipred_idc;
|
||||
int8_t pic_init_qp_minus26;
|
||||
int8_t pic_init_qs_minus26;
|
||||
int8_t chroma_qp_index_offset;
|
||||
int8_t second_chroma_qp_index_offset;
|
||||
const StdVideoH264ScalingLists* pScalingLists;
|
||||
} StdVideoH264PictureParameterSet;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
#ifndef VULKAN_VIDEO_CODEC_H264STD_DECODE_H_
|
||||
#define VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define vulkan_video_codec_h264std_decode 1
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0)
|
||||
|
||||
#define STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE 2
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_decode"
|
||||
|
||||
typedef enum StdVideoDecodeH264FieldOrderCount {
|
||||
STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_TOP = 0,
|
||||
STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_BOTTOM = 1,
|
||||
STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoDecodeH264FieldOrderCount;
|
||||
typedef struct StdVideoDecodeH264PictureInfoFlags {
|
||||
uint32_t field_pic_flag : 1;
|
||||
uint32_t is_intra : 1;
|
||||
uint32_t IdrPicFlag : 1;
|
||||
uint32_t bottom_field_flag : 1;
|
||||
uint32_t is_reference : 1;
|
||||
uint32_t complementary_field_pair : 1;
|
||||
} StdVideoDecodeH264PictureInfoFlags;
|
||||
|
||||
typedef struct StdVideoDecodeH264PictureInfo {
|
||||
StdVideoDecodeH264PictureInfoFlags flags;
|
||||
uint8_t seq_parameter_set_id;
|
||||
uint8_t pic_parameter_set_id;
|
||||
uint8_t reserved1;
|
||||
uint8_t reserved2;
|
||||
uint16_t frame_num;
|
||||
uint16_t idr_pic_id;
|
||||
int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE];
|
||||
} StdVideoDecodeH264PictureInfo;
|
||||
|
||||
typedef struct StdVideoDecodeH264ReferenceInfoFlags {
|
||||
uint32_t top_field_flag : 1;
|
||||
uint32_t bottom_field_flag : 1;
|
||||
uint32_t used_for_long_term_reference : 1;
|
||||
uint32_t is_non_existing : 1;
|
||||
} StdVideoDecodeH264ReferenceInfoFlags;
|
||||
|
||||
typedef struct StdVideoDecodeH264ReferenceInfo {
|
||||
StdVideoDecodeH264ReferenceInfoFlags flags;
|
||||
uint16_t FrameNum;
|
||||
uint16_t reserved;
|
||||
int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE];
|
||||
} StdVideoDecodeH264ReferenceInfo;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
#ifndef VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_
|
||||
#define VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define vulkan_video_codec_h264std_encode 1
|
||||
// Vulkan 0.9 provisional Vulkan video H.264 encode std specification version number
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_API_VERSION_0_9_9 VK_MAKE_VIDEO_STD_VERSION(0, 9, 9)
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_API_VERSION_0_9_9
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_encode"
|
||||
typedef struct StdVideoEncodeH264WeightTableFlags {
|
||||
uint32_t luma_weight_l0_flag;
|
||||
uint32_t chroma_weight_l0_flag;
|
||||
uint32_t luma_weight_l1_flag;
|
||||
uint32_t chroma_weight_l1_flag;
|
||||
} StdVideoEncodeH264WeightTableFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH264WeightTable {
|
||||
StdVideoEncodeH264WeightTableFlags flags;
|
||||
uint8_t luma_log2_weight_denom;
|
||||
uint8_t chroma_log2_weight_denom;
|
||||
int8_t luma_weight_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF];
|
||||
int8_t luma_offset_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF];
|
||||
int8_t chroma_weight_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
|
||||
int8_t chroma_offset_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
|
||||
int8_t luma_weight_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF];
|
||||
int8_t luma_offset_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF];
|
||||
int8_t chroma_weight_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
|
||||
int8_t chroma_offset_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
|
||||
} StdVideoEncodeH264WeightTable;
|
||||
|
||||
typedef struct StdVideoEncodeH264SliceHeaderFlags {
|
||||
uint32_t direct_spatial_mv_pred_flag : 1;
|
||||
uint32_t num_ref_idx_active_override_flag : 1;
|
||||
uint32_t no_output_of_prior_pics_flag : 1;
|
||||
uint32_t adaptive_ref_pic_marking_mode_flag : 1;
|
||||
uint32_t no_prior_references_available_flag : 1;
|
||||
} StdVideoEncodeH264SliceHeaderFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH264PictureInfoFlags {
|
||||
uint32_t idr_flag : 1;
|
||||
uint32_t is_reference_flag : 1;
|
||||
uint32_t used_for_long_term_reference : 1;
|
||||
} StdVideoEncodeH264PictureInfoFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH264ReferenceInfoFlags {
|
||||
uint32_t used_for_long_term_reference : 1;
|
||||
} StdVideoEncodeH264ReferenceInfoFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH264ReferenceListsInfoFlags {
|
||||
uint32_t ref_pic_list_modification_flag_l0 : 1;
|
||||
uint32_t ref_pic_list_modification_flag_l1 : 1;
|
||||
} StdVideoEncodeH264ReferenceListsInfoFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH264RefListModEntry {
|
||||
StdVideoH264ModificationOfPicNumsIdc modification_of_pic_nums_idc;
|
||||
uint16_t abs_diff_pic_num_minus1;
|
||||
uint16_t long_term_pic_num;
|
||||
} StdVideoEncodeH264RefListModEntry;
|
||||
|
||||
typedef struct StdVideoEncodeH264RefPicMarkingEntry {
|
||||
StdVideoH264MemMgmtControlOp operation;
|
||||
uint16_t difference_of_pic_nums_minus1;
|
||||
uint16_t long_term_pic_num;
|
||||
uint16_t long_term_frame_idx;
|
||||
uint16_t max_long_term_frame_idx_plus1;
|
||||
} StdVideoEncodeH264RefPicMarkingEntry;
|
||||
|
||||
typedef struct StdVideoEncodeH264ReferenceListsInfo {
|
||||
StdVideoEncodeH264ReferenceListsInfoFlags flags;
|
||||
uint8_t refPicList0EntryCount;
|
||||
uint8_t refPicList1EntryCount;
|
||||
uint8_t refList0ModOpCount;
|
||||
uint8_t refList1ModOpCount;
|
||||
uint8_t refPicMarkingOpCount;
|
||||
uint8_t reserved1[7];
|
||||
const uint8_t* pRefPicList0Entries;
|
||||
const uint8_t* pRefPicList1Entries;
|
||||
const StdVideoEncodeH264RefListModEntry* pRefList0ModOperations;
|
||||
const StdVideoEncodeH264RefListModEntry* pRefList1ModOperations;
|
||||
const StdVideoEncodeH264RefPicMarkingEntry* pRefPicMarkingOperations;
|
||||
} StdVideoEncodeH264ReferenceListsInfo;
|
||||
|
||||
typedef struct StdVideoEncodeH264PictureInfo {
|
||||
StdVideoEncodeH264PictureInfoFlags flags;
|
||||
uint8_t seq_parameter_set_id;
|
||||
uint8_t pic_parameter_set_id;
|
||||
uint16_t reserved1;
|
||||
StdVideoH264PictureType pictureType;
|
||||
uint32_t frame_num;
|
||||
int32_t PicOrderCnt;
|
||||
} StdVideoEncodeH264PictureInfo;
|
||||
|
||||
typedef struct StdVideoEncodeH264ReferenceInfo {
|
||||
StdVideoEncodeH264ReferenceInfoFlags flags;
|
||||
StdVideoH264PictureType pictureType;
|
||||
uint32_t FrameNum;
|
||||
int32_t PicOrderCnt;
|
||||
uint16_t long_term_pic_num;
|
||||
uint16_t long_term_frame_idx;
|
||||
} StdVideoEncodeH264ReferenceInfo;
|
||||
|
||||
typedef struct StdVideoEncodeH264SliceHeader {
|
||||
StdVideoEncodeH264SliceHeaderFlags flags;
|
||||
uint32_t first_mb_in_slice;
|
||||
StdVideoH264SliceType slice_type;
|
||||
uint16_t idr_pic_id;
|
||||
uint8_t num_ref_idx_l0_active_minus1;
|
||||
uint8_t num_ref_idx_l1_active_minus1;
|
||||
StdVideoH264CabacInitIdc cabac_init_idc;
|
||||
StdVideoH264DisableDeblockingFilterIdc disable_deblocking_filter_idc;
|
||||
int8_t slice_alpha_c0_offset_div2;
|
||||
int8_t slice_beta_offset_div2;
|
||||
uint16_t reserved1;
|
||||
uint32_t reserved2;
|
||||
const StdVideoEncodeH264WeightTable* pWeightTable;
|
||||
} StdVideoEncodeH264SliceHeader;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Vendored
+443
@@ -0,0 +1,443 @@
|
||||
#ifndef VULKAN_VIDEO_CODEC_H265STD_H_
|
||||
#define VULKAN_VIDEO_CODEC_H265STD_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define vulkan_video_codec_h265std 1
|
||||
#define STD_VIDEO_H265_SUBLAYERS_LIST_SIZE 7
|
||||
#define STD_VIDEO_H265_CPB_CNT_LIST_SIZE 32
|
||||
#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS 6
|
||||
#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS 16
|
||||
#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS 6
|
||||
#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_ELEMENTS 64
|
||||
#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS 6
|
||||
#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS 64
|
||||
#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS 2
|
||||
#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS 64
|
||||
#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE 3
|
||||
#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE 128
|
||||
#define STD_VIDEO_H265_MAX_DPB_SIZE 16
|
||||
#define STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS 32
|
||||
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE 6
|
||||
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE 19
|
||||
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE 21
|
||||
#define STD_VIDEO_H265_MAX_NUM_LIST_REF 15
|
||||
#define STD_VIDEO_H265_MAX_CHROMA_PLANES 2
|
||||
#define STD_VIDEO_H265_MAX_SHORT_TERM_REF_PIC_SETS 64
|
||||
#define STD_VIDEO_H265_MAX_LONG_TERM_PICS 16
|
||||
#define STD_VIDEO_H265_MAX_DELTA_POC 48
|
||||
|
||||
typedef enum StdVideoH265ChromaFormatIdc {
|
||||
STD_VIDEO_H265_CHROMA_FORMAT_IDC_MONOCHROME = 0,
|
||||
STD_VIDEO_H265_CHROMA_FORMAT_IDC_420 = 1,
|
||||
STD_VIDEO_H265_CHROMA_FORMAT_IDC_422 = 2,
|
||||
STD_VIDEO_H265_CHROMA_FORMAT_IDC_444 = 3,
|
||||
STD_VIDEO_H265_CHROMA_FORMAT_IDC_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H265_CHROMA_FORMAT_IDC_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH265ChromaFormatIdc;
|
||||
|
||||
typedef enum StdVideoH265ProfileIdc {
|
||||
STD_VIDEO_H265_PROFILE_IDC_MAIN = 1,
|
||||
STD_VIDEO_H265_PROFILE_IDC_MAIN_10 = 2,
|
||||
STD_VIDEO_H265_PROFILE_IDC_MAIN_STILL_PICTURE = 3,
|
||||
STD_VIDEO_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSIONS = 4,
|
||||
STD_VIDEO_H265_PROFILE_IDC_SCC_EXTENSIONS = 9,
|
||||
STD_VIDEO_H265_PROFILE_IDC_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H265_PROFILE_IDC_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH265ProfileIdc;
|
||||
|
||||
typedef enum StdVideoH265LevelIdc {
|
||||
STD_VIDEO_H265_LEVEL_IDC_1_0 = 0,
|
||||
STD_VIDEO_H265_LEVEL_IDC_2_0 = 1,
|
||||
STD_VIDEO_H265_LEVEL_IDC_2_1 = 2,
|
||||
STD_VIDEO_H265_LEVEL_IDC_3_0 = 3,
|
||||
STD_VIDEO_H265_LEVEL_IDC_3_1 = 4,
|
||||
STD_VIDEO_H265_LEVEL_IDC_4_0 = 5,
|
||||
STD_VIDEO_H265_LEVEL_IDC_4_1 = 6,
|
||||
STD_VIDEO_H265_LEVEL_IDC_5_0 = 7,
|
||||
STD_VIDEO_H265_LEVEL_IDC_5_1 = 8,
|
||||
STD_VIDEO_H265_LEVEL_IDC_5_2 = 9,
|
||||
STD_VIDEO_H265_LEVEL_IDC_6_0 = 10,
|
||||
STD_VIDEO_H265_LEVEL_IDC_6_1 = 11,
|
||||
STD_VIDEO_H265_LEVEL_IDC_6_2 = 12,
|
||||
STD_VIDEO_H265_LEVEL_IDC_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H265_LEVEL_IDC_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH265LevelIdc;
|
||||
|
||||
typedef enum StdVideoH265SliceType {
|
||||
STD_VIDEO_H265_SLICE_TYPE_B = 0,
|
||||
STD_VIDEO_H265_SLICE_TYPE_P = 1,
|
||||
STD_VIDEO_H265_SLICE_TYPE_I = 2,
|
||||
STD_VIDEO_H265_SLICE_TYPE_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H265_SLICE_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH265SliceType;
|
||||
|
||||
typedef enum StdVideoH265PictureType {
|
||||
STD_VIDEO_H265_PICTURE_TYPE_P = 0,
|
||||
STD_VIDEO_H265_PICTURE_TYPE_B = 1,
|
||||
STD_VIDEO_H265_PICTURE_TYPE_I = 2,
|
||||
STD_VIDEO_H265_PICTURE_TYPE_IDR = 3,
|
||||
STD_VIDEO_H265_PICTURE_TYPE_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H265_PICTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH265PictureType;
|
||||
|
||||
typedef enum StdVideoH265AspectRatioIdc {
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_UNSPECIFIED = 0,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_SQUARE = 1,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_12_11 = 2,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_10_11 = 3,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_16_11 = 4,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_40_33 = 5,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_24_11 = 6,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_20_11 = 7,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_32_11 = 8,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_80_33 = 9,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_18_11 = 10,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_15_11 = 11,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_64_33 = 12,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_160_99 = 13,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_4_3 = 14,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_3_2 = 15,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_2_1 = 16,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_EXTENDED_SAR = 255,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_H265_ASPECT_RATIO_IDC_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoH265AspectRatioIdc;
|
||||
typedef struct StdVideoH265DecPicBufMgr {
|
||||
uint32_t max_latency_increase_plus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
|
||||
uint8_t max_dec_pic_buffering_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
|
||||
uint8_t max_num_reorder_pics[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
|
||||
} StdVideoH265DecPicBufMgr;
|
||||
|
||||
typedef struct StdVideoH265SubLayerHrdParameters {
|
||||
uint32_t bit_rate_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
|
||||
uint32_t cpb_size_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
|
||||
uint32_t cpb_size_du_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
|
||||
uint32_t bit_rate_du_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
|
||||
uint32_t cbr_flag;
|
||||
} StdVideoH265SubLayerHrdParameters;
|
||||
|
||||
typedef struct StdVideoH265HrdFlags {
|
||||
uint32_t nal_hrd_parameters_present_flag : 1;
|
||||
uint32_t vcl_hrd_parameters_present_flag : 1;
|
||||
uint32_t sub_pic_hrd_params_present_flag : 1;
|
||||
uint32_t sub_pic_cpb_params_in_pic_timing_sei_flag : 1;
|
||||
uint32_t fixed_pic_rate_general_flag : 8;
|
||||
uint32_t fixed_pic_rate_within_cvs_flag : 8;
|
||||
uint32_t low_delay_hrd_flag : 8;
|
||||
} StdVideoH265HrdFlags;
|
||||
|
||||
typedef struct StdVideoH265HrdParameters {
|
||||
StdVideoH265HrdFlags flags;
|
||||
uint8_t tick_divisor_minus2;
|
||||
uint8_t du_cpb_removal_delay_increment_length_minus1;
|
||||
uint8_t dpb_output_delay_du_length_minus1;
|
||||
uint8_t bit_rate_scale;
|
||||
uint8_t cpb_size_scale;
|
||||
uint8_t cpb_size_du_scale;
|
||||
uint8_t initial_cpb_removal_delay_length_minus1;
|
||||
uint8_t au_cpb_removal_delay_length_minus1;
|
||||
uint8_t dpb_output_delay_length_minus1;
|
||||
uint8_t cpb_cnt_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
|
||||
uint16_t elemental_duration_in_tc_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
|
||||
uint16_t reserved[3];
|
||||
const StdVideoH265SubLayerHrdParameters* pSubLayerHrdParametersNal;
|
||||
const StdVideoH265SubLayerHrdParameters* pSubLayerHrdParametersVcl;
|
||||
} StdVideoH265HrdParameters;
|
||||
|
||||
typedef struct StdVideoH265VpsFlags {
|
||||
uint32_t vps_temporal_id_nesting_flag : 1;
|
||||
uint32_t vps_sub_layer_ordering_info_present_flag : 1;
|
||||
uint32_t vps_timing_info_present_flag : 1;
|
||||
uint32_t vps_poc_proportional_to_timing_flag : 1;
|
||||
} StdVideoH265VpsFlags;
|
||||
|
||||
typedef struct StdVideoH265ProfileTierLevelFlags {
|
||||
uint32_t general_tier_flag : 1;
|
||||
uint32_t general_progressive_source_flag : 1;
|
||||
uint32_t general_interlaced_source_flag : 1;
|
||||
uint32_t general_non_packed_constraint_flag : 1;
|
||||
uint32_t general_frame_only_constraint_flag : 1;
|
||||
} StdVideoH265ProfileTierLevelFlags;
|
||||
|
||||
typedef struct StdVideoH265ProfileTierLevel {
|
||||
StdVideoH265ProfileTierLevelFlags flags;
|
||||
StdVideoH265ProfileIdc general_profile_idc;
|
||||
StdVideoH265LevelIdc general_level_idc;
|
||||
} StdVideoH265ProfileTierLevel;
|
||||
|
||||
typedef struct StdVideoH265VideoParameterSet {
|
||||
StdVideoH265VpsFlags flags;
|
||||
uint8_t vps_video_parameter_set_id;
|
||||
uint8_t vps_max_sub_layers_minus1;
|
||||
uint8_t reserved1;
|
||||
uint8_t reserved2;
|
||||
uint32_t vps_num_units_in_tick;
|
||||
uint32_t vps_time_scale;
|
||||
uint32_t vps_num_ticks_poc_diff_one_minus1;
|
||||
uint32_t reserved3;
|
||||
const StdVideoH265DecPicBufMgr* pDecPicBufMgr;
|
||||
const StdVideoH265HrdParameters* pHrdParameters;
|
||||
const StdVideoH265ProfileTierLevel* pProfileTierLevel;
|
||||
} StdVideoH265VideoParameterSet;
|
||||
|
||||
typedef struct StdVideoH265ScalingLists {
|
||||
uint8_t ScalingList4x4[STD_VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS];
|
||||
uint8_t ScalingList8x8[STD_VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_8X8_NUM_ELEMENTS];
|
||||
uint8_t ScalingList16x16[STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS];
|
||||
uint8_t ScalingList32x32[STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS];
|
||||
uint8_t ScalingListDCCoef16x16[STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS];
|
||||
uint8_t ScalingListDCCoef32x32[STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS];
|
||||
} StdVideoH265ScalingLists;
|
||||
|
||||
typedef struct StdVideoH265SpsVuiFlags {
|
||||
uint32_t aspect_ratio_info_present_flag : 1;
|
||||
uint32_t overscan_info_present_flag : 1;
|
||||
uint32_t overscan_appropriate_flag : 1;
|
||||
uint32_t video_signal_type_present_flag : 1;
|
||||
uint32_t video_full_range_flag : 1;
|
||||
uint32_t colour_description_present_flag : 1;
|
||||
uint32_t chroma_loc_info_present_flag : 1;
|
||||
uint32_t neutral_chroma_indication_flag : 1;
|
||||
uint32_t field_seq_flag : 1;
|
||||
uint32_t frame_field_info_present_flag : 1;
|
||||
uint32_t default_display_window_flag : 1;
|
||||
uint32_t vui_timing_info_present_flag : 1;
|
||||
uint32_t vui_poc_proportional_to_timing_flag : 1;
|
||||
uint32_t vui_hrd_parameters_present_flag : 1;
|
||||
uint32_t bitstream_restriction_flag : 1;
|
||||
uint32_t tiles_fixed_structure_flag : 1;
|
||||
uint32_t motion_vectors_over_pic_boundaries_flag : 1;
|
||||
uint32_t restricted_ref_pic_lists_flag : 1;
|
||||
} StdVideoH265SpsVuiFlags;
|
||||
|
||||
typedef struct StdVideoH265SequenceParameterSetVui {
|
||||
StdVideoH265SpsVuiFlags flags;
|
||||
StdVideoH265AspectRatioIdc aspect_ratio_idc;
|
||||
uint16_t sar_width;
|
||||
uint16_t sar_height;
|
||||
uint8_t video_format;
|
||||
uint8_t colour_primaries;
|
||||
uint8_t transfer_characteristics;
|
||||
uint8_t matrix_coeffs;
|
||||
uint8_t chroma_sample_loc_type_top_field;
|
||||
uint8_t chroma_sample_loc_type_bottom_field;
|
||||
uint8_t reserved1;
|
||||
uint8_t reserved2;
|
||||
uint16_t def_disp_win_left_offset;
|
||||
uint16_t def_disp_win_right_offset;
|
||||
uint16_t def_disp_win_top_offset;
|
||||
uint16_t def_disp_win_bottom_offset;
|
||||
uint32_t vui_num_units_in_tick;
|
||||
uint32_t vui_time_scale;
|
||||
uint32_t vui_num_ticks_poc_diff_one_minus1;
|
||||
uint16_t min_spatial_segmentation_idc;
|
||||
uint16_t reserved3;
|
||||
uint8_t max_bytes_per_pic_denom;
|
||||
uint8_t max_bits_per_min_cu_denom;
|
||||
uint8_t log2_max_mv_length_horizontal;
|
||||
uint8_t log2_max_mv_length_vertical;
|
||||
const StdVideoH265HrdParameters* pHrdParameters;
|
||||
} StdVideoH265SequenceParameterSetVui;
|
||||
|
||||
typedef struct StdVideoH265PredictorPaletteEntries {
|
||||
uint16_t PredictorPaletteEntries[STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE][STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE];
|
||||
} StdVideoH265PredictorPaletteEntries;
|
||||
|
||||
typedef struct StdVideoH265SpsFlags {
|
||||
uint32_t sps_temporal_id_nesting_flag : 1;
|
||||
uint32_t separate_colour_plane_flag : 1;
|
||||
uint32_t conformance_window_flag : 1;
|
||||
uint32_t sps_sub_layer_ordering_info_present_flag : 1;
|
||||
uint32_t scaling_list_enabled_flag : 1;
|
||||
uint32_t sps_scaling_list_data_present_flag : 1;
|
||||
uint32_t amp_enabled_flag : 1;
|
||||
uint32_t sample_adaptive_offset_enabled_flag : 1;
|
||||
uint32_t pcm_enabled_flag : 1;
|
||||
uint32_t pcm_loop_filter_disabled_flag : 1;
|
||||
uint32_t long_term_ref_pics_present_flag : 1;
|
||||
uint32_t sps_temporal_mvp_enabled_flag : 1;
|
||||
uint32_t strong_intra_smoothing_enabled_flag : 1;
|
||||
uint32_t vui_parameters_present_flag : 1;
|
||||
uint32_t sps_extension_present_flag : 1;
|
||||
uint32_t sps_range_extension_flag : 1;
|
||||
uint32_t transform_skip_rotation_enabled_flag : 1;
|
||||
uint32_t transform_skip_context_enabled_flag : 1;
|
||||
uint32_t implicit_rdpcm_enabled_flag : 1;
|
||||
uint32_t explicit_rdpcm_enabled_flag : 1;
|
||||
uint32_t extended_precision_processing_flag : 1;
|
||||
uint32_t intra_smoothing_disabled_flag : 1;
|
||||
uint32_t high_precision_offsets_enabled_flag : 1;
|
||||
uint32_t persistent_rice_adaptation_enabled_flag : 1;
|
||||
uint32_t cabac_bypass_alignment_enabled_flag : 1;
|
||||
uint32_t sps_scc_extension_flag : 1;
|
||||
uint32_t sps_curr_pic_ref_enabled_flag : 1;
|
||||
uint32_t palette_mode_enabled_flag : 1;
|
||||
uint32_t sps_palette_predictor_initializers_present_flag : 1;
|
||||
uint32_t intra_boundary_filtering_disabled_flag : 1;
|
||||
} StdVideoH265SpsFlags;
|
||||
|
||||
typedef struct StdVideoH265ShortTermRefPicSetFlags {
|
||||
uint32_t inter_ref_pic_set_prediction_flag : 1;
|
||||
uint32_t delta_rps_sign : 1;
|
||||
} StdVideoH265ShortTermRefPicSetFlags;
|
||||
|
||||
typedef struct StdVideoH265ShortTermRefPicSet {
|
||||
StdVideoH265ShortTermRefPicSetFlags flags;
|
||||
uint32_t delta_idx_minus1;
|
||||
uint16_t use_delta_flag;
|
||||
uint16_t abs_delta_rps_minus1;
|
||||
uint16_t used_by_curr_pic_flag;
|
||||
uint16_t used_by_curr_pic_s0_flag;
|
||||
uint16_t used_by_curr_pic_s1_flag;
|
||||
uint16_t reserved1;
|
||||
uint8_t reserved2;
|
||||
uint8_t reserved3;
|
||||
uint8_t num_negative_pics;
|
||||
uint8_t num_positive_pics;
|
||||
uint16_t delta_poc_s0_minus1[STD_VIDEO_H265_MAX_DPB_SIZE];
|
||||
uint16_t delta_poc_s1_minus1[STD_VIDEO_H265_MAX_DPB_SIZE];
|
||||
} StdVideoH265ShortTermRefPicSet;
|
||||
|
||||
typedef struct StdVideoH265LongTermRefPicsSps {
|
||||
uint32_t used_by_curr_pic_lt_sps_flag;
|
||||
uint32_t lt_ref_pic_poc_lsb_sps[STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS];
|
||||
} StdVideoH265LongTermRefPicsSps;
|
||||
|
||||
typedef struct StdVideoH265SequenceParameterSet {
|
||||
StdVideoH265SpsFlags flags;
|
||||
StdVideoH265ChromaFormatIdc chroma_format_idc;
|
||||
uint32_t pic_width_in_luma_samples;
|
||||
uint32_t pic_height_in_luma_samples;
|
||||
uint8_t sps_video_parameter_set_id;
|
||||
uint8_t sps_max_sub_layers_minus1;
|
||||
uint8_t sps_seq_parameter_set_id;
|
||||
uint8_t bit_depth_luma_minus8;
|
||||
uint8_t bit_depth_chroma_minus8;
|
||||
uint8_t log2_max_pic_order_cnt_lsb_minus4;
|
||||
uint8_t log2_min_luma_coding_block_size_minus3;
|
||||
uint8_t log2_diff_max_min_luma_coding_block_size;
|
||||
uint8_t log2_min_luma_transform_block_size_minus2;
|
||||
uint8_t log2_diff_max_min_luma_transform_block_size;
|
||||
uint8_t max_transform_hierarchy_depth_inter;
|
||||
uint8_t max_transform_hierarchy_depth_intra;
|
||||
uint8_t num_short_term_ref_pic_sets;
|
||||
uint8_t num_long_term_ref_pics_sps;
|
||||
uint8_t pcm_sample_bit_depth_luma_minus1;
|
||||
uint8_t pcm_sample_bit_depth_chroma_minus1;
|
||||
uint8_t log2_min_pcm_luma_coding_block_size_minus3;
|
||||
uint8_t log2_diff_max_min_pcm_luma_coding_block_size;
|
||||
uint8_t reserved1;
|
||||
uint8_t reserved2;
|
||||
uint8_t palette_max_size;
|
||||
uint8_t delta_palette_max_predictor_size;
|
||||
uint8_t motion_vector_resolution_control_idc;
|
||||
uint8_t sps_num_palette_predictor_initializers_minus1;
|
||||
uint32_t conf_win_left_offset;
|
||||
uint32_t conf_win_right_offset;
|
||||
uint32_t conf_win_top_offset;
|
||||
uint32_t conf_win_bottom_offset;
|
||||
const StdVideoH265ProfileTierLevel* pProfileTierLevel;
|
||||
const StdVideoH265DecPicBufMgr* pDecPicBufMgr;
|
||||
const StdVideoH265ScalingLists* pScalingLists;
|
||||
const StdVideoH265ShortTermRefPicSet* pShortTermRefPicSet;
|
||||
const StdVideoH265LongTermRefPicsSps* pLongTermRefPicsSps;
|
||||
const StdVideoH265SequenceParameterSetVui* pSequenceParameterSetVui;
|
||||
const StdVideoH265PredictorPaletteEntries* pPredictorPaletteEntries;
|
||||
} StdVideoH265SequenceParameterSet;
|
||||
|
||||
typedef struct StdVideoH265PpsFlags {
|
||||
uint32_t dependent_slice_segments_enabled_flag : 1;
|
||||
uint32_t output_flag_present_flag : 1;
|
||||
uint32_t sign_data_hiding_enabled_flag : 1;
|
||||
uint32_t cabac_init_present_flag : 1;
|
||||
uint32_t constrained_intra_pred_flag : 1;
|
||||
uint32_t transform_skip_enabled_flag : 1;
|
||||
uint32_t cu_qp_delta_enabled_flag : 1;
|
||||
uint32_t pps_slice_chroma_qp_offsets_present_flag : 1;
|
||||
uint32_t weighted_pred_flag : 1;
|
||||
uint32_t weighted_bipred_flag : 1;
|
||||
uint32_t transquant_bypass_enabled_flag : 1;
|
||||
uint32_t tiles_enabled_flag : 1;
|
||||
uint32_t entropy_coding_sync_enabled_flag : 1;
|
||||
uint32_t uniform_spacing_flag : 1;
|
||||
uint32_t loop_filter_across_tiles_enabled_flag : 1;
|
||||
uint32_t pps_loop_filter_across_slices_enabled_flag : 1;
|
||||
uint32_t deblocking_filter_control_present_flag : 1;
|
||||
uint32_t deblocking_filter_override_enabled_flag : 1;
|
||||
uint32_t pps_deblocking_filter_disabled_flag : 1;
|
||||
uint32_t pps_scaling_list_data_present_flag : 1;
|
||||
uint32_t lists_modification_present_flag : 1;
|
||||
uint32_t slice_segment_header_extension_present_flag : 1;
|
||||
uint32_t pps_extension_present_flag : 1;
|
||||
uint32_t cross_component_prediction_enabled_flag : 1;
|
||||
uint32_t chroma_qp_offset_list_enabled_flag : 1;
|
||||
uint32_t pps_curr_pic_ref_enabled_flag : 1;
|
||||
uint32_t residual_adaptive_colour_transform_enabled_flag : 1;
|
||||
uint32_t pps_slice_act_qp_offsets_present_flag : 1;
|
||||
uint32_t pps_palette_predictor_initializers_present_flag : 1;
|
||||
uint32_t monochrome_palette_flag : 1;
|
||||
uint32_t pps_range_extension_flag : 1;
|
||||
} StdVideoH265PpsFlags;
|
||||
|
||||
typedef struct StdVideoH265PictureParameterSet {
|
||||
StdVideoH265PpsFlags flags;
|
||||
uint8_t pps_pic_parameter_set_id;
|
||||
uint8_t pps_seq_parameter_set_id;
|
||||
uint8_t sps_video_parameter_set_id;
|
||||
uint8_t num_extra_slice_header_bits;
|
||||
uint8_t num_ref_idx_l0_default_active_minus1;
|
||||
uint8_t num_ref_idx_l1_default_active_minus1;
|
||||
int8_t init_qp_minus26;
|
||||
uint8_t diff_cu_qp_delta_depth;
|
||||
int8_t pps_cb_qp_offset;
|
||||
int8_t pps_cr_qp_offset;
|
||||
int8_t pps_beta_offset_div2;
|
||||
int8_t pps_tc_offset_div2;
|
||||
uint8_t log2_parallel_merge_level_minus2;
|
||||
uint8_t log2_max_transform_skip_block_size_minus2;
|
||||
uint8_t diff_cu_chroma_qp_offset_depth;
|
||||
uint8_t chroma_qp_offset_list_len_minus1;
|
||||
int8_t cb_qp_offset_list[STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE];
|
||||
int8_t cr_qp_offset_list[STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE];
|
||||
uint8_t log2_sao_offset_scale_luma;
|
||||
uint8_t log2_sao_offset_scale_chroma;
|
||||
int8_t pps_act_y_qp_offset_plus5;
|
||||
int8_t pps_act_cb_qp_offset_plus5;
|
||||
int8_t pps_act_cr_qp_offset_plus3;
|
||||
uint8_t pps_num_palette_predictor_initializers;
|
||||
uint8_t luma_bit_depth_entry_minus8;
|
||||
uint8_t chroma_bit_depth_entry_minus8;
|
||||
uint8_t num_tile_columns_minus1;
|
||||
uint8_t num_tile_rows_minus1;
|
||||
uint8_t reserved1;
|
||||
uint8_t reserved2;
|
||||
uint16_t column_width_minus1[STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE];
|
||||
uint16_t row_height_minus1[STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE];
|
||||
uint32_t reserved3;
|
||||
const StdVideoH265ScalingLists* pScalingLists;
|
||||
const StdVideoH265PredictorPaletteEntries* pPredictorPaletteEntries;
|
||||
} StdVideoH265PictureParameterSet;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
#ifndef VULKAN_VIDEO_CODEC_H265STD_DECODE_H_
|
||||
#define VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define vulkan_video_codec_h265std_decode 1
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0)
|
||||
|
||||
#define STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE 8
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_decode"
|
||||
typedef struct StdVideoDecodeH265PictureInfoFlags {
|
||||
uint32_t IrapPicFlag : 1;
|
||||
uint32_t IdrPicFlag : 1;
|
||||
uint32_t IsReference : 1;
|
||||
uint32_t short_term_ref_pic_set_sps_flag : 1;
|
||||
} StdVideoDecodeH265PictureInfoFlags;
|
||||
|
||||
typedef struct StdVideoDecodeH265PictureInfo {
|
||||
StdVideoDecodeH265PictureInfoFlags flags;
|
||||
uint8_t sps_video_parameter_set_id;
|
||||
uint8_t pps_seq_parameter_set_id;
|
||||
uint8_t pps_pic_parameter_set_id;
|
||||
uint8_t NumDeltaPocsOfRefRpsIdx;
|
||||
int32_t PicOrderCntVal;
|
||||
uint16_t NumBitsForSTRefPicSetInSlice;
|
||||
uint16_t reserved;
|
||||
uint8_t RefPicSetStCurrBefore[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE];
|
||||
uint8_t RefPicSetStCurrAfter[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE];
|
||||
uint8_t RefPicSetLtCurr[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE];
|
||||
} StdVideoDecodeH265PictureInfo;
|
||||
|
||||
typedef struct StdVideoDecodeH265ReferenceInfoFlags {
|
||||
uint32_t used_for_long_term_reference : 1;
|
||||
uint32_t unused_for_reference : 1;
|
||||
} StdVideoDecodeH265ReferenceInfoFlags;
|
||||
|
||||
typedef struct StdVideoDecodeH265ReferenceInfo {
|
||||
StdVideoDecodeH265ReferenceInfoFlags flags;
|
||||
int32_t PicOrderCntVal;
|
||||
} StdVideoDecodeH265ReferenceInfo;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
#ifndef VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_
|
||||
#define VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define vulkan_video_codec_h265std_encode 1
|
||||
// Vulkan 0.9 provisional Vulkan video H.265 encode std specification version number
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_API_VERSION_0_9_10 VK_MAKE_VIDEO_STD_VERSION(0, 9, 10)
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_API_VERSION_0_9_10
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_encode"
|
||||
typedef struct StdVideoEncodeH265WeightTableFlags {
|
||||
uint16_t luma_weight_l0_flag;
|
||||
uint16_t chroma_weight_l0_flag;
|
||||
uint16_t luma_weight_l1_flag;
|
||||
uint16_t chroma_weight_l1_flag;
|
||||
} StdVideoEncodeH265WeightTableFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH265WeightTable {
|
||||
StdVideoEncodeH265WeightTableFlags flags;
|
||||
uint8_t luma_log2_weight_denom;
|
||||
int8_t delta_chroma_log2_weight_denom;
|
||||
int8_t delta_luma_weight_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF];
|
||||
int8_t luma_offset_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF];
|
||||
int8_t delta_chroma_weight_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
|
||||
int8_t delta_chroma_offset_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
|
||||
int8_t delta_luma_weight_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF];
|
||||
int8_t luma_offset_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF];
|
||||
int8_t delta_chroma_weight_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
|
||||
int8_t delta_chroma_offset_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
|
||||
} StdVideoEncodeH265WeightTable;
|
||||
|
||||
typedef struct StdVideoEncodeH265SliceSegmentHeaderFlags {
|
||||
uint32_t first_slice_segment_in_pic_flag : 1;
|
||||
uint32_t no_output_of_prior_pics_flag : 1;
|
||||
uint32_t dependent_slice_segment_flag : 1;
|
||||
uint32_t pic_output_flag : 1;
|
||||
uint32_t short_term_ref_pic_set_sps_flag : 1;
|
||||
uint32_t slice_temporal_mvp_enable_flag : 1;
|
||||
uint32_t slice_sao_luma_flag : 1;
|
||||
uint32_t slice_sao_chroma_flag : 1;
|
||||
uint32_t num_ref_idx_active_override_flag : 1;
|
||||
uint32_t mvd_l1_zero_flag : 1;
|
||||
uint32_t cabac_init_flag : 1;
|
||||
uint32_t cu_chroma_qp_offset_enabled_flag : 1;
|
||||
uint32_t deblocking_filter_override_flag : 1;
|
||||
uint32_t slice_deblocking_filter_disabled_flag : 1;
|
||||
uint32_t collocated_from_l0_flag : 1;
|
||||
uint32_t slice_loop_filter_across_slices_enabled_flag : 1;
|
||||
} StdVideoEncodeH265SliceSegmentHeaderFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH265SliceSegmentLongTermRefPics {
|
||||
uint8_t num_long_term_sps;
|
||||
uint8_t num_long_term_pics;
|
||||
uint8_t lt_idx_sps[STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS];
|
||||
uint8_t poc_lsb_lt[STD_VIDEO_H265_MAX_LONG_TERM_PICS];
|
||||
uint16_t used_by_curr_pic_lt_flag;
|
||||
uint8_t delta_poc_msb_present_flag[STD_VIDEO_H265_MAX_DELTA_POC];
|
||||
uint8_t delta_poc_msb_cycle_lt[STD_VIDEO_H265_MAX_DELTA_POC];
|
||||
} StdVideoEncodeH265SliceSegmentLongTermRefPics;
|
||||
|
||||
typedef struct StdVideoEncodeH265SliceSegmentHeader {
|
||||
StdVideoEncodeH265SliceSegmentHeaderFlags flags;
|
||||
StdVideoH265SliceType slice_type;
|
||||
uint32_t slice_segment_address;
|
||||
uint8_t short_term_ref_pic_set_idx;
|
||||
uint8_t collocated_ref_idx;
|
||||
uint8_t num_ref_idx_l0_active_minus1;
|
||||
uint8_t num_ref_idx_l1_active_minus1;
|
||||
uint8_t MaxNumMergeCand;
|
||||
int8_t slice_cb_qp_offset;
|
||||
int8_t slice_cr_qp_offset;
|
||||
int8_t slice_beta_offset_div2;
|
||||
int8_t slice_tc_offset_div2;
|
||||
int8_t slice_act_y_qp_offset;
|
||||
int8_t slice_act_cb_qp_offset;
|
||||
int8_t slice_act_cr_qp_offset;
|
||||
const StdVideoH265ShortTermRefPicSet* pShortTermRefPicSet;
|
||||
const StdVideoEncodeH265SliceSegmentLongTermRefPics* pLongTermRefPics;
|
||||
const StdVideoEncodeH265WeightTable* pWeightTable;
|
||||
} StdVideoEncodeH265SliceSegmentHeader;
|
||||
|
||||
typedef struct StdVideoEncodeH265ReferenceListsInfoFlags {
|
||||
uint32_t ref_pic_list_modification_flag_l0 : 1;
|
||||
uint32_t ref_pic_list_modification_flag_l1 : 1;
|
||||
} StdVideoEncodeH265ReferenceListsInfoFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH265ReferenceListsInfo {
|
||||
StdVideoEncodeH265ReferenceListsInfoFlags flags;
|
||||
uint8_t num_ref_idx_l0_active_minus1;
|
||||
uint8_t num_ref_idx_l1_active_minus1;
|
||||
uint16_t reserved1;
|
||||
const uint8_t* pRefPicList0Entries;
|
||||
const uint8_t* pRefPicList1Entries;
|
||||
const uint8_t* pRefList0Modifications;
|
||||
const uint8_t* pRefList1Modifications;
|
||||
} StdVideoEncodeH265ReferenceListsInfo;
|
||||
|
||||
typedef struct StdVideoEncodeH265PictureInfoFlags {
|
||||
uint32_t is_reference_flag : 1;
|
||||
uint32_t IrapPicFlag : 1;
|
||||
uint32_t long_term_flag : 1;
|
||||
uint32_t discardable_flag : 1;
|
||||
uint32_t cross_layer_bla_flag : 1;
|
||||
} StdVideoEncodeH265PictureInfoFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH265PictureInfo {
|
||||
StdVideoEncodeH265PictureInfoFlags flags;
|
||||
StdVideoH265PictureType PictureType;
|
||||
uint8_t sps_video_parameter_set_id;
|
||||
uint8_t pps_seq_parameter_set_id;
|
||||
uint8_t pps_pic_parameter_set_id;
|
||||
uint8_t TemporalId;
|
||||
int32_t PicOrderCntVal;
|
||||
} StdVideoEncodeH265PictureInfo;
|
||||
|
||||
typedef struct StdVideoEncodeH265ReferenceInfoFlags {
|
||||
uint32_t used_for_long_term_reference : 1;
|
||||
uint32_t unused_for_reference : 1;
|
||||
} StdVideoEncodeH265ReferenceInfoFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH265ReferenceInfo {
|
||||
StdVideoEncodeH265ReferenceInfoFlags flags;
|
||||
StdVideoH265PictureType PictureType;
|
||||
int32_t PicOrderCntVal;
|
||||
uint8_t TemporalId;
|
||||
} StdVideoEncodeH265ReferenceInfo;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
#ifndef VULKAN_VIDEO_CODECS_COMMON_H_
|
||||
#define VULKAN_VIDEO_CODECS_COMMON_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define vulkan_video_codecs_common 1
|
||||
#define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \
|
||||
((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch)))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,258 @@
|
||||
//
|
||||
// File: vk_icd.h
|
||||
//
|
||||
/*
|
||||
* Copyright (c) 2015-2023 LunarG, Inc.
|
||||
* Copyright (c) 2015-2023 The Khronos Group Inc.
|
||||
* Copyright (c) 2015-2023 Valve Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "vulkan.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
// Loader-ICD version negotiation API. Versions add the following features:
|
||||
// Version 0 - Initial. Doesn't support vk_icdGetInstanceProcAddr
|
||||
// or vk_icdNegotiateLoaderICDInterfaceVersion.
|
||||
// Version 1 - Add support for vk_icdGetInstanceProcAddr.
|
||||
// Version 2 - Add Loader/ICD Interface version negotiation
|
||||
// via vk_icdNegotiateLoaderICDInterfaceVersion.
|
||||
// Version 3 - Add ICD creation/destruction of KHR_surface objects.
|
||||
// Version 4 - Add unknown physical device extension querying via
|
||||
// vk_icdGetPhysicalDeviceProcAddr.
|
||||
// Version 5 - Tells ICDs that the loader is now paying attention to the
|
||||
// application version of Vulkan passed into the ApplicationInfo
|
||||
// structure during vkCreateInstance. This will tell the ICD
|
||||
// that if the loader is older, it should automatically fail a
|
||||
// call for any API version > 1.0. Otherwise, the loader will
|
||||
// manually determine if it can support the expected version.
|
||||
// Version 6 - Add support for vk_icdEnumerateAdapterPhysicalDevices.
|
||||
// Version 7 - If an ICD supports any of the following functions, they must be
|
||||
// queryable with vk_icdGetInstanceProcAddr:
|
||||
// vk_icdNegotiateLoaderICDInterfaceVersion
|
||||
// vk_icdGetPhysicalDeviceProcAddr
|
||||
// vk_icdEnumerateAdapterPhysicalDevices (Windows only)
|
||||
// In addition, these functions no longer need to be exported directly.
|
||||
// This version allows drivers provided through the extension
|
||||
// VK_LUNARG_direct_driver_loading be able to support the entire
|
||||
// Driver-Loader interface.
|
||||
|
||||
#define CURRENT_LOADER_ICD_INTERFACE_VERSION 7
|
||||
#define MIN_SUPPORTED_LOADER_ICD_INTERFACE_VERSION 0
|
||||
#define MIN_PHYS_DEV_EXTENSION_ICD_INTERFACE_VERSION 4
|
||||
|
||||
// Old typedefs that don't follow a proper naming convention but are preserved for compatibility
|
||||
typedef VkResult(VKAPI_PTR *PFN_vkNegotiateLoaderICDInterfaceVersion)(uint32_t *pVersion);
|
||||
// This is defined in vk_layer.h which will be found by the loader, but if an ICD is building against this
|
||||
// file directly, it won't be found.
|
||||
#ifndef PFN_GetPhysicalDeviceProcAddr
|
||||
typedef PFN_vkVoidFunction(VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char *pName);
|
||||
#endif
|
||||
|
||||
// Typedefs for loader/ICD interface
|
||||
typedef VkResult (VKAPI_PTR *PFN_vk_icdNegotiateLoaderICDInterfaceVersion)(uint32_t* pVersion);
|
||||
typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vk_icdGetInstanceProcAddr)(VkInstance instance, const char* pName);
|
||||
typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vk_icdGetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName);
|
||||
#if defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||
typedef VkResult (VKAPI_PTR *PFN_vk_icdEnumerateAdapterPhysicalDevices)(VkInstance instance, LUID adapterLUID,
|
||||
uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
|
||||
#endif
|
||||
|
||||
// Prototypes for loader/ICD interface
|
||||
#if !defined(VK_NO_PROTOTYPES)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pVersion);
|
||||
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName);
|
||||
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(VkInstance instance, const char* pName);
|
||||
#if defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vk_icdEnumerateAdapterPhysicalDevices(VkInstance instance, LUID adapterLUID,
|
||||
uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The ICD must reserve space for a pointer for the loader's dispatch
|
||||
* table, at the start of <each object>.
|
||||
* The ICD must initialize this variable using the SET_LOADER_MAGIC_VALUE macro.
|
||||
*/
|
||||
|
||||
#define ICD_LOADER_MAGIC 0x01CDC0DE
|
||||
|
||||
typedef union {
|
||||
uintptr_t loaderMagic;
|
||||
void *loaderData;
|
||||
} VK_LOADER_DATA;
|
||||
|
||||
static inline void set_loader_magic_value(void *pNewObject) {
|
||||
VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject;
|
||||
loader_info->loaderMagic = ICD_LOADER_MAGIC;
|
||||
}
|
||||
|
||||
static inline bool valid_loader_magic_value(void *pNewObject) {
|
||||
const VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject;
|
||||
return (loader_info->loaderMagic & 0xffffffff) == ICD_LOADER_MAGIC;
|
||||
}
|
||||
|
||||
/*
|
||||
* Windows and Linux ICDs will treat VkSurfaceKHR as a pointer to a struct that
|
||||
* contains the platform-specific connection and surface information.
|
||||
*/
|
||||
typedef enum {
|
||||
VK_ICD_WSI_PLATFORM_MIR,
|
||||
VK_ICD_WSI_PLATFORM_WAYLAND,
|
||||
VK_ICD_WSI_PLATFORM_WIN32,
|
||||
VK_ICD_WSI_PLATFORM_XCB,
|
||||
VK_ICD_WSI_PLATFORM_XLIB,
|
||||
VK_ICD_WSI_PLATFORM_ANDROID,
|
||||
VK_ICD_WSI_PLATFORM_MACOS,
|
||||
VK_ICD_WSI_PLATFORM_IOS,
|
||||
VK_ICD_WSI_PLATFORM_DISPLAY,
|
||||
VK_ICD_WSI_PLATFORM_HEADLESS,
|
||||
VK_ICD_WSI_PLATFORM_METAL,
|
||||
VK_ICD_WSI_PLATFORM_DIRECTFB,
|
||||
VK_ICD_WSI_PLATFORM_VI,
|
||||
VK_ICD_WSI_PLATFORM_GGP,
|
||||
VK_ICD_WSI_PLATFORM_SCREEN,
|
||||
VK_ICD_WSI_PLATFORM_FUCHSIA,
|
||||
} VkIcdWsiPlatform;
|
||||
|
||||
typedef struct {
|
||||
VkIcdWsiPlatform platform;
|
||||
} VkIcdSurfaceBase;
|
||||
|
||||
#ifdef VK_USE_PLATFORM_MIR_KHR
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
MirConnection *connection;
|
||||
MirSurface *mirSurface;
|
||||
} VkIcdSurfaceMir;
|
||||
#endif // VK_USE_PLATFORM_MIR_KHR
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
struct wl_display *display;
|
||||
struct wl_surface *surface;
|
||||
} VkIcdSurfaceWayland;
|
||||
#endif // VK_USE_PLATFORM_WAYLAND_KHR
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
HINSTANCE hinstance;
|
||||
HWND hwnd;
|
||||
} VkIcdSurfaceWin32;
|
||||
#endif // VK_USE_PLATFORM_WIN32_KHR
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
xcb_connection_t *connection;
|
||||
xcb_window_t window;
|
||||
} VkIcdSurfaceXcb;
|
||||
#endif // VK_USE_PLATFORM_XCB_KHR
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
Display *dpy;
|
||||
Window window;
|
||||
} VkIcdSurfaceXlib;
|
||||
#endif // VK_USE_PLATFORM_XLIB_KHR
|
||||
|
||||
#ifdef VK_USE_PLATFORM_DIRECTFB_EXT
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
IDirectFB *dfb;
|
||||
IDirectFBSurface *surface;
|
||||
} VkIcdSurfaceDirectFB;
|
||||
#endif // VK_USE_PLATFORM_DIRECTFB_EXT
|
||||
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
struct ANativeWindow *window;
|
||||
} VkIcdSurfaceAndroid;
|
||||
#endif // VK_USE_PLATFORM_ANDROID_KHR
|
||||
|
||||
#ifdef VK_USE_PLATFORM_MACOS_MVK
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
const void *pView;
|
||||
} VkIcdSurfaceMacOS;
|
||||
#endif // VK_USE_PLATFORM_MACOS_MVK
|
||||
|
||||
#ifdef VK_USE_PLATFORM_IOS_MVK
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
const void *pView;
|
||||
} VkIcdSurfaceIOS;
|
||||
#endif // VK_USE_PLATFORM_IOS_MVK
|
||||
|
||||
#ifdef VK_USE_PLATFORM_GGP
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
GgpStreamDescriptor streamDescriptor;
|
||||
} VkIcdSurfaceGgp;
|
||||
#endif // VK_USE_PLATFORM_GGP
|
||||
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
VkDisplayModeKHR displayMode;
|
||||
uint32_t planeIndex;
|
||||
uint32_t planeStackIndex;
|
||||
VkSurfaceTransformFlagBitsKHR transform;
|
||||
float globalAlpha;
|
||||
VkDisplayPlaneAlphaFlagBitsKHR alphaMode;
|
||||
VkExtent2D imageExtent;
|
||||
} VkIcdSurfaceDisplay;
|
||||
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
} VkIcdSurfaceHeadless;
|
||||
|
||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
const CAMetalLayer *pLayer;
|
||||
} VkIcdSurfaceMetal;
|
||||
#endif // VK_USE_PLATFORM_METAL_EXT
|
||||
|
||||
#ifdef VK_USE_PLATFORM_VI_NN
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
void *window;
|
||||
} VkIcdSurfaceVi;
|
||||
#endif // VK_USE_PLATFORM_VI_NN
|
||||
|
||||
#ifdef VK_USE_PLATFORM_SCREEN_QNX
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
struct _screen_context *context;
|
||||
struct _screen_window *window;
|
||||
} VkIcdSurfaceScreen;
|
||||
#endif // VK_USE_PLATFORM_SCREEN_QNX
|
||||
|
||||
#ifdef VK_USE_PLATFORM_FUCHSIA
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
} VkIcdSurfaceImagePipe;
|
||||
#endif // VK_USE_PLATFORM_FUCHSIA
|
||||
@@ -0,0 +1,203 @@
|
||||
//
|
||||
// File: vk_layer.h
|
||||
//
|
||||
/*
|
||||
* Copyright (c) 2015-2023 LunarG, Inc.
|
||||
* Copyright (c) 2015-2023 The Khronos Group Inc.
|
||||
* Copyright (c) 2015-2023 Valve Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/* Need to define dispatch table
|
||||
* Core struct can then have ptr to dispatch table at the top
|
||||
* Along with object ptrs for current and next OBJ
|
||||
*/
|
||||
|
||||
#include "vulkan_core.h"
|
||||
|
||||
#define MAX_NUM_UNKNOWN_EXTS 250
|
||||
|
||||
// Loader-Layer version negotiation API. Versions add the following features:
|
||||
// Versions 0/1 - Initial. Doesn't support vk_layerGetPhysicalDeviceProcAddr
|
||||
// or vk_icdNegotiateLoaderLayerInterfaceVersion.
|
||||
// Version 2 - Add support for vk_layerGetPhysicalDeviceProcAddr and
|
||||
// vk_icdNegotiateLoaderLayerInterfaceVersion.
|
||||
#define CURRENT_LOADER_LAYER_INTERFACE_VERSION 2
|
||||
#define MIN_SUPPORTED_LOADER_LAYER_INTERFACE_VERSION 1
|
||||
|
||||
#define VK_CURRENT_CHAIN_VERSION 1
|
||||
|
||||
// Typedef for use in the interfaces below
|
||||
typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName);
|
||||
|
||||
// Version negotiation values
|
||||
typedef enum VkNegotiateLayerStructType {
|
||||
LAYER_NEGOTIATE_UNINTIALIZED = 0,
|
||||
LAYER_NEGOTIATE_INTERFACE_STRUCT = 1,
|
||||
} VkNegotiateLayerStructType;
|
||||
|
||||
// Version negotiation structures
|
||||
typedef struct VkNegotiateLayerInterface {
|
||||
VkNegotiateLayerStructType sType;
|
||||
void *pNext;
|
||||
uint32_t loaderLayerInterfaceVersion;
|
||||
PFN_vkGetInstanceProcAddr pfnGetInstanceProcAddr;
|
||||
PFN_vkGetDeviceProcAddr pfnGetDeviceProcAddr;
|
||||
PFN_GetPhysicalDeviceProcAddr pfnGetPhysicalDeviceProcAddr;
|
||||
} VkNegotiateLayerInterface;
|
||||
|
||||
// Version negotiation functions
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkNegotiateLoaderLayerInterfaceVersion)(VkNegotiateLayerInterface *pVersionStruct);
|
||||
|
||||
// Function prototype for unknown physical device extension command
|
||||
typedef VkResult(VKAPI_PTR *PFN_PhysDevExt)(VkPhysicalDevice phys_device);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// CreateInstance and CreateDevice support structures
|
||||
|
||||
/* Sub type of structure for instance and device loader ext of CreateInfo.
|
||||
* When sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
|
||||
* or sType == VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
|
||||
* then VkLayerFunction indicates struct type pointed to by pNext
|
||||
*/
|
||||
typedef enum VkLayerFunction_ {
|
||||
VK_LAYER_LINK_INFO = 0,
|
||||
VK_LOADER_DATA_CALLBACK = 1,
|
||||
VK_LOADER_LAYER_CREATE_DEVICE_CALLBACK = 2,
|
||||
VK_LOADER_FEATURES = 3,
|
||||
} VkLayerFunction;
|
||||
|
||||
typedef struct VkLayerInstanceLink_ {
|
||||
struct VkLayerInstanceLink_ *pNext;
|
||||
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
|
||||
PFN_GetPhysicalDeviceProcAddr pfnNextGetPhysicalDeviceProcAddr;
|
||||
} VkLayerInstanceLink;
|
||||
|
||||
/*
|
||||
* When creating the device chain the loader needs to pass
|
||||
* down information about it's device structure needed at
|
||||
* the end of the chain. Passing the data via the
|
||||
* VkLayerDeviceInfo avoids issues with finding the
|
||||
* exact instance being used.
|
||||
*/
|
||||
typedef struct VkLayerDeviceInfo_ {
|
||||
void *device_info;
|
||||
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
|
||||
} VkLayerDeviceInfo;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkSetInstanceLoaderData)(VkInstance instance,
|
||||
void *object);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkSetDeviceLoaderData)(VkDevice device,
|
||||
void *object);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkLayerCreateDevice)(VkInstance instance, VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, PFN_vkGetInstanceProcAddr layerGIPA, PFN_vkGetDeviceProcAddr *nextGDPA);
|
||||
typedef void (VKAPI_PTR *PFN_vkLayerDestroyDevice)(VkDevice physicalDevice, const VkAllocationCallbacks *pAllocator, PFN_vkDestroyDevice destroyFunction);
|
||||
|
||||
typedef enum VkLoaderFeastureFlagBits {
|
||||
VK_LOADER_FEATURE_PHYSICAL_DEVICE_SORTING = 0x00000001,
|
||||
} VkLoaderFlagBits;
|
||||
typedef VkFlags VkLoaderFeatureFlags;
|
||||
|
||||
typedef struct {
|
||||
VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
|
||||
const void *pNext;
|
||||
VkLayerFunction function;
|
||||
union {
|
||||
VkLayerInstanceLink *pLayerInfo;
|
||||
PFN_vkSetInstanceLoaderData pfnSetInstanceLoaderData;
|
||||
struct {
|
||||
PFN_vkLayerCreateDevice pfnLayerCreateDevice;
|
||||
PFN_vkLayerDestroyDevice pfnLayerDestroyDevice;
|
||||
} layerDevice;
|
||||
VkLoaderFeatureFlags loaderFeatures;
|
||||
} u;
|
||||
} VkLayerInstanceCreateInfo;
|
||||
|
||||
typedef struct VkLayerDeviceLink_ {
|
||||
struct VkLayerDeviceLink_ *pNext;
|
||||
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
|
||||
PFN_vkGetDeviceProcAddr pfnNextGetDeviceProcAddr;
|
||||
} VkLayerDeviceLink;
|
||||
|
||||
typedef struct {
|
||||
VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
|
||||
const void *pNext;
|
||||
VkLayerFunction function;
|
||||
union {
|
||||
VkLayerDeviceLink *pLayerInfo;
|
||||
PFN_vkSetDeviceLoaderData pfnSetDeviceLoaderData;
|
||||
} u;
|
||||
} VkLayerDeviceCreateInfo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface *pVersionStruct);
|
||||
|
||||
typedef enum VkChainType {
|
||||
VK_CHAIN_TYPE_UNKNOWN = 0,
|
||||
VK_CHAIN_TYPE_ENUMERATE_INSTANCE_EXTENSION_PROPERTIES = 1,
|
||||
VK_CHAIN_TYPE_ENUMERATE_INSTANCE_LAYER_PROPERTIES = 2,
|
||||
VK_CHAIN_TYPE_ENUMERATE_INSTANCE_VERSION = 3,
|
||||
} VkChainType;
|
||||
|
||||
typedef struct VkChainHeader {
|
||||
VkChainType type;
|
||||
uint32_t version;
|
||||
uint32_t size;
|
||||
} VkChainHeader;
|
||||
|
||||
typedef struct VkEnumerateInstanceExtensionPropertiesChain {
|
||||
VkChainHeader header;
|
||||
VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceExtensionPropertiesChain *, const char *, uint32_t *,
|
||||
VkExtensionProperties *);
|
||||
const struct VkEnumerateInstanceExtensionPropertiesChain *pNextLink;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
inline VkResult CallDown(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) const {
|
||||
return pfnNextLayer(pNextLink, pLayerName, pPropertyCount, pProperties);
|
||||
}
|
||||
#endif
|
||||
} VkEnumerateInstanceExtensionPropertiesChain;
|
||||
|
||||
typedef struct VkEnumerateInstanceLayerPropertiesChain {
|
||||
VkChainHeader header;
|
||||
VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceLayerPropertiesChain *, uint32_t *, VkLayerProperties *);
|
||||
const struct VkEnumerateInstanceLayerPropertiesChain *pNextLink;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
inline VkResult CallDown(uint32_t *pPropertyCount, VkLayerProperties *pProperties) const {
|
||||
return pfnNextLayer(pNextLink, pPropertyCount, pProperties);
|
||||
}
|
||||
#endif
|
||||
} VkEnumerateInstanceLayerPropertiesChain;
|
||||
|
||||
typedef struct VkEnumerateInstanceVersionChain {
|
||||
VkChainHeader header;
|
||||
VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceVersionChain *, uint32_t *);
|
||||
const struct VkEnumerateInstanceVersionChain *pNextLink;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
inline VkResult CallDown(uint32_t *pApiVersion) const {
|
||||
return pfnNextLayer(pNextLink, pApiVersion);
|
||||
}
|
||||
#endif
|
||||
} VkEnumerateInstanceVersionChain;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// File: vk_platform.h
|
||||
//
|
||||
/*
|
||||
** Copyright 2014-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#ifndef VK_PLATFORM_H_
|
||||
#define VK_PLATFORM_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
/*
|
||||
***************************************************************************************************
|
||||
* Platform-specific directives and type declarations
|
||||
***************************************************************************************************
|
||||
*/
|
||||
|
||||
/* Platform-specific calling convention macros.
|
||||
*
|
||||
* Platforms should define these so that Vulkan clients call Vulkan commands
|
||||
* with the same calling conventions that the Vulkan implementation expects.
|
||||
*
|
||||
* VKAPI_ATTR - Placed before the return type in function declarations.
|
||||
* Useful for C++11 and GCC/Clang-style function attribute syntax.
|
||||
* VKAPI_CALL - Placed after the return type in function declarations.
|
||||
* Useful for MSVC-style calling convention syntax.
|
||||
* VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
|
||||
*
|
||||
* Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
|
||||
* Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
// On Windows, Vulkan commands use the stdcall convention
|
||||
#define VKAPI_ATTR
|
||||
#define VKAPI_CALL __stdcall
|
||||
#define VKAPI_PTR VKAPI_CALL
|
||||
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
|
||||
#error "Vulkan is not supported for the 'armeabi' NDK ABI"
|
||||
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
|
||||
// On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
|
||||
// calling convention, i.e. float parameters are passed in registers. This
|
||||
// is true even if the rest of the application passes floats on the stack,
|
||||
// as it does by default when compiling for the armeabi-v7a NDK ABI.
|
||||
#define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
|
||||
#define VKAPI_CALL
|
||||
#define VKAPI_PTR VKAPI_ATTR
|
||||
#else
|
||||
// On other platforms, use the default calling convention
|
||||
#define VKAPI_ATTR
|
||||
#define VKAPI_CALL
|
||||
#define VKAPI_PTR
|
||||
#endif
|
||||
|
||||
#if !defined(VK_NO_STDDEF_H)
|
||||
#include <stddef.h>
|
||||
#endif // !defined(VK_NO_STDDEF_H)
|
||||
|
||||
#if !defined(VK_NO_STDINT_H)
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
typedef signed __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#endif // !defined(VK_NO_STDINT_H)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,99 @@
|
||||
#ifndef VULKAN_H_
|
||||
#define VULKAN_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "vk_platform.h"
|
||||
#include "vulkan_core.h"
|
||||
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
#include "vulkan_android.h"
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_FUCHSIA
|
||||
#include <zircon/types.h>
|
||||
#include "vulkan_fuchsia.h"
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_IOS_MVK
|
||||
#include "vulkan_ios.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_MACOS_MVK
|
||||
#include "vulkan_macos.h"
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
||||
#include "vulkan_metal.h"
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_VI_NN
|
||||
#include "vulkan_vi.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
#include "vulkan_wayland.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
#include <windows.h>
|
||||
#include "vulkan_win32.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
#include <xcb/xcb.h>
|
||||
#include "vulkan_xcb.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
#include <X11/Xlib.h>
|
||||
#include "vulkan_xlib.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_DIRECTFB_EXT
|
||||
#include <directfb.h>
|
||||
#include "vulkan_directfb.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#include "vulkan_xlib_xrandr.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_GGP
|
||||
#include <ggp_c/vulkan_types.h>
|
||||
#include "vulkan_ggp.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_SCREEN_QNX
|
||||
#include <screen/screen.h>
|
||||
#include "vulkan_screen.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_SCI
|
||||
#include <nvscisync.h>
|
||||
#include <nvscibuf.h>
|
||||
#include "vulkan_sci.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_ENABLE_BETA_EXTENSIONS
|
||||
#include "vulkan_beta.h"
|
||||
#endif
|
||||
|
||||
#endif // VULKAN_H_
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
#ifndef VULKAN_ANDROID_H_
|
||||
#define VULKAN_ANDROID_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_KHR_android_surface 1
|
||||
struct ANativeWindow;
|
||||
#define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6
|
||||
#define VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "VK_KHR_android_surface"
|
||||
typedef VkFlags VkAndroidSurfaceCreateFlagsKHR;
|
||||
typedef struct VkAndroidSurfaceCreateInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkAndroidSurfaceCreateFlagsKHR flags;
|
||||
struct ANativeWindow* window;
|
||||
} VkAndroidSurfaceCreateInfoKHR;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateAndroidSurfaceKHR)(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkAndroidSurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
|
||||
|
||||
#define VK_ANDROID_external_memory_android_hardware_buffer 1
|
||||
struct AHardwareBuffer;
|
||||
#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION 5
|
||||
#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME "VK_ANDROID_external_memory_android_hardware_buffer"
|
||||
typedef struct VkAndroidHardwareBufferUsageANDROID {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
uint64_t androidHardwareBufferUsage;
|
||||
} VkAndroidHardwareBufferUsageANDROID;
|
||||
|
||||
typedef struct VkAndroidHardwareBufferPropertiesANDROID {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkDeviceSize allocationSize;
|
||||
uint32_t memoryTypeBits;
|
||||
} VkAndroidHardwareBufferPropertiesANDROID;
|
||||
|
||||
typedef struct VkAndroidHardwareBufferFormatPropertiesANDROID {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkFormat format;
|
||||
uint64_t externalFormat;
|
||||
VkFormatFeatureFlags formatFeatures;
|
||||
VkComponentMapping samplerYcbcrConversionComponents;
|
||||
VkSamplerYcbcrModelConversion suggestedYcbcrModel;
|
||||
VkSamplerYcbcrRange suggestedYcbcrRange;
|
||||
VkChromaLocation suggestedXChromaOffset;
|
||||
VkChromaLocation suggestedYChromaOffset;
|
||||
} VkAndroidHardwareBufferFormatPropertiesANDROID;
|
||||
|
||||
typedef struct VkImportAndroidHardwareBufferInfoANDROID {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
struct AHardwareBuffer* buffer;
|
||||
} VkImportAndroidHardwareBufferInfoANDROID;
|
||||
|
||||
typedef struct VkMemoryGetAndroidHardwareBufferInfoANDROID {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkDeviceMemory memory;
|
||||
} VkMemoryGetAndroidHardwareBufferInfoANDROID;
|
||||
|
||||
typedef struct VkExternalFormatANDROID {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
uint64_t externalFormat;
|
||||
} VkExternalFormatANDROID;
|
||||
|
||||
typedef struct VkAndroidHardwareBufferFormatProperties2ANDROID {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkFormat format;
|
||||
uint64_t externalFormat;
|
||||
VkFormatFeatureFlags2 formatFeatures;
|
||||
VkComponentMapping samplerYcbcrConversionComponents;
|
||||
VkSamplerYcbcrModelConversion suggestedYcbcrModel;
|
||||
VkSamplerYcbcrRange suggestedYcbcrRange;
|
||||
VkChromaLocation suggestedXChromaOffset;
|
||||
VkChromaLocation suggestedYChromaOffset;
|
||||
} VkAndroidHardwareBufferFormatProperties2ANDROID;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetAndroidHardwareBufferPropertiesANDROID)(VkDevice device, const struct AHardwareBuffer* buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryAndroidHardwareBufferANDROID)(VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct AHardwareBuffer** pBuffer);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetAndroidHardwareBufferPropertiesANDROID(
|
||||
VkDevice device,
|
||||
const struct AHardwareBuffer* buffer,
|
||||
VkAndroidHardwareBufferPropertiesANDROID* pProperties);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryAndroidHardwareBufferANDROID(
|
||||
VkDevice device,
|
||||
const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo,
|
||||
struct AHardwareBuffer** pBuffer);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+537
@@ -0,0 +1,537 @@
|
||||
#ifndef VULKAN_BETA_H_
|
||||
#define VULKAN_BETA_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_KHR_portability_subset 1
|
||||
#define VK_KHR_PORTABILITY_SUBSET_SPEC_VERSION 1
|
||||
#define VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME "VK_KHR_portability_subset"
|
||||
typedef struct VkPhysicalDevicePortabilitySubsetFeaturesKHR {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkBool32 constantAlphaColorBlendFactors;
|
||||
VkBool32 events;
|
||||
VkBool32 imageViewFormatReinterpretation;
|
||||
VkBool32 imageViewFormatSwizzle;
|
||||
VkBool32 imageView2DOn3DImage;
|
||||
VkBool32 multisampleArrayImage;
|
||||
VkBool32 mutableComparisonSamplers;
|
||||
VkBool32 pointPolygons;
|
||||
VkBool32 samplerMipLodBias;
|
||||
VkBool32 separateStencilMaskRef;
|
||||
VkBool32 shaderSampleRateInterpolationFunctions;
|
||||
VkBool32 tessellationIsolines;
|
||||
VkBool32 tessellationPointMode;
|
||||
VkBool32 triangleFans;
|
||||
VkBool32 vertexAttributeAccessBeyondStride;
|
||||
} VkPhysicalDevicePortabilitySubsetFeaturesKHR;
|
||||
|
||||
typedef struct VkPhysicalDevicePortabilitySubsetPropertiesKHR {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
uint32_t minVertexInputBindingStrideAlignment;
|
||||
} VkPhysicalDevicePortabilitySubsetPropertiesKHR;
|
||||
|
||||
|
||||
|
||||
#define VK_KHR_video_encode_queue 1
|
||||
#define VK_KHR_VIDEO_ENCODE_QUEUE_SPEC_VERSION 8
|
||||
#define VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME "VK_KHR_video_encode_queue"
|
||||
|
||||
typedef enum VkVideoEncodeTuningModeKHR {
|
||||
VK_VIDEO_ENCODE_TUNING_MODE_DEFAULT_KHR = 0,
|
||||
VK_VIDEO_ENCODE_TUNING_MODE_HIGH_QUALITY_KHR = 1,
|
||||
VK_VIDEO_ENCODE_TUNING_MODE_LOW_LATENCY_KHR = 2,
|
||||
VK_VIDEO_ENCODE_TUNING_MODE_ULTRA_LOW_LATENCY_KHR = 3,
|
||||
VK_VIDEO_ENCODE_TUNING_MODE_LOSSLESS_KHR = 4,
|
||||
VK_VIDEO_ENCODE_TUNING_MODE_MAX_ENUM_KHR = 0x7FFFFFFF
|
||||
} VkVideoEncodeTuningModeKHR;
|
||||
typedef VkFlags VkVideoEncodeFlagsKHR;
|
||||
|
||||
typedef enum VkVideoEncodeCapabilityFlagBitsKHR {
|
||||
VK_VIDEO_ENCODE_CAPABILITY_PRECEDING_EXTERNALLY_ENCODED_BYTES_BIT_KHR = 0x00000001,
|
||||
VK_VIDEO_ENCODE_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
|
||||
} VkVideoEncodeCapabilityFlagBitsKHR;
|
||||
typedef VkFlags VkVideoEncodeCapabilityFlagsKHR;
|
||||
|
||||
typedef enum VkVideoEncodeRateControlModeFlagBitsKHR {
|
||||
VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR = 0,
|
||||
VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR = 0x00000001,
|
||||
VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR = 0x00000002,
|
||||
VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR = 0x00000004,
|
||||
VK_VIDEO_ENCODE_RATE_CONTROL_MODE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
|
||||
} VkVideoEncodeRateControlModeFlagBitsKHR;
|
||||
typedef VkFlags VkVideoEncodeRateControlModeFlagsKHR;
|
||||
|
||||
typedef enum VkVideoEncodeFeedbackFlagBitsKHR {
|
||||
VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BUFFER_OFFSET_BIT_KHR = 0x00000001,
|
||||
VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BYTES_WRITTEN_BIT_KHR = 0x00000002,
|
||||
VK_VIDEO_ENCODE_FEEDBACK_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
|
||||
} VkVideoEncodeFeedbackFlagBitsKHR;
|
||||
typedef VkFlags VkVideoEncodeFeedbackFlagsKHR;
|
||||
|
||||
typedef enum VkVideoEncodeUsageFlagBitsKHR {
|
||||
VK_VIDEO_ENCODE_USAGE_DEFAULT_KHR = 0,
|
||||
VK_VIDEO_ENCODE_USAGE_TRANSCODING_BIT_KHR = 0x00000001,
|
||||
VK_VIDEO_ENCODE_USAGE_STREAMING_BIT_KHR = 0x00000002,
|
||||
VK_VIDEO_ENCODE_USAGE_RECORDING_BIT_KHR = 0x00000004,
|
||||
VK_VIDEO_ENCODE_USAGE_CONFERENCING_BIT_KHR = 0x00000008,
|
||||
VK_VIDEO_ENCODE_USAGE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
|
||||
} VkVideoEncodeUsageFlagBitsKHR;
|
||||
typedef VkFlags VkVideoEncodeUsageFlagsKHR;
|
||||
|
||||
typedef enum VkVideoEncodeContentFlagBitsKHR {
|
||||
VK_VIDEO_ENCODE_CONTENT_DEFAULT_KHR = 0,
|
||||
VK_VIDEO_ENCODE_CONTENT_CAMERA_BIT_KHR = 0x00000001,
|
||||
VK_VIDEO_ENCODE_CONTENT_DESKTOP_BIT_KHR = 0x00000002,
|
||||
VK_VIDEO_ENCODE_CONTENT_RENDERED_BIT_KHR = 0x00000004,
|
||||
VK_VIDEO_ENCODE_CONTENT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
|
||||
} VkVideoEncodeContentFlagBitsKHR;
|
||||
typedef VkFlags VkVideoEncodeContentFlagsKHR;
|
||||
typedef VkFlags VkVideoEncodeRateControlFlagsKHR;
|
||||
typedef struct VkVideoEncodeInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkVideoEncodeFlagsKHR flags;
|
||||
uint32_t qualityLevel;
|
||||
VkBuffer dstBuffer;
|
||||
VkDeviceSize dstBufferOffset;
|
||||
VkDeviceSize dstBufferRange;
|
||||
VkVideoPictureResourceInfoKHR srcPictureResource;
|
||||
const VkVideoReferenceSlotInfoKHR* pSetupReferenceSlot;
|
||||
uint32_t referenceSlotCount;
|
||||
const VkVideoReferenceSlotInfoKHR* pReferenceSlots;
|
||||
uint32_t precedingExternallyEncodedBytes;
|
||||
} VkVideoEncodeInfoKHR;
|
||||
|
||||
typedef struct VkVideoEncodeCapabilitiesKHR {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkVideoEncodeCapabilityFlagsKHR flags;
|
||||
VkVideoEncodeRateControlModeFlagsKHR rateControlModes;
|
||||
uint32_t maxRateControlLayers;
|
||||
uint32_t maxQualityLevels;
|
||||
VkExtent2D inputImageDataFillAlignment;
|
||||
VkVideoEncodeFeedbackFlagsKHR supportedEncodeFeedbackFlags;
|
||||
} VkVideoEncodeCapabilitiesKHR;
|
||||
|
||||
typedef struct VkQueryPoolVideoEncodeFeedbackCreateInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkVideoEncodeFeedbackFlagsKHR encodeFeedbackFlags;
|
||||
} VkQueryPoolVideoEncodeFeedbackCreateInfoKHR;
|
||||
|
||||
typedef struct VkVideoEncodeUsageInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkVideoEncodeUsageFlagsKHR videoUsageHints;
|
||||
VkVideoEncodeContentFlagsKHR videoContentHints;
|
||||
VkVideoEncodeTuningModeKHR tuningMode;
|
||||
} VkVideoEncodeUsageInfoKHR;
|
||||
|
||||
typedef struct VkVideoEncodeRateControlLayerInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint64_t averageBitrate;
|
||||
uint64_t maxBitrate;
|
||||
uint32_t frameRateNumerator;
|
||||
uint32_t frameRateDenominator;
|
||||
uint32_t virtualBufferSizeInMs;
|
||||
uint32_t initialVirtualBufferSizeInMs;
|
||||
} VkVideoEncodeRateControlLayerInfoKHR;
|
||||
|
||||
typedef struct VkVideoEncodeRateControlInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkVideoEncodeRateControlFlagsKHR flags;
|
||||
VkVideoEncodeRateControlModeFlagBitsKHR rateControlMode;
|
||||
uint32_t layerCount;
|
||||
const VkVideoEncodeRateControlLayerInfoKHR* pLayers;
|
||||
} VkVideoEncodeRateControlInfoKHR;
|
||||
|
||||
typedef void (VKAPI_PTR *PFN_vkCmdEncodeVideoKHR)(VkCommandBuffer commandBuffer, const VkVideoEncodeInfoKHR* pEncodeInfo);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR void VKAPI_CALL vkCmdEncodeVideoKHR(
|
||||
VkCommandBuffer commandBuffer,
|
||||
const VkVideoEncodeInfoKHR* pEncodeInfo);
|
||||
#endif
|
||||
|
||||
|
||||
#define VK_EXT_video_encode_h264 1
|
||||
#include "vk_video/vulkan_video_codec_h264std.h"
|
||||
#include "vk_video/vulkan_video_codec_h264std_encode.h"
|
||||
#define VK_EXT_VIDEO_ENCODE_H264_SPEC_VERSION 10
|
||||
#define VK_EXT_VIDEO_ENCODE_H264_EXTENSION_NAME "VK_EXT_video_encode_h264"
|
||||
|
||||
typedef enum VkVideoEncodeH264RateControlStructureEXT {
|
||||
VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_UNKNOWN_EXT = 0,
|
||||
VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_FLAT_EXT = 1,
|
||||
VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_DYADIC_EXT = 2,
|
||||
VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_MAX_ENUM_EXT = 0x7FFFFFFF
|
||||
} VkVideoEncodeH264RateControlStructureEXT;
|
||||
|
||||
typedef enum VkVideoEncodeH264CapabilityFlagBitsEXT {
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_DIRECT_8X8_INFERENCE_ENABLED_BIT_EXT = 0x00000001,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_DIRECT_8X8_INFERENCE_DISABLED_BIT_EXT = 0x00000002,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_SEPARATE_COLOUR_PLANE_BIT_EXT = 0x00000004,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_QPPRIME_Y_ZERO_TRANSFORM_BYPASS_BIT_EXT = 0x00000008,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_SCALING_LISTS_BIT_EXT = 0x00000010,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_HRD_COMPLIANCE_BIT_EXT = 0x00000020,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_CHROMA_QP_OFFSET_BIT_EXT = 0x00000040,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_SECOND_CHROMA_QP_OFFSET_BIT_EXT = 0x00000080,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_PIC_INIT_QP_MINUS26_BIT_EXT = 0x00000100,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_PRED_BIT_EXT = 0x00000200,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_BIPRED_EXPLICIT_BIT_EXT = 0x00000400,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_BIPRED_IMPLICIT_BIT_EXT = 0x00000800,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_PRED_NO_TABLE_BIT_EXT = 0x00001000,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_TRANSFORM_8X8_BIT_EXT = 0x00002000,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_CABAC_BIT_EXT = 0x00004000,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_CAVLC_BIT_EXT = 0x00008000,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_DISABLED_BIT_EXT = 0x00010000,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_ENABLED_BIT_EXT = 0x00020000,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_PARTIAL_BIT_EXT = 0x00040000,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_DISABLE_DIRECT_SPATIAL_MV_PRED_BIT_EXT = 0x00080000,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_MULTIPLE_SLICE_PER_FRAME_BIT_EXT = 0x00100000,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_SLICE_MB_COUNT_BIT_EXT = 0x00200000,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_ROW_UNALIGNED_SLICE_BIT_EXT = 0x00400000,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_DIFFERENT_SLICE_TYPE_BIT_EXT = 0x00800000,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_EXT = 0x01000000,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_DIFFERENT_REFERENCE_FINAL_LISTS_BIT_EXT = 0x02000000,
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
|
||||
} VkVideoEncodeH264CapabilityFlagBitsEXT;
|
||||
typedef VkFlags VkVideoEncodeH264CapabilityFlagsEXT;
|
||||
typedef struct VkVideoEncodeH264CapabilitiesEXT {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkVideoEncodeH264CapabilityFlagsEXT flags;
|
||||
uint32_t maxPPictureL0ReferenceCount;
|
||||
uint32_t maxBPictureL0ReferenceCount;
|
||||
uint32_t maxL1ReferenceCount;
|
||||
VkBool32 motionVectorsOverPicBoundariesFlag;
|
||||
uint32_t maxBytesPerPicDenom;
|
||||
uint32_t maxBitsPerMbDenom;
|
||||
uint32_t log2MaxMvLengthHorizontal;
|
||||
uint32_t log2MaxMvLengthVertical;
|
||||
} VkVideoEncodeH264CapabilitiesEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH264SessionParametersAddInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t stdSPSCount;
|
||||
const StdVideoH264SequenceParameterSet* pStdSPSs;
|
||||
uint32_t stdPPSCount;
|
||||
const StdVideoH264PictureParameterSet* pStdPPSs;
|
||||
} VkVideoEncodeH264SessionParametersAddInfoEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH264SessionParametersCreateInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t maxStdSPSCount;
|
||||
uint32_t maxStdPPSCount;
|
||||
const VkVideoEncodeH264SessionParametersAddInfoEXT* pParametersAddInfo;
|
||||
} VkVideoEncodeH264SessionParametersCreateInfoEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH264NaluSliceInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t mbCount;
|
||||
const StdVideoEncodeH264ReferenceListsInfo* pStdReferenceFinalLists;
|
||||
const StdVideoEncodeH264SliceHeader* pStdSliceHeader;
|
||||
} VkVideoEncodeH264NaluSliceInfoEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH264VclFrameInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
const StdVideoEncodeH264ReferenceListsInfo* pStdReferenceFinalLists;
|
||||
uint32_t naluSliceEntryCount;
|
||||
const VkVideoEncodeH264NaluSliceInfoEXT* pNaluSliceEntries;
|
||||
const StdVideoEncodeH264PictureInfo* pStdPictureInfo;
|
||||
} VkVideoEncodeH264VclFrameInfoEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH264DpbSlotInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
const StdVideoEncodeH264ReferenceInfo* pStdReferenceInfo;
|
||||
} VkVideoEncodeH264DpbSlotInfoEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH264ProfileInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
StdVideoH264ProfileIdc stdProfileIdc;
|
||||
} VkVideoEncodeH264ProfileInfoEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH264RateControlInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t gopFrameCount;
|
||||
uint32_t idrPeriod;
|
||||
uint32_t consecutiveBFrameCount;
|
||||
VkVideoEncodeH264RateControlStructureEXT rateControlStructure;
|
||||
uint32_t temporalLayerCount;
|
||||
} VkVideoEncodeH264RateControlInfoEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH264QpEXT {
|
||||
int32_t qpI;
|
||||
int32_t qpP;
|
||||
int32_t qpB;
|
||||
} VkVideoEncodeH264QpEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH264FrameSizeEXT {
|
||||
uint32_t frameISize;
|
||||
uint32_t framePSize;
|
||||
uint32_t frameBSize;
|
||||
} VkVideoEncodeH264FrameSizeEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH264RateControlLayerInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t temporalLayerId;
|
||||
VkBool32 useInitialRcQp;
|
||||
VkVideoEncodeH264QpEXT initialRcQp;
|
||||
VkBool32 useMinQp;
|
||||
VkVideoEncodeH264QpEXT minQp;
|
||||
VkBool32 useMaxQp;
|
||||
VkVideoEncodeH264QpEXT maxQp;
|
||||
VkBool32 useMaxFrameSize;
|
||||
VkVideoEncodeH264FrameSizeEXT maxFrameSize;
|
||||
} VkVideoEncodeH264RateControlLayerInfoEXT;
|
||||
|
||||
|
||||
|
||||
#define VK_EXT_video_encode_h265 1
|
||||
#include "vk_video/vulkan_video_codec_h265std.h"
|
||||
#include "vk_video/vulkan_video_codec_h265std_encode.h"
|
||||
#define VK_EXT_VIDEO_ENCODE_H265_SPEC_VERSION 10
|
||||
#define VK_EXT_VIDEO_ENCODE_H265_EXTENSION_NAME "VK_EXT_video_encode_h265"
|
||||
|
||||
typedef enum VkVideoEncodeH265RateControlStructureEXT {
|
||||
VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_UNKNOWN_EXT = 0,
|
||||
VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_FLAT_EXT = 1,
|
||||
VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_DYADIC_EXT = 2,
|
||||
VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_MAX_ENUM_EXT = 0x7FFFFFFF
|
||||
} VkVideoEncodeH265RateControlStructureEXT;
|
||||
|
||||
typedef enum VkVideoEncodeH265CapabilityFlagBitsEXT {
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_SEPARATE_COLOUR_PLANE_BIT_EXT = 0x00000001,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_SCALING_LISTS_BIT_EXT = 0x00000002,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_SAMPLE_ADAPTIVE_OFFSET_ENABLED_BIT_EXT = 0x00000004,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_PCM_ENABLE_BIT_EXT = 0x00000008,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_SPS_TEMPORAL_MVP_ENABLED_BIT_EXT = 0x00000010,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_HRD_COMPLIANCE_BIT_EXT = 0x00000020,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_INIT_QP_MINUS26_BIT_EXT = 0x00000040,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_LOG2_PARALLEL_MERGE_LEVEL_MINUS2_BIT_EXT = 0x00000080,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_SIGN_DATA_HIDING_ENABLED_BIT_EXT = 0x00000100,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSFORM_SKIP_ENABLED_BIT_EXT = 0x00000200,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSFORM_SKIP_DISABLED_BIT_EXT = 0x00000400,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT_BIT_EXT = 0x00000800,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_PRED_BIT_EXT = 0x00001000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_BIPRED_BIT_EXT = 0x00002000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_PRED_NO_TABLE_BIT_EXT = 0x00004000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSQUANT_BYPASS_ENABLED_BIT_EXT = 0x00008000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_ENTROPY_CODING_SYNC_ENABLED_BIT_EXT = 0x00010000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_DEBLOCKING_FILTER_OVERRIDE_ENABLED_BIT_EXT = 0x00020000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_TILE_PER_FRAME_BIT_EXT = 0x00040000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_SLICE_PER_TILE_BIT_EXT = 0x00080000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_TILE_PER_SLICE_BIT_EXT = 0x00100000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_SLICE_SEGMENT_CTB_COUNT_BIT_EXT = 0x00200000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_ROW_UNALIGNED_SLICE_SEGMENT_BIT_EXT = 0x00400000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_DEPENDENT_SLICE_SEGMENT_BIT_EXT = 0x00800000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_DIFFERENT_SLICE_TYPE_BIT_EXT = 0x01000000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_EXT = 0x02000000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_DIFFERENT_REFERENCE_FINAL_LISTS_BIT_EXT = 0x04000000,
|
||||
VK_VIDEO_ENCODE_H265_CAPABILITY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
|
||||
} VkVideoEncodeH265CapabilityFlagBitsEXT;
|
||||
typedef VkFlags VkVideoEncodeH265CapabilityFlagsEXT;
|
||||
|
||||
typedef enum VkVideoEncodeH265CtbSizeFlagBitsEXT {
|
||||
VK_VIDEO_ENCODE_H265_CTB_SIZE_16_BIT_EXT = 0x00000001,
|
||||
VK_VIDEO_ENCODE_H265_CTB_SIZE_32_BIT_EXT = 0x00000002,
|
||||
VK_VIDEO_ENCODE_H265_CTB_SIZE_64_BIT_EXT = 0x00000004,
|
||||
VK_VIDEO_ENCODE_H265_CTB_SIZE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
|
||||
} VkVideoEncodeH265CtbSizeFlagBitsEXT;
|
||||
typedef VkFlags VkVideoEncodeH265CtbSizeFlagsEXT;
|
||||
|
||||
typedef enum VkVideoEncodeH265TransformBlockSizeFlagBitsEXT {
|
||||
VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_4_BIT_EXT = 0x00000001,
|
||||
VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_8_BIT_EXT = 0x00000002,
|
||||
VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_16_BIT_EXT = 0x00000004,
|
||||
VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_32_BIT_EXT = 0x00000008,
|
||||
VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
|
||||
} VkVideoEncodeH265TransformBlockSizeFlagBitsEXT;
|
||||
typedef VkFlags VkVideoEncodeH265TransformBlockSizeFlagsEXT;
|
||||
typedef struct VkVideoEncodeH265CapabilitiesEXT {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkVideoEncodeH265CapabilityFlagsEXT flags;
|
||||
VkVideoEncodeH265CtbSizeFlagsEXT ctbSizes;
|
||||
VkVideoEncodeH265TransformBlockSizeFlagsEXT transformBlockSizes;
|
||||
uint32_t maxPPictureL0ReferenceCount;
|
||||
uint32_t maxBPictureL0ReferenceCount;
|
||||
uint32_t maxL1ReferenceCount;
|
||||
uint32_t maxSubLayersCount;
|
||||
uint32_t minLog2MinLumaCodingBlockSizeMinus3;
|
||||
uint32_t maxLog2MinLumaCodingBlockSizeMinus3;
|
||||
uint32_t minLog2MinLumaTransformBlockSizeMinus2;
|
||||
uint32_t maxLog2MinLumaTransformBlockSizeMinus2;
|
||||
uint32_t minMaxTransformHierarchyDepthInter;
|
||||
uint32_t maxMaxTransformHierarchyDepthInter;
|
||||
uint32_t minMaxTransformHierarchyDepthIntra;
|
||||
uint32_t maxMaxTransformHierarchyDepthIntra;
|
||||
uint32_t maxDiffCuQpDeltaDepth;
|
||||
uint32_t minMaxNumMergeCand;
|
||||
uint32_t maxMaxNumMergeCand;
|
||||
} VkVideoEncodeH265CapabilitiesEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH265SessionParametersAddInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t stdVPSCount;
|
||||
const StdVideoH265VideoParameterSet* pStdVPSs;
|
||||
uint32_t stdSPSCount;
|
||||
const StdVideoH265SequenceParameterSet* pStdSPSs;
|
||||
uint32_t stdPPSCount;
|
||||
const StdVideoH265PictureParameterSet* pStdPPSs;
|
||||
} VkVideoEncodeH265SessionParametersAddInfoEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH265SessionParametersCreateInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t maxStdVPSCount;
|
||||
uint32_t maxStdSPSCount;
|
||||
uint32_t maxStdPPSCount;
|
||||
const VkVideoEncodeH265SessionParametersAddInfoEXT* pParametersAddInfo;
|
||||
} VkVideoEncodeH265SessionParametersCreateInfoEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH265NaluSliceSegmentInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t ctbCount;
|
||||
const StdVideoEncodeH265ReferenceListsInfo* pStdReferenceFinalLists;
|
||||
const StdVideoEncodeH265SliceSegmentHeader* pStdSliceSegmentHeader;
|
||||
} VkVideoEncodeH265NaluSliceSegmentInfoEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH265VclFrameInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
const StdVideoEncodeH265ReferenceListsInfo* pStdReferenceFinalLists;
|
||||
uint32_t naluSliceSegmentEntryCount;
|
||||
const VkVideoEncodeH265NaluSliceSegmentInfoEXT* pNaluSliceSegmentEntries;
|
||||
const StdVideoEncodeH265PictureInfo* pStdPictureInfo;
|
||||
} VkVideoEncodeH265VclFrameInfoEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH265DpbSlotInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
const StdVideoEncodeH265ReferenceInfo* pStdReferenceInfo;
|
||||
} VkVideoEncodeH265DpbSlotInfoEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH265ProfileInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
StdVideoH265ProfileIdc stdProfileIdc;
|
||||
} VkVideoEncodeH265ProfileInfoEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH265RateControlInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t gopFrameCount;
|
||||
uint32_t idrPeriod;
|
||||
uint32_t consecutiveBFrameCount;
|
||||
VkVideoEncodeH265RateControlStructureEXT rateControlStructure;
|
||||
uint32_t subLayerCount;
|
||||
} VkVideoEncodeH265RateControlInfoEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH265QpEXT {
|
||||
int32_t qpI;
|
||||
int32_t qpP;
|
||||
int32_t qpB;
|
||||
} VkVideoEncodeH265QpEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH265FrameSizeEXT {
|
||||
uint32_t frameISize;
|
||||
uint32_t framePSize;
|
||||
uint32_t frameBSize;
|
||||
} VkVideoEncodeH265FrameSizeEXT;
|
||||
|
||||
typedef struct VkVideoEncodeH265RateControlLayerInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t temporalId;
|
||||
VkBool32 useInitialRcQp;
|
||||
VkVideoEncodeH265QpEXT initialRcQp;
|
||||
VkBool32 useMinQp;
|
||||
VkVideoEncodeH265QpEXT minQp;
|
||||
VkBool32 useMaxQp;
|
||||
VkVideoEncodeH265QpEXT maxQp;
|
||||
VkBool32 useMaxFrameSize;
|
||||
VkVideoEncodeH265FrameSizeEXT maxFrameSize;
|
||||
} VkVideoEncodeH265RateControlLayerInfoEXT;
|
||||
|
||||
|
||||
|
||||
#define VK_NV_displacement_micromap 1
|
||||
#define VK_NV_DISPLACEMENT_MICROMAP_SPEC_VERSION 1
|
||||
#define VK_NV_DISPLACEMENT_MICROMAP_EXTENSION_NAME "VK_NV_displacement_micromap"
|
||||
|
||||
typedef enum VkDisplacementMicromapFormatNV {
|
||||
VK_DISPLACEMENT_MICROMAP_FORMAT_64_TRIANGLES_64_BYTES_NV = 1,
|
||||
VK_DISPLACEMENT_MICROMAP_FORMAT_256_TRIANGLES_128_BYTES_NV = 2,
|
||||
VK_DISPLACEMENT_MICROMAP_FORMAT_1024_TRIANGLES_128_BYTES_NV = 3,
|
||||
VK_DISPLACEMENT_MICROMAP_FORMAT_MAX_ENUM_NV = 0x7FFFFFFF
|
||||
} VkDisplacementMicromapFormatNV;
|
||||
typedef struct VkPhysicalDeviceDisplacementMicromapFeaturesNV {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkBool32 displacementMicromap;
|
||||
} VkPhysicalDeviceDisplacementMicromapFeaturesNV;
|
||||
|
||||
typedef struct VkPhysicalDeviceDisplacementMicromapPropertiesNV {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
uint32_t maxDisplacementMicromapSubdivisionLevel;
|
||||
} VkPhysicalDeviceDisplacementMicromapPropertiesNV;
|
||||
|
||||
typedef struct VkAccelerationStructureTrianglesDisplacementMicromapNV {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkFormat displacementBiasAndScaleFormat;
|
||||
VkFormat displacementVectorFormat;
|
||||
VkDeviceOrHostAddressConstKHR displacementBiasAndScaleBuffer;
|
||||
VkDeviceSize displacementBiasAndScaleStride;
|
||||
VkDeviceOrHostAddressConstKHR displacementVectorBuffer;
|
||||
VkDeviceSize displacementVectorStride;
|
||||
VkDeviceOrHostAddressConstKHR displacedMicromapPrimitiveFlags;
|
||||
VkDeviceSize displacedMicromapPrimitiveFlagsStride;
|
||||
VkIndexType indexType;
|
||||
VkDeviceOrHostAddressConstKHR indexBuffer;
|
||||
VkDeviceSize indexStride;
|
||||
uint32_t baseTriangle;
|
||||
uint32_t usageCountsCount;
|
||||
const VkMicromapUsageEXT* pUsageCounts;
|
||||
const VkMicromapUsageEXT* const* ppUsageCounts;
|
||||
VkMicromapEXT micromap;
|
||||
} VkAccelerationStructureTrianglesDisplacementMicromapNV;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+17178
File diff suppressed because it is too large.
Load diff
+54
@@ -0,0 +1,54 @@
|
||||
#ifndef VULKAN_DIRECTFB_H_
|
||||
#define VULKAN_DIRECTFB_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_EXT_directfb_surface 1
|
||||
#define VK_EXT_DIRECTFB_SURFACE_SPEC_VERSION 1
|
||||
#define VK_EXT_DIRECTFB_SURFACE_EXTENSION_NAME "VK_EXT_directfb_surface"
|
||||
typedef VkFlags VkDirectFBSurfaceCreateFlagsEXT;
|
||||
typedef struct VkDirectFBSurfaceCreateInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkDirectFBSurfaceCreateFlagsEXT flags;
|
||||
IDirectFB* dfb;
|
||||
IDirectFBSurface* surface;
|
||||
} VkDirectFBSurfaceCreateInfoEXT;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateDirectFBSurfaceEXT)(VkInstance instance, const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, IDirectFB* dfb);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDirectFBSurfaceEXT(
|
||||
VkInstance instance,
|
||||
const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceDirectFBPresentationSupportEXT(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
IDirectFB* dfb);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+258
@@ -0,0 +1,258 @@
|
||||
#ifndef VULKAN_FUCHSIA_H_
|
||||
#define VULKAN_FUCHSIA_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_FUCHSIA_imagepipe_surface 1
|
||||
#define VK_FUCHSIA_IMAGEPIPE_SURFACE_SPEC_VERSION 1
|
||||
#define VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME "VK_FUCHSIA_imagepipe_surface"
|
||||
typedef VkFlags VkImagePipeSurfaceCreateFlagsFUCHSIA;
|
||||
typedef struct VkImagePipeSurfaceCreateInfoFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkImagePipeSurfaceCreateFlagsFUCHSIA flags;
|
||||
zx_handle_t imagePipeHandle;
|
||||
} VkImagePipeSurfaceCreateInfoFUCHSIA;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateImagePipeSurfaceFUCHSIA)(VkInstance instance, const VkImagePipeSurfaceCreateInfoFUCHSIA* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateImagePipeSurfaceFUCHSIA(
|
||||
VkInstance instance,
|
||||
const VkImagePipeSurfaceCreateInfoFUCHSIA* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
|
||||
|
||||
#define VK_FUCHSIA_external_memory 1
|
||||
#define VK_FUCHSIA_EXTERNAL_MEMORY_SPEC_VERSION 1
|
||||
#define VK_FUCHSIA_EXTERNAL_MEMORY_EXTENSION_NAME "VK_FUCHSIA_external_memory"
|
||||
typedef struct VkImportMemoryZirconHandleInfoFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkExternalMemoryHandleTypeFlagBits handleType;
|
||||
zx_handle_t handle;
|
||||
} VkImportMemoryZirconHandleInfoFUCHSIA;
|
||||
|
||||
typedef struct VkMemoryZirconHandlePropertiesFUCHSIA {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
uint32_t memoryTypeBits;
|
||||
} VkMemoryZirconHandlePropertiesFUCHSIA;
|
||||
|
||||
typedef struct VkMemoryGetZirconHandleInfoFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkDeviceMemory memory;
|
||||
VkExternalMemoryHandleTypeFlagBits handleType;
|
||||
} VkMemoryGetZirconHandleInfoFUCHSIA;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryZirconHandleFUCHSIA)(VkDevice device, const VkMemoryGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo, zx_handle_t* pZirconHandle);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryZirconHandlePropertiesFUCHSIA)(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, zx_handle_t zirconHandle, VkMemoryZirconHandlePropertiesFUCHSIA* pMemoryZirconHandleProperties);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryZirconHandleFUCHSIA(
|
||||
VkDevice device,
|
||||
const VkMemoryGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo,
|
||||
zx_handle_t* pZirconHandle);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryZirconHandlePropertiesFUCHSIA(
|
||||
VkDevice device,
|
||||
VkExternalMemoryHandleTypeFlagBits handleType,
|
||||
zx_handle_t zirconHandle,
|
||||
VkMemoryZirconHandlePropertiesFUCHSIA* pMemoryZirconHandleProperties);
|
||||
#endif
|
||||
|
||||
|
||||
#define VK_FUCHSIA_external_semaphore 1
|
||||
#define VK_FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION 1
|
||||
#define VK_FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_FUCHSIA_external_semaphore"
|
||||
typedef struct VkImportSemaphoreZirconHandleInfoFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkSemaphore semaphore;
|
||||
VkSemaphoreImportFlags flags;
|
||||
VkExternalSemaphoreHandleTypeFlagBits handleType;
|
||||
zx_handle_t zirconHandle;
|
||||
} VkImportSemaphoreZirconHandleInfoFUCHSIA;
|
||||
|
||||
typedef struct VkSemaphoreGetZirconHandleInfoFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkSemaphore semaphore;
|
||||
VkExternalSemaphoreHandleTypeFlagBits handleType;
|
||||
} VkSemaphoreGetZirconHandleInfoFUCHSIA;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreZirconHandleFUCHSIA)(VkDevice device, const VkImportSemaphoreZirconHandleInfoFUCHSIA* pImportSemaphoreZirconHandleInfo);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreZirconHandleFUCHSIA)(VkDevice device, const VkSemaphoreGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo, zx_handle_t* pZirconHandle);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreZirconHandleFUCHSIA(
|
||||
VkDevice device,
|
||||
const VkImportSemaphoreZirconHandleInfoFUCHSIA* pImportSemaphoreZirconHandleInfo);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreZirconHandleFUCHSIA(
|
||||
VkDevice device,
|
||||
const VkSemaphoreGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo,
|
||||
zx_handle_t* pZirconHandle);
|
||||
#endif
|
||||
|
||||
|
||||
#define VK_FUCHSIA_buffer_collection 1
|
||||
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferCollectionFUCHSIA)
|
||||
#define VK_FUCHSIA_BUFFER_COLLECTION_SPEC_VERSION 2
|
||||
#define VK_FUCHSIA_BUFFER_COLLECTION_EXTENSION_NAME "VK_FUCHSIA_buffer_collection"
|
||||
typedef VkFlags VkImageFormatConstraintsFlagsFUCHSIA;
|
||||
|
||||
typedef enum VkImageConstraintsInfoFlagBitsFUCHSIA {
|
||||
VK_IMAGE_CONSTRAINTS_INFO_CPU_READ_RARELY_FUCHSIA = 0x00000001,
|
||||
VK_IMAGE_CONSTRAINTS_INFO_CPU_READ_OFTEN_FUCHSIA = 0x00000002,
|
||||
VK_IMAGE_CONSTRAINTS_INFO_CPU_WRITE_RARELY_FUCHSIA = 0x00000004,
|
||||
VK_IMAGE_CONSTRAINTS_INFO_CPU_WRITE_OFTEN_FUCHSIA = 0x00000008,
|
||||
VK_IMAGE_CONSTRAINTS_INFO_PROTECTED_OPTIONAL_FUCHSIA = 0x00000010,
|
||||
VK_IMAGE_CONSTRAINTS_INFO_FLAG_BITS_MAX_ENUM_FUCHSIA = 0x7FFFFFFF
|
||||
} VkImageConstraintsInfoFlagBitsFUCHSIA;
|
||||
typedef VkFlags VkImageConstraintsInfoFlagsFUCHSIA;
|
||||
typedef struct VkBufferCollectionCreateInfoFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
zx_handle_t collectionToken;
|
||||
} VkBufferCollectionCreateInfoFUCHSIA;
|
||||
|
||||
typedef struct VkImportMemoryBufferCollectionFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkBufferCollectionFUCHSIA collection;
|
||||
uint32_t index;
|
||||
} VkImportMemoryBufferCollectionFUCHSIA;
|
||||
|
||||
typedef struct VkBufferCollectionImageCreateInfoFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkBufferCollectionFUCHSIA collection;
|
||||
uint32_t index;
|
||||
} VkBufferCollectionImageCreateInfoFUCHSIA;
|
||||
|
||||
typedef struct VkBufferCollectionConstraintsInfoFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t minBufferCount;
|
||||
uint32_t maxBufferCount;
|
||||
uint32_t minBufferCountForCamping;
|
||||
uint32_t minBufferCountForDedicatedSlack;
|
||||
uint32_t minBufferCountForSharedSlack;
|
||||
} VkBufferCollectionConstraintsInfoFUCHSIA;
|
||||
|
||||
typedef struct VkBufferConstraintsInfoFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkBufferCreateInfo createInfo;
|
||||
VkFormatFeatureFlags requiredFormatFeatures;
|
||||
VkBufferCollectionConstraintsInfoFUCHSIA bufferCollectionConstraints;
|
||||
} VkBufferConstraintsInfoFUCHSIA;
|
||||
|
||||
typedef struct VkBufferCollectionBufferCreateInfoFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkBufferCollectionFUCHSIA collection;
|
||||
uint32_t index;
|
||||
} VkBufferCollectionBufferCreateInfoFUCHSIA;
|
||||
|
||||
typedef struct VkSysmemColorSpaceFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t colorSpace;
|
||||
} VkSysmemColorSpaceFUCHSIA;
|
||||
|
||||
typedef struct VkBufferCollectionPropertiesFUCHSIA {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
uint32_t memoryTypeBits;
|
||||
uint32_t bufferCount;
|
||||
uint32_t createInfoIndex;
|
||||
uint64_t sysmemPixelFormat;
|
||||
VkFormatFeatureFlags formatFeatures;
|
||||
VkSysmemColorSpaceFUCHSIA sysmemColorSpaceIndex;
|
||||
VkComponentMapping samplerYcbcrConversionComponents;
|
||||
VkSamplerYcbcrModelConversion suggestedYcbcrModel;
|
||||
VkSamplerYcbcrRange suggestedYcbcrRange;
|
||||
VkChromaLocation suggestedXChromaOffset;
|
||||
VkChromaLocation suggestedYChromaOffset;
|
||||
} VkBufferCollectionPropertiesFUCHSIA;
|
||||
|
||||
typedef struct VkImageFormatConstraintsInfoFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkImageCreateInfo imageCreateInfo;
|
||||
VkFormatFeatureFlags requiredFormatFeatures;
|
||||
VkImageFormatConstraintsFlagsFUCHSIA flags;
|
||||
uint64_t sysmemPixelFormat;
|
||||
uint32_t colorSpaceCount;
|
||||
const VkSysmemColorSpaceFUCHSIA* pColorSpaces;
|
||||
} VkImageFormatConstraintsInfoFUCHSIA;
|
||||
|
||||
typedef struct VkImageConstraintsInfoFUCHSIA {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t formatConstraintsCount;
|
||||
const VkImageFormatConstraintsInfoFUCHSIA* pFormatConstraints;
|
||||
VkBufferCollectionConstraintsInfoFUCHSIA bufferCollectionConstraints;
|
||||
VkImageConstraintsInfoFlagsFUCHSIA flags;
|
||||
} VkImageConstraintsInfoFUCHSIA;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateBufferCollectionFUCHSIA)(VkDevice device, const VkBufferCollectionCreateInfoFUCHSIA* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferCollectionFUCHSIA* pCollection);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkSetBufferCollectionImageConstraintsFUCHSIA)(VkDevice device, VkBufferCollectionFUCHSIA collection, const VkImageConstraintsInfoFUCHSIA* pImageConstraintsInfo);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkSetBufferCollectionBufferConstraintsFUCHSIA)(VkDevice device, VkBufferCollectionFUCHSIA collection, const VkBufferConstraintsInfoFUCHSIA* pBufferConstraintsInfo);
|
||||
typedef void (VKAPI_PTR *PFN_vkDestroyBufferCollectionFUCHSIA)(VkDevice device, VkBufferCollectionFUCHSIA collection, const VkAllocationCallbacks* pAllocator);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetBufferCollectionPropertiesFUCHSIA)(VkDevice device, VkBufferCollectionFUCHSIA collection, VkBufferCollectionPropertiesFUCHSIA* pProperties);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferCollectionFUCHSIA(
|
||||
VkDevice device,
|
||||
const VkBufferCollectionCreateInfoFUCHSIA* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkBufferCollectionFUCHSIA* pCollection);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkSetBufferCollectionImageConstraintsFUCHSIA(
|
||||
VkDevice device,
|
||||
VkBufferCollectionFUCHSIA collection,
|
||||
const VkImageConstraintsInfoFUCHSIA* pImageConstraintsInfo);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkSetBufferCollectionBufferConstraintsFUCHSIA(
|
||||
VkDevice device,
|
||||
VkBufferCollectionFUCHSIA collection,
|
||||
const VkBufferConstraintsInfoFUCHSIA* pBufferConstraintsInfo);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkDestroyBufferCollectionFUCHSIA(
|
||||
VkDevice device,
|
||||
VkBufferCollectionFUCHSIA collection,
|
||||
const VkAllocationCallbacks* pAllocator);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetBufferCollectionPropertiesFUCHSIA(
|
||||
VkDevice device,
|
||||
VkBufferCollectionFUCHSIA collection,
|
||||
VkBufferCollectionPropertiesFUCHSIA* pProperties);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
#ifndef VULKAN_GGP_H_
|
||||
#define VULKAN_GGP_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_GGP_stream_descriptor_surface 1
|
||||
#define VK_GGP_STREAM_DESCRIPTOR_SURFACE_SPEC_VERSION 1
|
||||
#define VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME "VK_GGP_stream_descriptor_surface"
|
||||
typedef VkFlags VkStreamDescriptorSurfaceCreateFlagsGGP;
|
||||
typedef struct VkStreamDescriptorSurfaceCreateInfoGGP {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkStreamDescriptorSurfaceCreateFlagsGGP flags;
|
||||
GgpStreamDescriptor streamDescriptor;
|
||||
} VkStreamDescriptorSurfaceCreateInfoGGP;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateStreamDescriptorSurfaceGGP)(VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateStreamDescriptorSurfaceGGP(
|
||||
VkInstance instance,
|
||||
const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
|
||||
|
||||
#define VK_GGP_frame_token 1
|
||||
#define VK_GGP_FRAME_TOKEN_SPEC_VERSION 1
|
||||
#define VK_GGP_FRAME_TOKEN_EXTENSION_NAME "VK_GGP_frame_token"
|
||||
typedef struct VkPresentFrameTokenGGP {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
GgpFrameToken frameToken;
|
||||
} VkPresentFrameTokenGGP;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#ifndef VULKAN_IOS_H_
|
||||
#define VULKAN_IOS_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_MVK_ios_surface 1
|
||||
#define VK_MVK_IOS_SURFACE_SPEC_VERSION 3
|
||||
#define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface"
|
||||
typedef VkFlags VkIOSSurfaceCreateFlagsMVK;
|
||||
typedef struct VkIOSSurfaceCreateInfoMVK {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkIOSSurfaceCreateFlagsMVK flags;
|
||||
const void* pView;
|
||||
} VkIOSSurfaceCreateInfoMVK;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK(
|
||||
VkInstance instance,
|
||||
const VkIOSSurfaceCreateInfoMVK* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#ifndef VULKAN_MACOS_H_
|
||||
#define VULKAN_MACOS_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_MVK_macos_surface 1
|
||||
#define VK_MVK_MACOS_SURFACE_SPEC_VERSION 3
|
||||
#define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface"
|
||||
typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
|
||||
typedef struct VkMacOSSurfaceCreateInfoMVK {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkMacOSSurfaceCreateFlagsMVK flags;
|
||||
const void* pView;
|
||||
} VkMacOSSurfaceCreateInfoMVK;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(
|
||||
VkInstance instance,
|
||||
const VkMacOSSurfaceCreateInfoMVK* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+193
@@ -0,0 +1,193 @@
|
||||
#ifndef VULKAN_METAL_H_
|
||||
#define VULKAN_METAL_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_EXT_metal_surface 1
|
||||
#ifdef __OBJC__
|
||||
@class CAMetalLayer;
|
||||
#else
|
||||
typedef void CAMetalLayer;
|
||||
#endif
|
||||
|
||||
#define VK_EXT_METAL_SURFACE_SPEC_VERSION 1
|
||||
#define VK_EXT_METAL_SURFACE_EXTENSION_NAME "VK_EXT_metal_surface"
|
||||
typedef VkFlags VkMetalSurfaceCreateFlagsEXT;
|
||||
typedef struct VkMetalSurfaceCreateInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkMetalSurfaceCreateFlagsEXT flags;
|
||||
const CAMetalLayer* pLayer;
|
||||
} VkMetalSurfaceCreateInfoEXT;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateMetalSurfaceEXT)(VkInstance instance, const VkMetalSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateMetalSurfaceEXT(
|
||||
VkInstance instance,
|
||||
const VkMetalSurfaceCreateInfoEXT* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
|
||||
|
||||
#define VK_EXT_metal_objects 1
|
||||
#ifdef __OBJC__
|
||||
@protocol MTLDevice;
|
||||
typedef id<MTLDevice> MTLDevice_id;
|
||||
#else
|
||||
typedef void* MTLDevice_id;
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
@protocol MTLCommandQueue;
|
||||
typedef id<MTLCommandQueue> MTLCommandQueue_id;
|
||||
#else
|
||||
typedef void* MTLCommandQueue_id;
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
@protocol MTLBuffer;
|
||||
typedef id<MTLBuffer> MTLBuffer_id;
|
||||
#else
|
||||
typedef void* MTLBuffer_id;
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
@protocol MTLTexture;
|
||||
typedef id<MTLTexture> MTLTexture_id;
|
||||
#else
|
||||
typedef void* MTLTexture_id;
|
||||
#endif
|
||||
|
||||
typedef struct __IOSurface* IOSurfaceRef;
|
||||
#ifdef __OBJC__
|
||||
@protocol MTLSharedEvent;
|
||||
typedef id<MTLSharedEvent> MTLSharedEvent_id;
|
||||
#else
|
||||
typedef void* MTLSharedEvent_id;
|
||||
#endif
|
||||
|
||||
#define VK_EXT_METAL_OBJECTS_SPEC_VERSION 1
|
||||
#define VK_EXT_METAL_OBJECTS_EXTENSION_NAME "VK_EXT_metal_objects"
|
||||
|
||||
typedef enum VkExportMetalObjectTypeFlagBitsEXT {
|
||||
VK_EXPORT_METAL_OBJECT_TYPE_METAL_DEVICE_BIT_EXT = 0x00000001,
|
||||
VK_EXPORT_METAL_OBJECT_TYPE_METAL_COMMAND_QUEUE_BIT_EXT = 0x00000002,
|
||||
VK_EXPORT_METAL_OBJECT_TYPE_METAL_BUFFER_BIT_EXT = 0x00000004,
|
||||
VK_EXPORT_METAL_OBJECT_TYPE_METAL_TEXTURE_BIT_EXT = 0x00000008,
|
||||
VK_EXPORT_METAL_OBJECT_TYPE_METAL_IOSURFACE_BIT_EXT = 0x00000010,
|
||||
VK_EXPORT_METAL_OBJECT_TYPE_METAL_SHARED_EVENT_BIT_EXT = 0x00000020,
|
||||
VK_EXPORT_METAL_OBJECT_TYPE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
|
||||
} VkExportMetalObjectTypeFlagBitsEXT;
|
||||
typedef VkFlags VkExportMetalObjectTypeFlagsEXT;
|
||||
typedef struct VkExportMetalObjectCreateInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkExportMetalObjectTypeFlagBitsEXT exportObjectType;
|
||||
} VkExportMetalObjectCreateInfoEXT;
|
||||
|
||||
typedef struct VkExportMetalObjectsInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
} VkExportMetalObjectsInfoEXT;
|
||||
|
||||
typedef struct VkExportMetalDeviceInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
MTLDevice_id mtlDevice;
|
||||
} VkExportMetalDeviceInfoEXT;
|
||||
|
||||
typedef struct VkExportMetalCommandQueueInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkQueue queue;
|
||||
MTLCommandQueue_id mtlCommandQueue;
|
||||
} VkExportMetalCommandQueueInfoEXT;
|
||||
|
||||
typedef struct VkExportMetalBufferInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkDeviceMemory memory;
|
||||
MTLBuffer_id mtlBuffer;
|
||||
} VkExportMetalBufferInfoEXT;
|
||||
|
||||
typedef struct VkImportMetalBufferInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
MTLBuffer_id mtlBuffer;
|
||||
} VkImportMetalBufferInfoEXT;
|
||||
|
||||
typedef struct VkExportMetalTextureInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkImage image;
|
||||
VkImageView imageView;
|
||||
VkBufferView bufferView;
|
||||
VkImageAspectFlagBits plane;
|
||||
MTLTexture_id mtlTexture;
|
||||
} VkExportMetalTextureInfoEXT;
|
||||
|
||||
typedef struct VkImportMetalTextureInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkImageAspectFlagBits plane;
|
||||
MTLTexture_id mtlTexture;
|
||||
} VkImportMetalTextureInfoEXT;
|
||||
|
||||
typedef struct VkExportMetalIOSurfaceInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkImage image;
|
||||
IOSurfaceRef ioSurface;
|
||||
} VkExportMetalIOSurfaceInfoEXT;
|
||||
|
||||
typedef struct VkImportMetalIOSurfaceInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
IOSurfaceRef ioSurface;
|
||||
} VkImportMetalIOSurfaceInfoEXT;
|
||||
|
||||
typedef struct VkExportMetalSharedEventInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkSemaphore semaphore;
|
||||
VkEvent event;
|
||||
MTLSharedEvent_id mtlSharedEvent;
|
||||
} VkExportMetalSharedEventInfoEXT;
|
||||
|
||||
typedef struct VkImportMetalSharedEventInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
MTLSharedEvent_id mtlSharedEvent;
|
||||
} VkImportMetalSharedEventInfoEXT;
|
||||
|
||||
typedef void (VKAPI_PTR *PFN_vkExportMetalObjectsEXT)(VkDevice device, VkExportMetalObjectsInfoEXT* pMetalObjectsInfo);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR void VKAPI_CALL vkExportMetalObjectsEXT(
|
||||
VkDevice device,
|
||||
VkExportMetalObjectsInfoEXT* pMetalObjectsInfo);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
#ifndef VULKAN_SCREEN_H_
|
||||
#define VULKAN_SCREEN_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_QNX_screen_surface 1
|
||||
#define VK_QNX_SCREEN_SURFACE_SPEC_VERSION 1
|
||||
#define VK_QNX_SCREEN_SURFACE_EXTENSION_NAME "VK_QNX_screen_surface"
|
||||
typedef VkFlags VkScreenSurfaceCreateFlagsQNX;
|
||||
typedef struct VkScreenSurfaceCreateInfoQNX {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkScreenSurfaceCreateFlagsQNX flags;
|
||||
struct _screen_context* context;
|
||||
struct _screen_window* window;
|
||||
} VkScreenSurfaceCreateInfoQNX;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateScreenSurfaceQNX)(VkInstance instance, const VkScreenSurfaceCreateInfoQNX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct _screen_window* window);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateScreenSurfaceQNX(
|
||||
VkInstance instance,
|
||||
const VkScreenSurfaceCreateInfoQNX* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceScreenPresentationSupportQNX(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
struct _screen_window* window);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
#ifndef VULKAN_VI_H_
|
||||
#define VULKAN_VI_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_NN_vi_surface 1
|
||||
#define VK_NN_VI_SURFACE_SPEC_VERSION 1
|
||||
#define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface"
|
||||
typedef VkFlags VkViSurfaceCreateFlagsNN;
|
||||
typedef struct VkViSurfaceCreateInfoNN {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkViSurfaceCreateFlagsNN flags;
|
||||
void* window;
|
||||
} VkViSurfaceCreateInfoNN;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN(
|
||||
VkInstance instance,
|
||||
const VkViSurfaceCreateInfoNN* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
#ifndef VULKAN_WAYLAND_H_
|
||||
#define VULKAN_WAYLAND_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_KHR_wayland_surface 1
|
||||
#define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6
|
||||
#define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface"
|
||||
typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
|
||||
typedef struct VkWaylandSurfaceCreateInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkWaylandSurfaceCreateFlagsKHR flags;
|
||||
struct wl_display* display;
|
||||
struct wl_surface* surface;
|
||||
} VkWaylandSurfaceCreateInfoKHR;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkWaylandSurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
struct wl_display* display);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+333
@@ -0,0 +1,333 @@
|
||||
#ifndef VULKAN_WIN32_H_
|
||||
#define VULKAN_WIN32_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_KHR_win32_surface 1
|
||||
#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6
|
||||
#define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface"
|
||||
typedef VkFlags VkWin32SurfaceCreateFlagsKHR;
|
||||
typedef struct VkWin32SurfaceCreateInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkWin32SurfaceCreateFlagsKHR flags;
|
||||
HINSTANCE hinstance;
|
||||
HWND hwnd;
|
||||
} VkWin32SurfaceCreateInfoKHR;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateWin32SurfaceKHR)(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkWin32SurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex);
|
||||
#endif
|
||||
|
||||
|
||||
#define VK_KHR_external_memory_win32 1
|
||||
#define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
|
||||
#define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32"
|
||||
typedef struct VkImportMemoryWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkExternalMemoryHandleTypeFlagBits handleType;
|
||||
HANDLE handle;
|
||||
LPCWSTR name;
|
||||
} VkImportMemoryWin32HandleInfoKHR;
|
||||
|
||||
typedef struct VkExportMemoryWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
const SECURITY_ATTRIBUTES* pAttributes;
|
||||
DWORD dwAccess;
|
||||
LPCWSTR name;
|
||||
} VkExportMemoryWin32HandleInfoKHR;
|
||||
|
||||
typedef struct VkMemoryWin32HandlePropertiesKHR {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
uint32_t memoryTypeBits;
|
||||
} VkMemoryWin32HandlePropertiesKHR;
|
||||
|
||||
typedef struct VkMemoryGetWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkDeviceMemory memory;
|
||||
VkExternalMemoryHandleTypeFlagBits handleType;
|
||||
} VkMemoryGetWin32HandleInfoKHR;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleKHR)(VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandlePropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleKHR(
|
||||
VkDevice device,
|
||||
const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo,
|
||||
HANDLE* pHandle);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR(
|
||||
VkDevice device,
|
||||
VkExternalMemoryHandleTypeFlagBits handleType,
|
||||
HANDLE handle,
|
||||
VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties);
|
||||
#endif
|
||||
|
||||
|
||||
#define VK_KHR_win32_keyed_mutex 1
|
||||
#define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1
|
||||
#define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex"
|
||||
typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t acquireCount;
|
||||
const VkDeviceMemory* pAcquireSyncs;
|
||||
const uint64_t* pAcquireKeys;
|
||||
const uint32_t* pAcquireTimeouts;
|
||||
uint32_t releaseCount;
|
||||
const VkDeviceMemory* pReleaseSyncs;
|
||||
const uint64_t* pReleaseKeys;
|
||||
} VkWin32KeyedMutexAcquireReleaseInfoKHR;
|
||||
|
||||
|
||||
|
||||
#define VK_KHR_external_semaphore_win32 1
|
||||
#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1
|
||||
#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32"
|
||||
typedef struct VkImportSemaphoreWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkSemaphore semaphore;
|
||||
VkSemaphoreImportFlags flags;
|
||||
VkExternalSemaphoreHandleTypeFlagBits handleType;
|
||||
HANDLE handle;
|
||||
LPCWSTR name;
|
||||
} VkImportSemaphoreWin32HandleInfoKHR;
|
||||
|
||||
typedef struct VkExportSemaphoreWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
const SECURITY_ATTRIBUTES* pAttributes;
|
||||
DWORD dwAccess;
|
||||
LPCWSTR name;
|
||||
} VkExportSemaphoreWin32HandleInfoKHR;
|
||||
|
||||
typedef struct VkD3D12FenceSubmitInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t waitSemaphoreValuesCount;
|
||||
const uint64_t* pWaitSemaphoreValues;
|
||||
uint32_t signalSemaphoreValuesCount;
|
||||
const uint64_t* pSignalSemaphoreValues;
|
||||
} VkD3D12FenceSubmitInfoKHR;
|
||||
|
||||
typedef struct VkSemaphoreGetWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkSemaphore semaphore;
|
||||
VkExternalSemaphoreHandleTypeFlagBits handleType;
|
||||
} VkSemaphoreGetWin32HandleInfoKHR;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreWin32HandleKHR)(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreWin32HandleKHR)(VkDevice device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreWin32HandleKHR(
|
||||
VkDevice device,
|
||||
const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR(
|
||||
VkDevice device,
|
||||
const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo,
|
||||
HANDLE* pHandle);
|
||||
#endif
|
||||
|
||||
|
||||
#define VK_KHR_external_fence_win32 1
|
||||
#define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1
|
||||
#define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32"
|
||||
typedef struct VkImportFenceWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkFence fence;
|
||||
VkFenceImportFlags flags;
|
||||
VkExternalFenceHandleTypeFlagBits handleType;
|
||||
HANDLE handle;
|
||||
LPCWSTR name;
|
||||
} VkImportFenceWin32HandleInfoKHR;
|
||||
|
||||
typedef struct VkExportFenceWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
const SECURITY_ATTRIBUTES* pAttributes;
|
||||
DWORD dwAccess;
|
||||
LPCWSTR name;
|
||||
} VkExportFenceWin32HandleInfoKHR;
|
||||
|
||||
typedef struct VkFenceGetWin32HandleInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkFence fence;
|
||||
VkExternalFenceHandleTypeFlagBits handleType;
|
||||
} VkFenceGetWin32HandleInfoKHR;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkImportFenceWin32HandleKHR)(VkDevice device, const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetFenceWin32HandleKHR)(VkDevice device, const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceWin32HandleKHR(
|
||||
VkDevice device,
|
||||
const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR(
|
||||
VkDevice device,
|
||||
const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo,
|
||||
HANDLE* pHandle);
|
||||
#endif
|
||||
|
||||
|
||||
#define VK_NV_external_memory_win32 1
|
||||
#define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
|
||||
#define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32"
|
||||
typedef struct VkImportMemoryWin32HandleInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkExternalMemoryHandleTypeFlagsNV handleType;
|
||||
HANDLE handle;
|
||||
} VkImportMemoryWin32HandleInfoNV;
|
||||
|
||||
typedef struct VkExportMemoryWin32HandleInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
const SECURITY_ATTRIBUTES* pAttributes;
|
||||
DWORD dwAccess;
|
||||
} VkExportMemoryWin32HandleInfoNV;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleNV)(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE* pHandle);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV(
|
||||
VkDevice device,
|
||||
VkDeviceMemory memory,
|
||||
VkExternalMemoryHandleTypeFlagsNV handleType,
|
||||
HANDLE* pHandle);
|
||||
#endif
|
||||
|
||||
|
||||
#define VK_NV_win32_keyed_mutex 1
|
||||
#define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 2
|
||||
#define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex"
|
||||
typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t acquireCount;
|
||||
const VkDeviceMemory* pAcquireSyncs;
|
||||
const uint64_t* pAcquireKeys;
|
||||
const uint32_t* pAcquireTimeoutMilliseconds;
|
||||
uint32_t releaseCount;
|
||||
const VkDeviceMemory* pReleaseSyncs;
|
||||
const uint64_t* pReleaseKeys;
|
||||
} VkWin32KeyedMutexAcquireReleaseInfoNV;
|
||||
|
||||
|
||||
|
||||
#define VK_EXT_full_screen_exclusive 1
|
||||
#define VK_EXT_FULL_SCREEN_EXCLUSIVE_SPEC_VERSION 4
|
||||
#define VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME "VK_EXT_full_screen_exclusive"
|
||||
|
||||
typedef enum VkFullScreenExclusiveEXT {
|
||||
VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT = 0,
|
||||
VK_FULL_SCREEN_EXCLUSIVE_ALLOWED_EXT = 1,
|
||||
VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT = 2,
|
||||
VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT = 3,
|
||||
VK_FULL_SCREEN_EXCLUSIVE_MAX_ENUM_EXT = 0x7FFFFFFF
|
||||
} VkFullScreenExclusiveEXT;
|
||||
typedef struct VkSurfaceFullScreenExclusiveInfoEXT {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkFullScreenExclusiveEXT fullScreenExclusive;
|
||||
} VkSurfaceFullScreenExclusiveInfoEXT;
|
||||
|
||||
typedef struct VkSurfaceCapabilitiesFullScreenExclusiveEXT {
|
||||
VkStructureType sType;
|
||||
void* pNext;
|
||||
VkBool32 fullScreenExclusiveSupported;
|
||||
} VkSurfaceCapabilitiesFullScreenExclusiveEXT;
|
||||
|
||||
typedef struct VkSurfaceFullScreenExclusiveWin32InfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
HMONITOR hmonitor;
|
||||
} VkSurfaceFullScreenExclusiveWin32InfoEXT;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModes2EXT)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkAcquireFullScreenExclusiveModeEXT)(VkDevice device, VkSwapchainKHR swapchain);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkReleaseFullScreenExclusiveModeEXT)(VkDevice device, VkSwapchainKHR swapchain);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupSurfacePresentModes2EXT)(VkDevice device, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, VkDeviceGroupPresentModeFlagsKHR* pModes);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModes2EXT(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
|
||||
uint32_t* pPresentModeCount,
|
||||
VkPresentModeKHR* pPresentModes);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkAcquireFullScreenExclusiveModeEXT(
|
||||
VkDevice device,
|
||||
VkSwapchainKHR swapchain);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkReleaseFullScreenExclusiveModeEXT(
|
||||
VkDevice device,
|
||||
VkSwapchainKHR swapchain);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModes2EXT(
|
||||
VkDevice device,
|
||||
const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
|
||||
VkDeviceGroupPresentModeFlagsKHR* pModes);
|
||||
#endif
|
||||
|
||||
|
||||
#define VK_NV_acquire_winrt_display 1
|
||||
#define VK_NV_ACQUIRE_WINRT_DISPLAY_SPEC_VERSION 1
|
||||
#define VK_NV_ACQUIRE_WINRT_DISPLAY_EXTENSION_NAME "VK_NV_acquire_winrt_display"
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkAcquireWinrtDisplayNV)(VkPhysicalDevice physicalDevice, VkDisplayKHR display);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetWinrtDisplayNV)(VkPhysicalDevice physicalDevice, uint32_t deviceRelativeId, VkDisplayKHR* pDisplay);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkAcquireWinrtDisplayNV(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkDisplayKHR display);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetWinrtDisplayNV(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t deviceRelativeId,
|
||||
VkDisplayKHR* pDisplay);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#ifndef VULKAN_XCB_H_
|
||||
#define VULKAN_XCB_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_KHR_xcb_surface 1
|
||||
#define VK_KHR_XCB_SURFACE_SPEC_VERSION 6
|
||||
#define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface"
|
||||
typedef VkFlags VkXcbSurfaceCreateFlagsKHR;
|
||||
typedef struct VkXcbSurfaceCreateInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkXcbSurfaceCreateFlagsKHR flags;
|
||||
xcb_connection_t* connection;
|
||||
xcb_window_t window;
|
||||
} VkXcbSurfaceCreateInfoKHR;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkXcbSurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
xcb_connection_t* connection,
|
||||
xcb_visualid_t visual_id);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#ifndef VULKAN_XLIB_H_
|
||||
#define VULKAN_XLIB_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_KHR_xlib_surface 1
|
||||
#define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6
|
||||
#define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface"
|
||||
typedef VkFlags VkXlibSurfaceCreateFlagsKHR;
|
||||
typedef struct VkXlibSurfaceCreateInfoKHR {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkXlibSurfaceCreateFlagsKHR flags;
|
||||
Display* dpy;
|
||||
Window window;
|
||||
} VkXlibSurfaceCreateInfoKHR;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkXlibSurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
Display* dpy,
|
||||
VisualID visualID);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
#ifndef VULKAN_XLIB_XRANDR_H_
|
||||
#define VULKAN_XLIB_XRANDR_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define VK_EXT_acquire_xlib_display 1
|
||||
#define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1
|
||||
#define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display"
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkAcquireXlibDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetRandROutputDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, VkDisplayKHR* pDisplay);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
Display* dpy,
|
||||
VkDisplayKHR display);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
Display* dpy,
|
||||
RROutput rrOutput,
|
||||
VkDisplayKHR* pDisplay);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user