diff options
author | Charlotte Pabst <cpabst@codeweavers.com> | 2025-06-18 17:47:32 +0200 |
---|---|---|
committer | Marek Olšák <maraeo@gmail.com> | 2025-06-25 23:30:36 +0000 |
commit | 70df12a9ba398ab1ffaa9316bf6761abe78a664b (patch) | |
tree | e518945609f08d4b76033acbc4b2660ad0acd9ac | |
parent | 55d5b292e97fd5d4880d50e1cd7f5d2fb7a92587 (diff) |
-rw-r--r-- | tests/opengl.py | 1 | ||||
-rw-r--r-- | tests/spec/arb_fragment_program/CMakeLists.gl.txt | 1 | ||||
-rw-r--r-- | tests/spec/arb_fragment_program/recompile.c | 86 |
3 files changed, 88 insertions, 0 deletions
diff --git a/tests/opengl.py b/tests/opengl.py index 6bbb071f7..071a8843b 100644 --- a/tests/opengl.py +++ b/tests/opengl.py @@ -1863,6 +1863,7 @@ with profile.test_list.group_manager( g(['trinity-fp1']) g(['arb_fragment_program-sparse-samplers'], 'sparse-samplers') g(['arb_fragment_program-no-newline'], 'no-newline') + g(['arb_fragment_program-recompile'], 'recompile') g(['incomplete-texture', 'arb_fp'], 'incomplete-texture-arb_fp') with profile.test_list.group_manager( diff --git a/tests/spec/arb_fragment_program/CMakeLists.gl.txt b/tests/spec/arb_fragment_program/CMakeLists.gl.txt index 88ccfe7c1..d9643d56b 100644 --- a/tests/spec/arb_fragment_program/CMakeLists.gl.txt +++ b/tests/spec/arb_fragment_program/CMakeLists.gl.txt @@ -11,5 +11,6 @@ link_libraries ( piglit_add_executable (arb_fragment_program-minmax minmax.c) piglit_add_executable (arb_fragment_program-sparse-samplers sparse-samplers.c) piglit_add_executable (arb_fragment_program-no-newline no-newline.c) +piglit_add_executable (arb_fragment_program-recompile recompile.c) # vim: ft=cmake: diff --git a/tests/spec/arb_fragment_program/recompile.c b/tests/spec/arb_fragment_program/recompile.c new file mode 100644 index 000000000..1fbd4718b --- /dev/null +++ b/tests/spec/arb_fragment_program/recompile.c @@ -0,0 +1,86 @@ +/* Copyright © 2025 Charlotte Pabst for Codeweavers + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/* Test to make sure that replacing the source of a program + * works without issues. + */ + +#include "piglit-util-gl.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + + config.window_width = 100; + config.window_height = 100; + config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ + static const char *fp_source1 = + "!!ARBfp1.0\n" + "MOV result.color, {0, 0, 0, 0};\n" + "END\n"; + static const char *fp_source2 = + "!!ARBfp1.0\n" + "TEMP x;" + "LRP result.color, fragment.texcoord[0], {0.1, 0.1}, {0.3, 0.3};\n" + "END\n"; + const float expected1[] = { 0.0f, 0.0f, 0.0f, 0.0f }; + const float expected2[] = { 0.2f, 0.2f, 0.0f, 1.0f }; + GLuint prog; + bool pass = true; + + glEnable(GL_FRAGMENT_PROGRAM_ARB); + glGenProgramsARB(1, &prog); + glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog); + + glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, + GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(fp_source1), + (const GLubyte *) fp_source1); + piglit_draw_rect_tex(-1, -1, 2, 2, 0, 0, 1, 1); + pass = pass && piglit_probe_pixel_rgba(piglit_width/2, piglit_height/2, expected1); + + glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, + GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(fp_source2), + (const GLubyte *) fp_source2); + piglit_draw_rect_tex(-1, -1, 2, 2, 0, 0, 1, 1); + pass = pass && piglit_probe_pixel_rgba(piglit_width/2, piglit_height/2, expected2); + + piglit_present_results(); + + glDisable(GL_FRAGMENT_PROGRAM_ARB); + glDeleteProgramsARB(1, &prog); + + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + piglit_require_extension("GL_ARB_fragment_program"); +} |