aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* 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]>
* 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]>