Skip to content

Commit ca51bc7

Browse files
vkcube: Updated to support portability extension properly
1 parent 4cc0932 commit ca51bc7

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

cube/cube.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,10 +1364,10 @@ static void demo_prepare_buffers(struct demo *demo) {
13641364
.format = demo->format,
13651365
.components =
13661366
{
1367-
.r = VK_COMPONENT_SWIZZLE_R,
1368-
.g = VK_COMPONENT_SWIZZLE_G,
1369-
.b = VK_COMPONENT_SWIZZLE_B,
1370-
.a = VK_COMPONENT_SWIZZLE_A,
1367+
.r = VK_COMPONENT_SWIZZLE_IDENTITY,
1368+
.g = VK_COMPONENT_SWIZZLE_IDENTITY,
1369+
.b = VK_COMPONENT_SWIZZLE_IDENTITY,
1370+
.a = VK_COMPONENT_SWIZZLE_IDENTITY,
13711371
},
13721372
.subresourceRange =
13731373
{.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, .baseMipLevel = 0, .levelCount = 1, .baseArrayLayer = 0, .layerCount = 1},
@@ -1729,10 +1729,10 @@ static void demo_prepare_textures(struct demo *demo) {
17291729
.format = tex_format,
17301730
.components =
17311731
{
1732-
VK_COMPONENT_SWIZZLE_R,
1733-
VK_COMPONENT_SWIZZLE_G,
1734-
VK_COMPONENT_SWIZZLE_B,
1735-
VK_COMPONENT_SWIZZLE_A,
1732+
VK_COMPONENT_SWIZZLE_IDENTITY,
1733+
VK_COMPONENT_SWIZZLE_IDENTITY,
1734+
VK_COMPONENT_SWIZZLE_IDENTITY,
1735+
VK_COMPONENT_SWIZZLE_IDENTITY,
17361736
},
17371737
.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1},
17381738
.flags = 0,
@@ -3136,6 +3136,9 @@ static void demo_init_vk(struct demo *demo) {
31363136
demo->extension_names[demo->enabled_extension_count++] = VK_EXT_METAL_SURFACE_EXTENSION_NAME;
31373137
}
31383138
#endif
3139+
if (!strcmp(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, instance_extensions[i].extensionName)) {
3140+
demo->extension_names[demo->enabled_extension_count++] = VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME;
3141+
}
31393142
if (!strcmp(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, instance_extensions[i].extensionName)) {
31403143
if (demo->validate) {
31413144
demo->extension_names[demo->enabled_extension_count++] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
@@ -3308,6 +3311,9 @@ static void demo_init_vk(struct demo *demo) {
33083311
swapchainExtFound = 1;
33093312
demo->extension_names[demo->enabled_extension_count++] = VK_KHR_SWAPCHAIN_EXTENSION_NAME;
33103313
}
3314+
if (!strcmp(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME, device_extensions[i].extensionName)) {
3315+
demo->extension_names[demo->enabled_extension_count++] = VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME;
3316+
}
33113317
assert(demo->enabled_extension_count < 64);
33123318
}
33133319

cube/cube.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,9 @@ void Demo::init_vk() {
11101110
VERIFY(result == vk::Result::eSuccess);
11111111

11121112
for (uint32_t i = 0; i < instance_extension_count; i++) {
1113+
if (!strcmp(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, instance_extensions[i].extensionName)) {
1114+
extension_names[enabled_extension_count++] = VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME;
1115+
}
11131116
if (!strcmp(VK_KHR_SURFACE_EXTENSION_NAME, instance_extensions[i].extensionName)) {
11141117
surfaceExtFound = 1;
11151118
extension_names[enabled_extension_count++] = VK_KHR_SURFACE_EXTENSION_NAME;
@@ -1149,7 +1152,6 @@ void Demo::init_vk() {
11491152
platformSurfaceExtFound = 1;
11501153
extension_names[enabled_extension_count++] = VK_EXT_METAL_SURFACE_EXTENSION_NAME;
11511154
}
1152-
11531155
#endif
11541156
assert(enabled_extension_count < 64);
11551157
}
@@ -1284,6 +1286,9 @@ void Demo::init_vk() {
12841286
swapchainExtFound = 1;
12851287
extension_names[enabled_extension_count++] = VK_KHR_SWAPCHAIN_EXTENSION_NAME;
12861288
}
1289+
if (!strcmp(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME, device_extensions[i].extensionName)) {
1290+
extension_names[enabled_extension_count++] = VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME;
1291+
}
12871292
assert(enabled_extension_count < 64);
12881293
}
12891294
}

0 commit comments

Comments
 (0)