summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* 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]>
* nir/locals_to_regs: Initialize registers with constant initializersJason Ekstrand2015-04-221-0/+103
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/locals_to_regs: Pass around the nir_shader rather than a void * mem_ctxJason Ekstrand2015-04-221-13/+13
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Add a simple growing array data structureJason Ekstrand2015-04-221-0/+96
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/types: Make glsl_get_length smarterJason Ekstrand2015-04-224-55/+8
| | | | | | | | | | | | | | | | | | Previously, this function returned the number of elements for structures and arrays and 0 for everything else. In NIR, this is almost never what you want because we also treat matricies as arrays so you have to special-case constantly. This commit glsl_get_length treat matrices as an array of columns by returning the number of columns instead of 0 This also fixes a bug in locals_to_regs caused by not checking for the matrix case in one place. v2: Only special-case for matrices and return a length of 0 for vectors as we did before. This was needed to not break the TGSI-based drivers and doesn't really affect NIR at the moment. Reviewed-by: Connor Abbott <[email protected]> Tested-by: Rob Clark <[email protected]>
* nir: Move get_const_initializer_load from vars_to_ssa to NIR coreJason Ekstrand2015-04-223-62/+65
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/lower_vars_to_ssa: Pass around the nir_shader instead of a void mem_ctxJason Ekstrand2015-04-221-14/+14
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/print: Print the closing paren on load_const instructionsJason Ekstrand2015-04-221-0/+2
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/tex: Use the correct return size for query_levels and lodJason Ekstrand2015-04-221-1/+4
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir: Refactor tex_instr_dest_size to use a switch statementJason Ekstrand2015-04-221-5/+8
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/lower_vars_to_ssa: Actually look for indirects when determining aliasingJason Ekstrand2015-04-221-0/+4
| | | | Reviewed-by: Connor Abbott <[email protected]>
* mesa: remove the gl_sl_pragmas structureJason Ekstrand2015-04-221-3/+0
| | | | | | | This code was added by Brian Paul in 2009 but, as far as Matt and I can tell, it's been dead ever since the new GLSL compiler was added. Reviewed-by: Brian Paul <[email protected]>
* glsl: rewrite glsl_type::record_key_hash() to avoid buffer overflowBrian Paul2015-04-221-10/+13
| | | | | | | | | | | | | | | | | | | This should be more efficient than the previous snprintf() solution. But more importantly, it avoids a buffer overflow bug that could result in crashes or unpredictable results when processing very large interface blocks. For the app in question, key->length = 103 for some interfaces. The check if size >= sizeof(hash_key) was insufficient to prevent overflows of the hash_key[128] array because it didn't account for the terminating zero. In this case, this caused the call to hash_table_string_hash() to return different results for identical inputs, and then shader linking failed. This new solution also takes all structure fields into account instead of just the first 15 when sizeof(pointer)==8. Cc: [email protected] Reviewed-by: Ian Romanick <[email protected]>
* android: fix the building rules for Android 5.0Chih-Wei Huang2015-04-221-2/+1
| | | | | | | | | | | | | | | | | Android 5.0 allows modules to generate source into $OUT/gen, which will then be copied into $OUT/obj and $OUT/obj_$(TARGET_2ND_ARCH) as necessary. Modules will need to change calls to local-intermediates-dir into local-generated-sources-dir. The patch changes local-intermediates-dir into local-generated-sources-dir. If the Android version is less than 5.0, fallback to local-intermediates-dir. The patch also fixes the 64-bit building issue of Android 5.0. v2 [Emil Velikov] - Keep the LOCAL_UNSTRIPPED_PATH variable. Signed-off-by: Chih-Wei Huang <[email protected]>
* android: nir: add build rules for nir_builder_opcodes.hEmil Velikov2015-04-221-0/+10
| | | | | | | Missed out with commit 2a135c470e3(nir: Add an ALU op builder kind of like ir_builder.h) Signed-off-by: Emil Velikov <[email protected]>
* android: add inital NIR buildMauro Rossi2015-04-222-3/+55
| | | | | | | | | | | | | | | Required by the i965 driver. v2: - Split out the nir_builder_opcodes.h rules. - Do not unconditionally hide the python command - use $(hide) - Use LOCAL_EXPORT_C_INCLUDE_DIRS to manage includes for the generated sources. Cc: "10.5" <[email protected]> [Emil Velikov: Split from a larger commit, v2] Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Chih-Wei Huang <[email protected]>
* android: add gallium dirs to more places in the treeEmil Velikov2015-04-221-2/+6
| | | | | | | | Similar to e8c5cbfd921(mesa: Add gallium include dirs to more parts of the tree.) Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Chih-Wei Huang <[email protected]>
* android: add $(mesa_top)/src include to the whole of mesaEmil Velikov2015-04-221-2/+0
| | | | | | | | | Many parts of mesa already have the include with others depending on it but it's missing. Add it once at the top makefile and be done with it. Cc: "10.4 10.5" <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Chih-Wei Huang <[email protected]>
* glsl: correct indentation of comment, Trivial.Tapani Pälli2015-04-211-1/+1
| | | | Signed-off-by: Tapani Pälli <[email protected]>
* glsl: add fallthrough comment on switchTapani Pälli2015-04-211-1/+2
| | | | | Signed-off-by: Tapani Pälli <[email protected]> Reviewed-By: Martin Peres <[email protected]>
* nir: Allow abs/neg in select peephole pass.Matt Turner2015-04-171-1/+3
| | | | | | | | | | | total instructions in shared programs: 4314531 -> 4308949 (-0.13%) instructions in affected programs: 429085 -> 423503 (-1.30%) helped: 1680 HURT: 0 GAINED: 0 LOST: 111 Reviewed-by: Jason Ekstrand <[email protected]>
* nir/builder: add nir_builder_insert_after_instr()Rob Clark2015-04-171-2/+18
| | | | | | | For lowering if/else, I need a way to insert at the end of the previous block. Signed-off-by: Rob Clark <[email protected]>
* nir: Convert the if-test for num_inputs == 2 to an assertionIan Romanick2015-04-161-2/+2
| | | | | | | | | Suggested by Jason on a different patch after some comments / questions by Ilia. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* mesa,glsl: rename `interface` to `programInterface`.Jose Fonseca2015-04-161-4/+4
| | | | | | | | | | | | | | | | | `interface` is a define on Windows -- an alias for `struct` keyword, used when declaring COM interfaces in C or C++. So use instead `programInterface`, therefore matching the name used in GL_ARB_program_interface_query spec/headers, which was renamed exactly for the same reason: "Revision 10, May 10, 2012 (pbrown) - Rename the formal parameter <interface> used by the functions in this extension to <programInterface>. Certain versions of the Microsoft C/C++ compiler and/or its headers cause "interface" to be treated as a reserved keyword." Trivial.
* mesa/glsl: build list of program resources during linkingTapani Pälli2015-04-161-0/+192
| | | | | | | | | | | | | | | | Patch adds ProgramResourceList to gl_shader_program structure. List contains references to active program resources and is constructed during linking phase. This list will be used by follow-up patches to implement hooks for GL_ARB_program_interface_query. It can be also used to implement any of the older shader program query APIs. v2: code cleanups + note for SSBO and subroutines (Ilia Mirkin) v3: code cleanups + assert(MESA_SHADER_STAGES < 8) (Martin Peres) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Martin Peres <[email protected]>
* linker: fix varying linking if SSO program has only gs and fsTapani Pälli2015-04-161-12/+17
| | | | | | | | | | | | | | | | Previously linker did not take in to account case where one would have only gs and fs (with SSO), patch adds the case by refactoring code around assign_varying_locations. This makes sure locations for gs get populated correctly. This was found with some of the SSO subtests of Martin's upcoming GetProgramInterfaceiv Piglit test which passes with the patch, no Piglit regressions. v2: code cleanups (Martin Peres) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Martin Peres <[email protected]>
* nir: Try commutative sources in CSEIan Romanick2015-04-151-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shader-db results: GM45 NIR: total instructions in shared programs: 4082044 -> 4081919 (-0.00%) instructions in affected programs: 27609 -> 27484 (-0.45%) helped: 44 Iron Lake NIR: total instructions in shared programs: 5678776 -> 5678646 (-0.00%) instructions in affected programs: 27406 -> 27276 (-0.47%) helped: 45 Sandy Bridge NIR: total instructions in shared programs: 7329995 -> 7329096 (-0.01%) instructions in affected programs: 142035 -> 141136 (-0.63%) helped: 406 HURT: 19 Ivy Bridge NIR: total instructions in shared programs: 6769314 -> 6768359 (-0.01%) instructions in affected programs: 140820 -> 139865 (-0.68%) helped: 423 HURT: 2 Haswell NIR: total instructions in shared programs: 6183693 -> 6183298 (-0.01%) instructions in affected programs: 96538 -> 96143 (-0.41%) helped: 303 HURT: 4 Broadwell NIR: total instructions in shared programs: 7501711 -> 7498170 (-0.05%) instructions in affected programs: 266403 -> 262862 (-1.33%) helped: 705 HURT: 5 GAINED: 4 v2: Rebase on top of Connor's fix. v3: Convert the if-test for num_inputs == 2 to an assertion. Suggested by Jason after some comments / questions by Ilia. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]> [v1] Reviewed-by: Jason Ekstrand <[email protected]> Cc: Connor Abbott <[email protected]>
* glsl: fix assignment of multiple scalar and vecs to matrices.Samuel Iglesias Gonsalvez2015-04-151-61/+49
| | | | | | | | | | | | | | | | | When a vec has more elements than row components in a matrix, the code could end up failing an assert inside assign_to_matrix_column(). This patch makes sure that when there is still room in the matrix for more elements (but in other columns of the matrix), the data is actually assigned. This patch fixes the following dEQP test: dEQP-GLES3.functional.shaders.conversions.matrix_combine.float_bvec4_ivec2_bool_to_mat4x2_vertex dEQP-GLES3.functional.shaders.conversions.matrix_combine.float_bvec4_ivec2_bool_to_mat4x2_fragment Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Ben Widawsky <[email protected]>
* nir: Fix typo in "ushr by 0" algebraic replacementIan Romanick2015-04-141-1/+1
| | | | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Connor Abbott <[email protected]> Cc: "10.5" <[email protected]>
* nir: Silence unused parameter warningsIan Romanick2015-04-142-1/+3
| | | | | | | | | | | | | | | | | | | nir/nir.h: In function 'nir_validate_shader': nir/nir.h:1567:56: warning: unused parameter 'shader' [-Wunused-parameter] static inline void nir_validate_shader(nir_shader *shader) { } ^ nir/nir_opt_cse.c: In function 'src_is_ssa': nir/nir_opt_cse.c:165:32: warning: unused parameter 'data' [-Wunused-parameter] src_is_ssa(nir_src *src, void *data) ^ nir/nir_opt_cse.c: In function 'dest_is_ssa': nir/nir_opt_cse.c:171:35: warning: unused parameter 'data' [-Wunused-parameter] dest_is_ssa(nir_dest *dest, void *data) ^ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir/cse: fix bug with comparing non-per-component sourcesConnor Abbott2015-04-141-10/+7
| | | | | | | | | | | | We weren't comparing the right number of components when checking swizzles. Use nir_ssa_alu_instr_num_src_components() to do the right thing. No piglit regressions, and no fixes either. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Connor Abbott <[email protected]>
* nir: Store num_direct_uniforms in the nir_shader.Kenneth Graunke2015-04-111-0/+3
| | | | | | | | | | | | | | Storing this here is pretty sketchy - I don't know if any driver other than i965 will want to use it. But this will make it a lot easier to generate NIR code at link time. We'll probably rework it anyway. (Ian suggested making nir_assign_var_locations_scalar_direct_first simply modify the nir_shader's fields, rather than passing pointers to them. If this stays long term, we should do that. But Jason and I suspect we'll be reworking this area again in the near future.) Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: Mark path as unreachable.Matt Turner2015-04-111-1/+1
|
* nir: fix bit of cargo-culting in lower_idivRob Clark2015-04-111-2/+0
| | | | | | | | | | | | I guess I was looking too much at how lower_system_values worked when writing lower_idiv. Since ttn wasn't emitting load_var for sysvals and the only drivers using lower_idiv were using ttn, I think nothing was broken as a result. But might as well fix this before it becomes a problem. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: split out lower_sub from lower_negateRob Clark2015-04-112-2/+4
| | | | | | | | | | Originally you had to have one or the other. But actually I don't want either. (Or rather I want whatever is the minimum # of instructions.) TODO: not sure where the best place to insert a check that driver hasn't set *both* lower_negate and lower_sub? Signed-off-by: Rob Clark <[email protected]>
* nir: Constify nir_lower_sampler's gl_shader_program pointer.Kenneth Graunke2015-04-102-6/+6
| | | | | | | | | Now that we're not generating linker errors, we don't actually modify this. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* nir: Remove linker_error calls from nir_lower_samplers().Kenneth Graunke2015-04-101-7/+2
| | | | | | | | | These should never happen. Plus, NIR passes really shouldn't be reporting linker errors - this is past link time. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* nir: Make nir_lower_samplers take a gl_shader_stage, not a gl_program *.Kenneth Graunke2015-04-102-15/+13
| | | | | | | | | | We don't actually need a gl_program struct. We only used it to translate prog->Target (i.e. GL_VERTEX_PROGRAM) to the gl_shader_stage (i.e. MESA_SHADER_VERTEX). We may as well just pass that. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* nir: Move gl_shader_stage enum from mtypes.h to shader_enums.h.Kenneth Graunke2015-04-102-0/+18
| | | | | | | | | I want to use this in some code that doesn't currently include mtypes.h. It seems like a better place for it anyway. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* nir: Fix #include guards in shader_enums.h.Kenneth Graunke2015-04-101-3/+3
| | | | | | | | | This header was originally going to be called pipeline.h, but it got renamed at the last minute. Make the include guards match. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Ian Romanick <[email protected]>