ImageProcessing::depthColours reads depthWeights as 64 RGBA entries (alpha 1.0 = the GS's 0x80), the index clamped to 63, replacing the texel. With Blend::DestinationBySource this is a port's depth fog: a ramp colour added and the scene scaled by the ramp's alpha (VP2S: the Lost Forest haze). Hashed only when set, so existing frame digests are unchanged. Two admission guards, a digest check and a GPU case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2.6 KiB
Native image processing
Material::ImageProcessing describes PC image operations supplied by a port.
It has no dependency on console command streams, hardware register state or
console image layouts. Renderer::draw copies the parameters into the frame;
subsequent producer edits cannot change a published draw. Disabled operations
leave existing frame digests unchanged.
- A symmetric separable convolution has radius 1..16, a centre coefficient and
one coefficient for each positive offset. Both sides use the same coefficient.
stepis a normalized source-image displacement. The port supplies normalized coefficients if it wants an energy-preserving kernel. Sampling uses LOD zero. depthLookupproduces grayscale RGB from the current main framebuffer depth. Its index isclamp(floor((1-windowDepth)*depthScale),0,255). Each table entry is normalized to 0..1. The depth image is a private OpenGL copy taken before this batch, not a delayed CPU depth query. This operation excludes convolution. WithdepthColours,depthWeightsholds 64 RGBA entries (each 0..1, alpha 1.0 being the GS's 0x80) and the index is clamped to 63; the entry replaces the texel. WithBlend::DestinationBySourcethis adds a depth fog colour and attenuates the scene by the entry's alpha.alphaSourcemultiplies output alpha by another auxiliary image's green channel, withclamp(green*alphaScale,0,1). The source must have a producer in the current frame and cannot be the draw target. It samples bilinearly in destination framebuffer coordinates. Ordinary alpha blending can then combine colour and opacity images without changing the main depth attachment.targetWidth/targetHeightoptionally set a batch's auxiliary image dimensions. They travel with the draw, so a later port resize cannot change earlier work. Existing global target sizes remain the default. A shared-depth target must match main-frame dimensions. A resized image is cleared before its first draw.
Image operations require frame draws; overlay admission rejects them. Invalid indices, dimensions, coefficients, table values and nonfinite parameters fail before publication. Frame digests include each active operation's values.
native_image_processing covers immutable publication, digest changes and
mutation-free admission failures. With BOZO_APP=ON, the hidden video-only
native_image_processing_gpu fixture checks an exact three-tap kernel, current
depth lookup, independent opacity images, target resizing and optional shader
state reset. It initializes no host input. No game data is required.