diff options
| author | Mark Lobodzinski <mark@lunarg.com> | 2017-01-26 13:34:13 -0700 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2017-01-26 15:45:51 -0700 |
| commit | 85dbd823c410a2817b077e2c6d1ee0cda7e247dd (patch) | |
| tree | 0043e88c6dcea7537d836c1fdb64556b09952a6c /loader | |
| parent | 5492b5039192cb9cae396a96e1fd7cff3852f6da (diff) | |
| download | usermoji-85dbd823c410a2817b077e2c6d1ee0cda7e247dd.tar.xz | |
repo: Clang-format LVL source files using Google
Switch clang-format standard from the LLVM style to the
Google style for more consistency.
Change-Id: I247c4abc275d7873a91522e1e234198adaa24033
Diffstat (limited to 'loader')
| -rw-r--r-- | loader/cJSON.c | 604 | ||||
| -rw-r--r-- | loader/debug_report.c | 3 | ||||
| -rw-r--r-- | loader/dev_ext_trampoline.c | 2 | ||||
| -rw-r--r-- | loader/extensions.c | 6 | ||||
| -rw-r--r-- | loader/gpa_helper.h | 432 | ||||
| -rw-r--r-- | loader/loader.c | 815 | ||||
| -rw-r--r-- | loader/loader.h | 33 | ||||
| -rw-r--r-- | loader/murmurhash.c | 32 | ||||
| -rw-r--r-- | loader/phys_dev_ext.c | 32 | ||||
| -rw-r--r-- | loader/table_ops.h | 496 | ||||
| -rw-r--r-- | loader/trampoline.c | 60 | ||||
| -rw-r--r-- | loader/vk_loader_platform.h | 25 | ||||
| -rw-r--r-- | loader/wsi.c | 193 | ||||
| -rw-r--r-- | loader/wsi.h | 18 |
14 files changed, 1183 insertions, 1568 deletions
diff --git a/loader/cJSON.c b/loader/cJSON.c index 9c800e18..a7671c4a 100644 --- a/loader/cJSON.c +++ b/loader/cJSON.c @@ -47,8 +47,7 @@ static char *cJSON_strdup(const char *str) { char *copy; len = strlen(str) + 1; - if (!(copy = (char *)cJSON_malloc(len))) - return 0; + if (!(copy = (char *)cJSON_malloc(len))) return 0; memcpy(copy, str, len); return copy; } @@ -67,8 +66,7 @@ void cJSON_InitHooks(cJSON_Hooks *hooks) { /* Internal constructor. */ static cJSON *cJSON_New_Item(void) { cJSON *node = (cJSON *)cJSON_malloc(sizeof(cJSON)); - if (node) - memset(node, 0, sizeof(cJSON)); + if (node) memset(node, 0, sizeof(cJSON)); return node; } @@ -77,12 +75,9 @@ void cJSON_Delete(cJSON *c) { cJSON *next; while (c) { next = c->next; - if (!(c->type & cJSON_IsReference) && c->child) - cJSON_Delete(c->child); - if (!(c->type & cJSON_IsReference) && c->valuestring) - cJSON_free(c->valuestring); - if (!(c->type & cJSON_StringIsConst) && c->string) - cJSON_free(c->string); + if (!(c->type & cJSON_IsReference) && c->child) cJSON_Delete(c->child); + if (!(c->type & cJSON_IsReference) && c->valuestring) cJSON_free(c->valuestring); + if (!(c->type & cJSON_StringIsConst) && c->string) cJSON_free(c->string); cJSON_free(c); c = next; } @@ -96,12 +91,9 @@ static const char *parse_number(cJSON *item, const char *num) { double n = 0, sign = 1, scale = 0; int subscale = 0, signsubscale = 1; - if (*num == '-') - sign = -1, num++; /* Has sign? */ - if (*num == '0') - num++; /* is zero */ - if (*num >= '1' && *num <= '9') - do + if (*num == '-') sign = -1, num++; /* Has sign? */ + if (*num == '0') num++; /* is zero */ + if (*num >= '1' && *num <= '9') do n = (n * 10.0) + (*num++ - '0'); while (*num >= '0' && *num <= '9'); /* Number? */ if (*num == '.' && num[1] >= '0' && num[1] <= '9') { @@ -116,9 +108,8 @@ static const char *parse_number(cJSON *item, const char *num) { if (*num == '+') num++; else if (*num == '-') - signsubscale = -1, num++; /* With sign? */ - while (*num >= '0' && *num <= '9') - subscale = (subscale * 10) + (*num++ - '0'); /* Number? */ + signsubscale = -1, num++; /* With sign? */ + while (*num >= '0' && *num <= '9') subscale = (subscale * 10) + (*num++ - '0'); /* Number? */ } n = sign * n * pow(10.0, (scale + subscale * signsubscale)); /* number = +/- @@ -150,11 +141,9 @@ typedef struct { static char *ensure(printbuffer *p, size_t needed) { char *newbuffer; size_t newsize; - if (!p || !p->buffer) - return 0; + if (!p || !p->buffer) return 0; needed += p->offset; - if (needed <= p->length) - return p->buffer + p->offset; + if (needed <= p->length) return p->buffer + p->offset; newsize = pow2gt(needed); newbuffer = (char *)cJSON_malloc(newsize); @@ -163,8 +152,7 @@ static char *ensure(printbuffer *p, size_t needed) { p->length = 0, p->buffer = 0; return 0; } - if (newbuffer) - memcpy(newbuffer, p->buffer, p->length); + if (newbuffer) memcpy(newbuffer, p->buffer, p->length); cJSON_free(p->buffer); p->length = newsize; p->buffer = newbuffer; @@ -173,8 +161,7 @@ static char *ensure(printbuffer *p, size_t needed) { static size_t update(printbuffer *p) { char *str; - if (!p || !p->buffer) - return 0; + if (!p || !p->buffer) return 0; str = p->buffer + p->offset; return p->offset + strlen(str); } @@ -188,15 +175,13 @@ static char *print_number(cJSON *item, printbuffer *p) { str = ensure(p, 2); else str = (char *)cJSON_malloc(2); /* special case for 0. */ - if (str) - strcpy(str, "0"); + if (str) strcpy(str, "0"); } else if (fabs(((double)item->valueint) - d) <= DBL_EPSILON && d <= INT_MAX && d >= INT_MIN) { if (p) str = ensure(p, 21); else str = (char *)cJSON_malloc(21); /* 2^64+1 can be represented in 21 chars. */ - if (str) - sprintf(str, "%d", item->valueint); + if (str) sprintf(str, "%d", item->valueint); } else { if (p) str = ensure(p, 64); @@ -271,12 +256,10 @@ static const char *parse_string(cJSON *item, const char *str) { } /* not a string! */ while (*ptr != '\"' && *ptr && ++len) - if (*ptr++ == '\\') - ptr++; /* Skip escaped quotes. */ + if (*ptr++ == '\\') ptr++; /* Skip escaped quotes. */ out = (char *)cJSON_malloc(len + 1); /* This is how long we need for the string, roughly. */ - if (!out) - return 0; + if (!out) return 0; ptr = str + 1; ptr2 = out; @@ -286,73 +269,69 @@ static const char *parse_string(cJSON *item, const char *str) { else { ptr++; switch (*ptr) { - case 'b': - *ptr2++ = '\b'; - break; - case 'f': - *ptr2++ = '\f'; - break; - case 'n': - *ptr2++ = '\n'; - break; - case 'r': - *ptr2++ = '\r'; - break; - case 't': - *ptr2++ = '\t'; - break; - case 'u': /* transcode utf16 to utf8. */ - uc = parse_hex4(ptr + 1); - ptr += 4; /* get the unicode char. */ - - if ((uc >= 0xDC00 && uc <= 0xDFFF) || uc == 0) - break; /* check for invalid. */ - - if (uc >= 0xD800 && uc <= 0xDBFF) /* UTF16 surrogate pairs. */ - { - if (ptr[1] != '\\' || ptr[2] != 'u') - break; /* missing second-half of surrogate. */ - uc2 = parse_hex4(ptr + 3); - ptr += 6; - if (uc2 < 0xDC00 || uc2 > 0xDFFF) - break; /* invalid second-half of surrogate. */ - uc = 0x10000 + (((uc & 0x3FF) << 10) | (uc2 & 0x3FF)); - } - - len = 4; - if (uc < 0x80) - len = 1; - else if (uc < 0x800) - len = 2; - else if (uc < 0x10000) - len = 3; - ptr2 += len; - - switch (len) { - case 4: - *--ptr2 = ((uc | 0x80) & 0xBF); - uc >>= 6; - case 3: - *--ptr2 = ((uc | 0x80) & 0xBF); - uc >>= 6; - case 2: - *--ptr2 = ((uc | 0x80) & 0xBF); - uc >>= 6; - case 1: - *--ptr2 = ((unsigned char)uc | firstByteMark[len]); - } - ptr2 += len; - break; - default: - *ptr2++ = *ptr; - break; + case 'b': + *ptr2++ = '\b'; + break; + case 'f': + *ptr2++ = '\f'; + break; + case 'n': + *ptr2++ = '\n'; + break; + case 'r': + *ptr2++ = '\r'; + break; + case 't': + *ptr2++ = '\t'; + break; + case 'u': /* transcode utf16 to utf8. */ + uc = parse_hex4(ptr + 1); + ptr += 4; /* get the unicode char. */ + + if ((uc >= 0xDC00 && uc <= 0xDFFF) || uc == 0) break; /* check for invalid. */ + + if (uc >= 0xD800 && uc <= 0xDBFF) /* UTF16 surrogate pairs. */ + { + if (ptr[1] != '\\' || ptr[2] != 'u') break; /* missing second-half of surrogate. */ + uc2 = parse_hex4(ptr + 3); + ptr += 6; + if (uc2 < 0xDC00 || uc2 > 0xDFFF) break; /* invalid second-half of surrogate. */ + uc = 0x10000 + (((uc & 0x3FF) << 10) | (uc2 & 0x3FF)); + } + + len = 4; + if (uc < 0x80) + len = 1; + else if (uc < 0x800) + len = 2; + else if (uc < 0x10000) + len = 3; + ptr2 += len; + + switch (len) { + case 4: + *--ptr2 = ((uc | 0x80) & 0xBF); + uc >>= 6; + case 3: + *--ptr2 = ((uc | 0x80) & 0xBF); + uc >>= 6; + case 2: + *--ptr2 = ((uc | 0x80) & 0xBF); + uc >>= 6; + case 1: + *--ptr2 = ((unsigned char)uc | firstByteMark[len]); + } + ptr2 += len; + break; + default: + *ptr2++ = *ptr; + break; } ptr++; } } *ptr2 = 0; - if (*ptr == '\"') - ptr++; + if (*ptr == '\"') ptr++; item->valuestring = out; item->type = cJSON_String; return ptr; @@ -366,16 +345,14 @@ static char *print_string_ptr(const char *str, printbuffer *p) { size_t len = 0, flag = 0; unsigned char token; - for (ptr = str; *ptr; ptr++) - flag |= ((*ptr > 0 && *ptr < 32) || (*ptr == '\"') || (*ptr == '\\')) ? 1 : 0; + for (ptr = str; *ptr; ptr++) flag |= ((*ptr > 0 && *ptr < 32) || (*ptr == '\"') || (*ptr == '\\')) ? 1 : 0; if (!flag) { len = ptr - str; if (p) out = ensure(p, len + 3); else out = (char *)cJSON_malloc(len + 3); - if (!out) - return 0; + if (!out) return 0; ptr2 = out; *ptr2++ = '\"'; strcpy(ptr2, str); @@ -389,8 +366,7 @@ static char *print_string_ptr(const char *str, printbuffer *p) { out = ensure(p, 3); else out = (char *)cJSON_malloc(3); - if (!out) - return 0; + if (!out) return 0; strcpy(out, "\"\""); return out; } @@ -407,8 +383,7 @@ static char *print_string_ptr(const char *str, printbuffer *p) { out = ensure(p, len + 3); else out = (char *)cJSON_malloc(len + 3); - if (!out) - return 0; + if (!out) return 0; ptr2 = out; ptr = str; @@ -418,31 +393,31 @@ static char *print_string_ptr(const char *str, printbuffer *p) { *ptr2++ = *ptr++; else { switch (token = *ptr++) { - case '\\': - *ptr2++ = '\\'; - break; - case '\"': - *ptr2++ = '\"'; - break; - case '\b': - *ptr2++ = '\b'; - break; - case '\f': - *ptr2++ = '\f'; - break; - case '\n': - *ptr2++ = '\n'; - break; - case '\r': - *ptr2++ = '\r'; - break; - case '\t': - *ptr2++ = '\t'; - break; - default: - sprintf(ptr2, "u%04x", token); - ptr2 += 5; - break; /* escape and print */ + case '\\': + *ptr2++ = '\\'; + break; + case '\"': + *ptr2++ = '\"'; + break; + case '\b': + *ptr2++ = '\b'; + break; + case '\f': + *ptr2++ = '\f'; + break; + case '\n': + *ptr2++ = '\n'; + break; + case '\r': + *ptr2++ = '\r'; + break; + case '\t': + *ptr2++ = '\t'; + break; + default: + sprintf(ptr2, "u%04x", token); + ptr2 += 5; + break; /* escape and print */ } } } @@ -463,8 +438,7 @@ static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p); /* Utility to jump whitespace and cr/lf */ static const char *skip(const char *in) { - while (in && *in && (unsigned char)*in <= 32) - in++; + while (in && *in && (unsigned char)*in <= 32) in++; return in; } @@ -473,8 +447,7 @@ cJSON *cJSON_ParseWithOpts(const char *value, const char **return_parse_end, int const char *end = 0; cJSON *c = cJSON_New_Item(); ep = 0; - if (!c) - return 0; /* memory fail */ + if (!c) return 0; /* memory fail */ end = parse_value(c, skip(value)); if (!end) { @@ -492,8 +465,7 @@ cJSON *cJSON_ParseWithOpts(const char *value, const char **return_parse_end, int return 0; } } - if (return_parse_end) - *return_parse_end = end; + if (return_parse_end) *return_parse_end = end; return c; } /* Default options for cJSON_Parse */ @@ -513,8 +485,7 @@ char *cJSON_PrintBuffered(cJSON *item, int prebuffer, int fmt) { /* Parser core - when encountering text, process appropriately. */ static const char *parse_value(cJSON *item, const char *value) { - if (!value) - return 0; /* Fail on null. */ + if (!value) return 0; /* Fail on null. */ if (!strncmp(value, "null", 4)) { item->type = cJSON_NULL; return value + 4; @@ -548,64 +519,60 @@ static const char *parse_value(cJSON *item, const char *value) { /* Render a value to text. */ static char *print_value(cJSON *item, int depth, int fmt, printbuffer *p) { char *out = 0; - if (!item) - return 0; + if (!item) return 0; if (p) { switch ((item->type) & 255) { - case cJSON_NULL: { - out = ensure(p, 5); - if (out) - strcpy(out, "null"); - break; - } - case cJSON_False: { - out = ensure(p, 6); - if (out) - strcpy(out, "false"); - break; - } - case cJSON_True: { - out = ensure(p, 5); - if (out) - strcpy(out, "true"); - break; - } - case cJSON_Number: - out = print_number(item, p); - break; - case cJSON_String: - out = print_string(item, p); - break; - case cJSON_Array: - out = print_array(item, depth, fmt, p); - break; - case cJSON_Object: - out = print_object(item, depth, fmt, p); - break; + case cJSON_NULL: { + out = ensure(p, 5); + if (out) strcpy(out, "null"); + break; + } + case cJSON_False: { + out = ensure(p, 6); + if (out) strcpy(out, "false"); + break; + } + case cJSON_True: { + out = ensure(p, 5); + if (out) strcpy(out, "true"); + break; + } + case cJSON_Number: + out = print_number(item, p); + break; + case cJSON_String: + out = print_string(item, p); + break; + case cJSON_Array: + out = print_array(item, depth, fmt, p); + break; + case cJSON_Object: + out = print_object(item, depth, fmt, p); + break; } } else { switch ((item->type) & 255) { - case cJSON_NULL: - out = cJSON_strdup("null"); - break; - case cJSON_False: - out = cJSON_strdup("false"); - break; - case cJSON_True: - out = cJSON_strdup("true"); - break; - case cJSON_Number: - out = print_number(item, 0); - break; - case cJSON_String: - out = print_string(item, 0); - break; - case cJSON_Array: - out = print_array(item, depth, fmt, 0); - break; - case cJSON_Object: - out = print_object(item, depth, fmt, 0); - break; + case cJSON_NULL: + out = cJSON_strdup("null"); + break; + case cJSON_False: + out = cJSON_strdup("false"); + break; + case cJSON_True: + out = cJSON_strdup("true"); + break; + case cJSON_Number: + out = print_number(item, 0); + break; + case cJSON_String: + out = print_string(item, 0); + break; + case cJSON_Array: + out = print_array(item, depth, fmt, 0); + break; + case cJSON_Object: + out = print_object(item, depth, fmt, 0); + break; } } return out; @@ -621,30 +588,24 @@ static const char *parse_array(cJSON *item, const char *value) { item->type = cJSON_Array; value = skip(value + 1); - if (*value == ']') - return value + 1; /* empty array. */ + if (*value == ']') return value + 1; /* empty array. */ item->child = child = cJSON_New_Item(); - if (!item->child) - return 0; /* memory fail */ + if (!item->child) return 0; /* memory fail */ value = skip(parse_value(child, skip(value))); /* skip any spacing, get the value. */ - if (!value) - return 0; + if (!value) return 0; while (*value == ',') { cJSON *new_item; - if (!(new_item = cJSON_New_Item())) - return 0; /* memory fail */ + if (!(new_item = cJSON_New_Item())) return 0; /* memory fail */ child->next = new_item; new_item->prev = child; child = new_item; value = skip(parse_value(child, skip(value + 1))); - if (!value) - return 0; /* memory fail */ + if (!value) return 0; /* memory fail */ } - if (*value == ']') - return value + 1; /* end of array */ + if (*value == ']') return value + 1; /* end of array */ ep = value; return 0; /* malformed. */ } @@ -659,16 +620,14 @@ static char *print_array(cJSON *item, int depth, int fmt, printbuffer *p) { size_t tmplen = 0, i = 0; /* How many entries in the array? */ - while (child) - numentries++, child = child->next; + while (child) numentries++, child = child->next; /* Explicitly handle numentries==0 */ if (!numentries) { if (p) out = ensure(p, 3); else out = (char *)cJSON_malloc(3); - if (out) - strcpy(out, "[]"); + if (out) strcpy(out, "[]"); return out; } @@ -676,8 +635,7 @@ static char *print_array(cJSON *item, int depth, int fmt, printbuffer *p) { /* Compose the output array. */ i = p->offset; ptr = ensure(p, 1); - if (!ptr) - return 0; + if (!ptr) return 0; *ptr = '['; p->offset++; child = item->child; @@ -687,27 +645,23 @@ static char *print_array(cJSON *item, int depth, int fmt, printbuffer *p) { if (child->next) { len = fmt ? 2 : 1; ptr = ensure(p, len + 1); - if (!ptr) - return 0; + if (!ptr) return 0; *ptr++ = ','; - if (fmt) - *ptr++ = ' '; + if (fmt) *ptr++ = ' '; *ptr = 0; p->offset += len; } child = child->next; } ptr = ensure(p, 2); - if (!ptr) - return 0; + if (!ptr) return 0; *ptr++ = ']'; *ptr = 0; out = (p->buffer) + i; } else { /* Allocate an array to hold the values for each */ entries = (char **)cJSON_malloc(numentries * sizeof(char *)); - if (!entries) - return 0; + if (!entries) return 0; memset(entries, 0, numentries * sizeof(char *)); /* Retrieve all the results: */ child = item->child; @@ -722,17 +676,14 @@ static char *print_array(cJSON *item, int depth, int fmt, printbuffer *p) { } /* If we didn't fail, try to malloc the output string */ - if (!fail) - out = (char *)cJSON_malloc(len); + if (!fail) out = (char *)cJSON_malloc(len); /* If that fails, we fail. */ - if (!out) - fail = 1; + if (!out) fail = 1; /* Handle failure. */ if (fail) { for (j = 0; j < numentries; j++) - if (entries[j]) - cJSON_free(entries[j]); + if (entries[j]) cJSON_free(entries[j]); cJSON_free(entries); return 0; } @@ -747,8 +698,7 @@ static char *print_array(cJSON *item, int depth, int fmt, printbuffer *p) { ptr += tmplen; if (j != numentries - 1) { *ptr++ = ','; - if (fmt) - *ptr++ = ' '; + if (fmt) *ptr++ = ' '; *ptr = 0; } cJSON_free(entries[j]); @@ -770,15 +720,12 @@ static const char *parse_object(cJSON *item, const char *value) { item->type = cJSON_Object; value = skip(value + 1); - if (*value == '}') - return value + 1; /* empty array. */ + if (*value == '}') return value + 1; /* empty array. */ item->child = child = cJSON_New_Item(); - if (!item->child) - return 0; + if (!item->child) return 0; value = skip(parse_string(child, skip(value))); - if (!value) - return 0; + if (!value) return 0; child->string = child->valuestring; child->valuestring = 0; if (*value != ':') { @@ -786,19 +733,16 @@ static const char *parse_object(cJSON *item, const char *value) { return 0; } /* fail! */ value = skip(parse_value(child, skip(value + 1))); /* skip any spacing, get the value. */ - if (!value) - return 0; + if (!value) return 0; while (*value == ',') { cJSON *new_item; - if (!(new_item = cJSON_New_Item())) - return 0; /* memory fail */ + if (!(new_item = cJSON_New_Item())) return 0; /* memory fail */ child->next = new_item; new_item->prev = child; child = new_item; value = skip(parse_string(child, skip(value + 1))); - if (!value) - return 0; + if (!value) return 0; child->string = child->valuestring; child->valuestring = 0; if (*value != ':') { @@ -806,12 +750,10 @@ static const char *parse_object(cJSON *item, const char *value) { return 0; } /* fail! */ value = skip(parse_value(child, skip(value + 1))); /* skip any spacing, get the value. */ - if (!value) - return 0; + if (!value) return 0; } - if (*value == '}') - return value + 1; /* end of array */ + if (*value == '}') return value + 1; /* end of array */ ep = value; return 0; /* malformed. */ } @@ -825,22 +767,19 @@ static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) { int numentries = 0, fail = 0, k; size_t tmplen = 0, i = 0, len = 7; /* Count the number of entries. */ - while (child) - numentries++, child = child->next; + while (child) numentries++, child = child->next; /* Explicitly handle empty object case */ if (!numentries) { if (p) out = ensure(p, fmt ? depth + 4 : 3); else out = (char *)cJSON_malloc(fmt ? depth + 4 : 3); - if (!out) - return 0; + if (!out) return 0; ptr = out; *ptr++ = '{'; if (fmt) { *ptr++ = '\n'; - for (j = 0; j < depth - 1; j++) - *ptr++ = '\t'; + for (j = 0; j < depth - 1; j++) *ptr++ = '\t'; } *ptr++ = '}'; *ptr++ = 0; @@ -851,11 +790,9 @@ static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) { i = p->offset; len = fmt ? 2 : 1; ptr = ensure(p, len + 1); - if (!ptr) - return 0; + if (!ptr) return 0; *ptr++ = '{'; - if (fmt) - *ptr++ = '\n'; + if (fmt) *ptr++ = '\n'; *ptr = 0; p->offset += len; child = item->child; @@ -863,10 +800,8 @@ static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) { while (child) { if (fmt) { ptr = ensure(p, depth); - if (!ptr) - return 0; - for (j = 0; j < depth; j++) - *ptr++ = '\t'; + if (!ptr) return 0; + for (j = 0; j < depth; j++) *ptr++ = '\t'; p->offset += depth; } print_string_ptr(child->string, p); @@ -874,11 +809,9 @@ static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) { len = fmt ? 2 : 1; ptr = ensure(p, len); - if (!ptr) - return 0; + if (!ptr) return 0; *ptr++ = ':'; - if (fmt) - *ptr++ = '\t'; + if (fmt) *ptr++ = '\t'; p->offset += len; print_value(child, depth, fmt, p); @@ -886,30 +819,24 @@ static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) { len = (fmt ? 1 : 0) + (child->next ? 1 : 0); ptr = ensure(p, len + 1); - if (!ptr) - return 0; - if (child->next) - *ptr++ = ','; - if (fmt) - *ptr++ = '\n'; + if (!ptr) return 0; + if (child->next) *ptr++ = ','; + if (fmt) *ptr++ = '\n'; *ptr = 0; p->offset += len; child = child->next; } ptr = ensure(p, fmt ? (depth + 1) : 2); - if (!ptr) - return 0; + if (!ptr) return 0; if (fmt) - for (j = 0; j < depth - 1; j++) - *ptr++ = '\t'; + for (j = 0; j < depth - 1; j++) *ptr++ = '\t'; *ptr++ = '}'; *ptr = 0; out = (p->buffer) + i; } else { /* Allocate space for the names and the objects */ entries = (char **)cJSON_malloc(numentries * sizeof(char *)); - if (!entries) - return 0; + if (!entries) return 0; names = (char **)cJSON_malloc(numentries * sizeof(char *)); if (!names) { cJSON_free(entries); @@ -921,8 +848,7 @@ static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) { /* Collect all the results into our arrays: */ child = item->child; depth++; - if (fmt) - len += depth; + if (fmt) len += depth; while (child) { names[i] = str = print_string_ptr(child->string, 0); entries[i++] = ret = print_value(child, depth, fmt, 0); @@ -934,18 +860,14 @@ static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) { } /* Try to allocate the output string */ - if (!fail) - out = (char *)cJSON_malloc(len); - if (!out) - fail = 1; + if (!fail) out = (char *)cJSON_malloc(len); + if (!out) fail = 1; /* Handle failure */ if (fail) { for (j = 0; j < numentries; j++) { - if (names[i]) - cJSON_free(names[j]); - if (entries[j]) - cJSON_free(entries[j]); + if (names[i]) cJSON_free(names[j]); + if (entries[j]) cJSON_free(entries[j]); } cJSON_free(names); cJSON_free(entries); @@ -955,25 +877,20 @@ static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) { /* Compose the output: */ *out = '{'; ptr = out + 1; - if (fmt) - *ptr++ = '\n'; + if (fmt) *ptr++ = '\n'; *ptr = 0; for (j = 0; j < numentries; j++) { if (fmt) - for (k = 0; k < depth; k++) - *ptr++ = '\t'; + for (k = 0; k < depth; k++) *ptr++ = '\t'; tmplen = strlen(names[j]); memcpy(ptr, names[j], tmplen); ptr += tmplen; *ptr++ = ':'; - if (fmt) - *ptr++ = '\t'; + if (fmt) *ptr++ = '\t'; strcpy(ptr, entries[j]); ptr += strlen(entries[j]); - if (j != numentries - 1) - *ptr++ = ','; - if (fmt) - *ptr++ = '\n'; + if (j != numentries - 1) *ptr++ = ','; + if (fmt) *ptr++ = '\n'; *ptr = 0; cJSON_free(names[j]); cJSON_free(entries[j]); @@ -982,8 +899,7 @@ static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) { cJSON_free(names); cJSON_free(entries); if (fmt) - for (j = 0; j < depth - 1; j++) - *ptr++ = '\t'; + for (j = 0; j < depth - 1; j++) *ptr++ = '\t'; *ptr++ = '}'; *ptr++ = 0; } @@ -994,20 +910,17 @@ static char *print_object(cJSON *item, int depth, int fmt, printbuffer *p) { int cJSON_GetArraySize(cJSON *array) { cJSON *c = array->child; int i = 0; - while (c) - i++, c = c->next; + while (c) i++, c = c->next; return i; } cJSON *cJSON_GetArrayItem(cJSON *array, int item) { cJSON *c = array->child; - while (c && item > 0) - item--, c = c->next; + while (c && item > 0) item--, c = c->next; return c; } cJSON *cJSON_GetObjectItem(cJSON *object, const char *string) { cJSON *c = object->child; - while (c && strcmp(c->string, string)) - c = c->next; + while (c && strcmp(c->string, string)) c = c->next; return c; } @@ -1019,8 +932,7 @@ static void suffix_object(cJSON *prev, cJSON *item) { /* Utility for handling references. */ static cJSON *create_reference(cJSON *item) { cJSON *ref = cJSON_New_Item(); - if (!ref) - return 0; + if (!ref) return 0; memcpy(ref, item, sizeof(cJSON)); ref->string = 0; ref->type |= cJSON_IsReference; @@ -1031,29 +943,23 @@ static cJSON *create_reference(cJSON *item) { /* Add item to array/object. */ void cJSON_AddItemToArray(cJSON *array, cJSON *item) { cJSON *c = array->child; - if (!item) - return; + if (!item) return; if (!c) { array->child = item; } else { - while (c && c->next) - c = c->next; + while (c && c->next) c = c->next; suffix_object(c, item); } } void cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) { - if (!item) - return; - if (item->string) - cJSON_free(item->string); + if (!item) return; + if (item->string) cJSON_free(item->string); item->string = cJSON_strdup(string); cJSON_AddItemToArray(object, item); } void cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) { - if (!item) - return; - if (!(item->type & cJSON_StringIsConst) && item->string) - cJSON_free(item->string); + if (!item) return; + if (!(item->type & cJSON_StringIsConst) && item->string) cJSON_free(item->string); item->string = (char *)string; item->type |= cJSON_StringIsConst; cJSON_AddItemToArray(object, item); @@ -1065,16 +971,11 @@ void cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *it cJSON *cJSON_DetachItemFromArray(cJSON *array, int which) { cJSON *c = array->child; - while (c && which > 0) - c = c->next, which--; - if (!c) - return 0; - if (c->prev) - c->prev->next = c->next; - if (c->next) - c->next->prev = c->prev; - if (c == array->child) - array->child = c->next; + while (c && which > 0) c = c->next, which--; + if (!c) return 0; + if (c->prev) c->prev->next = c->next; + if (c->next) c->next->prev = c->prev; + if (c == array->child) array->child = c->next; c->prev = c->next = 0; return c; } @@ -1082,10 +983,8 @@ void cJSON_DeleteItemFromArray(cJSON *array, int which) { cJSON_Delete(cJSON_Det cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string) { int i = 0; cJSON *c = object->child; - while (c && strcmp(c->string, string)) - i++, c = c->next; - if (c) - return cJSON_DetachItemFromArray(object, i); + while (c && strcmp(c->string, string)) i++, c = c->next; + if (c) return cJSON_DetachItemFromArray(object, i); return 0; } void cJSON_DeleteItemFromObject(cJSON *object, const char *string) { cJSON_Delete(cJSON_DetachItemFromObject(object, string)); } @@ -1093,8 +992,7 @@ void cJSON_DeleteItemFromObject(cJSON *object, const char *string) { cJSON_Delet /* Replace array/object items with new ones. */ void cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) { cJSON *c = array->child; - while (c && which > 0) - c = c->next, which--; + while (c && which > 0) c = c->next, which--; if (!c) { cJSON_AddItemToArray(array, newitem); return; @@ -1109,14 +1007,11 @@ void cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) { } void cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) { cJSON *c = array->child; - while (c && which > 0) - c = c->next, which--; - if (!c) - return; + while (c && which > 0) c = c->next, which--; + if (!c) return; newitem->next = c->next; newitem->prev = c->prev; - if (newitem->next) - newitem->next->prev = newitem; + if (newitem->next) newitem->next->prev = newitem; if (c == array->child) array->child = newitem; else @@ -1127,8 +1022,7 @@ void cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) { void cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) { int i = 0; cJSON *c = object->child; - while (c && strcmp(c->string, string)) - i++, c = c->next; + while (c && strcmp(c->string, string)) i++, c = c->next; if (c) { newitem->string = cJSON_strdup(string); cJSON_ReplaceItemInArray(object, i, newitem); @@ -1138,26 +1032,22 @@ void cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem /* Create basic types: */ cJSON *cJSON_CreateNull(void) { cJSON *item = cJSON_New_Item(); - if (item) - item->type = cJSON_NULL; + if (item) item->type = cJSON_NULL; return item; } cJSON *cJSON_CreateTrue(void) { cJSON *item = cJSON_New_Item(); - if (item) - item->type = cJSON_True; + if (item) item->type = cJSON_True; return item; } cJSON *cJSON_CreateFalse(void) { cJSON *item = cJSON_New_Item(); - if (item) - item->type = cJSON_False; + if (item) item->type = cJSON_False; return item; } cJSON *cJSON_CreateBool(int b) { cJSON *item = cJSON_New_Item(); - if (item) - item->type = b ? cJSON_True : cJSON_False; + if (item) item->type = b ? cJSON_True : cJSON_False; return item; } cJSON *cJSON_CreateNumber(double num) { @@ -1179,14 +1069,12 @@ cJSON *cJSON_CreateString(const char *string) { } cJSON *cJSON_CreateArray(void) { cJSON *item = cJSON_New_Item(); - if (item) - item->type = cJSON_Array; + if (item) item->type = cJSON_Array; return item; } cJSON *cJSON_CreateObject(void) { cJSON *item = cJSON_New_Item(); - if (item) - item->type = cJSON_Object; + if (item) item->type = cJSON_Object; return item; } @@ -1248,12 +1136,10 @@ cJSON *cJSON_CreateStringArray(const char **strings, int count) { cJSON *cJSON_Duplicate(cJSON *item, int recurse) { cJSON *newitem, *cptr, *nptr = 0, *newchild; /* Bail on bad ptr */ - if (!item) - return 0; + if (!item) return 0; /* Create new item */ newitem = cJSON_New_Item(); - if (!newitem) - return 0; + if (!newitem) return 0; /* Copy over all vars */ newitem->type = item->type & (~cJSON_IsReference), newitem->valueint = item->valueint, newitem->valuedouble = item->valuedouble; if (item->valuestring) { @@ -1271,8 +1157,7 @@ cJSON *cJSON_Duplicate(cJSON *item, int recurse) { } } /* If non-recursive, then we're done! */ - if (!recurse) - return newitem; + if (!recurse) return newitem; /* Walk the ->next chain for the child. */ cptr = item->child; while (cptr) { @@ -1307,18 +1192,15 @@ void cJSON_Minify(char *json) { else if (*json == '\n') json++; else if (*json == '/' && json[1] == '/') - while (*json && *json != '\n') - json++; /* double-slash comments, to end of line. */ + while (*json && *json != '\n') json++; /* double-slash comments, to end of line. */ else if (*json == '/' && json[1] == '*') { - while (*json && !(*json == '*' && json[1] == '/')) - json++; + while (*json && !(*json == '*' && json[1] == '/')) json++; json += 2; } /* multiline comments. */ else if (*json == '\"') { *into++ = *json++; while (*json && *json != '\"') { - if (*json == '\\') - *into++ = *json++; + if (*json == '\\') *into++ = *json++; *into++ = *json++; } *into++ = *json++; diff --git a/loader/debug_report.c b/loader/debug_report.c index 84b85492..bd46282a 100644 --- a/loader/debug_report.c +++ b/loader/debug_report.c @@ -120,8 +120,7 @@ void util_DestroyDebugReportCallback(struct loader_instance *inst, VkDebugReport while (pTrav) { if (pTrav->msgCallback == callback) { pPrev->pNext = pTrav->pNext; - if (inst->DbgFunctionHead == pTrav) - inst->DbgFunctionHead = pTrav->pNext; + if (inst->DbgFunctionHead == pTrav) inst->DbgFunctionHead = pTrav->pNext; #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) { #else diff --git a/loader/dev_ext_trampoline.c b/loader/dev_ext_trampoline.c index 5de697c2..c5c549ae 100644 --- a/loader/dev_ext_trampoline.c +++ b/loader/dev_ext_trampoline.c @@ -21,7 +21,7 @@ #include "vk_loader_platform.h" #include "loader.h" #if defined(__GNUC__) && !defined(__clang__) -#pragma GCC optimize(3) // force gcc to use tail-calls +#pragma GCC optimize(3) // force gcc to use tail-calls #endif // Clang-format does not understand macros. diff --git a/loader/extensions.c b/loader/extensions.c index 0b5c0002..fb05809f 100644 --- a/loader/extensions.c +++ b/loader/extensions.c @@ -425,7 +425,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV(VkDevice device, VkDevic return disp->GetMemoryWin32HandleNV(device, memory, handleType, pHandle); } -#endif // VK_USE_PLATFORM_WIN32_KHR +#endif // VK_USE_PLATFORM_WIN32_KHR // Definitions for the VK_NVX_device_generated_commands @@ -573,7 +573,7 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na return true; } -#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT +#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT // Definitions for the VK_EXT_debug_marker extension commands which // need to have a terminator function. Since these are device @@ -631,7 +631,7 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na return true; } -#endif // VK_USE_PLATFORM_WIN32_KHR +#endif // VK_USE_PLATFORM_WIN32_KHR // Functions for the VK_NVX_device_generated_commands extension diff --git a/loader/gpa_helper.h b/loader/gpa_helper.h index e3e41ba1..93d60df9 100644 --- a/loader/gpa_helper.h +++ b/loader/gpa_helper.h @@ -26,289 +26,154 @@ static inline void *trampolineGetProcAddr(struct loader_instance *inst, const char *funcName) { // Don't include or check global functions - if (!strcmp(funcName, "vkGetInstanceProcAddr")) - return (PFN_vkVoidFunction)vkGetInstanceProcAddr; - if (!strcmp(funcName, "vkDestroyInstance")) - return (PFN_vkVoidFunction)vkDestroyInstance; - if (!strcmp(funcName, "vkEnumeratePhysicalDevices")) - return (PFN_vkVoidFunction)vkEnumeratePhysicalDevices; - if (!strcmp(funcName, "vkGetPhysicalDeviceFeatures")) - return (PFN_vkVoidFunction)vkGetPhysicalDeviceFeatures; - if (!strcmp(funcName, "vkGetPhysicalDeviceFormatProperties")) - return (PFN_vkVoidFunction)vkGetPhysicalDeviceFormatProperties; + if (!strcmp(funcName, "vkGetInstanceProcAddr")) return (PFN_vkVoidFunction)vkGetInstanceProcAddr; + if (!strcmp(funcName, "vkDestroyInstance")) return (PFN_vkVoidFunction)vkDestroyInstance; + if (!strcmp(funcName, "vkEnumeratePhysicalDevices")) return (PFN_vkVoidFunction)vkEnumeratePhysicalDevices; + if (!strcmp(funcName, "vkGetPhysicalDeviceFeatures")) return (PFN_vkVoidFunction)vkGetPhysicalDeviceFeatures; + if (!strcmp(funcName, "vkGetPhysicalDeviceFormatProperties")) return (PFN_vkVoidFunction)vkGetPhysicalDeviceFormatProperties; if (!strcmp(funcName, "vkGetPhysicalDeviceImageFormatProperties")) return (PFN_vkVoidFunction)vkGetPhysicalDeviceImageFormatProperties; if (!strcmp(funcName, "vkGetPhysicalDeviceSparseImageFormatProperties")) return (PFN_vkVoidFunction)vkGetPhysicalDeviceSparseImageFormatProperties; - if (!strcmp(funcName, "vkGetPhysicalDeviceProperties")) - return (PFN_vkVoidFunction)vkGetPhysicalDeviceProperties; + if (!strcmp(funcName, "vkGetPhysicalDeviceProperties")) return (PFN_vkVoidFunction)vkGetPhysicalDeviceProperties; if (!strcmp(funcName, "vkGetPhysicalDeviceQueueFamilyProperties")) return (PFN_vkVoidFunction)vkGetPhysicalDeviceQueueFamilyProperties; - if (!strcmp(funcName, "vkGetPhysicalDeviceMemoryProperties")) - return (PFN_vkVoidFunction)vkGetPhysicalDeviceMemoryProperties; - if (!strcmp(funcName, "vkEnumerateDeviceLayerProperties")) - return (PFN_vkVoidFunction)vkEnumerateDeviceLayerProperties; - if (!strcmp(funcName, "vkEnumerateDeviceExtensionProperties")) - return (PFN_vkVoidFunction)vkEnumerateDeviceExtensionProperties; - if (!strcmp(funcName, "vkCreateDevice")) - return (PFN_vkVoidFunction)vkCreateDevice; - if (!strcmp(funcName, "vkGetDeviceProcAddr")) - return (PFN_vkVoidFunction)vkGetDeviceProcAddr; - if (!strcmp(funcName, "vkDestroyDevice")) - return (PFN_vkVoidFunction)vkDestroyDevice; - if (!strcmp(funcName, "vkGetDeviceQueue")) - return (PFN_vkVoidFunction)vkGetDeviceQueue; - if (!strcmp(funcName, "vkQueueSubmit")) - return (PFN_vkVoidFunction)vkQueueSubmit; - if (!strcmp(funcName, "vkQueueWaitIdle")) - return (PFN_vkVoidFunction)vkQueueWaitIdle; - if (!strcmp(funcName, "vkDeviceWaitIdle")) - return (PFN_vkVoidFunction)vkDeviceWaitIdle; - if (!strcmp(funcName, "vkAllocateMemory")) - return (PFN_vkVoidFunction)vkAllocateMemory; - if (!strcmp(funcName, "vkFreeMemory")) - return (PFN_vkVoidFunction)vkFreeMemory; - if (!strcmp(funcName, "vkMapMemory")) - return (PFN_vkVoidFunction)vkMapMemory; - if (!strcmp(funcName, "vkUnmapMemory")) - return (PFN_vkVoidFunction)vkUnmapMemory; - if (!strcmp(funcName, "vkFlushMappedMemoryRanges")) - return (PFN_vkVoidFunction)vkFlushMappedMemoryRanges; - if (!strcmp(funcName, "vkInvalidateMappedMemoryRanges")) - return (PFN_vkVoidFunction)vkInvalidateMappedMemoryRanges; - if (!strcmp(funcName, "vkGetDeviceMemoryCommitment")) - return (PFN_vkVoidFunction)vkGetDeviceMemoryCommitment; - if (!strcmp(funcName, "vkGetImageSparseMemoryRequirements")) - return (PFN_vkVoidFunction)vkGetImageSparseMemoryRequirements; - if (!strcmp(funcName, "vkGetImageMemoryRequirements")) - return (PFN_vkVoidFunction)vkGetImageMemoryRequirements; - if (!strcmp(funcName, "vkGetBufferMemoryRequirements")) - return (PFN_vkVoidFunction)vkGetBufferMemoryRequirements; - if (!strcmp(funcName, "vkBindImageMemory")) - return (PFN_vkVoidFunction)vkBindImageMemory; - if (!strcmp(funcName, "vkBindBufferMemory")) - return (PFN_vkVoidFunction)vkBindBufferMemory; - if (!strcmp(funcName, "vkQueueBindSparse")) - return (PFN_vkVoidFunction)vkQueueBindSparse; - if (!strcmp(funcName, "vkCreateFence")) - return (PFN_vkVoidFunction)vkCreateFence; - if (!strcmp(funcName, "vkDestroyFence")) - return (PFN_vkVoidFunction)vkDestroyFence; - if (!strcmp(funcName, "vkGetFenceStatus")) - return (PFN_vkVoidFunction)vkGetFenceStatus; - if (!strcmp(funcName, "vkResetFences")) - return (PFN_vkVoidFunction)vkResetFences; - if (!strcmp(funcName, "vkWaitForFences")) - return (PFN_vkVoidFunction)vkWaitForFences; - if (!strcmp(funcName, "vkCreateSemaphore")) - return (PFN_vkVoidFunction)vkCreateSemaphore; - if (!strcmp(funcName, "vkDestroySemaphore")) - return (PFN_vkVoidFunction)vkDestroySemaphore; - if (!strcmp(funcName, "vkCreateEvent")) - return (PFN_vkVoidFunction)vkCreateEvent; - if (!strcmp(funcName, "vkDestroyEvent")) - return (PFN_vkVoidFunction)vkDestroyEvent; - if (!strcmp(funcName, "vkGetEventStatus")) - return (PFN_vkVoidFunction)vkGetEventStatus; - if (!strcmp(funcName, "vkSetEvent")) - return (PFN_vkVoidFunction)vkSetEvent; - if (!strcmp(funcName, "vkResetEvent")) - return (PFN_vkVoidFunction)vkResetEvent; - if (!strcmp(funcName, "vkCreateQueryPool")) - return (PFN_vkVoidFunction)vkCreateQueryPool; - if (!strcmp(funcName, "vkDestroyQueryPool")) - return (PFN_vkVoidFunction)vkDestroyQueryPool; - if (!strcmp(funcName, "vkGetQueryPoolResults")) - return (PFN_vkVoidFunction)vkGetQueryPoolResults; - if (!strcmp(funcName, "vkCreateBuffer")) - return (PFN_vkVoidFunction)vkCreateBuffer; - if (!strcmp(funcName, "vkDestroyBuffer")) - return (PFN_vkVoidFunction)vkDestroyBuffer; - if (!strcmp(funcName, "vkCreateBufferView")) - return (PFN_vkVoidFunction)vkCreateBufferView; - if (!strcmp(funcName, "vkDestroyBufferView")) - return (PFN_vkVoidFunction)vkDestroyBufferView; - if (!strcmp(funcName, "vkCreateImage")) - return (PFN_vkVoidFunction)vkCreateImage; - if (!strcmp(funcName, "vkDestroyImage")) - return (PFN_vkVoidFunction)vkDestroyImage; - if (!strcmp(funcName, "vkGetImageSubresourceLayout")) - return (PFN_vkVoidFunction)vkGetImageSubresourceLayout; - if (!strcmp(funcName, "vkCreateImageView")) - return (PFN_vkVoidFunction)vkCreateImageView; - if (!strcmp(funcName, "vkDestroyImageView")) - return (PFN_vkVoidFunction)vkDestroyImageView; - if (!strcmp(funcName, "vkCreateShaderModule")) - return (PFN_vkVoidFunction)vkCreateShaderModule; - if (!strcmp(funcName, "vkDestroyShaderModule")) - return (PFN_vkVoidFunction)vkDestroyShaderModule; - if (!strcmp(funcName, "vkCreatePipelineCache")) - return (PFN_vkVoidFunction)vkCreatePipelineCache; - if (!strcmp(funcName, "vkDestroyPipelineCache")) - return (PFN_vkVoidFunction)vkDestroyPipelineCache; - if (!strcmp(funcName, "vkGetPipelineCacheData")) - return (PFN_vkVoidFunction)vkGetPipelineCacheData; - if (!strcmp(funcName, "vkMergePipelineCaches")) - return (PFN_vkVoidFunction)vkMergePipelineCaches; - if (!strcmp(funcName, "vkCreateGraphicsPipelines")) - return (PFN_vkVoidFunction)vkCreateGraphicsPipelines; - if (!strcmp(funcName, "vkCreateComputePipelines")) - return (PFN_vkVoidFunction)vkCreateComputePipelines; - if (!strcmp(funcName, "vkDestroyPipeline")) - return (PFN_vkVoidFunction)vkDestroyPipeline; - if (!strcmp(funcName, "vkCreatePipelineLayout")) - return (PFN_vkVoidFunction)vkCreatePipelineLayout; - if (!strcmp(funcName, "vkDestroyPipelineLayout")) - return (PFN_vkVoidFunction)vkDestroyPipelineLayout; - if (!strcmp(funcName, "vkCreateSampler")) - return (PFN_vkVoidFunction)vkCreateSampler; - if (!strcmp(funcName, "vkDestroySampler")) - return (PFN_vkVoidFunction)vkDestroySampler; - if (!strcmp(funcName, "vkCreateDescriptorSetLayout")) - return (PFN_vkVoidFunction)vkCreateDescriptorSetLayout; - if (!strcmp(funcName, "vkDestroyDescriptorSetLayout")) - return (PFN_vkVoidFunction)vkDestroyDescriptorSetLayout; - if (!strcmp(funcName, "vkCreateDescriptorPool")) - return (PFN_vkVoidFunction)vkCreateDescriptorPool; - if (!strcmp(funcName, "vkDestroyDescriptorPool")) - return (PFN_vkVoidFunction)vkDestroyDescriptorPool; - if (!strcmp(funcName, "vkResetDescriptorPool")) - return (PFN_vkVoidFunction)vkResetDescriptorPool; - if (!strcmp(funcName, "vkAllocateDescriptorSets")) - return (PFN_vkVoidFunction)vkAllocateDescriptorSets; - if (!strcmp(funcName, "vkFreeDescriptorSets")) - return (PFN_vkVoidFunction)vkFreeDescriptorSets; - if (!strcmp(funcName, "vkUpdateDescriptorSets")) - return (PFN_vkVoidFunction)vkUpdateDescriptorSets; - if (!strcmp(funcName, "vkCreateFramebuffer")) - return (PFN_vkVoidFunction)vkCreateFramebuffer; - if (!strcmp(funcName, "vkDestroyFramebuffer")) - return (PFN_vkVoidFunction)vkDestroyFramebuffer; - if (!strcmp(funcName, "vkCreateRenderPass")) - return (PFN_vkVoidFunction)vkCreateRenderPass; - if (!strcmp(funcName, "vkDestroyRenderPass")) - return (PFN_vkVoidFunction)vkDestroyRenderPass; - if (!strcmp(funcName, "vkGetRenderAreaGranularity")) - return (PFN_vkVoidFunction)vkGetRenderAreaGranularity; - if (!strcmp(funcName, "vkCreateCommandPool")) - return (PFN_vkVoidFunction)vkCreateCommandPool; - if (!strcmp(funcName, "vkDestroyCommandPool")) - return (PFN_vkVoidFunction)vkDestroyCommandPool; - if (!strcmp(funcName, "vkResetCommandPool")) - return (PFN_vkVoidFunction)vkResetCommandPool; - if (!strcmp(funcName, "vkAllocateCommandBuffers")) - return (PFN_vkVoidFunction)vkAllocateCommandBuffers; - if (!strcmp(funcName, "vkFreeCommandBuffers")) - return (PFN_vkVoidFunction)vkFreeCommandBuffers; - if (!strcmp(funcName, "vkBeginCommandBuffer")) - return (PFN_vkVoidFunction)vkBeginCommandBuffer; - if (!strcmp(funcName, "vkEndCommandBuffer")) - return (PFN_vkVoidFunction)vkEndCommandBuffer; - if (!strcmp(funcName, "vkResetCommandBuffer")) - return (PFN_vkVoidFunction)vkResetCommandBuffer; - if (!strcmp(funcName, "vkCmdBindPipeline")) - return (PFN_vkVoidFunction)vkCmdBindPipeline; - if (!strcmp(funcName, "vkCmdBindDescriptorSets")) - return (PFN_vkVoidFunction)vkCmdBindDescriptorSets; - if (!strcmp(funcName, "vkCmdBindVertexBuffers")) - return (PFN_vkVoidFunction)vkCmdBindVertexBuffers; - if (!strcmp(funcName, "vkCmdBindIndexBuffer")) - return (PFN_vkVoidFunction)vkCmdBindIndexBuffer; - if (!strcmp(funcName, "vkCmdSetViewport")) - return (PFN_vkVoidFunction)vkCmdSetViewport; - if (!strcmp(funcName, "vkCmdSetScissor")) - return (PFN_vkVoidFunction)vkCmdSetScissor; - if (!strcmp(funcName, "vkCmdSetLineWidth")) - return (PFN_vkVoidFunction)vkCmdSetLineWidth; - if (!strcmp(funcName, "vkCmdSetDepthBias")) - return (PFN_vkVoidFunction)vkCmdSetDepthBias; - if (!strcmp(funcName, "vkCmdSetBlendConstants")) - return (PFN_vkVoidFunction)vkCmdSetBlendConstants; - if (!strcmp(funcName, "vkCmdSetDepthBounds")) - return (PFN_vkVoidFunction)vkCmdSetDepthBounds; - if (!strcmp(funcName, "vkCmdSetStencilCompareMask")) - return (PFN_vkVoidFunction)vkCmdSetStencilCompareMask; - if (!strcmp(funcName, "vkCmdSetStencilWriteMask")) - return (PFN_vkVoidFunction)vkCmdSetStencilWriteMask; - if (!strcmp(funcName, "vkCmdSetStencilReference")) - return (PFN_vkVoidFunction)vkCmdSetStencilReference; - if (!strcmp(funcName, "vkCmdDraw")) - return (PFN_vkVoidFunction)vkCmdDraw; - if (!strcmp(funcName, "vkCmdDrawIndexed")) - return (PFN_vkVoidFunction)vkCmdDrawIndexed; - if (!strcmp(funcName, "vkCmdDrawIndirect")) - return (PFN_vkVoidFunction)vkCmdDrawIndirect; - if (!strcmp(funcName, "vkCmdDrawIndexedIndirect")) - return (PFN_vkVoidFunction)vkCmdDrawIndexedIndirect; - if (!strcmp(funcName, "vkCmdDispatch")) - return (PFN_vkVoidFunction)vkCmdDispatch; - if (!strcmp(funcName, "vkCmdDispatchIndirect")) - return (PFN_vkVoidFunction)vkCmdDispatchIndirect; - if (!strcmp(funcName, "vkCmdCopyBuffer")) - return (PFN_vkVoidFunction)vkCmdCopyBuffer; - if (!strcmp(funcName, "vkCmdCopyImage")) - return (PFN_vkVoidFunction)vkCmdCopyImage; - if (!strcmp(funcName, "vkCmdBlitImage")) - return (PFN_vkVoidFunction)vkCmdBlitImage; - if (!strcmp(funcName, "vkCmdCopyBufferToImage")) - return (PFN_vkVoidFunction)vkCmdCopyBufferToImage; - if (!strcmp(funcName, "vkCmdCopyImageToBuffer")) - return (PFN_vkVoidFunction)vkCmdCopyImageToBuffer; - if (!strcmp(funcName, "vkCmdUpdateBuffer")) - return (PFN_vkVoidFunction)vkCmdUpdateBuffer; - if (!strcmp(funcName, "vkCmdFillBuffer")) - return (PFN_vkVoidFunction)vkCmdFillBuffer; - if (!strcmp(funcName, "vkCmdClearColorImage")) - return (PFN_vkVoidFunction)vkCmdClearColorImage; - if (!strcmp(funcName, "vkCmdClearDepthStencilImage")) - return (PFN_vkVoidFunction)vkCmdClearDepthStencilImage; - if (!strcmp(funcName, "vkCmdClearAttachments")) - return (PFN_vkVoidFunction)vkCmdClearAttachments; - if (!strcmp(funcName, "vkCmdResolveImage")) - return (PFN_vkVoidFunction)vkCmdResolveImage; - if (!strcmp(funcName, "vkCmdSetEvent")) - return (PFN_vkVoidFunction)vkCmdSetEvent; - if (!strcmp(funcName, "vkCmdResetEvent")) - return (PFN_vkVoidFunction)vkCmdResetEvent; - if (!strcmp(funcName, "vkCmdWaitEvents")) - return (PFN_vkVoidFunction)vkCmdWaitEvents; - if (!strcmp(funcName, "vkCmdPipelineBarrier")) - return (PFN_vkVoidFunction)vkCmdPipelineBarrier; - if (!strcmp(funcName, "vkCmdBeginQuery")) - return (PFN_vkVoidFunction)vkCmdBeginQuery; - if (!strcmp(funcName, "vkCmdEndQuery")) - return (PFN_vkVoidFunction)vkCmdEndQuery; - if (!strcmp(funcName, "vkCmdResetQueryPool")) - return (PFN_vkVoidFunction)vkCmdResetQueryPool; - if (!strcmp(funcName, "vkCmdWriteTimestamp")) - return (PFN_vkVoidFunction)vkCmdWriteTimestamp; - if (!strcmp(funcName, "vkCmdCopyQueryPoolResults")) - return (PFN_vkVoidFunction)vkCmdCopyQueryPoolResults; - if (!strcmp(funcName, "vkCmdPushConstants")) - return (PFN_vkVoidFunction)vkCmdPushConstants; - if (!strcmp(funcName, "vkCmdBeginRenderPass")) - return (PFN_vkVoidFunction)vkCmdBeginRenderPass; - if (!strcmp(funcName, "vkCmdNextSubpass")) - return (PFN_vkVoidFunction)vkCmdNextSubpass; - if (!strcmp(funcName, "vkCmdEndRenderPass")) - return (PFN_vkVoidFunction)vkCmdEndRenderPass; - if (!strcmp(funcName, "vkCmdExecuteCommands")) - return (PFN_vkVoidFunction)vkCmdExecuteCommands; + if (!strcmp(funcName, "vkGetPhysicalDeviceMemoryProperties")) return (PFN_vkVoidFunction)vkGetPhysicalDeviceMemoryProperties; + if (!strcmp(funcName, "vkEnumerateDeviceLayerProperties")) return (PFN_vkVoidFunction)vkEnumerateDeviceLayerProperties; + if (!strcmp(funcName, "vkEnumerateDeviceExtensionProperties")) return (PFN_vkVoidFunction)vkEnumerateDeviceExtensionProperties; + if (!strcmp(funcName, "vkCreateDevice")) return (PFN_vkVoidFunction)vkCreateDevice; + if (!strcmp(funcName, "vkGetDeviceProcAddr")) return (PFN_vkVoidFunction)vkGetDeviceProcAddr; + if (!strcmp(funcName, "vkDestroyDevice")) return (PFN_vkVoidFunction)vkDestroyDevice; + if (!strcmp(funcName, "vkGetDeviceQueue")) return (PFN_vkVoidFunction)vkGetDeviceQueue; + if (!strcmp(funcName, "vkQueueSubmit")) return (PFN_vkVoidFunction)vkQueueSubmit; + if (!strcmp(funcName, "vkQueueWaitIdle")) return (PFN_vkVoidFunction)vkQueueWaitIdle; + if (!strcmp(funcName, "vkDeviceWaitIdle")) return (PFN_vkVoidFunction)vkDeviceWaitIdle; + if (!strcmp(funcName, "vkAllocateMemory")) return (PFN_vkVoidFunction)vkAllocateMemory; + if (!strcmp(funcName, "vkFreeMemory")) return (PFN_vkVoidFunction)vkFreeMemory; + if (!strcmp(funcName, "vkMapMemory")) return (PFN_vkVoidFunction)vkMapMemory; + if (!strcmp(funcName, "vkUnmapMemory")) return (PFN_vkVoidFunction)vkUnmapMemory; + if (!strcmp(funcName, "vkFlushMappedMemoryRanges")) return (PFN_vkVoidFunction)vkFlushMappedMemoryRanges; + if (!strcmp(funcName, "vkInvalidateMappedMemoryRanges")) return (PFN_vkVoidFunction)vkInvalidateMappedMemoryRanges; + if (!strcmp(funcName, "vkGetDeviceMemoryCommitment")) return (PFN_vkVoidFunction)vkGetDeviceMemoryCommitment; + if (!strcmp(funcName, "vkGetImageSparseMemoryRequirements")) return (PFN_vkVoidFunction)vkGetImageSparseMemoryRequirements; + if (!strcmp(funcName, "vkGetImageMemoryRequirements")) return (PFN_vkVoidFunction)vkGetImageMemoryRequirements; + if (!strcmp(funcName, "vkGetBufferMemoryRequirements")) return (PFN_vkVoidFunction)vkGetBufferMemoryRequirements; + if (!strcmp(funcName, "vkBindImageMemory")) return (PFN_vkVoidFunction)vkBindImageMemory; + if (!strcmp(funcName, "vkBindBufferMemory")) return (PFN_vkVoidFunction)vkBindBufferMemory; + if (!strcmp(funcName, "vkQueueBindSparse")) return (PFN_vkVoidFunction)vkQueueBindSparse; + if (!strcmp(funcName, "vkCreateFence")) return (PFN_vkVoidFunction)vkCreateFence; + if (!strcmp(funcName, "vkDestroyFence")) return (PFN_vkVoidFunction)vkDestroyFence; + if (!strcmp(funcName, "vkGetFenceStatus")) return (PFN_vkVoidFunction)vkGetFenceStatus; + if (!strcmp(funcName, "vkResetFences")) return (PFN_vkVoidFunction)vkResetFences; + if (!strcmp(funcName, "vkWaitForFences")) return (PFN_vkVoidFunction)vkWaitForFences; + if (!strcmp(funcName, "vkCreateSemaphore")) return (PFN_vkVoidFunction)vkCreateSemaphore; + if (!strcmp(funcName, "vkDestroySemaphore")) return (PFN_vkVoidFunction)vkDestroySemaphore; + if (!strcmp(funcName, "vkCreateEvent")) return (PFN_vkVoidFunction)vkCreateEvent; + if (!strcmp(funcName, "vkDestroyEvent")) return (PFN_vkVoidFunction)vkDestroyEvent; + if (!strcmp(funcName, "vkGetEventStatus")) return (PFN_vkVoidFunction)vkGetEventStatus; + if (!strcmp(funcName, "vkSetEvent")) return (PFN_vkVoidFunction)vkSetEvent; + if (!strcmp(funcName, "vkResetEvent")) return (PFN_vkVoidFunction)vkResetEvent; + if (!strcmp(funcName, "vkCreateQueryPool")) return (PFN_vkVoidFunction)vkCreateQueryPool; + if (!strcmp(funcName, "vkDestroyQueryPool")) return (PFN_vkVoidFunction)vkDestroyQueryPool; + if (!strcmp(funcName, "vkGetQueryPoolResults")) return (PFN_vkVoidFunction)vkGetQueryPoolResults; + if (!strcmp(funcName, "vkCreateBuffer")) return (PFN_vkVoidFunction)vkCreateBuffer; + if (!strcmp(funcName, "vkDestroyBuffer")) return (PFN_vkVoidFunction)vkDestroyBuffer; + if (!strcmp(funcName, "vkCreateBufferView")) return (PFN_vkVoidFunction)vkCreateBufferView; + if (!strcmp(funcName, "vkDestroyBufferView")) return (PFN_vkVoidFunction)vkDestroyBufferView; + if (!strcmp(funcName, "vkCreateImage")) return (PFN_vkVoidFunction)vkCreateImage; + if (!strcmp(funcName, "vkDestroyImage")) return (PFN_vkVoidFunction)vkDestroyImage; + if (!strcmp(funcName, "vkGetImageSubresourceLayout")) return (PFN_vkVoidFunction)vkGetImageSubresourceLayout; + if (!strcmp(funcName, "vkCreateImageView")) return (PFN_vkVoidFunction)vkCreateImageView; + if (!strcmp(funcName, "vkDestroyImageView")) return (PFN_vkVoidFunction)vkDestroyImageView; + if (!strcmp(funcName, "vkCreateShaderModule")) return (PFN_vkVoidFunction)vkCreateShaderModule; + if (!strcmp(funcName, "vkDestroyShaderModule")) return (PFN_vkVoidFunction)vkDestroyShaderModule; + if (!strcmp(funcName, "vkCreatePipelineCache")) return (PFN_vkVoidFunction)vkCreatePipelineCache; + if (!strcmp(funcName, "vkDestroyPipelineCache")) return (PFN_vkVoidFunction)vkDestroyPipelineCache; + if (!strcmp(funcName, "vkGetPipelineCacheData")) return (PFN_vkVoidFunction)vkGetPipelineCacheData; + if (!strcmp(funcName, "vkMergePipelineCaches")) return (PFN_vkVoidFunction)vkMergePipelineCaches; + if (!strcmp(funcName, "vkCreateGraphicsPipelines")) return (PFN_vkVoidFunction)vkCreateGraphicsPipelines; + if (!strcmp(funcName, "vkCreateComputePipelines")) return (PFN_vkVoidFunction)vkCreateComputePipelines; + if (!strcmp(funcName, "vkDestroyPipeline")) return (PFN_vkVoidFunction)vkDestroyPipeline; + if (!strcmp(funcName, "vkCreatePipelineLayout")) return (PFN_vkVoidFunction)vkCreatePipelineLayout; + if (!strcmp(funcName, "vkDestroyPipelineLayout")) return (PFN_vkVoidFunction)vkDestroyPipelineLayout; + if (!strcmp(funcName, "vkCreateSampler")) return (PFN_vkVoidFunction)vkCreateSampler; + if (!strcmp(funcName, "vkDestroySampler")) return (PFN_vkVoidFunction)vkDestroySampler; + if (!strcmp(funcName, "vkCreateDescriptorSetLayout")) return (PFN_vkVoidFunction)vkCreateDescriptorSetLayout; + if (!strcmp(funcName, "vkDestroyDescriptorSetLayout")) return (PFN_vkVoidFunction)vkDestroyDescriptorSetLayout; + if (!strcmp(funcName, "vkCreateDescriptorPool")) return (PFN_vkVoidFunction)vkCreateDescriptorPool; + if (!strcmp(funcName, "vkDestroyDescriptorPool")) return (PFN_vkVoidFunction)vkDestroyDescriptorPool; + if (!strcmp(funcName, "vkResetDescriptorPool")) return (PFN_vkVoidFunction)vkResetDescriptorPool; + if (!strcmp(funcName, "vkAllocateDescriptorSets")) return (PFN_vkVoidFunction)vkAllocateDescriptorSets; + if (!strcmp(funcName, "vkFreeDescriptorSets")) return (PFN_vkVoidFunction)vkFreeDescriptorSets; + if (!strcmp(funcName, "vkUpdateDescriptorSets")) return (PFN_vkVoidFunction)vkUpdateDescriptorSets; + if (!strcmp(funcName, "vkCreateFramebuffer")) return (PFN_vkVoidFunction)vkCreateFramebuffer; + if (!strcmp(funcName, "vkDestroyFramebuffer")) return (PFN_vkVoidFunction)vkDestroyFramebuffer; + if (!strcmp(funcName, "vkCreateRenderPass")) return (PFN_vkVoidFunction)vkCreateRenderPass; + if (!strcmp(funcName, "vkDestroyRenderPass")) return (PFN_vkVoidFunction)vkDestroyRenderPass; + if (!strcmp(funcName, "vkGetRenderAreaGranularity")) return (PFN_vkVoidFunction)vkGetRenderAreaGranularity; + if (!strcmp(funcName, "vkCreateCommandPool")) return (PFN_vkVoidFunction)vkCreateCommandPool; + if (!strcmp(funcName, "vkDestroyCommandPool")) return (PFN_vkVoidFunction)vkDestroyCommandPool; + if (!strcmp(funcName, "vkResetCommandPool")) return (PFN_vkVoidFunction)vkResetCommandPool; + if (!strcmp(funcName, "vkAllocateCommandBuffers")) return (PFN_vkVoidFunction)vkAllocateCommandBuffers; + if (!strcmp(funcName, "vkFreeCommandBuffers")) return (PFN_vkVoidFunction)vkFreeCommandBuffers; + if (!strcmp(funcName, "vkBeginCommandBuffer")) return (PFN_vkVoidFunction)vkBeginCommandBuffer; + if (!strcmp(funcName, "vkEndCommandBuffer")) return (PFN_vkVoidFunction)vkEndCommandBuffer; + if (!strcmp(funcName, "vkResetCommandBuffer")) return (PFN_vkVoidFunction)vkResetCommandBuffer; + if (!strcmp(funcName, "vkCmdBindPipeline")) return (PFN_vkVoidFunction)vkCmdBindPipeline; + if (!strcmp(funcName, "vkCmdBindDescriptorSets")) return (PFN_vkVoidFunction)vkCmdBindDescriptorSets; + if (!strcmp(funcName, "vkCmdBindVertexBuffers")) return (PFN_vkVoidFunction)vkCmdBindVertexBuffers; + if (!strcmp(funcName, "vkCmdBindIndexBuffer")) return (PFN_vkVoidFunction)vkCmdBindIndexBuffer; + if (!strcmp(funcName, "vkCmdSetViewport")) return (PFN_vkVoidFunction)vkCmdSetViewport; + if (!strcmp(funcName, "vkCmdSetScissor")) return (PFN_vkVoidFunction)vkCmdSetScissor; + if (!strcmp(funcName, "vkCmdSetLineWidth")) return (PFN_vkVoidFunction)vkCmdSetLineWidth; + if (!strcmp(funcName, "vkCmdSetDepthBias")) return (PFN_vkVoidFunction)vkCmdSetDepthBias; + if (!strcmp(funcName, "vkCmdSetBlendConstants")) return (PFN_vkVoidFunction)vkCmdSetBlendConstants; + if (!strcmp(funcName, "vkCmdSetDepthBounds")) return (PFN_vkVoidFunction)vkCmdSetDepthBounds; + if (!strcmp(funcName, "vkCmdSetStencilCompareMask")) return (PFN_vkVoidFunction)vkCmdSetStencilCompareMask; + if (!strcmp(funcName, "vkCmdSetStencilWriteMask")) return (PFN_vkVoidFunction)vkCmdSetStencilWriteMask; + if (!strcmp(funcName, "vkCmdSetStencilReference")) return (PFN_vkVoidFunction)vkCmdSetStencilReference; + if (!strcmp(funcName, "vkCmdDraw")) return (PFN_vkVoidFunction)vkCmdDraw; + if (!strcmp(funcName, "vkCmdDrawIndexed")) return (PFN_vkVoidFunction)vkCmdDrawIndexed; + if (!strcmp(funcName, "vkCmdDrawIndirect")) return (PFN_vkVoidFunction)vkCmdDrawIndirect; + if (!strcmp(funcName, "vkCmdDrawIndexedIndirect")) return (PFN_vkVoidFunction)vkCmdDrawIndexedIndirect; + if (!strcmp(funcName, "vkCmdDispatch")) return (PFN_vkVoidFunction)vkCmdDispatch; + if (!strcmp(funcName, "vkCmdDispatchIndirect")) return (PFN_vkVoidFunction)vkCmdDispatchIndirect; + if (!strcmp(funcName, "vkCmdCopyBuffer")) return (PFN_vkVoidFunction)vkCmdCopyBuffer; + if (!strcmp(funcName, "vkCmdCopyImage")) return (PFN_vkVoidFunction)vkCmdCopyImage; + if (!strcmp(funcName, "vkCmdBlitImage")) return (PFN_vkVoidFunction)vkCmdBlitImage; + if (!strcmp(funcName, "vkCmdCopyBufferToImage")) return (PFN_vkVoidFunction)vkCmdCopyBufferToImage; + if (!strcmp(funcName, "vkCmdCopyImageToBuffer")) return (PFN_vkVoidFunction)vkCmdCopyImageToBuffer; + if (!strcmp(funcName, "vkCmdUpdateBuffer")) return (PFN_vkVoidFunction)vkCmdUpdateBuffer; + if (!strcmp(funcName, "vkCmdFillBuffer")) return (PFN_vkVoidFunction)vkCmdFillBuffer; + if (!strcmp(funcName, "vkCmdClearColorImage")) return (PFN_vkVoidFunction)vkCmdClearColorImage; + if (!strcmp(funcName, "vkCmdClearDepthStencilImage")) return (PFN_vkVoidFunction)vkCmdClearDepthStencilImage; + if (!strcmp(funcName, "vkCmdClearAttachments")) return (PFN_vkVoidFunction)vkCmdClearAttachments; + if (!strcmp(funcName, "vkCmdResolveImage")) return (PFN_vkVoidFunction)vkCmdResolveImage; + if (!strcmp(funcName, "vkCmdSetEvent")) return (PFN_vkVoidFunction)vkCmdSetEvent; + if (!strcmp(funcName, "vkCmdResetEvent")) return (PFN_vkVoidFunction)vkCmdResetEvent; + if (!strcmp(funcName, "vkCmdWaitEvents")) return (PFN_vkVoidFunction)vkCmdWaitEvents; + if (!strcmp(funcName, "vkCmdPipelineBarrier")) return (PFN_vkVoidFunction)vkCmdPipelineBarrier; + if (!strcmp(funcName, "vkCmdBeginQuery")) return (PFN_vkVoidFunction)vkCmdBeginQuery; + if (!strcmp(funcName, "vkCmdEndQuery")) return (PFN_vkVoidFunction)vkCmdEndQuery; + if (!strcmp(funcName, "vkCmdResetQueryPool")) return (PFN_vkVoidFunction)vkCmdResetQueryPool; + if (!strcmp(funcName, "vkCmdWriteTimestamp")) return (PFN_vkVoidFunction)vkCmdWriteTimestamp; + if (!strcmp(funcName, "vkCmdCopyQueryPoolResults")) return (PFN_vkVoidFunction)vkCmdCopyQueryPoolResults; + if (!strcmp(funcName, "vkCmdPushConstants")) return (PFN_vkVoidFunction)vkCmdPushConstants; + if (!strcmp(funcName, "vkCmdBeginRenderPass")) return (PFN_vkVoidFunction)vkCmdBeginRenderPass; + if (!strcmp(funcName, "vkCmdNextSubpass")) return (PFN_vkVoidFunction)vkCmdNextSubpass; + if (!strcmp(funcName, "vkCmdEndRenderPass")) return (PFN_vkVoidFunction)vkCmdEndRenderPass; + if (!strcmp(funcName, "vkCmdExecuteCommands")) return (PFN_vkVoidFunction)vkCmdExecuteCommands; // Instance extensions void *addr; - if (debug_report_instance_gpa(inst, funcName, &addr)) - return addr; + if (debug_report_instance_gpa(inst, funcName, &addr)) return addr; - if (wsi_swapchain_instance_gpa(inst, funcName, &addr)) - return addr; + if (wsi_swapchain_instance_gpa(inst, funcName, &addr)) return addr; - if (extension_instance_gpa(inst, funcName, &addr)) - return addr; + if (extension_instance_gpa(inst, funcName, &addr)) return addr; // Unknown physical device extensions - if (loader_phys_dev_ext_gpa(inst, funcName, true, &addr, NULL)) - return addr; + if (loader_phys_dev_ext_gpa(inst, funcName, true, &addr, NULL)) return addr; // Unknown device extensions addr = loader_dev_ext_gpa(inst, funcName); @@ -316,34 +181,25 @@ static inline void *trampolineGetProcAddr(struct loader_instance *inst, const ch } static inline void *globalGetProcAddr(const char *name) { - if (!name || name[0] != 'v' || name[1] != 'k') - return NULL; + if (!name || name[0] != 'v' || name[1] != 'k') return NULL; name += 2; - if (!strcmp(name, "CreateInstance")) - return (void *)vkCreateInstance; - if (!strcmp(name, "EnumerateInstanceExtensionProperties")) - return (void *)vkEnumerateInstanceExtensionProperties; - if (!strcmp(name, "EnumerateInstanceLayerProperties")) - return (void *)vkEnumerateInstanceLayerProperties; + if (!strcmp(name, "CreateInstance")) return (void *)vkCreateInstance; + if (!strcmp(name, "EnumerateInstanceExtensionProperties")) return (void *)vkEnumerateInstanceExtensionProperties; + if (!strcmp(name, "EnumerateInstanceLayerProperties")) return (void *)vkEnumerateInstanceLayerProperties; return NULL; } static inline void *loader_non_passthrough_gdpa(const char *name) { - if (!name || name[0] != 'v' || name[1] != 'k') - return NULL; + if (!name || name[0] != 'v' || name[1] != 'k') return NULL; name += 2; - if (!strcmp(name, "GetDeviceProcAddr")) - return (void *)vkGetDeviceProcAddr; - if (!strcmp(name, "DestroyDevice")) - return (void *)vkDestroyDevice; - if (!strcmp(name, "GetDeviceQueue")) - return (void *)vkGetDeviceQueue; - if (!strcmp(name, "AllocateCommandBuffers")) - return (void *)vkAllocateCommandBuffers; + if (!strcmp(name, "GetDeviceProcAddr")) return (void *)vkGetDeviceProcAddr; + if (!strcmp(name, "DestroyDevice")) return (void *)vkDestroyDevice; + if (!strcmp(name, "GetDeviceQueue")) return (void *)vkGetDeviceQueue; + if (!strcmp(name, "AllocateCommandBuffers")) return (void *)vkAllocateCommandBuffers; return NULL; } diff --git a/loader/loader.c b/loader/loader.c index b002d43d..9c435251 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -34,9 +34,9 @@ #include <sys/types.h> #if defined(_WIN32) #include "dirent_on_windows.h" -#else // _WIN32 +#else // _WIN32 #include <dirent.h> -#endif // _WIN32 +#endif // _WIN32 #include "vk_loader_platform.h" #include "loader.h" #include "gpa_helper.h" @@ -346,8 +346,7 @@ static inline char *loader_getenv(const char *name, const struct loader_instance // valSize DOES include the null terminator, so for any set variable // will always be at least 1. If it's 0, the variable wasn't set. - if (valSize == 0) - return NULL; + if (valSize == 0) return NULL; // Allocate the space necessary for the registry entry if (NULL != inst && NULL != inst->alloc_callbacks.pfnAllocation) { @@ -465,11 +464,11 @@ void loader_log(const struct loader_instance *inst, VkFlags msg_type, int32_t ms } VKAPI_ATTR VkResult VKAPI_CALL vkSetInstanceDispatch(VkInstance instance, void *object) { - struct loader_instance *inst = loader_get_instance(instance); if (!inst) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkSetInstanceDispatch: Can not retrieve Instance " - "dispatch table."); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "vkSetInstanceDispatch: Can not retrieve Instance " + "dispatch table."); return VK_ERROR_INITIALIZATION_FAILED; } loader_set_dispatch(object, inst->disp); @@ -539,8 +538,9 @@ VkResult loaderGetRegistryFiles(const struct loader_instance *inst, char *locati if (NULL == *reg_data) { *reg_data = loader_instance_heap_alloc(inst, total_size, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == *reg_data) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loaderGetRegistryFiles: Failed to allocate " - "space for registry data for key %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loaderGetRegistryFiles: Failed to allocate " + "space for registry data for key %s", name); result = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -550,8 +550,9 @@ VkResult loaderGetRegistryFiles(const struct loader_instance *inst, char *locati *reg_data = loader_instance_heap_realloc(inst, *reg_data, total_size, total_size * 2, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == *reg_data) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loaderGetRegistryFiles: Failed to reallocate " - "space for registry value of size %d for key %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loaderGetRegistryFiles: Failed to reallocate " + "space for registry value of size %d for key %s", total_size * 2, name); result = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -579,7 +580,7 @@ out: return result; } -#endif // WIN32 +#endif // WIN32 /** * Combine path elements, separating each element with the platform-specific @@ -667,8 +668,7 @@ bool compare_vk_extension_properties(const VkExtensionProperties *op1, const VkE bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop, const uint32_t count, const VkExtensionProperties *ext_array) { for (uint32_t i = 0; i < count; i++) { - if (compare_vk_extension_properties(vk_ext_prop, &ext_array[i])) - return true; + if (compare_vk_extension_properties(vk_ext_prop, &ext_array[i])) return true; } return false; } @@ -679,8 +679,7 @@ bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop, c */ bool has_vk_extension_property(const VkExtensionProperties *vk_ext_prop, const struct loader_extension_list *ext_list) { for (uint32_t i = 0; i < ext_list->count; i++) { - if (compare_vk_extension_properties(&ext_list->list[i], vk_ext_prop)) - return true; + if (compare_vk_extension_properties(&ext_list->list[i], vk_ext_prop)) return true; } return false; } @@ -690,8 +689,7 @@ bool has_vk_extension_property(const VkExtensionProperties *vk_ext_prop, const s */ bool has_vk_dev_ext_property(const VkExtensionProperties *ext_prop, const struct loader_device_extension_list *ext_list) { for (uint32_t i = 0; i < ext_list->count; i++) { - if (compare_vk_extension_properties(&ext_list->list[i].props, ext_prop)) - return true; + if (compare_vk_extension_properties(&ext_list->list[i].props, ext_prop)) return true; } return false; } @@ -702,8 +700,7 @@ bool has_vk_dev_ext_property(const VkExtensionProperties *ext_prop, const struct static struct loader_layer_properties *loader_get_layer_property(const char *name, const struct loader_layer_list *layer_list) { for (uint32_t i = 0; i < layer_list->count; i++) { const VkLayerProperties *item = &layer_list->list[i].info; - if (strcmp(name, item->layerName) == 0) - return &layer_list->list[i]; + if (strcmp(name, item->layerName) == 0) return &layer_list->list[i]; } return NULL; } @@ -717,8 +714,9 @@ static struct loader_layer_properties *loader_get_next_layer_property(const stru layer_list->list = loader_instance_heap_alloc(inst, sizeof(struct loader_layer_properties) * 64, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (layer_list->list == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_next_layer_property: Out of memory can " - "not add any layer properties to list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_get_next_layer_property: Out of memory can " + "not add any layer properties to list"); return NULL; } memset(layer_list->list, 0, sizeof(struct loader_layer_properties) * 64); @@ -730,8 +728,9 @@ static struct loader_layer_properties *loader_get_next_layer_property(const stru layer_list->list = loader_instance_heap_realloc(inst, layer_list->list, layer_list->capacity, layer_list->capacity * 2, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (layer_list->list == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_next_layer_property: realloc failed for " - "layer list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_get_next_layer_property: realloc failed for " + "layer list"); return NULL; } layer_list->capacity *= 2; @@ -747,8 +746,7 @@ static struct loader_layer_properties *loader_get_next_layer_property(const stru void loader_delete_layer_properties(const struct loader_instance *inst, struct loader_layer_list *layer_list) { uint32_t i, j; struct loader_device_extension_list *dev_ext_list; - if (!layer_list) - return; + if (!layer_list) return; for (i = 0; i < layer_list->count; i++) { loader_destroy_generic_list(inst, (struct loader_generic_list *)&layer_list->list[i].instance_extension_list); @@ -783,8 +781,9 @@ static VkResult loader_add_instance_extensions(const struct loader_instance *ins res = fp_get_props(NULL, &count, NULL); if (res != VK_SUCCESS) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_instance_extensions: Error getting Instance " - "extension count from %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_instance_extensions: Error getting Instance " + "extension count from %s", lib_name); goto out; } @@ -802,8 +801,9 @@ static VkResult loader_add_instance_extensions(const struct loader_instance *ins res = fp_get_props(NULL, &count, ext_props); if (res != VK_SUCCESS) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_instance_extensions: Error getting Instance " - "extensions from %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_instance_extensions: Error getting Instance " + "extensions from %s", lib_name); goto out; } @@ -820,8 +820,9 @@ static VkResult loader_add_instance_extensions(const struct loader_instance *ins res = loader_add_to_ext_list(inst, ext_list, 1, &ext_props[i]); if (res != VK_SUCCESS) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_instance_extensions: Failed to add %s " - "to Instance extension list", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_instance_extensions: Failed to add %s " + "to Instance extension list", lib_name); goto out; } @@ -855,8 +856,7 @@ static VkResult loader_init_device_extensions(const struct loader_instance *inst loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Device Extension: %s (%s) version %s", ext_props[i].extensionName, phys_dev_term->this_icd_term->scanned_icd->lib_name, spec_version); res = loader_add_to_ext_list(inst, ext_list, 1, &ext_props[i]); - if (res != VK_SUCCESS) - return res; + if (res != VK_SUCCESS) return res; } return VK_SUCCESS; @@ -874,8 +874,9 @@ VkResult loader_add_device_extensions(const struct loader_instance *inst, if (res == VK_SUCCESS && count > 0) { ext_props = loader_stack_alloc(count * sizeof(VkExtensionProperties)); if (!ext_props) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_device_extensions: Failed to allocate space" - " for device extension properties."); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_device_extensions: Failed to allocate space" + " for device extension properties."); return VK_ERROR_OUT_OF_HOST_MEMORY; } res = fpEnumerateDeviceExtensionProperties(physical_device, NULL, &count, ext_props); @@ -895,8 +896,9 @@ VkResult loader_add_device_extensions(const struct loader_instance *inst, } } } else { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_device_extensions: Error getting physical " - "device extension info count from library %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_device_extensions: Error getting physical " + "device extension info count from library %s", lib_name); return res; } @@ -910,8 +912,9 @@ VkResult loader_init_generic_list(const struct loader_instance *inst, struct loa list_info->capacity = 0; list_info->list = loader_instance_heap_alloc(inst, capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (list_info->list == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_init_generic_list: Failed to allocate space " - "for generic list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_init_generic_list: Failed to allocate space " + "for generic list"); return VK_ERROR_OUT_OF_HOST_MEMORY; } memset(list_info->list, 0, capacity); @@ -954,13 +957,13 @@ VkResult loader_add_to_ext_list(const struct loader_instance *inst, struct loade // add to list at end // check for enough capacity if (ext_list->count * sizeof(VkExtensionProperties) >= ext_list->capacity) { - ext_list->list = loader_instance_heap_realloc(inst, ext_list->list, ext_list->capacity, ext_list->capacity * 2, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (ext_list->list == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_to_ext_list: Failed to reallocate " - "space for extension list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_to_ext_list: Failed to reallocate " + "space for extension list"); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -999,13 +1002,13 @@ VkResult loader_add_to_dev_ext_list(const struct loader_instance *inst, struct l // add to list at end // check for enough capacity if (idx * sizeof(struct loader_dev_ext_props) >= ext_list->capacity) { - ext_list->list = loader_instance_heap_realloc(inst, ext_list->list, ext_list->capacity, ext_list->capacity * 2, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (ext_list->list == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_to_dev_ext_list: Failed to reallocate " - "space for device extension list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_to_dev_ext_list: Failed to reallocate " + "space for device extension list"); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -1018,8 +1021,9 @@ VkResult loader_add_to_dev_ext_list(const struct loader_instance *inst, struct l ext_list->list[idx].entrypoints = loader_instance_heap_alloc(inst, sizeof(char *) * entry_count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (ext_list->list[idx].entrypoints == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_to_dev_ext_list: Failed to allocate space " - "for device extension entrypoint list in list %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_to_dev_ext_list: Failed to allocate space " + "for device extension entrypoint list in list %d", idx); ext_list->list[idx].entrypoint_count = 0; return VK_ERROR_OUT_OF_HOST_MEMORY; @@ -1034,8 +1038,9 @@ VkResult loader_add_to_dev_ext_list(const struct loader_instance *inst, struct l loader_instance_heap_free(inst, ext_list->list[idx].entrypoints); ext_list->list[idx].entrypoint_count = 0; ext_list->list[idx].entrypoints = NULL; - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_to_dev_ext_list: Failed to allocate space " - "for device extension entrypoint %d name", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_to_dev_ext_list: Failed to allocate space " + "for device extension entrypoint %d name", i); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -1061,8 +1066,9 @@ static VkResult loader_add_layer_names_to_list(const struct loader_instance *ins const char *search_target = names[i]; layer_prop = loader_get_layer_property(search_target, search_list); if (!layer_prop) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_layer_names_to_list: Unable to find layer" - " %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_layer_names_to_list: Unable to find layer" + " %s", search_target); err = VK_ERROR_LAYER_NOT_PRESENT; continue; @@ -1105,8 +1111,7 @@ void loader_destroy_layer_list(const struct loader_instance *inst, struct loader */ bool has_vk_layer_property(const VkLayerProperties *vk_layer_prop, const struct loader_layer_list *list) { for (uint32_t i = 0; i < list->count; i++) { - if (strcmp(vk_layer_prop->layerName, list->list[i].info.layerName) == 0) - return true; + if (strcmp(vk_layer_prop->layerName, list->list[i].info.layerName) == 0) return true; } return false; } @@ -1117,8 +1122,7 @@ bool has_vk_layer_property(const VkLayerProperties *vk_layer_prop, const struct */ bool has_layer_name(const char *name, const struct loader_layer_list *list) { for (uint32_t i = 0; i < list->count; i++) { - if (strcmp(name, list->list[i].info.layerName) == 0) - return true; + if (strcmp(name, list->list[i].info.layerName) == 0) return true; } return false; } @@ -1136,8 +1140,7 @@ VkResult loader_add_to_layer_list(const struct loader_instance *inst, struct loa loader_init_layer_list(inst, list); } - if (list->list == NULL) - return VK_SUCCESS; + if (list->list == NULL) return VK_SUCCESS; for (i = 0; i < prop_list_count; i++) { layer = (struct loader_layer_properties *)&props[i]; @@ -1150,12 +1153,12 @@ VkResult loader_add_to_layer_list(const struct loader_instance *inst, struct loa // add to list at end // check for enough capacity if (list->count * sizeof(struct loader_layer_properties) >= list->capacity) { - list->list = loader_instance_heap_realloc(inst, list->list, list->capacity, list->capacity * 2, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == list->list) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_to_layer_list: Realloc failed for " - "when attempting to add new layer"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_to_layer_list: Realloc failed for " + "when attempting to add new layer"); return VK_ERROR_OUT_OF_HOST_MEMORY; } // double capacity @@ -1189,24 +1192,23 @@ void loader_find_layer_name_add_list(const struct loader_instance *inst, const c } } if (!found) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_find_layer_name_add_list: Failed to find layer name " - "%s to activate", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_find_layer_name_add_list: Failed to find layer name " + "%s to activate", name); } } static VkExtensionProperties *get_extension_property(const char *name, const struct loader_extension_list *list) { for (uint32_t i = 0; i < list->count; i++) { - if (strcmp(name, list->list[i].extensionName) == 0) - return &list->list[i]; + if (strcmp(name, list->list[i].extensionName) == 0) return &list->list[i]; } return NULL; } static VkExtensionProperties *get_dev_extension_property(const char *name, const struct loader_device_extension_list *list) { for (uint32_t i = 0; i < list->count; i++) { - if (strcmp(name, list->list[i].props.extensionName) == 0) - return &list->list[i].props; + if (strcmp(name, list->list[i].props.extensionName) == 0) return &list->list[i].props; } return NULL; } @@ -1249,7 +1251,6 @@ VkResult loader_get_icd_loader_instance_extensions(const struct loader_instance if (VK_SUCCESS == res) { // Remove any extensions not recognized by the loader for (int32_t j = 0; j < (int32_t)icd_exts.count; j++) { - // See if the extension is in the list of supported extensions bool found = false; for (uint32_t k = 0; LOADER_INSTANCE_EXTENSIONS[k] != NULL; k++) { @@ -1330,8 +1331,9 @@ struct loader_device *loader_create_logical_device(const struct loader_instance } if (!new_dev) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_create_logical_device: Failed to alloc struct " - "loader_device"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_create_logical_device: Failed to alloc struct " + "loader_device"); return NULL; } @@ -1352,8 +1354,7 @@ void loader_remove_logical_device(const struct loader_instance *inst, struct loa struct loader_device *found_dev, const VkAllocationCallbacks *pAllocator) { struct loader_device *dev, *prev_dev; - if (!icd_term || !found_dev) - return; + if (!icd_term || !found_dev) return; prev_dev = NULL; dev = icd_term->logical_device_list; @@ -1422,7 +1423,6 @@ static struct loader_icd_term *loader_icd_add(struct loader_instance *ptr_inst, * by the loader, false indicates the version is not supported */ bool loader_get_icd_interface_version(PFN_vkNegotiateLoaderICDInterfaceVersion fp_negotiate_icd_version, uint32_t *pVersion) { - if (fp_negotiate_icd_version == NULL) { // ICD does not support the negotiation API, it supports version 0 or 1 // calling code must determine if it is version 0 or 1 @@ -1451,8 +1451,7 @@ bool loader_get_icd_interface_version(PFN_vkNegotiateLoaderICDInterfaceVersion f } void loader_scanned_icd_clear(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list) { - if (icd_tramp_list->capacity == 0) - return; + if (icd_tramp_list->capacity == 0) return; for (uint32_t i = 0; i < icd_tramp_list->count; i++) { loader_platform_close_library(icd_tramp_list->scanned_list[i].handle); loader_instance_heap_free(inst, icd_tramp_list->scanned_list[i].lib_name); @@ -1469,8 +1468,9 @@ static VkResult loader_scanned_icd_init(const struct loader_instance *inst, stru icd_tramp_list->capacity = 8 * sizeof(struct loader_scanned_icd); icd_tramp_list->scanned_list = loader_instance_heap_alloc(inst, icd_tramp_list->capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == icd_tramp_list->scanned_list) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_init: Realloc failed for layer list when " - "attempting to add new layer"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_scanned_icd_init: Realloc failed for layer list when " + "attempting to add new layer"); err = VK_ERROR_OUT_OF_HOST_MEMORY; } return err; @@ -1500,8 +1500,9 @@ static VkResult loader_scanned_icd_add(const struct loader_instance *inst, struc fp_negotiate_icd_version = loader_platform_get_proc_address(handle, "vk_icdNegotiateLoaderICDInterfaceVersion"); if (!loader_get_icd_interface_version(fp_negotiate_icd_version, &interface_vers)) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: ICD %s doesn't support interface" - " version compatible with loader, skip this ICD.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_scanned_icd_add: ICD %s doesn't support interface" + " version compatible with loader, skip this ICD.", filename); goto out; } @@ -1512,30 +1513,34 @@ static VkResult loader_scanned_icd_add(const struct loader_instance *inst, struc // Use deprecated interface from version 0 fp_get_proc_addr = loader_platform_get_proc_address(handle, "vkGetInstanceProcAddr"); if (NULL == fp_get_proc_addr) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: Attempt to retreive either " - "\'vkGetInstanceProcAddr\' or " - "\'vk_icdGetInstanceProcAddr\' from ICD %s failed.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_scanned_icd_add: Attempt to retreive either " + "\'vkGetInstanceProcAddr\' or " + "\'vk_icdGetInstanceProcAddr\' from ICD %s failed.", filename); goto out; } else { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_scanned_icd_add: Using deprecated ICD " - "interface of \'vkGetInstanceProcAddr\' instead of " - "\'vk_icdGetInstanceProcAddr\' for ICD %s", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_scanned_icd_add: Using deprecated ICD " + "interface of \'vkGetInstanceProcAddr\' instead of " + "\'vk_icdGetInstanceProcAddr\' for ICD %s", filename); } fp_create_inst = loader_platform_get_proc_address(handle, "vkCreateInstance"); if (NULL == fp_create_inst) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: Failed querying " - "\'vkCreateInstance\' via dlsym/loadlibrary for " - "ICD %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_scanned_icd_add: Failed querying " + "\'vkCreateInstance\' via dlsym/loadlibrary for " + "ICD %s", filename); goto out; } fp_get_inst_ext_props = loader_platform_get_proc_address(handle, "vkEnumerateInstanceExtensionProperties"); if (NULL == fp_get_inst_ext_props) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: Could not get \'vkEnumerate" - "InstanceExtensionProperties\' via dlsym/loadlibrary " - "for ICD %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_scanned_icd_add: Could not get \'vkEnumerate" + "InstanceExtensionProperties\' via dlsym/loadlibrary " + "for ICD %s", filename); goto out; } @@ -1547,18 +1552,20 @@ static VkResult loader_scanned_icd_add(const struct loader_instance *inst, struc fp_create_inst = (PFN_vkCreateInstance)fp_get_proc_addr(NULL, "vkCreateInstance"); if (NULL == fp_create_inst) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: Could not get " - "\'vkCreateInstance\' via \'vk_icdGetInstanceProcAddr\'" - " for ICD %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_scanned_icd_add: Could not get " + "\'vkCreateInstance\' via \'vk_icdGetInstanceProcAddr\'" + " for ICD %s", filename); goto out; } fp_get_inst_ext_props = (PFN_vkEnumerateInstanceExtensionProperties)fp_get_proc_addr(NULL, "vkEnumerateInstanceExtensionProperties"); if (NULL == fp_get_inst_ext_props) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: Could not get \'vkEnumerate" - "InstanceExtensionProperties\' via " - "\'vk_icdGetInstanceProcAddr\' for ICD %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_scanned_icd_add: Could not get \'vkEnumerate" + "InstanceExtensionProperties\' via " + "\'vk_icdGetInstanceProcAddr\' for ICD %s", filename); goto out; } @@ -1567,14 +1574,14 @@ static VkResult loader_scanned_icd_add(const struct loader_instance *inst, struc // check for enough capacity if ((icd_tramp_list->count * sizeof(struct loader_scanned_icd)) >= icd_tramp_list->capacity) { - icd_tramp_list->scanned_list = loader_instance_heap_realloc(inst, icd_tramp_list->scanned_list, icd_tramp_list->capacity, icd_tramp_list->capacity * 2, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == icd_tramp_list->scanned_list) { res = VK_ERROR_OUT_OF_HOST_MEMORY; - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: Realloc failed on icd library" - " list for ICD %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_scanned_icd_add: Realloc failed on icd library" + " list for ICD %s", filename); goto out; } @@ -1608,14 +1615,14 @@ out: static bool loader_icd_init_entrys(struct loader_icd_term *icd_term, VkInstance inst, const PFN_vkGetInstanceProcAddr fp_gipa) { /* initialize entrypoint function pointers */ -#define LOOKUP_GIPA(func, required) \ - do { \ - icd_term->func = (PFN_vk##func)fp_gipa(inst, "vk" #func); \ - if (!icd_term->func && required) { \ - loader_log((struct loader_instance *)inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, \ - loader_platform_get_proc_address_error("vk" #func)); \ - return false; \ - } \ +#define LOOKUP_GIPA(func, required) \ + do { \ + icd_term->func = (PFN_vk##func)fp_gipa(inst, "vk" #func); \ + if (!icd_term->func && required) { \ + loader_log((struct loader_instance *)inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, \ + loader_platform_get_proc_address_error("vk" #func)); \ + return false; \ + } \ } while (0) LOOKUP_GIPA(GetDeviceProcAddr, true); @@ -1707,8 +1714,7 @@ static bool loader_icd_init_entrys(struct loader_icd_term *icd_term, VkInstance static void loader_debug_init(void) { char *env, *orig; - if (g_loader_debug > 0) - return; + if (g_loader_debug > 0) return; g_loader_debug = 0; @@ -1745,8 +1751,7 @@ static void loader_debug_init(void) { } } - if (!p) - break; + if (!p) break; env = p + 1; } @@ -1786,8 +1791,7 @@ static char *loader_get_next_path(char *path) { uint32_t len; char *next; - if (path == NULL) - return NULL; + if (path == NULL) return NULL; next = strchr(path, PATH_SEPARATOR); if (next == NULL) { len = (uint32_t)strlen(path); @@ -1876,8 +1880,9 @@ static VkResult loader_get_json(const struct loader_instance *inst, const char * fseek(file, 0, SEEK_SET); json_buf = (char *)loader_stack_alloc(len + 1); if (json_buf == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_json: Failed to allocate space for " - "JSON file %s buffer of length %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_get_json: Failed to allocate space for " + "JSON file %s buffer of length %d", filename, len); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -1892,9 +1897,10 @@ static VkResult loader_get_json(const struct loader_instance *inst, const char * // parse text from file *json = cJSON_Parse(json_buf); if (*json == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_json: Failed to parse JSON file %s, " - "this is usually because something ran out of " - "memory.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_get_json: Failed to parse JSON file %s, " + "this is usually because something ran out of " + "memory.", filename); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -1918,8 +1924,9 @@ VkResult loader_copy_layer_properties(const struct loader_instance *inst, struct dst->instance_extension_list.list = loader_instance_heap_alloc( inst, sizeof(VkExtensionProperties) * src->instance_extension_list.count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == dst->instance_extension_list.list) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_copy_layer_properties: Failed to allocate space " - "for instance extension list of size %d.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_copy_layer_properties: Failed to allocate space " + "for instance extension list of size %d.", src->instance_extension_list.count); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -1928,8 +1935,9 @@ VkResult loader_copy_layer_properties(const struct loader_instance *inst, struct dst->device_extension_list.list = loader_instance_heap_alloc( inst, sizeof(struct loader_dev_ext_props) * src->device_extension_list.count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == dst->device_extension_list.list) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_copy_layer_properties: Failed to allocate space " - "for device extension list of size %d.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_copy_layer_properties: Failed to allocate space " + "for device extension list of size %d.", src->device_extension_list.count); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -1942,8 +1950,9 @@ VkResult loader_copy_layer_properties(const struct loader_instance *inst, struct dst->device_extension_list.list->entrypoints = loader_instance_heap_alloc(inst, sizeof(char *) * cnt, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == dst->device_extension_list.list->entrypoints) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_copy_layer_properties: Failed to allocate space " - "for device extension entrypoint list of size %d.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_copy_layer_properties: Failed to allocate space " + "for device extension entrypoint list of size %d.", cnt); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -1953,9 +1962,10 @@ VkResult loader_copy_layer_properties(const struct loader_instance *inst, struct dst->device_extension_list.list->entrypoints[i] = loader_instance_heap_alloc( inst, strlen(src->device_extension_list.list->entrypoints[i]) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == dst->device_extension_list.list->entrypoints[i]) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_copy_layer_properties: Failed to " - "allocate space for device extension entrypoint " - "%d name of length", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_copy_layer_properties: Failed to " + "allocate space for device extension entrypoint " + "%d name of length", i); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -1967,29 +1977,23 @@ VkResult loader_copy_layer_properties(const struct loader_instance *inst, struct } static bool loader_find_layer_name_list(const char *name, const struct loader_layer_list *layer_list) { - if (!layer_list) - return false; + if (!layer_list) return false; for (uint32_t j = 0; j < layer_list->count; j++) - if (!strcmp(name, layer_list->list[j].info.layerName)) - return true; + if (!strcmp(name, layer_list->list[j].info.layerName)) return true; return false; } static bool loader_find_layer_name(const char *name, uint32_t layer_count, const char **layer_list) { - if (!layer_list) - return false; + if (!layer_list) return false; for (uint32_t j = 0; j < layer_count; j++) - if (!strcmp(name, layer_list[j])) - return true; + if (!strcmp(name, layer_list[j])) return true; return false; } bool loader_find_layer_name_array(const char *name, uint32_t layer_count, const char layer_list[][VK_MAX_EXTENSION_NAME_SIZE]) { - if (!layer_list) - return false; + if (!layer_list) return false; for (uint32_t j = 0; j < layer_count; j++) - if (!strcmp(name, layer_list[j])) - return true; + if (!strcmp(name, layer_list[j])) return true; return false; } @@ -2008,12 +2012,11 @@ bool loader_find_layer_name_array(const char *name, uint32_t layer_count, const VkResult loader_expand_layer_names(struct loader_instance *inst, const char *key_name, uint32_t expand_count, const char expand_names[][VK_MAX_EXTENSION_NAME_SIZE], uint32_t *layer_count, char const *const **ppp_layer_names) { - char const *const *pp_src_layers = *ppp_layer_names; if (!loader_find_layer_name(key_name, *layer_count, (char const **)pp_src_layers)) { inst->activated_layers_are_std_val = false; - return VK_SUCCESS; // didn't find the key_name in the list. + return VK_SUCCESS; // didn't find the key_name in the list. } loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "Found meta layer %s, replacing with actual layer group", key_name); @@ -2022,8 +2025,9 @@ VkResult loader_expand_layer_names(struct loader_instance *inst, const char *key char const **pp_dst_layers = loader_instance_heap_alloc(inst, (expand_count + *layer_count - 1) * sizeof(char const *), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); if (NULL == pp_dst_layers) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_expand_layer_names:: Failed to allocate space for " - "std_validation layer names in pp_dst_layers."); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_expand_layer_names:: Failed to allocate space for " + "std_validation layer names in pp_dst_layers."); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -2088,19 +2092,15 @@ static void loader_add_layer_property_meta(const struct loader_instance *inst, u bool found; struct loader_layer_list *layer_list; - if (0 == layer_count || (!layer_instance_list)) - return; - if (layer_instance_list && (layer_count > layer_instance_list->count)) - return; + if (0 == layer_count || (!layer_instance_list)) return; + if (layer_instance_list && (layer_count > layer_instance_list->count)) return; layer_list = layer_instance_list; found = true; - if (layer_list == NULL) - return; + if (layer_list == NULL) return; for (i = 0; i < layer_count; i++) { - if (loader_find_layer_name_list(layer_names[i], layer_list)) - continue; + if (loader_find_layer_name_list(layer_names[i], layer_list)) continue; found = false; break; } @@ -2144,39 +2144,42 @@ static void loader_read_json_layer(const struct loader_instance *inst, struct lo * (required for implicit layers) “disable_environment” */ -#define GET_JSON_OBJECT(node, var) \ - { \ - var = cJSON_GetObjectItem(node, #var); \ - if (var == NULL) { \ - layer_node = layer_node->next; \ - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "Didn't find required layer object %s in manifest " \ - "JSON file, skipping this layer", \ - #var); \ - return; \ - } \ - } -#define GET_JSON_ITEM(node, var) \ - { \ - item = cJSON_GetObjectItem(node, #var); \ - if (item == NULL) { \ - layer_node = layer_node->next; \ - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "Didn't find required layer value %s in manifest JSON " \ - "file, skipping this layer", \ - #var); \ - return; \ - } \ - temp = cJSON_Print(item); \ - if (temp == NULL) { \ - layer_node = layer_node->next; \ - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "Problem accessing layer value %s in manifest JSON " \ - "file, skipping this layer", \ - #var); \ - return; \ - } \ - temp[strlen(temp) - 1] = '\0'; \ - var = loader_stack_alloc(strlen(temp) + 1); \ - strcpy(var, &temp[1]); \ - cJSON_Free(temp); \ +#define GET_JSON_OBJECT(node, var) \ + { \ + var = cJSON_GetObjectItem(node, #var); \ + if (var == NULL) { \ + layer_node = layer_node->next; \ + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, \ + "Didn't find required layer object %s in manifest " \ + "JSON file, skipping this layer", \ + #var); \ + return; \ + } \ + } +#define GET_JSON_ITEM(node, var) \ + { \ + item = cJSON_GetObjectItem(node, #var); \ + if (item == NULL) { \ + layer_node = layer_node->next; \ + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, \ + "Didn't find required layer value %s in manifest JSON " \ + "file, skipping this layer", \ + #var); \ + return; \ + } \ + temp = cJSON_Print(item); \ + if (temp == NULL) { \ + layer_node = layer_node->next; \ + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, \ + "Problem accessing layer value %s in manifest JSON " \ + "file, skipping this layer", \ + #var); \ + return; \ + } \ + temp[strlen(temp) - 1] = '\0'; \ + var = loader_stack_alloc(strlen(temp) + 1); \ + strcpy(var, &temp[1]); \ + cJSON_Free(temp); \ } GET_JSON_ITEM(layer_node, name) GET_JSON_ITEM(layer_node, type) @@ -2238,8 +2241,9 @@ static void loader_read_json_layer(const struct loader_instance *inst, struct lo props->info.description[sizeof(props->info.description) - 1] = '\0'; if (is_implicit) { if (!disable_environment || !disable_environment->child) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "Didn't find required layer child value disable_environment" - "in manifest JSON file, skipping this layer"); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "Didn't find required layer child value disable_environment" + "in manifest JSON file, skipping this layer"); layer_node = layer_node->next; return; } @@ -2256,20 +2260,20 @@ static void loader_read_json_layer(const struct loader_instance *inst, struct lo * device_extensions * enable_environment (implicit layers only) */ -#define GET_JSON_OBJECT(node, var) \ +#define GET_JSON_OBJECT(node, var) \ { var = cJSON_GetObjectItem(node, #var); } -#define GET_JSON_ITEM(node, var) \ - { \ - item = cJSON_GetObjectItem(node, #var); \ - if (item != NULL) { \ - temp = cJSON_Print(item); \ - if (temp != NULL) { \ - temp[strlen(temp) - 1] = '\0'; \ - var = loader_stack_alloc(strlen(temp) + 1); \ - strcpy(var, &temp[1]); \ - cJSON_Free(temp); \ - } \ - } \ +#define GET_JSON_ITEM(node, var) \ + { \ + item = cJSON_GetObjectItem(node, #var); \ + if (item != NULL) { \ + temp = cJSON_Print(item); \ + if (temp != NULL) { \ + temp[strlen(temp) - 1] = '\0'; \ + var = loader_stack_alloc(strlen(temp) + 1); \ + strcpy(var, &temp[1]); \ + cJSON_Free(temp); \ + } \ + } \ } cJSON *instance_extensions, *device_extensions, *functions, *enable_environment; @@ -2302,24 +2306,26 @@ static void loader_read_json_layer(const struct loader_instance *inst, struct lo if (vkGetInstanceProcAddr != NULL) { strncpy(props->functions.str_gipa, vkGetInstanceProcAddr, sizeof(props->functions.str_gipa)); if (version.major > 1 || version.minor >= 1) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "Indicating layer-specific vkGetInstanceProcAddr " - "function is deprecated starting with JSON file " - "version 1.1.0. Instead, use the new " - "vkNegotiateLayerInterfaceVersion function to " - "return the GetInstanceProcAddr function for this" - "layer"); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "Indicating layer-specific vkGetInstanceProcAddr " + "function is deprecated starting with JSON file " + "version 1.1.0. Instead, use the new " + "vkNegotiateLayerInterfaceVersion function to " + "return the GetInstanceProcAddr function for this" + "layer"); } } props->functions.str_gipa[sizeof(props->functions.str_gipa) - 1] = '\0'; if (vkGetDeviceProcAddr != NULL) { strncpy(props->functions.str_gdpa, vkGetDeviceProcAddr, sizeof(props->functions.str_gdpa)); if (version.major > 1 || version.minor >= 1) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "Indicating layer-specific vkGetDeviceProcAddr " - "function is deprecated starting with JSON file " - "version 1.1.0. Instead, use the new " - "vkNegotiateLayerInterfaceVersion function to " - "return the GetDeviceProcAddr function for this" - "layer"); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "Indicating layer-specific vkGetDeviceProcAddr " + "function is deprecated starting with JSON file " + "version 1.1.0. Instead, use the new " + "vkNegotiateLayerInterfaceVersion function to " + "return the GetDeviceProcAddr function for this" + "layer"); } } props->functions.str_gdpa[sizeof(props->functions.str_gdpa) - 1] = '\0'; @@ -2481,8 +2487,9 @@ static void loader_add_layer_properties(const struct loader_instance *inst, stru } if (!is_valid_layer_json_version(&json_version)) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_add_layer_properties: %s invalid layer " - " manifest file version %d.%d.%d. May cause errors.", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_add_layer_properties: %s invalid layer " + " manifest file version %d.%d.%d. May cause errors.", filename, json_version.major, json_version.minor, json_version.patch); } cJSON_Free(file_vers); @@ -2492,17 +2499,19 @@ static void loader_add_layer_properties(const struct loader_instance *inst, stru if (layers_node != NULL) { int numItems = cJSON_GetArraySize(layers_node); if (!layer_json_supports_layers_tag(&json_version)) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_add_layer_properties: \'layers\' tag not " - "supported until file version 1.0.1, but %s is " - "reporting version %s", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_add_layer_properties: \'layers\' tag not " + "supported until file version 1.0.1, but %s is " + "reporting version %s", filename, file_vers); } for (int curLayer = 0; curLayer < numItems; curLayer++) { layer_node = cJSON_GetArrayItem(layers_node, curLayer); if (layer_node == NULL) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_add_layer_properties: Can not find " - "\'layers\' array element %d object in manifest " - "JSON file %s. Skipping this file", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_add_layer_properties: Can not find " + "\'layers\' array element %d object in manifest " + "JSON file %s. Skipping this file", curLayer, filename); return; } @@ -2513,8 +2522,9 @@ static void loader_add_layer_properties(const struct loader_instance *inst, stru // Otherwise, try to read in individual layers layer_node = cJSON_GetObjectItem(json, "layer"); if (layer_node == NULL) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_add_layer_properties: Can not find \'layer\' " - "object in manifest JSON file %s. Skipping this file.", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_add_layer_properties: Can not find \'layer\' " + "object in manifest JSON file %s. Skipping this file.", filename); return; } @@ -2531,9 +2541,10 @@ static void loader_add_layer_properties(const struct loader_instance *inst, stru // versions newer than 1.0.0. Having multiple objects with the same // name at the same level is actually a JSON standard violation. if (layer_count > 1 && layer_json_supports_layers_tag(&json_version)) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_layer_properties: Multiple \'layer\' nodes" - " are deprecated starting in file version \"1.0.1\". " - "Please use \'layers\' : [] array instead in %s.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_layer_properties: Multiple \'layer\' nodes" + " are deprecated starting in file version \"1.0.1\". " + "Please use \'layers\' : [] array instead in %s.", filename); } else { do { @@ -2611,8 +2622,9 @@ static VkResult loader_get_manifest_files(const struct loader_instance *inst, co home_location = NULL; if (location == NULL) { #endif - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Can not get manifest files with " - "NULL location, env_override=%s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_get_manifest_files: Can not get manifest files with " + "NULL location, env_override=%s", (env_override != NULL) ? env_override : ""); res = VK_ERROR_INITIALIZATION_FAILED; goto out; @@ -2628,8 +2640,9 @@ static VkResult loader_get_manifest_files(const struct loader_instance *inst, co if (override == NULL) { loc = loader_stack_alloc(strlen(location) + 1); if (loc == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Failed to allocate " - "%d bytes for manifest file location.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_get_manifest_files: Failed to allocate " + "%d bytes for manifest file location.", strlen(location)); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -2639,9 +2652,10 @@ static VkResult loader_get_manifest_files(const struct loader_instance *inst, co VkResult reg_result = loaderGetRegistryFiles(inst, loc, ®); if (VK_SUCCESS != reg_result || NULL == reg) { if (!is_layer) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Registry lookup failed " - "to get ICD manifest files. Possibly missing Vulkan" - " driver?"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_get_manifest_files: Registry lookup failed " + "to get ICD manifest files. Possibly missing Vulkan" + " driver?"); if (VK_SUCCESS == reg_result || VK_ERROR_OUT_OF_HOST_MEMORY == reg_result) { res = reg_result; } else { @@ -2650,8 +2664,9 @@ static VkResult loader_get_manifest_files(const struct loader_instance *inst, co } else { if (warn_if_not_present) { // This is only a warning for layers - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_get_manifest_files: Registry lookup failed " - "to get layer manifest files."); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_get_manifest_files: Registry lookup failed " + "to get layer manifest files."); } if (reg_result == VK_ERROR_OUT_OF_HOST_MEMORY) { res = reg_result; @@ -2668,8 +2683,9 @@ static VkResult loader_get_manifest_files(const struct loader_instance *inst, co } else { loc = loader_stack_alloc(strlen(override) + 1); if (loc == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Failed to allocate space for " - "override environment variable of length %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_get_manifest_files: Failed to allocate space for " + "override environment variable of length %d", strlen(override) + 1); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -2688,8 +2704,7 @@ static VkResult loader_get_manifest_files(const struct loader_instance *inst, co name = NULL; if (sysdir) { dent = readdir(sysdir); - if (dent == NULL) - break; + if (dent == NULL) break; name = &(dent->d_name[0]); loader_get_fullpath(name, file, sizeof(full_path), full_path); name = full_path; @@ -2703,8 +2718,9 @@ static VkResult loader_get_manifest_files(const struct loader_instance *inst, co // make a copy of location so it isn't modified dir = loader_stack_alloc(strlen(loc) + 1); if (dir == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Failed to allocate " - "space for relative location path length %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_get_manifest_files: Failed to allocate " + "space for relative location path length %d", strlen(loc) + 1); goto out; } @@ -2730,16 +2746,18 @@ static VkResult loader_get_manifest_files(const struct loader_instance *inst, co alloced_count *= 2; } if (out_files->filename_list == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Failed to allocate " - "space for manifest file name list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_get_manifest_files: Failed to allocate " + "space for manifest file name list"); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } out_files->filename_list[out_files->count] = loader_instance_heap_alloc(inst, strlen(name) + 1, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); if (out_files->filename_list[out_files->count] == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Failed to allocate " - "space for manifest file %d list", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_get_manifest_files: Failed to allocate " + "space for manifest file %d list", out_files->count); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -2772,11 +2790,11 @@ static VkResult loader_get_manifest_files(const struct loader_instance *inst, co char *xdgdatahome = secure_getenv("XDG_DATA_HOME"); size_t len; if (xdgdatahome != NULL) { - char *home_loc = loader_stack_alloc(strlen(xdgdatahome) + 2 + strlen(home_location)); if (home_loc == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Failed to allocate " - "space for manifest file XDG Home location"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_get_manifest_files: Failed to allocate " + "space for manifest file XDG Home location"); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } @@ -2797,13 +2815,13 @@ static VkResult loader_get_manifest_files(const struct loader_instance *inst, co list_is_dirs = true; } else { - char *home = secure_getenv("HOME"); if (home != NULL) { char *home_loc = loader_stack_alloc(strlen(home) + 16 + strlen(home_location)); if (home_loc == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Failed to allocate " - "space for manifest file Home location"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_get_manifest_files: Failed to allocate " + "space for manifest file Home location"); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } @@ -2922,8 +2940,9 @@ VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_t if (num_good_icds == 0) { res = VK_ERROR_INITIALIZATION_FAILED; } - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: ICD JSON %s does not have a" - " \'file_format_version\' field. Skipping ICD JSON.", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_icd_scan: ICD JSON %s does not have a" + " \'file_format_version\' field. Skipping ICD JSON.", file_str); cJSON_Delete(json); json = NULL; @@ -2936,8 +2955,9 @@ VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_t if (num_good_icds == 0) { res = VK_ERROR_OUT_OF_HOST_MEMORY; } - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: Failed retrieving ICD JSON %s" - " \'file_format_version\' field. Skipping ICD JSON", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_icd_scan: Failed retrieving ICD JSON %s" + " \'file_format_version\' field. Skipping ICD JSON", file_str); cJSON_Delete(json); json = NULL; @@ -2958,8 +2978,9 @@ VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_t } } if (file_major_vers != 1 || file_minor_vers != 0 || file_patch_vers > 1) - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: Unexpected manifest file version " - "(expected 1.0.0 or 1.0.1), may cause errors"); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_icd_scan: Unexpected manifest file version " + "(expected 1.0.0 or 1.0.1), may cause errors"); cJSON_Free(file_vers); itemICD = cJSON_GetObjectItem(json, "ICD"); if (itemICD != NULL) { @@ -2970,8 +2991,9 @@ VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_t if (num_good_icds == 0) { res = VK_ERROR_OUT_OF_HOST_MEMORY; } - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: Failed retrieving ICD JSON %s" - " \'library_path\' field. Skipping ICD JSON.", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_icd_scan: Failed retrieving ICD JSON %s" + " \'library_path\' field. Skipping ICD JSON.", file_str); cJSON_Free(temp); cJSON_Delete(json); @@ -2982,9 +3004,10 @@ VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_t temp[strlen(temp) - 1] = '\0'; char *library_path = loader_stack_alloc(strlen(temp) + 1); if (NULL == library_path) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_icd_scan: Failed to allocate space for " - "ICD JSON %s \'library_path\' value. Skipping " - "ICD JSON.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_icd_scan: Failed to allocate space for " + "ICD JSON %s \'library_path\' value. Skipping " + "ICD JSON.", file_str); res = VK_ERROR_OUT_OF_HOST_MEMORY; cJSON_Free(temp); @@ -2995,8 +3018,9 @@ VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_t strcpy(library_path, &temp[1]); cJSON_Free(temp); if (strlen(library_path) == 0) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: ICD JSON %s \'library_path\'" - " field is empty. Skipping ICD JSON.", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_icd_scan: ICD JSON %s \'library_path\'" + " field is empty. Skipping ICD JSON.", file_str); cJSON_Delete(json); json = NULL; @@ -3023,8 +3047,9 @@ VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_t if (item != NULL) { temp = cJSON_Print(item); if (NULL == temp) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: Failed retrieving ICD JSON %s" - " \'api_version\' field. Skipping ICD JSON.", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_icd_scan: Failed retrieving ICD JSON %s" + " \'api_version\' field. Skipping ICD JSON.", file_str); // Only reason the print can fail is if there was an @@ -3041,27 +3066,31 @@ VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_t vers = loader_make_version(temp); cJSON_Free(temp); } else { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: ICD JSON %s does not have an" - " \'api_version\' field.", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_icd_scan: ICD JSON %s does not have an" + " \'api_version\' field.", file_str); } res = loader_scanned_icd_add(inst, icd_tramp_list, fullpath, vers); if (VK_SUCCESS != res) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_icd_scan: Failed to add ICD JSON %s. " - " Skipping ICD JSON.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_icd_scan: Failed to add ICD JSON %s. " + " Skipping ICD JSON.", fullpath); continue; } num_good_icds++; } else { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: Failed to find \'library_path\' " - "object in ICD JSON file %s. Skipping ICD JSON.", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_icd_scan: Failed to find \'library_path\' " + "object in ICD JSON file %s. Skipping ICD JSON.", file_str); } } else { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: Can not find \'ICD\' object in ICD JSON " - "file %s. Skipping ICD JSON", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "loader_icd_scan: Can not find \'ICD\' object in ICD JSON " + "file %s. Skipping ICD JSON", file_str); } @@ -3090,7 +3119,7 @@ out: void loader_layer_scan(const struct loader_instance *inst, struct loader_layer_list *instance_layers) { char *file_str; - struct loader_manifest_files manifest_files[2]; // [0] = explicit, [1] = implicit + struct loader_manifest_files manifest_files[2]; // [0] = explicit, [1] = implicit cJSON *json; uint32_t implicit; bool lockedMutex = false; @@ -3124,8 +3153,7 @@ void loader_layer_scan(const struct loader_instance *inst, struct loader_layer_l for (implicit = 0; implicit < 2; implicit++) { for (uint32_t i = 0; i < manifest_files[implicit].count; i++) { file_str = manifest_files[implicit].filename_list[i]; - if (file_str == NULL) - continue; + if (file_str == NULL) continue; // parse file into JSON struct VkResult res = loader_get_json(inst, file_str, &json); @@ -3216,8 +3244,7 @@ static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpdpa_instance_internal(V VkLayerInstanceDispatchTable *disp_table = *(VkLayerInstanceDispatchTable **)inst; void *addr; - if (disp_table == NULL) - return NULL; + if (disp_table == NULL) return NULL; bool found_name; addr = loader_lookup_instance_dispatch_table(disp_table, pName, &found_name); @@ -3225,8 +3252,7 @@ static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpdpa_instance_internal(V return addr; } - if (loader_phys_dev_ext_gpa(loader_get_instance(inst), pName, true, NULL, &addr)) - return addr; + if (loader_phys_dev_ext_gpa(loader_get_instance(inst), pName, true, NULL, &addr)) return addr; // Don't call down the chain, this would be an infinite loop loader_log(NULL, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_gpdpa_instance_internal() unrecognized name %s", pName); @@ -3241,8 +3267,7 @@ static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpdpa_instance_terminator VkLayerInstanceDispatchTable *disp_table = *(VkLayerInstanceDispatchTable **)inst; void *addr; - if (disp_table == NULL) - return NULL; + if (disp_table == NULL) return NULL; bool found_name; addr = loader_lookup_instance_dispatch_table(disp_table, pName, &found_name); @@ -3282,8 +3307,7 @@ static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpa_instance_internal(VkI VkLayerInstanceDispatchTable *disp_table = *(VkLayerInstanceDispatchTable **)inst; void *addr; - if (disp_table == NULL) - return NULL; + if (disp_table == NULL) return NULL; bool found_name; addr = loader_lookup_instance_dispatch_table(disp_table, pName, &found_name); @@ -3339,15 +3363,13 @@ static void loader_init_dispatch_dev_ext_entry(struct loader_instance *inst, str void *gdpa_value; if (dev != NULL) { gdpa_value = dev->loader_dispatch.core_dispatch.GetDeviceProcAddr(dev->chain_device, funcName); - if (gdpa_value != NULL) - dev->loader_dispatch.ext_dispatch.dev_ext[idx] = (PFN_vkDevExt)gdpa_value; + if (gdpa_value != NULL) dev->loader_dispatch.ext_dispatch.dev_ext[idx] = (PFN_vkDevExt)gdpa_value; } else { for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term != NULL; icd_term = icd_term->next) { struct loader_device *ldev = icd_term->logical_device_list; while (ldev) { gdpa_value = ldev->loader_dispatch.core_dispatch.GetDeviceProcAddr(ldev->chain_device, funcName); - if (gdpa_value != NULL) - ldev->loader_dispatch.ext_dispatch.dev_ext[idx] = (PFN_vkDevExt)gdpa_value; + if (gdpa_value != NULL) ldev->loader_dispatch.ext_dispatch.dev_ext[idx] = (PFN_vkDevExt)gdpa_value; ldev = ldev->next; } } @@ -3417,8 +3439,9 @@ static bool loader_add_dev_ext_table(struct loader_instance *inst, uint32_t *ptr inst->dev_ext_disp_hash[idx].func_name = (char *)loader_instance_heap_alloc(inst, strlen(funcName) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (inst->dev_ext_disp_hash[idx].func_name == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_dev_ext_table: Failed to allocate memory " - "for func_name %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_dev_ext_table: Failed to allocate memory " + "for func_name %s", funcName); return false; } @@ -3430,8 +3453,9 @@ static bool loader_add_dev_ext_table(struct loader_instance *inst, uint32_t *ptr if (list->capacity == 0) { list->index = loader_instance_heap_alloc(inst, 8 * sizeof(*(list->index)), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (list->index == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_dev_ext_table: Failed to allocate memory " - "for list index", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_dev_ext_table: Failed to allocate memory " + "for list index", funcName); return false; } @@ -3440,8 +3464,9 @@ static bool loader_add_dev_ext_table(struct loader_instance *inst, uint32_t *ptr list->index = loader_instance_heap_realloc(inst, list->index, list->capacity, list->capacity * 2, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (list->index == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_dev_ext_table: Failed to reallocate memory " - "for list index", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_dev_ext_table: Failed to reallocate memory " + "for list index", funcName); return false; } @@ -3456,8 +3481,9 @@ static bool loader_add_dev_ext_table(struct loader_instance *inst, uint32_t *ptr inst->dev_ext_disp_hash[i].func_name = (char *)loader_instance_heap_alloc(inst, strlen(funcName) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (inst->dev_ext_disp_hash[i].func_name == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_dev_ext_table: Failed to allocate memory " - "for func_name %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_dev_ext_table: Failed to allocate memory " + "for func_name %s", funcName); return false; } @@ -3470,16 +3496,16 @@ static bool loader_add_dev_ext_table(struct loader_instance *inst, uint32_t *ptr i = (i + 1) % MAX_NUM_UNKNOWN_EXTS; } while (i != idx); - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_dev_ext_table: Could not insert into hash table; is " - "it full?"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_dev_ext_table: Could not insert into hash table; is " + "it full?"); return false; } static bool loader_name_in_dev_ext_table(struct loader_instance *inst, uint32_t *idx, const char *funcName) { uint32_t alt_idx; - if (inst->dev_ext_disp_hash[*idx].func_name && !strcmp(inst->dev_ext_disp_hash[*idx].func_name, funcName)) - return true; + if (inst->dev_ext_disp_hash[*idx].func_name && !strcmp(inst->dev_ext_disp_hash[*idx].func_name, funcName)) return true; // funcName wasn't at the primary spot in the hash table // search the list of secondary locations (shallow search, not deep search) @@ -3589,8 +3615,9 @@ static bool loader_add_phys_dev_ext_table(struct loader_instance *inst, uint32_t inst->phys_dev_ext_disp_hash[idx].func_name = (char *)loader_instance_heap_alloc(inst, strlen(funcName) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (inst->phys_dev_ext_disp_hash[idx].func_name == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_phys_dev_ext_table() can't allocate memory for " - "func_name"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_phys_dev_ext_table() can't allocate memory for " + "func_name"); return false; } strncpy(inst->phys_dev_ext_disp_hash[idx].func_name, funcName, strlen(funcName) + 1); @@ -3623,8 +3650,9 @@ static bool loader_add_phys_dev_ext_table(struct loader_instance *inst, uint32_t inst->phys_dev_ext_disp_hash[i].func_name = (char *)loader_instance_heap_alloc(inst, strlen(funcName) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (inst->phys_dev_ext_disp_hash[i].func_name == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_dev_ext_table() can't rallocate " - "func_name memory"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_dev_ext_table() can't rallocate " + "func_name memory"); return false; } strncpy(inst->phys_dev_ext_disp_hash[i].func_name, funcName, strlen(funcName) + 1); @@ -3636,8 +3664,9 @@ static bool loader_add_phys_dev_ext_table(struct loader_instance *inst, uint32_t i = (i + 1) % MAX_NUM_UNKNOWN_EXTS; } while (i != idx); - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_phys_dev_ext_table() couldn't insert into hash table; is " - "it full?"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_add_phys_dev_ext_table() couldn't insert into hash table; is " + "it full?"); return false; } @@ -3778,7 +3807,6 @@ struct loader_instance *loader_get_instance(const VkInstance instance) { static loader_platform_dl_handle loader_open_layer_lib(const struct loader_instance *inst, const char *chain_type, struct loader_layer_properties *prop) { - if ((prop->lib_handle = loader_platform_open_library(prop->lib_name)) == NULL) { loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_open_layer_lib: Failed to open library %s", prop->lib_name); } else { @@ -3789,7 +3817,6 @@ static loader_platform_dl_handle loader_open_layer_lib(const struct loader_insta } static void loader_close_layer_lib(const struct loader_instance *inst, struct loader_layer_properties *prop) { - if (prop->lib_handle) { loader_platform_close_library(prop->lib_handle); loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Unloading layer library %s", prop->lib_name); @@ -3830,8 +3857,7 @@ static void loader_add_layer_implicit(const struct loader_instance *inst, const enable = true; } else { env_value = loader_getenv(prop->enable_env_var.name, inst); - if (env_value && !strcmp(prop->enable_env_var.value, env_value)) - enable = true; + if (env_value && !strcmp(prop->enable_env_var.value, env_value)) enable = true; loader_free_getenv(env_value, inst); } @@ -3883,8 +3909,7 @@ static void loader_add_layer_env(struct loader_instance *inst, const enum layer_ */ loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "Expanding meta layer %s found in environment variable", std_validation_str); - if (type == VK_LAYER_TYPE_INSTANCE_EXPLICIT) - inst->activated_layers_are_std_val = true; + if (type == VK_LAYER_TYPE_INSTANCE_EXPLICIT) inst->activated_layers_are_std_val = true; for (uint32_t i = 0; i < sizeof(std_validation_names) / sizeof(std_validation_names[0]); i++) { loader_find_layer_name_add_list(inst, std_validation_names[i], type, search_list, layer_list); } @@ -3904,8 +3929,9 @@ VkResult loader_enable_instance_layers(struct loader_instance *inst, const VkIns assert(inst && "Cannot have null instance"); if (!loader_init_layer_list(inst, &inst->activated_layer_list)) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_enable_instance_layers: Failed to initialize" - " the layer list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_enable_instance_layers: Failed to initialize" + " the layer list"); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -3925,7 +3951,6 @@ VkResult loader_enable_instance_layers(struct loader_instance *inst, const VkIns // Determine the layer interface version to use. bool loader_get_layer_interface_version(PFN_vkNegotiateLoaderLayerInterfaceVersion fp_negotiate_layer_version, VkNegotiateLayerInterface *interface_struct) { - memset(interface_struct, 0, sizeof(VkNegotiateLayerInterface)); // Base assumption is that all layers are version 1 at least. @@ -3987,7 +4012,6 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c memcpy(&loader_create_info, pCreateInfo, sizeof(VkInstanceCreateInfo)); if (inst->activated_layer_list.count > 0) { - chain_info.u.pLayerInfo = NULL; chain_info.pNext = pCreateInfo->pNext; chain_info.sType = VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO; @@ -3996,8 +4020,9 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c layer_instance_link_info = loader_stack_alloc(sizeof(VkLayerInstanceLink) * inst->activated_layer_list.count); if (!layer_instance_link_info) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_create_instance_chain: Failed to alloc Instance" - " objects for layer"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_create_instance_chain: Failed to alloc Instance" + " objects for layer"); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -4032,7 +4057,6 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c VkNegotiateLayerInterface interface_struct; if (loader_get_layer_interface_version(negotiate_interface, &interface_struct)) { - // Go ahead and set the properites version to the // correct value. layer_prop->interface_version = interface_struct.loaderLayerInterfaceVersion; @@ -4065,9 +4089,10 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c } if (NULL == cur_gipa) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_create_instance_chain: Failed to" - " find \'vkGetInstanceProcAddr\' in " - "layer %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_create_instance_chain: Failed to" + " find \'vkGetInstanceProcAddr\' in " + "layer %s", layer_prop->lib_name); continue; } @@ -4106,8 +4131,9 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c loader_create_info.pNext = &create_info_disp; res = fpCreateInstance(&loader_create_info, pAllocator, created_instance); } else { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_create_instance_chain: Failed to find " - "\'vkCreateInstance\'"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_create_instance_chain: Failed to find " + "\'vkCreateInstance\'"); // Couldn't find CreateInstance function! res = VK_ERROR_INITIALIZATION_FAILED; } @@ -4121,7 +4147,6 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c } void loader_activate_instance_layer_extensions(struct loader_instance *inst, VkInstance created_inst) { - loader_init_instance_extension_dispatch_table(&inst->disp->layer_inst_disp, inst->disp->layer_inst_disp.GetInstanceProcAddr, created_inst); } @@ -4142,8 +4167,9 @@ VkResult loader_create_device_chain(const struct loader_physical_device_tramp *p layer_device_link_info = loader_stack_alloc(sizeof(VkLayerDeviceLink) * dev->activated_layer_list.count); if (!layer_device_link_info) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_create_device_chain: Failed to alloc Device objects" - " for layer. Skipping Layer."); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_create_device_chain: Failed to alloc Device objects" + " for layer. Skipping Layer."); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -4185,7 +4211,6 @@ VkResult loader_create_device_chain(const struct loader_physical_device_tramp *p VkNegotiateLayerInterface interface_struct; if (loader_get_layer_interface_version(negotiate_interface, &interface_struct)) { - // Go ahead and set the properites version to the // correct value. layer_prop->interface_version = interface_struct.loaderLayerInterfaceVersion; @@ -4215,9 +4240,10 @@ VkResult loader_create_device_chain(const struct loader_physical_device_tramp *p fpGIPA = (PFN_vkGetInstanceProcAddr)loader_platform_get_proc_address(lib_handle, layer_prop->functions.str_gipa); if (!fpGIPA) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_create_device_chain: Failed to find " - "\'vkGetInstanceProcAddr\' in layer %s. Skipping" - " layer.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_create_device_chain: Failed to find " + "\'vkGetInstanceProcAddr\' in layer %s. Skipping" + " layer.", layer_prop->lib_name); continue; } @@ -4268,8 +4294,9 @@ VkResult loader_create_device_chain(const struct loader_physical_device_tramp *p } dev->chain_device = created_device; } else { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_create_device_chain: Failed to find \'vkCreateDevice\' " - "in layer %s"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_create_device_chain: Failed to find \'vkCreateDevice\' " + "in layer %s"); // Couldn't find CreateDevice function! return VK_ERROR_INITIALIZATION_FAILED; } @@ -4287,15 +4314,17 @@ VkResult loader_validate_layers(const struct loader_instance *inst, const uint32 for (uint32_t i = 0; i < layer_count; i++) { VkStringErrorFlags result = vk_string_validate(MaxLoaderStringLength, ppEnabledLayerNames[i]); if (result != VK_STRING_ERROR_NONE) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_validate_layers: Device ppEnabledLayerNames " - "contains string that is too long or is badly formed"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_validate_layers: Device ppEnabledLayerNames " + "contains string that is too long or is badly formed"); return VK_ERROR_LAYER_NOT_PRESENT; } prop = loader_get_layer_property(ppEnabledLayerNames[i], list); if (!prop) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_validate_layers: Layer %d does not exist in " - "the list of available layers", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_validate_layers: Layer %d does not exist in " + "the list of available layers", i); return VK_ERROR_LAYER_NOT_PRESENT; } @@ -4306,16 +4335,16 @@ VkResult loader_validate_layers(const struct loader_instance *inst, const uint32 VkResult loader_validate_instance_extensions(const struct loader_instance *inst, const struct loader_extension_list *icd_exts, const struct loader_layer_list *instance_layers, const VkInstanceCreateInfo *pCreateInfo) { - VkExtensionProperties *extension_prop; struct loader_layer_properties *layer_prop; for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { VkStringErrorFlags result = vk_string_validate(MaxLoaderStringLength, pCreateInfo->ppEnabledExtensionNames[i]); if (result != VK_STRING_ERROR_NONE) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_validate_instance_extensions: Instance " - "ppEnabledExtensionNames contains " - "string that is too long or is badly formed"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_validate_instance_extensions: Instance " + "ppEnabledExtensionNames contains " + "string that is too long or is badly formed"); return VK_ERROR_EXTENSION_NOT_PRESENT; } @@ -4330,8 +4359,9 @@ VkResult loader_validate_instance_extensions(const struct loader_instance *inst, // If it isn't in the list, return an error if (!found) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_validate_instance_extensions: Extension %d " - "not found in list of available extensions.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_validate_instance_extensions: Extension %d " + "not found in list of available extensions.", i); return VK_ERROR_EXTENSION_NOT_PRESENT; } @@ -4364,8 +4394,9 @@ VkResult loader_validate_instance_extensions(const struct loader_instance *inst, if (!extension_prop) { // Didn't find extension name in any of the global layers, error out - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_validate_instance_extensions: Extension %d " - "not found in enabled layer list extensions.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_validate_instance_extensions: Extension %d " + "not found in enabled layer list extensions.", i); return VK_ERROR_EXTENSION_NOT_PRESENT; } @@ -4380,12 +4411,12 @@ VkResult loader_validate_device_extensions(struct loader_physical_device_tramp * struct loader_layer_properties *layer_prop; for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { - VkStringErrorFlags result = vk_string_validate(MaxLoaderStringLength, pCreateInfo->ppEnabledExtensionNames[i]); if (result != VK_STRING_ERROR_NONE) { - loader_log(phys_dev->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_validate_device_extensions: Device " - "ppEnabledExtensionNames contains " - "string that is too long or is badly formed"); + loader_log(phys_dev->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_validate_device_extensions: Device " + "ppEnabledExtensionNames contains " + "string that is too long or is badly formed"); return VK_ERROR_EXTENSION_NOT_PRESENT; } @@ -4409,8 +4440,9 @@ VkResult loader_validate_device_extensions(struct loader_physical_device_tramp * if (!extension_prop) { // Didn't find extension name in any of the device layers, error out - loader_log(phys_dev->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_validate_device_extensions: Extension %d " - "not found in enabled layer list extensions.", + loader_log(phys_dev->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "loader_validate_device_extensions: Extension %d " + "not found in enabled layer list extensions.", i); return VK_ERROR_EXTENSION_NOT_PRESENT; } @@ -4441,8 +4473,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI // just in the same library. filtered_extension_names = loader_stack_alloc(pCreateInfo->enabledExtensionCount * sizeof(char *)); if (!filtered_extension_names) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "terminator_CreateInstance: Failed create extension name " - "array for %d extensions", + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "terminator_CreateInstance: Failed create extension name " + "array for %d extensions", pCreateInfo->enabledExtensionCount); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -4452,8 +4485,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI for (uint32_t i = 0; i < ptr_instance->icd_tramp_list.count; i++) { icd_term = loader_icd_add(ptr_instance, &ptr_instance->icd_tramp_list.scanned_list[i]); if (NULL == icd_term) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "terminator_CreateInstance: Failed to add ICD %d to ICD " - "trampoline list.", + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "terminator_CreateInstance: Failed to add ICD %d to ICD " + "trampoline list.", i); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -4512,8 +4546,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } else if (VK_SUCCESS != icd_result) { - loader_log(ptr_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "terminator_CreateInstance: Failed to CreateInstance in " - "ICD %d. Skipping ICD.", + loader_log(ptr_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "terminator_CreateInstance: Failed to CreateInstance in " + "ICD %d. Skipping ICD.", i); ptr_instance->icd_terms = icd_term->next; icd_term->next = NULL; @@ -4670,8 +4705,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical filtered_extension_names[localCreateInfo.enabledExtensionCount] = (char *)extension_name; localCreateInfo.enabledExtensionCount++; } else { - loader_log(icd_term->this_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "vkCreateDevice extension %s not available for " - "devices associated with ICD %s", + loader_log(icd_term->this_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "vkCreateDevice extension %s not available for " + "devices associated with ICD %s", extension_name, icd_term->scanned_icd->lib_name); } } @@ -4718,8 +4754,9 @@ VkResult setupLoaderTrampPhysDevs(VkInstance instance) { new_phys_devs = (struct loader_physical_device_tramp **)loader_instance_heap_alloc( inst, total_count * sizeof(struct loader_physical_device_tramp *), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == new_phys_devs) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTrampPhysDevs: Failed to allocate new physical device" - " array of size %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "setupLoaderTrampPhysDevs: Failed to allocate new physical device" + " array of size %d", total_count); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -4730,8 +4767,9 @@ VkResult setupLoaderTrampPhysDevs(VkInstance instance) { // returned VkPhysicalDevice values. local_phys_devs = loader_stack_alloc(sizeof(VkPhysicalDevice) * total_count); if (NULL == local_phys_devs) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTrampPhysDevs: Failed to allocate local " - "physical device array of size %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "setupLoaderTrampPhysDevs: Failed to allocate local " + "physical device array of size %d", total_count); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -4740,15 +4778,15 @@ VkResult setupLoaderTrampPhysDevs(VkInstance instance) { res = inst->disp->layer_inst_disp.EnumeratePhysicalDevices(instance, &total_count, local_phys_devs); if (VK_SUCCESS != res) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTrampPhysDevs: Failed during dispatch call " - "of \'vkEnumeratePhysicalDevices\' to lower layers or " - "loader."); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "setupLoaderTrampPhysDevs: Failed during dispatch call " + "of \'vkEnumeratePhysicalDevices\' to lower layers or " + "loader."); goto out; } // Copy or create everything to fill the new array of physical devices for (uint32_t new_idx = 0; new_idx < total_count; new_idx++) { - // Check if this physical device is already in the old buffer for (uint32_t old_idx = 0; old_idx < inst->phys_dev_count_tramp; old_idx++) { if (local_phys_devs[new_idx] == inst->phys_devs_tramp[old_idx]->phys_dev) { @@ -4762,8 +4800,9 @@ VkResult setupLoaderTrampPhysDevs(VkInstance instance) { new_phys_devs[new_idx] = (struct loader_physical_device_tramp *)loader_instance_heap_alloc( inst, sizeof(struct loader_physical_device_tramp), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == new_phys_devs[new_idx]) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTrampPhysDevs: Failed to allocate " - "physical device trampoline object %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "setupLoaderTrampPhysDevs: Failed to allocate " + "physical device trampoline object %d", new_idx); total_count = new_idx; res = VK_ERROR_OUT_OF_HOST_MEMORY; @@ -4828,8 +4867,9 @@ VkResult setupLoaderTermPhysDevs(struct loader_instance *inst) { icd_phys_dev_array = (struct loader_phys_dev_per_icd *)loader_stack_alloc(sizeof(struct loader_phys_dev_per_icd) * inst->total_icd_count); if (NULL == icd_phys_dev_array) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTermPhysDevs: Failed to allocate temporary " - "ICD Physical device info array of size %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "setupLoaderTermPhysDevs: Failed to allocate temporary " + "ICD Physical device info array of size %d", inst->total_gpu_count); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -4842,9 +4882,10 @@ VkResult setupLoaderTermPhysDevs(struct loader_instance *inst) { while (NULL != icd_term) { res = icd_term->EnumeratePhysicalDevices(icd_term->instance, &icd_phys_dev_array[i].count, NULL); if (VK_SUCCESS != res) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTermPhysDevs: Call to " - "ICD %d's \'vkEnumeratePhysicalDevices\' failed with" - " error 0x%08x", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "setupLoaderTermPhysDevs: Call to " + "ICD %d's \'vkEnumeratePhysicalDevices\' failed with" + " error 0x%08x", i, res); goto out; } @@ -4852,8 +4893,9 @@ VkResult setupLoaderTermPhysDevs(struct loader_instance *inst) { icd_phys_dev_array[i].phys_devs = (VkPhysicalDevice *)loader_stack_alloc(icd_phys_dev_array[i].count * sizeof(VkPhysicalDevice)); if (NULL == icd_phys_dev_array[i].phys_devs) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTermPhysDevs: Failed to allocate temporary " - "ICD Physical device array for ICD %d of size %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "setupLoaderTermPhysDevs: Failed to allocate temporary " + "ICD Physical device array for ICD %d of size %d", i, inst->total_gpu_count); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -4872,8 +4914,9 @@ VkResult setupLoaderTermPhysDevs(struct loader_instance *inst) { } if (0 == inst->total_gpu_count) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTermPhysDevs: Failed to detect any valid" - " GPUs in the current config"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "setupLoaderTermPhysDevs: Failed to detect any valid" + " GPUs in the current config"); res = VK_ERROR_INITIALIZATION_FAILED; goto out; } @@ -4881,8 +4924,9 @@ VkResult setupLoaderTermPhysDevs(struct loader_instance *inst) { new_phys_devs = loader_instance_heap_alloc(inst, sizeof(struct loader_physical_device_term *) * inst->total_gpu_count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == new_phys_devs) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTermPhysDevs: Failed to allocate new physical" - " device array of size %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "setupLoaderTermPhysDevs: Failed to allocate new physical" + " device array of size %d", inst->total_gpu_count); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -4893,7 +4937,6 @@ VkResult setupLoaderTermPhysDevs(struct loader_instance *inst) { uint32_t idx = 0; for (uint32_t icd_idx = 0; icd_idx < inst->total_icd_count; icd_idx++) { for (uint32_t pd_idx = 0; pd_idx < icd_phys_dev_array[icd_idx].count; pd_idx++) { - // Check if this physical device is already in the old buffer if (NULL != inst->phys_devs_term) { for (uint32_t old_idx = 0; old_idx < inst->phys_dev_count_term; old_idx++) { @@ -4909,8 +4952,9 @@ VkResult setupLoaderTermPhysDevs(struct loader_instance *inst) { new_phys_devs[idx] = loader_instance_heap_alloc(inst, sizeof(struct loader_physical_device_term), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == new_phys_devs[idx]) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTermPhysDevs: Failed to allocate " - "physical device terminator object %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "setupLoaderTermPhysDevs: Failed to allocate " + "physical device terminator object %d", idx); inst->total_gpu_count = idx; res = VK_ERROR_OUT_OF_HOST_MEMORY; @@ -5185,8 +5229,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceLayerProperties(VkPhysi VkLayerProperties *pProperties) { struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "Encountered the vkEnumerateDeviceLayerProperties " - "terminator. This means a layer improperly continued."); + loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "Encountered the vkEnumerateDeviceLayerProperties " + "terminator. This means a layer improperly continued."); // Should never get here this call isn't dispatched down the chain return VK_ERROR_INITIALIZATION_FAILED; } diff --git a/loader/loader.h b/loader/loader.h index e355b553..fb0bc896 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -135,7 +135,7 @@ struct loader_layer_functions { struct loader_layer_properties { VkLayerProperties info; enum layer_type type; - uint32_t interface_version; // PFN_vkNegotiateLoaderLayerInterfaceVersion + uint32_t interface_version; // PFN_vkNegotiateLoaderLayerInterfaceVersion char lib_name[MAX_STRING_SIZE]; loader_platform_dl_handle lib_handle; struct loader_layer_functions functions; @@ -154,7 +154,7 @@ struct loader_layer_list { struct loader_dispatch_hash_list { size_t capacity; uint32_t count; - uint32_t *index; // index into the dev_ext dispatch table + uint32_t *index; // index into the dev_ext dispatch table }; // loader_dispatch_hash_entry and loader_dev_ext_dispatch_table.dev_ext have @@ -163,7 +163,7 @@ struct loader_dispatch_hash_list { // Also have a one to one correspondence with functions in dev_ext_trampoline.c struct loader_dispatch_hash_entry { char *func_name; - struct loader_dispatch_hash_list list; // to handle hashing collisions + struct loader_dispatch_hash_list list; // to handle hashing collisions }; typedef void(VKAPI_PTR *PFN_vkDevExt)(VkDevice device); @@ -179,8 +179,8 @@ struct loader_dev_dispatch_table { // per CreateDevice structure struct loader_device { struct loader_dev_dispatch_table loader_dispatch; - VkDevice chain_device; // device object from the dispatch chain - VkDevice icd_device; // device object from the icd + VkDevice chain_device; // device object from the dispatch chain + VkDevice icd_device; // device object from the icd struct loader_physical_device_term *phys_dev_term; struct loader_layer_list activated_layer_list; @@ -196,7 +196,7 @@ struct loader_icd_term { const struct loader_scanned_icd *scanned_icd; const struct loader_instance *this_instance; struct loader_device *logical_device_list; - VkInstance instance; // instance object from the icd + VkInstance instance; // instance object from the icd PFN_vkGetDeviceProcAddr GetDeviceProcAddr; PFN_vkDestroyInstance DestroyInstance; PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices; @@ -306,7 +306,7 @@ union loader_instance_extension_enables { }; struct loader_instance_dispatch_table { - VkLayerInstanceDispatchTable layer_inst_disp; // must be first entry in structure + VkLayerInstanceDispatchTable layer_inst_disp; // must be first entry in structure // Physical device functions unknown to the loader PFN_PhysDevExt phys_dev_ext[MAX_NUM_UNKNOWN_EXTS]; @@ -314,7 +314,7 @@ struct loader_instance_dispatch_table { // per instance structure struct loader_instance { - struct loader_instance_dispatch_table *disp; // must be first entry in structure + struct loader_instance_dispatch_table *disp; // must be first entry in structure uint32_t total_gpu_count; uint32_t phys_dev_count_term; @@ -336,9 +336,9 @@ struct loader_instance { struct loader_layer_list instance_layer_list; struct loader_layer_list activated_layer_list; bool activated_layers_are_std_val; - VkInstance instance; // layers/ICD instance returned to trampoline + VkInstance instance; // layers/ICD instance returned to trampoline - struct loader_extension_list ext_list; // icds and loaders extensions + struct loader_extension_list ext_list; // icds and loaders extensions union loader_instance_extension_enables enabled_known_extensions; VkLayerDbgFunctionNode *DbgFunctionHead; @@ -385,17 +385,17 @@ struct loader_instance { /* per enumerated PhysicalDevice structure, used to wrap in trampoline code and also same structure used to wrap in terminator code */ struct loader_physical_device_tramp { - struct loader_instance_dispatch_table *disp; // must be first entry in structure + struct loader_instance_dispatch_table *disp; // must be first entry in structure struct loader_instance *this_instance; - VkPhysicalDevice phys_dev; // object from layers/loader terminator + VkPhysicalDevice phys_dev; // object from layers/loader terminator }; /* per enumerated PhysicalDevice structure, used to wrap in terminator code */ struct loader_physical_device_term { - struct loader_instance_dispatch_table *disp; // must be first entry in structure + struct loader_instance_dispatch_table *disp; // must be first entry in structure struct loader_icd_term *this_icd_term; uint8_t icd_index; - VkPhysicalDevice phys_dev; // object from ICD + VkPhysicalDevice phys_dev; // object from ICD }; struct loader_struct { @@ -438,8 +438,9 @@ static inline struct loader_instance_dispatch_table *loader_get_instance_dispatc static inline void loader_init_dispatch(void *obj, const void *data) { #ifdef DEBUG - assert(valid_loader_magic_value(obj) && "Incompatible ICD, first dword must be initialized to " - "ICD_LOADER_MAGIC. See loader/README.md for details."); + assert(valid_loader_magic_value(obj) && + "Incompatible ICD, first dword must be initialized to " + "ICD_LOADER_MAGIC. See loader/README.md for details."); #endif loader_set_dispatch(obj, data); diff --git a/loader/murmurhash.c b/loader/murmurhash.c index 5e5d0de6..db6276f5 100644 --- a/loader/murmurhash.c +++ b/loader/murmurhash.c @@ -41,16 +41,16 @@ uint32_t murmurhash(const char *key, size_t len, uint32_t seed) { uint32_t n = 0xe6546b64; uint32_t h = 0; uint32_t k = 0; - uint8_t *d = (uint8_t *)key; // 32 bit extract from `key' + uint8_t *d = (uint8_t *)key; // 32 bit extract from `key' const uint32_t *chunks = NULL; - const uint8_t *tail = NULL; // tail - last 8 bytes + const uint8_t *tail = NULL; // tail - last 8 bytes int i = 0; - int l = (int)len / 4; // chunk length + int l = (int)len / 4; // chunk length h = seed; - chunks = (const uint32_t *)(d + l * 4); // body - tail = (const uint8_t *)(d + l * 4); // last 8 byte chunk of `key' + chunks = (const uint32_t *)(d + l * 4); // body + tail = (const uint8_t *)(d + l * 4); // last 8 byte chunk of `key' // for each 4 byte chunk of `key' for (i = -l; i != 0; ++i) { @@ -71,18 +71,18 @@ uint32_t murmurhash(const char *key, size_t len, uint32_t seed) { k = 0; // remainder - switch (len & 3) { // `len % 4' - case 3: - k ^= (tail[2] << 16); - case 2: - k ^= (tail[1] << 8); + switch (len & 3) { // `len % 4' + case 3: + k ^= (tail[2] << 16); + case 2: + k ^= (tail[1] << 8); - case 1: - k ^= tail[0]; - k *= c1; - k = (k << r1) | (k >> (32 - r1)); - k *= c2; - h ^= k; + case 1: + k ^= tail[0]; + k *= c1; + k = (k << r1) | (k >> (32 - r1)); + k *= c2; + h ^= k; } h ^= len; diff --git a/loader/phys_dev_ext.c b/loader/phys_dev_ext.c index cf2ada57..d668b1b9 100644 --- a/loader/phys_dev_ext.c +++ b/loader/phys_dev_ext.c @@ -30,28 +30,28 @@ #include "loader.h" #if defined(__GNUC__) && !defined(__clang__) -#pragma GCC optimize(3) // force gcc to use tail-calls +#pragma GCC optimize(3) // force gcc to use tail-calls #endif // Trampoline function macro for unknown physical device extension command. -#define PhysDevExtTramp(num) \ - VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp##num(VkPhysicalDevice physical_device) { \ - const struct loader_instance_dispatch_table *disp; \ - disp = loader_get_instance_dispatch(physical_device); \ - disp->phys_dev_ext[num](loader_unwrap_physical_device(physical_device)); \ +#define PhysDevExtTramp(num) \ + VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp##num(VkPhysicalDevice physical_device) { \ + const struct loader_instance_dispatch_table *disp; \ + disp = loader_get_instance_dispatch(physical_device); \ + disp->phys_dev_ext[num](loader_unwrap_physical_device(physical_device)); \ } // Terminator function macro for unknown physical device extension command. -#define PhysDevExtTermin(num) \ - VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin##num(VkPhysicalDevice physical_device) { \ - struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physical_device; \ - struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; \ - struct loader_instance *inst = (struct loader_instance *)icd_term->this_instance; \ - if (NULL == icd_term->phys_dev_ext[num]) { \ - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "Extension %s not supported for this physical device", \ - inst->phys_dev_ext_disp_hash[num].func_name); \ - } \ - icd_term->phys_dev_ext[num](phys_dev_term->phys_dev); \ +#define PhysDevExtTermin(num) \ + VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin##num(VkPhysicalDevice physical_device) { \ + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physical_device; \ + struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; \ + struct loader_instance *inst = (struct loader_instance *)icd_term->this_instance; \ + if (NULL == icd_term->phys_dev_ext[num]) { \ + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "Extension %s not supported for this physical device", \ + inst->phys_dev_ext_disp_hash[num].func_name); \ + } \ + icd_term->phys_dev_ext[num](phys_dev_term->phys_dev); \ } // Disable clang-format for lists of macros diff --git a/loader/table_ops.h b/loader/table_ops.h index 15a7e996..cb4f6227 100644 --- a/loader/table_ops.h +++ b/loader/table_ops.h @@ -44,8 +44,7 @@ static VkResult VKAPI_CALL vkDevExtError(VkDevice dev) { static inline void loader_init_device_dispatch_table(struct loader_dev_dispatch_table *dev_table, PFN_vkGetDeviceProcAddr gpa, VkDevice dev) { VkLayerDispatchTable *table = &dev_table->core_dispatch; - for (uint32_t i = 0; i < MAX_NUM_UNKNOWN_EXTS; i++) - dev_table->ext_dispatch.dev_ext[i] = (PFN_vkDevExt)vkDevExtError; + for (uint32_t i = 0; i < MAX_NUM_UNKNOWN_EXTS; i++) dev_table->ext_dispatch.dev_ext[i] = (PFN_vkDevExt)vkDevExtError; table->GetDeviceProcAddr = (PFN_vkGetDeviceProcAddr)gpa(dev, "vkGetDeviceProcAddr"); table->DestroyDevice = (PFN_vkDestroyDevice)gpa(dev, "vkDestroyDevice"); @@ -221,260 +220,134 @@ static inline void loader_init_device_extension_dispatch_table(struct loader_dev } static inline void *loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, const char *name) { - if (!name || name[0] != 'v' || name[1] != 'k') - return NULL; + if (!name || name[0] != 'v' || name[1] != 'k') return NULL; name += 2; - if (!strcmp(name, "GetDeviceProcAddr")) - return (void *)table->GetDeviceProcAddr; - if (!strcmp(name, "DestroyDevice")) - return (void *)table->DestroyDevice; - if (!strcmp(name, "GetDeviceQueue")) - return (void *)table->GetDeviceQueue; - if (!strcmp(name, "QueueSubmit")) - return (void *)table->QueueSubmit; - if (!strcmp(name, "QueueWaitIdle")) - return (void *)table->QueueWaitIdle; - if (!strcmp(name, "DeviceWaitIdle")) - return (void *)table->DeviceWaitIdle; - if (!strcmp(name, "AllocateMemory")) - return (void *)table->AllocateMemory; - if (!strcmp(name, "FreeMemory")) - return (void *)table->FreeMemory; - if (!strcmp(name, "MapMemory")) - return (void *)table->MapMemory; - if (!strcmp(name, "UnmapMemory")) - return (void *)table->UnmapMemory; - if (!strcmp(name, "FlushMappedMemoryRanges")) - return (void *)table->FlushMappedMemoryRanges; - if (!strcmp(name, "InvalidateMappedMemoryRanges")) - return (void *)table->InvalidateMappedMemoryRanges; - if (!strcmp(name, "GetDeviceMemoryCommitment")) - return (void *)table->GetDeviceMemoryCommitment; - if (!strcmp(name, "GetImageSparseMemoryRequirements")) - return (void *)table->GetImageSparseMemoryRequirements; - if (!strcmp(name, "GetBufferMemoryRequirements")) - return (void *)table->GetBufferMemoryRequirements; - if (!strcmp(name, "GetImageMemoryRequirements")) - return (void *)table->GetImageMemoryRequirements; - if (!strcmp(name, "BindBufferMemory")) - return (void *)table->BindBufferMemory; - if (!strcmp(name, "BindImageMemory")) - return (void *)table->BindImageMemory; - if (!strcmp(name, "QueueBindSparse")) - return (void *)table->QueueBindSparse; - if (!strcmp(name, "CreateFence")) - return (void *)table->CreateFence; - if (!strcmp(name, "DestroyFence")) - return (void *)table->DestroyFence; - if (!strcmp(name, "ResetFences")) - return (void *)table->ResetFences; - if (!strcmp(name, "GetFenceStatus")) - return (void *)table->GetFenceStatus; - if (!strcmp(name, "WaitForFences")) - return (void *)table->WaitForFences; - if (!strcmp(name, "CreateSemaphore")) - return (void *)table->CreateSemaphore; - if (!strcmp(name, "DestroySemaphore")) - return (void *)table->DestroySemaphore; - if (!strcmp(name, "CreateEvent")) - return (void *)table->CreateEvent; - if (!strcmp(name, "DestroyEvent")) - return (void *)table->DestroyEvent; - if (!strcmp(name, "GetEventStatus")) - return (void *)table->GetEventStatus; - if (!strcmp(name, "SetEvent")) - return (void *)table->SetEvent; - if (!strcmp(name, "ResetEvent")) - return (void *)table->ResetEvent; - if (!strcmp(name, "CreateQueryPool")) - return (void *)table->CreateQueryPool; - if (!strcmp(name, "DestroyQueryPool")) - return (void *)table->DestroyQueryPool; - if (!strcmp(name, "GetQueryPoolResults")) - return (void *)table->GetQueryPoolResults; - if (!strcmp(name, "CreateBuffer")) - return (void *)table->CreateBuffer; - if (!strcmp(name, "DestroyBuffer")) - return (void *)table->DestroyBuffer; - if (!strcmp(name, "CreateBufferView")) - return (void *)table->CreateBufferView; - if (!strcmp(name, "DestroyBufferView")) - return (void *)table->DestroyBufferView; - if (!strcmp(name, "CreateImage")) - return (void *)table->CreateImage; - if (!strcmp(name, "DestroyImage")) - return (void *)table->DestroyImage; - if (!strcmp(name, "GetImageSubresourceLayout")) - return (void *)table->GetImageSubresourceLayout; - if (!strcmp(name, "CreateImageView")) - return (void *)table->CreateImageView; - if (!strcmp(name, "DestroyImageView")) - return (void *)table->DestroyImageView; - if (!strcmp(name, "CreateShaderModule")) - return (void *)table->CreateShaderModule; - if (!strcmp(name, "DestroyShaderModule")) - return (void *)table->DestroyShaderModule; - if (!strcmp(name, "CreatePipelineCache")) - return (void *)vkCreatePipelineCache; - if (!strcmp(name, "DestroyPipelineCache")) - return (void *)vkDestroyPipelineCache; - if (!strcmp(name, "GetPipelineCacheData")) - return (void *)vkGetPipelineCacheData; - if (!strcmp(name, "MergePipelineCaches")) - return (void *)vkMergePipelineCaches; - if (!strcmp(name, "CreateGraphicsPipelines")) - return (void *)vkCreateGraphicsPipelines; - if (!strcmp(name, "CreateComputePipelines")) - return (void *)vkCreateComputePipelines; - if (!strcmp(name, "DestroyPipeline")) - return (void *)table->DestroyPipeline; - if (!strcmp(name, "CreatePipelineLayout")) - return (void *)table->CreatePipelineLayout; - if (!strcmp(name, "DestroyPipelineLayout")) - return (void *)table->DestroyPipelineLayout; - if (!strcmp(name, "CreateSampler")) - return (void *)table->CreateSampler; - if (!strcmp(name, "DestroySampler")) - return (void *)table->DestroySampler; - if (!strcmp(name, "CreateDescriptorSetLayout")) - return (void *)table->CreateDescriptorSetLayout; - if (!strcmp(name, "DestroyDescriptorSetLayout")) - return (void *)table->DestroyDescriptorSetLayout; - if (!strcmp(name, "CreateDescriptorPool")) - return (void *)table->CreateDescriptorPool; - if (!strcmp(name, "DestroyDescriptorPool")) - return (void *)table->DestroyDescriptorPool; - if (!strcmp(name, "ResetDescriptorPool")) - return (void *)table->ResetDescriptorPool; - if (!strcmp(name, "AllocateDescriptorSets")) - return (void *)table->AllocateDescriptorSets; - if (!strcmp(name, "FreeDescriptorSets")) - return (void *)table->FreeDescriptorSets; - if (!strcmp(name, "UpdateDescriptorSets")) - return (void *)table->UpdateDescriptorSets; - if (!strcmp(name, "CreateFramebuffer")) - return (void *)table->CreateFramebuffer; - if (!strcmp(name, "DestroyFramebuffer")) - return (void *)table->DestroyFramebuffer; - if (!strcmp(name, "CreateRenderPass")) - return (void *)table->CreateRenderPass; - if (!strcmp(name, "DestroyRenderPass")) - return (void *)table->DestroyRenderPass; - if (!strcmp(name, "GetRenderAreaGranularity")) - return (void *)table->GetRenderAreaGranularity; - if (!strcmp(name, "CreateCommandPool")) - return (void *)table->CreateCommandPool; - if (!strcmp(name, "DestroyCommandPool")) - return (void *)table->DestroyCommandPool; - if (!strcmp(name, "ResetCommandPool")) - return (void *)table->ResetCommandPool; - if (!strcmp(name, "AllocateCommandBuffers")) - return (void *)table->AllocateCommandBuffers; - if (!strcmp(name, "FreeCommandBuffers")) - return (void *)table->FreeCommandBuffers; - if (!strcmp(name, "BeginCommandBuffer")) - return (void *)table->BeginCommandBuffer; - if (!strcmp(name, "EndCommandBuffer")) - return (void *)table->EndCommandBuffer; - if (!strcmp(name, "ResetCommandBuffer")) - return (void *)table->ResetCommandBuffer; - if (!strcmp(name, "CmdBindPipeline")) - return (void *)table->CmdBindPipeline; - if (!strcmp(name, "CmdSetViewport")) - return (void *)table->CmdSetViewport; - if (!strcmp(name, "CmdSetScissor")) - return (void *)table->CmdSetScissor; - if (!strcmp(name, "CmdSetLineWidth")) - return (void *)table->CmdSetLineWidth; - if (!strcmp(name, "CmdSetDepthBias")) - return (void *)table->CmdSetDepthBias; - if (!strcmp(name, "CmdSetBlendConstants")) - return (void *)table->CmdSetBlendConstants; - if (!strcmp(name, "CmdSetDepthBounds")) - return (void *)table->CmdSetDepthBounds; - if (!strcmp(name, "CmdSetStencilCompareMask")) - return (void *)table->CmdSetStencilCompareMask; - if (!strcmp(name, "CmdSetStencilwriteMask")) - return (void *)table->CmdSetStencilWriteMask; - if (!strcmp(name, "CmdSetStencilReference")) - return (void *)table->CmdSetStencilReference; - if (!strcmp(name, "CmdBindDescriptorSets")) - return (void *)table->CmdBindDescriptorSets; - if (!strcmp(name, "CmdBindVertexBuffers")) - return (void *)table->CmdBindVertexBuffers; - if (!strcmp(name, "CmdBindIndexBuffer")) - return (void *)table->CmdBindIndexBuffer; - if (!strcmp(name, "CmdDraw")) - return (void *)table->CmdDraw; - if (!strcmp(name, "CmdDrawIndexed")) - return (void *)table->CmdDrawIndexed; - if (!strcmp(name, "CmdDrawIndirect")) - return (void *)table->CmdDrawIndirect; - if (!strcmp(name, "CmdDrawIndexedIndirect")) - return (void *)table->CmdDrawIndexedIndirect; - if (!strcmp(name, "CmdDispatch")) - return (void *)table->CmdDispatch; - if (!strcmp(name, "CmdDispatchIndirect")) - return (void *)table->CmdDispatchIndirect; - if (!strcmp(name, "CmdCopyBuffer")) - return (void *)table->CmdCopyBuffer; - if (!strcmp(name, "CmdCopyImage")) - return (void *)table->CmdCopyImage; - if (!strcmp(name, "CmdBlitImage")) - return (void *)table->CmdBlitImage; - if (!strcmp(name, "CmdCopyBufferToImage")) - return (void *)table->CmdCopyBufferToImage; - if (!strcmp(name, "CmdCopyImageToBuffer")) - return (void *)table->CmdCopyImageToBuffer; - if (!strcmp(name, "CmdUpdateBuffer")) - return (void *)table->CmdUpdateBuffer; - if (!strcmp(name, "CmdFillBuffer")) - return (void *)table->CmdFillBuffer; - if (!strcmp(name, "CmdClearColorImage")) - return (void *)table->CmdClearColorImage; - if (!strcmp(name, "CmdClearDepthStencilImage")) - return (void *)table->CmdClearDepthStencilImage; - if (!strcmp(name, "CmdClearAttachments")) - return (void *)table->CmdClearAttachments; - if (!strcmp(name, "CmdResolveImage")) - return (void *)table->CmdResolveImage; - if (!strcmp(name, "CmdSetEvent")) - return (void *)table->CmdSetEvent; - if (!strcmp(name, "CmdResetEvent")) - return (void *)table->CmdResetEvent; - if (!strcmp(name, "CmdWaitEvents")) - return (void *)table->CmdWaitEvents; - if (!strcmp(name, "CmdPipelineBarrier")) - return (void *)table->CmdPipelineBarrier; - if (!strcmp(name, "CmdBeginQuery")) - return (void *)table->CmdBeginQuery; - if (!strcmp(name, "CmdEndQuery")) - return (void *)table->CmdEndQuery; - if (!strcmp(name, "CmdResetQueryPool")) - return (void *)table->CmdResetQueryPool; - if (!strcmp(name, "CmdWriteTimestamp")) - return (void *)table->CmdWriteTimestamp; - if (!strcmp(name, "CmdCopyQueryPoolResults")) - return (void *)table->CmdCopyQueryPoolResults; - if (!strcmp(name, "CmdPushConstants")) - return (void *)table->CmdPushConstants; - if (!strcmp(name, "CmdBeginRenderPass")) - return (void *)table->CmdBeginRenderPass; - if (!strcmp(name, "CmdNextSubpass")) - return (void *)table->CmdNextSubpass; - if (!strcmp(name, "CmdEndRenderPass")) - return (void *)table->CmdEndRenderPass; - if (!strcmp(name, "CmdExecuteCommands")) - return (void *)table->CmdExecuteCommands; - if (!strcmp(name, "DestroySwapchainKHR")) - return (void *)table->DestroySwapchainKHR; - if (!strcmp(name, "GetSwapchainImagesKHR")) - return (void *)table->GetSwapchainImagesKHR; - if (!strcmp(name, "AcquireNextImageKHR")) - return (void *)table->AcquireNextImageKHR; - if (!strcmp(name, "QueuePresentKHR")) - return (void *)table->QueuePresentKHR; + if (!strcmp(name, "GetDeviceProcAddr")) return (void *)table->GetDeviceProcAddr; + if (!strcmp(name, "DestroyDevice")) return (void *)table->DestroyDevice; + if (!strcmp(name, "GetDeviceQueue")) return (void *)table->GetDeviceQueue; + if (!strcmp(name, "QueueSubmit")) return (void *)table->QueueSubmit; + if (!strcmp(name, "QueueWaitIdle")) return (void *)table->QueueWaitIdle; + if (!strcmp(name, "DeviceWaitIdle")) return (void *)table->DeviceWaitIdle; + if (!strcmp(name, "AllocateMemory")) return (void *)table->AllocateMemory; + if (!strcmp(name, "FreeMemory")) return (void *)table->FreeMemory; + if (!strcmp(name, "MapMemory")) return (void *)table->MapMemory; + if (!strcmp(name, "UnmapMemory")) return (void *)table->UnmapMemory; + if (!strcmp(name, "FlushMappedMemoryRanges")) return (void *)table->FlushMappedMemoryRanges; + if (!strcmp(name, "InvalidateMappedMemoryRanges")) return (void *)table->InvalidateMappedMemoryRanges; + if (!strcmp(name, "GetDeviceMemoryCommitment")) return (void *)table->GetDeviceMemoryCommitment; + if (!strcmp(name, "GetImageSparseMemoryRequirements")) return (void *)table->GetImageSparseMemoryRequirements; + if (!strcmp(name, "GetBufferMemoryRequirements")) return (void *)table->GetBufferMemoryRequirements; + if (!strcmp(name, "GetImageMemoryRequirements")) return (void *)table->GetImageMemoryRequirements; + if (!strcmp(name, "BindBufferMemory")) return (void *)table->BindBufferMemory; + if (!strcmp(name, "BindImageMemory")) return (void *)table->BindImageMemory; + if (!strcmp(name, "QueueBindSparse")) return (void *)table->QueueBindSparse; + if (!strcmp(name, "CreateFence")) return (void *)table->CreateFence; + if (!strcmp(name, "DestroyFence")) return (void *)table->DestroyFence; + if (!strcmp(name, "ResetFences")) return (void *)table->ResetFences; + if (!strcmp(name, "GetFenceStatus")) return (void *)table->GetFenceStatus; + if (!strcmp(name, "WaitForFences")) return (void *)table->WaitForFences; + if (!strcmp(name, "CreateSemaphore")) return (void *)table->CreateSemaphore; + if (!strcmp(name, "DestroySemaphore")) return (void *)table->DestroySemaphore; + if (!strcmp(name, "CreateEvent")) return (void *)table->CreateEvent; + if (!strcmp(name, "DestroyEvent")) return (void *)table->DestroyEvent; + if (!strcmp(name, "GetEventStatus")) return (void *)table->GetEventStatus; + if (!strcmp(name, "SetEvent")) return (void *)table->SetEvent; + if (!strcmp(name, "ResetEvent")) return (void *)table->ResetEvent; + if (!strcmp(name, "CreateQueryPool")) return (void *)table->CreateQueryPool; + if (!strcmp(name, "DestroyQueryPool")) return (void *)table->DestroyQueryPool; + if (!strcmp(name, "GetQueryPoolResults")) return (void *)table->GetQueryPoolResults; + if (!strcmp(name, "CreateBuffer")) return (void *)table->CreateBuffer; + if (!strcmp(name, "DestroyBuffer")) return (void *)table->DestroyBuffer; + if (!strcmp(name, "CreateBufferView")) return (void *)table->CreateBufferView; + if (!strcmp(name, "DestroyBufferView")) return (void *)table->DestroyBufferView; + if (!strcmp(name, "CreateImage")) return (void *)table->CreateImage; + if (!strcmp(name, "DestroyImage")) return (void *)table->DestroyImage; + if (!strcmp(name, "GetImageSubresourceLayout")) return (void *)table->GetImageSubresourceLayout; + if (!strcmp(name, "CreateImageView")) return (void *)table->CreateImageView; + if (!strcmp(name, "DestroyImageView")) return (void *)table->DestroyImageView; + if (!strcmp(name, "CreateShaderModule")) return (void *)table->CreateShaderModule; + if (!strcmp(name, "DestroyShaderModule")) return (void *)table->DestroyShaderModule; + if (!strcmp(name, "CreatePipelineCache")) return (void *)vkCreatePipelineCache; + if (!strcmp(name, "DestroyPipelineCache")) return (void *)vkDestroyPipelineCache; + if (!strcmp(name, "GetPipelineCacheData")) return (void *)vkGetPipelineCacheData; + if (!strcmp(name, "MergePipelineCaches")) return (void *)vkMergePipelineCaches; + if (!strcmp(name, "CreateGraphicsPipelines")) return (void *)vkCreateGraphicsPipelines; + if (!strcmp(name, "CreateComputePipelines")) return (void *)vkCreateComputePipelines; + if (!strcmp(name, "DestroyPipeline")) return (void *)table->DestroyPipeline; + if (!strcmp(name, "CreatePipelineLayout")) return (void *)table->CreatePipelineLayout; + if (!strcmp(name, "DestroyPipelineLayout")) return (void *)table->DestroyPipelineLayout; + if (!strcmp(name, "CreateSampler")) return (void *)table->CreateSampler; + if (!strcmp(name, "DestroySampler")) return (void *)table->DestroySampler; + if (!strcmp(name, "CreateDescriptorSetLayout")) return (void *)table->CreateDescriptorSetLayout; + if (!strcmp(name, "DestroyDescriptorSetLayout")) return (void *)table->DestroyDescriptorSetLayout; + if (!strcmp(name, "CreateDescriptorPool")) return (void *)table->CreateDescriptorPool; + if (!strcmp(name, "DestroyDescriptorPool")) return (void *)table->DestroyDescriptorPool; + if (!strcmp(name, "ResetDescriptorPool")) return (void *)table->ResetDescriptorPool; + if (!strcmp(name, "AllocateDescriptorSets")) return (void *)table->AllocateDescriptorSets; + if (!strcmp(name, "FreeDescriptorSets")) return (void *)table->FreeDescriptorSets; + if (!strcmp(name, "UpdateDescriptorSets")) return (void *)table->UpdateDescriptorSets; + if (!strcmp(name, "CreateFramebuffer")) return (void *)table->CreateFramebuffer; + if (!strcmp(name, "DestroyFramebuffer")) return (void *)table->DestroyFramebuffer; + if (!strcmp(name, "CreateRenderPass")) return (void *)table->CreateRenderPass; + if (!strcmp(name, "DestroyRenderPass")) return (void *)table->DestroyRenderPass; + if (!strcmp(name, "GetRenderAreaGranularity")) return (void *)table->GetRenderAreaGranularity; + if (!strcmp(name, "CreateCommandPool")) return (void *)table->CreateCommandPool; + if (!strcmp(name, "DestroyCommandPool")) return (void *)table->DestroyCommandPool; + if (!strcmp(name, "ResetCommandPool")) return (void *)table->ResetCommandPool; + if (!strcmp(name, "AllocateCommandBuffers")) return (void *)table->AllocateCommandBuffers; + if (!strcmp(name, "FreeCommandBuffers")) return (void *)table->FreeCommandBuffers; + if (!strcmp(name, "BeginCommandBuffer")) return (void *)table->BeginCommandBuffer; + if (!strcmp(name, "EndCommandBuffer")) return (void *)table->EndCommandBuffer; + if (!strcmp(name, "ResetCommandBuffer")) return (void *)table->ResetCommandBuffer; + if (!strcmp(name, "CmdBindPipeline")) return (void *)table->CmdBindPipeline; + if (!strcmp(name, "CmdSetViewport")) return (void *)table->CmdSetViewport; + if (!strcmp(name, "CmdSetScissor")) return (void *)table->CmdSetScissor; + if (!strcmp(name, "CmdSetLineWidth")) return (void *)table->CmdSetLineWidth; + if (!strcmp(name, "CmdSetDepthBias")) return (void *)table->CmdSetDepthBias; + if (!strcmp(name, "CmdSetBlendConstants")) return (void *)table->CmdSetBlendConstants; + if (!strcmp(name, "CmdSetDepthBounds")) return (void *)table->CmdSetDepthBounds; + if (!strcmp(name, "CmdSetStencilCompareMask")) return (void *)table->CmdSetStencilCompareMask; + if (!strcmp(name, "CmdSetStencilwriteMask")) return (void *)table->CmdSetStencilWriteMask; + if (!strcmp(name, "CmdSetStencilReference")) return (void *)table->CmdSetStencilReference; + if (!strcmp(name, "CmdBindDescriptorSets")) return (void *)table->CmdBindDescriptorSets; + if (!strcmp(name, "CmdBindVertexBuffers")) return (void *)table->CmdBindVertexBuffers; + if (!strcmp(name, "CmdBindIndexBuffer")) return (void *)table->CmdBindIndexBuffer; + if (!strcmp(name, "CmdDraw")) return (void *)table->CmdDraw; + if (!strcmp(name, "CmdDrawIndexed")) return (void *)table->CmdDrawIndexed; + if (!strcmp(name, "CmdDrawIndirect")) return (void *)table->CmdDrawIndirect; + if (!strcmp(name, "CmdDrawIndexedIndirect")) return (void *)table->CmdDrawIndexedIndirect; + if (!strcmp(name, "CmdDispatch")) return (void *)table->CmdDispatch; + if (!strcmp(name, "CmdDispatchIndirect")) return (void *)table->CmdDispatchIndirect; + if (!strcmp(name, "CmdCopyBuffer")) return (void *)table->CmdCopyBuffer; + if (!strcmp(name, "CmdCopyImage")) return (void *)table->CmdCopyImage; + if (!strcmp(name, "CmdBlitImage")) return (void *)table->CmdBlitImage; + if (!strcmp(name, "CmdCopyBufferToImage")) return (void *)table->CmdCopyBufferToImage; + if (!strcmp(name, "CmdCopyImageToBuffer")) return (void *)table->CmdCopyImageToBuffer; + if (!strcmp(name, "CmdUpdateBuffer")) return (void *)table->CmdUpdateBuffer; + if (!strcmp(name, "CmdFillBuffer")) return (void *)table->CmdFillBuffer; + if (!strcmp(name, "CmdClearColorImage")) return (void *)table->CmdClearColorImage; + if (!strcmp(name, "CmdClearDepthStencilImage")) return (void *)table->CmdClearDepthStencilImage; + if (!strcmp(name, "CmdClearAttachments")) return (void *)table->CmdClearAttachments; + if (!strcmp(name, "CmdResolveImage")) return (void *)table->CmdResolveImage; + if (!strcmp(name, "CmdSetEvent")) return (void *)table->CmdSetEvent; + if (!strcmp(name, "CmdResetEvent")) return (void *)table->CmdResetEvent; + if (!strcmp(name, "CmdWaitEvents")) return (void *)table->CmdWaitEvents; + if (!strcmp(name, "CmdPipelineBarrier")) return (void *)table->CmdPipelineBarrier; + if (!strcmp(name, "CmdBeginQuery")) return (void *)table->CmdBeginQuery; + if (!strcmp(name, "CmdEndQuery")) return (void *)table->CmdEndQuery; + if (!strcmp(name, "CmdResetQueryPool")) return (void *)table->CmdResetQueryPool; + if (!strcmp(name, "CmdWriteTimestamp")) return (void *)table->CmdWriteTimestamp; + if (!strcmp(name, "CmdCopyQueryPoolResults")) return (void *)table->CmdCopyQueryPoolResults; + if (!strcmp(name, "CmdPushConstants")) return (void *)table->CmdPushConstants; + if (!strcmp(name, "CmdBeginRenderPass")) return (void *)table->CmdBeginRenderPass; + if (!strcmp(name, "CmdNextSubpass")) return (void *)table->CmdNextSubpass; + if (!strcmp(name, "CmdEndRenderPass")) return (void *)table->CmdEndRenderPass; + if (!strcmp(name, "CmdExecuteCommands")) return (void *)table->CmdExecuteCommands; + if (!strcmp(name, "DestroySwapchainKHR")) return (void *)table->DestroySwapchainKHR; + if (!strcmp(name, "GetSwapchainImagesKHR")) return (void *)table->GetSwapchainImagesKHR; + if (!strcmp(name, "AcquireNextImageKHR")) return (void *)table->AcquireNextImageKHR; + if (!strcmp(name, "QueuePresentKHR")) return (void *)table->QueuePresentKHR; // NOTE: Device Funcs needing Trampoline/Terminator. // Overrides for device functions needing a trampoline and @@ -608,48 +481,36 @@ static inline void loader_init_instance_extension_dispatch_table(VkLayerInstance static inline void *loader_lookup_instance_extension_dispatch_table(const VkLayerInstanceDispatchTable *table, const char *name, bool *found_name) { - *found_name = true; // KHR_get_physical_device_properties2 - if (!strcmp(name, "GetPhysicalDeviceFeatures2KHR")) - return (void *)table->GetPhysicalDeviceFeatures2KHR; - if (!strcmp(name, "GetPhysicalDeviceProperties2KHR")) - return (void *)table->GetPhysicalDeviceProperties2KHR; - if (!strcmp(name, "GetPhysicalDeviceFormatProperties2KHR")) - return (void *)table->GetPhysicalDeviceFormatProperties2KHR; + if (!strcmp(name, "GetPhysicalDeviceFeatures2KHR")) return (void *)table->GetPhysicalDeviceFeatures2KHR; + if (!strcmp(name, "GetPhysicalDeviceProperties2KHR")) return (void *)table->GetPhysicalDeviceProperties2KHR; + if (!strcmp(name, "GetPhysicalDeviceFormatProperties2KHR")) return (void *)table->GetPhysicalDeviceFormatProperties2KHR; if (!strcmp(name, "GetPhysicalDeviceImageFormatProperties2KHR")) return (void *)table->GetPhysicalDeviceImageFormatProperties2KHR; if (!strcmp(name, "GetPhysicalDeviceQueueFamilyProperties2KHR")) return (void *)table->GetPhysicalDeviceQueueFamilyProperties2KHR; - if (!strcmp(name, "GetPhysicalDeviceMemoryProperties2KHR")) - return (void *)table->GetPhysicalDeviceMemoryProperties2KHR; + if (!strcmp(name, "GetPhysicalDeviceMemoryProperties2KHR")) return (void *)table->GetPhysicalDeviceMemoryProperties2KHR; if (!strcmp(name, "GetPhysicalDeviceSparseImageFormatProperties2KHR")) return (void *)table->GetPhysicalDeviceSparseImageFormatProperties2KHR; // EXT_acquire_xlib_display #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT - if (!strcmp(name, "AcquireXlibDisplayEXT")) - return (void *)table->AcquireXlibDisplayEXT; - if (!strcmp(name, "GetRandROutputDisplayEXT")) - return (void *)table->GetRandROutputDisplayEXT; + if (!strcmp(name, "AcquireXlibDisplayEXT")) return (void *)table->AcquireXlibDisplayEXT; + if (!strcmp(name, "GetRandROutputDisplayEXT")) return (void *)table->GetRandROutputDisplayEXT; #endif // EXT_debug_report - if (!strcmp(name, "CreateDebugReportCallbackEXT")) - return (void *)table->CreateDebugReportCallbackEXT; - if (!strcmp(name, "DestroyDebugReportCallbackEXT")) - return (void *)table->DestroyDebugReportCallbackEXT; - if (!strcmp(name, "DebugReportMessageEXT")) - return (void *)table->DebugReportMessageEXT; + if (!strcmp(name, "CreateDebugReportCallbackEXT")) return (void *)table->CreateDebugReportCallbackEXT; + if (!strcmp(name, "DestroyDebugReportCallbackEXT")) return (void *)table->DestroyDebugReportCallbackEXT; + if (!strcmp(name, "DebugReportMessageEXT")) return (void *)table->DebugReportMessageEXT; // EXT_direct_mode_display - if (!strcmp(name, "ReleaseDisplayEXT")) - return (void *)table->ReleaseDisplayEXT; + if (!strcmp(name, "ReleaseDisplayEXT")) return (void *)table->ReleaseDisplayEXT; // EXT_display_surface_counter - if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilities2EXT")) - return (void *)table->GetPhysicalDeviceSurfaceCapabilities2EXT; + if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilities2EXT")) return (void *)table->GetPhysicalDeviceSurfaceCapabilities2EXT; // NV_external_memory_capabilities if (!strcmp(name, "GetPhysicalDeviceExternalImageFormatPropertiesNV")) @@ -672,84 +533,57 @@ static inline void *loader_lookup_instance_dispatch_table(const VkLayerInstanceD *found_name = true; name += 2; - if (!strcmp(name, "DestroyInstance")) - return (void *)table->DestroyInstance; - if (!strcmp(name, "EnumeratePhysicalDevices")) - return (void *)table->EnumeratePhysicalDevices; - if (!strcmp(name, "GetPhysicalDeviceFeatures")) - return (void *)table->GetPhysicalDeviceFeatures; - if (!strcmp(name, "GetPhysicalDeviceImageFormatProperties")) - return (void *)table->GetPhysicalDeviceImageFormatProperties; - if (!strcmp(name, "GetPhysicalDeviceFormatProperties")) - return (void *)table->GetPhysicalDeviceFormatProperties; + if (!strcmp(name, "DestroyInstance")) return (void *)table->DestroyInstance; + if (!strcmp(name, "EnumeratePhysicalDevices")) return (void *)table->EnumeratePhysicalDevices; + if (!strcmp(name, "GetPhysicalDeviceFeatures")) return (void *)table->GetPhysicalDeviceFeatures; + if (!strcmp(name, "GetPhysicalDeviceImageFormatProperties")) return (void *)table->GetPhysicalDeviceImageFormatProperties; + if (!strcmp(name, "GetPhysicalDeviceFormatProperties")) return (void *)table->GetPhysicalDeviceFormatProperties; if (!strcmp(name, "GetPhysicalDeviceSparseImageFormatProperties")) return (void *)table->GetPhysicalDeviceSparseImageFormatProperties; - if (!strcmp(name, "GetPhysicalDeviceProperties")) - return (void *)table->GetPhysicalDeviceProperties; - if (!strcmp(name, "GetPhysicalDeviceQueueFamilyProperties")) - return (void *)table->GetPhysicalDeviceQueueFamilyProperties; - if (!strcmp(name, "GetPhysicalDeviceMemoryProperties")) - return (void *)table->GetPhysicalDeviceMemoryProperties; - if (!strcmp(name, "GetInstanceProcAddr")) - return (void *)table->GetInstanceProcAddr; - if (!strcmp(name, "EnumerateDeviceExtensionProperties")) - return (void *)table->EnumerateDeviceExtensionProperties; - if (!strcmp(name, "EnumerateDeviceLayerProperties")) - return (void *)table->EnumerateDeviceLayerProperties; - if (!strcmp(name, "DestroySurfaceKHR")) - return (void *)table->DestroySurfaceKHR; - if (!strcmp(name, "GetPhysicalDeviceSurfaceSupportKHR")) - return (void *)table->GetPhysicalDeviceSurfaceSupportKHR; - if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilitiesKHR")) - return (void *)table->GetPhysicalDeviceSurfaceCapabilitiesKHR; - if (!strcmp(name, "GetPhysicalDeviceSurfaceFormatsKHR")) - return (void *)table->GetPhysicalDeviceSurfaceFormatsKHR; - if (!strcmp(name, "GetPhysicalDeviceSurfacePresentModesKHR")) - return (void *)table->GetPhysicalDeviceSurfacePresentModesKHR; + if (!strcmp(name, "GetPhysicalDeviceProperties")) return (void *)table->GetPhysicalDeviceProperties; + if (!strcmp(name, "GetPhysicalDeviceQueueFamilyProperties")) return (void *)table->GetPhysicalDeviceQueueFamilyProperties; + if (!strcmp(name, "GetPhysicalDeviceMemoryProperties")) return (void *)table->GetPhysicalDeviceMemoryProperties; + if (!strcmp(name, "GetInstanceProcAddr")) return (void *)table->GetInstanceProcAddr; + if (!strcmp(name, "EnumerateDeviceExtensionProperties")) return (void *)table->EnumerateDeviceExtensionProperties; + if (!strcmp(name, "EnumerateDeviceLayerProperties")) return (void *)table->EnumerateDeviceLayerProperties; + if (!strcmp(name, "DestroySurfaceKHR")) return (void *)table->DestroySurfaceKHR; + if (!strcmp(name, "GetPhysicalDeviceSurfaceSupportKHR")) return (void *)table->GetPhysicalDeviceSurfaceSupportKHR; + if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilitiesKHR")) return (void *)table->GetPhysicalDeviceSurfaceCapabilitiesKHR; + if (!strcmp(name, "GetPhysicalDeviceSurfaceFormatsKHR")) return (void *)table->GetPhysicalDeviceSurfaceFormatsKHR; + if (!strcmp(name, "GetPhysicalDeviceSurfacePresentModesKHR")) return (void *)table->GetPhysicalDeviceSurfacePresentModesKHR; #ifdef VK_USE_PLATFORM_MIR_KHR - if (!strcmp(name, "CreateMirSurfaceKHR")) - return (void *)table->CreateMirSurfaceKHR; + if (!strcmp(name, "CreateMirSurfaceKHR")) return (void *)table->CreateMirSurfaceKHR; if (!strcmp(name, "GetPhysicalDeviceMirPresentationSupportKHR")) return (void *)table->GetPhysicalDeviceMirPresentationSupportKHR; #endif #ifdef VK_USE_PLATFORM_WAYLAND_KHR - if (!strcmp(name, "CreateWaylandSurfaceKHR")) - return (void *)table->CreateWaylandSurfaceKHR; + if (!strcmp(name, "CreateWaylandSurfaceKHR")) return (void *)table->CreateWaylandSurfaceKHR; if (!strcmp(name, "GetPhysicalDeviceWaylandPresentationSupportKHR")) return (void *)table->GetPhysicalDeviceWaylandPresentationSupportKHR; #endif #ifdef VK_USE_PLATFORM_WIN32_KHR - if (!strcmp(name, "CreateWin32SurfaceKHR")) - return (void *)table->CreateWin32SurfaceKHR; + if (!strcmp(name, "CreateWin32SurfaceKHR")) return (void *)table->CreateWin32SurfaceKHR; if (!strcmp(name, "GetPhysicalDeviceWin32PresentationSupportKHR")) return (void *)table->GetPhysicalDeviceWin32PresentationSupportKHR; #endif #ifdef VK_USE_PLATFORM_XCB_KHR - if (!strcmp(name, "CreateXcbSurfaceKHR")) - return (void *)table->CreateXcbSurfaceKHR; + if (!strcmp(name, "CreateXcbSurfaceKHR")) return (void *)table->CreateXcbSurfaceKHR; if (!strcmp(name, "GetPhysicalDeviceXcbPresentationSupportKHR")) return (void *)table->GetPhysicalDeviceXcbPresentationSupportKHR; #endif #ifdef VK_USE_PLATFORM_XLIB_KHR - if (!strcmp(name, "CreateXlibSurfaceKHR")) - return (void *)table->CreateXlibSurfaceKHR; + if (!strcmp(name, "CreateXlibSurfaceKHR")) return (void *)table->CreateXlibSurfaceKHR; if (!strcmp(name, "GetPhysicalDeviceXlibPresentationSupportKHR")) return (void *)table->GetPhysicalDeviceXlibPresentationSupportKHR; #endif - if (!strcmp(name, "GetPhysicalDeviceDisplayPropertiesKHR")) - return (void *)table->GetPhysicalDeviceDisplayPropertiesKHR; + if (!strcmp(name, "GetPhysicalDeviceDisplayPropertiesKHR")) return (void *)table->GetPhysicalDeviceDisplayPropertiesKHR; if (!strcmp(name, "GetPhysicalDeviceDisplayPlanePropertiesKHR")) return (void *)table->GetPhysicalDeviceDisplayPlanePropertiesKHR; - if (!strcmp(name, "GetDisplayPlaneSupportedDisplaysKHR")) - return (void *)table->GetDisplayPlaneSupportedDisplaysKHR; - if (!strcmp(name, "GetDisplayModePropertiesKHR")) - return (void *)table->GetDisplayModePropertiesKHR; - if (!strcmp(name, "CreateDisplayModeKHR")) - return (void *)table->CreateDisplayModeKHR; - if (!strcmp(name, "GetDisplayPlaneCapabilitiesKHR")) - return (void *)table->GetDisplayPlaneCapabilitiesKHR; - if (!strcmp(name, "CreateDisplayPlaneSurfaceKHR")) - return (void *)table->CreateDisplayPlaneSurfaceKHR; + if (!strcmp(name, "GetDisplayPlaneSupportedDisplaysKHR")) return (void *)table->GetDisplayPlaneSupportedDisplaysKHR; + if (!strcmp(name, "GetDisplayModePropertiesKHR")) return (void *)table->GetDisplayModePropertiesKHR; + if (!strcmp(name, "CreateDisplayModeKHR")) return (void *)table->CreateDisplayModeKHR; + if (!strcmp(name, "GetDisplayPlaneCapabilitiesKHR")) return (void *)table->GetDisplayPlaneCapabilitiesKHR; + if (!strcmp(name, "CreateDisplayPlaneSurfaceKHR")) return (void *)table->CreateDisplayPlaneSurfaceKHR; return loader_lookup_instance_extension_dispatch_table(table, name, found_name); } diff --git a/loader/trampoline.c b/loader/trampoline.c index 31352ae9..23a1b702 100644 --- a/loader/trampoline.c +++ b/loader/trampoline.c @@ -46,7 +46,6 @@ * functions both core and extensions. */ LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *pName) { - void *addr; addr = globalGetProcAddr(pName); @@ -56,13 +55,11 @@ LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkI return addr; } else { // if a global entrypoint return NULL - if (addr) - return NULL; + if (addr) return NULL; } struct loader_instance *ptr_instance = loader_get_instance(instance); - if (ptr_instance == NULL) - return NULL; + if (ptr_instance == NULL) return NULL; // Return trampoline code for non-global entrypoints including any // extensions. // Device extensions are returned if a layer or ICD supports the extension. @@ -94,20 +91,16 @@ LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDev /* Although CreateDevice is on device chain it's dispatchable object isn't * a VkDevice or child of VkDevice so return NULL. */ - if (!strcmp(pName, "CreateDevice")) - return NULL; + if (!strcmp(pName, "CreateDevice")) return NULL; /* return the dispatch table entrypoint for the fastest case */ const VkLayerDispatchTable *disp_table = *(VkLayerDispatchTable **)device; - if (disp_table == NULL) - return NULL; + if (disp_table == NULL) return NULL; addr = loader_lookup_device_dispatch_table(disp_table, pName); - if (addr) - return addr; + if (addr) return addr; - if (disp_table->GetDeviceProcAddr == NULL) - return NULL; + if (disp_table->GetDeviceProcAddr == NULL) return NULL; return disp_table->GetDeviceProcAddr(device, pName); } @@ -129,8 +122,9 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionPropert /* get layer libraries if needed */ if (pLayerName && strlen(pLayerName) != 0) { if (vk_string_validate(MaxLoaderStringLength, pLayerName) != VK_STRING_ERROR_NONE) { - assert(VK_FALSE && "vkEnumerateInstanceExtensionProperties: " - "pLayerName is too long or is badly formed"); + assert(VK_FALSE && + "vkEnumerateInstanceExtensionProperties: " + "pLayerName is too long or is badly formed"); res = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -213,7 +207,6 @@ out: LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount, VkLayerProperties *pProperties) { - struct loader_layer_list instance_layer_list; tls_instance = NULL; @@ -351,8 +344,9 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr ptr_instance->disp = loader_instance_heap_alloc(ptr_instance, sizeof(VkLayerInstanceDispatchTable), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (ptr_instance->disp == NULL) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkCreateInstance: Failed to allocate Instance dispatch" - " table."); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "vkCreateInstance: Failed to allocate Instance dispatch" + " table."); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } @@ -494,8 +488,9 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstan // structures in the loader. res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); if (VK_SUCCESS != res) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkEnumeratePhysicalDevices: Failed in dispatch call" - " used to determine number of available GPUs"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "vkEnumeratePhysicalDevices: Failed in dispatch call" + " used to determine number of available GPUs"); } } @@ -512,8 +507,9 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstan // Wrap the PhysDev object for loader usage, return wrapped objects if (inst->total_gpu_count > *pPhysicalDeviceCount) { - loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "vkEnumeratePhysicalDevices: Trimming device count down" - " by application request from %d to %d physical devices", + loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, + "vkEnumeratePhysicalDevices: Trimming device count down" + " by application request from %d to %d physical devices", inst->total_gpu_count, *pPhysicalDeviceCount); count = *pPhysicalDeviceCount; res = VK_INCOMPLETE; @@ -632,8 +628,9 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice phy dev->activated_layer_list.list = loader_device_heap_alloc(dev, inst->activated_layer_list.capacity, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE); if (dev->activated_layer_list.list == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkCreateDevice: Failed to allocate activated layer" - "list of size %d.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "vkCreateDevice: Failed to allocate activated layer" + "list of size %d.", inst->activated_layer_list.capacity); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -714,7 +711,6 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionPropertie disp = loader_get_instance_layer_dispatch(physicalDevice); res = disp->EnumerateDeviceExtensionProperties(phys_dev->phys_dev, NULL, pPropertyCount, pProperties); } else { - uint32_t count; uint32_t copy_size; const struct loader_instance *inst = phys_dev->this_instance; @@ -766,8 +762,9 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionPropertie return VK_INCOMPLETE; } } else { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkEnumerateDeviceExtensionProperties: pLayerName " - "is too long or is badly formed"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "vkEnumerateDeviceExtensionProperties: pLayerName " + "is too long or is badly formed"); loader_platform_thread_unlock_mutex(&loader_lock); return VK_ERROR_EXTENSION_NOT_PRESENT; } @@ -796,8 +793,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(Vk const struct loader_instance *inst = phys_dev->this_instance; uint32_t count = inst->activated_layer_list.count; - if (inst->activated_layers_are_std_val) - count = count - std_val_count + 1; + if (inst->activated_layers_are_std_val) count = count - std_val_count + 1; if (pProperties == NULL) { *pPropertyCount = count; loader_platform_thread_unlock_mutex(&loader_lock); @@ -811,15 +807,15 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(Vk enabled_layers->capacity = enabled_layers->count * sizeof(struct loader_layer_properties); enabled_layers->list = loader_instance_heap_alloc(inst, enabled_layers->capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (!enabled_layers->list) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkEnumerateDeviceLayerProperties: Failed to allocate enabled" - "layer list of size %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "vkEnumerateDeviceLayerProperties: Failed to allocate enabled" + "layer list of size %d", enabled_layers->capacity); return VK_ERROR_OUT_OF_HOST_MEMORY; } uint32_t j = 0; for (uint32_t i = 0; i < inst->activated_layer_list.count; j++) { - if (loader_find_layer_name_array(inst->activated_layer_list.list[i].info.layerName, std_val_count, std_validation_names)) { struct loader_layer_properties props; diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h index e0af8965..8a70865d 100644 --- a/loader/vk_loader_platform.h +++ b/loader/vk_loader_platform.h @@ -25,7 +25,7 @@ #if defined(_WIN32) // WinSock2.h must be included *BEFORE* windows.h #include <WinSock2.h> -#endif // _WIN32 +#endif // _WIN32 #include "vulkan/vk_platform.h" #include "vulkan/vk_sdk_platform.h" @@ -77,14 +77,14 @@ #define EXTRA_ILAYERS_DATADIR_INFO #endif -#define DEFAULT_VK_DRIVERS_INFO \ - SYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR \ +#define DEFAULT_VK_DRIVERS_INFO \ + SYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR \ ":" DATADIR VULKAN_DIR VULKAN_ICDCONF_DIR EXTRA_DRIVERS_SYSCONFDIR_INFO EXTRA_DRIVERS_DATADIR_INFO -#define DEFAULT_VK_ELAYERS_INFO \ - SYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR \ +#define DEFAULT_VK_ELAYERS_INFO \ + SYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR \ ":" DATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR EXTRA_ELAYERS_SYSCONFDIR_INFO EXTRA_ELAYERS_DATADIR_INFO -#define DEFAULT_VK_ILAYERS_INFO \ - SYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR \ +#define DEFAULT_VK_ILAYERS_INFO \ + SYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR \ ":" DATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR EXTRA_ILAYERS_SYSCONFDIR_INFO EXTRA_ILAYERS_DATADIR_INFO #define DEFAULT_VK_DRIVERS_PATH "" @@ -165,7 +165,7 @@ static inline void loader_platform_thread_cond_broadcast(loader_platform_thread_ #define loader_stack_alloc(size) alloca(size) -#elif defined(_WIN32) // defined(__linux__) +#elif defined(_WIN32) // defined(__linux__) /* Windows-specific common code: */ // WinBase.h defines CreateSemaphore and synchapi.h defines CreateEvent // undefine them to avoid conflicts with VkLayerDispatchTable struct members. @@ -184,7 +184,7 @@ static inline void loader_platform_thread_cond_broadcast(loader_platform_thread_ #ifdef __cplusplus #include <iostream> #include <string> -#endif // __cplusplus +#endif // __cplusplus // VK Library Filenames, Paths, etc.: #define PATH_SEPARATOR ';' @@ -225,8 +225,7 @@ static inline char *loader_platform_dirname(char *path) { for (current = path; *current != '\0'; current = next) { next = strchr(current, DIRECTORY_SYMBOL); if (next == NULL) { - if (current != path) - *(current - 1) = '\0'; + if (current != path) *(current - 1) = '\0'; return path; } else { // Point one character past the DIRECTORY_SYMBOL: @@ -319,7 +318,7 @@ static void loader_platform_thread_cond_broadcast(loader_platform_thread_cond *p char *loader_get_registry_string(const HKEY hive, const LPCTSTR sub_key, const char *value); #define loader_stack_alloc(size) _alloca(size) -#else // defined(_WIN32) +#else // defined(_WIN32) #error The "loader_platform.h" file must be modified for this OS. @@ -330,7 +329,7 @@ char *loader_get_registry_string(const HKEY hive, const LPCTSTR sub_key, const c // NOTE: Other OS-specific changes are also needed for this OS. Search for // files with "WIN32" in it, as a quick way to find files that must be changed. -#endif // defined(_WIN32) +#endif // defined(_WIN32) // returns true if the given string appears to be a relative or absolute // path, as opposed to a bare filename. diff --git a/loader/wsi.c b/loader/wsi.c index a34498fe..257e1141 100644 --- a/loader/wsi.c +++ b/loader/wsi.c @@ -39,22 +39,22 @@ void wsi_create_instance(struct loader_instance *ptr_instance, const VkInstanceC #ifdef VK_USE_PLATFORM_WIN32_KHR ptr_instance->wsi_win32_surface_enabled = false; -#endif // VK_USE_PLATFORM_WIN32_KHR +#endif // VK_USE_PLATFORM_WIN32_KHR #ifdef VK_USE_PLATFORM_MIR_KHR ptr_instance->wsi_mir_surface_enabled = false; -#endif // VK_USE_PLATFORM_MIR_KHR +#endif // VK_USE_PLATFORM_MIR_KHR #ifdef VK_USE_PLATFORM_WAYLAND_KHR ptr_instance->wsi_wayland_surface_enabled = false; -#endif // VK_USE_PLATFORM_WAYLAND_KHR +#endif // VK_USE_PLATFORM_WAYLAND_KHR #ifdef VK_USE_PLATFORM_XCB_KHR ptr_instance->wsi_xcb_surface_enabled = false; -#endif // VK_USE_PLATFORM_XCB_KHR +#endif // VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XLIB_KHR ptr_instance->wsi_xlib_surface_enabled = false; -#endif // VK_USE_PLATFORM_XLIB_KHR +#endif // VK_USE_PLATFORM_XLIB_KHR #ifdef VK_USE_PLATFORM_ANDROID_KHR ptr_instance->wsi_android_surface_enabled = false; -#endif // VK_USE_PLATFORM_ANDROID_KHR +#endif // VK_USE_PLATFORM_ANDROID_KHR ptr_instance->wsi_display_enabled = false; @@ -68,37 +68,37 @@ void wsi_create_instance(struct loader_instance *ptr_instance, const VkInstanceC ptr_instance->wsi_win32_surface_enabled = true; continue; } -#endif // VK_USE_PLATFORM_WIN32_KHR +#endif // VK_USE_PLATFORM_WIN32_KHR #ifdef VK_USE_PLATFORM_MIR_KHR if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_MIR_SURFACE_EXTENSION_NAME) == 0) { ptr_instance->wsi_mir_surface_enabled = true; continue; } -#endif // VK_USE_PLATFORM_MIR_KHR +#endif // VK_USE_PLATFORM_MIR_KHR #ifdef VK_USE_PLATFORM_WAYLAND_KHR if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0) { ptr_instance->wsi_wayland_surface_enabled = true; continue; } -#endif // VK_USE_PLATFORM_WAYLAND_KHR +#endif // VK_USE_PLATFORM_WAYLAND_KHR #ifdef VK_USE_PLATFORM_XCB_KHR if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XCB_SURFACE_EXTENSION_NAME) == 0) { ptr_instance->wsi_xcb_surface_enabled = true; continue; } -#endif // VK_USE_PLATFORM_XCB_KHR +#endif // VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XLIB_KHR if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == 0) { ptr_instance->wsi_xlib_surface_enabled = true; continue; } -#endif // VK_USE_PLATFORM_XLIB_KHR +#endif // VK_USE_PLATFORM_XLIB_KHR #ifdef VK_USE_PLATFORM_ANDROID_KHR if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0) { ptr_instance->wsi_android_surface_enabled = true; continue; } -#endif // VK_USE_PLATFORM_ANDROID_KHR +#endif // VK_USE_PLATFORM_ANDROID_KHR if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DISPLAY_EXTENSION_NAME) == 0) { ptr_instance->wsi_display_enabled = true; continue; @@ -117,21 +117,17 @@ void wsi_create_instance(struct loader_instance *ptr_instance, const VkInstanceC // built to support the extension. bool wsi_unsupported_instance_extension(const VkExtensionProperties *ext_prop) { #ifndef VK_USE_PLATFORM_MIR_KHR - if (!strcmp(ext_prop->extensionName, "VK_KHR_mir_surface")) - return true; -#endif // VK_USE_PLATFORM_MIR_KHR + if (!strcmp(ext_prop->extensionName, "VK_KHR_mir_surface")) return true; +#endif // VK_USE_PLATFORM_MIR_KHR #ifndef VK_USE_PLATFORM_WAYLAND_KHR - if (!strcmp(ext_prop->extensionName, "VK_KHR_wayland_surface")) - return true; -#endif // VK_USE_PLATFORM_WAYLAND_KHR + if (!strcmp(ext_prop->extensionName, "VK_KHR_wayland_surface")) return true; +#endif // VK_USE_PLATFORM_WAYLAND_KHR #ifndef VK_USE_PLATFORM_XCB_KHR - if (!strcmp(ext_prop->extensionName, "VK_KHR_xcb_surface")) - return true; -#endif // VK_USE_PLATFORM_XCB_KHR + if (!strcmp(ext_prop->extensionName, "VK_KHR_xcb_surface")) return true; +#endif // VK_USE_PLATFORM_XCB_KHR #ifndef VK_USE_PLATFORM_XLIB_KHR - if (!strcmp(ext_prop->extensionName, "VK_KHR_xlib_surface")) - return true; -#endif // VK_USE_PLATFORM_XLIB_KHR + if (!strcmp(ext_prop->extensionName, "VK_KHR_xlib_surface")) return true; +#endif // VK_USE_PLATFORM_XLIB_KHR return false; } @@ -193,14 +189,14 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKH VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32 *pSupported) { - // First, check to ensure the appropriate extension was enabled: struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_VK_KHR_surface extension not enabled. " - "vkGetPhysicalDeviceSurfaceSupportKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_VK_KHR_surface extension not enabled. " + "vkGetPhysicalDeviceSurfaceSupportKHR not executed!\n"); return VK_SUCCESS; } @@ -222,7 +218,6 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceSupportKHR(VkP // This is the trampoline entrypoint for GetPhysicalDeviceSurfaceCapabilitiesKHR LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR( VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { - const VkLayerInstanceDispatchTable *disp; VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); @@ -235,20 +230,21 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilit VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { - // First, check to ensure the appropriate extension was enabled: struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_surface extension not enabled. " - "vkGetPhysicalDeviceSurfaceCapabilitiesKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_surface extension not enabled. " + "vkGetPhysicalDeviceSurfaceCapabilitiesKHR not executed!\n"); return VK_SUCCESS; } // Next, if so, proceed with the implementation of this function: - assert(pSurfaceCapabilities && "GetPhysicalDeviceSurfaceCapabilitiesKHR: " - "Error, null pSurfaceCapabilities"); + assert(pSurfaceCapabilities && + "GetPhysicalDeviceSurfaceCapabilitiesKHR: " + "Error, null pSurfaceCapabilities"); assert(icd_term->GetPhysicalDeviceSurfaceCapabilitiesKHR && "loader: null GetPhysicalDeviceSurfaceCapabilitiesKHR ICD pointer"); @@ -278,14 +274,14 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKH VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats) { - // First, check to ensure the appropriate extension was enabled: struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_surface extension not enabled. " - "vkGetPhysicalDeviceSurfaceFormatsKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_surface extension not enabled. " + "vkGetPhysicalDeviceSurfaceFormatsKHR not executed!\n"); return VK_SUCCESS; } @@ -321,20 +317,21 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentMo VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes) { - // First, check to ensure the appropriate extension was enabled: struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_surface extension not enabled. " - "vkGetPhysicalDeviceSurfacePresentModesKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_surface extension not enabled. " + "vkGetPhysicalDeviceSurfacePresentModesKHR not executed!\n"); return VK_SUCCESS; } // Next, if so, proceed with the implementation of this function: - assert(pPresentModeCount && "GetPhysicalDeviceSurfacePresentModesKHR: " - "Error, null pPresentModeCount"); + assert(pPresentModeCount && + "GetPhysicalDeviceSurfacePresentModesKHR: " + "Error, null pPresentModeCount"); assert(icd_term->GetPhysicalDeviceSurfacePresentModesKHR && "loader: null GetPhysicalDeviceSurfacePresentModesKHR ICD pointer"); @@ -474,8 +471,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR(VkInstance insta // First, check to ensure the appropriate extension was enabled: struct loader_instance *ptr_instance = loader_get_instance(instance); if (!ptr_instance->wsi_win32_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_win32_surface extension not enabled. " - "vkCreateWin32SurfaceKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_win32_surface extension not enabled. " + "vkCreateWin32SurfaceKHR not executed!\n"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -557,7 +555,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWin32PresentationSupp return icd_term->GetPhysicalDeviceWin32PresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex); } -#endif // VK_USE_PLATFORM_WIN32_KHR +#endif // VK_USE_PLATFORM_WIN32_KHR #ifdef VK_USE_PLATFORM_MIR_KHR @@ -586,8 +584,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMirSurfaceKHR(VkInstance instanc // First, check to ensure the appropriate extension was enabled: struct loader_instance *ptr_instance = loader_get_instance(instance); if (!ptr_instance->wsi_mir_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_mir_surface extension not enabled. " - "vkCreateMirSurfaceKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_mir_surface extension not enabled. " + "vkCreateMirSurfaceKHR not executed!\n"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -653,14 +652,14 @@ LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationS VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, MirConnection *connection) { - // First, check to ensure the appropriate extension was enabled: struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_mir_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_mir_surface extension not enabled. " - "vkGetPhysicalDeviceMirPresentationSupportKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_mir_surface extension not enabled. " + "vkGetPhysicalDeviceMirPresentationSupportKHR not executed!\n"); return VK_SUCCESS; } @@ -670,7 +669,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceMirPresentationSuppor return icd_term->GetPhysicalDeviceMirPresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, connection); } -#endif // VK_USE_PLATFORM_MIR_KHR +#endif // VK_USE_PLATFORM_MIR_KHR #ifdef VK_USE_PLATFORM_WAYLAND_KHR @@ -701,8 +700,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(VkInstance ins // First, check to ensure the appropriate extension was enabled: struct loader_instance *ptr_instance = loader_get_instance(instance); if (!ptr_instance->wsi_wayland_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_wayland_surface extension not enabled. " - "vkCreateWaylandSurfaceKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_wayland_surface extension not enabled. " + "vkCreateWaylandSurfaceKHR not executed!\n"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -768,7 +768,6 @@ LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentat VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display *display) { - // First, check to ensure the appropriate extension was enabled: struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; @@ -787,7 +786,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWaylandPresentationSu return icd_term->GetPhysicalDeviceWaylandPresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, display); } -#endif // VK_USE_PLATFORM_WAYLAND_KHR +#endif // VK_USE_PLATFORM_WAYLAND_KHR #ifdef VK_USE_PLATFORM_XCB_KHR @@ -816,8 +815,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXcbSurfaceKHR(VkInstance instanc // First, check to ensure the appropriate extension was enabled: struct loader_instance *ptr_instance = loader_get_instance(instance); if (!ptr_instance->wsi_xcb_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_xcb_surface extension not enabled. " - "vkCreateXcbSurfaceKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_xcb_surface extension not enabled. " + "vkCreateXcbSurfaceKHR not executed!\n"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -885,14 +885,14 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXcbPresentationSuppor uint32_t queueFamilyIndex, xcb_connection_t *connection, xcb_visualid_t visual_id) { - // First, check to ensure the appropriate extension was enabled: struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_xcb_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_xcb_surface extension not enabled. " - "vkGetPhysicalDeviceXcbPresentationSupportKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_xcb_surface extension not enabled. " + "vkGetPhysicalDeviceXcbPresentationSupportKHR not executed!\n"); return VK_SUCCESS; } @@ -902,7 +902,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXcbPresentationSuppor return icd_term->GetPhysicalDeviceXcbPresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, connection, visual_id); } -#endif // VK_USE_PLATFORM_XCB_KHR +#endif // VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XLIB_KHR @@ -931,8 +931,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXlibSurfaceKHR(VkInstance instan // First, check to ensure the appropriate extension was enabled: struct loader_instance *ptr_instance = loader_get_instance(instance); if (!ptr_instance->wsi_xlib_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_xlib_surface extension not enabled. " - "vkCreateXlibSurfaceKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_xlib_surface extension not enabled. " + "vkCreateXlibSurfaceKHR not executed!\n"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -998,14 +999,14 @@ LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentation VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display *dpy, VisualID visualID) { - // First, check to ensure the appropriate extension was enabled: struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_xlib_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_xlib_surface extension not enabled. " - "vkGetPhysicalDeviceXlibPresentationSupportKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_xlib_surface extension not enabled. " + "vkGetPhysicalDeviceXlibPresentationSupportKHR not executed!\n"); return VK_SUCCESS; } @@ -1015,7 +1016,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXlibPresentationSuppo return icd_term->GetPhysicalDeviceXlibPresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, dpy, visualID); } -#endif // VK_USE_PLATFORM_XLIB_KHR +#endif // VK_USE_PLATFORM_XLIB_KHR #ifdef VK_USE_PLATFORM_ANDROID_KHR @@ -1039,8 +1040,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateAndroidSurfaceKHR(VkInstance ins // First, check to ensure the appropriate extension was enabled: struct loader_instance *ptr_instance = loader_get_instance(instance); if (!ptr_instance->wsi_display_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_display extension not enabled. " - "vkCreateAndroidSurfaceKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_display extension not enabled. " + "vkCreateAndroidSurfaceKHR not executed!\n"); return VK_ERROR_EXTENSION_NOT_PRESENT; } @@ -1060,7 +1062,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateAndroidSurfaceKHR(VkInstance ins return VK_SUCCESS; } -#endif // VK_USE_PLATFORM_ANDROID_KHR +#endif // VK_USE_PLATFORM_ANDROID_KHR // Functions for the VK_KHR_display instance extension: LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, @@ -1076,14 +1078,14 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertie VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkDisplayPropertiesKHR *pProperties) { - // First, check to ensure the appropriate extension was enabled: struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_display_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_display extension not enabled. " - "vkGetPhysicalDeviceDisplayPropertiesKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_display extension not enabled. " + "vkGetPhysicalDeviceDisplayPropertiesKHR not executed!\n"); return VK_SUCCESS; } @@ -1105,14 +1107,14 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlaneProp VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkDisplayPlanePropertiesKHR *pProperties) { - // First, check to ensure the appropriate extension was enabled: struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_display_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_display extension not enabled. " - "vkGetPhysicalDeviceDisplayPlanePropertiesKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_display extension not enabled. " + "vkGetPhysicalDeviceDisplayPlanePropertiesKHR not executed!\n"); return VK_SUCCESS; } @@ -1135,14 +1137,14 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneSupportedDisplaysK VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t *pDisplayCount, VkDisplayKHR *pDisplays) { - // First, check to ensure the appropriate extension was enabled: struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_display_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_display extension not enabled. " - "vkGetDisplayPlaneSupportedDisplaysKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_display extension not enabled. " + "vkGetDisplayPlaneSupportedDisplaysKHR not executed!\n"); return VK_SUCCESS; } @@ -1165,14 +1167,14 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModePropertiesKHR(VkPhy VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t *pPropertyCount, VkDisplayModePropertiesKHR *pProperties) { - // First, check to ensure the appropriate extension was enabled: struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_display_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_display extension not enabled. " - "vkGetDisplayModePropertiesKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_display extension not enabled. " + "vkGetDisplayModePropertiesKHR not executed!\n"); return VK_SUCCESS; } @@ -1196,14 +1198,14 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayModeKHR(VkPhysicalDe VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) { - // First, check to ensure the appropriate extension was enabled: struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_display_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_display extension not enabled. " - "vkCreateDisplayModeKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_display extension not enabled. " + "vkCreateDisplayModeKHR not executed!\n"); return VK_ERROR_EXTENSION_NOT_PRESENT; } @@ -1226,14 +1228,14 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilitiesKHR(Vk VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR *pCapabilities) { - // First, check to ensure the appropriate extension was enabled: struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_display_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_display extension not enabled. " - "vkGetDisplayPlaneCapabilitiesKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_display extension not enabled. " + "vkGetDisplayPlaneCapabilitiesKHR not executed!\n"); return VK_SUCCESS; } @@ -1265,8 +1267,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR(VkInstanc uint32_t i = 0; if (!inst->wsi_display_enabled) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_surface extension not enabled. " - "vkCreateDisplayPlaneSurfaceKHR not executed!\n"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_surface extension not enabled. " + "vkCreateDisplayPlaneSurfaceKHR not executed!\n"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } @@ -1424,7 +1427,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, const char *addr = ptr_instance->wsi_win32_surface_enabled ? (void *)vkGetPhysicalDeviceWin32PresentationSupportKHR : NULL; return true; } -#endif // VK_USE_PLATFORM_WIN32_KHR +#endif // VK_USE_PLATFORM_WIN32_KHR #ifdef VK_USE_PLATFORM_MIR_KHR // Functions for the VK_KHR_mir_surface extension: @@ -1436,7 +1439,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, const char *addr = ptr_instance->wsi_mir_surface_enabled ? (void *)vkGetPhysicalDeviceMirPresentationSupportKHR : NULL; return true; } -#endif // VK_USE_PLATFORM_MIR_KHR +#endif // VK_USE_PLATFORM_MIR_KHR #ifdef VK_USE_PLATFORM_WAYLAND_KHR // Functions for the VK_KHR_wayland_surface extension: @@ -1448,7 +1451,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, const char *addr = ptr_instance->wsi_wayland_surface_enabled ? (void *)vkGetPhysicalDeviceWaylandPresentationSupportKHR : NULL; return true; } -#endif // VK_USE_PLATFORM_WAYLAND_KHR +#endif // VK_USE_PLATFORM_WAYLAND_KHR #ifdef VK_USE_PLATFORM_XCB_KHR // Functions for the VK_KHR_xcb_surface extension: @@ -1460,7 +1463,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, const char *addr = ptr_instance->wsi_xcb_surface_enabled ? (void *)vkGetPhysicalDeviceXcbPresentationSupportKHR : NULL; return true; } -#endif // VK_USE_PLATFORM_XCB_KHR +#endif // VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XLIB_KHR // Functions for the VK_KHR_xlib_surface extension: @@ -1472,7 +1475,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, const char *addr = ptr_instance->wsi_xlib_surface_enabled ? (void *)vkGetPhysicalDeviceXlibPresentationSupportKHR : NULL; return true; } -#endif // VK_USE_PLATFORM_XLIB_KHR +#endif // VK_USE_PLATFORM_XLIB_KHR #ifdef VK_USE_PLATFORM_ANDROID_KHR // Functions for the VK_KHR_android_surface extension: @@ -1480,7 +1483,7 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, const char *addr = ptr_instance->wsi_xlib_surface_enabled ? (void *)vkCreateAndroidSurfaceKHR : NULL; return true; } -#endif // VK_USE_PLATFORM_ANDROID_KHR +#endif // VK_USE_PLATFORM_ANDROID_KHR // Functions for VK_KHR_display extension: if (!strcmp("vkGetPhysicalDeviceDisplayPropertiesKHR", name)) { diff --git a/loader/wsi.h b/loader/wsi.h index c5cf8714..5a13bf44 100644 --- a/loader/wsi.h +++ b/loader/wsi.h @@ -29,25 +29,25 @@ typedef struct { union { #ifdef VK_USE_PLATFORM_MIR_KHR VkIcdSurfaceMir mir_surf; -#endif // VK_USE_PLATFORM_MIR_KHR +#endif // VK_USE_PLATFORM_MIR_KHR #ifdef VK_USE_PLATFORM_WAYLAND_KHR VkIcdSurfaceWayland wayland_surf; -#endif // VK_USE_PLATFORM_WAYLAND_KHR +#endif // VK_USE_PLATFORM_WAYLAND_KHR #ifdef VK_USE_PLATFORM_WIN32_KHR VkIcdSurfaceWin32 win_surf; -#endif // VK_USE_PLATFORM_WIN32_KHR +#endif // VK_USE_PLATFORM_WIN32_KHR #ifdef VK_USE_PLATFORM_XCB_KHR VkIcdSurfaceXcb xcb_surf; -#endif // VK_USE_PLATFORM_XCB_KHR +#endif // VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XLIB_KHR VkIcdSurfaceXlib xlib_surf; -#endif // VK_USE_PLATFORM_XLIB_KHR +#endif // VK_USE_PLATFORM_XLIB_KHR VkIcdSurfaceDisplay display_surf; }; - uint32_t base_size; // Size of VkIcdSurfaceBase - uint32_t platform_size; // Size of corresponding VkIcdSurfaceXXX - uint32_t non_platform_offset; // Start offset to base_size - uint32_t entire_size; // Size of entire VkIcdSurface + uint32_t base_size; // Size of VkIcdSurfaceBase + uint32_t platform_size; // Size of corresponding VkIcdSurfaceXXX + uint32_t non_platform_offset; // Start offset to base_size + uint32_t entire_size; // Size of entire VkIcdSurface VkSurfaceKHR *real_icd_surfaces; } VkIcdSurface; |
