summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* nir: Fix aggressive typos in nir_from_ssa.c.Kenneth Graunke2015-05-081-5/+5
| | | | | | s/agressive/aggressive/g Trivial.
* nir/search: Save/restore the variables_seen bitmask when matchingJason Ekstrand2015-05-081-0/+12
| | | | | | | | | | | | | Shader-db results on Broadwell: total instructions in shared programs: 7152330 -> 7137006 (-0.21%) instructions in affected programs: 1330548 -> 1315224 (-1.15%) helped: 5797 HURT: 76 GAINED: 0 LOST: 8 Reviewed-by: Connor Abbott <[email protected]>
* nir/search: Assert that variable id's are in rangeJason Ekstrand2015-05-081-0/+1
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/search: handle explicitly sized sources in match_valueJason Ekstrand2015-05-081-8/+8
| | | | | | | | | | Previously, this case was being handled in match_expression prior to calling match_value. However, there is really no good reason for this given that match_value has all of the information it needs. Also, they weren't being handled properly in the commutative case and putting it in match_value gives us that for free. Reviewed-by: Connor Abbott <[email protected]>
* nir/nir: Use a linked list instead of a hash set for use/def setsJason Ekstrand2015-05-0814-306/+281
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit switches us from the current setup of using hash sets for use/def sets to using linked lists. Doing so should save us quite a bit of memory because we aren't carrying around 3 hash sets per register and 2 per SSA value. It should also save us CPU time because adding/removing things from use/def sets is 4 pointer manipulations instead of a hash lookup. Running shader-db 50 times with USE_NIR=0, NIR, and NIR + use/def lists: GLSL IR Only: 586.4 +/- 1.653833 NIR with hash sets: 675.4 +/- 2.502108 NIR + use/def lists: 641.2 +/- 1.557043 I also ran a memory usage experiment with Ken's patch to delete GLSL IR and keep NIR. This patch cuts an aditional 42.9 MiB of ralloc'd memory over and above what we gained by deleting the GLSL IR on the same dota trace. On the code complexity side of things, some things are now much easier and others are a bit harder. One of the operations we perform constantly in optimization passes is to replace one source with another. Due to the fact that an instruction can use the same SSA value multiple times, we had to iterate through the sources of the instruction and determine if the use we were replacing was the only one before removing it from the set of uses. With this patch, uses are per-source not per-instruction so we can just remove it safely. On the other hand, trying to iterate over all of the instructions that use a given value is more difficult. Fortunately, the two places we do that are the ffma peephole where it doesn't matter and GCM where we already gracefully handle duplicates visits to an instruction. Another aspect here is that using linked lists in this way can be tricky to get right. With sets, things were quite forgiving and the worst that happened if you didn't properly remove a use was that it would get caught in the validator. With linked lists, it can lead to linked list corruption which can be harder to track. However, we do just as much validation of the linked lists as we did of the sets so the validator should still catch these problems. While working on this series, the vast majority of the bugs I had to fix were caught by assertions. I don't think the lists are going to be that much worse than the sets. Reviewed-by: Connor Abbott <[email protected]>
* nir: Use nir_instr_rewrite_src in copy propagationJason Ekstrand2015-05-081-61/+10
| | | | | | | We were rolling our own rewrite_src variant in copy-propagation. Let's stop doing that and use the ones in core NIR. Reviewed-by: Connor Abbott <[email protected]>
* nir: Add a function for rewriting the condition of an if statementJason Ekstrand2015-05-082-0/+23
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add and use initializer #defines for nir_src and nir_destJason Ekstrand2015-05-086-18/+15
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Modernize the out-of-SSA passJason Ekstrand2015-05-081-103/+36
| | | | | | | | | The out-of-SSA pass was one of the first passes written when getting SSA up-and-going (for obvious reasons). As such, it came before a lot of the nifty SSA-based helpers were introduced. This commit modernizes it so that we're no longer doing nearly as much manual banging on use/def sets. Reviewed-by: Connor Abbott <[email protected]>
* nir/validate: Validate SSA def parent instructionsJason Ekstrand2015-05-081-0/+2
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Delete all traces of nir_op_flogIan Romanick2015-05-082-7/+0
| | | | | | | | Nothing produces it, and nothing can consume it. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* nir: Don't produce nir_op_flog from GLSL IRIan Romanick2015-05-081-1/+1
| | | | | | | | | All paths that produce GLSL IR for NIR lower ir_unop_log. All paths that consume NIR will explode if they geta nir_op_flog. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* nir: Delete all traces of nir_op_fexpIan Romanick2015-05-082-8/+0
| | | | | | | | Nothing produces it, and nothing can consume it. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* nir: Don't produce nir_op_fexp from GLSL IRIan Romanick2015-05-081-1/+1
| | | | | | | | | All paths that produce GLSL IR for NIR lower ir_unop_exp. All paths that consume NIR will explode if they geta nir_op_fexp. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* glsl: check total count of multi-slot double vertex attribsDave Airlie2015-05-081-1/+40
| | | | | | | | | | | | The spec is vague all over the place about this, but this seems to be the intent, we can probably make this optional later if someone makes hw that cares and writes a driver. Basically we need to double count some of the d types but only for totalling not for slot number assignment. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: track which program inputs are doublesDave Airlie2015-05-081-13/+3
| | | | | | | | instead of doing the attempts at dual slot handling here, let the backend do it. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: add ARB_vertex_attrib_64bit support. (v2)Dave Airlie2015-05-084-0/+9
| | | | | | | | | | | Just more boilerplate stuff. v2: bad fallthrough on versioning, this is my ugly but self contained solution (Ian) Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* nir: Allow feq/fne/ieq/ine to be optimized with inot.Matt Turner2015-05-071-0/+4
| | | | | | | | instructions in affected programs: 380 -> 376 (-1.05%) helped: 2 Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Glenn Kennard <[email protected]>
* nir: Recognize (a < c || b < c) as min(a, b) < c.Matt Turner2015-05-071-0/+2
| | | | | | | | | | | | | | ... and (a >= c) || (b >= c) as max(a, b) >= c. Similar to commit 97e6c1b9. total instructions in shared programs: 6182276 -> 6182180 (-0.00%) instructions in affected programs: 6400 -> 6304 (-1.50%) helped: 68 HURT: 4 Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Glenn Kennard <[email protected]>
* nir: Recognize trivial min/max.Matt Turner2015-05-071-0/+6
| | | | | | | No changes, but does prevent some regressions in the next commit. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Glenn Kennard <[email protected]>
* nir: Recognize i2b(b2i(x)) as x.Matt Turner2015-05-071-0/+1
| | | | | | | | | | Helps the same set of programs as the previous commit. instructions in affected programs: 4490 -> 4346 (-3.21%) helped: 8 Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Glenn Kennard <[email protected]>
* nir: Recognize imul(b2i(a), b2i(b)) as a logical AND.Matt Turner2015-05-071-0/+1
| | | | | | | | | | | | Four shaders in Unreal 4's Sun Temple are helped, and gain SIMD16 because we avoid an integer multiplication. instructions in affected programs: 2353 -> 2245 (-4.59%) helped: 4 GAINED: 4 Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Glenn Kennard <[email protected]>
* glsl: mark special built-in inputs referenced by vertex stageTapani Pälli2015-05-061-1/+6
| | | | | | | | | | | | | | | Refactoring done on active attribute queries did not take in to account special built-in inputs for the vertex stage. This commit sets them referenced by vertex stage so that they get enumerated properly. Fixes Piglit test 'get-active-attrib-returns-all-inputs' failure. Signed-off-by: Tapani Pälli <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90243 Acked-by: Jose Fonseca <[email protected]> Tested-by: Dieter Nützel <[email protected]> Reviewed-By: Martin Peres <[email protected]>
* glsl: add parens in shader_integer_mix() to silence compiler warningBrian Paul2015-05-051-1/+1
| | | | | | | | Silences gcc warning: builtin_functions.cpp:204:23: warning: suggest parentheses around '&&' within '||' [-Wparentheses] Reviewed-by: Ilia Mirkin <[email protected]>
* nir: add nir_array.h to the sources listEmil Velikov2015-05-051-0/+1
| | | | | | | Otherwise `make distcheck' will fail. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: don't lower fragdata array if the output data types don't matchSamuel Iglesias Gonsalvez2015-05-051-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 7e414b58640aee6e243d337e72cea290c354f632 broke the gl_FragData array into separate gl_FragData[i] variables, so drivers can eliminate useless writes to gl_FragData improving their performance. The problem occurs when GLSL IR code is linked in the following case: * The FS output variable base data type does not match gl_FragData one (float vector) * The FS output variable is replaced by gl_out_FragDataX because of commit 7e414b58640aee6 with X from 0 to GL_MAX_DRAW_BUFFERS. Then the FS output variable base data type is lost in the resulting GLSL IR, making that the driver does a wrong assignment to gl_out_FragData components because of unmatching data types. This patch reverts the fragdata array lowering when the output var base data type doesn't match gl_out_FragData, i.e., when output variable base data type is not a float or a float vector. This patch fixes 250 dEQP tests (tested in an Intel Haswell machine) dEQP-GLES3.functional.fragment_out.random.* (22 failed tests) dEQP-GLES3.functional.fragment_out.array.uint.* (120 failed tests) dEQP-GLES3.functional.fragment_out.array.int.* (108 failed tests) Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl/es3.1: Allow misc ARB_gpu_shader5 built-ins in GLSL ES 3.10Ian Romanick2015-05-041-11/+11
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl/es3.1: Allow textureGather and textureGatherOffset in GLSL ES 3.10Ian Romanick2015-05-041-29/+61
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl/es3.1: Allow enhnaced packing functions in GLSL ES 3.10Ian Romanick2015-05-041-6/+7
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl/es3.1: Allow interger mix built-ins in GLSL ES 3.10Ian Romanick2015-05-045-7/+55
| | | | | | | | v2: Add missing lexer support. Noticed by Tapani. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> [v1]
* glsl/es3.1: Allow separate shader objects in GLSL ES 3.10Ian Romanick2015-05-041-2/+2
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl/es3.1: Allow explicit uniform locations in GLSL ES 3.10Ian Romanick2015-05-041-4/+13
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl/es3.1: Allow 3.10 ES shaders in a GLES 3.1 contextIan Romanick2015-05-042-3/+8
| | | | | | | | Currently no 3.10 ES features (beyond 3.00 ES) are enabled. That will come later. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Add glsl_parser_state::has_atomic_counters helperIan Romanick2015-05-045-5/+10
| | | | | | | v2: Change GL version from 400 to 420. Noticed by Tapani and Ilia. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Silence unused parameter warningsIan Romanick2015-05-042-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I opted to comment out "last_field" because it was not obvious what the meaning of the dangling bool would be. For the other parameters, the meaning was more intuitive without the name. link_uniform_blocks.cpp:70:65: warning: unused parameter 'name' [-Wunused-parameter] virtual void enter_record(const glsl_type *type, const char *name, ^ link_uniform_blocks.cpp:77:65: warning: unused parameter 'name' [-Wunused-parameter] virtual void leave_record(const glsl_type *type, const char *name, ^ link_uniform_blocks.cpp:93:62: warning: unused parameter 'record_type' [-Wunused-parameter] bool row_major, const glsl_type *record_type, ^ link_uniform_blocks.cpp:94:34: warning: unused parameter 'last_field' [-Wunused-parameter] bool last_field) ^ link_uniforms.cpp:547:65: warning: unused parameter 'name' [-Wunused-parameter] virtual void enter_record(const glsl_type *type, const char *name, ^ link_uniforms.cpp:556:65: warning: unused parameter 'name' [-Wunused-parameter] virtual void leave_record(const glsl_type *type, const char *name, ^ link_uniforms.cpp:567:34: warning: unused parameter 'last_field' [-Wunused-parameter] bool last_field) ^ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Keep track of the early_fragment_tests flag in gl_shader.Francisco Jerez2015-05-044-3/+7
| | | | | | | | And rename _mesa_glsl_parse_state::early_fragment_tests to fs_early_fragment_tests for consistency with other FS-specific flags in the same struct. Reviewed-by: Matt Turner <[email protected]>
* glsl: Error out on invalid uses of the early_fragment_tests layout qualifier.Francisco Jerez2015-05-043-5/+34
| | | | Reviewed-by: Matt Turner <[email protected]>
* glsl: Forbid use of image qualifiers in declarations of type other than image.Francisco Jerez2015-05-041-2/+9
| | | | Reviewed-by: Matt Turner <[email protected]>
* glsl: Split off memory qualifiers from storage qualifiers.Francisco Jerez2015-05-041-1/+16
| | | | | | | | Image memory qualifiers (coherent, volatile, restrict, readonly and writeonly) follow slightly different rules from storage qualifiers, e.g. the uniqueness rule doesn't apply. Make them a separate non-terminal. Reviewed-by: Matt Turner <[email protected]>
* glsl: Forbid opaque variables as operands of the ternary operator.Francisco Jerez2015-05-041-0/+12
| | | | Reviewed-by: Matt Turner <[email protected]>
* glsl: fix packing support for arrays of doublesTimothy Arceri2015-04-281-2/+2
| | | | | | | Broke in commit f00c5f85b82efe9535b18dbf97c4591fb28aeae6 when adding support for multidimensional arrays Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
* Fix a few typosZoë Blade2015-04-277-13/+13
| | | | Reviewed-by: Francisco Jerez <[email protected]>
* glsl: replace while loop with without_array functionTimothy Arceri2015-04-271-3/+1
| | | | | Signed-off-by: Timothy Arceri <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: support packing of arrays of arraysTimothy Arceri2015-04-271-8/+2
| | | | Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: add arrays of arrays support to without_array functionTimothy Arceri2015-04-271-1/+6
| | | | | Signed-off-by: Timothy Arceri <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* nir: Transform pow(x, 4) into (x*x)*(x*x).Matt Turner2015-04-241-0/+1
|
* glsl: Transform pow(x, 4) into (x*x)*(x*x).Matt Turner2015-04-241-0/+20
| | | | | Reviewed-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/lower_source_mods: Don't propagate register sourcesJason Ekstrand2015-04-221-0/+7
| | | | | | | | | The nir_lower_source_mods pass does a weak form of copy propagation to clean up all of the mov-with-negate's that get generated. However, we weren't properly checking that the sources were SSA and so we could end up moving a register read which is not, in general, valid. Reviewed-by: Connor Abbott <[email protected]>
* nir: Rewrite instr_rewrite_srcJason Ekstrand2015-04-221-24/+28
| | | | | | | The old code wasn't correctly handling the case where the new value of the source contains an indirect. Reviewed-by: Connor Abbott <[email protected]>
* nir/locals_to_regs: Hanadle indirect accesses of length-1 arraysJason Ekstrand2015-04-221-0/+8
| | | | Reviewed-by: Connor Abbott <[email protected]>