An image to be filled by the host which can't be made is tried again without the host transfer usage, and only when that one
can be made is the format filled through staging buffers from then on. When it can't either (the memory ran out), the texture
fails as before and the format keeps the host copy. The warning says the error logged before it was recovered from.
On a GeForce GTX 1050 (driver 582.28) every DDS texture loaded in the background came out white: the driver reports
hostImageCopy for the format, but an image with VK_IMAGE_USAGE_HOST_TRANSFER_BIT can't be made (vmaCreateImage fails with
VK_ERROR_FEATURE_NOT_PRESENT), and the texture was left without a gpu image.
- The check of a format (once a format) also asks the allocator for the memory a trial image of the textures' kind would go to,
and uses hostImageCopy only when there is such memory and it is device local.
- Each texture is checked against the limits of the format for that use (maxExtent, maxMipLevels), which were left unread.
- An image the driver still can't make is made again without the host transfer usage and filled through a staging buffer, and
the rest of its format goes that way too.
- The log says once a format which way its textures go.
Devices where hostImageCopy works keep it: the check is made once a format.
Without rain or snow the colour pass draws the cab first (9b7d02e5). Since
the depth of the prepass is kept for the alpha tested draws (ff2ff308),
the cab drawn first fell under that too: its screens, stickers and desk
lamps wrote no depth of their own, and what came after them, the scene and
the simplified desk (cab1) of the outer model a few centimetres behind,
came through in patches cut along the triangles. The released exe shows it
as well.
The early cab now writes its depth, as in the rain and in the OpenGL
renderer; the rest of the scene keeps the depth of the prepass as before.
With the depth prepass of the scene, the colour pass of the alpha tested
materials (default, normalmap, pbr, ...) doesn't write the depth the prepass
drew (keepdepth) and tested it without a bias. The prepass draws everything
a little farther (constant -1, slope -1), so a surface lying up to a pixel's
worth of the slope behind the front one passed as well, and the one drawn
last covered the other. Seen from the side a few metres away that is more
than a millimetre: the warning stickers 1 mm off the buffer beam of the EP07
(303e) vanished under the beam, drawn after them.
Those draws now test their depth with the bias of the prepass, nearer by two
units and 1/16 of the slope (the position is invariant in both programs).
The colour pass sets its bias in apply_draw_state() for the kept draws and
the decals together; the depth drawn inside the colour pass holds its own.
The OpenGL 4.6 renderer writes the depth in its colour pass and isn't
affected. No asset changes.
A player's simulator (Vulkan, GeForce RTX 4060, NVIDIA 610.88, through Steam) crashed at every start
as the cab loaded: an access violation (read of address 8) inside nvgpucomp64.dll while
vkCreateComputePipelines compiled water_snowlayer.comp. The crash came on $baltyk_skm1.scn and $td.scn
alike, at the same address in the driver.
The snow shaders (shaders/vk14 and shaders/ogl46, the same in both) no longer use what the
compute shader alone had: a vector component written at an index known only while running through an
inout parameter (snRef), constant arrays of structs and of ints indexed at run time (sn_grids,
sn_lump_tiles, the neighbours of snSpan) and a local vec4 indexed by the blade. They are worked out by
small functions and explicit components instead (snRefPut, snRefWord, snGrid, snLumpTile, snNear),
and the blade is read from the storage as water_snow.comp, which the same driver compiled, does.
The results are the same. glslc compiles both variants and spirv-val passes; whether 610.88 compiles
them now can't be checked without that driver.
So that a driver crashing on a program the renderer can go without doesn't take the simulator down,
the programs of the windscreen water are made under gfx::DriverCrashGuard
(rendering/common/drivercrashguard.*):
- with msvc the fault of the driver is caught (SEH) and the session goes on without the program: the
glasses without the snow, or without the simulation of the water;
- the program is written down in the cache of the renderer (driver_crash_attempt.txt) before the driver
gets it and crossed out after. a program a session ended on is suspect (driver_crash_suspects.txt);
when a second session ends on it, or when a fault was caught, it is recorded (driver_crashes.txt) and
not made again with that driver. a new driver or a changed program is tried again;
- Vulkan makes these pipelines without the VkPipelineCache, whose lock a faulting driver might leave
taken (the drivers keep their own cache on the disk).
Tested: unit tests (1211/1211, with a caught access violation), Vulkan and OpenGL 4.6 in the cab of
303E on $td.scn (RTX 4070, 621.14), and on Vulkan with a real access violation injected into the
pipeline of water_snowlayer.comp: the session went on without the snow, the next one skipped it.
No change of the game data.
A submodel whose definition breaks off before its transform (no "type:"
in its header) is still attached to the tree, without a matrix, and
TSubModel::serialize dereferenced that matrix. It is written as -1 now,
which the binary loader reads back as no matrix, so the .e3d holds the
same tree the .t3d gives.
The -e3d mode also runs the log service now. Without it nothing logged
during the conversion came out, neither the included files the
conversion scripts read from the standard output nor the error that
names the broken submodel. A model that loaded nothing ends with exit
code 1 and a message instead of a crash.
The game now reads .ktx2 texture files, for the OpenGL 4.6 and the Vulkan
renderer alike (texture_source::load_KTX2(), parser in model/ktx2.*):
- formats: BC1 (RGB and RGBA), BC2, BC3, BC4, BC5 (unsigned and signed),
BC6H (unsigned and signed float), BC7, and plain R8G8B8A8 / B8G8R8A8;
- the levels stored as they are or packed with zstd (the bundled zstd);
with gfx.textures.streaming the worker threads read and unpack them;
- the KTXorientation key is honoured: "rd" files are flipped to the bottom
row first, BC1-BC5 block by block, plain texels row by row. BC6H and BC7
can't be flipped without decoding: an "rd" file of these is loaded as
stored, with a warning in the log, as the BC7 dds files are. A file
without the key is taken the way the dds files are (ddsupperorigin);
- srgb or linear colour is chosen by the material, as for the dds files;
- the alpha of BC7 is checked on a small level, as for the dds files.
Not supported, refused with the reason in the log: Basis Universal
(ETC1S / UASTC, BasisLZ), zlib supercompression, arrays, cube maps and
3d images.
BC1 without alpha, BC4, BC5 and BC6H are new formats for the renderers:
opengl_texture::mapping and the Vulkan texture_format_of() map them (no
srgb variants for BC4/BC5/BC6H; their alpha reads 1).
.ktx2 is looked for right after .dds (textures, materials, the editor's
texture browsers). Existing data holds no .ktx2 files, so nothing changes
for existing sceneries and vehicles, and no asset change in the SVN is
needed.
Unit tests: tests/unit/test_ktx2.cpp (header, levels, zstd, orientation,
refused files, flipping of BC1-BC5 and plain texels).
The nested conditional operators mapping DerailReason and the verdict of
the criteria to derailment::reason in Derail(), derail() and
derail_in_collision() go into the switch of reason_of() (S3358), and the
log of Derail() into log_derailment(); Derail() returns early instead of
nesting its body (S3776). The behaviour stays the same for every caller.
report_derailment() writes the memory cell at once and only queues the
events, which run later in Events.update(). A collision derails both
vehicles in one frame, so when <A>:derailed ran, __simulation.derailment
already held B. The scenery can now declare the memory cell
<vehicle>:derailed, written the same way and with the same three fields
as __simulation.derailment, for the events of that one vehicle to read.
Documented that __simulation.derailment keeps only the last derailment
of a frame; eu07_td_off_track_end_scenery_told checks the cell of the
locomotive now.
The windscreen weather (#367) and the compiler cache of the CI (#434). The
wipers' code of both renderers takes staging's side, reading the active cab and
the speed through TDynamicObject (ActiveCab(), Speed()) as the renderer does on
this branch; the windscreen water reads the speed the same way, and the deer
(world/deer.cpp) read the vehicle through its queries (V(), WarningSignal(),
CabOccupied()).
The golden traces recorded on dfb43c4f still match bit for bit: staging didn't
touch the physics.
AGENTS.md says that outside physics/ the state of a physics::Vehicle changes
only through its operations, its definition aside as the vehicle loads; that a
field the rest only reads is private with a query named as the field was, one
nothing outside uses private outright, and a new one private from the start;
and that the cab and the events read the AI through its queries, the debug and
timetable panels alone being its friends.
eimic_real, the demand of the integrated controller the vehicle goes by with
the speed control counted, which TDynamicObject and the consist braking set
for the vehicle that leads, is private: EimicReal() and SetEimicReal(). The
field of the same name of drivingaid::input stays as it is.
No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
71 public fields of physics::Vehicle that no code outside the class reads or
writes (the definitions of the circuits and the tables only the vehicle's own
step goes through, the forces and the timers of its step, the programmable
controller, ...) move into its private part as they are, with the comments
above them. The fields of the old doors inside EU07_USEOLDDOORCODE stay where
they are.
No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
The mass of the empty vehicle, the braking force, the outcome of a derailment,
the departure signal, the traction mode of a dual-mode vehicle and the moment
of the motors are private to physics::Vehicle like the 53 before them, read
through Mass(), Fb(), Derailed(), DepartureSignal(), TractionMode() and Mm().
Inside the class they are emptyMass, brakingForce, derailOutcome,
departureSignalOn, tractionModeSetting and motorMoment, as the plain camelCase
names were taken by locals there.
No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
53 fields of physics::Vehicle that only the vehicle itself writes, and the rest
of the simulator reads, are private, with a query each, named as the field was
(Vmax(), TotalMass(), Ft(), nrot(), NAxles(), PhysicActivation(), ...): the
compiler now keeps the cab, the AI, the scenery, the renderer and the tests from
changing what the definition gives or the physics works out. The fields were
picked by what is never written outside the class, of plain types, with no
other member of the same name to confuse; inside the class they keep their
meaning under camelCase names. The one place outside that cleared a flag of
the AI through a reference does it through ClearAIFlag().
No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.