<div dir="ltr"><div>It's also an execution test for "varying out".</div><div><br></div><div>Marek<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 15, 2019 at 6:28 PM Ian Romanick <<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 4/15/19 10:47 AM, Marek Olšák wrote:<br>
> From: Marek Olšák <<a href="mailto:marek.olsak@amd.com" target="_blank">marek.olsak@amd.com</a>><br>
> <br>
> ---<br>
> tests/opengl.py | 7 ++<br>
> tests/spec/gl-3.1/mixed-int-float-fbo.c | 100 +++++++++++++++++++-----<br>
> 2 files changed, 88 insertions(+), 19 deletions(-)<br>
> <br>
> diff --git a/tests/opengl.py b/tests/opengl.py<br>
> index 40c37a055..666b35200 100644<br>
> --- a/tests/opengl.py<br>
> +++ b/tests/opengl.py<br>
> @@ -3026,20 +3026,27 @@ with profile.test_list.group_manager(<br>
> g(['getteximage-formats', 'init-by-rendering'])<br>
> g(['getteximage-formats', 'init-by-clear-and-render'])<br>
> g(['ext_framebuffer_multisample-fast-clear', 'single-sample'],<br>
> 'fbo-fast-clear')<br>
> g(['ext_framebuffer_object-border-texture-finish'])<br>
> add_fbo_stencil_tests(g, 'GL_STENCIL_INDEX1')<br>
> add_fbo_stencil_tests(g, 'GL_STENCIL_INDEX4')<br>
> add_fbo_stencil_tests(g, 'GL_STENCIL_INDEX8')<br>
> add_fbo_stencil_tests(g, 'GL_STENCIL_INDEX16')<br>
> <br>
> +<br>
> +with profile.test_list.group_manager(<br>
> + PiglitGLTest,<br>
> + grouptools.join('spec', 'ext_gpu_shader4')) as g:<br>
> + g(['gl-3.1-mixed-int-float-fbo', 'ext_gpu_shader4'], 'bindfragdatalocation mixed-int-float-fbo')<br>
> + g(['gl-3.1-mixed-int-float-fbo', 'ext_gpu_shader4', 'int_second'], 'bindfragdatalocation mixed-int-float-fbo int_second')<br>
> +<br>
> with profile.test_list.group_manager(<br>
> PiglitGLTest, grouptools.join('spec', 'ext_image_dma_buf_import')) as \<br>
> g:<br>
> g(['ext_image_dma_buf_import-invalid_hints'], run_concurrent=False)<br>
> g(['ext_image_dma_buf_import-invalid_attributes'], run_concurrent=False)<br>
> g(['ext_image_dma_buf_import-missing_attributes'], run_concurrent=False)<br>
> g(['ext_image_dma_buf_import-ownership_transfer'], run_concurrent=False)<br>
> g(['ext_image_dma_buf_import-unsupported_format'], run_concurrent=False)<br>
> g(['ext_image_dma_buf_import-intel_external_sampler_only'],<br>
> run_concurrent=False)<br>
> diff --git a/tests/spec/gl-3.1/mixed-int-float-fbo.c b/tests/spec/gl-3.1/mixed-int-float-fbo.c<br>
> index d2d7aeb65..8dfeccb41 100644<br>
> --- a/tests/spec/gl-3.1/mixed-int-float-fbo.c<br>
> +++ b/tests/spec/gl-3.1/mixed-int-float-fbo.c<br>
> @@ -26,22 +26,36 @@<br>
> * Test mixed integer/float FBO.<br>
> *<br>
> * If the argument 'int_second' is given the 0th color attachment will<br>
> * be a unorm texture and the 1st color attachment will be an integer texture.<br>
> * Otherwise, the 0th color attachment will be integer and the 1st color<br>
> * attachment will be unorm.<br>
> */<br>
> <br>
> #include "piglit-util-gl.h"<br>
> <br>
> +static bool ext_gpu_shader4 = false;<br>
> +<br>
> PIGLIT_GL_TEST_CONFIG_BEGIN<br>
> - config.supports_gl_core_version = 31;<br>
> + for (int i = 1; i < argc; i++) {<br>
> + if (!strcmp(argv[i], "ext_gpu_shader4")) {<br>
> + ext_gpu_shader4 = true;<br>
> + puts("Testing GL_EXT_gpu_shader4.");<br>
> + break;<br>
> + }<br>
> + }<br>
> +<br>
> + if (ext_gpu_shader4)<br>
> + config.supports_gl_compat_version = 10;<br>
> + else<br>
> + config.supports_gl_core_version = 31;<br>
> +<br>
> config.window_visual = PIGLIT_GL_VISUAL_RGBA;<br>
> config.khr_no_error_support = PIGLIT_NO_ERRORS;<br>
> PIGLIT_GL_TEST_CONFIG_END<br>
> <br>
> static const char *vs_text =<br>
> "#version 150\n"<br>
> "in vec4 vertex;\n"<br>
> "void main() \n"<br>
> "{ \n"<br>
> " gl_Position = vertex; \n"<br>
> @@ -50,35 +64,71 @@ static const char *vs_text =<br>
> static const char *fs_text =<br>
> "#version 150\n"<br>
> "out ivec4 outputInt;\n"<br>
> "out vec4 outputFloat;\n"<br>
> "void main() \n"<br>
> "{ \n"<br>
> " outputInt = ivec4(1, 2, 3, 4); \n"<br>
> " outputFloat = vec4(0.25, 0.5, 0.75, 1.0); \n"<br>
> "} \n";<br>
> <br>
> +static const char *vs_text_gpu_shader4 =<br>
> + "#version 110\n"<br>
> + "attribute vec4 vertex;\n"<br>
> + "void main() \n"<br>
> + "{ \n"<br>
> + " gl_Position = vertex; \n"<br>
> + "} \n";<br>
> +<br>
> +static const char *fs_text_gpu_shader4 =<br>
> + "#version 110\n"<br>
> + "#extension GL_EXT_gpu_shader4 : enable\n"<br>
> + "varying out ivec4 outputInt;\n"<br>
> + "varying out vec4 outputFloat;\n"<br>
> + "void main() \n"<br>
> + "{ \n"<br>
> + " outputInt = ivec4(1, 2, 3, 4); \n"<br>
> + " outputFloat = vec4(0.25, 0.5, 0.75, 1.0); \n"<br>
> + "} \n";<br>
> +<br>
> const int width = 128, height = 128;<br>
> bool int_output_first = true;<br>
> <br>
> <br>
> static GLuint<br>
> create_program(void)<br>
> {<br>
> - GLuint program = piglit_build_simple_program(vs_text, fs_text);<br>
> - if (int_output_first) {<br>
> - glBindFragDataLocation(program, 0, "outputInt");<br>
> - glBindFragDataLocation(program, 1, "outputFloat");<br>
> - }<br>
> - else {<br>
> - glBindFragDataLocation(program, 0, "outputFloat");<br>
> - glBindFragDataLocation(program, 1, "outputInt");<br>
> + GLuint program;<br>
> +<br>
> + if (ext_gpu_shader4) {<br>
> + program = piglit_build_simple_program(vs_text_gpu_shader4,<br>
> + fs_text_gpu_shader4);<br>
> +<br>
> + if (int_output_first) {<br>
> + glBindFragDataLocationEXT(program, 0, "outputInt");<br>
> + glBindFragDataLocationEXT(program, 1, "outputFloat");<br>
<br>
I don't know if this separation is strictly necessary. The Khronos<br>
gl.xml /says/ glBindFragDataLocationEXT is an alias of<br>
glBindFragDataLocation. There's no published GLX protocol, so there's<br>
nothing that prevents the two from being unaliased in the future.<br>
<br>
I don't feel very strongly about it either way. Whichever way you<br>
decide to do it, this patch is<br>
<br>
Reviewed-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com" target="_blank">ian.d.romanick@intel.com</a>><br>
<br>
> + }<br>
> + else {<br>
> + glBindFragDataLocationEXT(program, 0, "outputFloat");<br>
> + glBindFragDataLocationEXT(program, 1, "outputInt");<br>
> + }<br>
> + } else {<br>
> + program = piglit_build_simple_program(vs_text, fs_text);<br>
> +<br>
> + if (int_output_first) {<br>
> + glBindFragDataLocation(program, 0, "outputInt");<br>
> + glBindFragDataLocation(program, 1, "outputFloat");<br>
> + }<br>
> + else {<br>
> + glBindFragDataLocation(program, 0, "outputFloat");<br>
> + glBindFragDataLocation(program, 1, "outputInt");<br>
> + }<br>
> }<br>
> <br>
> glLinkProgram(program);<br>
> if (!piglit_link_check_status(program))<br>
> piglit_report_result(PIGLIT_FAIL);<br>
> <br>
> piglit_check_gl_error(GL_NO_ERROR);<br>
> <br>
> return program;<br>
> }<br>
> @@ -139,30 +189,35 @@ create_fbo(void)<br>
> piglit_report_result(PIGLIT_SKIP);<br>
> }<br>
> <br>
> return fbo;<br>
> }<br>
> <br>
> <br>
> enum piglit_result<br>
> piglit_display(void)<br>
> {<br>
> - const int int_clear[4] = { 99, 99, 99, 99 };<br>
> - const float float_clear[4] = { 0.33, 0.33, 0.33, 0.33 };<br>
> -<br>
> - if (int_output_first) {<br>
> - glClearBufferiv(GL_COLOR, 0, int_clear);<br>
> - glClearBufferfv(GL_COLOR, 1, float_clear);<br>
> - }<br>
> - else {<br>
> - glClearBufferfv(GL_COLOR, 0, float_clear);<br>
> - glClearBufferiv(GL_COLOR, 1, int_clear);<br>
> + if (ext_gpu_shader4) {<br>
> + glClearColor(0, 0, 0, 0);<br>
> + glClear(GL_COLOR_BUFFER_BIT);<br>
> + } else {<br>
> + const int int_clear[4] = { 99, 99, 99, 99 };<br>
> + const float float_clear[4] = { 0.33, 0.33, 0.33, 0.33 };<br>
> +<br>
> + if (int_output_first) {<br>
> + glClearBufferiv(GL_COLOR, 0, int_clear);<br>
> + glClearBufferfv(GL_COLOR, 1, float_clear);<br>
> + }<br>
> + else {<br>
> + glClearBufferfv(GL_COLOR, 0, float_clear);<br>
> + glClearBufferiv(GL_COLOR, 1, int_clear);<br>
> + }<br>
> }<br>
> <br>
> piglit_draw_rect(-1, -1, 2, 2);<br>
> <br>
> bool pass = true;<br>
> <br>
> /* check the int target */<br>
> if (int_output_first) {<br>
> glReadBuffer(GL_COLOR_ATTACHMENT0);<br>
> }<br>
> @@ -205,20 +260,27 @@ piglit_display(void)<br>
> <br>
> pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
> <br>
> return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
> }<br>
> <br>
> <br>
> void<br>
> piglit_init(int argc, char **argv)<br>
> {<br>
> + if (ext_gpu_shader4) {<br>
> + piglit_require_gl_version(20);<br>
> + piglit_require_extension("GL_ARB_framebuffer_object");<br>
> + piglit_require_extension("GL_EXT_gpu_shader4");<br>
> + piglit_require_extension("GL_EXT_texture_integer");<br>
> + }<br>
> +<br>
> if (argc > 1 && strcmp(argv[1], "int_second") == 0) {<br>
> int_output_first = false;<br>
> }<br>
> <br>
> GLuint fbo = create_fbo();<br>
> GLuint program = create_program();<br>
> <br>
> glBindFramebuffer(GL_FRAMEBUFFER, fbo);<br>
> glUseProgram(program);<br>
> }<br>
> <br>
<br>
</blockquote></div>