aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
Commit message (Collapse)AuthorAgeFilesLines
...
* compiler/glsl: close fd's in glcpp_test.pyDylan Baker2018-04-231-2/+4
| | | | | | | | | | | | I would have thought falling out of scope would allow the gc to collect these, but apparently it doesn't, and this hits an fd limit on macos. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106133 Fixes: db8cd8e36771eed98eb638fd0593c978c3da52a9 ("glcpp/tests: Convert shell scripts to a python script") Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Tested-by: Vinson Lee <[email protected]>
* meson: enable glcpp testDylan Baker2018-04-181-1/+17
| | | | | Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glcpp/tests: Convert shell scripts to a python scriptDylan Baker2018-04-183-267/+223
| | | | | | | | | | | This ports glcpp-test.sh and glcpp-test-cr-lf.sh to a python script that accepts arguments for each line ending type. This should allow for better reporting to users. v2: - Use $PYTHON2 to be consistent with other tests in mesa Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl/tests: Remove unused compare_ir.py scriptDylan Baker2018-04-181-58/+0
| | | | Signed-off-by: Dylan Baker <[email protected]>
* meson: enable optimization-testDylan Baker2018-04-181-0/+5
| | | | Signed-off-by: Dylan Baker <[email protected]>
* glsl/tests: Convert optimization-test.sh to pure pythonDylan Baker2018-04-184-238/+215
| | | | | | | | | | | This patch converts optimization-test.sh to python, in this process it removes external shell dependencies including diff. It replaces the python script that generates shell scripts with a python library that generates test cases and runs them using subprocess. v2: - use $PYTHON2 to be consistent with other tests in mesa Signed-off-by: Dylan Baker <[email protected]>
* meson: run glsl compiler warnings testDylan Baker2018-04-181-1/+9
| | | | | Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl/tests: reimplement warnings-test in pythonDylan Baker2018-04-182-56/+75
| | | | | | | | | | | | | | | | | | This reimplements the test in python with a shell script wrapper that allows autotools to continue to run the test without realizing that anything has changed. Using python has two advantages, first it's portable so this test can be run on windows as well as Linux since it just requires python, no more diff, pwd or sh. It's also no longer tied to autotools implementation details, like the environment variables $srcdir and $abs_builddir, though the autotools shell wrapper still uses those, which makes it possible to run the test in meson. v2: - Use $PYTHON2 in script to be consistent with other scripts in mesa Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: fix gcc 8 parenthesis warningMarc Dietrich2018-04-171-2/+2
| | | | | | | | | | | | | | | | | | | fixes warnings like this: [184/1137] Compiling C++ object 'src/compiler/glsl/glsl@sta/lower_jumps.cpp.o'. In file included from ../src/mesa/main/mtypes.h:48, from ../src/compiler/glsl_types.h:149, from ../src/compiler/glsl/lower_jumps.cpp:59: ../src/compiler/glsl/lower_jumps.cpp: In member function '{anonymous}::block_record {anonymous}::ir_lower_jumps_visitor::visit_block(exec_list*)': ../src/compiler/glsl/list.h:650:17: warning: unnecessary parentheses in declaration of 'node' [-Wparentheses] for (__type *(__inst) = (__type *)(__list)->head_sentinel.next; \ ^ ../src/compiler/glsl/lower_jumps.cpp:510:7: note: in expansion of macro 'foreach_in_list' foreach_in_list(ir_instruction, node, list) { ^~~~~~~~~~~~~~~ Signed-off-by: Marc Dietrich <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* nir: fix ir_binop_gequal glsl_to_nir conversionErico Nunes2018-04-161-1/+1
| | | | | | | | | | ir_binop_gequal needs to be converted to nir_op_sge when native integers are not supported in the driver. Otherwise it becomes no different than ir_binop_less after the conversion. Signed-off-by: Erico Nunes <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: #undef THIS macro to fix MSVC buildBrian Paul2018-04-131-0/+5
| | | | | | | | | | THIS is a macro in one of the MSVC header files. It's also a token in the GLSL lexer. This causes a compilation failure with MSVC. This issue seems to be newly exposed after the recent mtypes.h removal patches. Reviewed-by: Charmaine Lee <[email protected]> Reviewed-by: Neha Bhende <[email protected]>
* glsl: rename 'interface' var to 'iface' to fix MSVC buildBrian Paul2018-04-131-7/+7
| | | | | | | | The recent mtypes.h removal patches seems to have exposed a MSVC issue where 'interface' is defined as a macro in an MSVC header file. Reviewed-by: Charmaine Lee <[email protected]> Reviewed-by: Neha Bhende <[email protected]>
* Fix make checkMarek Olšák2018-04-121-0/+1
|
* Fix scons buildMarek Olšák2018-04-121-0/+1
|
* mesa: include mtypes.h lessMarek Olšák2018-04-1247-24/+55
| | | | | | | | | | - remove mtypes.h from most header files - add main/menums.h for often used definitions - remove main/core.h v2: fix radv build Reviewed-by: Brian Paul <[email protected]>
* glsl: fix compat shaders in GLSL 1.40Timothy Arceri2018-04-121-0/+2
| | | | | | | | | | | | | | The compatibility and core tokens were not added until GLSL 1.50, for GLSL 1.40 just assume all shaders built with a compat profile are compat shaders. Fixes rendering issues in Dawn of War II on radeonsi which has enabled OpenGL 3.1 compat support. Fixes: a0c8b49284ef "mesa: enable OpenGL 3.1 with ARB_compatibility" Reviewed-by: Marek Olšák <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105807
* glsl: remove unreachable assert()Emil Velikov2018-04-101-2/+0
| | | | | | | | | | Earlier commit enforced that we'll bail out if the number of terminators is different than 2. With that in mind, the assert() will never trigger. Fixes: 56b867395de ("glsl: fix infinite loop caused by bug in loop unrolling pass") Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* glsl: always call do_lower_jumps() after loop unrollingTimothy Arceri2018-04-041-0/+18
| | | | | | | | | | | | | | This fixes a bug in radeonsi where LLVM cannot handle the case where a break exists but its not the last instruction in the block. LLVM would fail with: Terminator found in the middle of a basic block! LLVM ERROR: Broken function found, compilation aborted! Fixes: 96fe8834f539 "glsl_to_tgsi: do fewer optimizations with GLSLOptimizeConservatively" Reviewed-by: Matt Turner <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105317
* nir: s/uint/unsigned/ to fix MSVC/MinGW buildBrian Paul2018-03-301-1/+1
| | | | | Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Neha Bhende <[email protected]>
* nir: add bindless to nir dataTimothy Arceri2018-03-281-0/+1
| | | | | | Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
* glsl: fix infinite loop caused by bug in loop unrolling passTimothy Arceri2018-03-271-1/+1
| | | | | | | | | | | | | | | | | | Just checking for 2 jumps is not enough to be sure we can do a complex loop unroll. We need to make sure we also have also found 2 loop terminators. Without this we were attempting to unroll a loop where the second jump was nested inside multiple ifs which loop analysis is unable to detect as a terminator. We ended up splicing out the first terminator but failed to actually unroll the loop, this resulted in the creation of a possible infinite loop. Fixes: 646621c66da9 "glsl: make loop unrolling more like the nir unrolling path" Tested-by: Gert Wollny <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105670
* compiler: glsl: silence valgrind warning on write cacheLionel Landwerlin2018-03-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I don't think it actually fixes anything, but that's nice not to have valgrind warnings. It manifests itself when running the piglit test : glsl-fs-raytrace-bug27060 ==2058== Uninitialised byte(s) found during client check request ==2058== at 0xC5BB040: blob_write_bytes (blob.c:152) ==2058== by 0xC595359: write_variable (nir_serialize.c:144) ==2058== by 0xC59560C: write_var_list (nir_serialize.c:192) ==2058== by 0xC5982E4: nir_serialize (nir_serialize.c:1124) ==2058== by 0xC0B729D: brw_program_serialize_nir (brw_program.c:835) ==2058== by 0xC0AB2D6: brw_link_shader (brw_link.cpp:358) ==2058== by 0xC32FE3F: _mesa_glsl_link_shader (ir_to_mesa.cpp:3169) ==2058== by 0xC36C7ED: create_new_program(gl_context*, state_key*) (ff_fragment_shader.cpp:1127) ==2058== by 0xC36C8A6: _mesa_get_fixed_func_fragment_program (ff_fragment_shader.cpp:1157) ==2058== by 0xC1B50AF: update_program (state.c:134) ==2058== by 0xC1B56DF: _mesa_update_state_locked (state.c:352) ==2058== by 0xC1B579A: _mesa_update_state (state.c:386) ==2058== Address 0xf1eab8a is 58 bytes inside a block of size 96 alloc'd ==2058== at 0x4C2CB8F: malloc (vg_replace_malloc.c:299) ==2058== by 0xC0FD306: ralloc_size (ralloc.c:121) ==2058== by 0xC0FD5B1: ralloc_array_size (ralloc.c:208) ==2058== by 0xC452B3B: (anonymous namespace)::nir_visitor::visit(ir_variable*) (glsl_to_nir.cpp:448) ==2058== by 0xC45CE8B: ir_variable::accept(ir_visitor*) (ir.h:428) ==2058== by 0xC46D0B5: visit_exec_list(exec_list*, ir_visitor*) (ir.cpp:1898) ==2058== by 0xC451D2F: glsl_to_nir (glsl_to_nir.cpp:162) ==2058== by 0xC0B5223: brw_create_nir (brw_program.c:79) ==2058== by 0xC0AAB67: brw_link_shader (brw_link.cpp:257) ==2058== by 0xC32FE3F: _mesa_glsl_link_shader (ir_to_mesa.cpp:3169) ==2058== by 0xC36C7ED: create_new_program(gl_context*, state_key*) (ff_fragment_shader.cpp:1127) ==2058== by 0xC36C8A6: _mesa_get_fixed_func_fragment_program (ff_fragment_shader.cpp:1157) Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* nir: Rename image intrinsics to image_varJason Ekstrand2018-03-231-27/+27
| | | | | | | | | | | Generated with git grep -l nir_intrinsic_image | xargs \ sed -i 's/nir_intrinsic_image/nir_intrinsic_image_var/g' and some manual fixing in nir_intrinsics.h Reviewed-by: Timothy Arceri <[email protected]>
* nir: add frexp_exp and frexp_sig opcodesTimothy Arceri2018-03-221-0/+2
| | | | Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* mesa: rework ParameterList to allow packingTimothy Arceri2018-03-201-3/+11
| | | | | | | | | | | | | | Currently everything is padded to 4 components. Making the list more flexible will allow us to do uniform packing. V2 (suggestions from Nicolai): - always pass existing calls to _mesa_add_parameter() true for padd_and_align - fix bindless param value offsets - remove left over wip logic from pad and align code - zero out param value padding - whitespace fix Reviewed-by: Marek Olšák <[email protected]>
* glsl/serialize: Save shader program metadata sha1Jordan Justen2018-03-191-0/+4
| | | | | | | | | | | | | | | When the shader cache is used, this can be generated. In fact, the shader cache uses this sha1 to lookup the serialized GL shader program. If a GL shader program is restored with ProgramBinary, the shaders are not available, and therefore the correct sha1 cannot be generated. If this is restored, then we can use the shader cache to restore the binary programs to the program that was loaded with ProgramBinary. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Remove api_enabled tracking for transform feedbackJordan Justen2018-03-191-2/+0
| | | | | | | | | | We used this to prevent usage of the disk shader cache when transform feedback was enabled via the GL API. This is no longer used. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105444 Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl/shader_cache: Allow shader cache usage with transform feedbackJordan Justen2018-03-192-10/+7
| | | | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105444 Suggested-by: Timothy Arceri <[email protected]> Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Use hash table cloning in copy propagationThomas Helland2018-03-142-31/+15
| | | | | | | | | | Walking the whole hash table, inserting entries by hashing them first is just a really bad idea. We can simply memcpy the whole thing. V2: Remove leftover creation of acp in two places Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* compiler: int8/uint8 supportKarol Herbst2018-03-143-0/+6
| | | | | | | | | | OpenCL kernels also have int8/uint8. v2: remove changes in nir_search as Jason posted a patch for that Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Rob Clark <[email protected]> Signed-off-by: Karol Herbst <[email protected]>
* nir: Generalize nir_intrinsic_vote_eqJason Ekstrand2018-03-071-2/+3
| | | | | | | | | | | | | The SPIR-V extension wants us to be able to do an AllEqual on any vector or scalar type. This has two implications: 1) We need to be able to handle vectors so we switch the vote_eq intrinsics to be vectorized intrinsics. 2) We need to handle floats which have different behavior with respect to +-0, NaN, etc. than the integer variant so we need two variants. Reviewed-by: Lionel Landwerlin <[email protected]>
* glsl/linker: fix bug when checking precision qualifierSamuel Iglesias Gonsálvez2018-02-281-8/+3
| | | | | | | | | | | | | | | According to GLSL ES 3.2 spec, see table in 9.2.1 "Linked Shaders" section, the precision qualifier should match for uniform variables. This also applies to previous GLSL ES 3.x specs. This 'if' checks the condition for uniform variables, while for UBOs it is checked in link_interface_blocks.cpp. Fixes: b50b82b8a553 ("glsl/es31: precision qualifier doesn't need to match in shader interface block members") Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* util/bitset: Make C++ wrapper trivially constructible.Francisco Jerez2018-02-272-3/+0
| | | | | | | | | | | | | | | In order to fix a build failure on compilers not implementing unrestricted unions, which is a C++11 feature. v2: Provide signed integer comparison and assignment operators instead of BITSET_WORD ones to avoid spurious ambiguity warnings on comparisons with a signed integer literal. Fixes: ba79a90fb52e1e81fb "glsl: Switch ast_type_qualifier to a 128-bit bitset." Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105238 Tested-by: Roland Scheidegger <[email protected]> Tested-By: George Kyriazis <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* glsl: Silence warnings when reading from a framebuffer fetch output.Francisco Jerez2018-02-241-0/+1
| | | | | | | Framebuffer fetch outputs are implicitly initialized upon entry to the fragment shader. Reviewed-by: Plamena Manolova <[email protected]>
* glsl: Specify framebuffer fetch coherency mode in ↵Francisco Jerez2018-02-242-2/+3
| | | | | | | | | | | | | | | | | | | | | lower_blend_equation_advanced(). This requires passing an extra argument to the lowering pass because the KHR_blend_equation_advanced specification doesn't seem to define any mechanism for the implementation to determine at compile-time whether coherent blending can ever be used (not even an "#extension KHR_blend_equation_advanced_coherent" directive seems to be required in the shader source AFAICT). In the long run we'll probably want to do state-dependent recompiles based on the value of ctx->Color.BlendCoherent, but right now there would be no benefit from that because the only driver that supports coherent framebuffer fetch is i965 on SKL+ hardware, which are unable to support the non-coherent path for the moment because of texture layout issues, so framebuffer fetch coherency is always enabled for them. Reviewed-by: Plamena Manolova <[email protected]>
* glsl: Add support for the framebuffer fetch layout(noncoherent) qualifier.Francisco Jerez2018-02-245-2/+61
| | | | | | | | | | This allows the application to request framebuffer fetch coherency with per-fragment output granularity. Coherent framebuffer fetch outputs (which is the default if no qualifier is present for compatibility with older versions of the EXT_shader_framebuffer_fetch extension) will have ir_variable_data::memory_coherent set to true. Reviewed-by: Plamena Manolova <[email protected]>
* glsl: Allow layout token for EXT_shader_framebuffer_fetch_non_coherent.Francisco Jerez2018-02-241-1/+2
| | | | | | | EXT_shader_framebuffer_fetch_non_coherent requires layout qualifiers even on GL(ES) 2. Reviewed-by: Plamena Manolova <[email protected]>
* glsl: Initialize ir_variable_data::fb_fetch_output earlier for GL(ES) 2.Francisco Jerez2018-02-241-2/+7
| | | | | | | | | | At the same point where it is initialized on GL(ES) 3.0+ so we can implement some common layout qualifier handling in a future commit. Until now the fb_fetch_output flag would be inherited from the original implicit gl_LastFragData declaration at a later point in the AST to GLSL IR translation. Reviewed-by: Plamena Manolova <[email protected]>
* glsl: Replace MESA_shader_framebuffer_fetch extension flags with EXT ones.Francisco Jerez2018-02-242-6/+4
| | | | Reviewed-by: Plamena Manolova <[email protected]>
* glsl: Switch ast_type_qualifier to a 128-bit bitset.Francisco Jerez2018-02-243-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | This should end the drought of bits in the ast_type_qualifier object. The bitset_t type works pretty much as a drop-in replacement for the current uint64_t bitset. The only catch is that the bitset_t type as defined in the previous commit doesn't have a trivial constructor (because it has a user-defined constructor), so it cannot be used as union member without providing a user-defined constructor for the union (which causes it in turn to be non-trivially constructible). This annoyance could be easily addressed in C++11 by declaring the default constructor of bitset_t to be the implicitly defined one -- IMO one more reason to drop support for GCC 4.2-4.3. The other minor change was required because glsl_parser_extras.cpp was hard-coding the type of bitset temporaries as uint64_t, which (unlike would have been the case if the uint64_t had been replaced with e.g. an __int128) would otherwise have caused a build failure, because the boolean conversion operator of bitset_t is marked explicit (if C++11 is available), so the bitset won't be silently truncated down to 1 bit in order to use it to initialize the uint64_t temporaries (yikes). Reviewed-by: Plamena Manolova <[email protected]>
* mesa: implement ARB_compatibilityMarek Olšák2018-02-235-3/+6
| | | | | Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* glsl: Parse 'layout' as a token with advanced blending or bindlessKenneth Graunke2018-02-211-0/+2
| | | | | | | | | | | | | Both KHR_blend_equation_advanced and ARB_bindless_texture provide layout qualifiers, and are exposed in compatibility contexts. We need to parse the layout qualifier as a token in order for those to work, but forgot to extend this check. ARB_shader_image_load_store would need a similar treatment, but we don't expose that in legacy OpenGL contexts. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105161 Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl/tests: Fix a compiler warning about signed/unsigned loop comparison.Eric Anholt2018-02-201-1/+1
| | | | | Fixes: d32956935edf ("glsl: Walk a list of ir_dereference_array to mark array elements as accessed") Reviewed-by: Ian Romanick <[email protected]>
* glsl: Silence warnings in the uniform initializer test about 16-bit typesEric Anholt2018-02-201-0/+9
| | | | | | | | | They should probably get unit tests implemented, but this cleans up a bunch of warnings in my build for now. Fixes: 59f458cd8703 ("glsl: Add 16-bit types") Cc: Eduardo Lima Mitev <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl/nir: add pixel_center_integer to shader infoTimothy Arceri2018-02-191-0/+5
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: fix sizeof(pointer) bugEric Engestrom2018-02-161-1/+1
| | | | | | | | | | Doesn't really change anything to the test though ¯\_(ツ)_/¯ CID: 1429511 Fixes: e8495646afb06a9dd7786 "glsl/tests: changes to test_disk_cache_create test" Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa: move STATE_LENGTH to shader_enums.h and use it everywhereMarek Olšák2018-02-131-1/+1
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa,glsl,nir: reduce gl_state_index size to 2 bytesMarek Olšák2018-02-134-6/+6
| | | | | | | | | Let's use the new gl_state_index16 type everywhere and remove the typecasts. This helps reduce the size of gl_program_parameter. Reviewed-by: Brian Paul <[email protected]>
* mesa: reduce the size of gl_programMarek Olšák2018-02-131-5/+4
| | | | | | gl_program: 1456 -> 976 bytes Reviewed-by: Brian Paul <[email protected]>
* glsl/tests: Fix strict aliasing warning about int64/double.Eric Anholt2018-02-121-3/+19
| | | | | Fixes: 4bf986274728 ("glsl/tests: Add UINT64 and INT64 types") Reviewed-by: Rhys Kidd <[email protected]>