tests: Check if geometry shaders are available before running tests

Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Elie Tournier 7 years ago committed by Dave Airlie
parent 9fd1df5576
commit a4fbf0d8a5
  1. 7
      tests/test_virgl_cmd.c
  2. 23
      tests/testvirgl.c
  3. 1
      tests/testvirgl.h

@ -497,6 +497,13 @@ START_TEST(virgl_test_render_geom_simple)
ret = testvirgl_init_ctx_cmdbuf(&ctx);
ck_assert_int_eq(ret, 0);
/* Geometry shader are only available since GLSL 150 */
uint32_t glsl_level = testvirgl_get_glsl_level_from_caps();
if (glsl_level < 150) {
testvirgl_fini_ctx_cmdbuf(&ctx);
return;
}
/* init and create simple 2D resource */
ret = testvirgl_create_backed_simple_2d_res(&res, 1, tw, th);
ck_assert_int_eq(ret, 0);

@ -32,6 +32,7 @@
#include "util/u_format.h"
#include "testvirgl.h"
#include "virgl_hw.h"
#include "virglrenderer.h"
void testvirgl_init_simple_1d_resource(struct virgl_renderer_resource_create_args *res, int handle)
@ -265,3 +266,25 @@ int testvirgl_create_backed_simple_buffer(struct virgl_resource *res,
virgl_renderer_resource_attach_iov(res->handle, res->iovs, res->niovs);
return 0;
}
uint32_t testvirgl_get_glsl_level_from_caps(void)
{
uint32_t max_ver, max_size, glsl_level;
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;
glsl_level = v1->glsl_level;
free(caps);
return glsl_level;
}

@ -77,4 +77,5 @@ int testvirgl_create_backed_simple_2d_res(struct virgl_resource *res,
int testvirgl_create_backed_simple_buffer(struct virgl_resource *res,
int handle, int size, int bind);
void testvirgl_destroy_backed_res(struct virgl_resource *res);
uint32_t testvirgl_get_glsl_level_from_caps(void);
#endif

Loading…
Cancel
Save