FAILURE MAP
← Case archive

FA-10696 / Rendering state / Open access

Stencil write mask preserves bits · case 01

Masking only the new stencil value clears protected existing bits.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Masking only the new stencil value clears protected existing bits.

VERIFIED REPAIR

Use the stage contract: Old/new/mask are bytes. Replace only stencil bits enabled by the write mask; preserve every masked-off old bit.

Unsuccessful approach: Reversing mask roles updates protected bits instead of enabled bits.

Case contract

Old/new/mask are bytes. Replace only stencil bits enabled by the write mask; preserve every masked-off old bit.

Why this case matters

A deterministic software graphics stage with explicit channel and coordinate conventions; no hardware, device profile or API behavior is inferred.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(old, new, mask):
    return new & mask
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*(240, 15, 15)), 255)
check('fixture 2', solve(*(170, 85, 0)), 170)
check('fixture 3', solve(*(170, 85, 255)), 85)
check('fixture 4', solve(*(0, 255, 240)), 240)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 115255Failed
fixture 20170Failed
fixture 38585Passed
fixture 4240240Passed

SHA-256 / 097df9d1dfe8c3742ca63bd5e9371995900c0e8bb6378b908c5ac95704494217

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(old, new, mask):
    return (old & mask) | (new & (255^mask))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*(240, 15, 15)), 255)
check('fixture 2', solve(*(170, 85, 0)), 170)
check('fixture 3', solve(*(170, 85, 255)), 85)
check('fixture 4', solve(*(0, 255, 240)), 240)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 10255Failed
fixture 285170Failed
fixture 317085Failed
fixture 415240Failed

SHA-256 / 45ca43d3f84c92258bb2b67663e51314a94e7946a1390878f0a7622fe29582af

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(old, new, mask):
    return (old & (255^mask)) | (new & mask)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*(240, 15, 15)), 255)
check('fixture 2', solve(*(170, 85, 0)), 170)
check('fixture 3', solve(*(170, 85, 255)), 85)
check('fixture 4', solve(*(0, 255, 240)), 240)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 1255255Passed
fixture 2170170Passed
fixture 38585Passed
fixture 4240240Passed

SHA-256 / e6551e8e092b972dbf4f15990c9c8d0e2f2425f716086e487c7e4f785c4fea5d

Verification & scope

This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:38:41.342043+00:00.

Case digest / 7833d9e871212d1f24a31943b5e7a594c4ba13cbc32c1c49ce09a823e265c682