aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* mesa/glsl: Move string_to_uint_map into the util folderThomas Helland2016-09-125-5/+5
| | | | | | | | | | This clears the last bits of the usecases of the hash table located in mesa/program, allowing us to remove it. V2: Rebase on top of changes to Makefile.sources Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Convert glcpp-parse to the util hash tableThomas Helland2016-09-122-21/+35
| | | | | | | | | And change the include in glcpp.h accordingly. V2: Whitespace fix Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Convert loop analysis to the util hash tableThomas Helland2016-09-122-15/+18
| | | | | Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Convert varying test to the util hash tableThomas Helland2016-09-121-57/+29
| | | | | | | V2: remove now unused ht_count_callback() (Timothy Arceri) Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Convert output read lowering to the util hash tableThomas Helland2016-09-121-8/+9
| | | | | Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Convert interface block lowering to the util hash tableThomas Helland2016-09-121-13/+14
| | | | | | | V2: move comment to correct location (Timothy Arceri) Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Convert if lowering to use a setThomas Helland2016-09-121-23/+26
| | | | | | | Also do some minor whitespace cleanups Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Convert linker to the util hash tableThomas Helland2016-09-121-12/+17
| | | | | | | | | We are getting the util hash table through the include in program/hash_table.h for the moment until we migrate the string_to_uint_map to a separate file. Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Convert link_varyings to the util hash tableThomas Helland2016-09-121-25/+33
| | | | | Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Change link_functions to use a setThomas Helland2016-09-121-13/+15
| | | | | | | | The "locals" hash table is used as a set, so use a set to avoid confusion and also spare some minor memory. Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Convert recursion detection to the util hash tableThomas Helland2016-09-121-13/+17
| | | | | Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Convert constant_expression to the util hash tableThomas Helland2016-09-121-11/+14
| | | | | | | | | | V2: Fix incorrect ordering on hash table insert V3: null check value returned by _mesa_hash_table_search() (Timothy Arceri) Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Convert ast_to_hir to the util hash tableThomas Helland2016-09-121-11/+13
| | | | | | | | | | V2: Rebase to the adaption of new hashing functions V3: move previous_label declaration to where it is used (Timothy Arceri) Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Convert ir_clone to the util hash tableThomas Helland2016-09-121-16/+18
| | | | | | | V2: add braces to multiline if (Timothy Arceri) Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Convert function inlining to the util hash tableThomas Helland2016-09-121-3/+3
| | | | | Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: Remove prog_hash_table.cThomas Helland2016-09-121-2/+0
| | | | | | | | | | | | | Here we make the prog_hash_table functionally equivalent to the one in util by wrapping the remaing functions that differ. We also move the functions to the header so we can remove the c file. This enables us to do a step-by-step replacement of the table. Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: Remove unused hash table includesThomas Helland2016-09-123-3/+0
| | | | | | | This should prevent us from rebuilding the world. Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: use hash instead of exec_list in copy propagationTapani Pälli2016-09-091-51/+41
| | | | | | | | | | | | This change makes copy propagation pass faster. Complete link time spent in test case attached to bug 94477 goes down to ~400 secs from over 500 secs on my HSW machine. Does not fix the actual issue but brings down the total. No regressions seen in CI. v2: do not leak hash_table structure Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* nir/gcm: Add global value numbering supportJason Ekstrand2016-09-082-6/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unlike the current CSE pass, global value numbering is capable of detecting common values even if one does not dominate the other. For instance, in you have if (...) { ssa_1 = ssa_0 + 7; /* use ssa_1 */ } else { ssa_2 = ssa_0 + 7; /* use ssa_2 */ } Global value numbering doesn't care about dominance relationships so it figures out that ssa_1 and ssa_2 are the same and converts this to if (...) { ssa_1 = ssa_0 + 7; /* use ssa_1 */ } else { /* use ssa_1 */ } Obviously, we just broke SSA form which is bad. Global code motion, however, will repair this for us by turning this into ssa_1 = ssa_0 + 7; if (...) { /* use ssa_1 */ } else { /* use ssa_1 */ } This intended to eventually mostly replace CSE. However, conventional CSE may still be useful because it's less of a scorched-earth approach and doesn't require GCM. This makes it a bit more appropriate for use as a clean-up in a late optimization run. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/gcm: Call nir_metadata_preserveJason Ekstrand2016-09-081-0/+3
| | | | | | Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/spirv: Refactor variable deocration handlingJason Ekstrand2016-09-081-15/+29
| | | | | | | | | | | Previously, we dind't apply variable decorations to the members of a split structure variable. This doesn't quite work, unfortunately, because things such as the "flat" qualifier may get applied to an entire structure instead of propagated to the members. This fixes 9 of the new CTS tests in the dEQP-VK.glsl.linkage.varying.struct.* group. Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]>
* nir/spirv: Break variable decoration handling into a helperJason Ekstrand2016-09-081-74/+81
| | | | | Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]>
* spirv/nir: Implement OpAtomicLoad/Store for shared variablesLionel Landwerlin2016-09-071-1/+34
| | | | | | | Missing bits from 2afb950161f847d9b0a7be03dfb62cacc5ea51ba. Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/spirv: Remove an erroneous "fall through" commentJason Ekstrand2016-09-071-1/+0
|
* spirv/nir: Add support for OpAtomicLoad/StoreLionel Landwerlin2016-09-071-11/+113
| | | | | | | | | | | | Fixes new CTS tests : dEQP-VK.spirv_assembly.instruction.compute.opatomic.load dEQP-VK.spirv_assembly.instruction.compute.opatomic.store v2: don't handle images like ssbo/ubo (Jason) Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: fix definition of pack_uvec2_to_uintIlia Mirkin2016-09-061-1/+1
| | | | | | | | | Found by inspection. Untested beyond compilation. This also matches the logic used in nir_lower_alu_to_scalar. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Cc: [email protected]
* nir/spirv: Use fill_common_atomic_sources for image atomicsJason Ekstrand2016-09-061-56/+43
| | | | | | | | | We had two almost identical copies of this code and they were both broken but in different ways. The previous two commits fixed both of them. This one just unifies them so that it's easier to handle in the future. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* nir/spirv: Use the correct sources for CompareExchange on imagesJason Ekstrand2016-09-061-2/+2
| | | | | | | | | The CompareExchange operation has two "Memory Semantics" parameters instead of one so the real arguments start at w[7] instead of w[6]. Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* nir/spirv: Swap the argument order for AtomicCompareExchangeJason Ekstrand2016-09-061-2/+2
| | | | | | | | | | | SPIR-V has the two arguments in the opposite order from GLSL. NIR uses the GLSL order so we had them backwards. Fixes dEQP-VK.spirv_assembly.instruction.compute.opatomic.compex Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* glsl: Add positional argument specifiers.Vinson Lee2016-09-061-5/+5
| | | | | | | | | | | Fix build with Python < 2.7. File "./glsl/ir_expression_operation.py", line 360, in get_enum_name return "ir_{}op_{}".format(("un", "bin", "tri", "quad")[self.num_operands-1], self.name) ValueError: zero length field name in format Fixes: e31c72a331b1 ("glsl: Convert tuple into a class") Signed-off-by: Vinson Lee <[email protected]>
* glsl: Add .gitignore for make check warnings testJason Ekstrand2016-09-061-0/+1
|
* Android: glsl: add rules to generate ir_expression*.h header filesRob Herring2016-09-063-5/+33
| | | | | | | | | | | | | | Recent changes to generate ir_expression*.h header files broke Android builds. This adds the generation rules. This change is complicated due to creating a circular dependency between libmesa_glsl, libmesa_nir, and libmesa_compiler. Normally, we add static libraries so that include paths are added even if there's no linking dependency. That is the case here. Instead, we explicitly add the include path using $(MESA_GEN_GLSL_H) to libmesa_compiler. This in turn requires shuffling the order of make includes. It also uncovered missing dependency tracking of glsl_parser.h. Signed-off-by: Rob Herring <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glsl: Fix locations of variables in patch qualified interface blocks.Kenneth Graunke2016-09-051-2/+4
| | | | | | | | | | | | | | | | | | | | | | | As of commit d82f8d9772813949d0f5455cd0edad9003be0fb0, we actually parse and attempt to handle the 'patch' qualifier on interface blocks. This patch fixes explicit locations for variables in such blocks. Without it, many program interface query dEQP/CTS tests hit this assertion in ir_set_program_inouts.cpp if (is_patch_generic) { assert(idx >= VARYING_SLOT_PATCH0 && idx < VARYING_SLOT_TESS_MAX); bitfield = BITFIELD64_BIT(idx - VARYING_SLOT_PATCH0); } because the location was incorrectly based on VARYING_SLOT_VAR0. Note that most of the tests affected currently fail before they hit this, due to confusion about what the program interface query name of those resources should be. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* nir/tests: Update the CF tests to not assume fake edgesJason Ekstrand2016-09-041-4/+4
| | | | | | | | | | | In aad4f1550, we removed the concept of "fake" edges from NIR. Now, if you have a block at the end of an infinite loop it really has no predecessors. This updates the unit tests to match. Signed-off-by: Jason Ekstrand <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97587 Tested-by: Aaron Watry <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir: remove unused variableTimothy Arceri2016-09-031-2/+0
| | | | | | This was let over from aad4f15506c Reviewed-by: Jason Ekstrand <[email protected]>
* nir: remove some fields from nir_shader_compiler_optionsConnor Abbott2016-09-031-3/+0
| | | | I accidentally added these with 0dc4cab. Oops!
* nir: fix bug with moves in nir_opt_remove_phis()Connor Abbott2016-09-031-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 144cbf8 ("nir: Make nir_opt_remove_phis see through moves."), Ken made nir_opt_remove_phis able to coalesce phi nodes whose sources are all moves with the same swizzle. However, he didn't add the logic necessary for handling the fact that the phi may now have multiple different sources, even though the sources point to the same thing. For example, if we had something like: if (...) a1 = b.yx; else a2 = b.yx; a = phi(a1, a2) ... = a then we would rewrite it to if (...) a1 = b.yx; else a2 = b.yx; ... = a1 by picking a random phi source, which in this case is invalid because the source doesn't dominate the phi. Instead, we need to change it to: if (...) a1 = b.yx; else a2 = b.yx; a3 = b.yx; ... = a3; Fixes 12 CTS tests: ES31-CTS.functional.tessellation.invariance.outer_edge_symmetry.quads* Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add nir_after_phis() cursor helperConnor Abbott2016-09-031-5/+14
| | | | | | | And re-implement nir_after_cf_node_and_phis() using it. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: expose max atomic counter/buffer consts for tess in ES 3.2Ilia Mirkin2016-09-031-2/+2
| | | | | | | | Curiously OES/EXT_tessellation_shader leave these out, while ES 3.2 adds them in. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* nir: Remove fake edges in the CF handling codeJason Ekstrand2016-09-021-57/+2
| | | | | | | | | | | | | | | | When NIR was first introduced, Connor added this fake-edge hack to work around issues related to unreachable blocks. Thanks to GLSL IR's jump lowering code, the only unreachable code you can have is a block after an infinite loop. With SPIR-V, we didn't have the jump lowering code so we could also end up with the "if (...) { break; } else { continue; }" case which generates an unreachable block after the if. Because of this, most of NIR had to be fixed up for handling unreachable blocks. The only remaining case of not handling unreachable blocks was specifically the block-after-infinite-loop case in dead_cf which was fixed by the previous commit. We can now delete the fake edge hack. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir/dead_cf: Don't crash on unreachable after-loop blocksJason Ekstrand2016-09-021-1/+2
| | | | | Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* glsl: Only force varyings to be flat when varying packing.Kenneth Graunke2016-09-011-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Varying packing would like to mark certain variables as flat. This works as long as both sides of the interfaces are changed accordingly. However, with SSO, we disable varying packing on the outermost stages. We also disable varying packing for certain tessellation stages. With SSO, we operate on the producer and consumer separately. Checks based on the consumer stage and variable are risky, and can easily lead to altering one half of the interface between stages, breaking SSO pipeline IO validation. Just stop monkeying around with interpolation modes unless required for varying packing. There's no point. This also disables it in unsafe SSO cases. Fixes CTS tests: *.tessellation_shader.tessellation_control_to_tessellation_evaluation.gl_MaxPatchVertices_Position_PointSize Also fixes Piglit's spec/oes_geometry_shader/sso_validation: - user-defined-gs-input-not-in-block.shader_test - user-defined-gs-input-in-block.shader_test Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Reject TCS/TES input arrays not sized to gl_MaxPatchVertices.Kenneth Graunke2016-09-011-1/+14
| | | | | | | | | | | | | | | | | | We handled the unsized case, implicitly sizing arrays to the value of gl_MaxPatchVertices. But if a size was present, we failed to raise a compile error if it wasn't the value of gl_MaxPatchVertices. Fixes CTS tests: *.tessellation_shader.compilation_and_linking_errors. {tc,te}_invalid_array_size_used_for_input_blocks Piglit's tcs-input-read-nonconst-* tests have recently been fixed. This patch will break older copies of those tests, but the latest should continue working. Update to Piglit 75819c13af2ed5. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* mesa: Add some more .gitignoreJason Ekstrand2016-08-311-0/+1
|
* scons: Fix MinGW cross compilation.Jose Fonseca2016-08-311-21/+25
| | | | | | | The generated GLSL header files were only being built for the host platform, and not the target platform. Trivial.
* glsl: Handle patch qualifier on interface blocks.Kenneth Graunke2016-08-303-0/+16
| | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: add gl_BoundingBox and associated varying slotsIlia Mirkin2016-08-304-1/+21
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: add scaffolding for OES/EXT_primitive_bounding_boxIlia Mirkin2016-08-302-0/+6
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Fix gl_program::OutputsWritten computation for dual-source blending.Francisco Jerez2016-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | In the fragment shader OutputsWritten is a bitset of FRAG_RESULT_* enumerants, which represent the location of each color output written by the shader. The secondary and primary color outputs of a given render target using dual-source blending have the same location, so the 'idx' computation below will give the wrong bit as result if the 'var->data.index' term is non-zero -- E.g. if the shader writes the primary and secondary colors of the FRAG_RESULT_COLOR output, ir_set_program_inouts will think that the shader writes both FRAG_RESULT_COLOR and FRAG_RESULT_SAMPLE_MASK, which is just bogus. That would cause the brw_wm_prog_key::nr_color_regions computation done in the i965 driver during fragment shader precompilation to be wrong, which currently leads to unnecessary recompilation of shaders that use dual-source blending, and triggers an assertion failure in fs_visitor::emit_fb_writes() on my i965-fb-fetch branch. Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: Fix incorrect hard-coded location of the gl_SecondaryFragColorEXT ↵Francisco Jerez2016-08-301-7/+2
| | | | | | | | | | | | | | | | | | | built-in. gl_SecondaryFragColorEXT should have the same location as gl_FragColor for the secondary fragment color to be replicated to all fragment outputs. The incorrect location of gl_SecondaryFragColorEXT would cause the linker to mark both FRAG_RESULT_COLOR and FRAG_RESULT_DATA0 as being written to, which isn't allowed by the spec and would ultimately lead to an assertion failure in fs_visitor::emit_fb_writes() on my i965-fb-fetch branch. This should also fix the code below for multiple dual-source-blended render targets, which no driver currently supports but we have plans to enable eventually in the i965 driver (the comment saying that no hardware will ever support it seems rather hilarious). Reviewed-by: Ilia Mirkin <[email protected]>