-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16196 from hrydgard/improved-render-stats
Improved stats in the Vulkan GPU profiler
- Loading branch information
Showing
21 changed files
with
126 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <cstdio> | ||
|
||
#include "Common/Math/Statistics.h" | ||
|
||
void SimpleStat::Format(char *buffer, size_t sz) { | ||
if (min_ == INFINITY) { | ||
snprintf(buffer, sz, "%s: N/A\n", name_); | ||
} else { | ||
snprintf(buffer, sz, "%s: %0.2f (%0.2f..%0.2f, avg %0.2f)\n", name_, value_, min_, max_, smoothed_); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#pragma once | ||
|
||
#include <cmath> | ||
|
||
// Very simple stat for convenience. Keeps track of min, max, smoothed. | ||
struct SimpleStat { | ||
SimpleStat(const char *name) : name_(name) { Reset(); } | ||
|
||
void Update(double value) { | ||
value_ = value; | ||
if (min_ == INFINITY) { | ||
smoothed_ = value; | ||
} else { | ||
// TODO: Make factor adjustable? | ||
smoothed_ = 0.99 * smoothed_ + 0.01 * value; | ||
} | ||
if (value < min_) { | ||
min_ = value; | ||
} | ||
if (value > max_) { | ||
max_ = value; | ||
} | ||
} | ||
|
||
void Reset() { | ||
value_ = 0.0; | ||
smoothed_ = 0.0; // doens't really need init | ||
min_ = INFINITY; | ||
max_ = -INFINITY; | ||
} | ||
|
||
void Format(char *buffer, size_t sz); | ||
|
||
private: | ||
const char *name_; | ||
|
||
// These are initialized in Reset(). | ||
double value_; | ||
double min_; | ||
double max_; | ||
double smoothed_; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,5 @@ | ||
#include "Common/Math/math_util.h" | ||
#include <stdlib.h> | ||
|
||
// QNX can only use RunFast mode and it is already the default. | ||
#if defined(__ARM_ARCH_7A__) | ||
// Enables 'RunFast' VFP mode. | ||
void EnableFZ() { | ||
int x; | ||
asm( | ||
"fmrx %[result],FPSCR \r\n" | ||
"orr %[result],%[result],#16777216 \r\n" | ||
"fmxr FPSCR,%[result]" | ||
:[result] "=r" (x) : : | ||
); | ||
//printf("ARM FPSCR: %08x\n",x); | ||
} | ||
#include <cstdlib> | ||
|
||
// New fastmode code from: http://pandorawiki.org/Floating_Point_Optimization | ||
// These settings turbocharge the slow VFP unit on Cortex-A8 based chips by setting | ||
// restrictions that permit running VFP instructions on the NEON unit. | ||
// Denormal flush-to-zero, for example. | ||
void FPU_SetFastMode() { | ||
static const unsigned int x = 0x04086060; | ||
static const unsigned int y = 0x03000000; | ||
int r; | ||
asm volatile ( | ||
"fmrx %0, fpscr \n\t" //r0 = FPSCR | ||
"and %0, %0, %1 \n\t" //r0 = r0 & 0x04086060 | ||
"orr %0, %0, %2 \n\t" //r0 = r0 | 0x03000000 | ||
"fmxr fpscr, %0 \n\t" //FPSCR = r0 | ||
: "=r"(r) | ||
: "r"(x), "r"(y) | ||
); | ||
} | ||
|
||
#else | ||
|
||
void EnableFZ() { | ||
// TODO | ||
} | ||
|
||
void FPU_SetFastMode() {} | ||
|
||
#endif | ||
// Could delete this file, but might find use again. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -807,6 +807,3 @@ void bindDefaultFBO() | |
{ | ||
[sharedViewController bindDefaultFBO]; | ||
} | ||
|
||
void EnableFZ(){}; | ||
void DisableFZ(){}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters