diff options
author | Vasily Khoruzhick <anarsoul@gmail.com> | 2022-05-26 23:41:39 -0700 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-06-23 22:18:02 +0000 |
commit | 479b0002d004bc99514d186724b5a4fbfe543370 (patch) | |
tree | 2a857a173becfe55b11cf244e40808a685b0a89f /tests/spec/arb_blend_func_extended/execution/fbo-extended-blend.c | |
parent | cdbf346467a56639ff7f54d7d83de35772c5ddf6 (diff) |
arb_blend_func_extended: add GL_ARB_ES2_compatibility support
lima driver exposes GL_ARB_blend_func_extended, but it has no
GL_EXT_gpu_shader4 support. The only way to use it in GL
is by using GLES2 shaders.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/688>
Diffstat (limited to 'tests/spec/arb_blend_func_extended/execution/fbo-extended-blend.c')
-rw-r--r-- | tests/spec/arb_blend_func_extended/execution/fbo-extended-blend.c | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/tests/spec/arb_blend_func_extended/execution/fbo-extended-blend.c b/tests/spec/arb_blend_func_extended/execution/fbo-extended-blend.c index 7020c46d4..dd11a3b5f 100644 --- a/tests/spec/arb_blend_func_extended/execution/fbo-extended-blend.c +++ b/tests/spec/arb_blend_func_extended/execution/fbo-extended-blend.c @@ -55,6 +55,7 @@ static GLint max_ds_buffers; static GLuint fbo; static bool use_gpu_shader4; +static bool use_gles2_shader; static GLenum srcFactors[] = { GL_ZERO, @@ -207,6 +208,23 @@ static void blend_expected(float *expected, const float *src, const float *src1, } } +static const char *vs_text_gles2 = + "#version 100\n" + "attribute vec4 piglit_vertex;\n" + "void main() {\n" + " gl_Position = piglit_vertex;\n" + "}\n" + ; +static const char *fs_text_gles2 = + "#version 100\n" + "#extension GL_EXT_blend_func_extended : enable\n" + "uniform highp vec4 src0;\n" + "uniform highp vec4 src1;\n" + "void main() {\n" + " gl_FragColor = src0;\n" + " gl_SecondaryFragColorEXT = src1;\n" + "}\n" + ; #ifdef PIGLIT_USE_OPENGL static const char *vs_text = "#version 120\n" @@ -334,15 +352,26 @@ test(void) } prog = glCreateProgram(); - vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text); + if (use_gles2_shader) + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text_gles2); + else + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text); + + if (use_gpu_shader4) + fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text_gpu4); + else if (use_gles2_shader) + fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text_gles2); + else + fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text); - fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, use_gpu_shader4 ? fs_text_gpu4 : fs_text); glAttachShader(prog, vs); glAttachShader(prog, fs); piglit_check_gl_error(GL_NO_ERROR); - glBindFragDataLocationIndexed(prog, 0, 0, "col0"); - glBindFragDataLocationIndexed(prog, 0, 1, "col1"); + if (!use_gles2_shader) { + glBindFragDataLocationIndexed(prog, 0, 0, "col0"); + glBindFragDataLocationIndexed(prog, 0, 1, "col1"); + } create_fbo(); @@ -406,10 +435,13 @@ piglit_init(int argc, char**argv) int major, minor; piglit_get_glsl_version(NULL, &major, &minor); int vers = 100 * major + minor; - if (vers < 130) { - piglit_require_extension("GL_EXT_gpu_shader4"); + if (vers < 130 && + piglit_is_extension_supported("GL_EXT_gpu_shader4")) use_gpu_shader4 = true; - } else + else if (vers < 130 && + piglit_is_extension_supported("GL_ARB_ES2_compatibility")) + use_gles2_shader = true; + else piglit_require_GLSL_version(130); #else // PIGLIT_USE_OPENGL_ES3 |