tests: refactor caps getting code out.

This just makes getting caps be common code.

Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Dave Airlie 7 years ago
parent 8007cc0b12
commit 3cd2caad2b
  1. 21
      tests/testvirgl.c

@ -267,7 +267,7 @@ int testvirgl_create_backed_simple_buffer(struct virgl_resource *res,
return 0;
}
uint32_t testvirgl_get_glsl_level_from_caps(void)
static void *get_caps(void)
{
uint32_t max_ver, max_size, glsl_level;
void *caps;
@ -276,11 +276,16 @@ uint32_t testvirgl_get_glsl_level_from_caps(void)
ck_assert_int_eq(max_ver, 1);
ck_assert_int_ne(max_size, 0);
ck_assert_int_eq(max_size, sizeof(struct virgl_caps_v1));
caps = malloc(max_size);
virgl_renderer_fill_caps(0, 0, caps);
return caps;
}
uint32_t testvirgl_get_glsl_level_from_caps(void)
{
uint32_t glsl_level;
void *caps = get_caps();
struct virgl_caps_v1 *v1 = (struct virgl_caps_v1*) caps;
glsl_level = v1->glsl_level;
@ -291,18 +296,8 @@ uint32_t testvirgl_get_glsl_level_from_caps(void)
unsigned testvirgl_get_multisample_from_caps(void)
{
uint32_t max_ver, max_size;
void *caps = get_caps();
unsigned multisample;
void *caps;
virgl_renderer_get_cap_set(1, &max_ver, &max_size);
ck_assert_int_eq(max_ver, 1);
ck_assert_int_ne(max_size, 0);
ck_assert_int_eq(max_size, sizeof(struct virgl_caps_v1));
caps = malloc(max_size);
virgl_renderer_fill_caps(0, 0, caps);
struct virgl_caps_v1 *v1 = (struct virgl_caps_v1*) caps;
multisample = v1->bset.texture_multisample;

Loading…
Cancel
Save