mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 15:30:35 +00:00
Bugfixes to VK gpu profiling. Properly get the valid bits.
This commit is contained in:
parent
653afeb7ab
commit
19a443819b
@ -516,8 +516,8 @@ void VulkanContext::ChooseDevice(int physical_device) {
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(physical_devices_[physical_device_], &queue_count, nullptr);
|
||||
assert(queue_count >= 1);
|
||||
|
||||
queue_props.resize(queue_count);
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(physical_devices_[physical_device_], &queue_count, queue_props.data());
|
||||
queueFamilyProperties_.resize(queue_count);
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(physical_devices_[physical_device_], &queue_count, queueFamilyProperties_.data());
|
||||
assert(queue_count >= 1);
|
||||
|
||||
// Detect preferred formats, in this order.
|
||||
@ -619,7 +619,7 @@ VkResult VulkanContext::CreateDevice() {
|
||||
queue_info.pQueuePriorities = queue_priorities;
|
||||
bool found = false;
|
||||
for (int i = 0; i < (int)queue_count; i++) {
|
||||
if (queue_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
|
||||
if (queueFamilyProperties_[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
|
||||
queue_info.queueFamilyIndex = i;
|
||||
found = true;
|
||||
break;
|
||||
@ -816,7 +816,7 @@ bool VulkanContext::InitQueue() {
|
||||
uint32_t graphicsQueueNodeIndex = UINT32_MAX;
|
||||
uint32_t presentQueueNodeIndex = UINT32_MAX;
|
||||
for (uint32_t i = 0; i < queue_count; i++) {
|
||||
if ((queue_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0) {
|
||||
if ((queueFamilyProperties_[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0) {
|
||||
if (graphicsQueueNodeIndex == UINT32_MAX) {
|
||||
graphicsQueueNodeIndex = i;
|
||||
}
|
||||
|
@ -201,6 +201,10 @@ public:
|
||||
return physicalDeviceProperties_[i];
|
||||
}
|
||||
|
||||
const VkQueueFamilyProperties &GetQueueFamilyProperties(int family) const {
|
||||
return queueFamilyProperties_[family];
|
||||
}
|
||||
|
||||
VkResult GetInstanceLayerExtensionList(const char *layerName, std::vector<VkExtensionProperties> &extensions);
|
||||
VkResult GetInstanceLayerProperties();
|
||||
|
||||
@ -303,8 +307,8 @@ private:
|
||||
int physical_device_ = -1;
|
||||
|
||||
uint32_t graphics_queue_family_index_ = -1;
|
||||
std::vector<PhysicalDeviceProps> physicalDeviceProperties_{};
|
||||
std::vector<VkQueueFamilyProperties> queue_props;
|
||||
std::vector<PhysicalDeviceProps> physicalDeviceProperties_;
|
||||
std::vector<VkQueueFamilyProperties> queueFamilyProperties_;
|
||||
VkPhysicalDeviceMemoryProperties memory_properties{};
|
||||
|
||||
// Custom collection of things that are good to know
|
||||
|
@ -237,8 +237,8 @@ public:
|
||||
bool bLogFrameDrops;
|
||||
bool bShowDebugStats;
|
||||
bool bShowAudioDebug;
|
||||
bool bAudioResampler;
|
||||
bool bShowGpuProfile;
|
||||
bool bAudioResampler;
|
||||
|
||||
//Analog stick tilting
|
||||
//the base x and y tilt. this inclination is treated as (0,0) and the tilt input
|
||||
|
@ -226,6 +226,9 @@ void VulkanRenderManager::StopThread() {
|
||||
std::unique_lock<std::mutex> lock(frameData.pull_mutex);
|
||||
frameData.pull_condVar.notify_all();
|
||||
}
|
||||
// Zero the queries so we don't try to pull them later.
|
||||
frameData.numQueries = 0;
|
||||
frameData.timestampDescriptions.clear();
|
||||
}
|
||||
thread_.join();
|
||||
ILOG("Vulkan submission thread joined. Frame=%d", vulkan_->GetCurFrame());
|
||||
@ -378,7 +381,8 @@ void VulkanRenderManager::BeginFrame() {
|
||||
VK_QUERY_RESULT_64_BIT);
|
||||
if (res == VK_SUCCESS) {
|
||||
double timestampConversionFactor = (double)vulkan_->GetPhysicalDeviceProperties().properties.limits.timestampPeriod * (1.0 / 1000000.0);
|
||||
uint64_t timestampDiffMask = 0xFFFFFFFFFFFFFFFFULL; // TODO: Get from queue family
|
||||
int validBits = vulkan_->GetQueueFamilyProperties(vulkan_->GetGraphicsQueueFamilyIndex()).timestampValidBits;
|
||||
uint64_t timestampDiffMask = validBits == 64 ? 0xFFFFFFFFFFFFFFFFULL : ((1ULL << validBits) - 1);
|
||||
std::stringstream str;
|
||||
|
||||
char line[256];
|
||||
@ -409,6 +413,7 @@ void VulkanRenderManager::BeginFrame() {
|
||||
|
||||
insideFrame_ = true;
|
||||
|
||||
frameData.timestampDescriptions.clear();
|
||||
if (gpuProfilingEnabled_) {
|
||||
// For various reasons, we need to always use an init cmd buffer in this case to perform the vkCmdResetQueryPool,
|
||||
// unless we want to limit ourselves to only measure the main cmd buffer.
|
||||
|
@ -314,7 +314,7 @@ private:
|
||||
VKRStep *curRenderStep_ = nullptr;
|
||||
std::vector<VKRStep *> steps_;
|
||||
bool splitSubmit_ = false;
|
||||
bool gpuProfilingEnabled_ = true;
|
||||
bool gpuProfilingEnabled_ = false;
|
||||
|
||||
// Execution time state
|
||||
bool run_ = true;
|
||||
|
Loading…
Reference in New Issue
Block a user