@@ -356,24 +356,28 @@ lagfx_vk_iosurface_t *lagfx_texture_realize(lagfx_protocol_t *p,
356356 for (uint32_t o = 0 ; o + 4u <= want ; o += 4u )
357357 if (pick [o ] | pick [o + 1 ] | pick [o + 2 ]) nb ++ ;
358358 /* Opaque-layer alpha: the 16F login backdrop's backing carries REAL RGB
359- * imagery (render-verified: the Sequoia forest wallpaper) but an ALL-ZERO
360- * alpha channel — the layer is opaque, so the guest's compositor ignores
361- * alpha and never writes it. Our sampled VkImage returns that a=0 into
362- * the panel material's alpha-threshold → every draw sampling the
363- * backdrop discards → black scene. Apply the opaque contract only when
364- * the WHOLE channel is zero (any real alpha anywhere → leave untouched):
365- * rewrite alpha halves to 1.0 (0x3C00). */
359+ * imagery (render-verified: the Sequoia forest wallpaper) but its alpha
360+ * channel is 0xFFFF (NaN) in every texel — an RGBX16F opaque layer whose
361+ * X filler the guest never writes meaningfully. Sampled NaN alpha poisons
362+ * the panel material's blending/threshold math → the settled scene went
363+ * black once AUTHTEX bound the real backdrop. Apply the opaque contract
364+ * only when NO texel carries a finite nonzero alpha (a single real alpha
365+ * value anywhere → leave the channel untouched): rewrite alpha halves to
366+ * 1.0 (0x3C00). */
366367 {
367368 uint32_t bpp_probe = (lagfx_le32 (desc + 32 ) >> 24 ) & 0xFFu ;
368369 if (bpp_probe == 8u && want >= 8u ) {
369370 bool any_alpha = false;
370371 for (uint32_t o = 6u ; o + 2u <= want ; o += 8u ) {
371- if ((lagfx_le16 (pick + o ) & 0x7FFFu ) != 0u ) { any_alpha = true; break ; }
372+ uint16_t mag = (uint16_t )(lagfx_le16 (pick + o ) & 0x7FFFu );
373+ /* finite nonzero half: mag in (0, 0x7C00) — 0x7C00 = inf,
374+ * above = NaN */
375+ if (mag != 0u && mag < 0x7C00u ) { any_alpha = true; break ; }
372376 }
373377 if (!any_alpha ) {
374378 for (uint32_t o = 6u ; o + 2u <= want ; o += 8u )
375379 lagfx_put_le16 (pick + o , 0x3C00u );
376- LAGFX_LOG ("TEXREAL: ref=0x%x all-zero 16F alpha -> opaque (a=1.0)" ,
380+ LAGFX_LOG ("TEXREAL: ref=0x%x no finite 16F alpha -> opaque (a=1.0)" ,
377381 tref );
378382 }
379383 }
0 commit comments