update client visuals, performance and diagnostics

This commit is contained in:
st committed 2026-10-14 23:30:29 -05:00
1 parent 361892bf0b
commit 875bab0310
155 files changed
+40855 -421

No files matched your search

+33 -2
View File
@@ -1,4 +1,5 @@
#pragma once
#include <set>
#include "../src/modules/world_modules.h"
#include "../src/modules/fps_counter.h"
#include "../src/modules/keystrokes.h"
@@ -106,8 +107,38 @@ inline void test_world_filter() {
D3D11_MAPPED_SUBRESOURCE mapped{};assert(SUCCEEDED(context->Map(staging.Get(),0,D3D11_MAP_READ,0,&mapped)));
auto* pixel=static_cast<unsigned char*>(mapped.pData)+16*mapped.RowPitch+16*4;
assert(std::abs(int(pixel[0])-128)<=1 && std::abs(int(pixel[1])-64)<=1 && std::abs(int(pixel[2])-32)<=1 && pixel[3]==255);
context->Unmap(staging.Get(),0);enabled=false;assert(!apply(device.Get(),context.Get(),rt));shutdown();
std::cout<<"PASS: actual D3D11 color/darkness shader and render-state restoration (WARP)\n";
context->Unmap(staging.Get(),0);
auto read_pixel=[&](int x,int y) {
context->CopyResource(staging.Get(),output.Get());
D3D11_MAPPED_SUBRESOURCE data{};assert(SUCCEEDED(context->Map(staging.Get(),0,D3D11_MAP_READ,0,&data)));
const auto* p=static_cast<unsigned char*>(data.pData)+y*data.RowPitch+x*4;
const std::array<int,3> result{p[0],p[1],p[2]};context->Unmap(staging.Get(),0);return result;
};
tint=IM_COL32_WHITE;brightness=1;
grading grade;grade.saturation=0;configure(grade);
const float blue[4]={.2f,.4f,.8f,1};context->ClearRenderTargetView(rt,blue);assert(apply(device.Get(),context.Get(),rt));
const auto gray=read_pixel(16,16);assert(std::abs(gray[0]-gray[1])<=1 && std::abs(gray[1]-gray[2])<=1);
grade={};grade.vignette=.8f;configure(grade);context->ClearRenderTargetView(rt,white);assert(apply(device.Get(),context.Get(),rt));
assert(read_pixel(16,16)[0]>read_pixel(0,0)[0]+30);
grade={};grade.shadows=IM_COL32(255,0,0,255);grade.highlights=IM_COL32(255,0,0,255);configure(grade);
context->ClearRenderTargetView(rt,blue);assert(apply(device.Get(),context.Get(),rt));const auto toned=read_pixel(16,16);assert(toned[0]>51 && toned[2]<204);
ImGui::CreateContext();atmosphere looks;
auto setting=[&](const char* name)->struct setting& {for(auto& s:looks.settings())if(s.name==name)return s;assert(false);return looks.settings().front();};
std::set<std::array<int,3>> results;
for(int preset=0;preset<7;++preset) {
setting("look preset").int_value=preset;setting("apply selected look").action();looks.on_render();
assert(enabled && world::fog_enabled);
context->ClearRenderTargetView(rt,blue);assert(apply(device.Get(),context.Get(),rt));results.insert(read_pixel(16,16));
D3D11_PRIMITIVE_TOPOLOGY restored_topology;context->IAGetPrimitiveTopology(&restored_topology);
assert(restored_topology==D3D11_PRIMITIVE_TOPOLOGY_LINELIST);
}
assert(results.size()>=5);
setting("palette animation").int_value=1;looks.on_render();const auto first=tint.load();
GImGui->Time+=5;looks.on_render();assert(tint!=first);
setting("reset atmosphere").action();looks.on_render();assert(!enabled && configuration().bloom==0 && configuration().contrast==1);
looks.on_disable();assert(!world::fog_enabled);ImGui::DestroyContext();
enabled=false;assert(!apply(device.Get(),context.Get(),rt));shutdown();
std::cout<<"PASS: actual D3D11 grading, vignette, split tones, seven presets, palette animation/reset and render-state restoration (WARP)\n";
}
inline void test_world_huds() {