On a device without VK_EXT_depth_range_unrestricted the target remaps every
vertex shader, so an in-range draw carries the remap's push block too. Draw
it from a direct and from a prepared build; both must validate and store the
right depth.
fopen and freopen in an append mode gave the C runtime a descriptor with
_O_APPEND, which seeks to the end of the file and then writes. Streams on
separate descriptors overwrote each other's data. FreeBSD opens these
streams with O_APPEND, so every flush lands at the end of the file.
Open append streams with FILE_APPEND_DATA but without FILE_WRITE_DATA,
so Windows writes each flush at the end of the file. ftruncate and
flock reopen the file to get the access such a handle lacks.
The selected-records limit tests only read through image tables, so
nothing showed that the estimate counts direct images and samplers too.
TableManyKeyCode can now also load T#s straight from the SRT and sample
them, with the same samplers as the table reads and optionally a third
sampler on the last one.
agc_shader_selected_records_direct_image_limit:
- 63 selected reads and 1 direct image, 64 images: the per-key split is
kept (63 selected tables and the direct image).
- 63 selected reads and 2 direct images, 65 images: over the limit only
because of the direct images. Heap A's reads merge into one unselected
table beside the 2 direct images (3 images, 3 pairs), and keys 2, 33
and 64 still bind their records.
agc_shader_selected_records_direct_pair_limit:
- 31 selected reads and 1 direct image, each with 2 samplers, 64 pairs:
the split is kept.
- The same with a third sampler on the direct image, 65 pairs: over the
pair limit only because of the direct sampler. The reads merge into
one table (2 images, 5 pairs), and keys 2, 17 and 32 still bind.
With ResourceTracker.cpp as on main 9caecfd2d5, the over-limit cases fail
with "image resource limit exceeded" and "sampled image/sampler pair
limit exceeded", and the cases within the limits pass.
The listener read event now reports one connection after the first connect, and on Linux two once a second client is waiting, before both are accepted.
A read event on a listening socket took its data from FIONREAD, which a listening socket refuses on Linux, so kevent and sceKernelAddReadEvent reported 0 connections while saying one was ready. FreeBSD 11.4 gives a listening socket filt_solisten, which reports so_qlen, the completed connections waiting for accept. Ready now checks SO_ACCEPTCONN and on Linux reads a TCP listener's accept backlog from TCP_INFO, where tcp_get_info puts it in tcpi_unacked; with no host call for the count (Windows, macOS, a listener that is not TCP) it reports 1, the lower bound the readiness already implies.
Since #6243, each read whose record offset the CPU evaluates gets its own
selected table column, so a shader that reads one heap at many such keys
plans one image per key. Past 64 keys that is refused with "image resource
limit exceeded", or with "sampled image/sampler pair limit exceeded" when
each read is sampled twice, where the shader planned within both limits
before.
After planning the table columns, the tracker now estimates the images
and sampled pairs that collecting the program would add, keyed as
AddImage and AddSampledPair key them, from the planned column sources
and the direct handles. If either is over its limit, it plans again with
the columns of one heap unselected, the heap with the most selected
columns first, until both fit or no heap is left. Those reads then share
one keyed column, as before #6243: the union of their key domains and the
largest key. A shader within both limits plans exactly as before, from
one planning pass.
The estimate counts images exactly. A direct sampler is told apart by its
handle's words and whether the sample adjusts, before the canonicalization
collecting it applies, so the pair count can only be too high and errs
toward merging.
A device that cannot sample R8_SRGB or R8G8_SRGB had its sRGB textures
decoded in the shader, which cannot serve filtered samples: the decode must
come before the filter. The texture is now an RGBA8 UNORM image viewed as
RGBA8 sRGB, filled by a one-to-one blit of the R8 or RG8 texels (a snapshot's
upload, or a storage image's texels refreshed when its Version changes), so
the sampler decodes and then filters, and every sample, gather and load of
these images is an ordinary sRGB one. The recompiler is given the decode mask
only for formats the device cannot blit, or when APS5_SRGB_SHADER_DECODE=1
forces the shader decode. Tests run on lavapipe only.
Every IR value kept two lists of its users: uses (the users) and
operandUses (the users with their operand index). AddArgument,
ReplaceArgument and ReplaceAllUsesWith updated both, and each value
allocated and freed both. Only operandUses is kept now. Uses() is a view
of the users in operandUses, and HasUses, UseCount and Invalidate read
it. sizeof(IrValue) drops from 152 to 128 bytes; the plan value encoder
writes no use lists, so only its size check changes.
The two lists held the same users in the same order, except after
ReplaceArgument on a user that took the value in more than one
operand: uses dropped the user's first entry and operandUses the
replaced operand's entry. Uses() now follows operandUses there too.
shader_ir_use_rewrite counted the allocations of both lists: its
allocation failure check now fails the one reserve ReplaceAllUsesWith
makes, and its growth check allows the allocations of one list, which
main exceeds.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every IR value grew its argument vector one AddArgument at a time from
empty, so a value with three arguments allocated three times (capacity
1, 2 and then 4) and freed the first two. The constructor now reserves
IrOpcodeOperandCount(opcode) arguments, the count IrBuilder::Emit
already requires, so a value built with its opcode's arguments
allocates once. Opcodes without fixed arguments (constants, phis)
reserve nothing, as before. The IR and the SPIR-V are unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The SPIR-V interface check only allowed a push constant block for a program
with push data of its own, so a remapped vertex shader without any was
rejected as having an invalid push constant interface.
minMaxF16Bits compares the halves as ordered integers (the low 16 bits
sign-extended, with the magnitude bits of a negative half inverted),
then replaced the result when both halves were zero: max took a & b and
min took a | b. The ordered integers already put -0 (-1) below +0 (0),
so the compare picks +0 for max and -0 for min, which is what the
both-zero select produced. Every caller passes halves with their upper
16 bits clear (readF16Bits masks them, the packed path extracts them),
and for those all 2^32 pairs of each give the same bits with and
without the select. Each f16 min, max, min3, max3 and med3 now emits
five instructions fewer per pair.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The flag that adds the vertex stage to the push constant stages was not part
of the encoded result, so a journalled remapped vertex shader replayed
without it. Encode and decode it with the invocation and cover it in the
result round trip and the push stage test.
APS5_CRASH_STACK_BYTES=<n> prints n bytes of stack words from rsp after the
stack return address candidates, then eight words at every distinct stack word
that points at readable, non-executable memory outside the thread's stack.
Off when the variable is unset, empty or 0.
Windows refuses to start the image with a 0x7fe00000 gap (CreateProcess
WinError 193, SizeOfImage 0x7fe3e000), with or without this change. The
far image still checks the PE layout and the macOS conversion; native
Windows execution now uses a fixture whose segment is 64 MiB away.
Reported by simonbronk in the review.
A remapped vertex shader reads the scale and offset from the push block, but
the pipeline's push constant stages only counted programs with push data of
their own, so a shader with none got no stage in a non-GPL layout and its
scale and offset never arrived. The result now says it reads them, and the
push stages include the vertex stage for it. The draw test gains a fetchless
remapped vertex shader with no push data.
IrProgram::ReclaimUnusedValues put every live value into an
unordered_set, one allocation each, and looked every value of the
program up in it again. Values enter the program only through
CreateValue, which numbers them with nextValueId, so an id names at
most one of them. The marks of those values now live in a vector
indexed by id, after a check that the id's owner is the same pointer.
A value the program does not own, such as one in the resource plan's
value storage, which may reuse an id, still goes into a set. The values
kept and removed are unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Onimusha: Way of the Sword (PPSA27836 01.000.001) imports
_ZSt26__throw_bad_variant_accessv (9G6z-nF6njg) from libc, and its
bundled libc.prx does not export it, so the title fails to load with
an unresolved import.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GtXavMkgCTCdmRpweviHcQ