[Piglit] [PATCH 5/8] sample_common: Separate EGLImage-to-texture from drawing.
Eric Anholt
eric at anholt.net
Tue Jul 26 00:43:41 UTC 2016
This will get reused from refcount testing.
---
tests/spec/ext_image_dma_buf_import/sample_common.c | 21 ++++++++++++++++++---
tests/spec/ext_image_dma_buf_import/sample_common.h | 3 +++
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.c b/tests/spec/ext_image_dma_buf_import/sample_common.c
index 78e4de378494..9864ad038644 100644
--- a/tests/spec/ext_image_dma_buf_import/sample_common.c
+++ b/tests/spec/ext_image_dma_buf_import/sample_common.c
@@ -47,10 +47,10 @@ static const char vs_src[] =
" gl_Position = piglit_vertex;\n"
"}\n";
-static enum piglit_result
-sample_and_destroy_img(unsigned w, unsigned h, EGLImageKHR img)
+enum piglit_result
+texture_for_egl_image(EGLImageKHR img, GLuint *out_tex)
{
- GLuint prog, tex;
+ GLuint tex;
GLenum error;
glGenTextures(1, &tex);
@@ -79,6 +79,21 @@ sample_and_destroy_img(unsigned w, unsigned h, EGLImageKHR img)
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
+ *out_tex = tex;
+
+ return PIGLIT_PASS;
+}
+
+static enum piglit_result
+sample_and_destroy_img(unsigned w, unsigned h, EGLImageKHR img)
+{
+ GLuint prog, tex;
+ enum piglit_result res;
+
+ res = texture_for_egl_image(img, &tex);
+ if (res != PIGLIT_PASS)
+ return res;
+
prog = piglit_build_simple_program(vs_src, fs_src);
glUseProgram(prog);
diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.h b/tests/spec/ext_image_dma_buf_import/sample_common.h
index 7160b816ca03..75a5c59bdbc1 100644
--- a/tests/spec/ext_image_dma_buf_import/sample_common.h
+++ b/tests/spec/ext_image_dma_buf_import/sample_common.h
@@ -39,4 +39,7 @@ enum piglit_result
egl_image_for_dma_buf_fd(int fd, int fourcc, int w, int h,
unsigned stride, unsigned offset, EGLImageKHR *out_img);
+enum piglit_result
+texture_for_egl_image(EGLImageKHR img, GLuint *out_tex);
+
#endif /* SAMPLE_COMMON_H */
--
2.8.1
More information about the Piglit
mailing list