Skip to content

Commit

Permalink
tests/gpu_tests: add pl_frames_infer_* tests
Browse files Browse the repository at this point in the history
  • Loading branch information
haasn committed Sep 18, 2023
1 parent 84ebe49 commit c4c68fe
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/tests/gpu_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,11 @@ static void pl_render_tests(pl_gpu gpu)
REQUIRE(pl_renderer_get_errors(rr).errors == PL_RENDER_ERR_NONE);
params = pl_render_default_params;

struct pl_frame inferred_image = image, inferred_target = target;
pl_frames_infer(rr, &inferred_image, &inferred_target);
REQUIRE(pl_render_image(rr, &inferred_image, &inferred_target, &params));
REQUIRE(pl_renderer_get_errors(rr).errors == PL_RENDER_ERR_NONE);

// Test background blending and alpha transparency
params.blend_against_tiles = true;
params.corner_rounding = 0.25f;
Expand Down Expand Up @@ -1371,10 +1376,20 @@ static void pl_render_tests(pl_gpu gpu)
};
REQUIRE(pl_render_image_mix(rr, &mix, &target, &mix_params));

// Test inferring frame mix
inferred_target = target;
pl_frames_infer_mix(rr, &mix, &inferred_target, &inferred_image);
REQUIRE(pl_render_image_mix(rr, &mix, &target, &mix_params));

// Test empty frame mix
mix = (struct pl_frame_mix) {0};
REQUIRE(pl_render_image_mix(rr, &mix, &target, &mix_params));

// Test inferring empty frame mix
inferred_target = target;
pl_frames_infer_mix(rr, &mix, &inferred_target, &inferred_image);
REQUIRE(pl_render_image_mix(rr, &mix, &target, &mix_params));

// Test mixer queue
#define NUM_MIX_FRAMES 20
const float frame_duration = 1.0 / 24.0;
Expand Down

0 comments on commit c4c68fe

Please sign in to comment.