Skip to content

Commit

Permalink
Fix github issue: googlesamples#38
Browse files Browse the repository at this point in the history
  • Loading branch information
ggfan committed Jan 10, 2018
1 parent 2e5750d commit 5e1711d
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 6 deletions.
19 changes: 18 additions & 1 deletion tutorial01_load_vulkan/app/src/main/jni/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,23 @@ bool initialize(android_app* app) {
LOGI("\tallowed transforms: %x\n", surfaceCapabilities.supportedTransforms);
LOGI("\tcomposite alpha flags: %u\n", surfaceCapabilities.currentTransform);

// Find a GFX queue family
uint32_t queueFamilyCount;
vkGetPhysicalDeviceQueueFamilyProperties(tutorialGpu, &queueFamilyCount, nullptr);
assert(queueFamilyCount);
std::vector<VkQueueFamilyProperties> queueFamilyProperties(queueFamilyCount);
vkGetPhysicalDeviceQueueFamilyProperties(tutorialGpu, &queueFamilyCount,
queueFamilyProperties.data());

uint32_t queueFamilyIndex;
for (queueFamilyIndex=0; queueFamilyIndex < queueFamilyCount;
queueFamilyIndex++) {
if (queueFamilyProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
break;
}
}
assert(queueFamilyIndex < queueFamilyCount);

// Create a logical device from GPU we picked
float priorities[] = {
1.0f,
Expand All @@ -160,7 +177,7 @@ bool initialize(android_app* app) {
.pNext = nullptr,
.flags = 0,
.queueCount = 1,
.queueFamilyIndex = 0,
.queueFamilyIndex = queueFamilyIndex,
.pQueuePriorities = priorities,
};

Expand Down
19 changes: 18 additions & 1 deletion tutorial02_prebuild_layers/app/src/main/jni/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,23 @@ bool initialize(android_app* app) {
LOGI("\tallowed transforms: %x\n", surfaceCapabilities.supportedTransforms);
LOGI("\tcomposite alpha flags: %u\n", surfaceCapabilities.currentTransform);

// Find a GFX queue family
uint32_t queueFamilyCount;
vkGetPhysicalDeviceQueueFamilyProperties(tutorialGpu, &queueFamilyCount, nullptr);
assert(queueFamilyCount);
std::vector<VkQueueFamilyProperties> queueFamilyProperties(queueFamilyCount);
vkGetPhysicalDeviceQueueFamilyProperties(tutorialGpu, &queueFamilyCount,
queueFamilyProperties.data());

uint32_t queueFamilyIndex;
for (queueFamilyIndex=0; queueFamilyIndex < queueFamilyCount;
queueFamilyIndex++) {
if (queueFamilyProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
break;
}
}
assert(queueFamilyIndex < queueFamilyCount);

// Create a logical device from GPU we picked
float priorities[] = {
1.0f,
Expand All @@ -167,7 +184,7 @@ bool initialize(android_app* app) {
.pNext = nullptr,
.flags = 0,
.queueCount = 1,
.queueFamilyIndex = 0,
.queueFamilyIndex = queueFamilyIndex,
// Send nullptr for queue priority so debug extension could
// catch the bug and call back app's debug function
.pQueuePriorities = nullptr, // priorities,
Expand Down
19 changes: 18 additions & 1 deletion tutorial03_traceable_layers/app/src/main/jni/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,23 @@ bool initialize(android_app* app) {
LOGI("\tallowed transforms: %x\n", surfaceCapabilities.supportedTransforms);
LOGI("\tcomposite alpha flags: %u\n", surfaceCapabilities.currentTransform);

// Find a GFX queue family
uint32_t queueFamilyCount;
vkGetPhysicalDeviceQueueFamilyProperties(tutorialGpu, &queueFamilyCount, nullptr);
assert(queueFamilyCount);
std::vector<VkQueueFamilyProperties> queueFamilyProperties(queueFamilyCount);
vkGetPhysicalDeviceQueueFamilyProperties(tutorialGpu, &queueFamilyCount,
queueFamilyProperties.data());

uint32_t queueFamilyIndex;
for (queueFamilyIndex=0; queueFamilyIndex < queueFamilyCount;
queueFamilyIndex++) {
if (queueFamilyProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
break;
}
}
assert(queueFamilyIndex < queueFamilyCount);

// Create a logical device from GPU we picked
float priorities[] = {
1.0f,
Expand All @@ -167,7 +184,7 @@ bool initialize(android_app* app) {
.pNext = nullptr,
.flags = 0,
.queueCount = 1,
.queueFamilyIndex = 0,
.queueFamilyIndex = queueFamilyIndex,
// Send nullptr for queue priority so debug extension could
// catch the bug and call back app's debug function
.pQueuePriorities = nullptr, // priorities,
Expand Down
19 changes: 18 additions & 1 deletion tutorial04_first_window/app/src/main/jni/VulkanMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,23 @@ void CreateVulkanDevice(ANativeWindow* platformWindow,
CALL_VK(vkEnumeratePhysicalDevices(device.instance_, &gpuCount, tmpGpus));
device.gpuDevice_ = tmpGpus[0]; // Pick up the first GPU Device

// Find a GFX queue family
uint32_t queueFamilyCount;
vkGetPhysicalDeviceQueueFamilyProperties(device.gpuDevice_, &queueFamilyCount, nullptr);
assert(queueFamilyCount);
std::vector<VkQueueFamilyProperties> queueFamilyProperties(queueFamilyCount);
vkGetPhysicalDeviceQueueFamilyProperties(device.gpuDevice_, &queueFamilyCount,
queueFamilyProperties.data());

uint32_t queueFamilyIndex;
for (queueFamilyIndex=0; queueFamilyIndex < queueFamilyCount;
queueFamilyIndex++) {
if (queueFamilyProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
break;
}
}
assert(queueFamilyIndex < queueFamilyCount);

// Create a logical device (vulkan device)
float priorities[] = {
1.0f,
Expand All @@ -128,7 +145,7 @@ void CreateVulkanDevice(ANativeWindow* platformWindow,
.pNext = nullptr,
.flags = 0,
.queueCount = 1,
.queueFamilyIndex = 0,
.queueFamilyIndex = queueFamilyIndex,
.pQueuePriorities = priorities,
};

Expand Down
19 changes: 18 additions & 1 deletion tutorial05_triangle/app/src/main/jni/VulkanMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,23 @@ void CreateVulkanDevice(ANativeWindow* platformWindow,
CALL_VK(vkEnumeratePhysicalDevices(device.instance_, &gpuCount, tmpGpus));
device.gpuDevice_ = tmpGpus[0]; // Pick up the first GPU Device

// Find a GFX queue family
uint32_t queueFamilyCount;
vkGetPhysicalDeviceQueueFamilyProperties(device.gpuDevice_, &queueFamilyCount, nullptr);
assert(queueFamilyCount);
std::vector<VkQueueFamilyProperties> queueFamilyProperties(queueFamilyCount);
vkGetPhysicalDeviceQueueFamilyProperties(device.gpuDevice_, &queueFamilyCount,
queueFamilyProperties.data());

uint32_t queueFamilyIndex;
for (queueFamilyIndex=0; queueFamilyIndex < queueFamilyCount;
queueFamilyIndex++) {
if (queueFamilyProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
break;
}
}
assert(queueFamilyIndex < queueFamilyCount);

// Create a logical device (vulkan device)
float priorities[] = {
1.0f,
Expand All @@ -141,7 +158,7 @@ void CreateVulkanDevice(ANativeWindow* platformWindow,
.pNext = nullptr,
.flags = 0,
.queueCount = 1,
.queueFamilyIndex = 0,
.queueFamilyIndex = queueFamilyIndex,
.pQueuePriorities = priorities,
};

Expand Down
19 changes: 18 additions & 1 deletion tutorial06_texture/app/src/main/cpp/VulkanMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,23 @@ void CreateVulkanDevice(ANativeWindow* platformWindow,
vkGetPhysicalDeviceMemoryProperties(device.gpuDevice_,
&device.gpuMemoryProperties_);

// Find a GFX queue family
uint32_t queueFamilyCount;
vkGetPhysicalDeviceQueueFamilyProperties(device.gpuDevice_, &queueFamilyCount, nullptr);
assert(queueFamilyCount);
std::vector<VkQueueFamilyProperties> queueFamilyProperties(queueFamilyCount);
vkGetPhysicalDeviceQueueFamilyProperties(device.gpuDevice_, &queueFamilyCount,
queueFamilyProperties.data());

uint32_t queueFamilyIndex;
for (queueFamilyIndex=0; queueFamilyIndex < queueFamilyCount;
queueFamilyIndex++) {
if (queueFamilyProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
break;
}
}
assert(queueFamilyIndex < queueFamilyCount);

// Create a logical device (vulkan device)
float priorities[] = {
1.0f,
Expand All @@ -169,7 +186,7 @@ void CreateVulkanDevice(ANativeWindow* platformWindow,
.pNext = nullptr,
.flags = 0,
.queueCount = 1,
.queueFamilyIndex = 0,
.queueFamilyIndex = queueFamilyIndex,
.pQueuePriorities = priorities,
};

Expand Down

0 comments on commit 5e1711d

Please sign in to comment.