summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Check TCS barrier restrictions at ast_to_hir time, not link time.Kenneth Graunke2016-09-232-99/+19
| | | | | | | | | | | | | | | | | | | | | | | We want to check prior to optimization - otherwise we might fail to detect cases where barrier() is in control flow which is always taken (and therefore gets optimized away). We don't currently loop unroll if there are function calls inside; otherwise we might have a problem detecting barrier() in loops that get unrolled as well. Tapani's switch handling code adds a loop around switch statements, so even with the mess of if ladders, we'll properly reject it. Enforcing these rules at compile time makes more sense more sense than link time. Doing it at ast-to-hir time (rather than as an IR pass) allows us to emit an error message with proper line numbers. (Otherwise, I would have preferred the IR pass...) Fixes spec/arb_tessellation_shader/compiler/barrier-switch-always.tesc. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by; Ian Romanick <[email protected]>
* glsl: move xfb BufferStride into gl_transform_feedback_infoTimothy Arceri2016-09-242-6/+6
| | | | | | | | It makes more sense to have this here where we store the other values from xfb qualifiers. The struct it was previously part of is now only used to store values that come from the api. Reviewed-by: Alejandro Piñeiro <[email protected]>
* mesa: add GL_OES_viewport_array to the extension stringIlia Mirkin2016-09-221-0/+1
| | | | | | | | | The expectation is that drivers will set this based on OES_geometry_shader and ARB_viewport_array support. This is a separate enable on the same reasoning as for OES_texture_cube_map_array. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* glsl: add OES_viewport_array enables and use them to expose gl_ViewportIndexIlia Mirkin2016-09-222-3/+8
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* mesa: Implement ARB_shader_viewport_layer_array for i965Dylan Baker2016-09-203-2/+15
| | | | | | | | | | | | | This extension is a combination of AMD_vertex_shader_viewport_index and AMD_vertex_shader_layer, making it rather trivial to implement. For gallium I *think* this needs a new cap because of the addition of support in tessellation evaluation shaders, and since I don't have any hardware to test it on, I've left that for someone else to wire up. Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Skip "unsized arrays aren't allowed" check for TCS/TES/GS vars.Kenneth Graunke2016-09-191-1/+27
| | | | | | | | Fixes ESEXT-CTS.draw_elements_base_vertex_tests.AEP_shader_stages and ESEXT-CTS.texture_cube_map_array.texture_size_tesselation_con_sh. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: remove interpolateAt* instructions for demoted inputsMarek Olšák2016-09-162-0/+15
| | | | | | | This fixes 8 fs-interpolateat* piglit crashes on radeonsi, because it can't handle non-input operands in interpolateAt*. Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: grammar fixEero Tamminen2016-09-141-2/+2
| | | | | | Signed-off-by: Eero Tamminen <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: add core plumbing for GL_ANDROID_extension_pack_es31aIlia Mirkin2016-09-132-16/+44
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* 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 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]>
* 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
|
* 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]>
* 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]>
* 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
|
* 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-302-1/+15
| | | | | 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]>
* glsl: Calculate bitset of secondary outputs written in ir_set_program_inouts.Francisco Jerez2016-08-301-2/+7
| | | | Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: Fix typo in commentIan Romanick2016-08-301-1/+1
| | | | | | Trivial. Signed-off-by: Ian Romanick <[email protected]>
* glsl: Replace most assertions with unreachable()Ian Romanick2016-08-301-10/+9
| | | | | | | | | | | | | | text data bss dec hex filename 7669233 277176 28624 7975033 79b079 i965_dri.so before generated code 7647081 277176 28624 7952881 7959f1 i965_dri.so before this commit 7669289 277176 28624 7975089 79b0b1 i965_dri.so with this commit Looking at the generated assembly, it appears that some of changes made in the generated code prevent some loops from being unrolled. Removing the default cases (via unreachable()) allows these loops to unroll again. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Refactor handling of horizontal operationsIan Romanick2016-08-301-8/+7
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Dylan Baker <[email protected]>
* glsl: Use constant_template_horizontal instead of ↵Ian Romanick2016-08-301-1/+1
| | | | | | | | | | | constant_template_horizontal_single_implementation for unops This changes the "shape" of all the pack and unpack operators, but they should function the same. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Dylan Baker <[email protected]>
* glsl: Eliminate constant_template2Ian Romanick2016-08-301-11/+0
| | | | | | | | | constant_template_common can now handle the case where the result type is different from the input type by using type_signature_iter. This changes the "shape" of all the cast-style operators, but they should function the same. Signed-off-by: Ian Romanick <[email protected]>
* glsl: Eliminate constant_template5Ian Romanick2016-08-301-22/+1
| | | | | | | | constant_template_common can now handle the case where the result type is different from the input type by using type_signature_iter. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Eliminate constant_template0Ian Romanick2016-08-301-34/+4
| | | | | | | | | This template is mostly an artefact of the development of the original patch series and to minimize the differences between the original code and the generated code. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Eliminate one of the templates for simpler operationsIan Romanick2016-08-301-21/+3
| | | | | | | | | | The difference between these two templates were mostly an artefact of the development of the original patch series and to minimize the differences between the original code and the generated code. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Dylan Baker <[email protected]>
* glsl: Use the generated constant expression codeIan Romanick2016-08-301-1108/+1
| | | | | | | | | | | | | | Immediately previous to this patch, diff -wud src/glsl/ir_constant_expression.cpp \ src/glsl/ir_expression_operation_constant.h should be "minimal." v3: With much help from José Fonseca, fix the SCons build. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Generate code for constant ir_triop_csel expressionsIan Romanick2016-08-301-1/+23
| | | | | | | | v2: 'for (a, b) in d' => 'for a, b in d'. Suggested by Dylan. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Dylan Baker <[email protected]>
* glsl: Generate code for constant ir_triop_lrp expressionsIan Romanick2016-08-301-1/+28
| | | | | | | | v2: 'for (a, b) in d' => 'for a, b in d'. Suggested by Dylan. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Dylan Baker <[email protected]>