QoL Changes

fix timetrace last diff
This commit is contained in:
2025-12-27 23:35:23 +01:00
parent 03f65e069f
commit 7fc7a2ecb9
5 changed files with 31 additions and 16 deletions

View File

@@ -55,8 +55,7 @@ public:
* @return Average * @return Average
*/ */
u64 GetAverage() { u64 GetAverage() {
if (!num_val) if (!num_val) return 0.f;
return 0.f;
u64 res = 0; u64 res = 0;
for (int i = 0; i < num_val; i++) { for (int i = 0; i < num_val; i++) {
res += val[smart_idx(i)]; res += val[smart_idx(i)];
@@ -69,8 +68,7 @@ public:
* @return Minimum value * @return Minimum value
*/ */
u64 GetMin() { u64 GetMin() {
if (!num_val) if (!num_val) return 0.f;
return 0.f;
u64 res = std::numeric_limits<u64>::max(); u64 res = std::numeric_limits<u64>::max();
for (int i = 0; i < num_val; i++) { for (int i = 0; i < num_val; i++) {
res = std::min(val[smart_idx(i)], res); res = std::min(val[smart_idx(i)], res);
@@ -83,8 +81,7 @@ public:
* @return Max Value * @return Max Value
*/ */
u64 GetMax() { u64 GetMax() {
if (!num_val) if (!num_val) return 0.f;
return 0.f;
u64 res = 0; u64 res = 0;
for (int i = 0; i < num_val; i++) { for (int i = 0; i < num_val; i++) {
res = std::max(val[smart_idx(i)], res); res = std::max(val[smart_idx(i)], res);
@@ -185,6 +182,7 @@ public:
*/ */
void SetEnd(u64 v) { void SetEnd(u64 v) {
end = v; end = v;
diff = end - start;
protocol->Add(GetLastDiff()); protocol->Add(GetLastDiff());
} }
/** /**
@@ -197,7 +195,7 @@ public:
* Get Last Diffrence between end and start * Get Last Diffrence between end and start
* @return end - start * @return end - start
*/ */
u64 GetLastDiff() { return end - start; } u64 GetLastDiff() { return diff; }
/** /**
* Get Protcol Reference * Get Protcol Reference
* @return Protocol Ref * @return Protocol Ref
@@ -211,6 +209,8 @@ private:
u64 start; u64 start;
/** End Time */ /** End Time */
u64 end; u64 end;
/** Last Diff */
u64 diff;
/** Protocol */ /** Protocol */
TimeStats::Ref protocol; TimeStats::Ref protocol;
}; };

View File

@@ -94,6 +94,7 @@ class Gfx {
static void BindTex(Li::TexAddress addr) { pGfx->BindTex(addr); } static void BindTex(Li::TexAddress addr) { pGfx->BindTex(addr); }
static void SetViewPort(const ivec2& vp) { pGfx->SetViewPort(vp); } 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) { static void RenderDrawData(const std::vector<Li::Command::Ref>& Commands) {
pGfx->RenderDrawData(Commands); pGfx->RenderDrawData(Commands);

View File

@@ -40,6 +40,12 @@ class Command {
IndexBuffer.push_back(VertexBuffer.size() + idx); IndexBuffer.push_back(VertexBuffer.size() + idx);
return *this; 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) { Command& AddVtx(const Vertex& v) {
VertexBuffer.push_back(std::move(v)); VertexBuffer.push_back(std::move(v));

View File

@@ -68,6 +68,12 @@ class PD_LITHIUM_API DrawList {
* @param list DrawList to move into current * @param list DrawList to move into current
*/ */
void Merge(DrawList::Ref list); 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 * Optimize a Drawlist to a more or less perfect order
* to reduce drawcall overhead... This function also uses * to reduce drawcall overhead... This function also uses
@@ -80,6 +86,8 @@ class PD_LITHIUM_API DrawList {
void Clear(); void Clear();
void Layer(int l) { this->pLayer = l; } void Layer(int l) { this->pLayer = l; }
int Layer() { return this->pLayer; } int Layer() { return this->pLayer; }
void LayerUp() { this->pLayer++; }
void LayerDown() { this->pLayer--; }
void SetFont(Font::Ref font) { pCurrentFont = font; } void SetFont(Font::Ref font) { pCurrentFont = font; }
void SetFontScale(float scale) { pFontScale = scale; } void SetFontScale(float scale) { pFontScale = scale; }

View File

@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.22) cmake_minimum_required(VERSION 3.22)
## The Core Core Library ## The Core Core Library
project(pd-drivers LANGUAGES CXX VERSION 0.5.1) project(pd-drivers LANGUAGES CXX VERSION 0.6.0)
set(SRC set(SRC
source/hid.cpp source/hid.cpp