Пример #1
0
def red_image_no_vert(tmp_path: pathlib2.Path, is_android: bool):
    out_dir = tmp_path / 'out'
    # There should be a fragment shader...
    assert os.path.isfile(cmd_helpers.get_shaders_dir() + os.sep + 'testing' +
                          os.sep + 'runspv' + os.sep + 'image' + os.sep +
                          'red_image_no_vert.frag')
    # ...but no vertex shader
    assert not os.path.isfile(cmd_helpers.get_shaders_dir() + os.sep +
                              'testing' + os.sep + 'runspv' + os.sep +
                              'image' + os.sep + 'red_image_no_vert.vert')
    args = [
        'android' if is_android else 'host',
        get_image_test('red_image_no_vert.json'),
        str(out_dir)
    ]
    runspv.main_helper(args)
    assert is_success(out_dir)
    image_file = out_dir / 'image_0.png'
    assert image_file.exists()
    image = PIL.Image.open(str(image_file)).convert('RGB')
    r, g, b = image.getpixel((0, 0))
    assert r == 255
    assert g == 0
    assert b == 0
Пример #2
0
def get_compute_samples_dir() -> str:
    return cmd_helpers.get_shaders_dir(
    ) + os.sep + 'samples' + os.sep + 'compute' + os.sep + '320es'
Пример #3
0
def get_image_test(json_filename: str) -> str:
    return cmd_helpers.get_shaders_dir() + os.sep + 'testing' + os.sep + 'runspv' + os.sep + 'image' + os.sep \
           + json_filename