Rise
The Vieneo Province
Loading...
Searching...
No Matches
Tests/RtsRoadShaderTests.cpp

Source at documentation-generation time. See Test catalog for fixture associations.

1// Offscreen regression of the native client shaders and shipped connector tiles.
2#include "../Rendering/Device11.h"
3#include "../Rendering/Program11.h"
4#include "../Rendering/Texture11.h"
5#include "../Rendering/TextureMips11.h"
6#include "../Rendering/Shaders/Catalog11.generated.h"
7#include "../Viewscreen/RtsTerrainSurface.h"
8#include <d3dcompiler.h>
9#include <d3d11sdklayers.h>
10#include <algorithm>
11#include <cmath>
12#include <fstream>
13#include <iostream>
14#include <stdexcept>
15#include <vector>
16using Microsoft::WRL::ComPtr;
17using namespace Rendering;
18static void CheckAt(HRESULT hr,int line) { if(FAILED(hr)) throw std::runtime_error("D3D11 failure at line "+std::to_string(line)+": "+std::to_string(hr)); }
19#define Check(hr) CheckAt((hr),__LINE__)
20static std::string Read(const char* path) {
21 std::ifstream in(path,std::ios::binary); if(!in)throw std::runtime_error(std::string("Cannot read ")+path);
22 return {std::istreambuf_iterator<char>(in),std::istreambuf_iterator<char>()};
23}
24struct Vec2 {float x,y; Vec2(float a=0,float b=0):x(a),y(b){}};
25struct Vec3 {float x,y,z;};
26struct Vec4 {
27 float x,y,z,w;
28 Vec4(float a=0,float b=0,float c=0,float d=0):x(a),y(b),z(c),w(d){}
29 Vec4 operator+(Vec4 b)const{return {x+b.x,y+b.y,z+b.z,w+b.w};}
30 Vec4 operator-(Vec4 b)const{return {x-b.x,y-b.y,z-b.z,w-b.w};}
31 Vec4 operator*(float b)const{return {x*b,y*b,z*b,w*b};}
32};
33struct Shader {Program11 program;};
34struct Vertex {Vec4 pos;Vec2 tex,plot;Vec3 emission;};
35struct Entrance {const char* name;const char* file;int side;}; // N,S,W,E
36static constexpr Entrance Entrances[]={
37 {"Industrial north","Meshes/Deois-industrial.rts",0},
38 {"Transit south / RESKIN WAY","Meshes/Deois-transit district.rts",1},
39 {"Industrial west","Meshes/Deois-industrial.rts",2},
40 {"City Center east","Meshes/Deois-city center.rts",3},
41 {"Financial west","Meshes/deois-financial.rts",2},
42 {"Financial south","Meshes/deois-financial.rts",1}
43};
44class Renderer {
45public:
46 static constexpr int Width=1024,Height=512;
47 Device11 gpu; Parameters11 parameters;
48 ComPtr<ID3D11Texture2D> target,readback;
49 ComPtr<ID3D11RenderTargetView> rtv;
50 ComPtr<ID3D11ShaderResourceView> ground,cloud;
51 ComPtr<ID3D11BlendState> alpha;
52 ComPtr<ID3D11Buffer> vertices;
53 Texture11 north,south,road;
54 Shader city,terrain,terrainFar;
55 Vec4 emission[4]={{.02f,.03f,.04f,0},{.05f,.06f,.07f,0},{.08f,.07f,.06f,0},{.03f,.04f,.05f,0}};
56 int scenario=0;
57 explicit Renderer(bool warp) {
58 Check(gpu.Create({warp?D3D_DRIVER_TYPE_WARP:D3D_DRIVER_TYPE_HARDWARE,true}));
59 for(const auto& sampler:CustomUISamplers){ComPtr<ID3D11SamplerState> state;Check(gpu.Device()->CreateSamplerState(&sampler.description,&state));parameters.Sampler(sampler.name,state.Get());}
60 std::cout<<gpu.Status()<<'\n';
61 D3D11_TEXTURE2D_DESC td{};td.Width=Width;td.Height=Height;td.MipLevels=td.ArraySize=1;
62 td.Format=DXGI_FORMAT_B8G8R8A8_UNORM;td.SampleDesc.Count=1;td.BindFlags=D3D11_BIND_RENDER_TARGET;
63 Check(gpu.Device()->CreateTexture2D(&td,nullptr,&target));
64 Check(gpu.Device()->CreateRenderTargetView(target.Get(),nullptr,&rtv));
65 td.BindFlags=0;td.Usage=D3D11_USAGE_STAGING;td.CPUAccessFlags=D3D11_CPU_ACCESS_READ;
66 Check(gpu.Device()->CreateTexture2D(&td,nullptr,&readback));
67 gpu.Context()->OMSetRenderTargets(1,rtv.GetAddressOf(),nullptr);
68 D3D11_VIEWPORT vp{0,0,float(Width),float(Height),0,1};gpu.Context()->RSSetViewports(1,&vp);
69 D3D11_RASTERIZER_DESC rd{};rd.FillMode=D3D11_FILL_SOLID;rd.CullMode=D3D11_CULL_NONE;rd.DepthClipEnable=TRUE;
70 ComPtr<ID3D11RasterizerState> raster;Check(gpu.Device()->CreateRasterizerState(&rd,&raster));gpu.Context()->RSSetState(raster.Get());
71 D3D11_BLEND_DESC bd{};auto& b=bd.RenderTarget[0];b.BlendEnable=TRUE;
72 b.SrcBlend=D3D11_BLEND_SRC_ALPHA;b.DestBlend=D3D11_BLEND_INV_SRC_ALPHA;b.BlendOp=D3D11_BLEND_OP_ADD;
73 b.SrcBlendAlpha=D3D11_BLEND_ONE;b.DestBlendAlpha=D3D11_BLEND_ZERO;b.BlendOpAlpha=D3D11_BLEND_OP_ADD;b.RenderTargetWriteMask=15;
74 Check(gpu.Device()->CreateBlendState(&bd,&alpha));
75 D3D11_BUFFER_DESC vb{};vb.ByteWidth=6*sizeof(Vertex);vb.BindFlags=D3D11_BIND_VERTEX_BUFFER;vb.Usage=D3D11_USAGE_DYNAMIC;vb.CPUAccessFlags=D3D11_CPU_ACCESS_WRITE;
76 Check(gpu.Device()->CreateBuffer(&vb,nullptr,&vertices));UINT stride=sizeof(Vertex),offset=0;
77 gpu.Context()->IASetVertexBuffers(0,1,vertices.GetAddressOf(),&stride,&offset);gpu.Context()->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
78 Load(north,"Textures/RTS/city2playerN.dds");
79 Load(south,"Textures/RTS/city2playerS.dds");
80 Load(road,"Textures/RTS/Road.dds");
81 MakeTexture(ground,false);MakeTexture(cloud,true);
82 Compile(city,"TestCity");Compile(terrain,"TestTerrain");Compile(terrainFar,"TestTerrainFar");
83 }
84 void Load(Texture11& texture,const char* path) {
85 const auto source=Read(path);std::vector<uint8_t> generated;
86 Check(PrepareTextureDDS(reinterpret_cast<const uint8_t*>(source.data()),source.size(),0,0,0,generated));
87 const auto* data=generated.empty()?reinterpret_cast<const uint8_t*>(source.data()):generated.data();
88 Check(texture.Load(gpu.Device(),gpu.Context(),data,generated.empty()?source.size():generated.size()));
89 }
90 void MakeTexture(ComPtr<ID3D11ShaderResourceView>& out,bool clouds) {
91 std::vector<DWORD> pixels(64*64);
92 for(int y=0;y<64;++y)for(int x=0;x<64;++x){const int s=clouds?90+(x*2+y)%130:42;pixels[y*64+x]=0xff000000|(s<<16)|(s<<8)|s;}
93 D3D11_TEXTURE2D_DESC d{};d.Width=d.Height=64;d.MipLevels=d.ArraySize=1;d.Format=DXGI_FORMAT_B8G8R8A8_UNORM;
94 d.SampleDesc.Count=1;d.Usage=D3D11_USAGE_IMMUTABLE;d.BindFlags=D3D11_BIND_SHADER_RESOURCE;
95 D3D11_SUBRESOURCE_DATA initial{pixels.data(),64*4,0};ComPtr<ID3D11Texture2D> t;
96 Check(gpu.Device()->CreateTexture2D(&d,&initial,&t));Check(gpu.Device()->CreateShaderResourceView(t.Get(),nullptr,&out));
97 }
98 void Compile(Shader& shader,const char* entry) {
99 std::string source=Read("Rendering/Shaders/CustomUI.hlsl");
100 source+=R"(
101struct RoadVertex {float4 p:SV_Position;float2 t:TEXCOORD0;float2 q:TEXCOORD1;float3 e:TEXCOORD2;};
102RoadVertex TestVertex(float4 p:POSITION,float2 t:TEXCOORD0,float2 q:TEXCOORD1,float3 e:TEXCOORD2){RoadVertex o;o.p=p;o.t=t;o.q=q;o.e=e;return o;}
103float4 TestLight;float TestCoverageOnly;
104float4 TestCity(RoadVertex v):SV_Target {float4 color=_RiseLegacy_PS11(v.t,float2(v.q.x,1-v.q.y),TestLight.xyz);return TestCoverageOnly?float4(color.aaa,1):color;}
105float4 TestTerrainFar(RoadVertex v):SV_Target {return _RiseLegacy_PS1(v.q,v.q+clouduv.xy,1,float4(.2,.18,.13,0),v.e,TestLight.xyz);}
106float4 TestTerrain(RoadVertex v):SV_Target {return _RiseLegacy_PS0(v.q,v.q+clouduv.xy,TestLight.xyz,float4(.2,.18,.13,0),v.e);}
107)";
108 auto compile=[&](const char* name,const char* model){ComPtr<ID3DBlob> code,errors;
109 auto hr=D3DCompile(source.data(),source.size(),"Rendering/Shaders/CustomUI.hlsl",nullptr,D3D_COMPILE_STANDARD_FILE_INCLUDE,name,model,D3DCOMPILE_ENABLE_STRICTNESS|D3DCOMPILE_OPTIMIZATION_LEVEL3,0,&code,&errors);
110 if(FAILED(hr)&&errors)std::cerr<<static_cast<const char*>(errors->GetBufferPointer());Check(hr);return code;};
111 auto vs=compile("TestVertex","vs_5_0"),ps=compile(entry,"ps_5_0");
112 const D3D11_INPUT_ELEMENT_DESC elements[]={
113 {"POSITION",0,DXGI_FORMAT_R32G32B32A32_FLOAT,0,0,D3D11_INPUT_PER_VERTEX_DATA,0},
114 {"TEXCOORD",0,DXGI_FORMAT_R32G32_FLOAT,0,16,D3D11_INPUT_PER_VERTEX_DATA,0},
115 {"TEXCOORD",1,DXGI_FORMAT_R32G32_FLOAT,0,24,D3D11_INPUT_PER_VERTEX_DATA,0},
116 {"TEXCOORD",2,DXGI_FORMAT_R32G32B32_FLOAT,0,32,D3D11_INPUT_PER_VERTEX_DATA,0}};
117 Check(shader.program.Create(gpu.Device(),vs->GetBufferPointer(),vs->GetBufferSize(),ps->GetBufferPointer(),ps->GetBufferSize(),elements,4));
118 }
119 void Vector(Shader&,const char* name,Vec4 value){parameters.Set(name,value);}
120 void Texture(Shader&,const char* name,ID3D11ShaderResourceView* value){
121 std::string textureName=name;const auto samplerAt=textureName.find("Sampler");
122 textureName.erase(samplerAt,7);if(textureName=="RtsColorMap")textureName="ColorMap";
123 parameters.Texture(textureName,value);
124 // Retain the generated production sampler state, including anisotropy.
125 }
126 void Bind(Shader& shader,int half,int mask,bool rts,bool enabled){
127 Vector(shader,"ambient",scenario==0?Vec4(.25f,.3f,.35f,10):Vec4(.003f,.005f,.008f,scenario==4?.15f:10));
128 Vector(shader,"shiplight",Vec4(0,0,0,0));
129 Vector(shader,"TestLight",Vec4(0,0,.08f,0));
130 parameters.Set("LandingLightCount",scenario==2?1:0);
131 Vector(shader,"LandingLightPosition",Vec4(0,0,0,.4f));
132 Vector(shader,"LandingLightDirection",Vec4(0,0,1,0));
133 Vector(shader,"LandingLightColor",Vec4(1,1,.75f,1));
134 Vector(shader,"LandingLightUp",Vec4(0,1,0,0));
135 Vector(shader,"LandingLightAngles",Vec4(.10510424f,.10510424f,.19438031f,.19438031f));
136 Vector(shader,"LandingLightParameters",Vec4(.03125f,.02f,1000,0));
137 Vector(shader,"WeapPos",Vec4(.03f,0,.05f,scenario==3?1.0f:0.0f));
138 Vector(shader,"WeapCol",Vec4(.2f,.6f,.1f,0));
139 Vector(shader,"clouduv",Vec4(scenario==5?.31f:.13f,.29f,0,1));
140 Vector(shader,"Features",rts?Vec4(0,enabled?static_cast<float>(half):0,.5f,0):Vec4(enabled?3.0f:0,0,0,static_cast<float>(mask)));
141 parameters.Set("RtsRoadEmission",emission);
142 int flags[5]={}; parameters.Set("flags",flags);
143 Texture(shader,"ColorMapSampler",rts?(half==1?north.View():south.View()):ground.Get());
144 Texture(shader,"RtsColorMapSampler",rts?(half==1?north.View():south.View()):ground.Get());
145 Texture(shader,"CityRoadNorthSampler",north.View()); Texture(shader,"CityRoadSouthSampler",south.View());
146 Texture(shader,"ColorMapSampler4",road.View()); Texture(shader,"CloudMapSampler",cloud.Get());
147 gpu.Context()->OMSetBlendState(rts?alpha.Get():nullptr,nullptr,0xffffffff);
148 }
149 void Draw(const Entrance& entrance, Shader& shader, bool rts, bool enabled, float tip0,float tip1,int y0,int y1) {
150 const auto tiles=Read(entrance.file);
151 if(tiles.size()!=26*26*2) throw std::runtime_error("Unexpected RTS layout");
152 const bool ns=entrance.side<2;
153 const int direction=(entrance.side==1 || entrance.side==3)?-1:1;
154 const int mask=entrance.side==0?4:entrance.side==1?8:entrance.side==2?1:2;
155 for(int half=0;half<2;++half) {
156 const int east=ns?12+half:(entrance.side==2?0:25), northTile=ns?(entrance.side==0?25:0):13-half;
157 const unsigned char rotation=tiles[(east*26+northTile)*2];
158 const unsigned char texture=tiles[(east*26+northTile)*2+1];
159 if(texture!=62 && texture!=63) throw std::runtime_error("Connector fixture changed");
160 Bind(shader,texture-61,mask,rts,enabled);
161 const auto uv0=RtsTerrain::TextureCoordinate({0,0},rotation);
162 const auto uvE=RtsTerrain::TextureCoordinate({1,0},rotation);
163 const auto uvN=RtsTerrain::TextureCoordinate({0,1},rotation);
164 Vertex v[4];
165 for(int corner=0;corner<4;++corner) {
166 const int right=corner%2, bottom=corner/2;
167 const float across=.492f+static_cast<float>(half+right)*.008f;
168 const float tip=bottom?tip1:tip0;
169 const float along=direction<0?1-(1-tip)/26:(1-tip)/26;
170 const Vec2 plot=ns?Vec2(across,along):Vec2(along,across);
171 const float e=plot.x*26-east, n=(1-plot.y)*26-northTile;
172 v[corner].tex={uv0.u+(uvE.u-uv0.u)*e+(uvN.u-uv0.u)*n,uv0.v+(uvE.v-uv0.v)*e+(uvN.v-uv0.v)*n};
173 v[corner].plot=plot;
174 if(!rts && enabled) { if(ns) v[corner].plot.y+=direction; else v[corner].plot.x+=direction; }
175 const int first=entrance.side==1?2:entrance.side==3?1:0, last=entrance.side==0?1:entrance.side==2?2:3;
176 const auto color=emission[first]+(emission[last]-emission[first])*std::max(0.0f,across*2-1);
177 v[corner].emission={color.x,color.y,color.z};
178 v[corner].pos={2.0f*((half+right)*Width/2)/Width-1,1-2.0f*((bottom?y1:y0))/Height,.5f,1};
179 }
180 const Vertex triangles[]={v[0],v[1],v[2],v[2],v[1],v[3]};
181 D3D11_MAPPED_SUBRESOURCE mapped{};
182 Check(gpu.Context()->Map(vertices.Get(),0,D3D11_MAP_WRITE_DISCARD,0,&mapped));
183 memcpy(mapped.pData,triangles,sizeof(triangles)); gpu.Context()->Unmap(vertices.Get(),0);
184 const auto bound=shader.program.Bind(gpu.Context(),parameters);if(FAILED(bound))throw std::runtime_error(shader.program.Status()); gpu.Context()->Draw(6,0);
185 }
186 }
187
188 std::vector<DWORD> Shoulder(bool high,bool northSouth,bool farSegment,float alongSpan,float phase,bool enabled,Shader& shader) {
189 Clear();Bind(shader,0,northSouth?(farSegment?4:8):(farSegment?1:2),false,enabled);
190 Vector(shader,"ambient",{.5f,.5f,.5f,10000});Vector(shader,"WeapPos",{});
191 parameters.Set("LandingLightCount",0);Vector(shader,"clouduv",{});
192 const float boundary=high?.5036576f:.4963424f;
193 const float texel=.0073152f/256;
194 Vertex v[4];
195 for(int corner=0;corner<4;++corner){
196 const float x=float(corner%2),y=float(corner/2);
197 const float across=boundary+((x-.5f)*32+(y-.5f)*16+phase)*texel;
198 const float along=(farSegment?.55f:.2f)+y*alongSpan;
199 v[corner]={{x*2-1,1-y*2,.5f,1},{0,0},northSouth?Vec2(across,along):Vec2(along,across),{1,1,1}};
200 }
201 const Vertex triangles[]={v[0],v[1],v[2],v[2],v[1],v[3]};D3D11_MAPPED_SUBRESOURCE m{};
202 Check(gpu.Context()->Map(vertices.Get(),0,D3D11_MAP_WRITE_DISCARD,0,&m));memcpy(m.pData,triangles,sizeof(triangles));gpu.Context()->Unmap(vertices.Get(),0);
203 Check(shader.program.Bind(gpu.Context(),parameters));gpu.Context()->Draw(6,0);return Pixels();
204 }
205 void Clear(){const float c[4]={};gpu.Context()->ClearRenderTargetView(rtv.Get(),c);}
206 std::vector<DWORD> Pixels(){
207 gpu.Context()->CopyResource(readback.Get(),target.Get());D3D11_MAPPED_SUBRESOURCE m{};
208 Check(gpu.Context()->Map(readback.Get(),0,D3D11_MAP_READ,0,&m));std::vector<DWORD> p(Width*Height);
209 for(int y=0;y<Height;++y)memcpy(p.data()+y*Width,static_cast<const char*>(m.pData)+y*m.RowPitch,Width*4);
210 gpu.Context()->Unmap(readback.Get(),0);return p;
211 }
212 std::vector<DWORD> Strip(const Entrance& entrance,Shader& shader,bool rts,bool enabled,float tip){
213 Clear();if(rts)Draw(entrance,terrain,false,false,tip,tip,0,8);
214 Draw(entrance,shader,rts,enabled,tip,tip,0,8);const auto p=Pixels();return {p.begin()+Width*3,p.begin()+Width*4};
215 }
216 static void Save(const std::vector<DWORD>& pixels,const char* file){
217 std::ofstream out(file,std::ios::binary);out<<"P6\n"<<Width<<' '<<Height<<"\n255\n";
218 for(auto c:pixels){char rgb[]={char(c>>16),char(c>>8),char(c)};out.write(rgb,3);}
219 }
220 void Preview(const Entrance& entrance,const char* file){
221 Clear();Draw(entrance,terrain,false,false,.6f,1.1333333f,0,Height);
222 Draw(entrance,city,true,true,.6f,1,0,384);Draw(entrance,terrain,false,true,1,1.1333333f,384,Height);
223 Save(Pixels(),file);
224 }
225 void DebugClean(){
226 ComPtr<ID3D11InfoQueue> q;Check(gpu.Device()->QueryInterface(IID_PPV_ARGS(&q)));
227 for(UINT64 i=0;i<q->GetNumStoredMessages();++i){SIZE_T size=0;q->GetMessage(i,nullptr,&size);std::vector<char> b(size);
228 auto* m=reinterpret_cast<D3D11_MESSAGE*>(b.data());Check(q->GetMessage(i,m,&size));
229 if(m->Severity<=D3D11_MESSAGE_SEVERITY_WARNING)throw std::runtime_error(m->pDescription);}
230 }
231};
232static int Difference(const std::vector<DWORD>& a,const std::vector<DWORD>& b){
233 int worst=0;for(size_t i=0;i<a.size();++i)for(int s=0;s<24;s+=8)worst=std::max(worst,std::abs(int((a[i]>>s)&255)-int((b[i]>>s)&255)));return worst;
234}
235int main(int argc,char** argv)try{
236 Renderer render(argc>1&&std::string(argv[1])=="--warp");int checks=0;
237 if(argc>2){
238 const auto file=std::string(argv[2])+".shoulder.ppm";
239 Renderer::Save(render.Shoulder(true,false,false,.01f,0,true,render.terrain),file.c_str());
240 }
241 // Diagonal strip boundaries exercise mixed inside/outside pixel quads.
242 // Match real mip generation and sampler state; flat strips without mips
243 // miss invalid implicit gradients at a per-pixel road branch.
244 int worstShoulder=0;
245 for(bool high:{false,true})for(bool ns:{false,true})for(bool farSegment:{false,true})
246 for(auto* shader:{&render.terrain,&render.terrainFar})for(float span:{.0001f,.01f,.25f})for(float phase:{0.f,.37f}){
247 const auto pixels=render.Shoulder(high,ns,farSegment,span,phase,true,*shader);
248 const auto base=render.Shoulder(high,ns,farSegment,span,phase,false,*shader);
249 for(int y=0;y<Renderer::Height;++y)for(int x=0;x<Renderer::Width;++x){
250 const float t=((x+.5f)/Renderer::Width-.5f)*32+((y+.5f)/Renderer::Height-.5f)*16+phase;
251 const bool outside=high?t>.125f:t<-.125f;
252 if(!outside && std::abs(t)>.25f)continue;
253 for(int c=0;c<24;c+=8){
254 const int error=std::abs(int((pixels[y*Renderer::Width+x]>>c)&255)-int((base[y*Renderer::Width+x]>>c)&255));
255 if(outside && error>1)throw std::runtime_error("Road color outside strip bounds");
256 if(!outside)worstShoulder=std::max(worstShoulder,error);
257 }
258 }
259 ++checks;
260 }
261 std::cout<<"Shoulder boundary: max RGB contribution="<<worstShoulder<<"/255\n";
262 // Require a complete fade to terrain, not just absence of bright speckles.
263 // The previous gradient-only fix still contributed up to 19/255 here.
264 if(worstShoulder>1)throw std::runtime_error("Visible opacity cutoff at road shoulder");
265 for(const auto& entrance:Entrances){int worst=0;
266 for(render.scenario=0;render.scenario<6;++render.scenario){
267 const auto expected=render.Strip(entrance,render.terrain,false,true,1);
268 worst=std::max(worst,Difference(expected,render.Strip(entrance,render.city,true,true,1)));
269 if(Difference(render.Strip(entrance,render.city,true,true,.7f),render.Strip(entrance,render.city,true,false,.7f)))throw std::runtime_error("Inner city artwork changed");
270 ++checks;
271 }
272 render.parameters.Set("TestCoverageOnly",1.f);
273 for(int step=0;step<=64;++step){
274 const float tip=.75f+.25f*step/64;
275 const auto coverage=render.Strip(entrance,render.city,true,true,tip);
276 const auto authored=render.Strip(entrance,render.city,true,false,tip);
277 for(int x=0;x<Renderer::Width;++x){
278 const int alpha=int(coverage[x]&255);
279 if((x<64 || x>=Renderer::Width-64) && alpha>int(authored[x]&255)+8)
280 throw std::runtime_error(std::string(entrance.name)+": connector spills across the shoulder at tip "+std::to_string(tip));
281 if(tip>=.9375f && x>=448 && x<576 && alpha<245)
282 throw std::runtime_error(std::string(entrance.name)+": gap across the paved lane at tip "+std::to_string(tip));
283 }
284 ++checks;
285 }
286 render.parameters.Set("TestCoverageOnly",0.f);
287 std::cout<<entrance.name<<": max edge RGB error="<<worst<<"/255\n";
288 if(worst>3)throw std::runtime_error("RTS/user road edge mismatch");
289 }
290 render.scenario=2;if(argc>2)render.Preview(Entrances[3],argv[2]);render.DebugClean();
291 std::cout<<"PASS: "<<checks<<" native rendered shoulder, connector and unchanged-interior checks; debug layer clean\n";return 0;
292}catch(const std::exception& e){std::cerr<<"FAIL: "<<e.what()<<'\n';return 1;}
SCRIPT_CONTROL SCRIPT_STATE const void int
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
ID3D11DeviceContext * Context() const
Definition Device11.h:66
ID3D11Device * Device() const
Definition Device11.h:65
const std::string & Status() const
Definition Device11.h:75
HRESULT Create(const DeviceOptions11 &options={})
Definition Device11.cpp:84
void Set(const std::string &name, const void *data, size_t bytes)
Definition Program11.cpp:45
void Texture(const std::string &name, ID3D11ShaderResourceView *value)
Definition Program11.cpp:55
void Sampler(const std::string &name, ID3D11SamplerState *value)
Definition Program11.cpp:66
ID3D11ShaderResourceView * View() const
Definition Texture11.h:20
HRESULT Load(ID3D11Device *device, ID3D11DeviceContext *context, const wchar_t *path)
Definition Texture11.cpp:70
constexpr float Width
constexpr float Height
ArrivalPreview Preview(const Input &in, const Request &r)
Vec operator*(Vec a, double b)
Definition OrbitMath.h:14
Vec operator-(Vec a, Vec b)
Definition OrbitMath.h:13
Vec operator+(Vec a, Vec b)
Definition OrbitMath.h:12
DirectX::XMFLOAT3 Vector
Definition Math11.h:7
constexpr uint8_t Pixels[262144]
HRESULT PrepareTextureDDS(const uint8_t *data, size_t size, UINT requested, UINT requestedWidth, UINT requestedHeight, std::vector< uint8_t > &output)
TexCoord TextureCoordinate(TileCorner corner, unsigned char rotation)
void Bind(Rendering::RenderDevice &device, Rendering::RenderTexture *texture)
HRESULT Draw(Rendering::RenderDevice *device, Rendering::RenderTexture *texture, Rendering::RenderBuffer *vertices, const RiseMath::Matrix &world, UINT segments, Rendering::RenderMaterial *volumeEffect=nullptr, float physicalScale=1)