aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/tests
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Add helper methods to glsl_type for dealing with images.Francisco Jerez2014-02-121-1/+1
| | | | | | | | | | | | Add predicates to query if a GLSL type is or contains an image. Rename sampler_coordinate_components() to coordinate_components(). v2: Use assert instead of unreachable. v3: No need to use a separate code-path for images in coordinate_components() after merging image and sampler fields in the glsl_type structure. Reviewed-by: Paul Berry <[email protected]>
* glsl: Change _mesa_glsl_parse_state ctor to use gl_shader_stage enum.Paul Berry2014-01-081-1/+1
| | | | | | | | Reviewed-by: Kenneth Graunke <[email protected]> v2: Also rename "target" param to "stage". Reviewed-by: Brian Paul <[email protected]>
* mesa: Store gl_shader_stage enum in gl_shader objects.Paul Berry2014-01-081-0/+1
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Clean up nomenclature for pipeline stages.Paul Berry2014-01-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we had an enum called gl_shader_type which represented pipeline stages in the order they occur in the pipeline (i.e. MESA_SHADER_VERTEX=0, MESA_SHADER_GEOMETRY=1, etc), and several inconsistently named functions for converting between it and other representations: - _mesa_shader_type_to_string: gl_shader_type -> string - _mesa_shader_type_to_index: GLenum (GL_*_SHADER) -> gl_shader_type - _mesa_program_target_to_index: GLenum (GL_*_PROGRAM) -> gl_shader_type - _mesa_shader_enum_to_string: GLenum (GL_*_{SHADER,PROGRAM}) -> string This patch tries to clean things up so that we use more consistent terminology: the enum is now called gl_shader_stage (to emphasize that it is in the order of pipeline stages), and the conversion functions are: - _mesa_shader_stage_to_string: gl_shader_stage -> string - _mesa_shader_enum_to_shader_stage: GLenum (GL_*_SHADER) -> gl_shader_stage - _mesa_program_enum_to_shader_stage: GLenum (GL_*_PROGRAM) -> gl_shader_stage - _mesa_progshader_enum_to_string: GLenum (GL_*_{SHADER,PROGRAM}) -> string In addition, MESA_SHADER_TYPES has been renamed to MESA_SHADER_STAGES, for consistency with the new name for the enum. Reviewed-by: Kenneth Graunke <[email protected]> v2: Also rename the "target" field of _mesa_glsl_parse_state and the "target" parameter of _mesa_shader_stage_to_string to "stage". Reviewed-by: Brian Paul <[email protected]>
* glsl: move variables in to ir_variable::data, part IITapani Pälli2013-12-122-86/+86
| | | | | | | | | | | | | This patch moves following bitfields and variables to the data structure: explicit_location, explicit_index, explicit_binding, has_initializer, is_unmatched_generic_inout, location_frac, from_named_ifc_block_nonarray, from_named_ifc_block_array, depth_layout, location, index, binding, max_array_access, atomic Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: move variables in to ir_variable::data, part ITapani Pälli2013-12-121-10/+10
| | | | | | | | | | This patch moves following bitfields in to the data structure: used, assigned, how_declared, mode, interpolation, origin_upper_left, pixel_center_integer Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: introduce data section to ir_variableTapani Pälli2013-12-121-1/+1
| | | | | | | | Data section helps serialization and cloning of a ir_variable. This patch includes the helper bits used for read only ir_variables. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl/loops: Get rid of lower_bounded_loops and ir_loop::normative_bound.Paul Berry2013-12-0930-30/+30
| | | | | | | | Now that loop_controls no longer creates normatively bound loops, there is no need for ir_loop::normative_bound or the lower_bounded_loops pass. Reviewed-by: Ian Romanick <[email protected]>
* glsl/loops: replace loop controls with a normative bound.Paul Berry2013-12-0930-30/+30
| | | | | | | | | | | | | | This patch replaces the ir_loop fields "from", "to", "increment", "counter", and "cmp" with a single integer ("normative_bound") that serves the same purpose. I've used the name "normative_bound" to emphasize the fact that the back-end is required to emit code to prevent the loop from running more than normative_bound times. (By contrast, an "informative" bound would be a bound that is informational only). Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Use more portable bash invocation construct.Vinson Lee2013-11-2026-26/+26
| | | | | | | | | Fixes 'make check' on distros where bash is not at /bin/bash. Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Tested-by: Ian Romanick <[email protected]>
* glsl: Add new atomic_uint built-in GLSL type.Francisco Jerez2013-10-291-0/+3
| | | | | | | | | v2: Fix GLSL version in which the type became available. Add contains_atomic() convenience method. Split off atomic counter comparison error checking to a separate patch that will handle all opaque types. Include new ir_variable fields for atomic types. Reviewed-by: Ian Romanick <[email protected]>
* glsl: Simplify the interface to link_invalidate_variable_locationsIan Romanick2013-10-221-18/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | The unit tests added in the previous commits prove some things about the state of some internal data structures. The most important of these is that all built-in input and output variables have explicit_location set. This means that link_invalidate_variable_locations doesn't need to know the range of non-generic shader inputs or outputs. It can simply reset location state depending on whether explicit_location is set. There are two additional assumptions that were already implicit in the code that comments now document. - ir_variable::is_unmatched_generic_inout is only used by the linker when connecting outputs from one shader stage to inputs of another shader stage. - Any varying that has explicit_location set must be a built-in. This will be true until GL_ARB_separate_shader_objects is supported. As a result, the input_base and output_base parameters to link_invalidate_variable_locations are no longer necessary, and the code for resetting locations and setting is_unmatched_generic_inout can be simplified. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl/tests: Unit test vertex shader in / out with ↵Ian Romanick2013-10-221-0/+208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | link_invalidate_variable_locations Validates: - ir_variable::explicit_location should not be modified. - If ir_variable::explicit_location is not set, ir_variable::location, ir_variable::location_frac, and ir_variable::is_unmatched_generic_inout must be reset to 0. - If ir_variable::explicit_location is set, ir_variable::location should not be modified. ir_variable::location_frac, and ir_variable::is_unmatched_generic_inout must be reset to 0. Previous unit tests have shown that all non-generic inputs / outputs have explicit_location set. v2: Split the link_invalidate_variable_locations interface change out to a separate patch. Remove the vertex_in_builtin_without_explicit and vertex_out_builtin_without_explicit tests. There was a lot of good discussion about this on the mailing list to which I refer the interested reader. Both changes suggested by Paul. http://lists.freedesktop.org/archives/mesa-dev/2013-October/046652.html Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl/tests: Verify geometry shader built-ins generated by ↵Ian Romanick2013-10-221-0/+98
| | | | | | | | | | | | | | | | | | | | | | | | | _mesa_glsl_initialize_variables Checks that the variables generated meet certain criteria. - Geometry shader inputs have an explicit location. - Geometry shader outputs have an explicit location. - Fragment shader-only varying locations are not used. - Geometry shader uniforms and system values don't have an explicit location. - Geometry shader constants don't have an explicit location and are read-only. - No other kinds of geometry variables exist. It does not verify that an specific variables exist. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl/tests: Verify fragment shader built-ins generated by ↵Ian Romanick2013-10-221-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | _mesa_glsl_initialize_variables Checks that the variables generated meet certain criteria. - Fragment shader inputs have an explicit location. - Fragment shader outputs have an explicit location. - Vertex / geometry shader-only varying locations are not used. - Fragment shader uniforms and system values don't have an explicit location. - Fragment shader constants don't have an explicit location and are read-only. - No other kinds of fragment variables exist. It does not verify that an specific variables exist. v2: Use _mesa_varying_slot_in_fs in fragment_builtin.inputs_have_explicit_location. Suggested by Paul. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl/tests: Verify vertex shader built-ins generated by ↵Ian Romanick2013-10-221-0/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _mesa_glsl_initialize_variables Checks that the variables generated meet certain criteria. - Vertex shader inputs have an explicit location. - Vertex shader outputs have an explicit location. - Fragment shader-only varying locations are not used. - Vertex shader uniforms and system values don't have an explicit location. - Vertex shader constants don't have an explicit location and are read-only. - No other kinds of vertex variables exist. It does not verify that an specific variables exist. v2: Fix memory management mistakes in common_builtin::string_starts_with_prefix. Clean up error message reporting in common_builtin::no_invalid_variable_modes. Both suggested by Paul. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: When constructing a variable with an interface type, set interface_typeIan Romanick2013-10-222-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ever since the addition of interface blocks with instance names, we have had an implicit invariant: var->type->is_interface() == (var->type == var->interface_type) The odd use of == here is intentional because !var->type->is_interface() implies var->type != var->interface_type. Further, if var->type->is_array() is true, we have a related implicit invariant: var->type->fields.array->is_interface() == (var->type->fields.array == var->interface_type) However, the ir_variable constructor doesn't maintain either invariant. That seems kind of silly... and I tripped over it while writing some other code. This patch makes the constructor do the right thing, and it introduces some tests to verify that behavior. v2: Add general-ir-test to .gitignore. Update the description of the ir_variable invariant for arrays in the commit message. Both suggested by Paul. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl/tests: Update .gitignore for new unit test.Kenneth Graunke2013-09-161-0/+1
| | | | | | I rarely run 'git status', so I failed to notice this was missing. Signed-off-by: Kenneth Graunke <[email protected]>
* glsl/tests: Add a test for properties of sampler types.Kenneth Graunke2013-09-151-0/+101
| | | | | | | | | | | | For each sampler type, this tests that: - The base type is GLSL_TYPE_SAMPLER. - The dimensionality is set correctly. - The returned data type is correct. - The sampler_array and sampler_shadow flags are set correctly. - sampler_coordinate_components() returns the correct value. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add heuristics to print floating-point numbers better.Matt Turner2013-08-2914-31/+31
| | | | | v2: Fix *.expected files to match. Reviewed-by: Paul Berry <[email protected]>
* mesa: fix GLSL program objects with more than 16 samplers combinedMarek Olšák2013-05-281-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | The problem is the sampler units are allocated from the same pool for all shader stages, so if a vertex shader uses 12 samplers (0..11), the fragment shader samplers start at index 12, leaving only 4 sampler units for the fragment shader. The main cause is probably the fact that samplers (texture unit -> sampler unit mapping, etc.) are tracked globally for an entire program object. This commit adapts the GLSL linker and core Mesa such that the sampler units are assigned to sampler uniforms for each shader stage separately (if a sampler uniform is used in all shader stages, it may occupy a different sampler unit in each, and vice versa, an i-th sampler unit may refer to a different sampler uniform in each shader stage), and the sampler-specific variables are moved from gl_shader_program to gl_shader. This doesn't require any driver changes, and it fixes piglit/max-samplers for gallium and classic swrast. It also works with any number of shader stages. v2: - converted tabs to spaces - added an assertion to _mesa_get_sampler_uniform_value Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Add GLSL_TYPE_INTERFACEIan Romanick2013-01-251-0/+3
| | | | | | | | | | | | | | | | | | | | | Interfaces are structurally identical to structures from the compiler's point of view. They have some additional restrictions, and generally GPUs use different instructions to access them. Using a different base type should make this a bit easier. This commit also adds the glsl_type::interface_packing fields. For GLSL_TYPE_INTERFACE types, this will track the specified packing mode. It is analogous to gl_uniform_buffer::_Packing. v2: Add serveral missing GLSL_TYPE_INTERFACE cases in switch-statements. v3: Add information about glsl_type::interface_packing. Move row_major checking in glsl_type::record_key_compare from this patch to the previous patch. Both suggested by Paul Berry. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/build: Build tests via the glsl MakefileMatt Turner2013-01-222-37/+8
| | | | Tested-by: Andreas Boll <[email protected]>
* tests: AM_CPPFLAGS must include $(top_srcdir) instead of $(top_builddir).Johannes Obermayr2013-01-131-4/+5
| | | | Reviewed-by: Andreas Boll <[email protected]>
* Clean up .gitignore filesMatt Turner2013-01-101-1/+0
|
* src/glsl/tests/Makefile.am: Specify -I... in AM_CPPFLAGSMatt Turner2012-10-251-4/+1
| | | | | | | | | | | | | When specifying per-target CFLAGS (e.g., ralloc_test_CFLAGS) AM_CFLAGS are not used. AM_CPPFLAGS should be used for includes anyway. Fixes a build problem since 41b14d125: CC ralloc_test-ralloc.o In file included from ../../../src/glsl/ralloc.c:42:0: ../../../src/glsl/ralloc.h:57:27: fatal error: main/compiler.h: No such file or directory Acked-by: Paul Berry <[email protected]>
* build: Use PTHREAD_LIBS and PTHREAD_CFLAGSMatt Turner2012-10-011-3/+5
|
* automake: convert libmesa and libmesagalliumJon TURNEY2012-07-131-1/+1
| | | | | | | | | | | | | | | | | * "configure substitutions are not allowed in _SOURCES variables" in automake, so instead of MESA_ASM_FILES, use some AM_CONDITIONALS to choose which architecture's asm sources are used in libmesa_la_SOURCES. (Can't remove MESA_ASM_FILES autoconf variable as it's still used in sources.mak) * Update to link with the .la file in other Makefile.am files, and make a link to the .a file for the convenience of other Makefiles which have not yet been converted to automake v2: Remove stray -static from LDFLAGS v3: Remove .a compatibility link on clean Signed-off-by: Jon TURNEY <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Tested-by: Matt Turner <[email protected]>
* automake: convert libglslJon TURNEY2012-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | v2: Use AM_V_GEN to silence generated code rules. Add BUILT_SOURCES to CLEANFILES v3: - Fix an accidental // in a path - Use automake make rules for lex/yacc rather than writing our own - Update .gitignore appropriately - Build a libglcpp convenience library rather than awkwardly including the files in libglsl and delegating the generation - Remove libglsl.a compatibility link on clean v4: - Automake's rules for lex/yacc make .cc if source is .ll or .yy, and apparently we must use those extensions "because of scons", so update everywhere glsl_parser.cpp -> glsl_parser.cc and glsl_lexer.cpp -> glsl_lexer.cc. This fixes 'make tarballs' and building with dricore enabled. Signed-off-by: Jon TURNEY <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Tested-by: Matt Turner <[email protected]>
* glx/tests: Fix signed/unsigned comparison warnings.Paul Berry2012-06-201-1/+1
|
* Fix .gitignore for ralloc-testPaul Berry2012-06-041-1/+1
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/tests: Plumb $(PYTHON2) and $(PYTHON_FLAGS) into optimization-test.Kenneth Graunke2012-05-302-2/+6
| | | | | | | | | | | | | | | | | | Some distributions (like Arch Linux) make /usr/bin/python Python 3, rather than Python 2. Since compare_ir uses /usr/bin/env python, such systems will fail to run optimization-test, causing 'make check' to always fail. Automake's TESTS_ENVIRONMENT variable provides a mechanism to run programs or set environment variables in the test environment. Ideally, I think we would want to use AM_TESTS_ENVIRONMENT, since TESTS_ENVIRONMENT is supposed to be user-overridable. However, it isn't supported using the default/serial test runner. Fixes 'make check' on Arch Linux and Gentoo. Signed-off-by: Kenneth Graunke <[email protected]> Acked-by: Matt Turner <[email protected]>
* ralloc: Add some basic unit tests.Kenneth Graunke2012-05-303-0/+44
| | | | | | | | | I started writing unit tests for a new piece of code, and discovered they all failed due to a bug in ralloc. Clearly it needs a test suite. v2: Rename to 'ralloc-test' and fix copyright date. (idr review) Signed-off-by: Kenneth Graunke <[email protected]>
* glsl/tests: Add .gitignore for uniform initialization unit test.Paul Berry2012-05-231-0/+1
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl/tests: Add test for uniform initialization by the linkerIan Romanick2012-05-235-1/+1186
| | | | | | | | v2: Put unit tests in src/glsl/tests rather than tests/glsl. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Kenneth Graunke <[email protected]>
* glsl: Convert the tests directory to automake.Eric Anholt2012-04-192-0/+3
| | | | | | | | | | | This runs optimization-test and produces the usual automake test output, which may be interesting to automated build systems. This doesn't convert the tests to be individually exposed to the automake runner, because automake doesn't like wildcards (due to being nonportable in make, not that we care). Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add unit tests for lower_jumps.cppPaul Berry2011-07-2253-0/+1538
| | | | | | | | | | | | | | These tests invoke do_lower_jumps() in isolation (using the glsl_test executable) and verify that it transforms the IR in the expected way. The unit tests may be run from the top level directory using "make check". For reference, I've also checked in the Python script create_test_cases.py, which was used to generate these tests. It is not necessary to run this script in order to run the tests. Acked-by: Chad Versace <[email protected]>
* glsl: Remove 'tests' subfolder.Kenneth Graunke2011-03-0270-631/+0
| | | | These have long since moved to piglit and aren't useful to have here.
* glsl2: Move the compiler to the subdirectory it will live in in Mesa.Eric Anholt2010-06-2470-0/+631