QoL Changes
fix timetrace last diff
This commit is contained in:
@@ -30,7 +30,7 @@ namespace PD {
|
||||
* Class to calculate Maximum/Minimum and Average Timings
|
||||
*/
|
||||
class TimeStats {
|
||||
public:
|
||||
public:
|
||||
/**
|
||||
* Constructor taking a lengh for the List
|
||||
* @param l Lengh of the data list
|
||||
@@ -55,8 +55,7 @@ public:
|
||||
* @return Average
|
||||
*/
|
||||
u64 GetAverage() {
|
||||
if (!num_val)
|
||||
return 0.f;
|
||||
if (!num_val) return 0.f;
|
||||
u64 res = 0;
|
||||
for (int i = 0; i < num_val; i++) {
|
||||
res += val[smart_idx(i)];
|
||||
@@ -69,8 +68,7 @@ public:
|
||||
* @return Minimum value
|
||||
*/
|
||||
u64 GetMin() {
|
||||
if (!num_val)
|
||||
return 0.f;
|
||||
if (!num_val) return 0.f;
|
||||
u64 res = std::numeric_limits<u64>::max();
|
||||
for (int i = 0; i < num_val; i++) {
|
||||
res = std::min(val[smart_idx(i)], res);
|
||||
@@ -83,8 +81,7 @@ public:
|
||||
* @return Max Value
|
||||
*/
|
||||
u64 GetMax() {
|
||||
if (!num_val)
|
||||
return 0.f;
|
||||
if (!num_val) return 0.f;
|
||||
u64 res = 0;
|
||||
for (int i = 0; i < num_val; i++) {
|
||||
res = std::max(val[smart_idx(i)], res);
|
||||
@@ -122,7 +119,7 @@ public:
|
||||
*/
|
||||
const size_t GetNumValues() { return num_val; }
|
||||
|
||||
private:
|
||||
private:
|
||||
/**
|
||||
* Get the Next Position to write to
|
||||
* @param c current position
|
||||
@@ -152,7 +149,7 @@ namespace TT {
|
||||
* Data Structure for a TimeTrace Result
|
||||
*/
|
||||
class Res {
|
||||
public:
|
||||
public:
|
||||
/** Constructore that Inits a protocol at size of 60 frames */
|
||||
Res() : start(0), end(0) { protocol = TimeStats::New(60); }
|
||||
~Res() = default;
|
||||
@@ -185,6 +182,7 @@ public:
|
||||
*/
|
||||
void SetEnd(u64 v) {
|
||||
end = v;
|
||||
diff = end - start;
|
||||
protocol->Add(GetLastDiff());
|
||||
}
|
||||
/**
|
||||
@@ -197,20 +195,22 @@ public:
|
||||
* Get Last Diffrence between end and start
|
||||
* @return end - start
|
||||
*/
|
||||
u64 GetLastDiff() { return end - start; }
|
||||
u64 GetLastDiff() { return diff; }
|
||||
/**
|
||||
* Get Protcol Reference
|
||||
* @return Protocol Ref
|
||||
*/
|
||||
TimeStats::Ref GetProtocol() { return protocol; }
|
||||
|
||||
private:
|
||||
private:
|
||||
/** Trace ID */
|
||||
std::string id;
|
||||
/** Start time */
|
||||
u64 start;
|
||||
/** End Time */
|
||||
u64 end;
|
||||
/** Last Diff */
|
||||
u64 diff;
|
||||
/** Protocol */
|
||||
TimeStats::Ref protocol;
|
||||
};
|
||||
@@ -240,7 +240,7 @@ PD_CORE_API void End(const std::string &id);
|
||||
* ```
|
||||
*/
|
||||
class Scope {
|
||||
public:
|
||||
public:
|
||||
/**
|
||||
* Constructor requiring a Name for the Trace
|
||||
* @param id Name of the Trace
|
||||
@@ -254,9 +254,9 @@ public:
|
||||
*/
|
||||
~Scope() { End(ID); }
|
||||
|
||||
private:
|
||||
private:
|
||||
/** Trace Name/ID */
|
||||
std::string ID;
|
||||
};
|
||||
} // namespace TT
|
||||
} // namespace PD
|
||||
} // namespace TT
|
||||
} // namespace PD
|
||||
@@ -94,6 +94,7 @@ class Gfx {
|
||||
|
||||
static void BindTex(Li::TexAddress addr) { pGfx->BindTex(addr); }
|
||||
static void SetViewPort(const ivec2& vp) { pGfx->SetViewPort(vp); }
|
||||
static void SetViewPort(int w, int h) { pGfx->SetViewPort(PD::ivec2(w, h);) }
|
||||
|
||||
static void RenderDrawData(const std::vector<Li::Command::Ref>& Commands) {
|
||||
pGfx->RenderDrawData(Commands);
|
||||
|
||||
@@ -40,6 +40,12 @@ class Command {
|
||||
IndexBuffer.push_back(VertexBuffer.size() + idx);
|
||||
return *this;
|
||||
}
|
||||
Command& AddIdxs(const u16& a, const u16& b, const u16& c) {
|
||||
IndexBuffer.push_back(VertexBuffer.size() + a);
|
||||
IndexBuffer.push_back(VertexBuffer.size() + b);
|
||||
IndexBuffer.push_back(VertexBuffer.size() + c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Command& AddVtx(const Vertex& v) {
|
||||
VertexBuffer.push_back(std::move(v));
|
||||
|
||||
@@ -68,6 +68,12 @@ class PD_LITHIUM_API DrawList {
|
||||
* @param list DrawList to move into current
|
||||
*/
|
||||
void Merge(DrawList::Ref list);
|
||||
/**
|
||||
* Copy another drawlist to this drawist.
|
||||
* This is important for static prerendered Drawlists
|
||||
* @param list DrawList Reference to copy from
|
||||
*/
|
||||
void Copy(DrawList::Ref list);
|
||||
/**
|
||||
* Optimize a Drawlist to a more or less perfect order
|
||||
* to reduce drawcall overhead... This function also uses
|
||||
@@ -80,6 +86,8 @@ class PD_LITHIUM_API DrawList {
|
||||
void Clear();
|
||||
void Layer(int l) { this->pLayer = l; }
|
||||
int Layer() { return this->pLayer; }
|
||||
void LayerUp() { this->pLayer++; }
|
||||
void LayerDown() { this->pLayer--; }
|
||||
|
||||
void SetFont(Font::Ref font) { pCurrentFont = font; }
|
||||
void SetFontScale(float scale) { pFontScale = scale; }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
|
||||
## The Core Core Library
|
||||
project(pd-drivers LANGUAGES CXX VERSION 0.5.1)
|
||||
project(pd-drivers LANGUAGES CXX VERSION 0.6.0)
|
||||
|
||||
set(SRC
|
||||
source/hid.cpp
|
||||
|
||||
Reference in New Issue
Block a user