[Piglit] [PATCH 1/2] shader_runner: add arb_gpu_shader_int64 support.
From: Dave AirlieThis adds support for 64-bit integer uniforms to shader_runner infrastructure. Signed-off-by: Dave Airlie --- tests/shaders/shader_runner.c | 97 +++ 1 file changed, 97 insertions(+) diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c index 94c7826..1187c64 100644 --- a/tests/shaders/shader_runner.c +++ b/tests/shaders/shader_runner.c @@ -185,6 +185,14 @@ static const struct string_to_enum all_types[] = { ENUM_STRING(GL_UNSIGNED_INT_VEC2), ENUM_STRING(GL_UNSIGNED_INT_VEC3), ENUM_STRING(GL_UNSIGNED_INT_VEC4), + ENUM_STRING(GL_INT64_ARB), + ENUM_STRING(GL_INT64_VEC2_ARB), + ENUM_STRING(GL_INT64_VEC3_ARB), + ENUM_STRING(GL_INT64_VEC4_ARB), + ENUM_STRING(GL_UNSIGNED_INT64_ARB), + ENUM_STRING(GL_UNSIGNED_INT64_VEC2_ARB), + ENUM_STRING(GL_UNSIGNED_INT64_VEC3_ARB), + ENUM_STRING(GL_UNSIGNED_INT64_VEC4_ARB), ENUM_STRING(GL_BOOL), ENUM_STRING(GL_BOOL_VEC2), ENUM_STRING(GL_BOOL_VEC3), @@ -1411,6 +1419,23 @@ get_uints(const char *line, unsigned *uints, unsigned count) uints[i] = strtoul(line, (char **) , 0); } +static void +get_int64s(const char *line, int64_t *ints, unsigned count) +{ + int i; + + for (i = 0; i < count; i++) + ints[i] = strtoll(line, (char **) , 0); +} + +static void +get_uint64s(const char *line, uint64_t *ints, unsigned count) +{ + int i; + + for (i = 0; i < count; i++) + ints[i] = strtoull(line, (char **) , 0); +} /** * Check that the GL implementation supports unsigned uniforms @@ -1437,6 +1462,18 @@ check_double_support(void) } /** + * Check that the GL implementation supports double uniforms + * (e.g. through glUniform1d). If not, terminate the test with a + * SKIP. + */ +static void +check_int64_support(void) +{ + if (!piglit_is_extension_supported("GL_ARB_gpu_shader_int64")) + piglit_report_result(PIGLIT_SKIP); +} + +/** * Check that the GL implementation supports shader subroutines * If not, terminate the test with a SKIP. */ @@ -1463,6 +1500,8 @@ set_ubo_uniform(char *name, const char *type, const char *line, int ubo_array_in double d[16]; int ints[16]; unsigned uints[16]; + uint64_t uint64s[16]; + int64_t int64s[16]; int name_len = strlen(name); if (!num_uniform_blocks) @@ -1527,6 +1566,12 @@ set_ubo_uniform(char *name, const char *type, const char *line, int ubo_array_in if (string_match("float", type)) { get_floats(line, f, 1); memcpy(data, f, sizeof(float)); + } else if (string_match("int64_t", type)) { + get_int64s(line, int64s, 1); + memcpy(data, int64s, sizeof(int64_t)); + } else if (string_match("uint64_t", type)) { + get_uint64s(line, uint64s, 1); + memcpy(data, uint64s, sizeof(uint64_t)); } else if (string_match("int", type)) { get_ints(line, ints, 1); memcpy(data, ints, sizeof(int)); @@ -1548,6 +1593,14 @@ set_ubo_uniform(char *name, const char *type, const char *line, int ubo_array_in int elements = type[4] - '0'; get_uints(line, uints, elements); memcpy(data, uints, elements * sizeof(unsigned)); + } else if (string_match("i64vec", type)) { + int elements = type[6] - '0'; + get_int64s(line, int64s, elements); + memcpy(data, int64s, elements * sizeof(int64_t)); + } else if (string_match("u64vec", type)) { + int elements = type[6] - '0'; + get_uint64s(line, uint64s, elements); + memcpy(data, uint64s, elements * sizeof(uint64_t)); } else if (string_match("dvec", type)) { int elements = type[4] - '0'; get_doubles(line, d, elements); @@ -1638,6 +1691,8 @@ set_uniform(const char *line, int ubo_array_index) double d[16]; int ints[16]; unsigned uints[16]; + int64_t int64s[16]; + uint64_t uint64s[16]; GLint loc; const char *type; @@ -1667,6 +1722,16 @@ set_uniform(const char *line, int ubo_array_index) get_floats(line, f, 1); glUniform1fv(loc, 1, f); return; + } else if (string_match("int64_t", type)) { + check_int64_support(); + get_int64s(line, int64s, 1); + glUniform1i64vARB(loc, 1, int64s); + return; + } else if (string_match("uint64_t", type)) { + check_int64_support(); + get_uint64s(line, uint64s, 1); + glUniform1ui64vARB(loc, 1, uint64s); + return; } else if (string_match("int", type)) { get_ints(line, ints, 1);
[Piglit] [PATCH 2/2] arb_gpu_shader_int64: add builtin test generator.
From: Dave AirlieLike the normal and fp64 generators, this generates a bunch of the built-in tests for use with shader_runner --- generated_tests/CMakeLists.txt |5 + generated_tests/builtin_function_int64.py | 1001 generated_tests/gen_builtin_uniform_tests_int64.py | 642 + 3 files changed, 1648 insertions(+) create mode 100644 generated_tests/builtin_function_int64.py create mode 100644 generated_tests/gen_builtin_uniform_tests_int64.py diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt index 0b9048f..8422329 100644 --- a/generated_tests/CMakeLists.txt +++ b/generated_tests/CMakeLists.txt @@ -196,6 +196,10 @@ piglit_make_generated_tests( templates/gen_vs_in_fp64/execution_base.mako templates/gen_vs_in_fp64/shader.vert.mako templates/gen_vs_in_fp64/shader_base.mako) +piglit_make_generated_tests( + builtin_uniform_tests_int64.list + gen_builtin_uniform_tests_int64.py + builtin_function_int64.py) # OpenCL Test generators piglit_make_generated_tests( @@ -247,6 +251,7 @@ add_custom_target(gen-gl-tests vp-tex.list variable_index_write_tests.list vs_in_fp64.list + builtin_uniform_tests_int64.list ) # Create a custom target for generating OpenCL tests diff --git a/generated_tests/builtin_function_int64.py b/generated_tests/builtin_function_int64.py new file mode 100644 index 000..56af117 --- /dev/null +++ b/generated_tests/builtin_function_int64.py @@ -0,0 +1,1001 @@ +# coding=utf-8 +# +# Copyright © 2011 Intel Corporation +# +# 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. + +# This source file defines a set of test vectors that can be used to +# test GLSL's built-in functions and operators. It is intended to be +# used by Python code that generates Piglit tests. +# +# The key export is the dictionary test_suite. It contains an entry +# for each possible overload of every pure built-in function and +# operator. By iterating through this dictionary you can find a set +# of test vectors for testing nearly every built-in GLSL function. +# +# The following functions are not included, since they are not pure, +# so they can't be tested using simple vectors: +# - dFdx() +# - dFdy() +# - fwidth() +# - ftransform() +# - Increment and decrement operators +# +# The following functions are not included, since they need to be +# tested in specialized ways: +# - modf(): not tested because it has an out parameter +# - isnan() and isinf(): not tested because special effort is required +# to create values that cause these functions to return true. +# +# Also not tested are array subscripting, field/method selection, +# swizzling, the function call operator, assignment, and the sequence +# operator. + +from __future__ import print_function, division, absolute_import +import collections +import itertools +import functools + +from six.moves import range +import numpy as np + + +# Floating point types used by Python and numpy +INT32_TYPES = (int, np.int32) +UINT32_TYPES = (int, np.uint32) +INT64_TYPES = (long, np.int64) +UINT64_TYPES = (long, np.uint64) + +class GlslBuiltinType(object): +"""Class representing a GLSL built-in type.""" +def __init__(self, name, base_type, num_cols, num_rows, + version_introduced): +self.__name = name +if base_type is not None: +self.__base_type = base_type +else: +self.__base_type = self +self.__num_cols = num_cols +self.__num_rows = num_rows +self.__version_introduced = version_introduced + +@property +def name(self): +"""The name of the type, as a string.""" +return self.__name + +@property +def base_type(self): +"""For vectors and matrices, the type of
Re: [Piglit] [PATCH] arb_copy_image-formats: add a bunch of const qualifiers
On Fri, Jun 3, 2016 at 10:44 AM, Brian Paulwrote: > --- > tests/spec/arb_copy_image/formats.c | 34 ++ > 1 file changed, 18 insertions(+), 16 deletions(-) > > diff --git a/tests/spec/arb_copy_image/formats.c > b/tests/spec/arb_copy_image/formats.c > index 5ae6631..e6e98a4 100644 > --- a/tests/spec/arb_copy_image/formats.c > +++ b/tests/spec/arb_copy_image/formats.c > @@ -55,7 +55,7 @@ struct texture_format { > GLuint block_height; > }; > > -struct texture_format formats[] = { > +static const struct texture_format formats[] = { > #define FORMAT(IF, F, D, S, B, W, H) { IF, #IF, F, D, S, B, W, H } > FORMAT(GL_RED, GL_RED, GL_UNSIGNED_BYTE, false, 1, 1, 1), > FORMAT(GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, true, 1, 1, 1), > @@ -181,11 +181,11 @@ struct texture_format formats[] = { > > #define ARRAY_LENGTH(X) (sizeof(X)/sizeof(*(X))) > > -static struct texture_format * > +static const struct texture_format * > find_format(const char *str) > { > int i; > - struct texture_format *format = NULL; > + const struct texture_format *format = NULL; > > for (i = 0; i < sizeof(formats) / sizeof(*formats); ++i) { > if (strcmp(str, formats[i].name) == 0) { > @@ -199,7 +199,7 @@ find_format(const char *str) > } > > static bool > -is_format_snorm(struct texture_format *format) > +is_format_snorm(const struct texture_format *format) > { > switch (format->internal_format) { > case GL_R8_SNORM: > @@ -217,13 +217,13 @@ is_format_snorm(struct texture_format *format) > } > > static bool > -is_format_compressed(struct texture_format *format) > +is_format_compressed(const struct texture_format *format) > { > return format->block_width != 1 && format->block_height != 1; > } > > static bool > -is_format_supported(struct texture_format *format) > +is_format_supported(const struct texture_format *format) > { > switch (format->internal_format) { > #ifdef GL_EXT_texture_compression_rgtc > @@ -268,7 +268,8 @@ is_format_supported(struct texture_format *format) > } > > static bool > -are_formats_compatible(struct texture_format *f1, struct texture_format *f2) > +are_formats_compatible(const struct texture_format *f1, > + const struct texture_format *f2) > { > if (f1 == f2) > return true; > @@ -286,7 +287,7 @@ are_formats_compatible(struct texture_format *f1, struct > texture_format *f2) > > static const float green[3] = {0.0, 1.0, 0.0}; > > -struct texture_format *src_format_arg, *dst_format_arg; > +const struct texture_format *src_format_arg, *dst_format_arg; > unsigned char *rand_data, *src_data, *dst_data, *res_data; > int samples = 1; > > @@ -387,8 +388,8 @@ memcpy_rect(void *src, int src_stride, int src_x, int > src_y, > } > > static void > -setup_test_data(struct texture_format *src_format, > - struct texture_format *dst_format) > +setup_test_data(const struct texture_format *src_format, > + const struct texture_format *dst_format) > { > int i, j, stride, image_size, data_size; > unsigned char *src_image, *res_image; > @@ -529,7 +530,7 @@ const char ms_compare_fs_source[] = > "}\n"; > > void > -load_compare_program(struct texture_format *format) > +load_compare_program(const struct texture_format *format) > { > static struct { > GLuint prog; > @@ -617,8 +618,8 @@ load_compare_program(struct texture_format *format) > } > > static enum piglit_result > -run_multisample_test(struct texture_format *src_format, > -struct texture_format *dst_format) > +run_multisample_test(const struct texture_format *src_format, > +const struct texture_format *dst_format) > { > bool pass = true; > int fbo_width, fbo_height; > @@ -800,7 +801,8 @@ check_texture(GLuint texture, unsigned level, > } > > static enum piglit_result > -run_test(struct texture_format *src_format, struct texture_format > *dst_format) > +run_test(const struct texture_format *src_format, > +const struct texture_format *dst_format) > { > bool pass = true, warn = false; > unsigned src_width, src_height, dst_width, dst_height; > @@ -916,8 +918,8 @@ piglit_display(void) > { > enum piglit_result result = PIGLIT_PASS; > enum piglit_result subtest; > - struct texture_format *src_format_list, *dst_format_list; > - struct texture_format *src_format, *dst_format; > + const struct texture_format *src_format_list, *dst_format_list; > + const struct texture_format *src_format, *dst_format; > int sf, df, src_format_count, dst_format_count; > > if (src_format_arg) { > -- > 1.9.1 > > ___ > Piglit mailing list > Piglit@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/piglit Reviewed-by: Anuj Phogat
Re: [Piglit] [PATCH 00/11] Port glsl-link-test to shader_runner
bump signature.asc Description: signature ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 2/2] shader_runner: Fix get_ints on 32-bit systems.
On Mon, 2016-06-06 at 16:02 -0700, Kenneth Graunke wrote: > On Monday, June 6, 2016 3:56:09 PM PDT Mark Janes wrote: > > > > Kenneth Graunkewrites: > > > > > > > > The new ARB_vertex_attrib_64bit tests specify integer uniform > > > values > > > as hex, such as 0xc21620c5. As an integer value, this is beyond > > > LONG_MAX > > > on 32-bit systems. The intent is to parse it as an unsigned hex > > > value and > > > bitcast it. > > > > > > However, we still need to handle parsing values with negative > > > signs. > > > > > > Using strtoll and truncating works. > > > > > > Signed-off-by: Kenneth Graunke > > > --- > > > tests/shaders/shader_runner.c | 2 +- > > > tests/util/piglit-vbo.cpp | 4 ++-- > > > 2 files changed, 3 insertions(+), 3 deletions(-) > > > > > > diff --git a/tests/shaders/shader_runner.c > > > b/tests/shaders/shader_runner.c > > > index 94c7826..56fd97c 100644 > > > --- a/tests/shaders/shader_runner.c > > > +++ b/tests/shaders/shader_runner.c > > > @@ -1398,7 +1398,7 @@ get_ints(const char *line, int *ints, > > > unsigned count) > > > unsigned i; > > > > > > for (i = 0; i < count; i++) > > > - ints[i] = strtol(line, (char **) , 0); > > > + ints[i] = strtoll(line, (char **) , 0); > > > } > > > > > > > > > diff --git a/tests/util/piglit-vbo.cpp b/tests/util/piglit- > > > vbo.cpp > > > index fd7e72a..50e6731 100644 > > > --- a/tests/util/piglit-vbo.cpp > > > +++ b/tests/util/piglit-vbo.cpp > > > @@ -387,8 +387,8 @@ vertex_attrib_description::parse_datum(const > > > char **text, void *data) const > > > break; > > > } > > > case GL_INT: { > > > - long value = (long) strtoll(*text, , 0); > > > - if (errno == ERANGE) { > > > + long long value = strtoll(*text, , 0); > > > + if (errno == ERANGE || (unsigned long long) > > > value > 0xull) { > > ^^^ > > ^^ > > with this check removed, the series corrects all 32 bit failures > > introduced by b7eb469, and is > > > > Tested-by: Mark Janes > Right, the value > 0xull bit is bogus - the sign bit gets > extended. I've just dropped this locally. It removes a bit of > sanity > checking for bogus values written in .shader_test files, but we don't > sanity check most values, either. Ugh! Sorry for this bug. With that change, it LGTM. I'm still working in these tests so I will come with a follow-up patch to handle the correct parsing of the values with negative sign. Reviewed-by: Andres Gomez -- -- Br, Andres ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit