"""Fractional wire coverage must preserve a different foreground surface.""" import os from pathlib import Path import struct import subprocess import tempfile import unittest ROOT=Path(__file__).resolve().parents[1] @unittest.skipUnless(os.environ.get('D4R_RUN_GPU_TESTS')=='1','opt-in GPU test') class WireBackgroundGpuTests(unittest.TestCase): def test_sky_wire_does_not_spill_onto_other_geometry(self): runner=os.environ['D4R_DUMP_RUNNER'] kernel=Path(os.environ.get('D4R_WIRE_TEST_KERNEL',str(ROOT/'build/wine-nvcuda/generated'/'gfx1101.hsaco'))) w,h=65,67 pitch,dp,mp=w*8+16,w*4+12,w*4+20 pixels=w*h rgba=struct.pack('<4e',.5,.5,.5,.5) observed=struct.pack('<4e',.125,.125,.125,.75) current=b''.join(rgba*w+b'\xa5'*16 for _ in range(h)) color=b''.join(observed*w+b'\xa5'*16 for _ in range(h)) depth=b''.join(struct.pack('<'+'f'*w,*[ .5 if y==32 else .9 if x<=31 and y<=31 else 1. for x in range(w)])+b'\xa5'*12 for y in range(h)) motion=b''.join(bytes(w*4)+b'\xa5'*20 for _ in range(h)) input_depth=b''.join(struct.pack('