Merge "Revert "GLConsumer: add build-time disable of gpu protected content"" into nyc-dev
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index e01aa3f..facf300 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -53,6 +53,8 @@
const char* k_traceAppsNumberProperty = "debug.atrace.app_number";
const char* k_traceAppsPropertyTemplate = "debug.atrace.app_%d";
+const char* k_coreServiceCategory = "core_services";
+const char* k_coreServicesProp = "ro.atrace.core.services";
typedef enum { OPT, REQ } requiredness ;
@@ -100,6 +102,7 @@
{ "pm", "Package Manager", ATRACE_TAG_PACKAGE_MANAGER, { } },
{ "ss", "System Server", ATRACE_TAG_SYSTEM_SERVER, { } },
{ "database", "Database", ATRACE_TAG_DATABASE, { } },
+ { k_coreServiceCategory, "Core services", 0, { } },
{ "sched", "CPU Scheduling", 0, {
{ REQ, "/sys/kernel/debug/tracing/events/sched/sched_switch/enable" },
{ REQ, "/sys/kernel/debug/tracing/events/sched/sched_wakeup/enable" },
@@ -331,6 +334,12 @@
// or /sys/ files.
static bool isCategorySupported(const TracingCategory& category)
{
+ if (strcmp(category.name, k_coreServiceCategory) == 0) {
+ char value[PROPERTY_VALUE_MAX];
+ property_get(k_coreServicesProp, value, "");
+ return strlen(value) != 0;
+ }
+
bool ok = category.tags != 0;
for (int i = 0; i < MAX_SYS_FILES; i++) {
const char* path = category.sysfiles[i].path;
@@ -727,7 +736,24 @@
}
}
ok &= setTagsProperty(tags);
- ok &= setAppCmdlineProperty(g_debugAppCmdLine);
+
+ bool coreServicesTagEnabled = false;
+ for (int i = 0; i < NELEM(k_categories); i++) {
+ if (strcmp(k_categories[i].name, k_coreServiceCategory) == 0) {
+ coreServicesTagEnabled = g_categoryEnables[i];
+ }
+ }
+
+ std::string packageList(g_debugAppCmdLine);
+ if (coreServicesTagEnabled) {
+ char value[PROPERTY_VALUE_MAX];
+ property_get(k_coreServicesProp, value, "");
+ if (!packageList.empty()) {
+ packageList += ",";
+ }
+ packageList += value;
+ }
+ ok &= setAppCmdlineProperty(packageList.data());
ok &= pokeBinderServices();
// Disable all the sysfs enables. This is done as a separate loop from
diff --git a/cmds/bugreportz/bugreportz.cpp b/cmds/bugreportz/bugreportz.cpp
index 19d2d64..312dceb 100644
--- a/cmds/bugreportz/bugreportz.cpp
+++ b/cmds/bugreportz/bugreportz.cpp
@@ -80,8 +80,8 @@
}
if (s == -1) {
- printf("Failed to connect to dumpstatez service: %s\n", strerror(errno));
- return EXIT_FAILURE;
+ printf("FAIL:Failed to connect to dumpstatez service: %s\n", strerror(errno));
+ return EXIT_SUCCESS;
}
// Set a timeout so that if nothing is read in 10 minutes, we'll stop
@@ -91,7 +91,7 @@
tv.tv_sec = 10 * 60;
tv.tv_usec = 0;
if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) {
- printf("WARNING: Cannot set socket timeout: %s\n", strerror(errno));
+ fprintf(stderr, "WARNING: Cannot set socket timeout: %s\n", strerror(errno));
}
while (1) {
@@ -105,8 +105,7 @@
if (errno == EAGAIN) {
errno = ETIMEDOUT;
}
- printf("\nBugreport read terminated abnormally (%s).\n",
- strerror(errno));
+ printf("FAIL:Bugreport read terminated abnormally (%s)\n", strerror(errno));
break;
}
@@ -117,15 +116,17 @@
write(STDOUT_FILENO, buffer + bytes_read - bytes_to_send,
bytes_to_send));
if (bytes_written == -1) {
- printf(
+ fprintf(stderr,
"Failed to write data to stdout: read %zd, trying to send %zd (%s)\n",
bytes_read, bytes_to_send, strerror(errno));
- return EXIT_FAILURE;
+ break;
}
bytes_to_send -= bytes_written;
} while (bytes_written != 0 && bytes_to_send > 0);
}
- close(s);
+ if (close(s) == -1) {
+ fprintf(stderr, "WARNING: error closing socket: %s\n", strerror(errno));
+ }
return EXIT_SUCCESS;
}
diff --git a/cmds/dumpstate/bugreport-format.md b/cmds/dumpstate/bugreport-format.md
index d7837ae..ca7d574 100644
--- a/cmds/dumpstate/bugreport-format.md
+++ b/cmds/dumpstate/bugreport-format.md
@@ -15,13 +15,13 @@
format _YYYY-MM-DD-HH-MM-SS_), and Shell simply propagates it as an attachment
in the `ACTION_SEND_MULTIPLE` intent.
-## Version v0 (Android M)
+## Version 0 (Android M)
On _Android M (Marshmallow)_, dumpstate still generates a flat
_bugreport-DATE.txt_ file, but then **Shell** creates a zip file called
_bugreport-DATE.zip_ containing a _bugreport-DATE.txt_ entry and sends that
file as the `ACTION_SEND_MULTIPLE` attachment.
-## Version v1 (Android N)
+## Version 1.0 (Android N)
On _Android N (TBD)_, `dumpstate` generates a zip file directly (unless there
is a failure, in which case it reverts to the flat file that is zipped by
**Shell** and hence the end result is the _v0_ format).
@@ -33,7 +33,7 @@
The zip file also contains 2 metadata entries generated by `dumpstate`:
-- `version.txt`: whose value is **v1**.
+- `version.txt`: whose value is **1.0**.
- `main-entry.txt`: whose value is the name of the flat text entry (i.e.,
_bugreport-BUILD_ID-DATE.txt_ or _bugreport-NEW_NAME.txt_).
@@ -61,16 +61,16 @@
changes become stable.
For example, the initial version during _Android N_ development was
-**v1-dev1**. When `dumpsys` was split in 2 sections but not all tools were
-ready to parse that format, the version was named **v1-dev2**,
+**1.0-dev1**. When `dumpsys` was split in 2 sections but not all tools were
+ready to parse that format, the version was named **1.0-dev2**,
which had to be passed do `dumpsys` explicitly (i.e., trhough a
-`-V v1-dev2` argument). Once that format became stable and tools
-knew how to parse it, the default version became **v1-dev2**.
+`-V 1.0-dev2` argument). Once that format became stable and tools
+knew how to parse it, the default version became **1.0-dev2**.
Similarly, if changes in the file format are made after the initial release of
Android defining that format, then a new _sub-version_ will be used.
For example, if after _Android N_ launches changes are made for the next _N_
-release, the version will be called **v1.1** or something like that.
+release, the version will be called **1.1** or something like that.
Determining version and main entry
-----------------------------------------------
@@ -83,7 +83,7 @@
version = read("version.txt")
main_entry = read("main_entry.txt")
else
- version = v0
+ version = 0
main_entry = entries[0]
fi
```
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index b731c53..cd7c4aa 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -61,9 +61,10 @@
static std::unique_ptr<ZipWriter> zip_writer;
static std::set<std::string> mount_points;
void add_mountinfo();
-static bool add_zip_entry(const std::string& entry_name, const std::string& entry_path);
-static bool add_zip_entry_from_fd(const std::string& entry_name, int fd);
static int control_socket_fd;
+/* suffix of the bugreport files - it's typically the date (when invoked with -d),
+ * although it could be changed by the user using a system property */
+static std::string suffix;
#define PSTORE_LAST_KMSG "/sys/fs/pstore/console-ramoops"
@@ -71,11 +72,14 @@
#define RECOVERY_DIR "/cache/recovery"
#define RECOVERY_DATA_DIR "/data/misc/recovery"
#define LOGPERSIST_DATA_DIR "/data/misc/logd"
+#define PROFILE_DATA_DIR_CUR "/data/misc/profiles/cur"
+#define PROFILE_DATA_DIR_REF "/data/misc/profiles/ref"
#define TOMBSTONE_DIR "/data/tombstones"
#define TOMBSTONE_FILE_PREFIX TOMBSTONE_DIR "/tombstone_"
/* Can accomodate a tombstone number up to 9999. */
#define TOMBSTONE_MAX_LEN (sizeof(TOMBSTONE_FILE_PREFIX) + 4)
#define NUM_TOMBSTONES 10
+#define WLUTIL "/vendor/xbin/wlutil"
typedef struct {
char name[TOMBSTONE_MAX_LEN];
@@ -84,18 +88,17 @@
static tombstone_data_t tombstone_data[NUM_TOMBSTONES];
-// Root dir for all files copied as-is into the bugreport
-const std::string& ZIP_ROOT_DIR = "FS";
+const std::string ZIP_ROOT_DIR = "FS";
+std::string bugreport_dir;
/*
* List of supported zip format versions.
*
* See bugreport-format.txt for more info.
*/
-// TODO: change to "v1" before final N build
-static std::string VERSION_DEFAULT = "v1-dev4";
+static std::string VERSION_DEFAULT = "1.0";
-static bool is_user_build() {
+bool is_user_build() {
return 0 == strncmp(build_type, "user", PROPERTY_VALUE_MAX - 1);
}
@@ -124,7 +127,7 @@
// Gets the the content of the /proc/PID/ns/mnt link, so only unique mount points
// are added.
- sprintf(path, "/proc/%d/ns/mnt", pid);
+ snprintf(path, sizeof(path), "/proc/%d/ns/mnt", pid);
char linkname[PATH_MAX];
ssize_t r = readlink(path, linkname, PATH_MAX);
if (r == -1) {
@@ -135,7 +138,7 @@
if (mount_points.find(linkname) == mount_points.end()) {
// First time this mount point was found: add it
- sprintf(path, "/proc/%d/mountinfo", pid);
+ snprintf(path, sizeof(path), "/proc/%d/mountinfo", pid);
if (add_zip_entry(ZIP_ROOT_DIR + path, path)) {
mount_points.insert(linkname);
} else {
@@ -175,11 +178,12 @@
closedir(d);
}
-static void dump_systrace(const std::string& systrace_path) {
+static void dump_systrace() {
if (!zip_writer) {
MYLOGD("Not dumping systrace because zip_writer is not set\n");
return;
}
+ std::string systrace_path = bugreport_dir + "/systrace-" + suffix + ".txt";
if (systrace_path.empty()) {
MYLOGE("Not dumping systrace because path is empty\n");
return;
@@ -527,8 +531,7 @@
printf("\n");
}
-/* adds a new entry to the existing zip file. */
-static bool add_zip_entry_from_fd(const std::string& entry_name, int fd) {
+bool add_zip_entry_from_fd(const std::string& entry_name, int fd) {
if (!zip_writer) {
MYLOGD("Not adding zip entry %s from fd because zip_writer is not set\n",
entry_name.c_str());
@@ -569,8 +572,7 @@
return true;
}
-/* adds a new entry to the existing zip file. */
-static bool add_zip_entry(const std::string& entry_name, const std::string& entry_path) {
+bool add_zip_entry(const std::string& entry_name, const std::string& entry_path) {
ScopedFd fd(TEMP_FAILURE_RETRY(open(entry_path.c_str(), O_RDONLY | O_NONBLOCK | O_CLOEXEC)));
if (fd.get() == -1) {
MYLOGE("open(%s): %s\n", entry_path.c_str(), strerror(errno));
@@ -585,7 +587,6 @@
return add_zip_entry_from_fd(ZIP_ROOT_DIR + path, fd) ? 0 : 1;
}
-/* adds all files from a directory to the zipped bugreport file */
void add_dir(const char *dir, bool recursive) {
if (!zip_writer) {
MYLOGD("Not adding dir %s because zip_writer is not set\n", dir);
@@ -798,6 +799,7 @@
run_command("ARP CACHE", 10, "ip", "-4", "neigh", "show", NULL);
run_command("IPv6 ND CACHE", 10, "ip", "-6", "neigh", "show", NULL);
+ run_command("MULTICAST ADDRESSES", 10, "ip", "maddr", NULL);
run_command("IPTABLES", 10, SU_PATH, "root", "iptables", "-L", "-nvx", NULL);
run_command("IP6TABLES", 10, SU_PATH, "root", "ip6tables", "-L", "-nvx", NULL);
@@ -811,28 +813,28 @@
#ifdef FWDUMP_bcmdhd
run_command("ND OFFLOAD TABLE", 5,
- SU_PATH, "root", "wlutil", "nd_hostip", NULL);
+ SU_PATH, "root", WLUTIL, "nd_hostip", NULL);
run_command("DUMP WIFI INTERNAL COUNTERS (1)", 20,
- SU_PATH, "root", "wlutil", "counters", NULL);
+ SU_PATH, "root", WLUTIL, "counters", NULL);
run_command("ND OFFLOAD STATUS (1)", 5,
- SU_PATH, "root", "wlutil", "nd_status", NULL);
+ SU_PATH, "root", WLUTIL, "nd_status", NULL);
#endif
dump_file("INTERRUPTS (1)", "/proc/interrupts");
- run_command("NETWORK DIAGNOSTICS", 10, "dumpsys", "connectivity", "--diag", NULL);
+ run_command("NETWORK DIAGNOSTICS", 10, "dumpsys", "-t", "10", "connectivity", "--diag", NULL);
#ifdef FWDUMP_bcmdhd
run_command("DUMP WIFI STATUS", 20,
SU_PATH, "root", "dhdutil", "-i", "wlan0", "dump", NULL);
run_command("DUMP WIFI INTERNAL COUNTERS (2)", 20,
- SU_PATH, "root", "wlutil", "counters", NULL);
+ SU_PATH, "root", WLUTIL, "counters", NULL);
run_command("ND OFFLOAD STATUS (2)", 5,
- SU_PATH, "root", "wlutil", "nd_status", NULL);
+ SU_PATH, "root", WLUTIL, "nd_status", NULL);
#endif
dump_file("INTERRUPTS (2)", "/proc/interrupts");
@@ -892,36 +894,36 @@
printf("== Android Framework Services\n");
printf("========================================================\n");
- run_command("DUMPSYS", 60, "dumpsys", "-t", "60", "--skip", "meminfo,cpuinfo", NULL);
+ run_command("DUMPSYS", 60, "dumpsys", "-t", "60", "--skip", "meminfo", "cpuinfo", NULL);
printf("========================================================\n");
printf("== Checkins\n");
printf("========================================================\n");
- run_command("CHECKIN BATTERYSTATS", 30, "dumpsys", "batterystats", "-c", NULL);
- run_command("CHECKIN MEMINFO", 30, "dumpsys", "meminfo", "--checkin", NULL);
- run_command("CHECKIN NETSTATS", 30, "dumpsys", "netstats", "--checkin", NULL);
- run_command("CHECKIN PROCSTATS", 30, "dumpsys", "procstats", "-c", NULL);
- run_command("CHECKIN USAGESTATS", 30, "dumpsys", "usagestats", "-c", NULL);
- run_command("CHECKIN PACKAGE", 30, "dumpsys", "package", "--checkin", NULL);
+ run_command("CHECKIN BATTERYSTATS", 30, "dumpsys", "-t", "30", "batterystats", "-c", NULL);
+ run_command("CHECKIN MEMINFO", 30, "dumpsys", "-t", "30", "meminfo", "--checkin", NULL);
+ run_command("CHECKIN NETSTATS", 30, "dumpsys", "-t", "30", "netstats", "--checkin", NULL);
+ run_command("CHECKIN PROCSTATS", 30, "dumpsys", "-t", "30", "procstats", "-c", NULL);
+ run_command("CHECKIN USAGESTATS", 30, "dumpsys", "-t", "30", "usagestats", "-c", NULL);
+ run_command("CHECKIN PACKAGE", 30, "dumpsys", "-t", "30", "package", "--checkin", NULL);
printf("========================================================\n");
printf("== Running Application Activities\n");
printf("========================================================\n");
- run_command("APP ACTIVITIES", 30, "dumpsys", "activity", "all", NULL);
+ run_command("APP ACTIVITIES", 30, "dumpsys", "-t", "30", "activity", "all", NULL);
printf("========================================================\n");
printf("== Running Application Services\n");
printf("========================================================\n");
- run_command("APP SERVICES", 30, "dumpsys", "activity", "service", "all", NULL);
+ run_command("APP SERVICES", 30, "dumpsys", "-t", "30", "activity", "service", "all", NULL);
printf("========================================================\n");
printf("== Running Application Providers\n");
printf("========================================================\n");
- run_command("APP SERVICES", 30, "dumpsys", "activity", "provider", "all", NULL);
+ run_command("APP SERVICES", 30, "dumpsys", "-t", "30", "activity", "provider", "all", NULL);
printf("========================================================\n");
@@ -1048,7 +1050,7 @@
char last_id[PROPERTY_VALUE_MAX];
property_get("dumpstate.last_id", last_id, "0");
id = strtoul(last_id, NULL, 10) + 1;
- sprintf(last_id, "%lu", id);
+ snprintf(last_id, sizeof(last_id), "%lu", id);
property_set("dumpstate.last_id", last_id);
MYLOGI("dumpstate id: %lu\n", id);
@@ -1131,9 +1133,6 @@
control_socket_fd = open_socket("dumpstate");
}
- /* full path of the directory where the bugreport files will be written */
- std::string bugreport_dir;
-
/* full path of the temporary file containing the bugreport */
std::string tmp_path;
@@ -1149,10 +1148,6 @@
/* base name (without suffix or extensions) of the bugreport files */
std::string base_name;
- /* suffix of the bugreport files - it's typically the date (when invoked with -d),
- * although it could be changed by the user using a system property */
- std::string suffix;
-
/* pointer to the actual path, be it zip or text */
std::string path;
@@ -1184,7 +1179,6 @@
tmp_path = bugreport_dir + "/" + base_name + "-" + suffix + ".tmp";
log_path = bugreport_dir + "/dumpstate_log-" + suffix + "-"
+ std::to_string(getpid()) + ".txt";
- systrace_path = bugreport_dir + "/systrace-" + suffix + ".txt";
MYLOGD("Bugreport dir: %s\n"
"Base name: %s\n"
@@ -1279,12 +1273,12 @@
print_header(version);
// Dumps systrace right away, otherwise it will be filled with unnecessary events.
- dump_systrace(systrace_path);
+ dump_systrace();
// Invoking the following dumpsys calls before dump_traces() to try and
// keep the system stats as close to its initial state as possible.
run_command_as_shell("DUMPSYS MEMINFO", 30, "dumpsys", "-t", "30", "meminfo", "-a", NULL);
- run_command_as_shell("DUMPSYS CPUINFO", 10, "dumpsys", "cpuinfo", "-a", NULL);
+ run_command_as_shell("DUMPSYS CPUINFO", 10, "dumpsys", "-t", "10", "cpuinfo", "-a", NULL);
/* collect stack traces from Dalvik and native processes (needs root) */
dump_traces_path = dump_traces();
@@ -1294,6 +1288,10 @@
add_dir(RECOVERY_DIR, true);
add_dir(RECOVERY_DATA_DIR, true);
add_dir(LOGPERSIST_DATA_DIR, false);
+ if (!is_user_build()) {
+ add_dir(PROFILE_DATA_DIR_CUR, true);
+ add_dir(PROFILE_DATA_DIR_REF, true);
+ }
add_mountinfo();
if (!drop_root_user()) {
@@ -1313,7 +1311,7 @@
/* check if user changed the suffix using system properties */
char key[PROPERTY_KEY_MAX];
char value[PROPERTY_VALUE_MAX];
- sprintf(key, "dumpstate.%d.name", getpid());
+ snprintf(key, sizeof(key), "dumpstate.%d.name", getpid());
property_get(key, value, "");
bool change_suffix= false;
if (value[0]) {
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index c51c79a..4769974 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -81,6 +81,21 @@
* idioms (like using std::string instead of char*, removing varargs, etc...) */
extern int do_update_progress, progress, weight_total;
+/* full path of the directory where the bugreport files will be written */
+extern std::string bugreport_dir;
+
+/* root dir for all files copied as-is into the bugreport. */
+extern const std::string ZIP_ROOT_DIR;
+
+/* adds a new entry to the existing zip file. */
+bool add_zip_entry(const std::string& entry_name, const std::string& entry_path);
+
+/* adds a new entry to the existing zip file. */
+bool add_zip_entry_from_fd(const std::string& entry_name, int fd);
+
+/* adds all files from a directory to the zipped bugreport file */
+void add_dir(const char *dir, bool recursive);
+
/* prints the contents of a file */
int dump_file(const char *title, const char *path);
@@ -184,12 +199,15 @@
/** Gets the last modification time of a file, or default time if file is not found. */
time_t get_mtime(int fd, time_t default_mtime);
-/* dump eMMC Extended CSD data */
+/* Dumps eMMC Extended CSD data. */
void dump_emmc_ecsd(const char *ext_csd_path);
-/** gets command-line arguments */
+/** Gets command-line arguments. */
void format_args(int argc, const char *argv[], std::string *args);
+/** Tells if the device is running a user build. */
+bool is_user_build();
+
/*
* Helper class used to report how long it takes for a section to finish.
*
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index f1a1ed6..09c2e7f 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -188,7 +188,7 @@
char taskpath[255];
for_each_tid_func *func = (for_each_tid_func *) arg;
- sprintf(taskpath, "/proc/%d/task", pid);
+ snprintf(taskpath, sizeof(taskpath), "/proc/%d/task", pid);
if (!(d = opendir(taskpath))) {
printf("Failed to open %s (%s)\n", taskpath, strerror(errno));
@@ -210,7 +210,7 @@
if (tid == pid)
continue;
- sprintf(commpath,"/proc/%d/comm", tid);
+ snprintf(commpath, sizeof(commpath), "/proc/%d/comm", tid);
memset(comm, 0, sizeof(comm));
if ((fd = TEMP_FAILURE_RETRY(open(commpath, O_RDONLY | O_CLOEXEC))) < 0) {
strcpy(comm, "N/A");
@@ -244,7 +244,7 @@
memset(buffer, 0, sizeof(buffer));
- sprintf(path, "/proc/%d/wchan", tid);
+ snprintf(path, sizeof(path), "/proc/%d/wchan", tid);
if ((fd = TEMP_FAILURE_RETRY(open(path, O_RDONLY | O_CLOEXEC))) < 0) {
printf("Failed to open '%s' (%s)\n", path, strerror(errno));
return;
@@ -309,7 +309,7 @@
memset(buffer, 0, sizeof(buffer));
- sprintf(path, "/proc/%d/stat", pid);
+ snprintf(path, sizeof(path), "/proc/%d/stat", pid);
if ((fd = TEMP_FAILURE_RETRY(open(path, O_RDONLY | O_CLOEXEC))) < 0) {
printf("Failed to open '%s' (%s)\n", path, strerror(errno));
return;
@@ -397,8 +397,8 @@
char title[255];
char arg[255];
- sprintf(title, "SHOW MAP %d (%s)", pid, name);
- sprintf(arg, "%d", pid);
+ snprintf(title, sizeof(title), "SHOW MAP %d (%s)", pid, name);
+ snprintf(arg, sizeof(arg), "%d", pid);
run_command(title, 10, SU_PATH, "root", "showmap", "-q", arg, NULL);
}
@@ -1191,8 +1191,8 @@
int new_total = weight_total * 1.2;
MYLOGD("Adjusting total weight from %d to %d\n", weight_total, new_total);
weight_total = new_total;
- sprintf(key, "dumpstate.%d.max", getpid());
- sprintf(value, "%d", weight_total);
+ snprintf(key, sizeof(key), "dumpstate.%d.max", getpid());
+ snprintf(value, sizeof(value), "%d", weight_total);
int status = property_set(key, value);
if (status) {
MYLOGE("Could not update max weight by setting system property %s to %s: %d\n",
@@ -1200,8 +1200,8 @@
}
}
- sprintf(key, "dumpstate.%d.progress", getpid());
- sprintf(value, "%d", progress);
+ snprintf(key, sizeof(key), "dumpstate.%d.progress", getpid());
+ snprintf(value, sizeof(value), "%d", progress);
if (progress % 100 == 0) {
// We don't want to spam logcat, so only log multiples of 100.
diff --git a/cmds/installd/commands.cpp b/cmds/installd/commands.cpp
index 90ef277..2a9950a 100644
--- a/cmds/installd/commands.cpp
+++ b/cmds/installd/commands.cpp
@@ -29,6 +29,7 @@
#include <unistd.h>
#include <android-base/stringprintf.h>
+#include <android-base/strings.h>
#include <android-base/logging.h>
#include <android-base/unique_fd.h>
#include <cutils/fs.h>
@@ -69,6 +70,12 @@
return strcmp(tmp_property_value, "true") == 0;
}
+// Keep profile paths in sync with ActivityThread.
+constexpr const char* PRIMARY_PROFILE_NAME = "primary.prof";
+static std::string create_primary_profile(const std::string& profile_dir) {
+ return StringPrintf("%s/%s", profile_dir.c_str(), PRIMARY_PROFILE_NAME);
+}
+
int create_app_data(const char *uuid, const char *pkgname, userid_t userid, int flags,
appid_t appid, const char* seinfo, int target_sdk_version) {
uid_t uid = multiuser_get_uid(userid, appid);
@@ -104,6 +111,12 @@
PLOG(ERROR) << "Failed to prepare " << profile_path;
return -1;
}
+ std::string profile_file = create_primary_profile(profile_path);
+ // read-write only for the app user.
+ if (fs_prepare_file_strict(profile_file.c_str(), 0600, uid, uid) != 0) {
+ PLOG(ERROR) << "Failed to prepare " << profile_path;
+ return -1;
+ }
const std::string ref_profile_path = create_data_ref_profile_package_path(pkgname);
// dex2oat/profman runs under the shared app gid and it needs to read/write reference
// profiles.
@@ -156,12 +169,6 @@
return 0;
}
-// Keep profile paths in sync with ActivityThread.
-constexpr const char* PRIMARY_PROFILE_NAME = "primary.prof";
-static std::string create_primary_profile(const std::string& profile_dir) {
- return StringPrintf("%s/%s", profile_dir.c_str(), PRIMARY_PROFILE_NAME);
-}
-
static bool clear_profile(const std::string& profile) {
base::unique_fd ufd(open(profile.c_str(), O_WRONLY | O_NOFOLLOW | O_CLOEXEC));
if (ufd.get() < 0) {
@@ -315,9 +322,9 @@
// Copy app
{
- std::string from(create_data_app_package_path(from_uuid, data_app_name));
- std::string to(create_data_app_package_path(to_uuid, data_app_name));
- std::string to_parent(create_data_app_path(to_uuid));
+ auto from = create_data_app_package_path(from_uuid, data_app_name);
+ auto to = create_data_app_package_path(to_uuid, data_app_name);
+ auto to_parent = create_data_app_path(to_uuid);
char *argv[] = {
(char*) kCpPath,
@@ -346,27 +353,18 @@
}
// Copy private data for all known users
- // TODO: handle user_de paths
for (auto user : users) {
- std::string from(create_data_user_ce_package_path(from_uuid, user, package_name));
- std::string to(create_data_user_ce_package_path(to_uuid, user, package_name));
- std::string to_parent(create_data_user_ce_path(to_uuid, user));
// Data source may not exist for all users; that's okay
- if (access(from.c_str(), F_OK) != 0) {
- LOG(INFO) << "Missing source " << from;
+ auto from_ce = create_data_user_ce_package_path(from_uuid, user, package_name);
+ if (access(from_ce.c_str(), F_OK) != 0) {
+ LOG(INFO) << "Missing source " << from_ce;
continue;
}
- std::string user_path(create_data_user_ce_path(to_uuid, user));
- if (fs_prepare_dir(user_path.c_str(), 0771, AID_SYSTEM, AID_SYSTEM) != 0) {
- LOG(ERROR) << "Failed to prepare user target " << user_path;
- goto fail;
- }
-
if (create_app_data(to_uuid, package_name, user, FLAG_STORAGE_CE | FLAG_STORAGE_DE,
appid, seinfo, target_sdk_version) != 0) {
- LOG(ERROR) << "Failed to create package target " << to;
+ LOG(ERROR) << "Failed to create package target on " << to_uuid;
goto fail;
}
@@ -377,17 +375,35 @@
(char*) "-R", /* recurse into subdirectories (DEST must be a directory) */
(char*) "-P", /* Do not follow symlinks [default] */
(char*) "-d", /* don't dereference symlinks */
- (char*) from.c_str(),
- (char*) to_parent.c_str()
+ nullptr,
+ nullptr
};
- LOG(DEBUG) << "Copying " << from << " to " << to;
- int rc = android_fork_execvp(ARRAY_SIZE(argv), argv, NULL, false, true);
+ {
+ auto from = create_data_user_de_package_path(from_uuid, user, package_name);
+ auto to = create_data_user_de_path(to_uuid, user);
+ argv[6] = (char*) from.c_str();
+ argv[7] = (char*) to.c_str();
- if (rc != 0) {
- LOG(ERROR) << "Failed copying " << from << " to " << to
- << ": status " << rc;
- goto fail;
+ LOG(DEBUG) << "Copying " << from << " to " << to;
+ int rc = android_fork_execvp(ARRAY_SIZE(argv), argv, NULL, false, true);
+ if (rc != 0) {
+ LOG(ERROR) << "Failed copying " << from << " to " << to << " with status " << rc;
+ goto fail;
+ }
+ }
+ {
+ auto from = create_data_user_ce_package_path(from_uuid, user, package_name);
+ auto to = create_data_user_ce_path(to_uuid, user);
+ argv[6] = (char*) from.c_str();
+ argv[7] = (char*) to.c_str();
+
+ LOG(DEBUG) << "Copying " << from << " to " << to;
+ int rc = android_fork_execvp(ARRAY_SIZE(argv), argv, NULL, false, true);
+ if (rc != 0) {
+ LOG(ERROR) << "Failed copying " << from << " to " << to << " with status " << rc;
+ goto fail;
+ }
}
if (restorecon_app_data(to_uuid, package_name, user, FLAG_STORAGE_CE | FLAG_STORAGE_DE,
@@ -405,15 +421,23 @@
fail:
// Nuke everything we might have already copied
{
- std::string to(create_data_app_package_path(to_uuid, data_app_name));
+ auto to = create_data_app_package_path(to_uuid, data_app_name);
if (delete_dir_contents(to.c_str(), 1, NULL) != 0) {
LOG(WARNING) << "Failed to rollback " << to;
}
}
for (auto user : users) {
- std::string to(create_data_user_ce_package_path(to_uuid, user, package_name));
- if (delete_dir_contents(to.c_str(), 1, NULL) != 0) {
- LOG(WARNING) << "Failed to rollback " << to;
+ {
+ auto to = create_data_user_de_package_path(to_uuid, user, package_name);
+ if (delete_dir_contents(to.c_str(), 1, NULL) != 0) {
+ LOG(WARNING) << "Failed to rollback " << to;
+ }
+ }
+ {
+ auto to = create_data_user_ce_package_path(to_uuid, user, package_name);
+ if (delete_dir_contents(to.c_str(), 1, NULL) != 0) {
+ LOG(WARNING) << "Failed to rollback " << to;
+ }
}
}
return -1;
@@ -452,16 +476,11 @@
* also require that apps constantly modify file metadata even
* when just reading from the cache, which is pretty awful.
*/
-int free_cache(const char *uuid, int64_t free_size)
-{
+int free_cache(const char *uuid, int64_t free_size) {
cache_t* cache;
int64_t avail;
- DIR *d;
- struct dirent *de;
- char tmpdir[PATH_MAX];
- char *dirpos;
- std::string data_path(create_data_path(uuid));
+ auto data_path = create_data_path(uuid);
avail = data_disk_free(data_path);
if (avail < 0) return -1;
@@ -471,65 +490,12 @@
cache = start_cache_collection();
- // Special case for owner on internal storage
- if (uuid == nullptr) {
- std::string _tmpdir(create_data_user_ce_path(nullptr, 0));
- add_cache_files(cache, _tmpdir.c_str(), "cache");
- }
-
- // Search for other users and add any cache files from them.
- std::string _tmpdir(create_data_path(uuid) + "/" + SECONDARY_USER_PREFIX);
- strcpy(tmpdir, _tmpdir.c_str());
-
- dirpos = tmpdir + strlen(tmpdir);
- d = opendir(tmpdir);
- if (d != NULL) {
- while ((de = readdir(d))) {
- if (de->d_type == DT_DIR) {
- const char *name = de->d_name;
- /* always skip "." and ".." */
- if (name[0] == '.') {
- if (name[1] == 0) continue;
- if ((name[1] == '.') && (name[2] == 0)) continue;
- }
- if ((strlen(name)+(dirpos-tmpdir)) < (sizeof(tmpdir)-1)) {
- strcpy(dirpos, name);
- //ALOGI("adding cache files from %s\n", tmpdir);
- add_cache_files(cache, tmpdir, "cache");
- } else {
- ALOGW("Path exceeds limit: %s%s", tmpdir, name);
- }
- }
- }
- closedir(d);
- }
-
- // Collect cache files on external storage for all users (if it is mounted as part
- // of the internal storage).
- strcpy(tmpdir, android_media_dir.path);
- dirpos = tmpdir + strlen(tmpdir);
- d = opendir(tmpdir);
- if (d != NULL) {
- while ((de = readdir(d))) {
- if (de->d_type == DT_DIR) {
- const char *name = de->d_name;
- /* skip any dir that doesn't start with a number, so not a user */
- if (name[0] < '0' || name[0] > '9') {
- continue;
- }
- if ((strlen(name)+(dirpos-tmpdir)) < (sizeof(tmpdir)-1)) {
- strcpy(dirpos, name);
- if (lookup_media_dir(tmpdir, "Android") == 0
- && lookup_media_dir(tmpdir, "data") == 0) {
- //ALOGI("adding cache files from %s\n", tmpdir);
- add_cache_files(cache, tmpdir, "cache");
- }
- } else {
- ALOGW("Path exceeds limit: %s%s", tmpdir, name);
- }
- }
- }
- closedir(d);
+ auto users = get_known_users(uuid);
+ for (auto user : users) {
+ add_cache_files(cache, create_data_user_ce_path(uuid, user));
+ add_cache_files(cache, create_data_user_de_path(uuid, user));
+ add_cache_files(cache,
+ StringPrintf("%s/Android/data", create_data_media_path(uuid, user).c_str()));
}
clear_cache_files(data_path, cache, free_size);
@@ -1126,7 +1092,7 @@
static constexpr int PROFMAN_BIN_RETURN_CODE_ERROR_IO = 3;
static constexpr int PROFMAN_BIN_RETURN_CODE_ERROR_LOCKING = 4;
-static void run_profman(const std::vector<fd_t>& profiles_fd, fd_t reference_profile_fd) {
+static void run_profman_merge(const std::vector<fd_t>& profiles_fd, fd_t reference_profile_fd) {
static const size_t MAX_INT_LEN = 32;
static const char* PROFMAN_BIN = "/system/bin/profman";
@@ -1174,13 +1140,13 @@
return false;
}
- ALOGV("PROFMAN: --- BEGIN '%s' ---\n", pkgname);
+ ALOGV("PROFMAN (MERGE): --- BEGIN '%s' ---\n", pkgname);
pid_t pid = fork();
if (pid == 0) {
/* child -- drop privileges before continuing */
drop_capabilities(uid);
- run_profman(profiles_fd, reference_profile_fd);
+ run_profman_merge(profiles_fd, reference_profile_fd);
exit(68); /* only get here on exec failure */
}
/* parent */
@@ -1240,6 +1206,113 @@
return need_to_compile;
}
+static void run_profman_dump(const std::vector<fd_t>& profile_fds,
+ fd_t reference_profile_fd,
+ const std::vector<std::string>& dex_locations,
+ const std::vector<fd_t>& apk_fds,
+ fd_t output_fd) {
+ std::vector<std::string> profman_args;
+ static const char* PROFMAN_BIN = "/system/bin/profman";
+ profman_args.push_back(PROFMAN_BIN);
+ profman_args.push_back("--dump-only");
+ profman_args.push_back(StringPrintf("--dump-output-to-fd=%d", output_fd));
+ if (reference_profile_fd != -1) {
+ profman_args.push_back(StringPrintf("--reference-profile-file-fd=%d",
+ reference_profile_fd));
+ }
+ for (fd_t profile_fd : profile_fds) {
+ profman_args.push_back(StringPrintf("--profile-file-fd=%d", profile_fd));
+ }
+ for (const std::string& dex_location : dex_locations) {
+ profman_args.push_back(StringPrintf("--dex-location=%s", dex_location.c_str()));
+ }
+ for (fd_t apk_fd : apk_fds) {
+ profman_args.push_back(StringPrintf("--apk-fd=%d", apk_fd));
+ }
+ const char **argv = new const char*[profman_args.size() + 1];
+ size_t i = 0;
+ for (const std::string& profman_arg : profman_args) {
+ argv[i++] = profman_arg.c_str();
+ }
+ argv[i] = NULL;
+
+ execv(PROFMAN_BIN, (char * const *)argv);
+ ALOGE("execv(%s) failed: %s\n", PROFMAN_BIN, strerror(errno));
+ exit(68); /* only get here on exec failure */
+}
+
+static const char* get_location_from_path(const char* path) {
+ static constexpr char kLocationSeparator = '/';
+ const char *location = strrchr(path, kLocationSeparator);
+ if (location == NULL) {
+ return path;
+ } else {
+ // Skip the separator character.
+ return location + 1;
+ }
+}
+
+// Dumps the contents of a profile file, using pkgname's dex files for pretty
+// printing the result.
+bool dump_profile(uid_t uid, const char* pkgname, const char* code_path_string) {
+ std::vector<fd_t> profile_fds;
+ fd_t reference_profile_fd = -1;
+ std::string out_file_name = StringPrintf("/data/misc/profman/%s.txt", pkgname);
+
+ ALOGV("PROFMAN (DUMP): --- BEGIN '%s' ---\n", pkgname);
+
+ open_profile_files(uid, pkgname, &profile_fds, &reference_profile_fd);
+
+ const bool has_reference_profile = (reference_profile_fd != -1);
+ const bool has_profiles = !profile_fds.empty();
+
+ if (!has_reference_profile && !has_profiles) {
+ ALOGE("profman dump: no profiles to dump for '%s'", pkgname);
+ return false;
+ }
+
+ fd_t output_fd = open(out_file_name.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW);
+ if (fchmod(output_fd, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) {
+ ALOGE("installd cannot chmod '%s' dump_profile\n", out_file_name.c_str());
+ return false;
+ }
+ std::vector<std::string> code_full_paths = base::Split(code_path_string, ";");
+ std::vector<std::string> dex_locations;
+ std::vector<fd_t> apk_fds;
+ for (const std::string& code_full_path : code_full_paths) {
+ const char* full_path = code_full_path.c_str();
+ fd_t apk_fd = open(full_path, O_RDONLY | O_NOFOLLOW);
+ if (apk_fd == -1) {
+ ALOGE("installd cannot open '%s'\n", full_path);
+ return false;
+ }
+ dex_locations.push_back(get_location_from_path(full_path));
+ apk_fds.push_back(apk_fd);
+ }
+
+ pid_t pid = fork();
+ if (pid == 0) {
+ /* child -- drop privileges before continuing */
+ drop_capabilities(uid);
+ run_profman_dump(profile_fds, reference_profile_fd, dex_locations,
+ apk_fds, output_fd);
+ exit(68); /* only get here on exec failure */
+ }
+ /* parent */
+ close_all_fds(apk_fds, "apk_fds");
+ close_all_fds(profile_fds, "profile_fds");
+ if (close(reference_profile_fd) != 0) {
+ PLOG(WARNING) << "Failed to close fd for reference profile";
+ }
+ int return_code = wait_child(pid);
+ if (!WIFEXITED(return_code)) {
+ LOG(WARNING) << "profman failed for package " << pkgname << ": "
+ << return_code;
+ return false;
+ }
+ return true;
+}
+
static void trim_extension(char* path) {
// Trim the extension.
int pos = strlen(path);
@@ -1461,12 +1534,7 @@
run_patchoat(input_fd, out_fd, input_file, out_path, pkgname, instruction_set);
} else if (dexopt_needed == DEXOPT_DEX2OAT_NEEDED) {
// Pass dex2oat the relative path to the input file.
- const char *input_file_name = strrchr(input_file, '/');
- if (input_file_name == NULL) {
- input_file_name = input_file;
- } else {
- input_file_name++;
- }
+ const char *input_file_name = get_location_from_path(input_file);
run_dex2oat(input_fd, out_fd, image_fd, input_file_name, out_path, swap_fd,
instruction_set, compiler_filter, vm_safe_mode, debuggable, boot_complete,
reference_profile_fd, shared_libraries);
diff --git a/cmds/installd/commands.h b/cmds/installd/commands.h
index 41cc209..7a42c5c 100644
--- a/cmds/installd/commands.h
+++ b/cmds/installd/commands.h
@@ -54,6 +54,8 @@
bool merge_profiles(uid_t uid, const char *pkgname);
+bool dump_profile(uid_t uid, const char *pkgname, const char *dex_files);
+
int dexopt(const char *apk_path, uid_t uid, const char *pkgName, const char *instruction_set,
int dexopt_needed, const char* oat_dir, int dexopt_flags, const char* compiler_filter,
const char* volume_uuid, const char* shared_libraries);
diff --git a/cmds/installd/installd.cpp b/cmds/installd/installd.cpp
index e8fce91..061359e 100644
--- a/cmds/installd/installd.cpp
+++ b/cmds/installd/installd.cpp
@@ -282,6 +282,19 @@
return 0;
}
+static int do_dump_profiles(char **arg, char reply[REPLY_MAX])
+{
+ uid_t uid = static_cast<uid_t>(atoi(arg[0]));
+ const char* pkgname = arg[1];
+ const char* dex_files = arg[2];
+ if (dump_profile(uid, pkgname, dex_files)) {
+ strncpy(reply, "true", REPLY_MAX);
+ } else {
+ strncpy(reply, "false", REPLY_MAX);
+ }
+ return 0;
+}
+
static int do_mark_boot_complete(char **arg, char reply[REPLY_MAX] ATTRIBUTE_UNUSED)
{
return mark_boot_complete(arg[0] /* instruction set */);
@@ -428,6 +441,7 @@
{ "linkfile", 3, do_link_file },
{ "move_ab", 3, do_move_ab },
{ "merge_profiles", 2, do_merge_profiles },
+ { "dump_profiles", 3, do_dump_profiles },
};
static int readx(int s, void *_buf, int count)
diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp
index 90d2a9e..c838993 100644
--- a/cmds/installd/utils.cpp
+++ b/cmds/installd/utils.cpp
@@ -521,56 +521,6 @@
return res;
}
-int lookup_media_dir(char basepath[PATH_MAX], const char *dir)
-{
- DIR *d;
- struct dirent *de;
- struct stat s;
- char* dirpos = basepath + strlen(basepath);
-
- if ((*(dirpos-1)) != '/') {
- *dirpos = '/';
- dirpos++;
- }
-
- CACHE_NOISY(ALOGI("Looking up %s in %s\n", dir, basepath));
- // Verify the path won't extend beyond our buffer, to avoid
- // repeated checking later.
- if ((dirpos-basepath+strlen(dir)) >= (PATH_MAX-1)) {
- ALOGW("Path exceeds limit: %s%s", basepath, dir);
- return -1;
- }
-
- // First, can we find this directory with the case that is given?
- strcpy(dirpos, dir);
- if (stat(basepath, &s) >= 0) {
- CACHE_NOISY(ALOGI("Found direct: %s\n", basepath));
- return 0;
- }
-
- // Not found with that case... search through all entries to find
- // one that matches regardless of case.
- *dirpos = 0;
-
- d = opendir(basepath);
- if (d == NULL) {
- return -1;
- }
-
- while ((de = readdir(d))) {
- if (strcasecmp(de->d_name, dir) == 0) {
- strcpy(dirpos, de->d_name);
- closedir(d);
- CACHE_NOISY(ALOGI("Found search: %s\n", basepath));
- return 0;
- }
- }
-
- ALOGW("Couldn't find %s in %s", dir, basepath);
- closedir(d);
- return -1;
-}
-
int64_t data_disk_free(const std::string& data_path)
{
struct statfs sfs;
@@ -829,13 +779,13 @@
return 0;
}
-void add_cache_files(cache_t* cache, const char *basepath, const char *cachedir)
-{
+void add_cache_files(cache_t* cache, const std::string& data_path) {
DIR *d;
struct dirent *de;
char dirname[PATH_MAX];
- CACHE_NOISY(ALOGI("add_cache_files: base=%s cachedir=%s\n", basepath, cachedir));
+ const char* basepath = data_path.c_str();
+ CACHE_NOISY(ALOGI("add_cache_files: basepath=%s\n", basepath));
d = opendir(basepath);
if (d == NULL) {
@@ -861,12 +811,11 @@
pathpos++;
*pathpos = 0;
}
- if (cachedir != NULL) {
- snprintf(pathpos, sizeof(dirname)-(pathpos-dirname), "%s/%s", name, cachedir);
- } else {
- snprintf(pathpos, sizeof(dirname)-(pathpos-dirname), "%s", name);
- }
+
+ // TODO: also try searching using xattr when CE is locked
+ snprintf(pathpos, sizeof(dirname)-(pathpos-dirname), "%s/cache", name);
CACHE_NOISY(ALOGI("Adding cache files from dir: %s\n", dirname));
+
subdir = opendir(dirname);
if (subdir != NULL) {
size_t dirnameLen = strlen(dirname);
diff --git a/cmds/installd/utils.h b/cmds/installd/utils.h
index 477baea..60df356 100644
--- a/cmds/installd/utils.h
+++ b/cmds/installd/utils.h
@@ -114,13 +114,11 @@
int copy_dir_files(const char *srcname, const char *dstname, uid_t owner, gid_t group);
-int lookup_media_dir(char basepath[PATH_MAX], const char *dir);
-
int64_t data_disk_free(const std::string& data_path);
cache_t* start_cache_collection();
-void add_cache_files(cache_t* cache, const char *basepath, const char *cachedir);
+void add_cache_files(cache_t* cache, const std::string& data_path);
void clear_cache_files(const std::string& data_path, cache_t* cache, int64_t free_size);
diff --git a/cmds/servicemanager/binder.c b/cmds/servicemanager/binder.c
index 01218c9..27c461a 100644
--- a/cmds/servicemanager/binder.c
+++ b/cmds/servicemanager/binder.c
@@ -181,13 +181,18 @@
void binder_send_reply(struct binder_state *bs,
struct binder_io *reply,
+ binder_uintptr_t buffer_to_free,
int status)
{
struct {
+ uint32_t cmd_free;
+ binder_uintptr_t buffer;
uint32_t cmd_reply;
struct binder_transaction_data txn;
} __attribute__((packed)) data;
+ data.cmd_free = BC_FREE_BUFFER;
+ data.buffer = buffer_to_free;
data.cmd_reply = BC_REPLY;
data.txn.target.ptr = 0;
data.txn.cookie = 0;
@@ -250,9 +255,11 @@
bio_init(&reply, rdata, sizeof(rdata), 4);
bio_init_from_txn(&msg, txn);
res = func(bs, txn, &msg, &reply);
- binder_free_buffer(bs, txn->data.ptr.buffer);
- if ((txn->flags & TF_ONE_WAY) == 0)
- binder_send_reply(bs, &reply, res);
+ if (txn->flags & TF_ONE_WAY) {
+ binder_free_buffer(bs, txn->data.ptr.buffer);
+ } else {
+ binder_send_reply(bs, &reply, txn->data.ptr.buffer, res);
+ }
}
ptr += sizeof(*txn);
break;
diff --git a/docs/Doxyfile b/docs/Doxyfile
index 46d6d84..3ea453f 100644
--- a/docs/Doxyfile
+++ b/docs/Doxyfile
@@ -677,7 +677,7 @@
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
-INPUT = ../include/android
+INPUT = ../include/android ../../av/include/ndk ../../av/include/camera/ndk
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
diff --git a/docs/images/camera2/metadata/android.colorCorrection.mode/processing_pipeline.png b/docs/images/camera2/metadata/android.colorCorrection.mode/processing_pipeline.png
new file mode 100644
index 0000000..7578b48
--- /dev/null
+++ b/docs/images/camera2/metadata/android.colorCorrection.mode/processing_pipeline.png
Binary files differ
diff --git a/docs/images/camera2/metadata/android.statistics.lensShadingMap/blue_shading.png b/docs/images/camera2/metadata/android.statistics.lensShadingMap/blue_shading.png
new file mode 100644
index 0000000..7b10f6b
--- /dev/null
+++ b/docs/images/camera2/metadata/android.statistics.lensShadingMap/blue_shading.png
Binary files differ
diff --git a/docs/images/camera2/metadata/android.statistics.lensShadingMap/green_e_shading.png b/docs/images/camera2/metadata/android.statistics.lensShadingMap/green_e_shading.png
new file mode 100644
index 0000000..41972cf
--- /dev/null
+++ b/docs/images/camera2/metadata/android.statistics.lensShadingMap/green_e_shading.png
Binary files differ
diff --git a/docs/images/camera2/metadata/android.statistics.lensShadingMap/green_o_shading.png b/docs/images/camera2/metadata/android.statistics.lensShadingMap/green_o_shading.png
new file mode 100644
index 0000000..d26600b
--- /dev/null
+++ b/docs/images/camera2/metadata/android.statistics.lensShadingMap/green_o_shading.png
Binary files differ
diff --git a/docs/images/camera2/metadata/android.statistics.lensShadingMap/inv_shading.png b/docs/images/camera2/metadata/android.statistics.lensShadingMap/inv_shading.png
new file mode 100644
index 0000000..1e7208e
--- /dev/null
+++ b/docs/images/camera2/metadata/android.statistics.lensShadingMap/inv_shading.png
Binary files differ
diff --git a/docs/images/camera2/metadata/android.statistics.lensShadingMap/red_shading.png b/docs/images/camera2/metadata/android.statistics.lensShadingMap/red_shading.png
new file mode 100644
index 0000000..ecef3ae
--- /dev/null
+++ b/docs/images/camera2/metadata/android.statistics.lensShadingMap/red_shading.png
Binary files differ
diff --git a/docs/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png b/docs/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png
new file mode 100644
index 0000000..a02fd89
--- /dev/null
+++ b/docs/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png
Binary files differ
diff --git a/docs/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png b/docs/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png
new file mode 100644
index 0000000..c309ac5
--- /dev/null
+++ b/docs/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png
Binary files differ
diff --git a/docs/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png b/docs/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png
new file mode 100644
index 0000000..414fad4
--- /dev/null
+++ b/docs/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png
Binary files differ
diff --git a/docs/images/camera2/metadata/android.tonemap.curveRed/rec709_tonemap.png b/docs/images/camera2/metadata/android.tonemap.curveRed/rec709_tonemap.png
new file mode 100644
index 0000000..c147a87
--- /dev/null
+++ b/docs/images/camera2/metadata/android.tonemap.curveRed/rec709_tonemap.png
Binary files differ
diff --git a/docs/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png b/docs/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png
new file mode 100644
index 0000000..4ce2125
--- /dev/null
+++ b/docs/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png
Binary files differ
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
index 2685bcc..1c355c4 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -705,9 +705,9 @@
}
setDataPosition(start);
- val->reset(new std::vector<T>());
+ val->reset(new std::vector<std::unique_ptr<T>>());
- status = unsafeReadTypedVector(val->get(), &Parcel::readParcelable);
+ status = unsafeReadTypedVector(val->get(), &Parcel::readParcelable<T>);
if (status != OK) {
val->reset();
diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h
index 73f923c..312e02f 100644
--- a/include/gui/SurfaceComposerClient.h
+++ b/include/gui/SurfaceComposerClient.h
@@ -140,6 +140,8 @@
const sp<IBinder>& handle, uint64_t frameNumber);
status_t setOverrideScalingMode(const sp<IBinder>& id,
int32_t overrideScalingMode);
+ status_t setPositionAppliesWithResize(const sp<IBinder>& id);
+
status_t destroySurface(const sp<IBinder>& id);
status_t clearLayerFrameStats(const sp<IBinder>& token) const;
diff --git a/include/gui/SurfaceControl.h b/include/gui/SurfaceControl.h
index bedebb6..fafd194 100644
--- a/include/gui/SurfaceControl.h
+++ b/include/gui/SurfaceControl.h
@@ -73,6 +73,11 @@
status_t setCrop(const Rect& crop);
status_t setFinalCrop(const Rect& crop);
+ // If the size changes in this transaction, position updates specified
+ // in this transaction will not complete until a buffer of the new size
+ // arrives.
+ status_t setPositionAppliesWithResize();
+
// Defers applying any changes made in this transaction until the Layer
// identified by handle reaches the given frameNumber
status_t deferTransactionUntil(sp<IBinder> handle, uint64_t frameNumber);
diff --git a/include/media/openmax/OMX_AsString.h b/include/media/openmax/OMX_AsString.h
index 5fb8ca8..03801ca 100644
--- a/include/media/openmax/OMX_AsString.h
+++ b/include/media/openmax/OMX_AsString.h
@@ -98,6 +98,22 @@
}
}
+inline static const char *asString(OMX_AUDIO_AACPROFILETYPE i, const char *def = "??") {
+ switch (i) {
+ case OMX_AUDIO_AACObjectNull: return "Null";
+ case OMX_AUDIO_AACObjectMain: return "Main";
+ case OMX_AUDIO_AACObjectLC: return "LC";
+ case OMX_AUDIO_AACObjectSSR: return "SSR";
+ case OMX_AUDIO_AACObjectLTP: return "LTP";
+ case OMX_AUDIO_AACObjectHE: return "HE";
+ case OMX_AUDIO_AACObjectScalable: return "Scalable";
+ case OMX_AUDIO_AACObjectERLC: return "ERLC";
+ case OMX_AUDIO_AACObjectLD: return "LD";
+ case OMX_AUDIO_AACObjectHE_PS: return "HE_PS";
+ default: return def;
+ }
+}
+
inline static const char *asString(OMX_AUDIO_AACSTREAMFORMATTYPE i, const char *def = "??") {
switch (i) {
// case OMX_AUDIO_AACStreamFormatMP2ADTS: return "MP2ADTS";
@@ -817,13 +833,37 @@
case OMX_VIDEO_MPEG4Level1: return "Level1";
case OMX_VIDEO_MPEG4Level2: return "Level2";
case OMX_VIDEO_MPEG4Level3: return "Level3";
+ case OMX_VIDEO_MPEG4Level3b: return "Level3b";
case OMX_VIDEO_MPEG4Level4: return "Level4";
case OMX_VIDEO_MPEG4Level4a: return "Level4a";
case OMX_VIDEO_MPEG4Level5: return "Level5";
+ case OMX_VIDEO_MPEG4Level6: return "Level6";
default: return def;
}
}
+inline static const char *asString(OMX_VIDEO_MPEG2PROFILETYPE i, const char *def = "??") {
+ switch (i) {
+ case OMX_VIDEO_MPEG2ProfileSimple: return "Simple";
+ case OMX_VIDEO_MPEG2ProfileMain: return "Main";
+ case OMX_VIDEO_MPEG2Profile422: return "4:2:2";
+ case OMX_VIDEO_MPEG2ProfileSNR: return "SNR";
+ case OMX_VIDEO_MPEG2ProfileSpatial: return "Spatial";
+ case OMX_VIDEO_MPEG2ProfileHigh: return "High";
+ default: return def;
+ }
+}
+
+inline static const char *asString(OMX_VIDEO_MPEG2LEVELTYPE i, const char *def = "??") {
+ switch (i) {
+ case OMX_VIDEO_MPEG2LevelLL: return "Low";
+ case OMX_VIDEO_MPEG2LevelML: return "Main";
+ case OMX_VIDEO_MPEG2LevelH14: return "High1440";
+ case OMX_VIDEO_MPEG2LevelHL: return "High";
+ default: return def;
+ }
+}
+
inline static const char *asString(OMX_VIDEO_AVCPROFILETYPE i, const char *def = "??") {
switch (i) {
case OMX_VIDEO_AVCProfileBaseline: return "Baseline";
@@ -879,7 +919,7 @@
#ifndef AS_STRING_FOR_OMX_VIDEOEXT_H
#define AS_STRING_FOR_OMX_VIDEOEXT_H
-inline static const char *asString(OMX_VIDEO_VP8PROFILETYPE i, const char *def = "!!") {
+inline static const char *asString(OMX_VIDEO_VP8PROFILETYPE i, const char *def = "??") {
switch (i) {
case OMX_VIDEO_VP8ProfileMain: return "Main";
case OMX_VIDEO_VP8ProfileUnknown: return "Unknown"; // unused
@@ -887,7 +927,7 @@
}
}
-inline static const char *asString(OMX_VIDEO_VP8LEVELTYPE i, const char *def = "!!") {
+inline static const char *asString(OMX_VIDEO_VP8LEVELTYPE i, const char *def = "??") {
switch (i) {
case OMX_VIDEO_VP8Level_Version0: return "_Version0";
case OMX_VIDEO_VP8Level_Version1: return "_Version1";
@@ -898,6 +938,38 @@
}
}
+inline static const char *asString(OMX_VIDEO_VP9PROFILETYPE i, const char *def = "??") {
+ switch (i) {
+ case OMX_VIDEO_VP9Profile0: return "Profile0";
+ case OMX_VIDEO_VP9Profile1: return "Profile1";
+ case OMX_VIDEO_VP9Profile2: return "Profile2";
+ case OMX_VIDEO_VP9Profile3: return "Profile3";
+ case OMX_VIDEO_VP9Profile2HDR: return "Profile2HDR";
+ case OMX_VIDEO_VP9Profile3HDR: return "Profile3HDR";
+ default: return def;
+ }
+}
+
+inline static const char *asString(OMX_VIDEO_VP9LEVELTYPE i, const char *def = "??") {
+ switch (i) {
+ case OMX_VIDEO_VP9Level1: return "Level1";
+ case OMX_VIDEO_VP9Level11: return "Level11";
+ case OMX_VIDEO_VP9Level2: return "Level2";
+ case OMX_VIDEO_VP9Level21: return "Level21";
+ case OMX_VIDEO_VP9Level3: return "Level3";
+ case OMX_VIDEO_VP9Level31: return "Level31";
+ case OMX_VIDEO_VP9Level4: return "Level4";
+ case OMX_VIDEO_VP9Level41: return "Level41";
+ case OMX_VIDEO_VP9Level5: return "Level5";
+ case OMX_VIDEO_VP9Level51: return "Level51";
+ case OMX_VIDEO_VP9Level52: return "Level52";
+ case OMX_VIDEO_VP9Level6: return "Level6";
+ case OMX_VIDEO_VP9Level61: return "Level61";
+ case OMX_VIDEO_VP9Level62: return "Level62";
+ default: return def;
+ }
+}
+
inline static const char *asString(
OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE i, const char *def = "??") {
switch (i) {
diff --git a/include/media/openmax/OMX_Video.h b/include/media/openmax/OMX_Video.h
index ca85cf1..76efac9 100644
--- a/include/media/openmax/OMX_Video.h
+++ b/include/media/openmax/OMX_Video.h
@@ -553,6 +553,7 @@
OMX_VIDEO_MPEG2LevelML, /**< Main Level */
OMX_VIDEO_MPEG2LevelH14, /**< High 1440 */
OMX_VIDEO_MPEG2LevelHL, /**< High Level */
+ OMX_VIDEO_MPEG2LevelHP, /**< HighP Level */
OMX_VIDEO_MPEG2LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_VIDEO_MPEG2LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_VIDEO_MPEG2LevelMax = 0x7FFFFFFF
@@ -636,9 +637,12 @@
OMX_VIDEO_MPEG4Level1 = 0x04, /**< Level 1 */
OMX_VIDEO_MPEG4Level2 = 0x08, /**< Level 2 */
OMX_VIDEO_MPEG4Level3 = 0x10, /**< Level 3 */
+ /* normally levels are powers of 2s, but 3b was missed and levels must be properly ordered */
+ OMX_VIDEO_MPEG4Level3b = 0x18, /**< Level 3a */
OMX_VIDEO_MPEG4Level4 = 0x20, /**< Level 4 */
OMX_VIDEO_MPEG4Level4a = 0x40, /**< Level 4a */
OMX_VIDEO_MPEG4Level5 = 0x80, /**< Level 5 */
+ OMX_VIDEO_MPEG4Level6 = 0x100, /**< Level 6 */
OMX_VIDEO_MPEG4LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_VIDEO_MPEG4LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_VIDEO_MPEG4LevelMax = 0x7FFFFFFF
diff --git a/include/private/gui/LayerState.h b/include/private/gui/LayerState.h
index 92d31d1..4885e05 100644
--- a/include/private/gui/LayerState.h
+++ b/include/private/gui/LayerState.h
@@ -54,7 +54,8 @@
eCropChanged = 0x00000100,
eDeferTransaction = 0x00000200,
eFinalCropChanged = 0x00000400,
- eOverrideScalingModeChanged = 0x00000800
+ eOverrideScalingModeChanged = 0x00000800,
+ ePositionAppliesWithResize = 0x00001000,
};
layer_state_t()
diff --git a/include/ui/FrameStats.h b/include/ui/FrameStats.h
index 5fdf94d..6bfe635 100644
--- a/include/ui/FrameStats.h
+++ b/include/ui/FrameStats.h
@@ -25,6 +25,7 @@
class FrameStats : public LightFlattenable<FrameStats> {
public:
+ FrameStats() : refreshPeriodNano(0) {};
/*
* Approximate refresh time, in nanoseconds.
diff --git a/libs/binder/IMemory.cpp b/libs/binder/IMemory.cpp
index fb8d620..5f345cf 100644
--- a/libs/binder/IMemory.cpp
+++ b/libs/binder/IMemory.cpp
@@ -312,17 +312,17 @@
IInterface::asBinder(this).get(),
parcel_fd, size, err, strerror(-err));
- int fd = dup( parcel_fd );
- ALOGE_IF(fd==-1, "cannot dup fd=%d, size=%zd, err=%d (%s)",
- parcel_fd, size, err, strerror(errno));
-
- int access = PROT_READ;
- if (!(flags & READ_ONLY)) {
- access |= PROT_WRITE;
- }
-
Mutex::Autolock _l(mLock);
if (mHeapId == -1) {
+ int fd = dup( parcel_fd );
+ ALOGE_IF(fd==-1, "cannot dup fd=%d, size=%zd, err=%d (%s)",
+ parcel_fd, size, err, strerror(errno));
+
+ int access = PROT_READ;
+ if (!(flags & READ_ONLY)) {
+ access |= PROT_WRITE;
+ }
+
mRealHeap = true;
mBase = mmap(0, size, access, MAP_SHARED, fd, offset);
if (mBase == MAP_FAILED) {
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index a0161b3..c7e8ff2 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1964,7 +1964,13 @@
for (int i=0 ; err==NO_ERROR && i<numFds ; i++) {
h->data[i] = dup(readFileDescriptor());
- if (h->data[i] < 0) err = BAD_VALUE;
+ if (h->data[i] < 0) {
+ for (int j = 0; j < i; j++) {
+ close(h->data[j]);
+ }
+ native_handle_delete(h);
+ return 0;
+ }
}
err = read(h->data + numFds, sizeof(int)*numInts);
if (err != NO_ERROR) {
diff --git a/libs/gui/BufferItemConsumer.cpp b/libs/gui/BufferItemConsumer.cpp
index 6f4c89d..3491043 100644
--- a/libs/gui/BufferItemConsumer.cpp
+++ b/libs/gui/BufferItemConsumer.cpp
@@ -49,6 +49,10 @@
void BufferItemConsumer::setName(const String8& name) {
Mutex::Autolock _l(mMutex);
+ if (mAbandoned) {
+ BI_LOGE("setName: BufferItemConsumer is abandoned!");
+ return;
+ }
mName = name;
mConsumer->setConsumerName(name);
}
diff --git a/libs/gui/BufferQueueCore.cpp b/libs/gui/BufferQueueCore.cpp
index 052de3d..ba34eb6 100644
--- a/libs/gui/BufferQueueCore.cpp
+++ b/libs/gui/BufferQueueCore.cpp
@@ -130,11 +130,18 @@
for (int s : mActiveBuffers) {
const sp<GraphicBuffer>& buffer(mSlots[s].mGraphicBuffer);
- result.appendFormat("%s%s[%02d:%p] state=%-8s, %p [%4ux%4u:%4u,%3X]\n",
- prefix, (mSlots[s].mBufferState.isAcquired()) ? ">" : " ", s,
- buffer.get(), mSlots[s].mBufferState.string(), buffer->handle,
- buffer->width, buffer->height, buffer->stride, buffer->format);
-
+ // A dequeued buffer might be null if it's still being allocated
+ if (buffer.get()) {
+ result.appendFormat("%s%s[%02d:%p] state=%-8s, %p "
+ "[%4ux%4u:%4u,%3X]\n", prefix,
+ (mSlots[s].mBufferState.isAcquired()) ? ">" : " ", s,
+ buffer.get(), mSlots[s].mBufferState.string(),
+ buffer->handle, buffer->width, buffer->height,
+ buffer->stride, buffer->format);
+ } else {
+ result.appendFormat("%s [%02d:%p] state=%-8s\n", prefix, s,
+ buffer.get(), mSlots[s].mBufferState.string());
+ }
}
for (int s : mFreeBuffers) {
const sp<GraphicBuffer>& buffer(mSlots[s].mGraphicBuffer);
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 3e26e05..69a408c 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -444,14 +444,6 @@
mSlots[found].mBufferState.dequeue();
- // If shared buffer mode has just been enabled, cache the slot of the
- // first buffer that is dequeued and mark it as the shared buffer.
- if (mCore->mSharedBufferMode && mCore->mSharedBufferSlot ==
- BufferQueueCore::INVALID_BUFFER_SLOT) {
- mCore->mSharedBufferSlot = found;
- mSlots[found].mBufferState.mShared = true;
- }
-
if ((buffer == NULL) ||
buffer->needsReallocation(width, height, format, usage))
{
@@ -483,9 +475,21 @@
eglDisplay = mSlots[found].mEglDisplay;
eglFence = mSlots[found].mEglFence;
- *outFence = mSlots[found].mFence;
+ // Don't return a fence in shared buffer mode, except for the first
+ // frame.
+ *outFence = (mCore->mSharedBufferMode &&
+ mCore->mSharedBufferSlot == found) ?
+ Fence::NO_FENCE : mSlots[found].mFence;
mSlots[found].mEglFence = EGL_NO_SYNC_KHR;
mSlots[found].mFence = Fence::NO_FENCE;
+
+ // If shared buffer mode has just been enabled, cache the slot of the
+ // first buffer that is dequeued and mark it as the shared buffer.
+ if (mCore->mSharedBufferMode && mCore->mSharedBufferSlot ==
+ BufferQueueCore::INVALID_BUFFER_SLOT) {
+ mCore->mSharedBufferSlot = found;
+ mSlots[found].mBufferState.mShared = true;
+ }
} // Autolock scope
if (returnFlags & BUFFER_NEEDS_REALLOCATION) {
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index 2187e5e..a6a9712 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -163,6 +163,10 @@
void ConsumerBase::abandonLocked() {
CB_LOGV("abandonLocked");
+ if (mAbandoned) {
+ CB_LOGE("abandonLocked: ConsumerBase is abandoned!");
+ return;
+ }
for (int i =0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) {
freeBufferLocked(i);
}
@@ -187,6 +191,11 @@
CB_LOGV("detachBuffer");
Mutex::Autolock lock(mMutex);
+ if (mAbandoned) {
+ CB_LOGE("detachBuffer: ConsumerBase is abandoned!");
+ return NO_INIT;
+ }
+
status_t result = mConsumer->detachBuffer(slot);
if (result != NO_ERROR) {
CB_LOGE("Failed to detach buffer: %d", result);
@@ -200,17 +209,29 @@
status_t ConsumerBase::setDefaultBufferSize(uint32_t width, uint32_t height) {
Mutex::Autolock _l(mMutex);
+ if (mAbandoned) {
+ CB_LOGE("setDefaultBufferSize: ConsumerBase is abandoned!");
+ return NO_INIT;
+ }
return mConsumer->setDefaultBufferSize(width, height);
}
status_t ConsumerBase::setDefaultBufferFormat(PixelFormat defaultFormat) {
Mutex::Autolock _l(mMutex);
+ if (mAbandoned) {
+ CB_LOGE("setDefaultBufferFormat: ConsumerBase is abandoned!");
+ return NO_INIT;
+ }
return mConsumer->setDefaultBufferFormat(defaultFormat);
}
status_t ConsumerBase::setDefaultBufferDataSpace(
android_dataspace defaultDataSpace) {
Mutex::Autolock _l(mMutex);
+ if (mAbandoned) {
+ CB_LOGE("setDefaultBufferDataSpace: ConsumerBase is abandoned!");
+ return NO_INIT;
+ }
return mConsumer->setDefaultBufferDataSpace(defaultDataSpace);
}
@@ -233,6 +254,11 @@
status_t ConsumerBase::acquireBufferLocked(BufferItem *item,
nsecs_t presentWhen, uint64_t maxFrameNumber) {
+ if (mAbandoned) {
+ CB_LOGE("acquireBufferLocked: ConsumerBase is abandoned!");
+ return NO_INIT;
+ }
+
status_t err = mConsumer->acquireBuffer(item, presentWhen, maxFrameNumber);
if (err != NO_ERROR) {
return err;
@@ -289,6 +315,10 @@
status_t ConsumerBase::releaseBufferLocked(
int slot, const sp<GraphicBuffer> graphicBuffer,
EGLDisplay display, EGLSyncKHR eglFence) {
+ if (mAbandoned) {
+ CB_LOGE("releaseBufferLocked: ConsumerBase is abandoned!");
+ return NO_INIT;
+ }
// If consumer no longer tracks this graphicBuffer (we received a new
// buffer on the same slot), the buffer producer is definitely no longer
// tracking it.
diff --git a/libs/gui/CpuConsumer.cpp b/libs/gui/CpuConsumer.cpp
index 7ed3d0f..8393160 100644
--- a/libs/gui/CpuConsumer.cpp
+++ b/libs/gui/CpuConsumer.cpp
@@ -52,6 +52,10 @@
void CpuConsumer::setName(const String8& name) {
Mutex::Autolock _l(mMutex);
+ if (mAbandoned) {
+ CC_LOGE("setName: CpuConsumer is abandoned!");
+ return;
+ }
mName = name;
mConsumer->setConsumerName(name);
}
diff --git a/libs/gui/GLConsumer.cpp b/libs/gui/GLConsumer.cpp
index ac8bc6e..553b65c 100644
--- a/libs/gui/GLConsumer.cpp
+++ b/libs/gui/GLConsumer.cpp
@@ -208,6 +208,10 @@
status_t GLConsumer::setDefaultBufferSize(uint32_t w, uint32_t h)
{
Mutex::Autolock lock(mMutex);
+ if (mAbandoned) {
+ GLC_LOGE("setDefaultBufferSize: GLConsumer is abandoned!");
+ return NO_INIT;
+ }
mDefaultWidth = w;
mDefaultHeight = h;
return mConsumer->setDefaultBufferSize(w, h);
@@ -415,21 +419,6 @@
return err;
}
- // For investigating b/27674961
- if (mEglSlots[slot].mEglImage == nullptr) {
- ALOGE("If you see this message in a log please post the log to "
- "b/27674961");
- ALOGE("slot = %d, mCurrentTexture = %d, mCurrentTextureImage = %p",
- slot, mCurrentTexture, mCurrentTextureImage.get());
- for (int i = 0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) {
- ALOGE("mEglSlots[%d].mEglImage = %p", i,
- mEglSlots[i].mEglImage.get());
- }
- String8 dump;
- dumpLocked(dump, "");
- ALOGE("%s", dump.string());
- }
-
// Ensure we have a valid EglImageKHR for the slot, creating an EglImage
// if nessessary, for the gralloc buffer currently in the slot in
// ConsumerBase.
@@ -1073,34 +1062,58 @@
void GLConsumer::setName(const String8& name) {
Mutex::Autolock _l(mMutex);
+ if (mAbandoned) {
+ GLC_LOGE("setName: GLConsumer is abandoned!");
+ return;
+ }
mName = name;
mConsumer->setConsumerName(name);
}
status_t GLConsumer::setDefaultBufferFormat(PixelFormat defaultFormat) {
Mutex::Autolock lock(mMutex);
+ if (mAbandoned) {
+ GLC_LOGE("setDefaultBufferFormat: GLConsumer is abandoned!");
+ return NO_INIT;
+ }
return mConsumer->setDefaultBufferFormat(defaultFormat);
}
status_t GLConsumer::setDefaultBufferDataSpace(
android_dataspace defaultDataSpace) {
Mutex::Autolock lock(mMutex);
+ if (mAbandoned) {
+ GLC_LOGE("setDefaultBufferDataSpace: GLConsumer is abandoned!");
+ return NO_INIT;
+ }
return mConsumer->setDefaultBufferDataSpace(defaultDataSpace);
}
status_t GLConsumer::setConsumerUsageBits(uint32_t usage) {
Mutex::Autolock lock(mMutex);
+ if (mAbandoned) {
+ GLC_LOGE("setConsumerUsageBits: GLConsumer is abandoned!");
+ return NO_INIT;
+ }
usage |= DEFAULT_USAGE_FLAGS;
return mConsumer->setConsumerUsageBits(usage);
}
status_t GLConsumer::setTransformHint(uint32_t hint) {
Mutex::Autolock lock(mMutex);
+ if (mAbandoned) {
+ GLC_LOGE("setTransformHint: GLConsumer is abandoned!");
+ return NO_INIT;
+ }
return mConsumer->setTransformHint(hint);
}
status_t GLConsumer::setMaxAcquiredBufferCount(int maxAcquiredBuffers) {
Mutex::Autolock lock(mMutex);
+ if (mAbandoned) {
+ GLC_LOGE("setMaxAcquiredBufferCount: GLConsumer is abandoned!");
+ return NO_INIT;
+ }
return mConsumer->setMaxAcquiredBufferCount(maxAcquiredBuffers);
}
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index 6811269..9d130cd 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -162,6 +162,9 @@
ANativeWindowBuffer* buf;
int fenceFd = -1;
int result = c->dequeueBuffer(&buf, &fenceFd);
+ if (result != OK) {
+ return result;
+ }
sp<Fence> fence(new Fence(fenceFd));
int waitResult = fence->waitForever("dequeueBuffer_DEPRECATED");
if (waitResult != OK) {
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index e33cc37..92ae41e 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -165,6 +165,8 @@
uint64_t frameNumber);
status_t setOverrideScalingMode(const sp<SurfaceComposerClient>& client,
const sp<IBinder>& id, int32_t overrideScalingMode);
+ status_t setPositionAppliesWithResize(const sp<SurfaceComposerClient>& client,
+ const sp<IBinder>& id);
void setDisplaySurface(const sp<IBinder>& token,
const sp<IGraphicBufferProducer>& bufferProducer);
@@ -443,6 +445,18 @@
return NO_ERROR;
}
+status_t Composer::setPositionAppliesWithResize(
+ const sp<SurfaceComposerClient>& client,
+ const sp<IBinder>& id) {
+ Mutex::Autolock lock(mLock);
+ layer_state_t* s = getLayerStateLocked(client, id);
+ if (!s) {
+ return BAD_INDEX;
+ }
+ s->what |= layer_state_t::ePositionAppliesWithResize;
+ return NO_ERROR;
+}
+
// ---------------------------------------------------------------------------
DisplayState& Composer::getDisplayStateLocked(const sp<IBinder>& token) {
@@ -685,6 +699,11 @@
this, id, overrideScalingMode);
}
+status_t SurfaceComposerClient::setPositionAppliesWithResize(
+ const sp<IBinder>& id) {
+ return getComposer().setPositionAppliesWithResize(this, id);
+}
+
// ----------------------------------------------------------------------------
void SurfaceComposerClient::setDisplaySurface(const sp<IBinder>& token,
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp
index 314d83a..4671e50 100644
--- a/libs/gui/SurfaceControl.cpp
+++ b/libs/gui/SurfaceControl.cpp
@@ -112,6 +112,11 @@
if (err < 0) return err;
return mClient->setPosition(mHandle, x, y);
}
+status_t SurfaceControl::setPositionAppliesWithResize() {
+ status_t err = validate();
+ if (err < 0) return err;
+ return mClient->setPositionAppliesWithResize(mHandle);
+}
status_t SurfaceControl::setSize(uint32_t w, uint32_t h) {
status_t err = validate();
if (err < 0) return err;
diff --git a/opengl/libagl/BufferObjectManager.h b/opengl/libagl/BufferObjectManager.h
index 6487faa..fcdae5b 100644
--- a/opengl/libagl/BufferObjectManager.h
+++ b/opengl/libagl/BufferObjectManager.h
@@ -18,11 +18,11 @@
#ifndef ANDROID_OPENGLES_BUFFER_OBJECT_MANAGER_H
#define ANDROID_OPENGLES_BUFFER_OBJECT_MANAGER_H
+#include <atomic>
#include <stdint.h>
#include <stddef.h>
#include <sys/types.h>
-#include <utils/Atomic.h>
#include <utils/RefBase.h>
#include <utils/KeyedVector.h>
#include <utils/Errors.h>
@@ -64,16 +64,17 @@
void deleteBuffers(GLsizei n, const GLuint* buffers);
private:
- mutable volatile int32_t mCount;
+ mutable std::atomic_size_t mCount;
mutable Mutex mLock;
KeyedVector<GLuint, gl::buffer_t*> mBuffers;
};
void EGLBufferObjectManager::incStrong(const void* /*id*/) const {
- android_atomic_inc(&mCount);
+ mCount.fetch_add(1, std::memory_order_relaxed);
}
void EGLBufferObjectManager::decStrong(const void* /*id*/) const {
- if (android_atomic_dec(&mCount) == 1) {
+ if (mCount.fetch_sub(1, std::memory_order_release) == 0) {
+ std::atomic_thread_fence(std::memory_order_acquire);
delete this;
}
}
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index 7560d8f..92139e9 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -16,6 +16,7 @@
*/
#include <assert.h>
+#include <atomic>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
@@ -27,7 +28,6 @@
#include <sys/mman.h>
#include <cutils/log.h>
-#include <cutils/atomic.h>
#include <utils/threads.h>
#include <ui/ANativeObjectBase.h>
@@ -107,8 +107,8 @@
return ((uintptr_t(dpy)-1U) >= NUM_DISPLAYS) ? EGL_FALSE : EGL_TRUE;
}
- NativeDisplayType type;
- volatile int32_t initialized;
+ NativeDisplayType type;
+ std::atomic_size_t initialized;
};
static egl_display_t gDisplays[NUM_DISPLAYS];
@@ -1429,7 +1429,7 @@
EGLBoolean res = EGL_TRUE;
egl_display_t& d = egl_display_t::get_display(dpy);
- if (android_atomic_inc(&d.initialized) == 0) {
+ if (d.initialized.fetch_add(1, std::memory_order_acquire) == 0) {
// initialize stuff here if needed
//pthread_mutex_lock(&gInitMutex);
//pthread_mutex_unlock(&gInitMutex);
@@ -1449,7 +1449,8 @@
EGLBoolean res = EGL_TRUE;
egl_display_t& d = egl_display_t::get_display(dpy);
- if (android_atomic_dec(&d.initialized) == 1) {
+ if (d.initialized.fetch_sub(1, std::memory_order_release) == 1) {
+ std::atomic_thread_fence(std::memory_order_acquire);
// TODO: destroy all resources (surfaces, contexts, etc...)
//pthread_mutex_lock(&gInitMutex);
//pthread_mutex_unlock(&gInitMutex);
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 00bfc24..e793852 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -1794,9 +1794,9 @@
uint32_t blue_size = 0;
uint32_t alpha_size = 0;
-#define GET_POSITIVE_VALUE(case_name, target) \
+#define GET_NONNEGATIVE_VALUE(case_name, target) \
case case_name: \
- if (value > 0) { \
+ if (value >= 0) { \
target = value; \
} else { \
return setError(EGL_BAD_PARAMETER, (EGLClientBuffer)0); \
@@ -1808,12 +1808,12 @@
GLint attr = *attrib_list++;
GLint value = *attrib_list++;
switch (attr) {
- GET_POSITIVE_VALUE(EGL_WIDTH, width);
- GET_POSITIVE_VALUE(EGL_HEIGHT, height);
- GET_POSITIVE_VALUE(EGL_RED_SIZE, red_size);
- GET_POSITIVE_VALUE(EGL_GREEN_SIZE, green_size);
- GET_POSITIVE_VALUE(EGL_BLUE_SIZE, blue_size);
- GET_POSITIVE_VALUE(EGL_ALPHA_SIZE, alpha_size);
+ GET_NONNEGATIVE_VALUE(EGL_WIDTH, width);
+ GET_NONNEGATIVE_VALUE(EGL_HEIGHT, height);
+ GET_NONNEGATIVE_VALUE(EGL_RED_SIZE, red_size);
+ GET_NONNEGATIVE_VALUE(EGL_GREEN_SIZE, green_size);
+ GET_NONNEGATIVE_VALUE(EGL_BLUE_SIZE, blue_size);
+ GET_NONNEGATIVE_VALUE(EGL_ALPHA_SIZE, alpha_size);
case EGL_NATIVE_BUFFER_USAGE_ANDROID:
if (value & EGL_NATIVE_BUFFER_USAGE_PROTECTED_BIT_ANDROID) {
usage |= GRALLOC_USAGE_PROTECTED;
@@ -1836,7 +1836,7 @@
}
}
}
-#undef GET_POSITIVE_VALUE
+#undef GET_NONNEGATIVE_VALUE
// Validate format.
if (red_size == 8 && green_size == 8 && blue_size == 8) {
@@ -1847,7 +1847,7 @@
}
} else if (red_size == 5 && green_size == 6 && blue_size == 5 &&
alpha_size == 0) {
- format == HAL_PIXEL_FORMAT_RGB_565;
+ format = HAL_PIXEL_FORMAT_RGB_565;
} else {
ALOGE("Invalid native pixel format { r=%d, g=%d, b=%d, a=%d }",
red_size, green_size, blue_size, alpha_size);
diff --git a/opengl/libs/EGL/egl_object.cpp b/opengl/libs/EGL/egl_object.cpp
index 918faa8..90f27d1 100644
--- a/opengl/libs/EGL/egl_object.cpp
+++ b/opengl/libs/EGL/egl_object.cpp
@@ -67,7 +67,8 @@
egl_surface_t::egl_surface_t(egl_display_t* dpy, EGLConfig config,
EGLNativeWindowType win, EGLSurface surface,
egl_connection_t const* cnx) :
- egl_object_t(dpy), surface(surface), config(config), win(win), cnx(cnx)
+ egl_object_t(dpy), surface(surface), config(config), win(win), cnx(cnx),
+ connected(true)
{
if (win) {
getDisplay()->onWindowSurfaceCreated();
@@ -77,14 +78,27 @@
egl_surface_t::~egl_surface_t() {
ANativeWindow* const window = win.get();
if (window != NULL) {
+ disconnect();
+ getDisplay()->onWindowSurfaceDestroyed();
+ }
+}
+
+void egl_surface_t::disconnect() {
+ ANativeWindow* const window = win.get();
+ if (window != NULL && connected) {
native_window_set_buffers_format(window, 0);
if (native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL)) {
ALOGW("EGLNativeWindowType %p disconnect failed", window);
}
- getDisplay()->onWindowSurfaceDestroyed();
+ connected = false;
}
}
+void egl_surface_t::terminate() {
+ disconnect();
+ egl_object_t::terminate();
+}
+
// ----------------------------------------------------------------------------
egl_context_t::egl_context_t(EGLDisplay dpy, EGLContext context, EGLConfig config,
diff --git a/opengl/libs/EGL/egl_object.h b/opengl/libs/EGL/egl_object.h
index 17a8304..8f3b9cb 100644
--- a/opengl/libs/EGL/egl_object.h
+++ b/opengl/libs/EGL/egl_object.h
@@ -17,7 +17,7 @@
#ifndef ANDROID_EGL_OBJECT_H
#define ANDROID_EGL_OBJECT_H
-
+#include <atomic>
#include <ctype.h>
#include <stdint.h>
#include <stdlib.h>
@@ -41,21 +41,21 @@
class egl_object_t {
egl_display_t *display;
- mutable volatile int32_t count;
+ mutable std::atomic_size_t count;
protected:
virtual ~egl_object_t();
+ virtual void terminate();
public:
egl_object_t(egl_display_t* display);
void destroy();
- inline int32_t incRef() { return android_atomic_inc(&count); }
- inline int32_t decRef() { return android_atomic_dec(&count); }
+ inline void incRef() { count.fetch_add(1, std::memory_order_relaxed); }
+ inline size_t decRef() { return count.fetch_sub(1, std::memory_order_acq_rel); }
inline egl_display_t* getDisplay() const { return display; }
private:
- void terminate();
static bool get(egl_display_t const* display, egl_object_t* object);
public:
@@ -127,6 +127,7 @@
class egl_surface_t : public egl_object_t {
protected:
~egl_surface_t();
+ void terminate() override;
public:
typedef egl_object_t::LocalRef<egl_surface_t, EGLSurface> Ref;
@@ -138,6 +139,9 @@
EGLConfig config;
sp<ANativeWindow> win;
egl_connection_t const* cnx;
+private:
+ bool connected;
+ void disconnect();
};
class egl_context_t: public egl_object_t {
diff --git a/opengl/libs/EGL/getProcAddress.cpp b/opengl/libs/EGL/getProcAddress.cpp
index bdfd21c..336c264 100644
--- a/opengl/libs/EGL/getProcAddress.cpp
+++ b/opengl/libs/EGL/getProcAddress.cpp
@@ -46,14 +46,15 @@
"ldr r12, [r12, %[tls]] \n" \
"cmp r12, #0 \n" \
"addne r12, %[api] \n" \
- "ldrne r12, [r12] \n" \
+ "ldrne r12, [r12, %[ext]] \n" \
"cmpne r12, #0 \n" \
"bxne r12 \n" \
"bx lr \n" \
: \
: [tls] "J"(TLS_SLOT_OPENGL_API*4), \
- [api] "r"(__builtin_offsetof(gl_hooks_t, \
- ext.extensions[_api])) \
+ [ext] "J"(__builtin_offsetof(gl_hooks_t, \
+ ext.extensions[0])), \
+ [api] "J"(_api*sizeof(void*)) \
: "r12" \
);
diff --git a/services/inputflinger/InputWindow.cpp b/services/inputflinger/InputWindow.cpp
index 1b913c5..d7b514b 100644
--- a/services/inputflinger/InputWindow.cpp
+++ b/services/inputflinger/InputWindow.cpp
@@ -46,7 +46,8 @@
|| layoutParamsType == TYPE_MAGNIFICATION_OVERLAY
|| layoutParamsType == TYPE_STATUS_BAR
|| layoutParamsType == TYPE_NAVIGATION_BAR
- || layoutParamsType == TYPE_SECURE_SYSTEM_OVERLAY;
+ || layoutParamsType == TYPE_SECURE_SYSTEM_OVERLAY
+ || layoutParamsType == TYPE_DOCK_DIVIDER;
}
bool InputWindowInfo::supportsSplitTouch() const {
diff --git a/services/inputflinger/InputWindow.h b/services/inputflinger/InputWindow.h
index 0ac7fce..e243637 100644
--- a/services/inputflinger/InputWindow.h
+++ b/services/inputflinger/InputWindow.h
@@ -102,6 +102,7 @@
TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20,
TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21,
TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+22,
+ TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW+34,
LAST_SYSTEM_WINDOW = 2999,
};
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp
index f7678e4..ed8cc08 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp
@@ -96,6 +96,7 @@
mDestroyLayer(nullptr),
mGetActiveConfig(nullptr),
mGetChangedCompositionTypes(nullptr),
+ mGetColorModes(nullptr),
mGetDisplayAttribute(nullptr),
mGetDisplayConfigs(nullptr),
mGetDisplayName(nullptr),
@@ -107,6 +108,8 @@
mPresentDisplay(nullptr),
mSetActiveConfig(nullptr),
mSetClientTarget(nullptr),
+ mSetColorMode(nullptr),
+ mSetColorTransform(nullptr),
mSetOutputBuffer(nullptr),
mSetPowerMode(nullptr),
mSetVsyncEnabled(nullptr),
@@ -117,6 +120,7 @@
mSetLayerBlendMode(nullptr),
mSetLayerColor(nullptr),
mSetLayerCompositionType(nullptr),
+ mSetLayerDataspace(nullptr),
mSetLayerDisplayFrame(nullptr),
mSetLayerPlaneAlpha(nullptr),
mSetLayerSidebandStream(nullptr),
@@ -188,19 +192,21 @@
}
Error Device::createVirtualDisplay(uint32_t width, uint32_t height,
- std::shared_ptr<Display>* outDisplay)
+ android_pixel_format_t* format, std::shared_ptr<Display>* outDisplay)
{
ALOGI("Creating virtual display");
hwc2_display_t displayId = 0;
+ int32_t intFormat = static_cast<int32_t>(*format);
int32_t intError = mCreateVirtualDisplay(mHwcDevice, width, height,
- &displayId);
+ &intFormat, &displayId);
auto error = static_cast<Error>(intError);
if (error != Error::None) {
return error;
}
ALOGI("Created virtual display");
+ *format = static_cast<android_pixel_format_t>(intFormat);
*outDisplay = getDisplayById(displayId);
(*outDisplay)->setVirtual();
return Error::None;
@@ -337,6 +343,8 @@
mGetActiveConfig)) return;
if (!loadFunctionPointer(FunctionDescriptor::GetChangedCompositionTypes,
mGetChangedCompositionTypes)) return;
+ if (!loadFunctionPointer(FunctionDescriptor::GetColorModes,
+ mGetColorModes)) return;
if (!loadFunctionPointer(FunctionDescriptor::GetDisplayAttribute,
mGetDisplayAttribute)) return;
if (!loadFunctionPointer(FunctionDescriptor::GetDisplayConfigs,
@@ -359,6 +367,10 @@
mSetActiveConfig)) return;
if (!loadFunctionPointer(FunctionDescriptor::SetClientTarget,
mSetClientTarget)) return;
+ if (!loadFunctionPointer(FunctionDescriptor::SetColorMode,
+ mSetColorMode)) return;
+ if (!loadFunctionPointer(FunctionDescriptor::SetColorTransform,
+ mSetColorTransform)) return;
if (!loadFunctionPointer(FunctionDescriptor::SetOutputBuffer,
mSetOutputBuffer)) return;
if (!loadFunctionPointer(FunctionDescriptor::SetPowerMode,
@@ -381,6 +393,8 @@
mSetLayerColor)) return;
if (!loadFunctionPointer(FunctionDescriptor::SetLayerCompositionType,
mSetLayerCompositionType)) return;
+ if (!loadFunctionPointer(FunctionDescriptor::SetLayerDataspace,
+ mSetLayerDataspace)) return;
if (!loadFunctionPointer(FunctionDescriptor::SetLayerDisplayFrame,
mSetLayerDisplayFrame)) return;
if (!loadFunctionPointer(FunctionDescriptor::SetLayerPlaneAlpha,
@@ -551,6 +565,28 @@
return Error::None;
}
+Error Display::getColorModes(std::vector<int32_t>* outModes) const
+{
+ uint32_t numModes = 0;
+ int32_t intError = mDevice.mGetColorModes(mDevice.mHwcDevice, mId,
+ &numModes, nullptr);
+ auto error = static_cast<Error>(intError);
+ if (error != Error::None) {
+ return error;
+ }
+
+ std::vector<int32_t> modes(numModes);
+ intError = mDevice.mGetColorModes(mDevice.mHwcDevice, mId, &numModes,
+ modes.data());
+ error = static_cast<Error>(intError);
+ if (error != Error::None) {
+ return error;
+ }
+
+ std::swap(*outModes, modes);
+ return Error::None;
+}
+
std::vector<std::shared_ptr<const Display::Config>> Display::getConfigs() const
{
std::vector<std::shared_ptr<const Config>> configs;
@@ -746,9 +782,24 @@
Error Display::setClientTarget(buffer_handle_t target,
const sp<Fence>& acquireFence, android_dataspace_t dataspace)
{
+ // TODO: Properly encode client target surface damage
int32_t fenceFd = acquireFence->dup();
int32_t intError = mDevice.mSetClientTarget(mDevice.mHwcDevice, mId, target,
- fenceFd, static_cast<int32_t>(dataspace));
+ fenceFd, static_cast<int32_t>(dataspace), {0, nullptr});
+ return static_cast<Error>(intError);
+}
+
+Error Display::setColorMode(int32_t mode)
+{
+ int32_t intError = mDevice.mSetColorMode(mDevice.mHwcDevice, mId, mode);
+ return static_cast<Error>(intError);
+}
+
+Error Display::setColorTransform(const android::mat4& matrix,
+ android_color_transform_t hint)
+{
+ int32_t intError = mDevice.mSetColorTransform(mDevice.mHwcDevice, mId,
+ matrix.asArray(), static_cast<int32_t>(hint));
return static_cast<Error>(intError);
}
@@ -965,6 +1016,14 @@
return static_cast<Error>(intError);
}
+Error Layer::setDataspace(android_dataspace_t dataspace)
+{
+ auto intDataspace = static_cast<int32_t>(dataspace);
+ int32_t intError = mDevice.mSetLayerDataspace(mDevice.mHwcDevice,
+ mDisplayId, mId, intDataspace);
+ return static_cast<Error>(intError);
+}
+
Error Layer::setDisplayFrame(const Rect& frame)
{
hwc_rect_t hwcRect{frame.left, frame.top, frame.right, frame.bottom};
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.h b/services/surfaceflinger/DisplayHardware/HWC2.h
index 967add0..8ab61e9 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.h
+++ b/services/surfaceflinger/DisplayHardware/HWC2.h
@@ -24,6 +24,7 @@
#undef HWC2_USE_CPP11
#include <ui/HdrCapabilities.h>
+#include <ui/mat4.h>
#include <utils/Log.h>
#include <utils/StrongPointer.h>
@@ -71,6 +72,7 @@
uint32_t getMaxVirtualDisplayCount() const;
Error createVirtualDisplay(uint32_t width, uint32_t height,
+ android_pixel_format_t* format,
std::shared_ptr<Display>* outDisplay);
void registerHotplugCallback(HotplugCallback hotplug);
@@ -143,6 +145,7 @@
HWC2_PFN_DESTROY_LAYER mDestroyLayer;
HWC2_PFN_GET_ACTIVE_CONFIG mGetActiveConfig;
HWC2_PFN_GET_CHANGED_COMPOSITION_TYPES mGetChangedCompositionTypes;
+ HWC2_PFN_GET_COLOR_MODES mGetColorModes;
HWC2_PFN_GET_DISPLAY_ATTRIBUTE mGetDisplayAttribute;
HWC2_PFN_GET_DISPLAY_CONFIGS mGetDisplayConfigs;
HWC2_PFN_GET_DISPLAY_NAME mGetDisplayName;
@@ -154,6 +157,8 @@
HWC2_PFN_PRESENT_DISPLAY mPresentDisplay;
HWC2_PFN_SET_ACTIVE_CONFIG mSetActiveConfig;
HWC2_PFN_SET_CLIENT_TARGET mSetClientTarget;
+ HWC2_PFN_SET_COLOR_MODE mSetColorMode;
+ HWC2_PFN_SET_COLOR_TRANSFORM mSetColorTransform;
HWC2_PFN_SET_OUTPUT_BUFFER mSetOutputBuffer;
HWC2_PFN_SET_POWER_MODE mSetPowerMode;
HWC2_PFN_SET_VSYNC_ENABLED mSetVsyncEnabled;
@@ -166,6 +171,7 @@
HWC2_PFN_SET_LAYER_BLEND_MODE mSetLayerBlendMode;
HWC2_PFN_SET_LAYER_COLOR mSetLayerColor;
HWC2_PFN_SET_LAYER_COMPOSITION_TYPE mSetLayerCompositionType;
+ HWC2_PFN_SET_LAYER_DATASPACE mSetLayerDataspace;
HWC2_PFN_SET_LAYER_DISPLAY_FRAME mSetLayerDisplayFrame;
HWC2_PFN_SET_LAYER_PLANE_ALPHA mSetLayerPlaneAlpha;
HWC2_PFN_SET_LAYER_SIDEBAND_STREAM mSetLayerSidebandStream;
@@ -273,6 +279,8 @@
std::shared_ptr<const Config>* outConfig) const;
[[clang::warn_unused_result]] Error getChangedCompositionTypes(
std::unordered_map<std::shared_ptr<Layer>, Composition>* outTypes);
+ [[clang::warn_unused_result]] Error getColorModes(
+ std::vector<int32_t>* outModes) const;
// Doesn't call into the HWC2 device, so no errors are possible
std::vector<std::shared_ptr<const Config>> getConfigs() const;
@@ -297,6 +305,9 @@
buffer_handle_t target,
const android::sp<android::Fence>& acquireFence,
android_dataspace_t dataspace);
+ [[clang::warn_unused_result]] Error setColorMode(int32_t mode);
+ [[clang::warn_unused_result]] Error setColorTransform(
+ const android::mat4& matrix, android_color_transform_t hint);
[[clang::warn_unused_result]] Error setOutputBuffer(
const android::sp<android::GraphicBuffer>& buffer,
const android::sp<android::Fence>& releaseFence);
@@ -360,6 +371,8 @@
[[clang::warn_unused_result]] Error setBlendMode(BlendMode mode);
[[clang::warn_unused_result]] Error setColor(hwc_color_t color);
[[clang::warn_unused_result]] Error setCompositionType(Composition type);
+ [[clang::warn_unused_result]] Error setDataspace(
+ android_dataspace_t dataspace);
[[clang::warn_unused_result]] Error setDisplayFrame(
const android::Rect& frame);
[[clang::warn_unused_result]] Error setPlaneAlpha(float alpha);
diff --git a/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.cpp b/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.cpp
index 6ebcdfe..2641ee6 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.cpp
@@ -75,6 +75,8 @@
using namespace HWC2;
+static constexpr Attribute ColorTransform = static_cast<Attribute>(6);
+
namespace android {
void HWC2On1Adapter::DisplayContentsDeleter::operator()(
@@ -214,6 +216,10 @@
displayHook<decltype(&Display::getChangedCompositionTypes),
&Display::getChangedCompositionTypes, uint32_t*,
hwc2_layer_t*, int32_t*>);
+ case FunctionDescriptor::GetColorModes:
+ return asFP<HWC2_PFN_GET_COLOR_MODES>(
+ displayHook<decltype(&Display::getColorModes),
+ &Display::getColorModes, uint32_t*, int32_t*>);
case FunctionDescriptor::GetDisplayAttribute:
return asFP<HWC2_PFN_GET_DISPLAY_ATTRIBUTE>(
getDisplayAttributeHook);
@@ -260,7 +266,13 @@
return asFP<HWC2_PFN_SET_CLIENT_TARGET>(
displayHook<decltype(&Display::setClientTarget),
&Display::setClientTarget, buffer_handle_t, int32_t,
- int32_t>);
+ int32_t, hwc_region_t>);
+ case FunctionDescriptor::SetColorMode:
+ return asFP<HWC2_PFN_SET_COLOR_MODE>(
+ displayHook<decltype(&Display::setColorMode),
+ &Display::setColorMode, int32_t>);
+ case FunctionDescriptor::SetColorTransform:
+ return asFP<HWC2_PFN_SET_COLOR_TRANSFORM>(setColorTransformHook);
case FunctionDescriptor::SetOutputBuffer:
return asFP<HWC2_PFN_SET_OUTPUT_BUFFER>(
displayHook<decltype(&Display::setOutputBuffer),
@@ -299,6 +311,8 @@
case FunctionDescriptor::SetLayerCompositionType:
return asFP<HWC2_PFN_SET_LAYER_COMPOSITION_TYPE>(
setLayerCompositionTypeHook);
+ case FunctionDescriptor::SetLayerDataspace:
+ return asFP<HWC2_PFN_SET_LAYER_DATASPACE>(setLayerDataspaceHook);
case FunctionDescriptor::SetLayerDisplayFrame:
return asFP<HWC2_PFN_SET_LAYER_DISPLAY_FRAME>(
layerHook<decltype(&Layer::setDisplayFrame),
@@ -554,6 +568,7 @@
mVsyncEnabled(Vsync::Invalid),
mClientTarget(),
mOutputBuffer(),
+ mHasColorTransform(false),
mLayers(),
mHwc1LayerMap() {}
@@ -681,6 +696,22 @@
return Error::None;
}
+Error HWC2On1Adapter::Display::getColorModes(uint32_t* outNumModes,
+ int32_t* outModes)
+{
+ std::unique_lock<std::recursive_mutex> lock(mStateMutex);
+
+ if (!outModes) {
+ *outNumModes = mColorModes.size();
+ return Error::None;
+ }
+ uint32_t numModes = std::min(*outNumModes,
+ static_cast<uint32_t>(mColorModes.size()));
+ std::copy_n(mColorModes.cbegin(), numModes, outModes);
+ *outNumModes = numModes;
+ return Error::None;
+}
+
Error HWC2On1Adapter::Display::getConfigs(uint32_t* outNumConfigs,
hwc2_config_t* outConfigs)
{
@@ -827,26 +858,81 @@
if (!config) {
return Error::BadConfig;
}
- mActiveConfig = config;
- if (mDevice.mHwc1MinorVersion >= 4) {
- int error = mDevice.mHwc1Device->setActiveConfig(mDevice.mHwc1Device,
- mHwc1Id, static_cast<int>(configId));
- ALOGE_IF(error != 0,
- "setActiveConfig: Failed to set active config on HWC1 (%d)",
- error);
+ if (config == mActiveConfig) {
+ return Error::None;
}
+
+ if (mDevice.mHwc1MinorVersion >= 4) {
+ uint32_t hwc1Id = 0;
+ auto error = config->getHwc1IdForColorMode(mActiveColorMode, &hwc1Id);
+ if (error != Error::None) {
+ return error;
+ }
+
+ int intError = mDevice.mHwc1Device->setActiveConfig(mDevice.mHwc1Device,
+ mHwc1Id, static_cast<int>(hwc1Id));
+ if (intError != 0) {
+ ALOGE("setActiveConfig: Failed to set active config on HWC1 (%d)",
+ intError);
+ return Error::BadConfig;
+ }
+ mActiveConfig = config;
+ }
+
return Error::None;
}
Error HWC2On1Adapter::Display::setClientTarget(buffer_handle_t target,
- int32_t acquireFence, int32_t /*dataspace*/)
+ int32_t acquireFence, int32_t /*dataspace*/, hwc_region_t /*damage*/)
{
std::unique_lock<std::recursive_mutex> lock(mStateMutex);
ALOGV("[%" PRIu64 "] setClientTarget(%p, %d)", mId, target, acquireFence);
mClientTarget.setBuffer(target);
mClientTarget.setFence(acquireFence);
- // dataspace can't be used by HWC1, so ignore it
+ // dataspace and damage can't be used by HWC1, so ignore them
+ return Error::None;
+}
+
+Error HWC2On1Adapter::Display::setColorMode(int32_t mode)
+{
+ std::unique_lock<std::recursive_mutex> lock (mStateMutex);
+
+ ALOGV("[%" PRIu64 "] setColorMode(%d)", mId, mode);
+
+ if (mode == mActiveColorMode) {
+ return Error::None;
+ }
+ if (mColorModes.count(mode) == 0) {
+ ALOGE("[%" PRIu64 "] Mode %d not found in mColorModes", mId, mode);
+ return Error::Unsupported;
+ }
+
+ uint32_t hwc1Config = 0;
+ auto error = mActiveConfig->getHwc1IdForColorMode(mode, &hwc1Config);
+ if (error != Error::None) {
+ return error;
+ }
+
+ ALOGV("[%" PRIu64 "] Setting HWC1 config %u", mId, hwc1Config);
+ int intError = mDevice.mHwc1Device->setActiveConfig(mDevice.mHwc1Device,
+ mHwc1Id, hwc1Config);
+ if (intError != 0) {
+ ALOGE("[%" PRIu64 "] Failed to set HWC1 config (%d)", mId, intError);
+ return Error::Unsupported;
+ }
+
+ mActiveColorMode = mode;
+ return Error::None;
+}
+
+Error HWC2On1Adapter::Display::setColorTransform(android_color_transform_t hint)
+{
+ std::unique_lock<std::recursive_mutex> lock(mStateMutex);
+
+ ALOGV("%" PRIu64 "] setColorTransform(%d)", mId,
+ static_cast<int32_t>(hint));
+ mHasColorTransform = (hint != HAL_COLOR_TRANSFORM_IDENTITY);
return Error::None;
}
@@ -1002,7 +1088,17 @@
return Error::None;
}
-static constexpr uint32_t ATTRIBUTES[] = {
+static constexpr uint32_t ATTRIBUTES_WITH_COLOR[] = {
+ HWC_DISPLAY_VSYNC_PERIOD,
+ HWC_DISPLAY_WIDTH,
+ HWC_DISPLAY_HEIGHT,
+ HWC_DISPLAY_DPI_X,
+ HWC_DISPLAY_DPI_Y,
+ HWC_DISPLAY_COLOR_TRANSFORM,
+ HWC_DISPLAY_NO_ATTRIBUTE,
+};
+
+static constexpr uint32_t ATTRIBUTES_WITHOUT_COLOR[] = {
HWC_DISPLAY_VSYNC_PERIOD,
HWC_DISPLAY_WIDTH,
HWC_DISPLAY_HEIGHT,
@@ -1010,9 +1106,23 @@
HWC_DISPLAY_DPI_Y,
HWC_DISPLAY_NO_ATTRIBUTE,
};
-static constexpr size_t NUM_ATTRIBUTES = sizeof(ATTRIBUTES) / sizeof(uint32_t);
-static constexpr uint32_t ATTRIBUTE_MAP[] = {
+static constexpr size_t NUM_ATTRIBUTES_WITH_COLOR =
+ sizeof(ATTRIBUTES_WITH_COLOR) / sizeof(uint32_t);
+static_assert(sizeof(ATTRIBUTES_WITH_COLOR) > sizeof(ATTRIBUTES_WITHOUT_COLOR),
+ "Attribute tables have unexpected sizes");
+
+static constexpr uint32_t ATTRIBUTE_MAP_WITH_COLOR[] = {
+ 6, // HWC_DISPLAY_NO_ATTRIBUTE = 0
+ 0, // HWC_DISPLAY_VSYNC_PERIOD = 1,
+ 1, // HWC_DISPLAY_WIDTH = 2,
+ 2, // HWC_DISPLAY_HEIGHT = 3,
+ 3, // HWC_DISPLAY_DPI_X = 4,
+ 4, // HWC_DISPLAY_DPI_Y = 5,
+ 5, // HWC_DISPLAY_COLOR_TRANSFORM = 6,
+};
+
+static constexpr uint32_t ATTRIBUTE_MAP_WITHOUT_COLOR[] = {
5, // HWC_DISPLAY_NO_ATTRIBUTE = 0
0, // HWC_DISPLAY_VSYNC_PERIOD = 1,
1, // HWC_DISPLAY_WIDTH = 2,
@@ -1024,7 +1134,14 @@
template <uint32_t attribute>
static constexpr bool attributesMatch()
{
- return ATTRIBUTES[ATTRIBUTE_MAP[attribute]] == attribute;
+ bool match = (attribute ==
+ ATTRIBUTES_WITH_COLOR[ATTRIBUTE_MAP_WITH_COLOR[attribute]]);
+ if (attribute == HWC_DISPLAY_COLOR_TRANSFORM) {
+ return match;
+ }
+
+ return match && (attribute ==
+ ATTRIBUTES_WITHOUT_COLOR[ATTRIBUTE_MAP_WITHOUT_COLOR[attribute]]);
}
static_assert(attributesMatch<HWC_DISPLAY_VSYNC_PERIOD>(),
"Tables out of sync");
@@ -1032,6 +1149,8 @@
static_assert(attributesMatch<HWC_DISPLAY_HEIGHT>(), "Tables out of sync");
static_assert(attributesMatch<HWC_DISPLAY_DPI_X>(), "Tables out of sync");
static_assert(attributesMatch<HWC_DISPLAY_DPI_Y>(), "Tables out of sync");
+static_assert(attributesMatch<HWC_DISPLAY_COLOR_TRANSFORM>(),
+ "Tables out of sync");
void HWC2On1Adapter::Display::populateConfigs()
{
@@ -1052,52 +1171,74 @@
for (size_t c = 0; c < numConfigs; ++c) {
uint32_t hwc1ConfigId = configs[c];
- hwc2_config_t id = static_cast<hwc2_config_t>(mConfigs.size());
- mConfigs.emplace_back(
- std::make_shared<Config>(*this, id, hwc1ConfigId));
- auto& config = mConfigs[id];
+ auto newConfig = std::make_shared<Config>(*this);
- int32_t values[NUM_ATTRIBUTES] = {};
- mDevice.mHwc1Device->getDisplayAttributes(mDevice.mHwc1Device, mHwc1Id,
- hwc1ConfigId, ATTRIBUTES, values);
-
- config->setAttribute(Attribute::VsyncPeriod,
- values[ATTRIBUTE_MAP[HWC_DISPLAY_VSYNC_PERIOD]]);
- config->setAttribute(Attribute::Width,
- values[ATTRIBUTE_MAP[HWC_DISPLAY_WIDTH]]);
- config->setAttribute(Attribute::Height,
- values[ATTRIBUTE_MAP[HWC_DISPLAY_HEIGHT]]);
- config->setAttribute(Attribute::DpiX,
- values[ATTRIBUTE_MAP[HWC_DISPLAY_DPI_X]]);
- config->setAttribute(Attribute::DpiY,
- values[ATTRIBUTE_MAP[HWC_DISPLAY_DPI_Y]]);
-
- ALOGV("Found config: %s", config->toString().c_str());
- }
-
- ALOGV("Getting active config");
- if (mDevice.mHwc1Device->getActiveConfig != nullptr) {
- auto activeConfig = mDevice.mHwc1Device->getActiveConfig(
- mDevice.mHwc1Device, mHwc1Id);
- if (activeConfig >= 0) {
- ALOGV("Setting active config to %d", activeConfig);
- mActiveConfig = mConfigs[activeConfig];
+ int32_t values[NUM_ATTRIBUTES_WITH_COLOR] = {};
+ bool hasColor = true;
+ auto result = mDevice.mHwc1Device->getDisplayAttributes(
+ mDevice.mHwc1Device, mHwc1Id, hwc1ConfigId,
+ ATTRIBUTES_WITH_COLOR, values);
+ if (result != 0) {
+ mDevice.mHwc1Device->getDisplayAttributes(mDevice.mHwc1Device,
+ mHwc1Id, hwc1ConfigId, ATTRIBUTES_WITHOUT_COLOR, values);
+ hasColor = false;
}
- } else {
- ALOGV("getActiveConfig is null, choosing config 0");
- mActiveConfig = mConfigs[0];
+
+ auto attributeMap = hasColor ?
+ ATTRIBUTE_MAP_WITH_COLOR : ATTRIBUTE_MAP_WITHOUT_COLOR;
+
+ newConfig->setAttribute(Attribute::VsyncPeriod,
+ values[attributeMap[HWC_DISPLAY_VSYNC_PERIOD]]);
+ newConfig->setAttribute(Attribute::Width,
+ values[attributeMap[HWC_DISPLAY_WIDTH]]);
+ newConfig->setAttribute(Attribute::Height,
+ values[attributeMap[HWC_DISPLAY_HEIGHT]]);
+ newConfig->setAttribute(Attribute::DpiX,
+ values[attributeMap[HWC_DISPLAY_DPI_X]]);
+ newConfig->setAttribute(Attribute::DpiY,
+ values[attributeMap[HWC_DISPLAY_DPI_Y]]);
+ if (hasColor) {
+ newConfig->setAttribute(ColorTransform,
+ values[attributeMap[HWC_DISPLAY_COLOR_TRANSFORM]]);
+ }
+
+ // We can only do this after attempting to read the color transform
+ newConfig->setHwc1Id(hwc1ConfigId);
+
+ for (auto& existingConfig : mConfigs) {
+ if (existingConfig->merge(*newConfig)) {
+ ALOGV("Merged config %d with existing config %u: %s",
+ hwc1ConfigId, existingConfig->getId(),
+ existingConfig->toString().c_str());
+ newConfig.reset();
+ break;
+ }
+ }
+
+ // If it wasn't merged with any existing config, add it to the end
+ if (newConfig) {
+ newConfig->setId(static_cast<hwc2_config_t>(mConfigs.size()));
+ ALOGV("Found new config %u: %s", newConfig->getId(),
+ newConfig->toString().c_str());
+ mConfigs.emplace_back(std::move(newConfig));
+ }
}
+
+ initializeActiveConfig();
+ populateColorModes();
}
void HWC2On1Adapter::Display::populateConfigs(uint32_t width, uint32_t height)
{
std::unique_lock<std::recursive_mutex> lock(mStateMutex);
- mConfigs.emplace_back(std::make_shared<Config>(*this, 0, 0));
+ mConfigs.emplace_back(std::make_shared<Config>(*this));
auto& config = mConfigs[0];
config->setAttribute(Attribute::Width, static_cast<int32_t>(width));
config->setAttribute(Attribute::Height, static_cast<int32_t>(height));
+ config->setHwc1Id(0);
+ config->setId(0);
mActiveConfig = config;
}
@@ -1286,6 +1427,12 @@
}
}
+bool HWC2On1Adapter::Display::hasColorTransform() const
+{
+ std::unique_lock<std::recursive_mutex> lock(mStateMutex);
+ return mHasColorTransform;
+}
+
static std::string hwc1CompositionString(int32_t type)
{
switch (type) {
@@ -1475,17 +1622,23 @@
output << "Power mode: " << to_string(mPowerMode) << " ";
output << "Vsync: " << to_string(mVsyncEnabled) << '\n';
- output << " " << mConfigs.size() << " Config" <<
- (mConfigs.size() == 1 ? "" : "s") << " (* Active)\n";
- for (const auto& config : mConfigs) {
- if (config == mActiveConfig) {
- output << " * " << config->toString();
+ output << " Color modes [active]:";
+ for (const auto& mode : mColorModes) {
+ if (mode == mActiveColorMode) {
+ output << " [" << mode << ']';
} else {
- output << " " << config->toString();
+ output << " " << mode;
}
}
output << '\n';
+ output << " " << mConfigs.size() << " Config" <<
+ (mConfigs.size() == 1 ? "" : "s") << " (* active)\n";
+ for (const auto& config : mConfigs) {
+ output << (config == mActiveConfig ? " * " : " ");
+ output << config->toString(true) << '\n';
+ }
+
output << " " << mLayers.size() << " Layer" <<
(mLayers.size() == 1 ? "" : "s") << '\n';
for (const auto& layer : mLayers) {
@@ -1523,15 +1676,85 @@
return mAttributes.at(attribute);
}
-std::string HWC2On1Adapter::Display::Config::toString() const
+void HWC2On1Adapter::Display::Config::setHwc1Id(uint32_t id)
+{
+ int32_t colorTransform = getAttribute(ColorTransform);
+ mHwc1Ids.emplace(colorTransform, id);
+}
+
+bool HWC2On1Adapter::Display::Config::hasHwc1Id(uint32_t id) const
+{
+ for (const auto& idPair : mHwc1Ids) {
+ if (id == idPair.second) {
+ return true;
+ }
+ }
+ return false;
+}
+
+int32_t HWC2On1Adapter::Display::Config::getColorModeForHwc1Id(
+ uint32_t id) const
+{
+ for (const auto& idPair : mHwc1Ids) {
+ if (id == idPair.second) {
+ return idPair.first;
+ }
+ }
+ return -1;
+}
+
+Error HWC2On1Adapter::Display::Config::getHwc1IdForColorMode(int32_t mode,
+ uint32_t* outId) const
+{
+ for (const auto& idPair : mHwc1Ids) {
+ if (mode == idPair.first) {
+ *outId = idPair.second;
+ return Error::None;
+ }
+ }
+ ALOGE("Unable to find HWC1 ID for color mode %d on config %u", mode, mId);
+ return Error::BadParameter;
+}
+
+bool HWC2On1Adapter::Display::Config::merge(const Config& other)
+{
+ auto attributes = {HWC2::Attribute::Width, HWC2::Attribute::Height,
+ HWC2::Attribute::VsyncPeriod, HWC2::Attribute::DpiX,
+ HWC2::Attribute::DpiY};
+ for (auto attribute : attributes) {
+ if (getAttribute(attribute) != other.getAttribute(attribute)) {
+ return false;
+ }
+ }
+ int32_t otherColorTransform = other.getAttribute(ColorTransform);
+ if (mHwc1Ids.count(otherColorTransform) != 0) {
+ ALOGE("Attempted to merge two configs (%u and %u) which appear to be "
+ "identical", mHwc1Ids.at(otherColorTransform),
+ other.mHwc1Ids.at(otherColorTransform));
+ return false;
+ }
+ mHwc1Ids.emplace(otherColorTransform,
+ other.mHwc1Ids.at(otherColorTransform));
+ return true;
+}
+
+std::set<int32_t> HWC2On1Adapter::Display::Config::getColorTransforms() const
+{
+ std::set<int32_t> colorTransforms;
+ for (const auto& idPair : mHwc1Ids) {
+ colorTransforms.emplace(idPair.first);
+ }
+ return colorTransforms;
+}
+
+std::string HWC2On1Adapter::Display::Config::toString(bool splitLine) const
{
std::string output;
const size_t BUFFER_SIZE = 100;
char buffer[BUFFER_SIZE] = {};
auto writtenBytes = snprintf(buffer, BUFFER_SIZE,
- "[%u] %u x %u", mHwcId,
- mAttributes.at(HWC2::Attribute::Width),
+ "%u x %u", mAttributes.at(HWC2::Attribute::Width),
mAttributes.at(HWC2::Attribute::Height));
output.append(buffer, writtenBytes);
@@ -1552,6 +1775,31 @@
output.append(buffer, writtenBytes);
}
+ std::memset(buffer, 0, BUFFER_SIZE);
+ if (splitLine) {
+ writtenBytes = snprintf(buffer, BUFFER_SIZE,
+ "\n HWC1 ID/Color transform:");
+ } else {
+ writtenBytes = snprintf(buffer, BUFFER_SIZE,
+ ", HWC1 ID/Color transform:");
+ }
+ output.append(buffer, writtenBytes);
+
+
+ for (const auto& id : mHwc1Ids) {
+ int32_t colorTransform = id.first;
+ uint32_t hwc1Id = id.second;
+ std::memset(buffer, 0, BUFFER_SIZE);
+ if (colorTransform == mDisplay.mActiveColorMode) {
+ writtenBytes = snprintf(buffer, BUFFER_SIZE, " [%u/%d]", hwc1Id,
+ colorTransform);
+ } else {
+ writtenBytes = snprintf(buffer, BUFFER_SIZE, " %u/%d", hwc1Id,
+ colorTransform);
+ }
+ output.append(buffer, writtenBytes);
+ }
+
return output;
}
@@ -1564,6 +1812,49 @@
return mConfigs[configId];
}
+void HWC2On1Adapter::Display::populateColorModes()
+{
+ mColorModes = mConfigs[0]->getColorTransforms();
+ for (const auto& config : mConfigs) {
+ std::set<int32_t> intersection;
+ auto configModes = config->getColorTransforms();
+ std::set_intersection(mColorModes.cbegin(), mColorModes.cend(),
+ configModes.cbegin(), configModes.cend(),
+ std::inserter(intersection, intersection.begin()));
+ std::swap(intersection, mColorModes);
+ }
+}
+
+void HWC2On1Adapter::Display::initializeActiveConfig()
+{
+ if (mDevice.mHwc1Device->getActiveConfig == nullptr) {
+ ALOGV("getActiveConfig is null, choosing config 0");
+ mActiveConfig = mConfigs[0];
+ mActiveColorMode = -1;
+ return;
+ }
+
+ auto activeConfig = mDevice.mHwc1Device->getActiveConfig(
+ mDevice.mHwc1Device, mHwc1Id);
+ if (activeConfig >= 0) {
+ for (const auto& config : mConfigs) {
+ if (config->hasHwc1Id(activeConfig)) {
+ ALOGV("Setting active config to %d for HWC1 config %u",
+ config->getId(), activeConfig);
+ mActiveConfig = config;
+ mActiveColorMode = config->getColorModeForHwc1Id(activeConfig);
+ break;
+ }
+ }
+ if (!mActiveConfig) {
+ ALOGV("Unable to find active HWC1 config %u, defaulting to "
+ "config 0", activeConfig);
+ mActiveConfig = mConfigs[0];
+ mActiveColorMode = -1;
+ }
+ }
+}
+
void HWC2On1Adapter::Display::reallocateHwc1Contents()
{
// Allocate an additional layer for the framebuffer target
@@ -1688,6 +1979,7 @@
mZ(0),
mReleaseFence(),
mHwc1Id(0),
+ mHasUnsupportedDataspace(false),
mHasUnsupportedPlaneAlpha(false) {}
bool HWC2On1Adapter::SortLayersByZ::operator()(
@@ -1748,6 +2040,12 @@
return Error::None;
}
+Error HWC2On1Adapter::Layer::setDataspace(android_dataspace_t dataspace)
+{
+ mHasUnsupportedDataspace = (dataspace != HAL_DATASPACE_UNKNOWN);
+ return Error::None;
+}
+
Error HWC2On1Adapter::Layer::setDisplayFrame(hwc_rect_t frame)
{
mDisplayFrame.setPending(frame);
@@ -1976,7 +2274,11 @@
void HWC2On1Adapter::Layer::applyCompositionType(hwc_layer_1_t& hwc1Layer,
bool applyAllState)
{
- if (mHasUnsupportedPlaneAlpha) {
+ // HWC1 never supports color transforms or dataspaces and only sometimes
+ // supports plane alpha (depending on the version). These require us to drop
+ // some or all layers to client composition.
+ if (mHasUnsupportedDataspace || mHasUnsupportedPlaneAlpha ||
+ mDisplay.hasColorTransform()) {
hwc1Layer.compositionType = HWC_FRAMEBUFFER;
hwc1Layer.flags = HWC_SKIP_LAYER;
return;
diff --git a/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.h b/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.h
index 6fdb184..dc7c355 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.h
+++ b/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.h
@@ -77,7 +77,10 @@
HWC2::Error createVirtualDisplay(uint32_t width, uint32_t height,
hwc2_display_t* outDisplay);
static int32_t createVirtualDisplayHook(hwc2_device_t* device,
- uint32_t width, uint32_t height, hwc2_display_t* outDisplay) {
+ uint32_t width, uint32_t height, int32_t* /*format*/,
+ hwc2_display_t* outDisplay) {
+ // HWC1 implementations cannot override the buffer format requested by
+ // the consumer
auto error = getAdapter(device)->createVirtualDisplay(width, height,
outDisplay);
return static_cast<int32_t>(error);
@@ -191,6 +194,7 @@
HWC2::Attribute attribute, int32_t* outValue);
HWC2::Error getChangedCompositionTypes(uint32_t* outNumElements,
hwc2_layer_t* outLayers, int32_t* outTypes);
+ HWC2::Error getColorModes(uint32_t* outNumModes, int32_t* outModes);
HWC2::Error getConfigs(uint32_t* outNumConfigs,
hwc2_config_t* outConfigIds);
HWC2::Error getDozeSupport(int32_t* outSupport);
@@ -207,7 +211,10 @@
HWC2::Error present(int32_t* outRetireFence);
HWC2::Error setActiveConfig(hwc2_config_t configId);
HWC2::Error setClientTarget(buffer_handle_t target,
- int32_t acquireFence, int32_t dataspace);
+ int32_t acquireFence, int32_t dataspace,
+ hwc_region_t damage);
+ HWC2::Error setColorMode(int32_t mode);
+ HWC2::Error setColorTransform(android_color_transform_t hint);
HWC2::Error setOutputBuffer(buffer_handle_t buffer,
int32_t releaseFence);
HWC2::Error setPowerMode(HWC2::PowerMode mode);
@@ -231,34 +238,50 @@
void addRetireFence(int fenceFd);
void addReleaseFences(const hwc_display_contents_1& hwcContents);
+ bool hasColorTransform() const;
+
std::string dump() const;
private:
class Config {
public:
- Config(Display& display, hwc2_config_t id, uint32_t hwcId)
+ Config(Display& display)
: mDisplay(display),
- mId(id),
- mHwcId(hwcId),
mAttributes() {}
bool isOnDisplay(const Display& display) const {
return display.getId() == mDisplay.getId();
}
- hwc2_config_t getId() const { return mId; }
- uint32_t getHwcId() const { return mHwcId; }
-
void setAttribute(HWC2::Attribute attribute, int32_t value);
int32_t getAttribute(HWC2::Attribute attribute) const;
- std::string toString() const;
+ void setHwc1Id(uint32_t id);
+ bool hasHwc1Id(uint32_t id) const;
+ int32_t getColorModeForHwc1Id(uint32_t id) const;
+ HWC2::Error getHwc1IdForColorMode(int32_t mode,
+ uint32_t* outId) const;
+
+ void setId(hwc2_config_t id) { mId = id; }
+ hwc2_config_t getId() const { return mId; }
+
+ // Attempts to merge two configs that differ only in color
+ // mode. Returns whether the merge was successful
+ bool merge(const Config& other);
+
+ std::set<int32_t> getColorTransforms() const;
+
+ // splitLine divides the output into two lines suitable for
+ // dumpsys SurfaceFlinger
+ std::string toString(bool splitLine = false) const;
private:
Display& mDisplay;
- const hwc2_config_t mId;
- const uint32_t mHwcId;
+ hwc2_config_t mId;
std::unordered_map<HWC2::Attribute, int32_t> mAttributes;
+
+ // Maps from color transform to HWC1 config ID
+ std::unordered_map<int32_t, uint32_t> mHwc1Ids;
};
class Changes {
@@ -312,6 +335,9 @@
std::shared_ptr<const Config>
getConfig(hwc2_config_t configId) const;
+ void populateColorModes();
+ void initializeActiveConfig();
+
void reallocateHwc1Contents();
void assignHwc1LayerIds();
@@ -349,8 +375,11 @@
std::unique_ptr<Changes> mChanges;
int32_t mHwc1Id;
+
std::vector<std::shared_ptr<Config>> mConfigs;
std::shared_ptr<const Config> mActiveConfig;
+ std::set<int32_t> mColorModes;
+ int32_t mActiveColorMode;
std::string mName;
HWC2::DisplayType mType;
HWC2::PowerMode mPowerMode;
@@ -359,6 +388,8 @@
FencedBuffer mClientTarget;
FencedBuffer mOutputBuffer;
+ bool mHasColorTransform;
+
std::multiset<std::shared_ptr<Layer>, SortLayersByZ> mLayers;
std::unordered_map<size_t, std::shared_ptr<Layer>> mHwc1LayerMap;
};
@@ -390,6 +421,17 @@
config, attribute, outValue);
}
+ static int32_t setColorTransformHook(hwc2_device_t* device,
+ hwc2_display_t display, const float* /*matrix*/,
+ int32_t /*android_color_transform_t*/ intHint) {
+ // We intentionally throw away the matrix, because if the hint is
+ // anything other than IDENTITY, we have to fall back to client
+ // composition anyway
+ auto hint = static_cast<android_color_transform_t>(intHint);
+ return callDisplayFunction(device, display, &Display::setColorTransform,
+ hint);
+ }
+
static int32_t setPowerModeHook(hwc2_device_t* device,
hwc2_display_t display, int32_t intMode) {
auto mode = static_cast<HWC2::PowerMode>(intMode);
@@ -467,6 +509,7 @@
HWC2::Error setBlendMode(HWC2::BlendMode mode);
HWC2::Error setColor(hwc_color_t color);
HWC2::Error setCompositionType(HWC2::Composition type);
+ HWC2::Error setDataspace(android_dataspace_t dataspace);
HWC2::Error setDisplayFrame(hwc_rect_t frame);
HWC2::Error setPlaneAlpha(float alpha);
HWC2::Error setSidebandStream(const native_handle_t* stream);
@@ -523,6 +566,7 @@
DeferredFence mReleaseFence;
size_t mHwc1Id;
+ bool mHasUnsupportedDataspace;
bool mHasUnsupportedPlaneAlpha;
};
@@ -562,6 +606,13 @@
&Layer::setCompositionType, type);
}
+ static int32_t setLayerDataspaceHook(hwc2_device_t* device,
+ hwc2_display_t display, hwc2_layer_t layer, int32_t intDataspace) {
+ auto dataspace = static_cast<android_dataspace_t>(intDataspace);
+ return callLayerFunction(device, display, layer, &Layer::setDataspace,
+ dataspace);
+ }
+
static int32_t setLayerTransformHook(hwc2_device_t* device,
hwc2_display_t display, hwc2_layer_t layer, int32_t intTransform) {
auto transform = static_cast<HWC2::Transform>(intTransform);
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 0bec0b8..2629794 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -249,14 +249,15 @@
}
status_t HWComposer::allocateVirtualDisplay(uint32_t width, uint32_t height,
- int32_t *outId) {
+ android_pixel_format_t* format, int32_t *outId) {
if (mRemainingHwcVirtualDisplays == 0) {
ALOGE("allocateVirtualDisplay: No remaining virtual displays");
return NO_MEMORY;
}
std::shared_ptr<HWC2::Display> display;
- auto error = mHwcDevice->createVirtualDisplay(width, height, &display);
+ auto error = mHwcDevice->createVirtualDisplay(width, height, format,
+ &display);
if (error != HWC2::Error::None) {
ALOGE("allocateVirtualDisplay: Failed to create HWC virtual display");
return NO_MEMORY;
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index d407877..b88e250 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -84,7 +84,7 @@
// Attempts to allocate a virtual display. If the virtual display is created
// on the HWC device, outId will contain its HWC ID.
status_t allocateVirtualDisplay(uint32_t width, uint32_t height,
- int32_t* outId);
+ android_pixel_format_t* format, int32_t* outId);
// Attempts to create a new layer on this display
std::shared_ptr<HWC2::Layer> createLayer(int32_t displayId);
diff --git a/services/surfaceflinger/GpuService.cpp b/services/surfaceflinger/GpuService.cpp
index 0c29971..70d9682 100644
--- a/services/surfaceflinger/GpuService.cpp
+++ b/services/surfaceflinger/GpuService.cpp
@@ -104,7 +104,7 @@
VK_STRUCTURE_TYPE_APPLICATION_INFO, nullptr,
"vkjson", 1, /* app name, version */
"", 0, /* engine name, version */
- VK_API_VERSION
+ VK_API_VERSION_1_0
};
const VkInstanceCreateInfo instance_info = {
VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, nullptr,
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 96252f3..0247723 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -95,7 +95,8 @@
mQueueItems(),
mLastFrameNumberReceived(0),
mUpdateTexImageFailed(false),
- mAutoRefresh(false)
+ mAutoRefresh(false),
+ mFreezePositionUpdates(false)
{
#ifdef USE_HWC2
ALOGV("Creating Layer %s", name.string());
@@ -448,17 +449,10 @@
if (invTransformOrient & NATIVE_WINDOW_TRANSFORM_ROT_90) {
invTransformOrient ^= NATIVE_WINDOW_TRANSFORM_FLIP_V |
NATIVE_WINDOW_TRANSFORM_FLIP_H;
- // If the transform has been rotated the axis of flip has been swapped
- // so we need to swap which flip operations we are performing
- bool is_h_flipped = (invTransform & NATIVE_WINDOW_TRANSFORM_FLIP_H) != 0;
- bool is_v_flipped = (invTransform & NATIVE_WINDOW_TRANSFORM_FLIP_V) != 0;
- if (is_h_flipped != is_v_flipped) {
- invTransform ^= NATIVE_WINDOW_TRANSFORM_FLIP_V |
- NATIVE_WINDOW_TRANSFORM_FLIP_H;
- }
}
// and apply to the current transform
- invTransform = (Transform(invTransform) * Transform(invTransformOrient)).getOrientation();
+ invTransform = (Transform(invTransformOrient) * Transform(invTransform))
+ .getOrientation();
}
int winWidth = s.active.w;
@@ -645,23 +639,13 @@
*/
uint32_t invTransform =
DisplayDevice::getPrimaryDisplayOrientationTransform();
-
- uint32_t t_orientation = transform.getOrientation();
// calculate the inverse transform
if (invTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) {
invTransform ^= NATIVE_WINDOW_TRANSFORM_FLIP_V |
NATIVE_WINDOW_TRANSFORM_FLIP_H;
- // If the transform has been rotated the axis of flip has been swapped
- // so we need to swap which flip operations we are performing
- bool is_h_flipped = (t_orientation & NATIVE_WINDOW_TRANSFORM_FLIP_H) != 0;
- bool is_v_flipped = (t_orientation & NATIVE_WINDOW_TRANSFORM_FLIP_V) != 0;
- if (is_h_flipped != is_v_flipped) {
- t_orientation ^= NATIVE_WINDOW_TRANSFORM_FLIP_V |
- NATIVE_WINDOW_TRANSFORM_FLIP_H;
- }
}
// and apply to the current transform
- transform = Transform(t_orientation) * Transform(invTransform);
+ transform = Transform(invTransform) * transform;
}
// this gives us only the "orientation" component of the transform
@@ -721,53 +705,50 @@
surfaceDamageRegion.dump(LOG_TAG);
}
- auto compositionType = HWC2::Composition::Invalid;
+ // Sideband layers
if (mSidebandStream.get()) {
- compositionType = HWC2::Composition::Sideband;
- auto error = hwcLayer->setSidebandStream(mSidebandStream->handle());
+ setCompositionType(hwcId, HWC2::Composition::Sideband);
+ ALOGV("[%s] Requesting Sideband composition", mName.string());
+ error = hwcLayer->setSidebandStream(mSidebandStream->handle());
if (error != HWC2::Error::None) {
ALOGE("[%s] Failed to set sideband stream %p: %s (%d)",
mName.string(), mSidebandStream->handle(),
to_string(error).c_str(), static_cast<int32_t>(error));
- return;
}
- } else {
- if (mActiveBuffer == nullptr || mActiveBuffer->handle == nullptr) {
- compositionType = HWC2::Composition::Client;
- auto error = hwcLayer->setBuffer(nullptr, Fence::NO_FENCE);
- if (error != HWC2::Error::None) {
- ALOGE("[%s] Failed to set null buffer: %s (%d)", mName.string(),
- to_string(error).c_str(), static_cast<int32_t>(error));
- return;
- }
- } else {
- if (mPotentialCursor) {
- compositionType = HWC2::Composition::Cursor;
- }
- auto acquireFence = mSurfaceFlingerConsumer->getCurrentFence();
- auto error = hwcLayer->setBuffer(mActiveBuffer->handle,
- acquireFence);
- if (error != HWC2::Error::None) {
- ALOGE("[%s] Failed to set buffer %p: %s (%d)", mName.string(),
- mActiveBuffer->handle, to_string(error).c_str(),
- static_cast<int32_t>(error));
- return;
- }
- // If it's not a cursor, default to device composition
- }
+ return;
}
- if (mHwcLayers[hwcId].forceClientComposition) {
- ALOGV("[%s] Forcing Client composition", mName.string());
+ // Client or SolidColor layers
+ if (mActiveBuffer == nullptr || mActiveBuffer->handle == nullptr ||
+ mHwcLayers[hwcId].forceClientComposition) {
+ // TODO: This also includes solid color layers, but no API exists to
+ // setup a solid color layer yet
+ ALOGV("[%s] Requesting Client composition", mName.string());
setCompositionType(hwcId, HWC2::Composition::Client);
- } else if (compositionType != HWC2::Composition::Invalid) {
- ALOGV("[%s] Requesting %s composition", mName.string(),
- to_string(compositionType).c_str());
- setCompositionType(hwcId, compositionType);
+ error = hwcLayer->setBuffer(nullptr, Fence::NO_FENCE);
+ if (error != HWC2::Error::None) {
+ ALOGE("[%s] Failed to set null buffer: %s (%d)", mName.string(),
+ to_string(error).c_str(), static_cast<int32_t>(error));
+ }
+ return;
+ }
+
+ // Device or Cursor layers
+ if (mPotentialCursor) {
+ ALOGV("[%s] Requesting Cursor composition", mName.string());
+ setCompositionType(hwcId, HWC2::Composition::Cursor);
} else {
ALOGV("[%s] Requesting Device composition", mName.string());
setCompositionType(hwcId, HWC2::Composition::Device);
}
+
+ auto acquireFence = mSurfaceFlingerConsumer->getCurrentFence();
+ error = hwcLayer->setBuffer(mActiveBuffer->handle, acquireFence);
+ if (error != HWC2::Error::None) {
+ ALOGE("[%s] Failed to set buffer %p: %s (%d)", mName.string(),
+ mActiveBuffer->handle, to_string(error).c_str(),
+ static_cast<int32_t>(error));
+ }
}
#else
void Layer::setPerFrameData(const sp<const DisplayDevice>& hw,
@@ -1435,11 +1416,9 @@
c.requested.w, c.requested.h);
}
+ const bool resizePending = (c.requested.w != c.active.w) ||
+ (c.requested.h != c.active.h);
if (!isFixedSize()) {
-
- const bool resizePending = (c.requested.w != c.active.w) ||
- (c.requested.h != c.active.h);
-
if (resizePending && mSidebandStream == NULL) {
// don't let Layer::doTransaction update the drawing state
// if we have a pending resize, unless we are in fixed-size mode.
@@ -1462,7 +1441,17 @@
// this is used by Layer, which special cases resizes.
if (flags & eDontUpdateGeometryState) {
} else {
- c.active = c.requested;
+ Layer::State& editCurrentState(getCurrentState());
+ if (mFreezePositionUpdates) {
+ float tx = c.active.transform.tx();
+ float ty = c.active.transform.ty();
+ c.active = c.requested;
+ c.active.transform.set(tx, ty);
+ editCurrentState.active = c.active;
+ } else {
+ editCurrentState.active = editCurrentState.requested;
+ c.active = c.requested;
+ }
}
if (s.active != c.active) {
@@ -1509,7 +1498,7 @@
return android_atomic_or(flags, &mTransactionFlags);
}
-bool Layer::setPosition(float x, float y) {
+bool Layer::setPosition(float x, float y, bool immediate) {
if (mCurrentState.requested.transform.tx() == x && mCurrentState.requested.transform.ty() == y)
return false;
mCurrentState.sequence++;
@@ -1518,12 +1507,16 @@
// we want to apply the position portion of the transform matrix immediately,
// but still delay scaling when resizing a SCALING_MODE_FREEZE layer.
mCurrentState.requested.transform.set(x, y);
- mCurrentState.active.transform.set(x, y);
+ if (immediate && !mFreezePositionUpdates) {
+ mCurrentState.active.transform.set(x, y);
+ }
+ mFreezePositionUpdates = mFreezePositionUpdates || !immediate;
mCurrentState.modified = true;
setTransactionFlags(eTransactionNeeded);
return true;
}
+
bool Layer::setLayer(uint32_t z) {
if (mCurrentState.z == z)
return false;
@@ -1603,6 +1596,7 @@
if (scalingMode == mOverrideScalingMode)
return false;
mOverrideScalingMode = scalingMode;
+ setTransactionFlags(eTransactionNeeded);
return true;
}
@@ -1820,6 +1814,7 @@
// NOTE: We don't need to hold the transaction lock here
// because State::active is only accessed from this thread.
current.active = front.active;
+ current.modified = true;
// recompute visible region
recomputeVisibleRegions = true;
@@ -2021,6 +2016,7 @@
if (bufWidth != uint32_t(oldActiveBuffer->width) ||
bufHeight != uint32_t(oldActiveBuffer->height)) {
recomputeVisibleRegions = true;
+ mFreezePositionUpdates = false;
}
}
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 7d085a4..ba7184f 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -145,7 +145,7 @@
status_t setBuffers(uint32_t w, uint32_t h, PixelFormat format, uint32_t flags);
// modify current state
- bool setPosition(float x, float y);
+ bool setPosition(float x, float y, bool immediate);
bool setLayer(uint32_t z);
bool setSize(uint32_t w, uint32_t h);
#ifdef USE_HWC2
@@ -596,6 +596,7 @@
bool mUpdateTexImageFailed; // This is only modified from the main thread
bool mAutoRefresh;
+ bool mFreezePositionUpdates;
};
// ---------------------------------------------------------------------------
diff --git a/services/surfaceflinger/MessageQueue.cpp b/services/surfaceflinger/MessageQueue.cpp
index 99efd39..34dc24b 100644
--- a/services/surfaceflinger/MessageQueue.cpp
+++ b/services/surfaceflinger/MessageQueue.cpp
@@ -61,12 +61,6 @@
}
}
-void MessageQueue::Handler::dispatchTransaction() {
- if ((android_atomic_or(eventMaskTransaction, &mEventMask) & eventMaskTransaction) == 0) {
- mQueue.mLooper->sendMessage(this, Message(MessageQueue::TRANSACTION));
- }
-}
-
void MessageQueue::Handler::handleMessage(const Message& message) {
switch (message.what) {
case INVALIDATE:
@@ -77,10 +71,6 @@
android_atomic_and(~eventMaskRefresh, &mEventMask);
mQueue.mFlinger->onMessageReceived(message.what);
break;
- case TRANSACTION:
- android_atomic_and(~eventMaskTransaction, &mEventMask);
- mQueue.mFlinger->onMessageReceived(message.what);
- break;
}
}
@@ -155,10 +145,6 @@
*/
#define INVALIDATE_ON_VSYNC 1
-void MessageQueue::invalidateTransactionNow() {
- mHandler->dispatchTransaction();
-}
-
void MessageQueue::invalidate() {
#if INVALIDATE_ON_VSYNC
mEvents->requestNextVsync();
diff --git a/services/surfaceflinger/MessageQueue.h b/services/surfaceflinger/MessageQueue.h
index b77e08e..1004f4c 100644
--- a/services/surfaceflinger/MessageQueue.h
+++ b/services/surfaceflinger/MessageQueue.h
@@ -73,7 +73,6 @@
virtual void handleMessage(const Message& message);
void dispatchRefresh();
void dispatchInvalidate();
- void dispatchTransaction();
};
friend class Handler;
@@ -93,7 +92,6 @@
enum {
INVALIDATE = 0,
REFRESH = 1,
- TRANSACTION = 2
};
MessageQueue();
@@ -108,8 +106,6 @@
void invalidate();
// sends REFRESH message at next VSYNC
void refresh();
- // sends TRANSACTION message immediately
- void invalidateTransactionNow();
};
// ---------------------------------------------------------------------------
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index a69b11b..a10a813 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -903,10 +903,6 @@
void SurfaceFlinger::onMessageReceived(int32_t what) {
ATRACE_CALL();
switch (what) {
- case MessageQueue::TRANSACTION: {
- handleMessageTransaction();
- break;
- }
case MessageQueue::INVALIDATE: {
bool refreshNeeded = handleMessageTransaction();
refreshNeeded |= handleMessageInvalidate();
@@ -1477,10 +1473,19 @@
NATIVE_WINDOW_HEIGHT, &height);
ALOGE_IF(status != NO_ERROR,
"Unable to query height (%d)", status);
+ int intFormat = 0;
+ status = state.surface->query(
+ NATIVE_WINDOW_FORMAT, &intFormat);
+ ALOGE_IF(status != NO_ERROR,
+ "Unable to query format (%d)", status);
+ auto format = static_cast<android_pixel_format_t>(
+ intFormat);
- mHwc->allocateVirtualDisplay(width, height,
+ mHwc->allocateVirtualDisplay(width, height, &format,
&hwcId);
+ // TODO: Plumb requested format back up to consumer
+
sp<VirtualDisplaySurface> vds =
new VirtualDisplaySurface(*mHwc,
hwcId, state.surface, bqProducer,
@@ -1719,17 +1724,13 @@
// Remove the transparent area from the visible region
if (translucent) {
const Transform tr(s.active.transform);
- if (tr.transformed()) {
- if (tr.preserveRects()) {
- // transform the transparent region
- transparentRegion = tr.transform(s.activeTransparentRegion);
- } else {
- // transformation too complex, can't do the
- // transparent region optimization.
- transparentRegion.clear();
- }
+ if (tr.preserveRects()) {
+ // transform the transparent region
+ transparentRegion = tr.transform(s.activeTransparentRegion);
} else {
- transparentRegion = s.activeTransparentRegion;
+ // transformation too complex, can't do the
+ // transparent region optimization.
+ transparentRegion.clear();
}
}
@@ -2160,6 +2161,13 @@
}
}
+ // If a synchronous transaction is explicitly requested without any changes,
+ // force a transaction anyway. This can be used as a flush mechanism for
+ // previous async transactions.
+ if (transactionFlags == 0 && (flags & eSynchronous)) {
+ transactionFlags = eTransactionNeeded;
+ }
+
if (transactionFlags) {
// this triggers the transaction
setTransactionFlags(transactionFlags);
@@ -2243,9 +2251,12 @@
sp<Layer> layer(client->getLayerUser(s.surface));
if (layer != 0) {
const uint32_t what = s.what;
+ bool positionAppliesWithResize =
+ what & layer_state_t::ePositionAppliesWithResize;
if (what & layer_state_t::ePositionChanged) {
- if (layer->setPosition(s.x, s.y))
+ if (layer->setPosition(s.x, s.y, !positionAppliesWithResize)) {
flags |= eTraversalNeeded;
+ }
}
if (what & layer_state_t::eLayerChanged) {
// NOTE: index needs to be calculated before we update the state
@@ -3278,13 +3289,6 @@
}
};
- // make sure to process transactions before screenshots -- a transaction
- // might already be pending but scheduled for VSYNC; this guarantees we
- // will handle it before the screenshot. When VSYNC finally arrives
- // the scheduled transaction will be a no-op. If no transactions are
- // scheduled at this time, this will end-up being a no-op as well.
- mEventQueue.invalidateTransactionNow();
-
// this creates a "fake" BBinder which will serve as a "fake" remote
// binder to receive the marshaled calls and forward them to the
// real remote (a BpGraphicBufferProducer)
diff --git a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
index 00700ab..7f3b269 100644
--- a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
+++ b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
@@ -907,10 +907,6 @@
void SurfaceFlinger::onMessageReceived(int32_t what) {
ATRACE_CALL();
switch (what) {
- case MessageQueue::TRANSACTION: {
- handleMessageTransaction();
- break;
- }
case MessageQueue::INVALIDATE: {
bool refreshNeeded = handleMessageTransaction();
refreshNeeded |= handleMessageInvalidate();
@@ -1747,17 +1743,13 @@
// Remove the transparent area from the visible region
if (translucent) {
const Transform tr(s.active.transform);
- if (tr.transformed()) {
- if (tr.preserveRects()) {
- // transform the transparent region
- transparentRegion = tr.transform(s.activeTransparentRegion);
- } else {
- // transformation too complex, can't do the
- // transparent region optimization.
- transparentRegion.clear();
- }
+ if (tr.preserveRects()) {
+ // transform the transparent region
+ transparentRegion = tr.transform(s.activeTransparentRegion);
} else {
- transparentRegion = s.activeTransparentRegion;
+ // transformation too complex, can't do the
+ // transparent region optimization.
+ transparentRegion.clear();
}
}
@@ -2185,6 +2177,13 @@
}
}
+ // If a synchronous transaction is explicitly requested without any changes,
+ // force a transaction anyway. This can be used as a flush mechanism for
+ // previous async transactions.
+ if (transactionFlags == 0 && (flags & eSynchronous)) {
+ transactionFlags = eTransactionNeeded;
+ }
+
if (transactionFlags) {
// this triggers the transaction
setTransactionFlags(transactionFlags);
@@ -2268,9 +2267,12 @@
sp<Layer> layer(client->getLayerUser(s.surface));
if (layer != 0) {
const uint32_t what = s.what;
+ bool positionAppliesWithResize =
+ what & layer_state_t::ePositionAppliesWithResize;
if (what & layer_state_t::ePositionChanged) {
- if (layer->setPosition(s.x, s.y))
+ if (layer->setPosition(s.x, s.y, !positionAppliesWithResize)) {
flags |= eTraversalNeeded;
+ }
}
if (what & layer_state_t::eLayerChanged) {
// NOTE: index needs to be calculated before we update the state
@@ -3301,13 +3303,6 @@
}
};
- // make sure to process transactions before screenshots -- a transaction
- // might already be pending but scheduled for VSYNC; this guarantees we
- // will handle it before the screenshot. When VSYNC finally arrives
- // the scheduled transaction will be a no-op. If no transactions are
- // scheduled at this time, this will end-up being a no-op as well.
- mEventQueue.invalidateTransactionNow();
-
// this creates a "fake" BBinder which will serve as a "fake" remote
// binder to receive the marshaled calls and forward them to the
// real remote (a BpGraphicBufferProducer)
diff --git a/services/surfaceflinger/Transform.cpp b/services/surfaceflinger/Transform.cpp
index 35e7e7d..c2be91d 100644
--- a/services/surfaceflinger/Transform.cpp
+++ b/services/surfaceflinger/Transform.cpp
@@ -87,10 +87,6 @@
return mMatrix[i];
}
-bool Transform::transformed() const {
- return type() > TRANSLATE;
-}
-
float Transform::tx() const {
return mMatrix[2][0];
}
@@ -224,7 +220,7 @@
Region Transform::transform(const Region& reg) const
{
Region out;
- if (CC_UNLIKELY(transformed())) {
+ if (CC_UNLIKELY(type() > TRANSLATE)) {
if (CC_LIKELY(preserveRects())) {
Region::const_iterator it = reg.begin();
Region::const_iterator const end = reg.end();
diff --git a/services/surfaceflinger/Transform.h b/services/surfaceflinger/Transform.h
index 9efeb9e..90855da 100644
--- a/services/surfaceflinger/Transform.h
+++ b/services/surfaceflinger/Transform.h
@@ -60,7 +60,6 @@
};
// query the transform
- bool transformed() const;
bool preserveRects() const;
uint32_t getType() const;
uint32_t getOrientation() const;
diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp
index 320fddb..f8d4d13 100644
--- a/services/surfaceflinger/tests/Transaction_test.cpp
+++ b/services/surfaceflinger/tests/Transaction_test.cpp
@@ -66,6 +66,8 @@
sp<ISurfaceComposer> sf(ComposerService::getComposerService());
sp<IBinder> display(sf->getBuiltInDisplay(
ISurfaceComposer::eDisplayIdMain));
+ SurfaceComposerClient::openGlobalTransaction();
+ SurfaceComposerClient::closeGlobalTransaction(true);
ASSERT_EQ(NO_ERROR, sf->captureScreen(display, producer, Rect(), 0, 0,
0, INT_MAX, false));
*sc = new ScreenCapture(cpuConsumer);
diff --git a/vulkan/api/vulkan.api b/vulkan/api/vulkan.api
index ae690a3..870f8eb 100644
--- a/vulkan/api/vulkan.api
+++ b/vulkan/api/vulkan.api
@@ -28,7 +28,7 @@
// API version (major.minor.patch)
define VERSION_MAJOR 1
define VERSION_MINOR 0
-define VERSION_PATCH 3
+define VERSION_PATCH 13
// API limits
define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256
@@ -48,7 +48,7 @@
@extension("VK_KHR_surface") define VK_KHR_SURFACE_SPEC_VERSION 25
@extension("VK_KHR_surface") define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface"
-@extension("VK_KHR_swapchain") define VK_KHR_SWAPCHAIN_SPEC_VERSION 67
+@extension("VK_KHR_swapchain") define VK_KHR_SWAPCHAIN_SPEC_VERSION 68
@extension("VK_KHR_swapchain") define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain"
@extension("VK_KHR_display") define VK_KHR_DISPLAY_SPEC_VERSION 21
@@ -78,9 +78,24 @@
@extension("VK_ANDROID_native_buffer") define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 5
@extension("VK_ANDROID_native_buffer") define VK_ANDROID_NATIVE_BUFFER_NAME "VK_ANDROID_native_buffer"
-@extension("VK_EXT_debug_report") define VK_EXT_DEBUG_REPORT_SPEC_VERSION 1
+@extension("VK_EXT_debug_report") define VK_EXT_DEBUG_REPORT_SPEC_VERSION 2
@extension("VK_EXT_debug_report") define VK_EXT_DEBUG_REPORT_NAME "VK_EXT_debug_report"
+@extension("VK_NV_glsl_shader") define VK_NV_GLSL_SHADER_SPEC_VERSION 1
+@extension("VK_NV_glsl_shader") define VK_NV_GLSL_SHADER_NAME "VK_NV_glsl_shader"
+
+@extension("VK_KHR_sampler_mirror_clamp_to_edge") define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 1
+@extension("VK_KHR_sampler_mirror_clamp_to_edge") define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_NAME "VK_KHR_sampler_mirror_clamp_to_edge"
+
+@extension("VK_IMG_filter_cubic") define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1
+@extension("VK_IMG_filter_cubic") define VK_IMG_FILTER_CUBIC_NAME "VK_IMG_filter_cubic"
+
+@extension("VK_AMD_rasterization_order") define VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION 1
+@extension("VK_AMD_rasterization_order") define VK_AMD_RASTERIZATION_ORDER_NAME "VK_AMD_rasterization_order"
+
+@extension("VK_EXT_debug_marker") define VK_EXT_DEBUG_MARKER_SPEC_VERSION 3
+@extension("VK_EXT_debug_marker") define VK_EXT_DEBUG_MARKER_NAME "VK_EXT_debug_marker"
+
/////////////
// Types //
@@ -257,6 +272,9 @@
enum VkFilter {
VK_FILTER_NEAREST = 0x00000000,
VK_FILTER_LINEAR = 0x00000001,
+
+ //@extension("VK_IMG_filter_cubic")
+ VK_FILTER_CUBIC_IMG = 1000015000,
}
enum VkSamplerMipmapMode {
@@ -653,7 +671,19 @@
VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID = 1000010000,
//@extension("VK_EXT_debug_report")
- VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = 1000011000,
+ VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000,
+
+ //@extension("VK_AMD_rasterization_order")
+ VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD = 1000018000,
+
+ //@extension("VK_EXT_debug_marker")
+ VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000,
+
+ //@extension("VK_EXT_debug_marker")
+ VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001,
+
+ //@extension("VK_EXT_debug_marker")
+ VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002,
}
enum VkSubpassContents {
@@ -706,6 +736,9 @@
//@extension("VK_EXT_debug_report")
VK_ERROR_VALIDATION_FAILED_EXT = 0xC4650B07, // -1000011001
+
+ //@extension("VK_NV_glsl_shader")
+ VK_ERROR_INVALID_SHADER_NV = 0xC4650720, // -1000012000
}
enum VkDynamicState {
@@ -772,6 +805,12 @@
VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT = 1,
}
+@extension("VK_AMD_rasterization_order")
+enum VkRasterizationOrderAMD {
+ VK_RASTERIZATION_ORDER_STRICT_AMD = 0,
+ VK_RASTERIZATION_ORDER_RELAXED_AMD = 1,
+}
+
/////////////////
// Bitfields //
@@ -943,6 +982,9 @@
VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, /// Format can be used as the source image of blits with vkCommandBlitImage
VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, /// Format can be used as the destination image of blits with vkCommandBlitImage
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000,
+
+ //@extension("VK_IMG_filter_cubic")
+ VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 0x00002000,
}
/// Query control flags
@@ -2616,6 +2658,41 @@
void* pUserData
}
+@extension("VK_AMD_rasterization_order")
+class VkPipelineRasterizationStateRasterizationOrderAMD {
+ VkStructureType sType
+ const void* pNext
+ VkRasterizationOrderAMD rasterizationOrder
+}
+
+@extension("VK_EXT_debug_marker")
+class VkDebugMarkerObjectNameInfoEXT {
+ VkStructureType sType
+ const void* pNext
+ VkDebugReportObjectTypeEXT objectType
+ u64 object
+ const char* pObjectName
+}
+
+@extension("VK_EXT_debug_marker")
+class VkDebugMarkerObjectTagInfoEXT {
+ VkStructureType sType
+ const void* pNext
+ VkDebugReportObjectTypeEXT objectType
+ u64 object
+ u64 tagName
+ platform.size_t tagSize
+ const void* pTag
+}
+
+@extension("VK_EXT_debug_marker")
+class VkDebugMarkerMarkerInfoEXT {
+ VkStructureType sType
+ const void* pNext
+ const char* pMarkerName
+ f32[4] color
+}
+
////////////////
// Commands //
@@ -5222,6 +5299,37 @@
const char* pMessage) {
}
+@extension("VK_EXT_debug_marker")
+cmd VkResult vkDebugMarkerSetObjectTagEXT(
+ VkDevice device,
+ VkDebugMarkerObjectTagInfoEXT* pTagInfo) {
+ return ?
+}
+
+@extension("VK_EXT_debug_marker")
+cmd VkResult vkDebugMarkerSetObjectNameEXT(
+ VkDevice device,
+ VkDebugMarkerObjectNameInfoEXT* pNameInfo) {
+ return ?
+}
+
+@extension("VK_EXT_debug_marker")
+cmd void vkCmdDebugMarkerBeginEXT(
+ VkCommandBuffer commandBuffer,
+ VkDebugMarkerMarkerInfoEXT* pMarkerInfo) {
+}
+
+@extension("VK_EXT_debug_marker")
+cmd void vkCmdDebugMarkerEndEXT(
+ VkCommandBuffer commandBuffer) {
+}
+
+@extension("VK_EXT_debug_marker")
+cmd void vkCmdDebugMarkerInsertEXT(
+ VkCommandBuffer commandBuffer,
+ VkDebugMarkerMarkerInfoEXT* pMarkerInfo) {
+}
+
////////////////
// Validation //
diff --git a/vulkan/include/vulkan/vk_platform.h b/vulkan/include/vulkan/vk_platform.h
index a53e725..5d0fc76 100644
--- a/vulkan/include/vulkan/vk_platform.h
+++ b/vulkan/include/vulkan/vk_platform.h
@@ -4,29 +4,22 @@
/*
** Copyright (c) 2014-2015 The Khronos Group Inc.
**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
+** 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
**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
+** http://www.apache.org/licenses/LICENSE-2.0
**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+** 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.
*/
-#ifndef __VK_PLATFORM_H__
-#define __VK_PLATFORM_H__
+#ifndef VK_PLATFORM_H_
+#define VK_PLATFORM_H_
#ifdef __cplusplus
extern "C"
@@ -124,4 +117,4 @@
#include <xcb/xcb.h>
#endif
-#endif // __VK_PLATFORM_H__
+#endif
diff --git a/vulkan/include/vulkan/vulkan.h b/vulkan/include/vulkan/vulkan.h
index cd6a71a..2f18076 100644
--- a/vulkan/include/vulkan/vulkan.h
+++ b/vulkan/include/vulkan/vulkan.h
@@ -1,5 +1,5 @@
-#ifndef __vulkan_h_
-#define __vulkan_h_ 1
+#ifndef VULKAN_H_
+#define VULKAN_H_ 1
#ifdef __cplusplus
extern "C" {
@@ -8,24 +8,17 @@
/*
** Copyright (c) 2015-2016 The Khronos Group Inc.
**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
+** 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
**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
+** http://www.apache.org/licenses/LICENSE-2.0
**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+** 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.
*/
/*
@@ -40,12 +33,18 @@
#define VK_MAKE_VERSION(major, minor, patch) \
(((major) << 22) | ((minor) << 12) | (patch))
-// Vulkan API version supported by this file
-#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 3)
+// DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead.
+//#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0)
+
+// Vulkan 1.0 version number
+#define VK_API_VERSION_1_0 VK_MAKE_VERSION(1, 0, 0)
#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22)
#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff)
#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff)
+// Version of this file
+#define VK_HEADER_VERSION 13
+
#define VK_NULL_HANDLE 0
@@ -142,6 +141,7 @@
VK_ERROR_OUT_OF_DATE_KHR = -1000001004,
VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
+ VK_ERROR_INVALID_SHADER_NV = -1000012000,
VK_RESULT_BEGIN_RANGE = VK_ERROR_FORMAT_NOT_SUPPORTED,
VK_RESULT_END_RANGE = VK_INCOMPLETE,
VK_RESULT_RANGE_SIZE = (VK_INCOMPLETE - VK_ERROR_FORMAT_NOT_SUPPORTED + 1),
@@ -209,7 +209,11 @@
VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000,
VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000,
VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
- VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = 1000011000,
+ VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000,
+ VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD = 1000018000,
+ VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000,
+ VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001,
+ VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002,
VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO,
VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO,
VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1),
@@ -679,6 +683,7 @@
typedef enum VkFilter {
VK_FILTER_NEAREST = 0,
VK_FILTER_LINEAR = 1,
+ VK_FILTER_CUBIC_IMG = 1000015000,
VK_FILTER_BEGIN_RANGE = VK_FILTER_NEAREST,
VK_FILTER_END_RANGE = VK_FILTER_LINEAR,
VK_FILTER_RANGE_SIZE = (VK_FILTER_LINEAR - VK_FILTER_NEAREST + 1),
@@ -701,8 +706,8 @@
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3,
VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4,
VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE = VK_SAMPLER_ADDRESS_MODE_REPEAT,
- VK_SAMPLER_ADDRESS_MODE_END_RANGE = VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE,
- VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1),
+ VK_SAMPLER_ADDRESS_MODE_END_RANGE = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER,
+ VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1),
VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7FFFFFFF
} VkSamplerAddressMode;
@@ -808,6 +813,8 @@
VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400,
VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000,
+ VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 0x00002000,
+ VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkFormatFeatureFlagBits;
typedef VkFlags VkFormatFeatureFlags;
@@ -820,6 +827,7 @@
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020,
VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040,
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080,
+ VK_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkImageUsageFlagBits;
typedef VkFlags VkImageUsageFlags;
@@ -829,6 +837,7 @@
VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004,
VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008,
VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010,
+ VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkImageCreateFlagBits;
typedef VkFlags VkImageCreateFlags;
@@ -840,6 +849,7 @@
VK_SAMPLE_COUNT_16_BIT = 0x00000010,
VK_SAMPLE_COUNT_32_BIT = 0x00000020,
VK_SAMPLE_COUNT_64_BIT = 0x00000040,
+ VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkSampleCountFlagBits;
typedef VkFlags VkSampleCountFlags;
@@ -848,6 +858,7 @@
VK_QUEUE_COMPUTE_BIT = 0x00000002,
VK_QUEUE_TRANSFER_BIT = 0x00000004,
VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008,
+ VK_QUEUE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkQueueFlagBits;
typedef VkFlags VkQueueFlags;
@@ -857,11 +868,13 @@
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004,
VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008,
VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010,
+ VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkMemoryPropertyFlagBits;
typedef VkFlags VkMemoryPropertyFlags;
typedef enum VkMemoryHeapFlagBits {
VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001,
+ VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkMemoryHeapFlagBits;
typedef VkFlags VkMemoryHeapFlags;
typedef VkFlags VkDeviceCreateFlags;
@@ -885,6 +898,7 @@
VK_PIPELINE_STAGE_HOST_BIT = 0x00004000,
VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00008000,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000,
+ VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkPipelineStageFlagBits;
typedef VkFlags VkPipelineStageFlags;
typedef VkFlags VkMemoryMapFlags;
@@ -894,6 +908,7 @@
VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
+ VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkImageAspectFlagBits;
typedef VkFlags VkImageAspectFlags;
@@ -901,16 +916,19 @@
VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001,
VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x00000002,
VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004,
+ VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkSparseImageFormatFlagBits;
typedef VkFlags VkSparseImageFormatFlags;
typedef enum VkSparseMemoryBindFlagBits {
VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001,
+ VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkSparseMemoryBindFlagBits;
typedef VkFlags VkSparseMemoryBindFlags;
typedef enum VkFenceCreateFlagBits {
VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
+ VK_FENCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkFenceCreateFlagBits;
typedef VkFlags VkFenceCreateFlags;
typedef VkFlags VkSemaphoreCreateFlags;
@@ -929,6 +947,7 @@
VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100,
VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200,
VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400,
+ VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkQueryPipelineStatisticFlagBits;
typedef VkFlags VkQueryPipelineStatisticFlags;
@@ -937,6 +956,7 @@
VK_QUERY_RESULT_WAIT_BIT = 0x00000002,
VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004,
VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008,
+ VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkQueryResultFlagBits;
typedef VkFlags VkQueryResultFlags;
@@ -944,6 +964,7 @@
VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001,
VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002,
VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004,
+ VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkBufferCreateFlagBits;
typedef VkFlags VkBufferCreateFlags;
@@ -957,6 +978,7 @@
VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040,
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080,
VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100,
+ VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkBufferUsageFlagBits;
typedef VkFlags VkBufferUsageFlags;
typedef VkFlags VkBufferViewCreateFlags;
@@ -968,6 +990,7 @@
VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
+ VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkPipelineCreateFlagBits;
typedef VkFlags VkPipelineCreateFlags;
typedef VkFlags VkPipelineShaderStageCreateFlags;
@@ -979,8 +1002,9 @@
VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
- VK_SHADER_STAGE_ALL_GRAPHICS = 0x1F,
+ VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F,
VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
+ VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkShaderStageFlagBits;
typedef VkFlags VkPipelineVertexInputStateCreateFlags;
typedef VkFlags VkPipelineInputAssemblyStateCreateFlags;
@@ -992,7 +1016,8 @@
VK_CULL_MODE_NONE = 0,
VK_CULL_MODE_FRONT_BIT = 0x00000001,
VK_CULL_MODE_BACK_BIT = 0x00000002,
- VK_CULL_MODE_FRONT_AND_BACK = 0x3,
+ VK_CULL_MODE_FRONT_AND_BACK = 0x00000003,
+ VK_CULL_MODE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkCullModeFlagBits;
typedef VkFlags VkCullModeFlags;
typedef VkFlags VkPipelineMultisampleStateCreateFlags;
@@ -1004,6 +1029,7 @@
VK_COLOR_COMPONENT_G_BIT = 0x00000002,
VK_COLOR_COMPONENT_B_BIT = 0x00000004,
VK_COLOR_COMPONENT_A_BIT = 0x00000008,
+ VK_COLOR_COMPONENT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkColorComponentFlagBits;
typedef VkFlags VkColorComponentFlags;
typedef VkFlags VkPipelineDynamicStateCreateFlags;
@@ -1014,6 +1040,7 @@
typedef enum VkDescriptorPoolCreateFlagBits {
VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001,
+ VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkDescriptorPoolCreateFlagBits;
typedef VkFlags VkDescriptorPoolCreateFlags;
typedef VkFlags VkDescriptorPoolResetFlags;
@@ -1022,6 +1049,7 @@
typedef enum VkAttachmentDescriptionFlagBits {
VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001,
+ VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkAttachmentDescriptionFlagBits;
typedef VkFlags VkAttachmentDescriptionFlags;
typedef VkFlags VkSubpassDescriptionFlags;
@@ -1044,22 +1072,26 @@
VK_ACCESS_HOST_WRITE_BIT = 0x00004000,
VK_ACCESS_MEMORY_READ_BIT = 0x00008000,
VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000,
+ VK_ACCESS_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkAccessFlagBits;
typedef VkFlags VkAccessFlags;
typedef enum VkDependencyFlagBits {
VK_DEPENDENCY_BY_REGION_BIT = 0x00000001,
+ VK_DEPENDENCY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkDependencyFlagBits;
typedef VkFlags VkDependencyFlags;
typedef enum VkCommandPoolCreateFlagBits {
VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001,
VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002,
+ VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkCommandPoolCreateFlagBits;
typedef VkFlags VkCommandPoolCreateFlags;
typedef enum VkCommandPoolResetFlagBits {
VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001,
+ VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkCommandPoolResetFlagBits;
typedef VkFlags VkCommandPoolResetFlags;
@@ -1067,23 +1099,27 @@
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
+ VK_COMMAND_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkCommandBufferUsageFlagBits;
typedef VkFlags VkCommandBufferUsageFlags;
typedef enum VkQueryControlFlagBits {
VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001,
+ VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkQueryControlFlagBits;
typedef VkFlags VkQueryControlFlags;
typedef enum VkCommandBufferResetFlagBits {
VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001,
+ VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkCommandBufferResetFlagBits;
typedef VkFlags VkCommandBufferResetFlags;
typedef enum VkStencilFaceFlagBits {
VK_STENCIL_FACE_FRONT_BIT = 0x00000001,
VK_STENCIL_FACE_BACK_BIT = 0x00000002,
- VK_STENCIL_FRONT_AND_BACK = 0x3,
+ VK_STENCIL_FRONT_AND_BACK = 0x00000003,
+ VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkStencilFaceFlagBits;
typedef VkFlags VkStencilFaceFlags;
@@ -3136,14 +3172,15 @@
#define VK_KHR_SURFACE_SPEC_VERSION 25
#define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface"
+#define VK_COLORSPACE_SRGB_NONLINEAR_KHR VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
typedef enum VkColorSpaceKHR {
- VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0,
- VK_COLORSPACE_BEGIN_RANGE = VK_COLORSPACE_SRGB_NONLINEAR_KHR,
- VK_COLORSPACE_END_RANGE = VK_COLORSPACE_SRGB_NONLINEAR_KHR,
- VK_COLORSPACE_RANGE_SIZE = (VK_COLORSPACE_SRGB_NONLINEAR_KHR - VK_COLORSPACE_SRGB_NONLINEAR_KHR + 1),
- VK_COLORSPACE_MAX_ENUM = 0x7FFFFFFF
+ VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0,
+ VK_COLOR_SPACE_BEGIN_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
+ VK_COLOR_SPACE_END_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
+ VK_COLOR_SPACE_RANGE_SIZE_KHR = (VK_COLOR_SPACE_SRGB_NONLINEAR_KHR - VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + 1),
+ VK_COLOR_SPACE_MAX_ENUM_KHR = 0x7FFFFFFF
} VkColorSpaceKHR;
typedef enum VkPresentModeKHR {
@@ -3151,10 +3188,10 @@
VK_PRESENT_MODE_MAILBOX_KHR = 1,
VK_PRESENT_MODE_FIFO_KHR = 2,
VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3,
- VK_PRESENT_MODE_BEGIN_RANGE = VK_PRESENT_MODE_IMMEDIATE_KHR,
- VK_PRESENT_MODE_END_RANGE = VK_PRESENT_MODE_FIFO_RELAXED_KHR,
- VK_PRESENT_MODE_RANGE_SIZE = (VK_PRESENT_MODE_FIFO_RELAXED_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1),
- VK_PRESENT_MODE_MAX_ENUM = 0x7FFFFFFF
+ VK_PRESENT_MODE_BEGIN_RANGE_KHR = VK_PRESENT_MODE_IMMEDIATE_KHR,
+ VK_PRESENT_MODE_END_RANGE_KHR = VK_PRESENT_MODE_FIFO_RELAXED_KHR,
+ VK_PRESENT_MODE_RANGE_SIZE_KHR = (VK_PRESENT_MODE_FIFO_RELAXED_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1),
+ VK_PRESENT_MODE_MAX_ENUM_KHR = 0x7FFFFFFF
} VkPresentModeKHR;
@@ -3168,6 +3205,7 @@
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040,
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080,
VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
+ VK_SURFACE_TRANSFORM_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
} VkSurfaceTransformFlagBitsKHR;
typedef VkFlags VkSurfaceTransformFlagsKHR;
@@ -3176,6 +3214,7 @@
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002,
VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004,
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008,
+ VK_COMPOSITE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
} VkCompositeAlphaFlagBitsKHR;
typedef VkFlags VkCompositeAlphaFlagsKHR;
@@ -3237,7 +3276,7 @@
#define VK_KHR_swapchain 1
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR)
-#define VK_KHR_SWAPCHAIN_SPEC_VERSION 67
+#define VK_KHR_SWAPCHAIN_SPEC_VERSION 68
#define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain"
typedef VkFlags VkSwapchainCreateFlagsKHR;
@@ -3325,9 +3364,10 @@
VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002,
VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004,
VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008,
+ VK_DISPLAY_PLANE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
} VkDisplayPlaneAlphaFlagBitsKHR;
-typedef VkFlags VkDisplayModeCreateFlagsKHR;
typedef VkFlags VkDisplayPlaneAlphaFlagsKHR;
+typedef VkFlags VkDisplayModeCreateFlagsKHR;
typedef VkFlags VkDisplaySurfaceCreateFlagsKHR;
typedef struct VkDisplayPropertiesKHR {
@@ -3392,7 +3432,7 @@
typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPlanePropertiesKHR* pProperties);
typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneSupportedDisplaysKHR)(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t* pDisplayCount, VkDisplayKHR* pDisplays);
typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayModePropertiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModePropertiesKHR* pProperties);
-typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayModeKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR*pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDisplayModeKHR* pMode);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayModeKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDisplayModeKHR* pMode);
typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR* pCapabilities);
typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayPlaneSurfaceKHR)(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
@@ -3667,11 +3707,17 @@
#endif
#endif /* VK_USE_PLATFORM_WIN32_KHR */
+#define VK_KHR_sampler_mirror_clamp_to_edge 1
+#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 1
+#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME "VK_KHR_sampler_mirror_clamp_to_edge"
+
+
#define VK_EXT_debug_report 1
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT)
-#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 1
+#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 2
#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report"
+#define VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT
typedef enum VkDebugReportObjectTypeEXT {
@@ -3704,11 +3750,19 @@
VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26,
VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27,
VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = 28,
+ VK_DEBUG_REPORT_OBJECT_TYPE_BEGIN_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,
+ VK_DEBUG_REPORT_OBJECT_TYPE_END_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT,
+ VK_DEBUG_REPORT_OBJECT_TYPE_RANGE_SIZE_EXT = (VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT - VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT + 1),
+ VK_DEBUG_REPORT_OBJECT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF
} VkDebugReportObjectTypeEXT;
typedef enum VkDebugReportErrorEXT {
VK_DEBUG_REPORT_ERROR_NONE_EXT = 0,
VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT = 1,
+ VK_DEBUG_REPORT_ERROR_BEGIN_RANGE_EXT = VK_DEBUG_REPORT_ERROR_NONE_EXT,
+ VK_DEBUG_REPORT_ERROR_END_RANGE_EXT = VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT,
+ VK_DEBUG_REPORT_ERROR_RANGE_SIZE_EXT = (VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT - VK_DEBUG_REPORT_ERROR_NONE_EXT + 1),
+ VK_DEBUG_REPORT_ERROR_MAX_ENUM_EXT = 0x7FFFFFFF
} VkDebugReportErrorEXT;
@@ -3718,6 +3772,7 @@
VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004,
VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008,
VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010,
+ VK_DEBUG_REPORT_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
} VkDebugReportFlagBitsEXT;
typedef VkFlags VkDebugReportFlagsEXT;
@@ -3768,6 +3823,95 @@
const char* pMessage);
#endif
+#define VK_NV_glsl_shader 1
+#define VK_NV_GLSL_SHADER_SPEC_VERSION 1
+#define VK_NV_GLSL_SHADER_EXTENSION_NAME "VK_NV_glsl_shader"
+
+
+#define VK_IMG_filter_cubic 1
+#define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1
+#define VK_IMG_FILTER_CUBIC_EXTENSION_NAME "VK_IMG_filter_cubic"
+
+
+#define VK_AMD_rasterization_order 1
+#define VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION 1
+#define VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME "VK_AMD_rasterization_order"
+
+
+typedef enum VkRasterizationOrderAMD {
+ VK_RASTERIZATION_ORDER_STRICT_AMD = 0,
+ VK_RASTERIZATION_ORDER_RELAXED_AMD = 1,
+ VK_RASTERIZATION_ORDER_BEGIN_RANGE_AMD = VK_RASTERIZATION_ORDER_STRICT_AMD,
+ VK_RASTERIZATION_ORDER_END_RANGE_AMD = VK_RASTERIZATION_ORDER_RELAXED_AMD,
+ VK_RASTERIZATION_ORDER_RANGE_SIZE_AMD = (VK_RASTERIZATION_ORDER_RELAXED_AMD - VK_RASTERIZATION_ORDER_STRICT_AMD + 1),
+ VK_RASTERIZATION_ORDER_MAX_ENUM_AMD = 0x7FFFFFFF
+} VkRasterizationOrderAMD;
+
+typedef struct VkPipelineRasterizationStateRasterizationOrderAMD {
+ VkStructureType sType;
+ const void* pNext;
+ VkRasterizationOrderAMD rasterizationOrder;
+} VkPipelineRasterizationStateRasterizationOrderAMD;
+
+
+
+#define VK_EXT_debug_marker 1
+#define VK_EXT_DEBUG_MARKER_SPEC_VERSION 3
+#define VK_EXT_DEBUG_MARKER_EXTENSION_NAME "VK_EXT_debug_marker"
+
+typedef struct VkDebugMarkerObjectNameInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkDebugReportObjectTypeEXT objectType;
+ uint64_t object;
+ const char* pObjectName;
+} VkDebugMarkerObjectNameInfoEXT;
+
+typedef struct VkDebugMarkerObjectTagInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkDebugReportObjectTypeEXT objectType;
+ uint64_t object;
+ uint64_t tagName;
+ size_t tagSize;
+ const void* pTag;
+} VkDebugMarkerObjectTagInfoEXT;
+
+typedef struct VkDebugMarkerMarkerInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ const char* pMarkerName;
+ float color[4];
+} VkDebugMarkerMarkerInfoEXT;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectTagEXT)(VkDevice device, VkDebugMarkerObjectTagInfoEXT* pTagInfo);
+typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectNameEXT)(VkDevice device, VkDebugMarkerObjectNameInfoEXT* pNameInfo);
+typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerBeginEXT)(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
+typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerEndEXT)(VkCommandBuffer commandBuffer);
+typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerInsertEXT)(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectTagEXT(
+ VkDevice device,
+ VkDebugMarkerObjectTagInfoEXT* pTagInfo);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT(
+ VkDevice device,
+ VkDebugMarkerObjectNameInfoEXT* pNameInfo);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerBeginEXT(
+ VkCommandBuffer commandBuffer,
+ VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerEndEXT(
+ VkCommandBuffer commandBuffer);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT(
+ VkCommandBuffer commandBuffer,
+ VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/vulkan/include/vulkan/vulkan_loader_data.h b/vulkan/include/vulkan/vulkan_loader_data.h
index 968a7aa..8ea4666 100644
--- a/vulkan/include/vulkan/vulkan_loader_data.h
+++ b/vulkan/include/vulkan/vulkan_loader_data.h
@@ -19,9 +19,13 @@
#include <string>
+struct android_namespace_t;
+
namespace vulkan {
struct LoaderData {
std::string layer_path;
+ android_namespace_t* app_namespace;
+
__attribute__((visibility("default"))) static LoaderData& GetInstance();
};
}
diff --git a/vulkan/libvulkan/Android.mk b/vulkan/libvulkan/Android.mk
index 71788a9..d2e28ff 100644
--- a/vulkan/libvulkan/Android.mk
+++ b/vulkan/libvulkan/Android.mk
@@ -20,6 +20,7 @@
LOCAL_CFLAGS := -DLOG_TAG=\"vulkan\" \
-DVK_USE_PLATFORM_ANDROID_KHR \
+ -DVK_NO_PROTOTYPES \
-std=c99 -fvisibility=hidden -fstrict-aliasing \
-Weverything -Werror \
-Wno-padded \
@@ -49,7 +50,8 @@
vulkan_loader_data.cpp
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-LOCAL_SHARED_LIBRARIES := libhardware liblog libsync libutils libcutils
+LOCAL_STATIC_LIBRARIES := libziparchive
+LOCAL_SHARED_LIBRARIES := libhardware libsync libbase liblog libutils libcutils libz
LOCAL_MODULE := libvulkan
include $(BUILD_SHARED_LIBRARY)
diff --git a/vulkan/libvulkan/api.cpp b/vulkan/libvulkan/api.cpp
index 28b172d..b699fe9 100644
--- a/vulkan/libvulkan/api.cpp
+++ b/vulkan/libvulkan/api.cpp
@@ -394,7 +394,9 @@
uint32_t& count);
private:
- LayerChain(bool is_instance, const VkAllocationCallbacks& allocator);
+ LayerChain(bool is_instance,
+ const driver::DebugReportLogger& logger,
+ const VkAllocationCallbacks& allocator);
~LayerChain();
VkResult ActivateLayers(const char* const* layer_names,
@@ -455,6 +457,7 @@
void* user_data);
const bool is_instance_;
+ const driver::DebugReportLogger& logger_;
const VkAllocationCallbacks& allocator_;
OverrideLayerNames override_layers_;
@@ -476,8 +479,11 @@
std::bitset<driver::ProcHook::EXTENSION_COUNT> enabled_extensions_;
};
-LayerChain::LayerChain(bool is_instance, const VkAllocationCallbacks& allocator)
+LayerChain::LayerChain(bool is_instance,
+ const driver::DebugReportLogger& logger,
+ const VkAllocationCallbacks& allocator)
: is_instance_(is_instance),
+ logger_(logger),
allocator_(allocator),
override_layers_(is_instance, allocator),
override_extensions_(is_instance, allocator),
@@ -562,12 +568,9 @@
}
if (!exact_match) {
- ALOGW("Device layers");
- for (uint32_t i = 0; i < layer_count; i++)
- ALOGW(" %s", layer_names[i]);
- ALOGW(
- "disagree with instance layers and are overridden by "
- "instance layers");
+ logger_.Warn(physical_dev,
+ "Device layers disagree with instance layers and are "
+ "overridden by instance layers");
}
}
@@ -599,6 +602,13 @@
new (&layers_[layer_count_++]) ActiveLayer{GetLayerRef(l), {}};
}
+ // this may happen when all layers are non-global ones
+ if (!layer_count_) {
+ get_instance_proc_addr_ = driver::GetInstanceProcAddr;
+ get_device_proc_addr_ = driver::GetDeviceProcAddr;
+ return VK_SUCCESS;
+ }
+
SetupLayerLinks();
return VK_SUCCESS;
@@ -617,7 +627,7 @@
VkResult LayerChain::LoadLayer(ActiveLayer& layer, const char* name) {
const Layer* l = FindLayer(name);
if (!l) {
- ALOGW("Failed to find layer %s", name);
+ logger_.Err(VK_NULL_HANDLE, "Failed to find layer %s", name);
return VK_ERROR_LAYER_NOT_PRESENT;
}
@@ -882,7 +892,8 @@
for (uint32_t i = 0; i < extension_count; i++) {
const char* name = extension_names[i];
if (!IsLayerExtension(name) && !IsDriverExtension(name)) {
- ALOGE("Failed to enable missing instance extension %s", name);
+ logger_.Err(VK_NULL_HANDLE,
+ "Failed to enable missing instance extension %s", name);
return VK_ERROR_EXTENSION_NOT_PRESENT;
}
@@ -919,7 +930,8 @@
for (uint32_t i = 0; i < extension_count; i++) {
const char* name = extension_names[i];
if (!IsLayerExtension(name) && !IsDriverExtension(name)) {
- ALOGE("Failed to enable missing device extension %s", name);
+ logger_.Err(physical_dev,
+ "Failed to enable missing device extension %s", name);
return VK_ERROR_EXTENSION_NOT_PRESENT;
}
@@ -1036,7 +1048,7 @@
VkResult LayerChain::CreateInstance(const VkInstanceCreateInfo* create_info,
const VkAllocationCallbacks* allocator,
VkInstance* instance_out) {
- LayerChain chain(true,
+ LayerChain chain(true, driver::DebugReportLogger(*create_info),
(allocator) ? *allocator : driver::GetDefaultAllocator());
VkResult result = chain.ActivateLayers(create_info->ppEnabledLayerNames,
@@ -1061,9 +1073,9 @@
const VkDeviceCreateInfo* create_info,
const VkAllocationCallbacks* allocator,
VkDevice* dev_out) {
- LayerChain chain(false, (allocator)
- ? *allocator
- : driver::GetData(physical_dev).allocator);
+ LayerChain chain(
+ false, driver::Logger(physical_dev),
+ (allocator) ? *allocator : driver::GetData(physical_dev).allocator);
VkResult result = chain.ActivateLayers(
physical_dev, create_info->ppEnabledLayerNames,
diff --git a/vulkan/libvulkan/api_gen.cpp b/vulkan/libvulkan/api_gen.cpp
index fe4136f..0a1dda2 100644
--- a/vulkan/libvulkan/api_gen.cpp
+++ b/vulkan/libvulkan/api_gen.cpp
@@ -20,6 +20,8 @@
#include <algorithm>
#include <log/log.h>
+// to catch mismatches between vulkan.h and this file
+#undef VK_NO_PROTOTYPES
#include "api.h"
namespace vulkan {
@@ -51,56 +53,56 @@
// clang-format off
-VKAPI_ATTR void disabledDestroySurfaceKHR(VkInstance, VkSurfaceKHR, const VkAllocationCallbacks*) {
- ALOGE("VK_KHR_surface not enabled. vkDestroySurfaceKHR not executed.");
+VKAPI_ATTR void disabledDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR, const VkAllocationCallbacks*) {
+ driver::Logger(instance).Err(instance, "VK_KHR_surface not enabled. Exported vkDestroySurfaceKHR not executed.");
}
-VKAPI_ATTR VkResult disabledGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice, uint32_t, VkSurfaceKHR, VkBool32*) {
- ALOGE("VK_KHR_surface not enabled. vkGetPhysicalDeviceSurfaceSupportKHR not executed.");
+VKAPI_ATTR VkResult disabledGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t, VkSurfaceKHR, VkBool32*) {
+ driver::Logger(physicalDevice).Err(physicalDevice, "VK_KHR_surface not enabled. Exported vkGetPhysicalDeviceSurfaceSupportKHR not executed.");
return VK_SUCCESS;
}
-VKAPI_ATTR VkResult disabledGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR*) {
- ALOGE("VK_KHR_surface not enabled. vkGetPhysicalDeviceSurfaceCapabilitiesKHR not executed.");
+VKAPI_ATTR VkResult disabledGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR*) {
+ driver::Logger(physicalDevice).Err(physicalDevice, "VK_KHR_surface not enabled. Exported vkGetPhysicalDeviceSurfaceCapabilitiesKHR not executed.");
return VK_SUCCESS;
}
-VKAPI_ATTR VkResult disabledGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice, VkSurfaceKHR, uint32_t*, VkSurfaceFormatKHR*) {
- ALOGE("VK_KHR_surface not enabled. vkGetPhysicalDeviceSurfaceFormatsKHR not executed.");
+VKAPI_ATTR VkResult disabledGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR, uint32_t*, VkSurfaceFormatKHR*) {
+ driver::Logger(physicalDevice).Err(physicalDevice, "VK_KHR_surface not enabled. Exported vkGetPhysicalDeviceSurfaceFormatsKHR not executed.");
return VK_SUCCESS;
}
-VKAPI_ATTR VkResult disabledGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice, VkSurfaceKHR, uint32_t*, VkPresentModeKHR*) {
- ALOGE("VK_KHR_surface not enabled. vkGetPhysicalDeviceSurfacePresentModesKHR not executed.");
+VKAPI_ATTR VkResult disabledGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR, uint32_t*, VkPresentModeKHR*) {
+ driver::Logger(physicalDevice).Err(physicalDevice, "VK_KHR_surface not enabled. Exported vkGetPhysicalDeviceSurfacePresentModesKHR not executed.");
return VK_SUCCESS;
}
-VKAPI_ATTR VkResult disabledCreateSwapchainKHR(VkDevice, const VkSwapchainCreateInfoKHR*, const VkAllocationCallbacks*, VkSwapchainKHR*) {
- ALOGE("VK_KHR_swapchain not enabled. vkCreateSwapchainKHR not executed.");
+VKAPI_ATTR VkResult disabledCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR*, const VkAllocationCallbacks*, VkSwapchainKHR*) {
+ driver::Logger(device).Err(device, "VK_KHR_swapchain not enabled. Exported vkCreateSwapchainKHR not executed.");
return VK_SUCCESS;
}
-VKAPI_ATTR void disabledDestroySwapchainKHR(VkDevice, VkSwapchainKHR, const VkAllocationCallbacks*) {
- ALOGE("VK_KHR_swapchain not enabled. vkDestroySwapchainKHR not executed.");
+VKAPI_ATTR void disabledDestroySwapchainKHR(VkDevice device, VkSwapchainKHR, const VkAllocationCallbacks*) {
+ driver::Logger(device).Err(device, "VK_KHR_swapchain not enabled. Exported vkDestroySwapchainKHR not executed.");
}
-VKAPI_ATTR VkResult disabledGetSwapchainImagesKHR(VkDevice, VkSwapchainKHR, uint32_t*, VkImage*) {
- ALOGE("VK_KHR_swapchain not enabled. vkGetSwapchainImagesKHR not executed.");
+VKAPI_ATTR VkResult disabledGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR, uint32_t*, VkImage*) {
+ driver::Logger(device).Err(device, "VK_KHR_swapchain not enabled. Exported vkGetSwapchainImagesKHR not executed.");
return VK_SUCCESS;
}
-VKAPI_ATTR VkResult disabledAcquireNextImageKHR(VkDevice, VkSwapchainKHR, uint64_t, VkSemaphore, VkFence, uint32_t*) {
- ALOGE("VK_KHR_swapchain not enabled. vkAcquireNextImageKHR not executed.");
+VKAPI_ATTR VkResult disabledAcquireNextImageKHR(VkDevice device, VkSwapchainKHR, uint64_t, VkSemaphore, VkFence, uint32_t*) {
+ driver::Logger(device).Err(device, "VK_KHR_swapchain not enabled. Exported vkAcquireNextImageKHR not executed.");
return VK_SUCCESS;
}
-VKAPI_ATTR VkResult disabledQueuePresentKHR(VkQueue, const VkPresentInfoKHR*) {
- ALOGE("VK_KHR_swapchain not enabled. vkQueuePresentKHR not executed.");
+VKAPI_ATTR VkResult disabledQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR*) {
+ driver::Logger(queue).Err(queue, "VK_KHR_swapchain not enabled. Exported vkQueuePresentKHR not executed.");
return VK_SUCCESS;
}
-VKAPI_ATTR VkResult disabledCreateAndroidSurfaceKHR(VkInstance, const VkAndroidSurfaceCreateInfoKHR*, const VkAllocationCallbacks*, VkSurfaceKHR*) {
- ALOGE("VK_KHR_android_surface not enabled. vkCreateAndroidSurfaceKHR not executed.");
+VKAPI_ATTR VkResult disabledCreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR*, const VkAllocationCallbacks*, VkSurfaceKHR*) {
+ driver::Logger(instance).Err(instance, "VK_KHR_android_surface not enabled. Exported vkCreateAndroidSurfaceKHR not executed.");
return VK_SUCCESS;
}
@@ -126,7 +128,6 @@
INIT_PROC(instance, GetPhysicalDeviceFormatProperties);
INIT_PROC(instance, GetPhysicalDeviceImageFormatProperties);
INIT_PROC(instance, CreateDevice);
- INIT_PROC(instance, EnumerateDeviceLayerProperties);
INIT_PROC(instance, EnumerateDeviceExtensionProperties);
INIT_PROC(instance, GetPhysicalDeviceSparseImageFormatProperties);
INIT_PROC_EXT(KHR_surface, instance, DestroySurfaceKHR);
@@ -279,32 +280,159 @@
return success;
}
-} // namespace api
-} // namespace vulkan
-
// clang-format off
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) {
- // call into api.cpp
- return vulkan::api::CreateInstance(pCreateInfo, pAllocator, pInstance);
+namespace {
+
+// forward declarations needed by GetInstanceProcAddr and GetDeviceProcAddr
+VKAPI_ATTR VkResult EnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
+VKAPI_ATTR PFN_vkVoidFunction GetDeviceProcAddr(VkDevice device, const char* pName);
+VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* pName);
+VKAPI_ATTR void GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties);
+VKAPI_ATTR void GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties);
+VKAPI_ATTR void GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties);
+VKAPI_ATTR void GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures);
+VKAPI_ATTR void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties);
+VKAPI_ATTR VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties);
+VKAPI_ATTR void GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue);
+VKAPI_ATTR VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence);
+VKAPI_ATTR VkResult QueueWaitIdle(VkQueue queue);
+VKAPI_ATTR VkResult DeviceWaitIdle(VkDevice device);
+VKAPI_ATTR VkResult AllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory);
+VKAPI_ATTR void FreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult MapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData);
+VKAPI_ATTR void UnmapMemory(VkDevice device, VkDeviceMemory memory);
+VKAPI_ATTR VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges);
+VKAPI_ATTR VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges);
+VKAPI_ATTR void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes);
+VKAPI_ATTR void GetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements);
+VKAPI_ATTR VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset);
+VKAPI_ATTR void GetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements);
+VKAPI_ATTR VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset);
+VKAPI_ATTR void GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements);
+VKAPI_ATTR void GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties);
+VKAPI_ATTR VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence);
+VKAPI_ATTR VkResult CreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence);
+VKAPI_ATTR void DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences);
+VKAPI_ATTR VkResult GetFenceStatus(VkDevice device, VkFence fence);
+VKAPI_ATTR VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout);
+VKAPI_ATTR VkResult CreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore);
+VKAPI_ATTR void DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent);
+VKAPI_ATTR void DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult GetEventStatus(VkDevice device, VkEvent event);
+VKAPI_ATTR VkResult SetEvent(VkDevice device, VkEvent event);
+VKAPI_ATTR VkResult ResetEvent(VkDevice device, VkEvent event);
+VKAPI_ATTR VkResult CreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool);
+VKAPI_ATTR void DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult GetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags);
+VKAPI_ATTR VkResult CreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer);
+VKAPI_ATTR void DestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView);
+VKAPI_ATTR void DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage);
+VKAPI_ATTR void DestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout);
+VKAPI_ATTR VkResult CreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView);
+VKAPI_ATTR void DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule);
+VKAPI_ATTR void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache);
+VKAPI_ATTR void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData);
+VKAPI_ATTR VkResult MergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches);
+VKAPI_ATTR VkResult CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);
+VKAPI_ATTR VkResult CreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);
+VKAPI_ATTR void DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout);
+VKAPI_ATTR void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler);
+VKAPI_ATTR void DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout);
+VKAPI_ATTR void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool);
+VKAPI_ATTR void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags);
+VKAPI_ATTR VkResult AllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets);
+VKAPI_ATTR VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets);
+VKAPI_ATTR void UpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies);
+VKAPI_ATTR VkResult CreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer);
+VKAPI_ATTR void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult CreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass);
+VKAPI_ATTR void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity);
+VKAPI_ATTR VkResult CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool);
+VKAPI_ATTR void DestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags);
+VKAPI_ATTR VkResult AllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers);
+VKAPI_ATTR void FreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers);
+VKAPI_ATTR VkResult BeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo);
+VKAPI_ATTR VkResult EndCommandBuffer(VkCommandBuffer commandBuffer);
+VKAPI_ATTR VkResult ResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags);
+VKAPI_ATTR void CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline);
+VKAPI_ATTR void CmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports);
+VKAPI_ATTR void CmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors);
+VKAPI_ATTR void CmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth);
+VKAPI_ATTR void CmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor);
+VKAPI_ATTR void CmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]);
+VKAPI_ATTR void CmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds);
+VKAPI_ATTR void CmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask);
+VKAPI_ATTR void CmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask);
+VKAPI_ATTR void CmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference);
+VKAPI_ATTR void CmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets);
+VKAPI_ATTR void CmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType);
+VKAPI_ATTR void CmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets);
+VKAPI_ATTR void CmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance);
+VKAPI_ATTR void CmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance);
+VKAPI_ATTR void CmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride);
+VKAPI_ATTR void CmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride);
+VKAPI_ATTR void CmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z);
+VKAPI_ATTR void CmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset);
+VKAPI_ATTR void CmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions);
+VKAPI_ATTR void CmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions);
+VKAPI_ATTR void CmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter);
+VKAPI_ATTR void CmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions);
+VKAPI_ATTR void CmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions);
+VKAPI_ATTR void CmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t* pData);
+VKAPI_ATTR void CmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data);
+VKAPI_ATTR void CmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
+VKAPI_ATTR void CmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
+VKAPI_ATTR void CmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects);
+VKAPI_ATTR void CmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions);
+VKAPI_ATTR void CmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask);
+VKAPI_ATTR void CmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask);
+VKAPI_ATTR void CmdWaitEvents(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);
+VKAPI_ATTR void CmdPipelineBarrier(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);
+VKAPI_ATTR void CmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags);
+VKAPI_ATTR void CmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query);
+VKAPI_ATTR void CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount);
+VKAPI_ATTR void CmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query);
+VKAPI_ATTR void CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags);
+VKAPI_ATTR void CmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues);
+VKAPI_ATTR void CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents);
+VKAPI_ATTR void CmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents);
+VKAPI_ATTR void CmdEndRenderPass(VkCommandBuffer commandBuffer);
+VKAPI_ATTR void CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers);
+VKAPI_ATTR void DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported);
+VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities);
+VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats);
+VKAPI_ATTR VkResult GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes);
+VKAPI_ATTR VkResult CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain);
+VKAPI_ATTR void DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator);
+VKAPI_ATTR VkResult GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages);
+VKAPI_ATTR VkResult AcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex);
+VKAPI_ATTR VkResult QueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* pPresentInfo);
+VKAPI_ATTR VkResult CreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+
+VKAPI_ATTR VkResult EnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices) {
+ return GetData(instance).dispatch.EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices);
}
-__attribute__((visibility("default")))
-VKAPI_ATTR void vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator) {
- // call into api.cpp
- vulkan::api::DestroyInstance(instance, pAllocator);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR VkResult vkEnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices) {
- return vulkan::api::GetData(instance).dispatch.EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices);
-}
-
-__attribute__((visibility("default")))
-VKAPI_ATTR PFN_vkVoidFunction vkGetDeviceProcAddr(VkDevice device, const char* pName) {
+VKAPI_ATTR PFN_vkVoidFunction GetDeviceProcAddr(VkDevice device, const char* pName) {
if (device == VK_NULL_HANDLE) {
- ALOGE("vkGetDeviceProcAddr called with invalid device");
+ ALOGE("invalid vkGetDeviceProcAddr(VK_NULL_HANDLE, ...) call");
return nullptr;
}
@@ -342,26 +470,27 @@
std::binary_search(
known_non_device_names, known_non_device_names + count, pName,
[](const char* a, const char* b) { return (strcmp(a, b) < 0); })) {
- ALOGE("vkGetDeviceProcAddr called with %s", (pName) ? pName : "(null)");
+ vulkan::driver::Logger(device).Err(
+ device, "invalid vkGetDeviceProcAddr(%p, \"%s\") call", device,
+ (pName) ? pName : "(null)");
return nullptr;
}
// clang-format off
- if (strcmp(pName, "vkGetDeviceProcAddr") == 0) return reinterpret_cast<PFN_vkVoidFunction>(vkGetDeviceProcAddr);
- if (strcmp(pName, "vkDestroyDevice") == 0) return reinterpret_cast<PFN_vkVoidFunction>(vulkan::api::DestroyDevice);
+ if (strcmp(pName, "vkGetDeviceProcAddr") == 0) return reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr);
+ if (strcmp(pName, "vkDestroyDevice") == 0) return reinterpret_cast<PFN_vkVoidFunction>(DestroyDevice);
- return vulkan::api::GetData(device).dispatch.GetDeviceProcAddr(device, pName);
+ return GetData(device).dispatch.GetDeviceProcAddr(device, pName);
}
-__attribute__((visibility("default")))
-VKAPI_ATTR PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance instance, const char* pName) {
+VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* pName) {
// global functions
- if (!instance) {
- if (strcmp(pName, "vkCreateInstance") == 0) return reinterpret_cast<PFN_vkVoidFunction>(vulkan::api::CreateInstance);
- if (strcmp(pName, "vkEnumerateInstanceLayerProperties") == 0) return reinterpret_cast<PFN_vkVoidFunction>(vulkan::api::EnumerateInstanceLayerProperties);
- if (strcmp(pName, "vkEnumerateInstanceExtensionProperties") == 0) return reinterpret_cast<PFN_vkVoidFunction>(vulkan::api::EnumerateInstanceExtensionProperties);
+ if (instance == VK_NULL_HANDLE) {
+ if (strcmp(pName, "vkCreateInstance") == 0) return reinterpret_cast<PFN_vkVoidFunction>(CreateInstance);
+ if (strcmp(pName, "vkEnumerateInstanceLayerProperties") == 0) return reinterpret_cast<PFN_vkVoidFunction>(EnumerateInstanceLayerProperties);
+ if (strcmp(pName, "vkEnumerateInstanceExtensionProperties") == 0) return reinterpret_cast<PFN_vkVoidFunction>(EnumerateInstanceExtensionProperties);
- ALOGE("vkGetInstanceProcAddr called with %s without instance", pName);
+ ALOGE("invalid vkGetInstanceProcAddr(VK_NULL_HANDLE, \"%s\") call", pName);
return nullptr;
}
@@ -369,140 +498,140 @@
const char* name;
PFN_vkVoidFunction proc;
} hooks[] = {
- { "vkAcquireNextImageKHR", reinterpret_cast<PFN_vkVoidFunction>(vkAcquireNextImageKHR) },
- { "vkAllocateCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(vkAllocateCommandBuffers) },
- { "vkAllocateDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(vkAllocateDescriptorSets) },
- { "vkAllocateMemory", reinterpret_cast<PFN_vkVoidFunction>(vkAllocateMemory) },
- { "vkBeginCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkBeginCommandBuffer) },
- { "vkBindBufferMemory", reinterpret_cast<PFN_vkVoidFunction>(vkBindBufferMemory) },
- { "vkBindImageMemory", reinterpret_cast<PFN_vkVoidFunction>(vkBindImageMemory) },
- { "vkCmdBeginQuery", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBeginQuery) },
- { "vkCmdBeginRenderPass", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBeginRenderPass) },
- { "vkCmdBindDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBindDescriptorSets) },
- { "vkCmdBindIndexBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBindIndexBuffer) },
- { "vkCmdBindPipeline", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBindPipeline) },
- { "vkCmdBindVertexBuffers", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBindVertexBuffers) },
- { "vkCmdBlitImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdBlitImage) },
- { "vkCmdClearAttachments", reinterpret_cast<PFN_vkVoidFunction>(vkCmdClearAttachments) },
- { "vkCmdClearColorImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdClearColorImage) },
- { "vkCmdClearDepthStencilImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdClearDepthStencilImage) },
- { "vkCmdCopyBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyBuffer) },
- { "vkCmdCopyBufferToImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyBufferToImage) },
- { "vkCmdCopyImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyImage) },
- { "vkCmdCopyImageToBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyImageToBuffer) },
- { "vkCmdCopyQueryPoolResults", reinterpret_cast<PFN_vkVoidFunction>(vkCmdCopyQueryPoolResults) },
- { "vkCmdDispatch", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDispatch) },
- { "vkCmdDispatchIndirect", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDispatchIndirect) },
- { "vkCmdDraw", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDraw) },
- { "vkCmdDrawIndexed", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDrawIndexed) },
- { "vkCmdDrawIndexedIndirect", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDrawIndexedIndirect) },
- { "vkCmdDrawIndirect", reinterpret_cast<PFN_vkVoidFunction>(vkCmdDrawIndirect) },
- { "vkCmdEndQuery", reinterpret_cast<PFN_vkVoidFunction>(vkCmdEndQuery) },
- { "vkCmdEndRenderPass", reinterpret_cast<PFN_vkVoidFunction>(vkCmdEndRenderPass) },
- { "vkCmdExecuteCommands", reinterpret_cast<PFN_vkVoidFunction>(vkCmdExecuteCommands) },
- { "vkCmdFillBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdFillBuffer) },
- { "vkCmdNextSubpass", reinterpret_cast<PFN_vkVoidFunction>(vkCmdNextSubpass) },
- { "vkCmdPipelineBarrier", reinterpret_cast<PFN_vkVoidFunction>(vkCmdPipelineBarrier) },
- { "vkCmdPushConstants", reinterpret_cast<PFN_vkVoidFunction>(vkCmdPushConstants) },
- { "vkCmdResetEvent", reinterpret_cast<PFN_vkVoidFunction>(vkCmdResetEvent) },
- { "vkCmdResetQueryPool", reinterpret_cast<PFN_vkVoidFunction>(vkCmdResetQueryPool) },
- { "vkCmdResolveImage", reinterpret_cast<PFN_vkVoidFunction>(vkCmdResolveImage) },
- { "vkCmdSetBlendConstants", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetBlendConstants) },
- { "vkCmdSetDepthBias", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetDepthBias) },
- { "vkCmdSetDepthBounds", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetDepthBounds) },
- { "vkCmdSetEvent", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetEvent) },
- { "vkCmdSetLineWidth", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetLineWidth) },
- { "vkCmdSetScissor", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetScissor) },
- { "vkCmdSetStencilCompareMask", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetStencilCompareMask) },
- { "vkCmdSetStencilReference", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetStencilReference) },
- { "vkCmdSetStencilWriteMask", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetStencilWriteMask) },
- { "vkCmdSetViewport", reinterpret_cast<PFN_vkVoidFunction>(vkCmdSetViewport) },
- { "vkCmdUpdateBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCmdUpdateBuffer) },
- { "vkCmdWaitEvents", reinterpret_cast<PFN_vkVoidFunction>(vkCmdWaitEvents) },
- { "vkCmdWriteTimestamp", reinterpret_cast<PFN_vkVoidFunction>(vkCmdWriteTimestamp) },
- { "vkCreateBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCreateBuffer) },
- { "vkCreateBufferView", reinterpret_cast<PFN_vkVoidFunction>(vkCreateBufferView) },
- { "vkCreateCommandPool", reinterpret_cast<PFN_vkVoidFunction>(vkCreateCommandPool) },
- { "vkCreateComputePipelines", reinterpret_cast<PFN_vkVoidFunction>(vkCreateComputePipelines) },
- { "vkCreateDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(vkCreateDescriptorPool) },
- { "vkCreateDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(vkCreateDescriptorSetLayout) },
- { "vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(vulkan::api::CreateDevice) },
- { "vkCreateEvent", reinterpret_cast<PFN_vkVoidFunction>(vkCreateEvent) },
- { "vkCreateFence", reinterpret_cast<PFN_vkVoidFunction>(vkCreateFence) },
- { "vkCreateFramebuffer", reinterpret_cast<PFN_vkVoidFunction>(vkCreateFramebuffer) },
- { "vkCreateGraphicsPipelines", reinterpret_cast<PFN_vkVoidFunction>(vkCreateGraphicsPipelines) },
- { "vkCreateImage", reinterpret_cast<PFN_vkVoidFunction>(vkCreateImage) },
- { "vkCreateImageView", reinterpret_cast<PFN_vkVoidFunction>(vkCreateImageView) },
+ { "vkAcquireNextImageKHR", reinterpret_cast<PFN_vkVoidFunction>(AcquireNextImageKHR) },
+ { "vkAllocateCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(AllocateCommandBuffers) },
+ { "vkAllocateDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(AllocateDescriptorSets) },
+ { "vkAllocateMemory", reinterpret_cast<PFN_vkVoidFunction>(AllocateMemory) },
+ { "vkBeginCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(BeginCommandBuffer) },
+ { "vkBindBufferMemory", reinterpret_cast<PFN_vkVoidFunction>(BindBufferMemory) },
+ { "vkBindImageMemory", reinterpret_cast<PFN_vkVoidFunction>(BindImageMemory) },
+ { "vkCmdBeginQuery", reinterpret_cast<PFN_vkVoidFunction>(CmdBeginQuery) },
+ { "vkCmdBeginRenderPass", reinterpret_cast<PFN_vkVoidFunction>(CmdBeginRenderPass) },
+ { "vkCmdBindDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(CmdBindDescriptorSets) },
+ { "vkCmdBindIndexBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdBindIndexBuffer) },
+ { "vkCmdBindPipeline", reinterpret_cast<PFN_vkVoidFunction>(CmdBindPipeline) },
+ { "vkCmdBindVertexBuffers", reinterpret_cast<PFN_vkVoidFunction>(CmdBindVertexBuffers) },
+ { "vkCmdBlitImage", reinterpret_cast<PFN_vkVoidFunction>(CmdBlitImage) },
+ { "vkCmdClearAttachments", reinterpret_cast<PFN_vkVoidFunction>(CmdClearAttachments) },
+ { "vkCmdClearColorImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearColorImage) },
+ { "vkCmdClearDepthStencilImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearDepthStencilImage) },
+ { "vkCmdCopyBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyBuffer) },
+ { "vkCmdCopyBufferToImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyBufferToImage) },
+ { "vkCmdCopyImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImage) },
+ { "vkCmdCopyImageToBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImageToBuffer) },
+ { "vkCmdCopyQueryPoolResults", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyQueryPoolResults) },
+ { "vkCmdDispatch", reinterpret_cast<PFN_vkVoidFunction>(CmdDispatch) },
+ { "vkCmdDispatchIndirect", reinterpret_cast<PFN_vkVoidFunction>(CmdDispatchIndirect) },
+ { "vkCmdDraw", reinterpret_cast<PFN_vkVoidFunction>(CmdDraw) },
+ { "vkCmdDrawIndexed", reinterpret_cast<PFN_vkVoidFunction>(CmdDrawIndexed) },
+ { "vkCmdDrawIndexedIndirect", reinterpret_cast<PFN_vkVoidFunction>(CmdDrawIndexedIndirect) },
+ { "vkCmdDrawIndirect", reinterpret_cast<PFN_vkVoidFunction>(CmdDrawIndirect) },
+ { "vkCmdEndQuery", reinterpret_cast<PFN_vkVoidFunction>(CmdEndQuery) },
+ { "vkCmdEndRenderPass", reinterpret_cast<PFN_vkVoidFunction>(CmdEndRenderPass) },
+ { "vkCmdExecuteCommands", reinterpret_cast<PFN_vkVoidFunction>(CmdExecuteCommands) },
+ { "vkCmdFillBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdFillBuffer) },
+ { "vkCmdNextSubpass", reinterpret_cast<PFN_vkVoidFunction>(CmdNextSubpass) },
+ { "vkCmdPipelineBarrier", reinterpret_cast<PFN_vkVoidFunction>(CmdPipelineBarrier) },
+ { "vkCmdPushConstants", reinterpret_cast<PFN_vkVoidFunction>(CmdPushConstants) },
+ { "vkCmdResetEvent", reinterpret_cast<PFN_vkVoidFunction>(CmdResetEvent) },
+ { "vkCmdResetQueryPool", reinterpret_cast<PFN_vkVoidFunction>(CmdResetQueryPool) },
+ { "vkCmdResolveImage", reinterpret_cast<PFN_vkVoidFunction>(CmdResolveImage) },
+ { "vkCmdSetBlendConstants", reinterpret_cast<PFN_vkVoidFunction>(CmdSetBlendConstants) },
+ { "vkCmdSetDepthBias", reinterpret_cast<PFN_vkVoidFunction>(CmdSetDepthBias) },
+ { "vkCmdSetDepthBounds", reinterpret_cast<PFN_vkVoidFunction>(CmdSetDepthBounds) },
+ { "vkCmdSetEvent", reinterpret_cast<PFN_vkVoidFunction>(CmdSetEvent) },
+ { "vkCmdSetLineWidth", reinterpret_cast<PFN_vkVoidFunction>(CmdSetLineWidth) },
+ { "vkCmdSetScissor", reinterpret_cast<PFN_vkVoidFunction>(CmdSetScissor) },
+ { "vkCmdSetStencilCompareMask", reinterpret_cast<PFN_vkVoidFunction>(CmdSetStencilCompareMask) },
+ { "vkCmdSetStencilReference", reinterpret_cast<PFN_vkVoidFunction>(CmdSetStencilReference) },
+ { "vkCmdSetStencilWriteMask", reinterpret_cast<PFN_vkVoidFunction>(CmdSetStencilWriteMask) },
+ { "vkCmdSetViewport", reinterpret_cast<PFN_vkVoidFunction>(CmdSetViewport) },
+ { "vkCmdUpdateBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdUpdateBuffer) },
+ { "vkCmdWaitEvents", reinterpret_cast<PFN_vkVoidFunction>(CmdWaitEvents) },
+ { "vkCmdWriteTimestamp", reinterpret_cast<PFN_vkVoidFunction>(CmdWriteTimestamp) },
+ { "vkCreateBuffer", reinterpret_cast<PFN_vkVoidFunction>(CreateBuffer) },
+ { "vkCreateBufferView", reinterpret_cast<PFN_vkVoidFunction>(CreateBufferView) },
+ { "vkCreateCommandPool", reinterpret_cast<PFN_vkVoidFunction>(CreateCommandPool) },
+ { "vkCreateComputePipelines", reinterpret_cast<PFN_vkVoidFunction>(CreateComputePipelines) },
+ { "vkCreateDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(CreateDescriptorPool) },
+ { "vkCreateDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(CreateDescriptorSetLayout) },
+ { "vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(CreateDevice) },
+ { "vkCreateEvent", reinterpret_cast<PFN_vkVoidFunction>(CreateEvent) },
+ { "vkCreateFence", reinterpret_cast<PFN_vkVoidFunction>(CreateFence) },
+ { "vkCreateFramebuffer", reinterpret_cast<PFN_vkVoidFunction>(CreateFramebuffer) },
+ { "vkCreateGraphicsPipelines", reinterpret_cast<PFN_vkVoidFunction>(CreateGraphicsPipelines) },
+ { "vkCreateImage", reinterpret_cast<PFN_vkVoidFunction>(CreateImage) },
+ { "vkCreateImageView", reinterpret_cast<PFN_vkVoidFunction>(CreateImageView) },
{ "vkCreateInstance", nullptr },
- { "vkCreatePipelineCache", reinterpret_cast<PFN_vkVoidFunction>(vkCreatePipelineCache) },
- { "vkCreatePipelineLayout", reinterpret_cast<PFN_vkVoidFunction>(vkCreatePipelineLayout) },
- { "vkCreateQueryPool", reinterpret_cast<PFN_vkVoidFunction>(vkCreateQueryPool) },
- { "vkCreateRenderPass", reinterpret_cast<PFN_vkVoidFunction>(vkCreateRenderPass) },
- { "vkCreateSampler", reinterpret_cast<PFN_vkVoidFunction>(vkCreateSampler) },
- { "vkCreateSemaphore", reinterpret_cast<PFN_vkVoidFunction>(vkCreateSemaphore) },
- { "vkCreateShaderModule", reinterpret_cast<PFN_vkVoidFunction>(vkCreateShaderModule) },
- { "vkCreateSwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(vkCreateSwapchainKHR) },
- { "vkDestroyBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyBuffer) },
- { "vkDestroyBufferView", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyBufferView) },
- { "vkDestroyCommandPool", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyCommandPool) },
- { "vkDestroyDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyDescriptorPool) },
- { "vkDestroyDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyDescriptorSetLayout) },
- { "vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(vulkan::api::DestroyDevice) },
- { "vkDestroyEvent", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyEvent) },
- { "vkDestroyFence", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyFence) },
- { "vkDestroyFramebuffer", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyFramebuffer) },
- { "vkDestroyImage", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyImage) },
- { "vkDestroyImageView", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyImageView) },
- { "vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(vulkan::api::DestroyInstance) },
- { "vkDestroyPipeline", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyPipeline) },
- { "vkDestroyPipelineCache", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyPipelineCache) },
- { "vkDestroyPipelineLayout", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyPipelineLayout) },
- { "vkDestroyQueryPool", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyQueryPool) },
- { "vkDestroyRenderPass", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyRenderPass) },
- { "vkDestroySampler", reinterpret_cast<PFN_vkVoidFunction>(vkDestroySampler) },
- { "vkDestroySemaphore", reinterpret_cast<PFN_vkVoidFunction>(vkDestroySemaphore) },
- { "vkDestroyShaderModule", reinterpret_cast<PFN_vkVoidFunction>(vkDestroyShaderModule) },
- { "vkDestroySwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(vkDestroySwapchainKHR) },
- { "vkDeviceWaitIdle", reinterpret_cast<PFN_vkVoidFunction>(vkDeviceWaitIdle) },
- { "vkEndCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkEndCommandBuffer) },
- { "vkEnumerateDeviceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(vulkan::api::EnumerateDeviceExtensionProperties) },
- { "vkEnumerateDeviceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(vulkan::api::EnumerateDeviceLayerProperties) },
+ { "vkCreatePipelineCache", reinterpret_cast<PFN_vkVoidFunction>(CreatePipelineCache) },
+ { "vkCreatePipelineLayout", reinterpret_cast<PFN_vkVoidFunction>(CreatePipelineLayout) },
+ { "vkCreateQueryPool", reinterpret_cast<PFN_vkVoidFunction>(CreateQueryPool) },
+ { "vkCreateRenderPass", reinterpret_cast<PFN_vkVoidFunction>(CreateRenderPass) },
+ { "vkCreateSampler", reinterpret_cast<PFN_vkVoidFunction>(CreateSampler) },
+ { "vkCreateSemaphore", reinterpret_cast<PFN_vkVoidFunction>(CreateSemaphore) },
+ { "vkCreateShaderModule", reinterpret_cast<PFN_vkVoidFunction>(CreateShaderModule) },
+ { "vkCreateSwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateSwapchainKHR) },
+ { "vkDestroyBuffer", reinterpret_cast<PFN_vkVoidFunction>(DestroyBuffer) },
+ { "vkDestroyBufferView", reinterpret_cast<PFN_vkVoidFunction>(DestroyBufferView) },
+ { "vkDestroyCommandPool", reinterpret_cast<PFN_vkVoidFunction>(DestroyCommandPool) },
+ { "vkDestroyDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(DestroyDescriptorPool) },
+ { "vkDestroyDescriptorSetLayout", reinterpret_cast<PFN_vkVoidFunction>(DestroyDescriptorSetLayout) },
+ { "vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(DestroyDevice) },
+ { "vkDestroyEvent", reinterpret_cast<PFN_vkVoidFunction>(DestroyEvent) },
+ { "vkDestroyFence", reinterpret_cast<PFN_vkVoidFunction>(DestroyFence) },
+ { "vkDestroyFramebuffer", reinterpret_cast<PFN_vkVoidFunction>(DestroyFramebuffer) },
+ { "vkDestroyImage", reinterpret_cast<PFN_vkVoidFunction>(DestroyImage) },
+ { "vkDestroyImageView", reinterpret_cast<PFN_vkVoidFunction>(DestroyImageView) },
+ { "vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(DestroyInstance) },
+ { "vkDestroyPipeline", reinterpret_cast<PFN_vkVoidFunction>(DestroyPipeline) },
+ { "vkDestroyPipelineCache", reinterpret_cast<PFN_vkVoidFunction>(DestroyPipelineCache) },
+ { "vkDestroyPipelineLayout", reinterpret_cast<PFN_vkVoidFunction>(DestroyPipelineLayout) },
+ { "vkDestroyQueryPool", reinterpret_cast<PFN_vkVoidFunction>(DestroyQueryPool) },
+ { "vkDestroyRenderPass", reinterpret_cast<PFN_vkVoidFunction>(DestroyRenderPass) },
+ { "vkDestroySampler", reinterpret_cast<PFN_vkVoidFunction>(DestroySampler) },
+ { "vkDestroySemaphore", reinterpret_cast<PFN_vkVoidFunction>(DestroySemaphore) },
+ { "vkDestroyShaderModule", reinterpret_cast<PFN_vkVoidFunction>(DestroyShaderModule) },
+ { "vkDestroySwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(DestroySwapchainKHR) },
+ { "vkDeviceWaitIdle", reinterpret_cast<PFN_vkVoidFunction>(DeviceWaitIdle) },
+ { "vkEndCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(EndCommandBuffer) },
+ { "vkEnumerateDeviceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateDeviceExtensionProperties) },
+ { "vkEnumerateDeviceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateDeviceLayerProperties) },
{ "vkEnumerateInstanceExtensionProperties", nullptr },
{ "vkEnumerateInstanceLayerProperties", nullptr },
- { "vkFlushMappedMemoryRanges", reinterpret_cast<PFN_vkVoidFunction>(vkFlushMappedMemoryRanges) },
- { "vkFreeCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(vkFreeCommandBuffers) },
- { "vkFreeDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(vkFreeDescriptorSets) },
- { "vkFreeMemory", reinterpret_cast<PFN_vkVoidFunction>(vkFreeMemory) },
- { "vkGetBufferMemoryRequirements", reinterpret_cast<PFN_vkVoidFunction>(vkGetBufferMemoryRequirements) },
- { "vkGetDeviceMemoryCommitment", reinterpret_cast<PFN_vkVoidFunction>(vkGetDeviceMemoryCommitment) },
- { "vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(vkGetDeviceProcAddr) },
- { "vkGetDeviceQueue", reinterpret_cast<PFN_vkVoidFunction>(vkGetDeviceQueue) },
- { "vkGetEventStatus", reinterpret_cast<PFN_vkVoidFunction>(vkGetEventStatus) },
- { "vkGetFenceStatus", reinterpret_cast<PFN_vkVoidFunction>(vkGetFenceStatus) },
- { "vkGetImageMemoryRequirements", reinterpret_cast<PFN_vkVoidFunction>(vkGetImageMemoryRequirements) },
- { "vkGetImageSparseMemoryRequirements", reinterpret_cast<PFN_vkVoidFunction>(vkGetImageSparseMemoryRequirements) },
- { "vkGetImageSubresourceLayout", reinterpret_cast<PFN_vkVoidFunction>(vkGetImageSubresourceLayout) },
- { "vkGetInstanceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(vkGetInstanceProcAddr) },
- { "vkGetPipelineCacheData", reinterpret_cast<PFN_vkVoidFunction>(vkGetPipelineCacheData) },
- { "vkGetQueryPoolResults", reinterpret_cast<PFN_vkVoidFunction>(vkGetQueryPoolResults) },
- { "vkGetRenderAreaGranularity", reinterpret_cast<PFN_vkVoidFunction>(vkGetRenderAreaGranularity) },
- { "vkGetSwapchainImagesKHR", reinterpret_cast<PFN_vkVoidFunction>(vkGetSwapchainImagesKHR) },
- { "vkInvalidateMappedMemoryRanges", reinterpret_cast<PFN_vkVoidFunction>(vkInvalidateMappedMemoryRanges) },
- { "vkMapMemory", reinterpret_cast<PFN_vkVoidFunction>(vkMapMemory) },
- { "vkMergePipelineCaches", reinterpret_cast<PFN_vkVoidFunction>(vkMergePipelineCaches) },
- { "vkQueueBindSparse", reinterpret_cast<PFN_vkVoidFunction>(vkQueueBindSparse) },
- { "vkQueuePresentKHR", reinterpret_cast<PFN_vkVoidFunction>(vkQueuePresentKHR) },
- { "vkQueueSubmit", reinterpret_cast<PFN_vkVoidFunction>(vkQueueSubmit) },
- { "vkQueueWaitIdle", reinterpret_cast<PFN_vkVoidFunction>(vkQueueWaitIdle) },
- { "vkResetCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(vkResetCommandBuffer) },
- { "vkResetCommandPool", reinterpret_cast<PFN_vkVoidFunction>(vkResetCommandPool) },
- { "vkResetDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(vkResetDescriptorPool) },
- { "vkResetEvent", reinterpret_cast<PFN_vkVoidFunction>(vkResetEvent) },
- { "vkResetFences", reinterpret_cast<PFN_vkVoidFunction>(vkResetFences) },
- { "vkSetEvent", reinterpret_cast<PFN_vkVoidFunction>(vkSetEvent) },
- { "vkUnmapMemory", reinterpret_cast<PFN_vkVoidFunction>(vkUnmapMemory) },
- { "vkUpdateDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(vkUpdateDescriptorSets) },
- { "vkWaitForFences", reinterpret_cast<PFN_vkVoidFunction>(vkWaitForFences) },
+ { "vkFlushMappedMemoryRanges", reinterpret_cast<PFN_vkVoidFunction>(FlushMappedMemoryRanges) },
+ { "vkFreeCommandBuffers", reinterpret_cast<PFN_vkVoidFunction>(FreeCommandBuffers) },
+ { "vkFreeDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(FreeDescriptorSets) },
+ { "vkFreeMemory", reinterpret_cast<PFN_vkVoidFunction>(FreeMemory) },
+ { "vkGetBufferMemoryRequirements", reinterpret_cast<PFN_vkVoidFunction>(GetBufferMemoryRequirements) },
+ { "vkGetDeviceMemoryCommitment", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceMemoryCommitment) },
+ { "vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr) },
+ { "vkGetDeviceQueue", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceQueue) },
+ { "vkGetEventStatus", reinterpret_cast<PFN_vkVoidFunction>(GetEventStatus) },
+ { "vkGetFenceStatus", reinterpret_cast<PFN_vkVoidFunction>(GetFenceStatus) },
+ { "vkGetImageMemoryRequirements", reinterpret_cast<PFN_vkVoidFunction>(GetImageMemoryRequirements) },
+ { "vkGetImageSparseMemoryRequirements", reinterpret_cast<PFN_vkVoidFunction>(GetImageSparseMemoryRequirements) },
+ { "vkGetImageSubresourceLayout", reinterpret_cast<PFN_vkVoidFunction>(GetImageSubresourceLayout) },
+ { "vkGetInstanceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetInstanceProcAddr) },
+ { "vkGetPipelineCacheData", reinterpret_cast<PFN_vkVoidFunction>(GetPipelineCacheData) },
+ { "vkGetQueryPoolResults", reinterpret_cast<PFN_vkVoidFunction>(GetQueryPoolResults) },
+ { "vkGetRenderAreaGranularity", reinterpret_cast<PFN_vkVoidFunction>(GetRenderAreaGranularity) },
+ { "vkGetSwapchainImagesKHR", reinterpret_cast<PFN_vkVoidFunction>(GetSwapchainImagesKHR) },
+ { "vkInvalidateMappedMemoryRanges", reinterpret_cast<PFN_vkVoidFunction>(InvalidateMappedMemoryRanges) },
+ { "vkMapMemory", reinterpret_cast<PFN_vkVoidFunction>(MapMemory) },
+ { "vkMergePipelineCaches", reinterpret_cast<PFN_vkVoidFunction>(MergePipelineCaches) },
+ { "vkQueueBindSparse", reinterpret_cast<PFN_vkVoidFunction>(QueueBindSparse) },
+ { "vkQueuePresentKHR", reinterpret_cast<PFN_vkVoidFunction>(QueuePresentKHR) },
+ { "vkQueueSubmit", reinterpret_cast<PFN_vkVoidFunction>(QueueSubmit) },
+ { "vkQueueWaitIdle", reinterpret_cast<PFN_vkVoidFunction>(QueueWaitIdle) },
+ { "vkResetCommandBuffer", reinterpret_cast<PFN_vkVoidFunction>(ResetCommandBuffer) },
+ { "vkResetCommandPool", reinterpret_cast<PFN_vkVoidFunction>(ResetCommandPool) },
+ { "vkResetDescriptorPool", reinterpret_cast<PFN_vkVoidFunction>(ResetDescriptorPool) },
+ { "vkResetEvent", reinterpret_cast<PFN_vkVoidFunction>(ResetEvent) },
+ { "vkResetFences", reinterpret_cast<PFN_vkVoidFunction>(ResetFences) },
+ { "vkSetEvent", reinterpret_cast<PFN_vkVoidFunction>(SetEvent) },
+ { "vkUnmapMemory", reinterpret_cast<PFN_vkVoidFunction>(UnmapMemory) },
+ { "vkUpdateDescriptorSets", reinterpret_cast<PFN_vkVoidFunction>(UpdateDescriptorSets) },
+ { "vkWaitForFences", reinterpret_cast<PFN_vkVoidFunction>(WaitForFences) },
};
// clang-format on
constexpr size_t count = sizeof(hooks) / sizeof(hooks[0]);
@@ -510,734 +639,1314 @@
hooks, hooks + count, pName,
[](const Hook& h, const char* n) { return strcmp(h.name, n) < 0; });
if (hook < hooks + count && strcmp(hook->name, pName) == 0) {
- if (!hook->proc)
- ALOGE("vkGetInstanceProcAddr called with %s with instance", pName);
+ if (!hook->proc) {
+ vulkan::driver::Logger(instance).Err(
+ instance, "invalid vkGetInstanceProcAddr(%p, \"%s\") call",
+ instance, pName);
+ }
return hook->proc;
}
// clang-format off
- return vulkan::api::GetData(instance).dispatch.GetInstanceProcAddr(instance, pName);
+ return GetData(instance).dispatch.GetInstanceProcAddr(instance, pName);
+}
+
+VKAPI_ATTR void GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties) {
+ GetData(physicalDevice).dispatch.GetPhysicalDeviceProperties(physicalDevice, pProperties);
+}
+
+VKAPI_ATTR void GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties) {
+ GetData(physicalDevice).dispatch.GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
+}
+
+VKAPI_ATTR void GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
+ GetData(physicalDevice).dispatch.GetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties);
+}
+
+VKAPI_ATTR void GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures) {
+ GetData(physicalDevice).dispatch.GetPhysicalDeviceFeatures(physicalDevice, pFeatures);
+}
+
+VKAPI_ATTR void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) {
+ GetData(physicalDevice).dispatch.GetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties);
+}
+
+VKAPI_ATTR VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
+ return GetData(physicalDevice).dispatch.GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties);
+}
+
+VKAPI_ATTR void GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue) {
+ GetData(device).dispatch.GetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue);
+}
+
+VKAPI_ATTR VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence) {
+ return GetData(queue).dispatch.QueueSubmit(queue, submitCount, pSubmits, fence);
+}
+
+VKAPI_ATTR VkResult QueueWaitIdle(VkQueue queue) {
+ return GetData(queue).dispatch.QueueWaitIdle(queue);
+}
+
+VKAPI_ATTR VkResult DeviceWaitIdle(VkDevice device) {
+ return GetData(device).dispatch.DeviceWaitIdle(device);
+}
+
+VKAPI_ATTR VkResult AllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory) {
+ return GetData(device).dispatch.AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
+}
+
+VKAPI_ATTR void FreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.FreeMemory(device, memory, pAllocator);
+}
+
+VKAPI_ATTR VkResult MapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData) {
+ return GetData(device).dispatch.MapMemory(device, memory, offset, size, flags, ppData);
+}
+
+VKAPI_ATTR void UnmapMemory(VkDevice device, VkDeviceMemory memory) {
+ GetData(device).dispatch.UnmapMemory(device, memory);
+}
+
+VKAPI_ATTR VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges) {
+ return GetData(device).dispatch.FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
+}
+
+VKAPI_ATTR VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges) {
+ return GetData(device).dispatch.InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
+}
+
+VKAPI_ATTR void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) {
+ GetData(device).dispatch.GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
+}
+
+VKAPI_ATTR void GetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements) {
+ GetData(device).dispatch.GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
+}
+
+VKAPI_ATTR VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset) {
+ return GetData(device).dispatch.BindBufferMemory(device, buffer, memory, memoryOffset);
+}
+
+VKAPI_ATTR void GetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements) {
+ GetData(device).dispatch.GetImageMemoryRequirements(device, image, pMemoryRequirements);
+}
+
+VKAPI_ATTR VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) {
+ return GetData(device).dispatch.BindImageMemory(device, image, memory, memoryOffset);
+}
+
+VKAPI_ATTR void GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
+ GetData(device).dispatch.GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
+}
+
+VKAPI_ATTR void GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties) {
+ GetData(physicalDevice).dispatch.GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties);
+}
+
+VKAPI_ATTR VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) {
+ return GetData(queue).dispatch.QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
+}
+
+VKAPI_ATTR VkResult CreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence) {
+ return GetData(device).dispatch.CreateFence(device, pCreateInfo, pAllocator, pFence);
+}
+
+VKAPI_ATTR void DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyFence(device, fence, pAllocator);
+}
+
+VKAPI_ATTR VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) {
+ return GetData(device).dispatch.ResetFences(device, fenceCount, pFences);
+}
+
+VKAPI_ATTR VkResult GetFenceStatus(VkDevice device, VkFence fence) {
+ return GetData(device).dispatch.GetFenceStatus(device, fence);
+}
+
+VKAPI_ATTR VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
+ return GetData(device).dispatch.WaitForFences(device, fenceCount, pFences, waitAll, timeout);
+}
+
+VKAPI_ATTR VkResult CreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore) {
+ return GetData(device).dispatch.CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
+}
+
+VKAPI_ATTR void DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroySemaphore(device, semaphore, pAllocator);
+}
+
+VKAPI_ATTR VkResult CreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent) {
+ return GetData(device).dispatch.CreateEvent(device, pCreateInfo, pAllocator, pEvent);
+}
+
+VKAPI_ATTR void DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyEvent(device, event, pAllocator);
+}
+
+VKAPI_ATTR VkResult GetEventStatus(VkDevice device, VkEvent event) {
+ return GetData(device).dispatch.GetEventStatus(device, event);
+}
+
+VKAPI_ATTR VkResult SetEvent(VkDevice device, VkEvent event) {
+ return GetData(device).dispatch.SetEvent(device, event);
+}
+
+VKAPI_ATTR VkResult ResetEvent(VkDevice device, VkEvent event) {
+ return GetData(device).dispatch.ResetEvent(device, event);
+}
+
+VKAPI_ATTR VkResult CreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool) {
+ return GetData(device).dispatch.CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
+}
+
+VKAPI_ATTR void DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyQueryPool(device, queryPool, pAllocator);
+}
+
+VKAPI_ATTR VkResult GetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags) {
+ return GetData(device).dispatch.GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
+}
+
+VKAPI_ATTR VkResult CreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer) {
+ return GetData(device).dispatch.CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
+}
+
+VKAPI_ATTR void DestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyBuffer(device, buffer, pAllocator);
+}
+
+VKAPI_ATTR VkResult CreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView) {
+ return GetData(device).dispatch.CreateBufferView(device, pCreateInfo, pAllocator, pView);
+}
+
+VKAPI_ATTR void DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyBufferView(device, bufferView, pAllocator);
+}
+
+VKAPI_ATTR VkResult CreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage) {
+ return GetData(device).dispatch.CreateImage(device, pCreateInfo, pAllocator, pImage);
+}
+
+VKAPI_ATTR void DestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyImage(device, image, pAllocator);
+}
+
+VKAPI_ATTR void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) {
+ GetData(device).dispatch.GetImageSubresourceLayout(device, image, pSubresource, pLayout);
+}
+
+VKAPI_ATTR VkResult CreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView) {
+ return GetData(device).dispatch.CreateImageView(device, pCreateInfo, pAllocator, pView);
+}
+
+VKAPI_ATTR void DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyImageView(device, imageView, pAllocator);
+}
+
+VKAPI_ATTR VkResult CreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule) {
+ return GetData(device).dispatch.CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule);
+}
+
+VKAPI_ATTR void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyShaderModule(device, shaderModule, pAllocator);
+}
+
+VKAPI_ATTR VkResult CreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache) {
+ return GetData(device).dispatch.CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache);
+}
+
+VKAPI_ATTR void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyPipelineCache(device, pipelineCache, pAllocator);
+}
+
+VKAPI_ATTR VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) {
+ return GetData(device).dispatch.GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
+}
+
+VKAPI_ATTR VkResult MergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) {
+ return GetData(device).dispatch.MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches);
+}
+
+VKAPI_ATTR VkResult CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) {
+ return GetData(device).dispatch.CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
+}
+
+VKAPI_ATTR VkResult CreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) {
+ return GetData(device).dispatch.CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
+}
+
+VKAPI_ATTR void DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyPipeline(device, pipeline, pAllocator);
+}
+
+VKAPI_ATTR VkResult CreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout) {
+ return GetData(device).dispatch.CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout);
+}
+
+VKAPI_ATTR void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyPipelineLayout(device, pipelineLayout, pAllocator);
+}
+
+VKAPI_ATTR VkResult CreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler) {
+ return GetData(device).dispatch.CreateSampler(device, pCreateInfo, pAllocator, pSampler);
+}
+
+VKAPI_ATTR void DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroySampler(device, sampler, pAllocator);
+}
+
+VKAPI_ATTR VkResult CreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout) {
+ return GetData(device).dispatch.CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout);
+}
+
+VKAPI_ATTR void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
+}
+
+VKAPI_ATTR VkResult CreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool) {
+ return GetData(device).dispatch.CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool);
+}
+
+VKAPI_ATTR void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyDescriptorPool(device, descriptorPool, pAllocator);
+}
+
+VKAPI_ATTR VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) {
+ return GetData(device).dispatch.ResetDescriptorPool(device, descriptorPool, flags);
+}
+
+VKAPI_ATTR VkResult AllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets) {
+ return GetData(device).dispatch.AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
+}
+
+VKAPI_ATTR VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets) {
+ return GetData(device).dispatch.FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets);
+}
+
+VKAPI_ATTR void UpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies) {
+ GetData(device).dispatch.UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
+}
+
+VKAPI_ATTR VkResult CreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer) {
+ return GetData(device).dispatch.CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer);
+}
+
+VKAPI_ATTR void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyFramebuffer(device, framebuffer, pAllocator);
+}
+
+VKAPI_ATTR VkResult CreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass) {
+ return GetData(device).dispatch.CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
+}
+
+VKAPI_ATTR void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyRenderPass(device, renderPass, pAllocator);
+}
+
+VKAPI_ATTR void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
+ GetData(device).dispatch.GetRenderAreaGranularity(device, renderPass, pGranularity);
+}
+
+VKAPI_ATTR VkResult CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool) {
+ return GetData(device).dispatch.CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool);
+}
+
+VKAPI_ATTR void DestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroyCommandPool(device, commandPool, pAllocator);
+}
+
+VKAPI_ATTR VkResult ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) {
+ return GetData(device).dispatch.ResetCommandPool(device, commandPool, flags);
+}
+
+VKAPI_ATTR VkResult AllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers) {
+ return GetData(device).dispatch.AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
+}
+
+VKAPI_ATTR void FreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers) {
+ GetData(device).dispatch.FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers);
+}
+
+VKAPI_ATTR VkResult BeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo) {
+ return GetData(commandBuffer).dispatch.BeginCommandBuffer(commandBuffer, pBeginInfo);
+}
+
+VKAPI_ATTR VkResult EndCommandBuffer(VkCommandBuffer commandBuffer) {
+ return GetData(commandBuffer).dispatch.EndCommandBuffer(commandBuffer);
+}
+
+VKAPI_ATTR VkResult ResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) {
+ return GetData(commandBuffer).dispatch.ResetCommandBuffer(commandBuffer, flags);
+}
+
+VKAPI_ATTR void CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
+ GetData(commandBuffer).dispatch.CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
+}
+
+VKAPI_ATTR void CmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports) {
+ GetData(commandBuffer).dispatch.CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports);
+}
+
+VKAPI_ATTR void CmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors) {
+ GetData(commandBuffer).dispatch.CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
+}
+
+VKAPI_ATTR void CmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
+ GetData(commandBuffer).dispatch.CmdSetLineWidth(commandBuffer, lineWidth);
+}
+
+VKAPI_ATTR void CmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) {
+ GetData(commandBuffer).dispatch.CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
+}
+
+VKAPI_ATTR void CmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) {
+ GetData(commandBuffer).dispatch.CmdSetBlendConstants(commandBuffer, blendConstants);
+}
+
+VKAPI_ATTR void CmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) {
+ GetData(commandBuffer).dispatch.CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
+}
+
+VKAPI_ATTR void CmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask) {
+ GetData(commandBuffer).dispatch.CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
+}
+
+VKAPI_ATTR void CmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) {
+ GetData(commandBuffer).dispatch.CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
+}
+
+VKAPI_ATTR void CmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) {
+ GetData(commandBuffer).dispatch.CmdSetStencilReference(commandBuffer, faceMask, reference);
+}
+
+VKAPI_ATTR void CmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets) {
+ GetData(commandBuffer).dispatch.CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
+}
+
+VKAPI_ATTR void CmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
+ GetData(commandBuffer).dispatch.CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
+}
+
+VKAPI_ATTR void CmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {
+ GetData(commandBuffer).dispatch.CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets);
+}
+
+VKAPI_ATTR void CmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
+ GetData(commandBuffer).dispatch.CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
+}
+
+VKAPI_ATTR void CmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) {
+ GetData(commandBuffer).dispatch.CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
+}
+
+VKAPI_ATTR void CmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
+ GetData(commandBuffer).dispatch.CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
+}
+
+VKAPI_ATTR void CmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
+ GetData(commandBuffer).dispatch.CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride);
+}
+
+VKAPI_ATTR void CmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) {
+ GetData(commandBuffer).dispatch.CmdDispatch(commandBuffer, x, y, z);
+}
+
+VKAPI_ATTR void CmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) {
+ GetData(commandBuffer).dispatch.CmdDispatchIndirect(commandBuffer, buffer, offset);
+}
+
+VKAPI_ATTR void CmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) {
+ GetData(commandBuffer).dispatch.CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions);
+}
+
+VKAPI_ATTR void CmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) {
+ GetData(commandBuffer).dispatch.CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
+}
+
+VKAPI_ATTR void CmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter) {
+ GetData(commandBuffer).dispatch.CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
+}
+
+VKAPI_ATTR void CmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
+ GetData(commandBuffer).dispatch.CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
+}
+
+VKAPI_ATTR void CmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
+ GetData(commandBuffer).dispatch.CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
+}
+
+VKAPI_ATTR void CmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t* pData) {
+ GetData(commandBuffer).dispatch.CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
+}
+
+VKAPI_ATTR void CmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) {
+ GetData(commandBuffer).dispatch.CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
+}
+
+VKAPI_ATTR void CmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
+ GetData(commandBuffer).dispatch.CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
+}
+
+VKAPI_ATTR void CmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
+ GetData(commandBuffer).dispatch.CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
+}
+
+VKAPI_ATTR void CmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) {
+ GetData(commandBuffer).dispatch.CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
+}
+
+VKAPI_ATTR void CmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) {
+ GetData(commandBuffer).dispatch.CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
+}
+
+VKAPI_ATTR void CmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
+ GetData(commandBuffer).dispatch.CmdSetEvent(commandBuffer, event, stageMask);
+}
+
+VKAPI_ATTR void CmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
+ GetData(commandBuffer).dispatch.CmdResetEvent(commandBuffer, event, stageMask);
+}
+
+VKAPI_ATTR void CmdWaitEvents(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) {
+ GetData(commandBuffer).dispatch.CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
+}
+
+VKAPI_ATTR void CmdPipelineBarrier(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) {
+ GetData(commandBuffer).dispatch.CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
+}
+
+VKAPI_ATTR void CmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags) {
+ GetData(commandBuffer).dispatch.CmdBeginQuery(commandBuffer, queryPool, query, flags);
+}
+
+VKAPI_ATTR void CmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query) {
+ GetData(commandBuffer).dispatch.CmdEndQuery(commandBuffer, queryPool, query);
+}
+
+VKAPI_ATTR void CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) {
+ GetData(commandBuffer).dispatch.CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
+}
+
+VKAPI_ATTR void CmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query) {
+ GetData(commandBuffer).dispatch.CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query);
+}
+
+VKAPI_ATTR void CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags) {
+ GetData(commandBuffer).dispatch.CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags);
+}
+
+VKAPI_ATTR void CmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues) {
+ GetData(commandBuffer).dispatch.CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues);
+}
+
+VKAPI_ATTR void CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) {
+ GetData(commandBuffer).dispatch.CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
+}
+
+VKAPI_ATTR void CmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
+ GetData(commandBuffer).dispatch.CmdNextSubpass(commandBuffer, contents);
+}
+
+VKAPI_ATTR void CmdEndRenderPass(VkCommandBuffer commandBuffer) {
+ GetData(commandBuffer).dispatch.CmdEndRenderPass(commandBuffer);
+}
+
+VKAPI_ATTR void CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers) {
+ GetData(commandBuffer).dispatch.CmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers);
+}
+
+VKAPI_ATTR void DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator) {
+ GetData(instance).dispatch.DestroySurfaceKHR(instance, surface, pAllocator);
+}
+
+VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported) {
+ return GetData(physicalDevice).dispatch.GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported);
+}
+
+VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
+ return GetData(physicalDevice).dispatch.GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities);
+}
+
+VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats) {
+ return GetData(physicalDevice).dispatch.GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats);
+}
+
+VKAPI_ATTR VkResult GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes) {
+ return GetData(physicalDevice).dispatch.GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, pPresentModes);
+}
+
+VKAPI_ATTR VkResult CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain) {
+ return GetData(device).dispatch.CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain);
+}
+
+VKAPI_ATTR void DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator) {
+ GetData(device).dispatch.DestroySwapchainKHR(device, swapchain, pAllocator);
+}
+
+VKAPI_ATTR VkResult GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages) {
+ return GetData(device).dispatch.GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages);
+}
+
+VKAPI_ATTR VkResult AcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex) {
+ return GetData(device).dispatch.AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex);
+}
+
+VKAPI_ATTR VkResult QueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* pPresentInfo) {
+ return GetData(queue).dispatch.QueuePresentKHR(queue, pPresentInfo);
+}
+
+VKAPI_ATTR VkResult CreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) {
+ return GetData(instance).dispatch.CreateAndroidSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface);
+}
+
+
+} // anonymous namespace
+
+// clang-format on
+
+} // namespace api
+} // namespace vulkan
+
+// clang-format off
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) {
+ return vulkan::api::CreateInstance(pCreateInfo, pAllocator, pInstance);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR void vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator) {
+ vulkan::api::DestroyInstance(instance, pAllocator);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR VkResult vkEnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices) {
+ return vulkan::api::EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR PFN_vkVoidFunction vkGetDeviceProcAddr(VkDevice device, const char* pName) {
+ return vulkan::api::GetDeviceProcAddr(device, pName);
+}
+
+__attribute__((visibility("default")))
+VKAPI_ATTR PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance instance, const char* pName) {
+ return vulkan::api::GetInstanceProcAddr(instance, pName);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties) {
- vulkan::api::GetData(physicalDevice).dispatch.GetPhysicalDeviceProperties(physicalDevice, pProperties);
+ vulkan::api::GetPhysicalDeviceProperties(physicalDevice, pProperties);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties) {
- vulkan::api::GetData(physicalDevice).dispatch.GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
+ vulkan::api::GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
- vulkan::api::GetData(physicalDevice).dispatch.GetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties);
+ vulkan::api::GetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures) {
- vulkan::api::GetData(physicalDevice).dispatch.GetPhysicalDeviceFeatures(physicalDevice, pFeatures);
+ vulkan::api::GetPhysicalDeviceFeatures(physicalDevice, pFeatures);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) {
- vulkan::api::GetData(physicalDevice).dispatch.GetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties);
+ vulkan::api::GetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
- return vulkan::api::GetData(physicalDevice).dispatch.GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties);
+ return vulkan::api::GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice) {
- // call into api.cpp
return vulkan::api::CreateDevice(physicalDevice, pCreateInfo, pAllocator, pDevice);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator) {
- // call into api.cpp
vulkan::api::DestroyDevice(device, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties) {
- // call into api.cpp
return vulkan::api::EnumerateInstanceLayerProperties(pPropertyCount, pProperties);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkEnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) {
- // call into api.cpp
return vulkan::api::EnumerateInstanceExtensionProperties(pLayerName, pPropertyCount, pProperties);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties) {
- // call into api.cpp
return vulkan::api::EnumerateDeviceLayerProperties(physicalDevice, pPropertyCount, pProperties);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) {
- // call into api.cpp
return vulkan::api::EnumerateDeviceExtensionProperties(physicalDevice, pLayerName, pPropertyCount, pProperties);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue) {
- vulkan::api::GetData(device).dispatch.GetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue);
+ vulkan::api::GetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence) {
- return vulkan::api::GetData(queue).dispatch.QueueSubmit(queue, submitCount, pSubmits, fence);
+ return vulkan::api::QueueSubmit(queue, submitCount, pSubmits, fence);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkQueueWaitIdle(VkQueue queue) {
- return vulkan::api::GetData(queue).dispatch.QueueWaitIdle(queue);
+ return vulkan::api::QueueWaitIdle(queue);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkDeviceWaitIdle(VkDevice device) {
- return vulkan::api::GetData(device).dispatch.DeviceWaitIdle(device);
+ return vulkan::api::DeviceWaitIdle(device);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory) {
- return vulkan::api::GetData(device).dispatch.AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
+ return vulkan::api::AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.FreeMemory(device, memory, pAllocator);
+ vulkan::api::FreeMemory(device, memory, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData) {
- return vulkan::api::GetData(device).dispatch.MapMemory(device, memory, offset, size, flags, ppData);
+ return vulkan::api::MapMemory(device, memory, offset, size, flags, ppData);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkUnmapMemory(VkDevice device, VkDeviceMemory memory) {
- vulkan::api::GetData(device).dispatch.UnmapMemory(device, memory);
+ vulkan::api::UnmapMemory(device, memory);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges) {
- return vulkan::api::GetData(device).dispatch.FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
+ return vulkan::api::FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges) {
- return vulkan::api::GetData(device).dispatch.InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
+ return vulkan::api::InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) {
- vulkan::api::GetData(device).dispatch.GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
+ vulkan::api::GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements) {
- vulkan::api::GetData(device).dispatch.GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
+ vulkan::api::GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset) {
- return vulkan::api::GetData(device).dispatch.BindBufferMemory(device, buffer, memory, memoryOffset);
+ return vulkan::api::BindBufferMemory(device, buffer, memory, memoryOffset);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements) {
- vulkan::api::GetData(device).dispatch.GetImageMemoryRequirements(device, image, pMemoryRequirements);
+ vulkan::api::GetImageMemoryRequirements(device, image, pMemoryRequirements);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) {
- return vulkan::api::GetData(device).dispatch.BindImageMemory(device, image, memory, memoryOffset);
+ return vulkan::api::BindImageMemory(device, image, memory, memoryOffset);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
- vulkan::api::GetData(device).dispatch.GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
+ vulkan::api::GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties) {
- vulkan::api::GetData(physicalDevice).dispatch.GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties);
+ vulkan::api::GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) {
- return vulkan::api::GetData(queue).dispatch.QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
+ return vulkan::api::QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence) {
- return vulkan::api::GetData(device).dispatch.CreateFence(device, pCreateInfo, pAllocator, pFence);
+ return vulkan::api::CreateFence(device, pCreateInfo, pAllocator, pFence);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyFence(device, fence, pAllocator);
+ vulkan::api::DestroyFence(device, fence, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) {
- return vulkan::api::GetData(device).dispatch.ResetFences(device, fenceCount, pFences);
+ return vulkan::api::ResetFences(device, fenceCount, pFences);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkGetFenceStatus(VkDevice device, VkFence fence) {
- return vulkan::api::GetData(device).dispatch.GetFenceStatus(device, fence);
+ return vulkan::api::GetFenceStatus(device, fence);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
- return vulkan::api::GetData(device).dispatch.WaitForFences(device, fenceCount, pFences, waitAll, timeout);
+ return vulkan::api::WaitForFences(device, fenceCount, pFences, waitAll, timeout);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore) {
- return vulkan::api::GetData(device).dispatch.CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
+ return vulkan::api::CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroySemaphore(device, semaphore, pAllocator);
+ vulkan::api::DestroySemaphore(device, semaphore, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent) {
- return vulkan::api::GetData(device).dispatch.CreateEvent(device, pCreateInfo, pAllocator, pEvent);
+ return vulkan::api::CreateEvent(device, pCreateInfo, pAllocator, pEvent);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyEvent(device, event, pAllocator);
+ vulkan::api::DestroyEvent(device, event, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkGetEventStatus(VkDevice device, VkEvent event) {
- return vulkan::api::GetData(device).dispatch.GetEventStatus(device, event);
+ return vulkan::api::GetEventStatus(device, event);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkSetEvent(VkDevice device, VkEvent event) {
- return vulkan::api::GetData(device).dispatch.SetEvent(device, event);
+ return vulkan::api::SetEvent(device, event);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkResetEvent(VkDevice device, VkEvent event) {
- return vulkan::api::GetData(device).dispatch.ResetEvent(device, event);
+ return vulkan::api::ResetEvent(device, event);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool) {
- return vulkan::api::GetData(device).dispatch.CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
+ return vulkan::api::CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyQueryPool(device, queryPool, pAllocator);
+ vulkan::api::DestroyQueryPool(device, queryPool, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags) {
- return vulkan::api::GetData(device).dispatch.GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
+ return vulkan::api::GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer) {
- return vulkan::api::GetData(device).dispatch.CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
+ return vulkan::api::CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyBuffer(device, buffer, pAllocator);
+ vulkan::api::DestroyBuffer(device, buffer, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView) {
- return vulkan::api::GetData(device).dispatch.CreateBufferView(device, pCreateInfo, pAllocator, pView);
+ return vulkan::api::CreateBufferView(device, pCreateInfo, pAllocator, pView);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyBufferView(device, bufferView, pAllocator);
+ vulkan::api::DestroyBufferView(device, bufferView, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage) {
- return vulkan::api::GetData(device).dispatch.CreateImage(device, pCreateInfo, pAllocator, pImage);
+ return vulkan::api::CreateImage(device, pCreateInfo, pAllocator, pImage);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyImage(device, image, pAllocator);
+ vulkan::api::DestroyImage(device, image, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) {
- vulkan::api::GetData(device).dispatch.GetImageSubresourceLayout(device, image, pSubresource, pLayout);
+ vulkan::api::GetImageSubresourceLayout(device, image, pSubresource, pLayout);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView) {
- return vulkan::api::GetData(device).dispatch.CreateImageView(device, pCreateInfo, pAllocator, pView);
+ return vulkan::api::CreateImageView(device, pCreateInfo, pAllocator, pView);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyImageView(device, imageView, pAllocator);
+ vulkan::api::DestroyImageView(device, imageView, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule) {
- return vulkan::api::GetData(device).dispatch.CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule);
+ return vulkan::api::CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyShaderModule(device, shaderModule, pAllocator);
+ vulkan::api::DestroyShaderModule(device, shaderModule, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache) {
- return vulkan::api::GetData(device).dispatch.CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache);
+ return vulkan::api::CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyPipelineCache(device, pipelineCache, pAllocator);
+ vulkan::api::DestroyPipelineCache(device, pipelineCache, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) {
- return vulkan::api::GetData(device).dispatch.GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
+ return vulkan::api::GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) {
- return vulkan::api::GetData(device).dispatch.MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches);
+ return vulkan::api::MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) {
- return vulkan::api::GetData(device).dispatch.CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
+ return vulkan::api::CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) {
- return vulkan::api::GetData(device).dispatch.CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
+ return vulkan::api::CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyPipeline(device, pipeline, pAllocator);
+ vulkan::api::DestroyPipeline(device, pipeline, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout) {
- return vulkan::api::GetData(device).dispatch.CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout);
+ return vulkan::api::CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyPipelineLayout(device, pipelineLayout, pAllocator);
+ vulkan::api::DestroyPipelineLayout(device, pipelineLayout, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler) {
- return vulkan::api::GetData(device).dispatch.CreateSampler(device, pCreateInfo, pAllocator, pSampler);
+ return vulkan::api::CreateSampler(device, pCreateInfo, pAllocator, pSampler);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroySampler(device, sampler, pAllocator);
+ vulkan::api::DestroySampler(device, sampler, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout) {
- return vulkan::api::GetData(device).dispatch.CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout);
+ return vulkan::api::CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
+ vulkan::api::DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool) {
- return vulkan::api::GetData(device).dispatch.CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool);
+ return vulkan::api::CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyDescriptorPool(device, descriptorPool, pAllocator);
+ vulkan::api::DestroyDescriptorPool(device, descriptorPool, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) {
- return vulkan::api::GetData(device).dispatch.ResetDescriptorPool(device, descriptorPool, flags);
+ return vulkan::api::ResetDescriptorPool(device, descriptorPool, flags);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets) {
- return vulkan::api::GetData(device).dispatch.AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
+ return vulkan::api::AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets) {
- return vulkan::api::GetData(device).dispatch.FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets);
+ return vulkan::api::FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies) {
- vulkan::api::GetData(device).dispatch.UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
+ vulkan::api::UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer) {
- return vulkan::api::GetData(device).dispatch.CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer);
+ return vulkan::api::CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyFramebuffer(device, framebuffer, pAllocator);
+ vulkan::api::DestroyFramebuffer(device, framebuffer, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass) {
- return vulkan::api::GetData(device).dispatch.CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
+ return vulkan::api::CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyRenderPass(device, renderPass, pAllocator);
+ vulkan::api::DestroyRenderPass(device, renderPass, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
- vulkan::api::GetData(device).dispatch.GetRenderAreaGranularity(device, renderPass, pGranularity);
+ vulkan::api::GetRenderAreaGranularity(device, renderPass, pGranularity);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool) {
- return vulkan::api::GetData(device).dispatch.CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool);
+ return vulkan::api::CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroyCommandPool(device, commandPool, pAllocator);
+ vulkan::api::DestroyCommandPool(device, commandPool, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) {
- return vulkan::api::GetData(device).dispatch.ResetCommandPool(device, commandPool, flags);
+ return vulkan::api::ResetCommandPool(device, commandPool, flags);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers) {
- return vulkan::api::GetData(device).dispatch.AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
+ return vulkan::api::AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers) {
- vulkan::api::GetData(device).dispatch.FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers);
+ vulkan::api::FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo) {
- return vulkan::api::GetData(commandBuffer).dispatch.BeginCommandBuffer(commandBuffer, pBeginInfo);
+ return vulkan::api::BeginCommandBuffer(commandBuffer, pBeginInfo);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
- return vulkan::api::GetData(commandBuffer).dispatch.EndCommandBuffer(commandBuffer);
+ return vulkan::api::EndCommandBuffer(commandBuffer);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) {
- return vulkan::api::GetData(commandBuffer).dispatch.ResetCommandBuffer(commandBuffer, flags);
+ return vulkan::api::ResetCommandBuffer(commandBuffer, flags);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
+ vulkan::api::CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports);
+ vulkan::api::CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
+ vulkan::api::CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdSetLineWidth(commandBuffer, lineWidth);
+ vulkan::api::CmdSetLineWidth(commandBuffer, lineWidth);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
+ vulkan::api::CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdSetBlendConstants(commandBuffer, blendConstants);
+ vulkan::api::CmdSetBlendConstants(commandBuffer, blendConstants);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
+ vulkan::api::CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
+ vulkan::api::CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
+ vulkan::api::CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdSetStencilReference(commandBuffer, faceMask, reference);
+ vulkan::api::CmdSetStencilReference(commandBuffer, faceMask, reference);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
+ vulkan::api::CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
+ vulkan::api::CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets);
+ vulkan::api::CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
+ vulkan::api::CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
+ vulkan::api::CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
+ vulkan::api::CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride);
+ vulkan::api::CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdDispatch(commandBuffer, x, y, z);
+ vulkan::api::CmdDispatch(commandBuffer, x, y, z);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdDispatchIndirect(commandBuffer, buffer, offset);
+ vulkan::api::CmdDispatchIndirect(commandBuffer, buffer, offset);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions);
+ vulkan::api::CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
+ vulkan::api::CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
+ vulkan::api::CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
+ vulkan::api::CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
+ vulkan::api::CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t* pData) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
+ vulkan::api::CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
+ vulkan::api::CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
+ vulkan::api::CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
+ vulkan::api::CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
+ vulkan::api::CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
+ vulkan::api::CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdSetEvent(commandBuffer, event, stageMask);
+ vulkan::api::CmdSetEvent(commandBuffer, event, stageMask);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdResetEvent(commandBuffer, event, stageMask);
+ vulkan::api::CmdResetEvent(commandBuffer, event, stageMask);
}
__attribute__((visibility("default")))
VKAPI_ATTR void 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) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
+ vulkan::api::CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
}
__attribute__((visibility("default")))
VKAPI_ATTR void 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) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
+ vulkan::api::CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdBeginQuery(commandBuffer, queryPool, query, flags);
+ vulkan::api::CmdBeginQuery(commandBuffer, queryPool, query, flags);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdEndQuery(commandBuffer, queryPool, query);
+ vulkan::api::CmdEndQuery(commandBuffer, queryPool, query);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
+ vulkan::api::CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query);
+ vulkan::api::CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags);
+ vulkan::api::CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues);
+ vulkan::api::CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
+ vulkan::api::CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdNextSubpass(commandBuffer, contents);
+ vulkan::api::CmdNextSubpass(commandBuffer, contents);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdEndRenderPass(commandBuffer);
+ vulkan::api::CmdEndRenderPass(commandBuffer);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers) {
- vulkan::api::GetData(commandBuffer).dispatch.CmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers);
+ vulkan::api::CmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(instance).dispatch.DestroySurfaceKHR(instance, surface, pAllocator);
+ vulkan::api::DestroySurfaceKHR(instance, surface, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported) {
- return vulkan::api::GetData(physicalDevice).dispatch.GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported);
+ return vulkan::api::GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
- return vulkan::api::GetData(physicalDevice).dispatch.GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities);
+ return vulkan::api::GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats) {
- return vulkan::api::GetData(physicalDevice).dispatch.GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats);
+ return vulkan::api::GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes) {
- return vulkan::api::GetData(physicalDevice).dispatch.GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, pPresentModes);
+ return vulkan::api::GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, pPresentModes);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain) {
- return vulkan::api::GetData(device).dispatch.CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain);
+ return vulkan::api::CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain);
}
__attribute__((visibility("default")))
VKAPI_ATTR void vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator) {
- vulkan::api::GetData(device).dispatch.DestroySwapchainKHR(device, swapchain, pAllocator);
+ vulkan::api::DestroySwapchainKHR(device, swapchain, pAllocator);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages) {
- return vulkan::api::GetData(device).dispatch.GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages);
+ return vulkan::api::GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex) {
- return vulkan::api::GetData(device).dispatch.AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex);
+ return vulkan::api::AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* pPresentInfo) {
- return vulkan::api::GetData(queue).dispatch.QueuePresentKHR(queue, pPresentInfo);
+ return vulkan::api::QueuePresentKHR(queue, pPresentInfo);
}
__attribute__((visibility("default")))
VKAPI_ATTR VkResult vkCreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) {
- return vulkan::api::GetData(instance).dispatch.CreateAndroidSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface);
+ return vulkan::api::CreateAndroidSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface);
}
// clang-format on
diff --git a/vulkan/libvulkan/api_gen.h b/vulkan/libvulkan/api_gen.h
index 779b654..7f8d274 100644
--- a/vulkan/libvulkan/api_gen.h
+++ b/vulkan/libvulkan/api_gen.h
@@ -38,7 +38,6 @@
PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties;
PFN_vkCreateDevice CreateDevice;
- PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
diff --git a/vulkan/libvulkan/code-generator.tmpl b/vulkan/libvulkan/code-generator.tmpl
index 3968371..f9a4670 100644
--- a/vulkan/libvulkan/code-generator.tmpl
+++ b/vulkan/libvulkan/code-generator.tmpl
@@ -94,6 +94,8 @@
#include <algorithm>
#include <log/log.h>
¶
+// to catch mismatches between vulkan.h and this file
+#undef VK_NO_PROTOTYPES
#include "api.h"
¶
namespace vulkan {«
@@ -150,6 +152,36 @@
return success;
}
¶
+// clang-format off
+¶
+namespace {«
+¶
+// forward declarations needed by GetInstanceProcAddr and GetDeviceProcAddr
+{{range $f := AllCommands $}}
+ {{if and (Macro "IsFunctionExported" $f) (not (Macro "api.IsIntercepted" $f))}}
+ VKAPI_ATTR {{Node "Type" $f.Return}} {{Macro "BaseName" $f}}({{Macro "Parameters" $f}});
+ {{end}}
+{{end}}
+¶
+{{range $f := AllCommands $}}
+ {{if and (Macro "IsFunctionExported" $f) (not (Macro "api.IsIntercepted" $f))}}
+ VKAPI_ATTR {{Node "Type" $f.Return}} {{Macro "BaseName" $f}}({{Macro "Parameters" $f}}) {
+ {{ if eq $f.Name "vkGetInstanceProcAddr"}}
+ {{Macro "api.C++.InterceptInstanceProcAddr" $}}
+ {{else if eq $f.Name "vkGetDeviceProcAddr"}}
+ {{Macro "api.C++.InterceptDeviceProcAddr" $}}
+ {{end}}
+
+ {{Macro "api.C++.Dispatch" $f}}
+ }
+ ¶
+ {{end}}
+{{end}}
+¶
+»} // anonymous namespace
+¶
+// clang-format on
+¶
»} // namespace api
»} // namespace vulkan
¶
@@ -159,13 +191,8 @@
{{if (Macro "IsFunctionExported" $f)}}
__attribute__((visibility("default")))
VKAPI_ATTR {{Node "Type" $f.Return}} {{$f.Name}}({{Macro "Parameters" $f}}) {
- {{ if eq $f.Name "vkGetInstanceProcAddr"}}
- {{Macro "api.C++.InterceptInstanceProcAddr" $}}
- {{else if eq $f.Name "vkGetDeviceProcAddr"}}
- {{Macro "api.C++.InterceptDeviceProcAddr" $}}
- {{end}}
-
- {{Macro "api.C++.Dispatch" $f}}
+ {{if not (IsVoid $f.Return.Type)}}return §{{end}}
+ vulkan::api::{{Macro "BaseName" $f}}({{Macro "Arguments" $f}});
}
¶
{{end}}
@@ -407,7 +434,10 @@
{{AssertType $ "Function"}}
{{if and (Macro "IsFunctionExported" $) (Macro "IsInstanceDispatched" $)}}
- true
+ {{/* deprecated and unused internally */}}
+ {{if not (eq $.Name "vkEnumerateDeviceLayerProperties")}}
+ true
+ {{end}}
{{end}}
{{end}}
@@ -482,10 +512,16 @@
{{$ext_name := index $ext.Arguments 0}}
{{$base := (Macro "BaseName" $)}}
- {{$unnamed_params := (ForEach $.CallParameters "ParameterType" | JoinWith ", ")}}
- VKAPI_ATTR {{Node "Type" $.Return}} disabled{{$base}}({{$unnamed_params}}) {
- ALOGE("{{$ext_name}} not enabled. {{$.Name}} not executed.");
+ {{$p0 := (index $.CallParameters 0)}}
+ {{$ptail := (Tail 1 $.CallParameters)}}
+
+ {{$first_type := (Macro "Parameter" $p0)}}
+ {{$tail_types := (ForEach $ptail "ParameterType" | JoinWith ", ")}}
+
+ VKAPI_ATTR {{Node "Type" $.Return}} disabled{{$base}}({{$first_type}}, {{$tail_types}}) {
+ driver::Logger({{$p0.Name}}).Err({{$p0.Name}}, §
+ "{{$ext_name}} not enabled. Exported {{$.Name}} not executed.");
{{if not (IsVoid $.Return.Type)}}return VK_SUCCESS;{{end}}
}
¶
@@ -502,16 +538,15 @@
{{AssertType $ "API"}}
// global functions
- if (!instance) {
+ if (instance == VK_NULL_HANDLE) {
{{range $f := AllCommands $}}
{{if (Macro "IsGloballyDispatched" $f)}}
if (strcmp(pName, "{{$f.Name}}") == 0) return §
- reinterpret_cast<PFN_vkVoidFunction>(§
- vulkan::api::{{Macro "BaseName" $f}});
+ reinterpret_cast<PFN_vkVoidFunction>({{Macro "BaseName" $f}});
{{end}}
{{end}}
¶
- ALOGE("vkGetInstanceProcAddr called with %s without instance", pName);
+ ALOGE("invalid vkGetInstanceProcAddr(VK_NULL_HANDLE, \"%s\") call", pName);
return nullptr;
}
¶
@@ -528,16 +563,16 @@
{{/* redirect intercepted functions */}}
{{else if (Macro "api.IsIntercepted" $f)}}
{ "{{$f.Name}}", reinterpret_cast<PFN_vkVoidFunction>(§
- vulkan::api::{{Macro "BaseName" $f}}) },
+ {{Macro "BaseName" $f}}) },
{{/* redirect vkGetInstanceProcAddr to itself */}}
{{else if eq $f.Name "vkGetInstanceProcAddr"}}
- { "{{$f.Name}}", reinterpret_cast<PFN_vkVoidFunction>({{$f.Name}}) },
+ { "{{$f.Name}}", reinterpret_cast<PFN_vkVoidFunction>({{Macro "BaseName" $f}}) },
{{/* redirect device functions to themselves as a workaround for
layers that do not intercept in their vkGetInstanceProcAddr */}}
{{else if (Macro "IsDeviceDispatched" $f)}}
- { "{{$f.Name}}", reinterpret_cast<PFN_vkVoidFunction>({{$f.Name}}) },
+ { "{{$f.Name}}", reinterpret_cast<PFN_vkVoidFunction>({{Macro "BaseName" $f}}) },
{{end}}
{{end}}
@@ -549,8 +584,11 @@
hooks, hooks + count, pName,
[](const Hook& h, const char* n) { return strcmp(h.name, n) < 0; });
if (hook < hooks + count && strcmp(hook->name, pName) == 0) {
- if (!hook->proc)
- ALOGE("vkGetInstanceProcAddr called with %s with instance", pName);
+ if (!hook->proc) {
+ vulkan::driver::Logger(instance).Err(
+ instance, "invalid vkGetInstanceProcAddr(%p, \"%s\") call",
+ instance, pName);
+ }
return hook->proc;
}
// clang-format off
@@ -567,7 +605,7 @@
{{AssertType $ "API"}}
if (device == VK_NULL_HANDLE) {
- ALOGE("vkGetDeviceProcAddr called with invalid device");
+ ALOGE("invalid vkGetDeviceProcAddr(VK_NULL_HANDLE, ...) call");
return nullptr;
}
¶
@@ -587,7 +625,9 @@
std::binary_search(
known_non_device_names, known_non_device_names + count, pName,
[](const char* a, const char* b) { return (strcmp(a, b) < 0); })) {
- ALOGE("vkGetDeviceProcAddr called with %s", (pName) ? pName : "(null)");
+ vulkan::driver::Logger(device).Err(§
+ device, "invalid vkGetDeviceProcAddr(%p, \"%s\") call", device,§
+ (pName) ? pName : "(null)");
return nullptr;
}
// clang-format off
@@ -597,11 +637,11 @@
{{ if (Macro "api.IsIntercepted" $f)}}
if (strcmp(pName, "{{$f.Name}}") == 0) return §
reinterpret_cast<PFN_vkVoidFunction>(§
- vulkan::api::{{Macro "BaseName" $f}});
+ {{Macro "BaseName" $f}});
{{else if eq $f.Name "vkGetDeviceProcAddr"}}
if (strcmp(pName, "{{$f.Name}}") == 0) return §
reinterpret_cast<PFN_vkVoidFunction>(§
- {{$f.Name}});
+ {{Macro "BaseName" $f}});
{{end}}
{{end}}
{{end}}
@@ -616,17 +656,14 @@
*/}}
{{define "api.C++.Dispatch"}}
{{AssertType $ "Function"}}
-
- {{if (Macro "api.IsIntercepted" $)}}// call into api.cpp{{end}}
- {{if not (IsVoid $.Return.Type)}}return §{{end}}
-
{{if (Macro "api.IsIntercepted" $)}}
- vulkan::api::§
- {{else}}
- {{$p0 := index $.CallParameters 0}}
- vulkan::api::GetData({{$p0.Name}}).dispatch.§
+ {{Error "$.Name should not be generated"}}
{{end}}
+ {{if not (IsVoid $.Return.Type)}}return §{{end}}
+
+ {{$p0 := index $.CallParameters 0}}
+ GetData({{$p0.Name}}).dispatch.§
{{Macro "BaseName" $}}({{Macro "Arguments" $}});
{{end}}
@@ -775,7 +812,6 @@
{{$ext_name := index $ext.Arguments 0}}
{{$base := (Macro "BaseName" $)}}
- {{$unnamed_params := (ForEach $.CallParameters "ParameterType" | JoinWith ", ")}}
VKAPI_ATTR {{Node "Type" $.Return}} checked{{$base}}({{Macro "Parameters" $}}) {
{{$p0 := index $.CallParameters 0}}
@@ -785,7 +821,7 @@
{{if not (IsVoid $.Return.Type)}}return §{{end}}
{{$base}}({{Macro "Arguments" $}});
} else {
- ALOGE("{{$ext_name}} not enabled. {{$.Name}} not executed.");
+ Logger({{$p0.Name}}).Err({{$p0.Name}}, "{{$ext_name}} not enabled. {{$.Name}} not executed.");
{{if not (IsVoid $.Return.Type)}}return VK_SUCCESS;{{end}}
}
}
@@ -905,8 +941,6 @@
{{else if eq $.Name "vkDestroyInstance"}}true
{{else if eq $.Name "vkDestroyDevice"}}true
- {{else if eq $.Name "vkEnumerateDeviceLayerProperties"}}true
-
{{/* Enumeration of extensions */}}
{{else if eq $.Name "vkEnumerateDeviceExtensionProperties"}}true
diff --git a/vulkan/libvulkan/debug_report.cpp b/vulkan/libvulkan/debug_report.cpp
index c4a1174..0c2f138 100644
--- a/vulkan/libvulkan/debug_report.cpp
+++ b/vulkan/libvulkan/debug_report.cpp
@@ -19,62 +19,37 @@
namespace vulkan {
namespace driver {
-VkResult DebugReportCallbackList::CreateCallback(
- VkInstance instance,
- const VkDebugReportCallbackCreateInfoEXT* create_info,
- const VkAllocationCallbacks* allocator,
- VkDebugReportCallbackEXT* callback) {
- VkDebugReportCallbackEXT driver_callback = VK_NULL_HANDLE;
+DebugReportCallbackList::Node* DebugReportCallbackList::AddCallback(
+ const VkDebugReportCallbackCreateInfoEXT& info,
+ VkDebugReportCallbackEXT driver_handle,
+ const VkAllocationCallbacks& allocator) {
+ void* mem = allocator.pfnAllocation(allocator.pUserData, sizeof(Node),
+ alignof(Node),
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+ if (!mem)
+ return nullptr;
- if (GetData(instance).driver.CreateDebugReportCallbackEXT) {
- VkResult result = GetData(instance).driver.CreateDebugReportCallbackEXT(
- instance, create_info, allocator, &driver_callback);
- if (result != VK_SUCCESS)
- return result;
- }
-
- const VkAllocationCallbacks* alloc =
- allocator ? allocator : &GetData(instance).allocator;
- void* mem =
- alloc->pfnAllocation(alloc->pUserData, sizeof(Node), alignof(Node),
- VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
- if (!mem) {
- if (GetData(instance).driver.DestroyDebugReportCallbackEXT) {
- GetData(instance).driver.DestroyDebugReportCallbackEXT(
- instance, driver_callback, allocator);
- }
- return VK_ERROR_OUT_OF_HOST_MEMORY;
- }
-
+ // initialize and prepend node to the list
std::lock_guard<decltype(rwmutex_)> lock(rwmutex_);
- head_.next =
- new (mem) Node{head_.next, create_info->flags, create_info->pfnCallback,
- create_info->pUserData, driver_callback};
- *callback =
- VkDebugReportCallbackEXT(reinterpret_cast<uintptr_t>(head_.next));
- return VK_SUCCESS;
+ head_.next = new (mem) Node{head_.next, info.flags, info.pfnCallback,
+ info.pUserData, driver_handle};
+
+ return head_.next;
}
-void DebugReportCallbackList::DestroyCallback(
- VkInstance instance,
- VkDebugReportCallbackEXT callback,
- const VkAllocationCallbacks* allocator) {
- Node* node = reinterpret_cast<Node*>(uintptr_t(callback));
- std::unique_lock<decltype(rwmutex_)> lock(rwmutex_);
- Node* prev = &head_;
- while (prev && prev->next != node)
- prev = prev->next;
- prev->next = node->next;
- lock.unlock();
-
- if (GetData(instance).driver.DestroyDebugReportCallbackEXT) {
- GetData(instance).driver.DestroyDebugReportCallbackEXT(
- instance, node->driver_callback, allocator);
+void DebugReportCallbackList::RemoveCallback(
+ Node* node,
+ const VkAllocationCallbacks& allocator) {
+ // remove node from the list
+ {
+ std::lock_guard<decltype(rwmutex_)> lock(rwmutex_);
+ Node* prev = &head_;
+ while (prev && prev->next != node)
+ prev = prev->next;
+ prev->next = node->next;
}
- const VkAllocationCallbacks* alloc =
- allocator ? allocator : &GetData(instance).allocator;
- alloc->pfnFree(alloc->pUserData, node);
+ allocator.pfnFree(allocator.pUserData, node);
}
void DebugReportCallbackList::Message(VkDebugReportFlagsEXT flags,
@@ -83,32 +58,110 @@
size_t location,
int32_t message_code,
const char* layer_prefix,
- const char* message) {
+ const char* message) const {
std::shared_lock<decltype(rwmutex_)> lock(rwmutex_);
- Node* node = &head_;
+ const Node* node = &head_;
while ((node = node->next)) {
if ((node->flags & flags) != 0) {
node->callback(flags, object_type, object, location, message_code,
- layer_prefix, message, node->data);
+ layer_prefix, message, node->user_data);
}
}
}
+void DebugReportLogger::Message(VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT object_type,
+ uint64_t object,
+ size_t location,
+ int32_t message_code,
+ const char* layer_prefix,
+ const char* message) const {
+ const VkDebugReportCallbackCreateInfoEXT* info =
+ reinterpret_cast<const VkDebugReportCallbackCreateInfoEXT*>(
+ instance_pnext_);
+ while (info) {
+ if (info->sType ==
+ VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT &&
+ (info->flags & flags) != 0) {
+ info->pfnCallback(flags, object_type, object, location,
+ message_code, layer_prefix, message,
+ info->pUserData);
+ }
+
+ info = reinterpret_cast<const VkDebugReportCallbackCreateInfoEXT*>(
+ info->pNext);
+ }
+
+ if (callbacks_) {
+ callbacks_->Message(flags, object_type, object, location, message_code,
+ layer_prefix, message);
+ }
+}
+
+void DebugReportLogger::PrintV(VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT object_type,
+ uint64_t object,
+ const char* format,
+ va_list ap) const {
+ char buf[1024];
+ int len = vsnprintf(buf, sizeof(buf), format, ap);
+
+ // message truncated
+ if (len >= static_cast<int>(sizeof(buf)))
+ memcpy(buf + sizeof(buf) - 4, "...", 4);
+
+ Message(flags, object_type, object, 0, 0, LOG_TAG, buf);
+}
+
VkResult CreateDebugReportCallbackEXT(
VkInstance instance,
const VkDebugReportCallbackCreateInfoEXT* create_info,
const VkAllocationCallbacks* allocator,
VkDebugReportCallbackEXT* callback) {
- return GetData(instance).debug_report_callbacks.CreateCallback(
- instance, create_info, allocator, callback);
+ const auto& driver = GetData(instance).driver;
+ VkDebugReportCallbackEXT driver_handle = VK_NULL_HANDLE;
+ if (driver.CreateDebugReportCallbackEXT) {
+ VkResult result = driver.CreateDebugReportCallbackEXT(
+ instance, create_info, allocator, &driver_handle);
+ if (result != VK_SUCCESS)
+ return result;
+ }
+
+ auto& callbacks = GetData(instance).debug_report_callbacks;
+ auto node = callbacks.AddCallback(
+ *create_info, driver_handle,
+ (allocator) ? *allocator : GetData(instance).allocator);
+ if (!node) {
+ if (driver_handle != VK_NULL_HANDLE) {
+ driver.DestroyDebugReportCallbackEXT(instance, driver_handle,
+ allocator);
+ }
+
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+ }
+
+ *callback = callbacks.GetHandle(node);
+
+ return VK_SUCCESS;
}
void DestroyDebugReportCallbackEXT(VkInstance instance,
VkDebugReportCallbackEXT callback,
const VkAllocationCallbacks* allocator) {
- if (callback)
- GetData(instance).debug_report_callbacks.DestroyCallback(
- instance, callback, allocator);
+ if (callback == VK_NULL_HANDLE)
+ return;
+
+ auto& callbacks = GetData(instance).debug_report_callbacks;
+ auto node = callbacks.FromHandle(callback);
+ auto driver_handle = callbacks.GetDriverHandle(node);
+
+ callbacks.RemoveCallback(
+ node, (allocator) ? *allocator : GetData(instance).allocator);
+
+ if (driver_handle != VK_NULL_HANDLE) {
+ GetData(instance).driver.DestroyDebugReportCallbackEXT(
+ instance, driver_handle, allocator);
+ }
}
void DebugReportMessageEXT(VkInstance instance,
@@ -123,10 +176,11 @@
GetData(instance).driver.DebugReportMessageEXT(
instance, flags, object_type, object, location, message_code,
layer_prefix, message);
+ } else {
+ GetData(instance).debug_report_callbacks.Message(
+ flags, object_type, object, location, message_code, layer_prefix,
+ message);
}
- GetData(instance).debug_report_callbacks.Message(flags, object_type, object,
- location, message_code,
- layer_prefix, message);
}
} // namespace driver
diff --git a/vulkan/libvulkan/debug_report.h b/vulkan/libvulkan/debug_report.h
index 72b1887..be9b645 100644
--- a/vulkan/libvulkan/debug_report.h
+++ b/vulkan/libvulkan/debug_report.h
@@ -17,8 +17,9 @@
#ifndef LIBVULKAN_DEBUG_REPORT_H
#define LIBVULKAN_DEBUG_REPORT_H 1
-#include <vulkan/vulkan.h>
+#include <stdarg.h>
#include <shared_mutex>
+#include <vulkan/vulkan.h>
namespace vulkan {
namespace driver {
@@ -30,6 +31,10 @@
// clang-format on
class DebugReportCallbackList {
+ private:
+ // forward declaration
+ struct Node;
+
public:
DebugReportCallbackList()
: head_{nullptr, 0, nullptr, nullptr, VK_NULL_HANDLE} {}
@@ -37,36 +42,124 @@
DebugReportCallbackList& operator=(const DebugReportCallbackList&) = delete;
~DebugReportCallbackList() = default;
- VkResult CreateCallback(
- VkInstance instance,
- const VkDebugReportCallbackCreateInfoEXT* create_info,
- const VkAllocationCallbacks* allocator,
- VkDebugReportCallbackEXT* callback);
- void DestroyCallback(VkInstance instance,
- VkDebugReportCallbackEXT callback,
- const VkAllocationCallbacks* allocator);
+ Node* AddCallback(const VkDebugReportCallbackCreateInfoEXT& info,
+ VkDebugReportCallbackEXT driver_handle,
+ const VkAllocationCallbacks& allocator);
+ void RemoveCallback(Node* node, const VkAllocationCallbacks& allocator);
+
void Message(VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT object_type,
uint64_t object,
size_t location,
int32_t message_code,
const char* layer_prefix,
- const char* message);
+ const char* message) const;
+
+ static Node* FromHandle(VkDebugReportCallbackEXT handle) {
+ return reinterpret_cast<Node*>(uintptr_t(handle));
+ }
+
+ static VkDebugReportCallbackEXT GetHandle(const Node* node) {
+ return VkDebugReportCallbackEXT(reinterpret_cast<uintptr_t>(node));
+ }
+
+ static VkDebugReportCallbackEXT GetDriverHandle(const Node* node) {
+ return node->driver_handle;
+ }
private:
struct Node {
Node* next;
+
VkDebugReportFlagsEXT flags;
PFN_vkDebugReportCallbackEXT callback;
- void* data;
- VkDebugReportCallbackEXT driver_callback;
+ void* user_data;
+
+ VkDebugReportCallbackEXT driver_handle;
};
// TODO(jessehall): replace with std::shared_mutex when available in libc++
- std::shared_timed_mutex rwmutex_;
+ mutable std::shared_timed_mutex rwmutex_;
Node head_;
};
+class DebugReportLogger {
+ public:
+ DebugReportLogger(const VkInstanceCreateInfo& info)
+ : instance_pnext_(info.pNext), callbacks_(nullptr) {}
+ DebugReportLogger(const DebugReportCallbackList& callbacks)
+ : instance_pnext_(nullptr), callbacks_(&callbacks) {}
+
+ void Message(VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT object_type,
+ uint64_t object,
+ size_t location,
+ int32_t message_code,
+ const char* layer_prefix,
+ const char* message) const;
+
+#define DEBUG_REPORT_LOGGER_PRINTF(fmt, args) \
+ __attribute__((format(printf, (fmt) + 1, (args) + 1)))
+ template <typename ObjectType>
+ void Info(ObjectType object, const char* format, ...) const
+ DEBUG_REPORT_LOGGER_PRINTF(2, 3) {
+ va_list ap;
+ va_start(ap, format);
+ PrintV(VK_DEBUG_REPORT_INFORMATION_BIT_EXT, GetObjectType(object),
+ GetObjectUInt64(object), format, ap);
+ va_end(ap);
+ }
+
+ template <typename ObjectType>
+ void Warn(ObjectType object, const char* format, ...) const
+ DEBUG_REPORT_LOGGER_PRINTF(2, 3) {
+ va_list ap;
+ va_start(ap, format);
+ PrintV(VK_DEBUG_REPORT_WARNING_BIT_EXT, GetObjectType(object),
+ GetObjectUInt64(object), format, ap);
+ va_end(ap);
+ }
+
+ template <typename ObjectType>
+ void Err(ObjectType object, const char* format, ...) const
+ DEBUG_REPORT_LOGGER_PRINTF(2, 3) {
+ va_list ap;
+ va_start(ap, format);
+ PrintV(VK_DEBUG_REPORT_ERROR_BIT_EXT, GetObjectType(object),
+ GetObjectUInt64(object), format, ap);
+ va_end(ap);
+ }
+
+ private:
+ template <typename ObjectType>
+ static VkDebugReportObjectTypeEXT GetObjectType(ObjectType) {
+ if (std::is_same<ObjectType, VkInstance>::value)
+ return VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT;
+ else if (std::is_same<ObjectType, VkPhysicalDevice>::value)
+ return VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT;
+ else if (std::is_same<ObjectType, VkDevice>::value)
+ return VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT;
+ else
+ return VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT;
+ }
+
+ template <typename ObjectType>
+ static uint64_t GetObjectUInt64(ObjectType object) {
+ return uint64_t(object);
+ }
+
+#define DEBUG_REPORT_LOGGER_VPRINTF(fmt) \
+ __attribute__((format(printf, (fmt) + 1, 0)))
+ void PrintV(VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT object_type,
+ uint64_t object,
+ const char* format,
+ va_list ap) const DEBUG_REPORT_LOGGER_VPRINTF(4);
+
+ const void* const instance_pnext_;
+ const DebugReportCallbackList* const callbacks_;
+};
+
} // namespace driver
} // namespace vulkan
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp
index b02f5b4..2555272 100644
--- a/vulkan/libvulkan/driver.cpp
+++ b/vulkan/libvulkan/driver.cpp
@@ -46,10 +46,31 @@
namespace {
+class Hal {
+ public:
+ static bool Open();
+
+ static const Hal& Get() { return hal_; }
+ static const hwvulkan_device_t& Device() { return *Get().dev_; }
+
+ int GetDebugReportIndex() const { return debug_report_index_; }
+
+ private:
+ Hal() : dev_(nullptr), debug_report_index_(-1) {}
+ Hal(const Hal&) = delete;
+ Hal& operator=(const Hal&) = delete;
+
+ bool InitDebugReportIndex();
+
+ static Hal hal_;
+
+ const hwvulkan_device_t* dev_;
+ int debug_report_index_;
+};
+
class CreateInfoWrapper {
public:
- CreateInfoWrapper(const hwvulkan_device_t* hw_dev,
- const VkInstanceCreateInfo& create_info,
+ CreateInfoWrapper(const VkInstanceCreateInfo& create_info,
const VkAllocationCallbacks& allocator);
CreateInfoWrapper(VkPhysicalDevice physical_dev,
const VkDeviceCreateInfo& create_info,
@@ -87,10 +108,7 @@
const bool is_instance_;
const VkAllocationCallbacks& allocator_;
- union {
- const hwvulkan_device_t* hw_dev_;
- VkPhysicalDevice physical_dev_;
- };
+ VkPhysicalDevice physical_dev_;
union {
VkInstanceCreateInfo instance_info_;
@@ -103,12 +121,80 @@
std::bitset<ProcHook::EXTENSION_COUNT> hal_extensions_;
};
-CreateInfoWrapper::CreateInfoWrapper(const hwvulkan_device_t* hw_dev,
- const VkInstanceCreateInfo& create_info,
+Hal Hal::hal_;
+
+bool Hal::Open() {
+ ALOG_ASSERT(!hal_.dev_, "OpenHAL called more than once");
+
+ // Use a stub device unless we successfully open a real HAL device.
+ hal_.dev_ = &stubhal::kDevice;
+
+ const hwvulkan_module_t* module;
+ int result =
+ hw_get_module("vulkan", reinterpret_cast<const hw_module_t**>(&module));
+ if (result != 0) {
+ ALOGI("no Vulkan HAL present, using stub HAL");
+ return true;
+ }
+
+ hwvulkan_device_t* device;
+ result =
+ module->common.methods->open(&module->common, HWVULKAN_DEVICE_0,
+ reinterpret_cast<hw_device_t**>(&device));
+ if (result != 0) {
+ // Any device with a Vulkan HAL should be able to open the device.
+ ALOGE("failed to open Vulkan HAL device: %s (%d)", strerror(-result),
+ result);
+ return false;
+ }
+
+ hal_.dev_ = device;
+
+ hal_.InitDebugReportIndex();
+
+ return true;
+}
+
+bool Hal::InitDebugReportIndex() {
+ uint32_t count;
+ if (dev_->EnumerateInstanceExtensionProperties(nullptr, &count, nullptr) !=
+ VK_SUCCESS) {
+ ALOGE("failed to get HAL instance extension count");
+ return false;
+ }
+
+ VkExtensionProperties* exts = reinterpret_cast<VkExtensionProperties*>(
+ malloc(sizeof(VkExtensionProperties) * count));
+ if (!exts) {
+ ALOGE("failed to allocate HAL instance extension array");
+ return false;
+ }
+
+ if (dev_->EnumerateInstanceExtensionProperties(nullptr, &count, exts) !=
+ VK_SUCCESS) {
+ ALOGE("failed to enumerate HAL instance extensions");
+ free(exts);
+ return false;
+ }
+
+ for (uint32_t i = 0; i < count; i++) {
+ if (strcmp(exts[i].extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME) ==
+ 0) {
+ debug_report_index_ = static_cast<int>(i);
+ break;
+ }
+ }
+
+ free(exts);
+
+ return true;
+}
+
+CreateInfoWrapper::CreateInfoWrapper(const VkInstanceCreateInfo& create_info,
const VkAllocationCallbacks& allocator)
: is_instance_(true),
allocator_(allocator),
- hw_dev_(hw_dev),
+ physical_dev_(VK_NULL_HANDLE),
instance_info_(create_info),
extension_filter_() {
hook_extensions_.set(ProcHook::EXTENSION_CORE);
@@ -225,8 +311,8 @@
VkResult CreateInfoWrapper::QueryExtensionCount(uint32_t& count) const {
if (is_instance_) {
- return hw_dev_->EnumerateInstanceExtensionProperties(nullptr, &count,
- nullptr);
+ return Hal::Device().EnumerateInstanceExtensionProperties(
+ nullptr, &count, nullptr);
} else {
const auto& driver = GetData(physical_dev_).driver;
return driver.EnumerateDeviceExtensionProperties(physical_dev_, nullptr,
@@ -238,8 +324,8 @@
uint32_t& count,
VkExtensionProperties* props) const {
if (is_instance_) {
- return hw_dev_->EnumerateInstanceExtensionProperties(nullptr, &count,
- props);
+ return Hal::Device().EnumerateInstanceExtensionProperties(
+ nullptr, &count, props);
} else {
const auto& driver = GetData(physical_dev_).driver;
return driver.EnumerateDeviceExtensionProperties(physical_dev_, nullptr,
@@ -343,8 +429,6 @@
}
}
-const hwvulkan_device_t* g_hwdevice = nullptr;
-
VKAPI_ATTR void* DefaultAllocate(void*,
size_t size,
size_t alignment,
@@ -409,14 +493,16 @@
allocator.pfnFree(allocator.pUserData, data);
}
-DeviceData* AllocateDeviceData(const VkAllocationCallbacks& allocator) {
+DeviceData* AllocateDeviceData(
+ const VkAllocationCallbacks& allocator,
+ const DebugReportCallbackList& debug_report_callbacks) {
void* data_mem = allocator.pfnAllocation(
allocator.pUserData, sizeof(DeviceData), alignof(DeviceData),
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (!data_mem)
return nullptr;
- return new (data_mem) DeviceData(allocator);
+ return new (data_mem) DeviceData(allocator, debug_report_callbacks);
}
void FreeDeviceData(DeviceData* data, const VkAllocationCallbacks& allocator) {
@@ -431,33 +517,7 @@
}
bool OpenHAL() {
- ALOG_ASSERT(!g_hwdevice, "OpenHAL called more than once");
-
- // Use a stub device unless we successfully open a real HAL device.
- g_hwdevice = &stubhal::kDevice;
-
- const hwvulkan_module_t* module;
- int result =
- hw_get_module("vulkan", reinterpret_cast<const hw_module_t**>(&module));
- if (result != 0) {
- ALOGV("no Vulkan HAL present, using stub HAL");
- return true;
- }
-
- hwvulkan_device_t* device;
- result =
- module->common.methods->open(&module->common, HWVULKAN_DEVICE_0,
- reinterpret_cast<hw_device_t**>(&device));
- if (result != 0) {
- // Any device with a Vulkan HAL should be able to open the device.
- ALOGE("failed to open Vulkan HAL device: %s (%d)", strerror(-result),
- result);
- return false;
- }
-
- g_hwdevice = device;
-
- return true;
+ return Hal::Open();
}
const VkAllocationCallbacks& GetDefaultAllocator() {
@@ -474,7 +534,7 @@
PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* pName) {
const ProcHook* hook = GetProcHook(pName);
if (!hook)
- return g_hwdevice->GetInstanceProcAddr(instance, pName);
+ return Hal::Device().GetInstanceProcAddr(instance, pName);
if (!instance) {
if (hook->type == ProcHook::GLOBAL)
@@ -489,8 +549,7 @@
return hook->proc;
ALOGE(
- "Invalid use of vkGetInstanceProcAddr to query %s without an "
- "instance",
+ "internal vkGetInstanceProcAddr called for %s without an instance",
pName);
return nullptr;
@@ -511,8 +570,7 @@
break;
default:
ALOGE(
- "Invalid use of vkGetInstanceProcAddr to query %s with an "
- "instance",
+ "internal vkGetInstanceProcAddr called for %s with an instance",
pName);
proc = nullptr;
break;
@@ -527,7 +585,7 @@
return GetData(device).driver.GetDeviceProcAddr(device, pName);
if (hook->type != ProcHook::DEVICE) {
- ALOGE("Invalid use of vkGetDeviceProcAddr to query %s", pName);
+ ALOGE("internal vkGetDeviceProcAddr called for %s", pName);
return nullptr;
}
@@ -545,6 +603,9 @@
{VK_KHR_ANDROID_SURFACE_EXTENSION_NAME,
VK_KHR_ANDROID_SURFACE_SPEC_VERSION},
}};
+ static const VkExtensionProperties loader_debug_report_extension = {
+ VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION,
+ };
// enumerate our extensions first
if (!pLayerName && pProperties) {
@@ -560,13 +621,35 @@
pProperties += count;
*pPropertyCount -= count;
+
+ if (Hal::Get().GetDebugReportIndex() < 0) {
+ if (!*pPropertyCount) {
+ *pPropertyCount = count;
+ return VK_INCOMPLETE;
+ }
+
+ pProperties[0] = loader_debug_report_extension;
+ pProperties += 1;
+ *pPropertyCount -= 1;
+ }
}
- VkResult result = g_hwdevice->EnumerateInstanceExtensionProperties(
+ VkResult result = Hal::Device().EnumerateInstanceExtensionProperties(
pLayerName, pPropertyCount, pProperties);
- if (!pLayerName && (result == VK_SUCCESS || result == VK_INCOMPLETE))
+ if (!pLayerName && (result == VK_SUCCESS || result == VK_INCOMPLETE)) {
+ int idx = Hal::Get().GetDebugReportIndex();
+ if (idx < 0) {
+ *pPropertyCount += 1;
+ } else if (pProperties &&
+ static_cast<uint32_t>(idx) < *pPropertyCount) {
+ pProperties[idx].specVersion =
+ std::min(pProperties[idx].specVersion,
+ loader_debug_report_extension.specVersion);
+ }
+
*pPropertyCount += loader_extensions.size();
+ }
return result;
}
@@ -608,7 +691,7 @@
const VkAllocationCallbacks& data_allocator =
(pAllocator) ? *pAllocator : GetDefaultAllocator();
- CreateInfoWrapper wrapper(g_hwdevice, *pCreateInfo, data_allocator);
+ CreateInfoWrapper wrapper(*pCreateInfo, data_allocator);
VkResult result = wrapper.Validate();
if (result != VK_SUCCESS)
return result;
@@ -621,7 +704,7 @@
// call into the driver
VkInstance instance;
- result = g_hwdevice->CreateInstance(
+ result = Hal::Device().CreateInstance(
static_cast<const VkInstanceCreateInfo*>(wrapper), pAllocator,
&instance);
if (result != VK_SUCCESS) {
@@ -631,10 +714,10 @@
// initialize InstanceDriverTable
if (!SetData(instance, *data) ||
- !InitDriverTable(instance, g_hwdevice->GetInstanceProcAddr,
+ !InitDriverTable(instance, Hal::Device().GetInstanceProcAddr,
wrapper.GetHalExtensions())) {
data->driver.DestroyInstance = reinterpret_cast<PFN_vkDestroyInstance>(
- g_hwdevice->GetInstanceProcAddr(instance, "vkDestroyInstance"));
+ Hal::Device().GetInstanceProcAddr(instance, "vkDestroyInstance"));
if (data->driver.DestroyInstance)
data->driver.DestroyInstance(instance, pAllocator);
@@ -644,7 +727,7 @@
}
data->get_device_proc_addr = reinterpret_cast<PFN_vkGetDeviceProcAddr>(
- g_hwdevice->GetInstanceProcAddr(instance, "vkGetDeviceProcAddr"));
+ Hal::Device().GetInstanceProcAddr(instance, "vkGetDeviceProcAddr"));
if (!data->get_device_proc_addr) {
data->driver.DestroyInstance(instance, pAllocator);
FreeInstanceData(data, data_allocator);
@@ -684,7 +767,8 @@
if (result != VK_SUCCESS)
return result;
- DeviceData* data = AllocateDeviceData(data_allocator);
+ DeviceData* data = AllocateDeviceData(data_allocator,
+ instance_data.debug_report_callbacks);
if (!data)
return VK_ERROR_OUT_OF_HOST_MEMORY;
@@ -713,6 +797,7 @@
return VK_ERROR_INCOMPATIBLE_DRIVER;
}
+ data->driver_device = dev;
*pDevice = dev;
diff --git a/vulkan/libvulkan/driver.h b/vulkan/libvulkan/driver.h
index 2b1f545..a02ebd7 100644
--- a/vulkan/libvulkan/driver.h
+++ b/vulkan/libvulkan/driver.h
@@ -82,17 +82,23 @@
};
struct DeviceData {
- DeviceData(const VkAllocationCallbacks& alloc)
- : opaque_api_data(), allocator(alloc), driver() {
+ DeviceData(const VkAllocationCallbacks& alloc,
+ const DebugReportCallbackList& debug_report_callbacks_)
+ : opaque_api_data(),
+ allocator(alloc),
+ debug_report_callbacks(debug_report_callbacks_),
+ driver() {
hook_extensions.set(ProcHook::EXTENSION_CORE);
}
api::DeviceData opaque_api_data;
const VkAllocationCallbacks allocator;
+ const DebugReportCallbackList& debug_report_callbacks;
std::bitset<ProcHook::EXTENSION_COUNT> hook_extensions;
+ VkDevice driver_device;
DeviceDriverTable driver;
};
@@ -214,6 +220,11 @@
return *reinterpret_cast<DeviceData*>(GetDataInternal(dispatchable));
}
+template <typename DispatchableType>
+const DebugReportLogger Logger(DispatchableType dispatchable) {
+ return DebugReportLogger(GetData(dispatchable).debug_report_callbacks);
+}
+
} // namespace driver
} // namespace vulkan
diff --git a/vulkan/libvulkan/driver_gen.cpp b/vulkan/libvulkan/driver_gen.cpp
index 5bd2159..d979a34 100644
--- a/vulkan/libvulkan/driver_gen.cpp
+++ b/vulkan/libvulkan/driver_gen.cpp
@@ -33,7 +33,7 @@
if (GetData(device).hook_extensions[ProcHook::KHR_swapchain]) {
return CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain);
} else {
- ALOGE("VK_KHR_swapchain not enabled. vkCreateSwapchainKHR not executed.");
+ Logger(device).Err(device, "VK_KHR_swapchain not enabled. vkCreateSwapchainKHR not executed.");
return VK_SUCCESS;
}
}
@@ -42,7 +42,7 @@
if (GetData(device).hook_extensions[ProcHook::KHR_swapchain]) {
DestroySwapchainKHR(device, swapchain, pAllocator);
} else {
- ALOGE("VK_KHR_swapchain not enabled. vkDestroySwapchainKHR not executed.");
+ Logger(device).Err(device, "VK_KHR_swapchain not enabled. vkDestroySwapchainKHR not executed.");
}
}
@@ -50,7 +50,7 @@
if (GetData(device).hook_extensions[ProcHook::KHR_swapchain]) {
return GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages);
} else {
- ALOGE("VK_KHR_swapchain not enabled. vkGetSwapchainImagesKHR not executed.");
+ Logger(device).Err(device, "VK_KHR_swapchain not enabled. vkGetSwapchainImagesKHR not executed.");
return VK_SUCCESS;
}
}
@@ -59,7 +59,7 @@
if (GetData(device).hook_extensions[ProcHook::KHR_swapchain]) {
return AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex);
} else {
- ALOGE("VK_KHR_swapchain not enabled. vkAcquireNextImageKHR not executed.");
+ Logger(device).Err(device, "VK_KHR_swapchain not enabled. vkAcquireNextImageKHR not executed.");
return VK_SUCCESS;
}
}
@@ -68,7 +68,7 @@
if (GetData(queue).hook_extensions[ProcHook::KHR_swapchain]) {
return QueuePresentKHR(queue, pPresentInfo);
} else {
- ALOGE("VK_KHR_swapchain not enabled. vkQueuePresentKHR not executed.");
+ Logger(queue).Err(queue, "VK_KHR_swapchain not enabled. vkQueuePresentKHR not executed.");
return VK_SUCCESS;
}
}
@@ -328,7 +328,6 @@
INIT_PROC(instance, EnumeratePhysicalDevices);
INIT_PROC(instance, GetInstanceProcAddr);
INIT_PROC(instance, CreateDevice);
- INIT_PROC(instance, EnumerateDeviceLayerProperties);
INIT_PROC(instance, EnumerateDeviceExtensionProperties);
INIT_PROC_EXT(EXT_debug_report, instance, CreateDebugReportCallbackEXT);
INIT_PROC_EXT(EXT_debug_report, instance, DestroyDebugReportCallbackEXT);
diff --git a/vulkan/libvulkan/driver_gen.h b/vulkan/libvulkan/driver_gen.h
index ca17d57..a60b2fe 100644
--- a/vulkan/libvulkan/driver_gen.h
+++ b/vulkan/libvulkan/driver_gen.h
@@ -58,7 +58,6 @@
PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
PFN_vkCreateDevice CreateDevice;
- PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
diff --git a/vulkan/libvulkan/layers_extensions.cpp b/vulkan/libvulkan/layers_extensions.cpp
index f9b1002..82169ff 100644
--- a/vulkan/libvulkan/layers_extensions.cpp
+++ b/vulkan/libvulkan/layers_extensions.cpp
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-// #define LOG_NDEBUG 0
-
#include "layers_extensions.h"
+
#include <alloca.h>
#include <dirent.h>
#include <dlfcn.h>
@@ -25,7 +24,13 @@
#include <string>
#include <string.h>
#include <vector>
+
+#include <android-base/strings.h>
+#include <android/dlext.h>
+#include <cutils/properties.h>
#include <log/log.h>
+#include <ziparchive/zip_archive.h>
+
#include <vulkan/vulkan_loader_data.h>
// TODO(jessehall): The whole way we deal with extensions is pretty hokey, and
@@ -59,6 +64,8 @@
namespace {
+const char kSystemLayerLibraryDir[] = "/data/local/debug/vulkan";
+
class LayerLibrary {
public:
LayerLibrary(const std::string& path)
@@ -96,10 +103,24 @@
bool LayerLibrary::Open() {
std::lock_guard<std::mutex> lock(mutex_);
-
if (refcount_++ == 0) {
- dlhandle_ = dlopen(path_.c_str(), RTLD_NOW | RTLD_LOCAL);
- ALOGV("Opening library %s", path_.c_str());
+ ALOGV("opening layer library '%s'", path_.c_str());
+ // Libraries in the system layer library dir can't be loaded into
+ // the application namespace. That causes compatibility problems, since
+ // any symbol dependencies will be resolved by system libraries. They
+ // can't safely use libc++_shared, for example. Which is one reason
+ // (among several) we only allow them in non-user builds.
+ auto app_namespace = LoaderData::GetInstance().app_namespace;
+ if (app_namespace &&
+ !android::base::StartsWith(path_, kSystemLayerLibraryDir)) {
+ android_dlextinfo dlextinfo = {};
+ dlextinfo.flags = ANDROID_DLEXT_USE_NAMESPACE;
+ dlextinfo.library_namespace = app_namespace;
+ dlhandle_ = android_dlopen_ext(path_.c_str(), RTLD_NOW | RTLD_LOCAL,
+ &dlextinfo);
+ } else {
+ dlhandle_ = dlopen(path_.c_str(), RTLD_NOW | RTLD_LOCAL);
+ }
if (!dlhandle_) {
ALOGE("failed to load layer library '%s': %s", path_.c_str(),
dlerror());
@@ -107,19 +128,16 @@
return false;
}
}
- ALOGV("Refcount on activate is %zu", refcount_);
return true;
}
void LayerLibrary::Close() {
std::lock_guard<std::mutex> lock(mutex_);
-
if (--refcount_ == 0) {
- ALOGV("Closing library %s", path_.c_str());
+ ALOGV("closing layer library '%s'", path_.c_str());
dlclose(dlhandle_);
dlhandle_ = nullptr;
}
- ALOGV("Refcount on destruction is %zu", refcount_);
}
bool LayerLibrary::EnumerateLayers(size_t library_idx,
@@ -131,7 +149,7 @@
reinterpret_cast<PFN_vkEnumerateInstanceExtensionProperties>(
dlsym(dlhandle_, "vkEnumerateInstanceExtensionProperties"));
if (!enumerate_instance_layers || !enumerate_instance_extensions) {
- ALOGV("layer library '%s' misses some instance enumeraion functions",
+ ALOGE("layer library '%s' missing some instance enumeration functions",
path_.c_str());
return false;
}
@@ -150,7 +168,7 @@
VkResult result = enumerate_instance_layers(&num_instance_layers, nullptr);
if (result != VK_SUCCESS || !num_instance_layers) {
if (result != VK_SUCCESS) {
- ALOGW(
+ ALOGE(
"vkEnumerateInstanceLayerProperties failed for library '%s': "
"%d",
path_.c_str(), result);
@@ -161,7 +179,7 @@
result = enumerate_device_layers(VK_NULL_HANDLE, &num_device_layers,
nullptr);
if (result != VK_SUCCESS) {
- ALOGW(
+ ALOGE(
"vkEnumerateDeviceLayerProperties failed for library '%s': %d",
path_.c_str(), result);
return false;
@@ -173,7 +191,7 @@
(num_instance_layers + num_device_layers) * sizeof(VkLayerProperties)));
result = enumerate_instance_layers(&num_instance_layers, properties);
if (result != VK_SUCCESS) {
- ALOGW("vkEnumerateInstanceLayerProperties failed for library '%s': %d",
+ ALOGE("vkEnumerateInstanceLayerProperties failed for library '%s': %d",
path_.c_str(), result);
return false;
}
@@ -181,7 +199,7 @@
result = enumerate_device_layers(VK_NULL_HANDLE, &num_device_layers,
properties + num_instance_layers);
if (result != VK_SUCCESS) {
- ALOGW(
+ ALOGE(
"vkEnumerateDeviceLayerProperties failed for library '%s': %d",
path_.c_str(), result);
return false;
@@ -203,9 +221,9 @@
result =
enumerate_instance_extensions(props.layerName, &count, nullptr);
if (result != VK_SUCCESS) {
- ALOGW(
- "vkEnumerateInstanceExtensionProperties(%s) failed for library "
- "'%s': %d",
+ ALOGE(
+ "vkEnumerateInstanceExtensionProperties(\"%s\") failed for "
+ "library '%s': %d",
props.layerName, path_.c_str(), result);
instance_layers.resize(prev_num_instance_layers);
return false;
@@ -214,9 +232,9 @@
result = enumerate_instance_extensions(
props.layerName, &count, layer.instance_extensions.data());
if (result != VK_SUCCESS) {
- ALOGW(
- "vkEnumerateInstanceExtensionProperties(%s) failed for library "
- "'%s': %d",
+ ALOGE(
+ "vkEnumerateInstanceExtensionProperties(\"%s\") failed for "
+ "library '%s': %d",
props.layerName, path_.c_str(), result);
instance_layers.resize(prev_num_instance_layers);
return false;
@@ -234,8 +252,8 @@
result = enumerate_device_extensions(
VK_NULL_HANDLE, props.layerName, &count, nullptr);
if (result != VK_SUCCESS) {
- ALOGW(
- "vkEnumerateDeviceExtensionProperties(%s) failed for "
+ ALOGE(
+ "vkEnumerateDeviceExtensionProperties(\"%s\") failed for "
"library '%s': %d",
props.layerName, path_.c_str(), result);
instance_layers.resize(prev_num_instance_layers);
@@ -246,8 +264,8 @@
VK_NULL_HANDLE, props.layerName, &count,
layer.device_extensions.data());
if (result != VK_SUCCESS) {
- ALOGW(
- "vkEnumerateDeviceExtensionProperties(%s) failed for "
+ ALOGE(
+ "vkEnumerateDeviceExtensionProperties(\"%s\") failed for "
"library '%s': %d",
props.layerName, path_.c_str(), result);
instance_layers.resize(prev_num_instance_layers);
@@ -256,8 +274,9 @@
}
instance_layers.push_back(layer);
- ALOGV(" added %s layer '%s'",
- (layer.is_global) ? "global" : "instance", props.layerName);
+ ALOGD("added %s layer '%s' from library '%s'",
+ (layer.is_global) ? "global" : "instance", props.layerName,
+ path_.c_str());
}
return true;
@@ -280,12 +299,12 @@
return gpa;
}
+// ----------------------------------------------------------------------------
+
std::vector<LayerLibrary> g_layer_libraries;
std::vector<Layer> g_instance_layers;
void AddLayerLibrary(const std::string& path) {
- ALOGV("examining layer library '%s'", path.c_str());
-
LayerLibrary library(path);
if (!library.Open())
return;
@@ -300,34 +319,88 @@
g_layer_libraries.emplace_back(std::move(library));
}
-void DiscoverLayersInDirectory(const std::string& dir_path) {
- ALOGV("looking for layers in '%s'", dir_path.c_str());
-
- DIR* directory = opendir(dir_path.c_str());
- if (!directory) {
+template <typename Functor>
+void ForEachFileInDir(const std::string& dirname, Functor functor) {
+ auto dir_deleter = [](DIR* handle) { closedir(handle); };
+ std::unique_ptr<DIR, decltype(dir_deleter)> dir(opendir(dirname.c_str()),
+ dir_deleter);
+ if (!dir) {
+ // It's normal for some search directories to not exist, especially
+ // /data/local/debug/vulkan.
int err = errno;
- ALOGV_IF(err != ENOENT, "failed to open layer directory '%s': %s (%d)",
- dir_path.c_str(), strerror(err), err);
+ ALOGW_IF(err != ENOENT, "failed to open layer directory '%s': %s",
+ dirname.c_str(), strerror(err));
return;
}
+ ALOGD("searching for layers in '%s'", dirname.c_str());
+ dirent* entry;
+ while ((entry = readdir(dir.get())) != nullptr)
+ functor(entry->d_name);
+}
- std::string path;
- path.reserve(dir_path.size() + 20);
- path.append(dir_path);
- path.append("/");
-
- struct dirent* entry;
- while ((entry = readdir(directory))) {
- size_t libname_len = strlen(entry->d_name);
- if (strncmp(entry->d_name, "libVkLayer", 10) != 0 ||
- strncmp(entry->d_name + libname_len - 3, ".so", 3) != 0)
- continue;
- path.append(entry->d_name);
- AddLayerLibrary(path);
- path.resize(dir_path.size() + 1);
+template <typename Functor>
+void ForEachFileInZip(const std::string& zipname,
+ const std::string& dir_in_zip,
+ Functor functor) {
+ int32_t err;
+ ZipArchiveHandle zip = nullptr;
+ if ((err = OpenArchive(zipname.c_str(), &zip)) != 0) {
+ ALOGE("failed to open apk '%s': %d", zipname.c_str(), err);
+ return;
}
+ std::string prefix(dir_in_zip + "/");
+ const ZipString prefix_str(prefix.c_str());
+ void* iter_cookie = nullptr;
+ if ((err = StartIteration(zip, &iter_cookie, &prefix_str, nullptr)) != 0) {
+ ALOGE("failed to iterate entries in apk '%s': %d", zipname.c_str(),
+ err);
+ CloseArchive(zip);
+ return;
+ }
+ ALOGD("searching for layers in '%s!/%s'", zipname.c_str(),
+ dir_in_zip.c_str());
+ ZipEntry entry;
+ ZipString name;
+ while (Next(iter_cookie, &entry, &name) == 0) {
+ std::string filename(
+ reinterpret_cast<const char*>(name.name) + prefix.length(),
+ name.name_length - prefix.length());
+ // only enumerate direct entries of the directory, not subdirectories
+ if (filename.find('/') != filename.npos)
+ continue;
+ // Check whether it *may* be possible to load the library directly from
+ // the APK. Loading still may fail for other reasons, but this at least
+ // lets us avoid failed-to-load log messages in the typical case of
+ // compressed and/or unaligned libraries.
+ if (entry.method != kCompressStored || entry.offset % PAGE_SIZE != 0)
+ continue;
+ functor(filename);
+ }
+ EndIteration(iter_cookie);
+ CloseArchive(zip);
+}
- closedir(directory);
+template <typename Functor>
+void ForEachFileInPath(const std::string& path, Functor functor) {
+ size_t zip_pos = path.find("!/");
+ if (zip_pos == std::string::npos) {
+ ForEachFileInDir(path, functor);
+ } else {
+ ForEachFileInZip(path.substr(0, zip_pos), path.substr(zip_pos + 2),
+ functor);
+ }
+}
+
+void DiscoverLayersInPathList(const std::string& pathstr) {
+ std::vector<std::string> paths = android::base::Split(pathstr, ":");
+ for (const auto& path : paths) {
+ ForEachFileInPath(path, [&](const std::string& filename) {
+ if (android::base::StartsWith(filename, "libVkLayer") &&
+ android::base::EndsWith(filename, ".so")) {
+ AddLayerLibrary(path + "/" + filename);
+ }
+ });
+ }
}
const VkExtensionProperties* FindExtension(
@@ -350,10 +423,12 @@
} // anonymous namespace
void DiscoverLayers() {
- if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0))
- DiscoverLayersInDirectory("/data/local/debug/vulkan");
+ if (property_get_bool("ro.debuggable", false) &&
+ prctl(PR_GET_DUMPABLE, 0, 0, 0, 0)) {
+ DiscoverLayersInPathList(kSystemLayerLibraryDir);
+ }
if (!LoaderData::GetInstance().layer_path.empty())
- DiscoverLayersInDirectory(LoaderData::GetInstance().layer_path.c_str());
+ DiscoverLayersInPathList(LoaderData::GetInstance().layer_path);
}
uint32_t GetLayerCount() {
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index 69e8e84..adc7d5c 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -109,6 +109,7 @@
struct Surface {
android::sp<ANativeWindow> window;
+ VkSwapchainKHR swapchain_handle;
};
VkSurfaceKHR HandleFromSurface(Surface* surface) {
@@ -147,6 +148,65 @@
return reinterpret_cast<Swapchain*>(handle);
}
+void ReleaseSwapchainImage(VkDevice device,
+ ANativeWindow* window,
+ int release_fence,
+ Swapchain::Image& image) {
+ ALOG_ASSERT(release_fence == -1 || image.dequeued,
+ "ReleaseSwapchainImage: can't provide a release fence for "
+ "non-dequeued images");
+
+ if (image.dequeued) {
+ if (release_fence >= 0) {
+ // We get here from vkQueuePresentKHR. The application is
+ // responsible for creating an execution dependency chain from
+ // vkAcquireNextImage (dequeue_fence) to vkQueuePresentKHR
+ // (release_fence), so we can drop the dequeue_fence here.
+ if (image.dequeue_fence >= 0)
+ close(image.dequeue_fence);
+ } else {
+ // We get here during swapchain destruction, or various serious
+ // error cases e.g. when we can't create the release_fence during
+ // vkQueuePresentKHR. In non-error cases, the dequeue_fence should
+ // have already signalled, since the swapchain images are supposed
+ // to be idle before the swapchain is destroyed. In error cases,
+ // there may be rendering in flight to the image, but since we
+ // weren't able to create a release_fence, waiting for the
+ // dequeue_fence is about the best we can do.
+ release_fence = image.dequeue_fence;
+ }
+ image.dequeue_fence = -1;
+
+ if (window) {
+ window->cancelBuffer(window, image.buffer.get(), release_fence);
+ } else {
+ if (release_fence >= 0) {
+ sync_wait(release_fence, -1 /* forever */);
+ close(release_fence);
+ }
+ }
+
+ image.dequeued = false;
+ }
+
+ if (image.image) {
+ GetData(device).driver.DestroyImage(device, image.image, nullptr);
+ image.image = VK_NULL_HANDLE;
+ }
+
+ image.buffer.clear();
+}
+
+void OrphanSwapchain(VkDevice device, Swapchain* swapchain) {
+ if (swapchain->surface.swapchain_handle != HandleFromSwapchain(swapchain))
+ return;
+ for (uint32_t i = 0; i < swapchain->num_images; i++) {
+ if (!swapchain->images[i].dequeued)
+ ReleaseSwapchainImage(device, nullptr, -1, swapchain->images[i]);
+ }
+ swapchain->surface.swapchain_handle = VK_NULL_HANDLE;
+}
+
} // anonymous namespace
VKAPI_ATTR
@@ -165,6 +225,7 @@
Surface* surface = new (mem) Surface;
surface->window = pCreateInfo->window;
+ surface->swapchain_handle = VK_NULL_HANDLE;
// TODO(jessehall): Create and use NATIVE_WINDOW_API_VULKAN.
int err =
@@ -191,6 +252,11 @@
if (!surface)
return;
native_window_api_disconnect(surface->window.get(), NATIVE_WINDOW_API_EGL);
+ ALOGV_IF(surface->swapchain_handle != VK_NULL_HANDLE,
+ "destroyed VkSurfaceKHR 0x%" PRIx64
+ " has active VkSwapchainKHR 0x%" PRIx64,
+ reinterpret_cast<uint64_t>(surface_handle),
+ reinterpret_cast<uint64_t>(surface->swapchain_handle));
surface->~Surface();
if (!allocator)
allocator = &GetData(instance).allocator;
@@ -285,9 +351,9 @@
// hardcoded below.
const VkSurfaceFormatKHR kFormats[] = {
- {VK_FORMAT_R8G8B8A8_UNORM, VK_COLORSPACE_SRGB_NONLINEAR_KHR},
- {VK_FORMAT_R8G8B8A8_SRGB, VK_COLORSPACE_SRGB_NONLINEAR_KHR},
- {VK_FORMAT_R5G6B5_UNORM_PACK16, VK_COLORSPACE_SRGB_NONLINEAR_KHR},
+ {VK_FORMAT_R8G8B8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR},
+ {VK_FORMAT_R8G8B8A8_SRGB, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR},
+ {VK_FORMAT_R5G6B5_UNORM_PACK16, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR},
};
const uint32_t kNumFormats = sizeof(kFormats) / sizeof(kFormats[0]);
@@ -344,29 +410,53 @@
allocator = &GetData(device).allocator;
ALOGV_IF(create_info->imageArrayLayers != 1,
- "Swapchain imageArrayLayers (%u) != 1 not supported",
+ "swapchain imageArrayLayers=%u not supported",
create_info->imageArrayLayers);
-
- ALOGE_IF(create_info->imageColorSpace != VK_COLORSPACE_SRGB_NONLINEAR_KHR,
- "color spaces other than SRGB_NONLINEAR not yet implemented");
- ALOGE_IF(create_info->oldSwapchain,
- "swapchain re-creation not yet implemented");
- ALOGE_IF((create_info->preTransform & ~kSupportedTransforms) != 0,
- "swapchain preTransform %d not supported",
+ ALOGV_IF(create_info->imageColorSpace != VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
+ "swapchain imageColorSpace=%u not supported",
+ create_info->imageColorSpace);
+ ALOGV_IF((create_info->preTransform & ~kSupportedTransforms) != 0,
+ "swapchain preTransform=%#x not supported",
create_info->preTransform);
- ALOGW_IF(!(create_info->presentMode == VK_PRESENT_MODE_FIFO_KHR ||
+ ALOGV_IF(!(create_info->presentMode == VK_PRESENT_MODE_FIFO_KHR ||
create_info->presentMode == VK_PRESENT_MODE_MAILBOX_KHR),
- "swapchain present mode %d not supported",
+ "swapchain presentMode=%u not supported",
create_info->presentMode);
Surface& surface = *SurfaceFromHandle(create_info->surface);
+ if (surface.swapchain_handle != create_info->oldSwapchain) {
+ ALOGV("Can't create a swapchain for VkSurfaceKHR 0x%" PRIx64
+ " because it already has active swapchain 0x%" PRIx64
+ " but VkSwapchainCreateInfo::oldSwapchain=0x%" PRIx64,
+ reinterpret_cast<uint64_t>(create_info->surface),
+ reinterpret_cast<uint64_t>(surface.swapchain_handle),
+ reinterpret_cast<uint64_t>(create_info->oldSwapchain));
+ return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR;
+ }
+ if (create_info->oldSwapchain != VK_NULL_HANDLE)
+ OrphanSwapchain(device, SwapchainFromHandle(create_info->oldSwapchain));
+
// -- Reset the native window --
// The native window might have been used previously, and had its properties
// changed from defaults. That will affect the answer we get for queries
// like MIN_UNDEQUED_BUFFERS. Reset to a known/default state before we
// attempt such queries.
+ // The native window only allows dequeueing all buffers before any have
+ // been queued, since after that point at least one is assumed to be in
+ // non-FREE state at any given time. Disconnecting and re-connecting
+ // orphans the previous buffers, getting us back to the state where we can
+ // dequeue all buffers.
+ err = native_window_api_disconnect(surface.window.get(),
+ NATIVE_WINDOW_API_EGL);
+ ALOGW_IF(err != 0, "native_window_api_disconnect failed: %s (%d)",
+ strerror(-err), err);
+ err =
+ native_window_api_connect(surface.window.get(), NATIVE_WINDOW_API_EGL);
+ ALOGW_IF(err != 0, "native_window_api_connect failed: %s (%d)",
+ strerror(-err), err);
+
err = native_window_set_buffer_count(surface.window.get(), 0);
if (err != 0) {
ALOGE("native_window_set_buffer_count(0) failed: %s (%d)",
@@ -397,7 +487,7 @@
native_format = HAL_PIXEL_FORMAT_RGB_565;
break;
default:
- ALOGE("unsupported swapchain format %d", create_info->imageFormat);
+ ALOGV("unsupported swapchain format %d", create_info->imageFormat);
break;
}
err = native_window_set_buffers_format(surface.window.get(), native_format);
@@ -618,7 +708,8 @@
return result;
}
- *swapchain_handle = HandleFromSwapchain(swapchain);
+ surface.swapchain_handle = HandleFromSwapchain(swapchain);
+ *swapchain_handle = surface.swapchain_handle;
return VK_SUCCESS;
}
@@ -628,21 +719,13 @@
const VkAllocationCallbacks* allocator) {
const auto& dispatch = GetData(device).driver;
Swapchain* swapchain = SwapchainFromHandle(swapchain_handle);
- const android::sp<ANativeWindow>& window = swapchain->surface.window;
+ bool active = swapchain->surface.swapchain_handle == swapchain_handle;
+ ANativeWindow* window = active ? swapchain->surface.window.get() : nullptr;
- for (uint32_t i = 0; i < swapchain->num_images; i++) {
- Swapchain::Image& img = swapchain->images[i];
- if (img.dequeued) {
- window->cancelBuffer(window.get(), img.buffer.get(),
- img.dequeue_fence);
- img.dequeue_fence = -1;
- img.dequeued = false;
- }
- if (img.image) {
- dispatch.DestroyImage(device, img.image, nullptr);
- }
- }
-
+ for (uint32_t i = 0; i < swapchain->num_images; i++)
+ ReleaseSwapchainImage(device, window, -1, swapchain->images[i]);
+ if (active)
+ swapchain->surface.swapchain_handle = VK_NULL_HANDLE;
if (!allocator)
allocator = &GetData(device).allocator;
swapchain->~Swapchain();
@@ -655,6 +738,10 @@
uint32_t* count,
VkImage* images) {
Swapchain& swapchain = *SwapchainFromHandle(swapchain_handle);
+ ALOGW_IF(swapchain.surface.swapchain_handle != swapchain_handle,
+ "getting images for non-active swapchain 0x%" PRIx64
+ "; only dequeued image handles are valid",
+ reinterpret_cast<uint64_t>(swapchain_handle));
VkResult result = VK_SUCCESS;
if (images) {
uint32_t n = swapchain.num_images;
@@ -681,6 +768,9 @@
VkResult result;
int err;
+ if (swapchain.surface.swapchain_handle != swapchain_handle)
+ return VK_ERROR_OUT_OF_DATE_KHR;
+
ALOGW_IF(
timeout != UINT64_MAX,
"vkAcquireNextImageKHR: non-infinite timeouts not yet implemented");
@@ -739,6 +829,26 @@
return VK_SUCCESS;
}
+static VkResult WorstPresentResult(VkResult a, VkResult b) {
+ // See the error ranking for vkQueuePresentKHR at the end of section 29.6
+ // (in spec version 1.0.14).
+ static const VkResult kWorstToBest[] = {
+ VK_ERROR_DEVICE_LOST,
+ VK_ERROR_SURFACE_LOST_KHR,
+ VK_ERROR_OUT_OF_DATE_KHR,
+ VK_ERROR_OUT_OF_DEVICE_MEMORY,
+ VK_ERROR_OUT_OF_HOST_MEMORY,
+ VK_SUBOPTIMAL_KHR,
+ };
+ for (auto result : kWorstToBest) {
+ if (a == result || b == result)
+ return result;
+ }
+ ALOG_ASSERT(a == VK_SUCCESS, "invalid vkQueuePresentKHR result %d", a);
+ ALOG_ASSERT(b == VK_SUCCESS, "invalid vkQueuePresentKHR result %d", b);
+ return a != VK_SUCCESS ? a : b;
+}
+
VKAPI_ATTR
VkResult QueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* present_info) {
ALOGV_IF(present_info->sType != VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
@@ -746,14 +856,16 @@
present_info->sType);
ALOGV_IF(present_info->pNext, "VkPresentInfo::pNext != NULL");
+ VkDevice device = GetData(queue).driver_device;
const auto& dispatch = GetData(queue).driver;
VkResult final_result = VK_SUCCESS;
+
for (uint32_t sc = 0; sc < present_info->swapchainCount; sc++) {
Swapchain& swapchain =
*SwapchainFromHandle(present_info->pSwapchains[sc]);
- ANativeWindow* window = swapchain.surface.window.get();
uint32_t image_idx = present_info->pImageIndices[sc];
Swapchain::Image& img = swapchain.images[image_idx];
+ VkResult swapchain_result = VK_SUCCESS;
VkResult result;
int err;
@@ -763,37 +875,42 @@
present_info->pWaitSemaphores, img.image, &fence);
if (result != VK_SUCCESS) {
ALOGE("QueueSignalReleaseImageANDROID failed: %d", result);
- if (present_info->pResults)
- present_info->pResults[sc] = result;
- if (final_result == VK_SUCCESS)
- final_result = result;
- // TODO(jessehall): What happens to the buffer here? Does the app
- // still own it or not, i.e. should we cancel the buffer? Hard to
- // do correctly without synchronizing, though I guess we could wait
- // for the queue to idle.
- continue;
+ swapchain_result = result;
}
- err = window->queueBuffer(window, img.buffer.get(), fence);
- if (err != 0) {
- // TODO(jessehall): What now? We should probably cancel the buffer,
- // I guess?
- ALOGE("queueBuffer failed: %s (%d)", strerror(-err), err);
- if (present_info->pResults)
- present_info->pResults[sc] = result;
- if (final_result == VK_SUCCESS)
- final_result = VK_ERROR_INITIALIZATION_FAILED;
- continue;
+ if (swapchain.surface.swapchain_handle ==
+ present_info->pSwapchains[sc]) {
+ ANativeWindow* window = swapchain.surface.window.get();
+ if (swapchain_result == VK_SUCCESS) {
+ err = window->queueBuffer(window, img.buffer.get(), fence);
+ // queueBuffer always closes fence, even on error
+ if (err != 0) {
+ // TODO(jessehall): What now? We should probably cancel the
+ // buffer, I guess?
+ ALOGE("queueBuffer failed: %s (%d)", strerror(-err), err);
+ swapchain_result = WorstPresentResult(
+ swapchain_result, VK_ERROR_OUT_OF_DATE_KHR);
+ }
+ if (img.dequeue_fence >= 0) {
+ close(img.dequeue_fence);
+ img.dequeue_fence = -1;
+ }
+ img.dequeued = false;
+ }
+ if (swapchain_result != VK_SUCCESS) {
+ ReleaseSwapchainImage(device, window, fence, img);
+ OrphanSwapchain(device, &swapchain);
+ }
+ } else {
+ ReleaseSwapchainImage(device, nullptr, fence, img);
+ swapchain_result = VK_ERROR_OUT_OF_DATE_KHR;
}
- if (img.dequeue_fence != -1) {
- close(img.dequeue_fence);
- img.dequeue_fence = -1;
- }
- img.dequeued = false;
-
if (present_info->pResults)
- present_info->pResults[sc] = VK_SUCCESS;
+ present_info->pResults[sc] = swapchain_result;
+
+ if (swapchain_result != final_result)
+ final_result = WorstPresentResult(final_result, swapchain_result);
}
return final_result;
diff --git a/vulkan/libvulkan/vulkan_loader_data.cpp b/vulkan/libvulkan/vulkan_loader_data.cpp
index a6a0295..0eda0af 100644
--- a/vulkan/libvulkan/vulkan_loader_data.cpp
+++ b/vulkan/libvulkan/vulkan_loader_data.cpp
@@ -19,6 +19,6 @@
using namespace vulkan;
LoaderData& LoaderData::GetInstance() {
- static LoaderData loader_data;
+ static LoaderData loader_data = {};
return loader_data;
}
diff --git a/vulkan/nulldrv/null_driver.cpp b/vulkan/nulldrv/null_driver.cpp
index f29cb68..3bf3ff7 100644
--- a/vulkan/nulldrv/null_driver.cpp
+++ b/vulkan/nulldrv/null_driver.cpp
@@ -388,7 +388,7 @@
void GetPhysicalDeviceProperties(VkPhysicalDevice,
VkPhysicalDeviceProperties* properties) {
- properties->apiVersion = VK_API_VERSION;
+ properties->apiVersion = VK_MAKE_VERSION(1, 0, VK_HEADER_VERSION);
properties->driverVersion = VK_MAKE_VERSION(0, 0, 1);
properties->vendorID = 0;
properties->deviceID = 0;
diff --git a/vulkan/tools/vkinfo.cpp b/vulkan/tools/vkinfo.cpp
index 62d8240..7cf85e6 100644
--- a/vulkan/tools/vkinfo.cpp
+++ b/vulkan/tools/vkinfo.cpp
@@ -268,7 +268,7 @@
.applicationVersion = 0,
.pEngineName = "vkinfo",
.engineVersion = 0,
- .apiVersion = VK_API_VERSION,
+ .apiVersion = VK_API_VERSION_1_0,
};
const VkInstanceCreateInfo create_info = {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,