summaryrefslogtreecommitdiffstats
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* nir: Wire up int64 lowering functionsMatt Turner2019-01-092-3/+127
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Add some more int64 lowering helpersJason Ekstrand2019-01-091-0/+227
| | | | | | | | | | | [mattst88]: Found in an old branch of Jason's. Jason implemented: inot, iand, ior, iadd, isub, ineg, iabs, compare, imin, imax, umin, umax Matt implemented: ixor, bcsel, b2i, i2b, i2i8, i2i16, i2i32, i2i64, u2u8, u2u16, u2u32, u2u64, and fixed ilt Reviewed-by: Elie Tournier <[email protected]>
* nir: Tag entrypoint for easy recognition by nir_shader_get_entrypoint()Matt Turner2019-01-097-6/+30
| | | | | | | | We're going to have multiple functions, so nir_shader_get_entrypoint() needs to do something a little smarter. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Rework nir_lower_constant_initializers() to handle functionsMatt Turner2019-01-091-34/+25
| | | | | | Previously it assumed that only a single function (the entrypoint) existed and attempted to lower constant initializers of shader outputs for each function, for instance.
* glsl: Add "built-in" functions to do fp32_to_int64(fp32)Sagar Ghuge2019-01-091-0/+31
| | | | | Reviewed-by: Elie Tournier <[email protected]> Signed-off-by: Sagar Ghuge <[email protected]>
* glsl: Add "built-in" functions to do fp32_to_uint64(fp32)Sagar Ghuge2019-01-091-0/+29
| | | | | Reviewed-by: Elie Tournier <[email protected]> Signed-off-by: Sagar Ghuge <[email protected]>
* glsl: Add "built-in" functions to do fp64_to_int64(fp64)Sagar Ghuge2019-01-091-0/+29
| | | | | Reviewed-by: Elie Tournier <[email protected]> Signed-off-by: Sagar Ghuge <[email protected]>
* glsl: Add utility function to round and pack int64_t valueSagar Ghuge2019-01-091-0/+36
| | | | | Reviewed-by: Elie Tournier <[email protected]> Signed-off-by: Sagar Ghuge <[email protected]>
* glsl: Add "built-in" functions to do fp64_to_uint64(fp64)Sagar Ghuge2019-01-091-0/+27
| | | | | Reviewed-by: Elie Tournier <[email protected]> Signed-off-by: Sagar Ghuge <[email protected]>
* glsl: Add utility function to round and pack uint64_t valueSagar Ghuge2019-01-091-0/+32
| | | | | Reviewed-by: Elie Tournier <[email protected]> Signed-off-by: Sagar Ghuge <[email protected]>
* glsl: Add "built-in" functions to do int64_to_fp32(int64_t)Sagar Ghuge2019-01-091-0/+22
| | | | | Reviewed-by: Elie Tournier <[email protected]> Signed-off-by: Sagar Ghuge <[email protected]>
* glsl: Add "built-in" functions to do uint64_to_fp32(uint64_t)Sagar Ghuge2019-01-091-0/+20
| | | | | Reviewed-by: Elie Tournier <[email protected]> Signed-off-by: Sagar Ghuge <[email protected]>
* glsl: Add "built-in" functions to do int64_to_fp64(int64_t)Sagar Ghuge2019-01-091-0/+18
| | | | | Reviewed-by: Elie Tournier <[email protected]> Signed-off-by: Sagar Ghuge <[email protected]>
* glsl: Add "built-in" functions to do uint64_to_fp64(uint64_t)Sagar Ghuge2019-01-091-0/+18
| | | | | Reviewed-by: Elie Tournier <[email protected]> Signed-off-by: Sagar Ghuge <[email protected]>
* glsl: Add "built-in" functions to convert bool to doubleMatt Turner2019-01-091-0/+12
| | | | | | And vice versa. Reviewed-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do ffract(fp64)Matt Turner2019-01-091-0/+6
| | | | Reviewed-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" function to do ffloor(fp64)Matt Turner2019-01-091-0/+13
| | | | Reviewed-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do fmin/fmax(fp64)Matt Turner2019-01-091-0/+20
| | | | Reviewed-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do ffma(fp64)Matt Turner2019-01-091-0/+6
| | | | | | Definitely not actually a fused-multiply add. Reviewed-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do round(fp64)Elie Tournier2019-01-091-0/+42
| | | | Signed-off-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do trunc(fp64)Elie Tournier2019-01-091-0/+22
| | | | | | v2: use mix. Signed-off-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do sqrt(fp64)Elie Tournier2019-01-091-0/+272
| | | | Signed-off-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do fp32_to_fp64(fp32)Elie Tournier2019-01-091-0/+38
| | | | Signed-off-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do fp64_to_fp32(fp64)Elie Tournier2019-01-091-0/+101
| | | | Signed-off-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do int_to_fp64(int)Elie Tournier2019-01-091-0/+23
| | | | | v2: use mix Signed-off-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do fp64_to_int(fp64)Elie Tournier2019-01-091-0/+41
| | | | | | v2: use mix Signed-off-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do uint_to_fp64(uint)Elie Tournier2019-01-091-0/+22
| | | | Signed-off-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do fp64_to_uint(fp64)Elie Tournier2019-01-091-0/+61
| | | | Signed-off-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do mul(fp64, fp64)Elie Tournier2019-01-091-0/+148
| | | | | v2: use mix Signed-off-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do add(fp64, fp64)Elie Tournier2019-01-091-0/+433
| | | | | | | v2: use mix and findMSB to optimise. v3: [Sagar] Fix zFrac0 == 0u case in __normalizeRoundAndPackFloat64 Signed-off-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do lt(fp64, fp64)Elie Tournier2019-01-091-0/+50
| | | | Signed-off-by: Elie Tournier <[email protected]>
* glsl: Add utility function to extract 64-bit signElie Tournier2019-01-091-0/+7
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add "built-in" functions to do eq/ne(fp64, fp64)Elie Tournier2019-01-091-0/+56
|
* glsl: Add "built-in" function to do sign(fp64)Elie Tournier2019-01-091-0/+10
| | | | | | v2: use mix. Signed-off-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" functions to do neg(fp64)Elie Tournier2019-01-091-0/+26
| | | | | | v2: use mix. Signed-off-by: Elie Tournier <[email protected]>
* glsl: Add "built-in" function to do abs(fp64)Elie Tournier2019-01-091-0/+11
| | | | Signed-off-by: Elie Tournier <[email protected]>
* glsl: Create file to contain software fp64 functionsMatt Turner2019-01-095-2/+79
| | | | | | | The following patches will add implementations of various double-precision operations to this file. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add utility to convert text files to C stringsIan Romanick2019-01-092-0/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Will be used to convert the .glsl source file containing software fp64 routines to a .h file that can be included while building the compiler. This commit contains two squashed together: the first from Ian adding the utility (with the existing title), and the second from Dylan making the code both python2 and python3 compatible. This is somewhat modeled after the xxd utility that comes with Vim. Signed-off-by: Ian Romanick <[email protected]> xxd.py: Make python2 and 3 compatible This makes use of unicode_literals, so that undecorated strings are considered text (python2 unicode, python3 str) and not bytes in python2 and text in python3. It makes use of io.open, which provides python2 with python3's open behavior (it's an alias in python3), in particular support for the 't' and 'b' option. Finally, it decorates all of the string literals with the 'b' prefix, so that python interprets them as bytes. I've removed the stdin and stdout options, as python2 always requires these to be bytes, but python3 always treats them as text (there is a way to get at the underlying bytes buffer, but that's even more complexity), and makes the input files required arguments. In the meson we use the '@INPUT@' shorthand instead of listing each input, as meson will expand that to [prog_python, '@INPUT0@', @INPUT1@, ..., @OUTPUT@, ...]
* glsl: Copy function out to temp if we don't directly ref a variableTimothy Arceri2019-01-091-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise we can end up with IR that looks like this: ( (declare (temporary ) vec4 f@8) (assign (xyzw) (var_ref f@8) (var_ref f) ) (call f16 ((swiz y (var_ref f@8) ))) (assign (xyzw) (var_ref f) (var_ref f@8) ) )) When we really need: (declare (temporary ) float inout_tmp) (assign (x) (var_ref inout_tmp) (swiz y (var_ref f) )) (call f16 ((var_ref inout_tmp) )) (assign (y) (var_ref f) (swiz y (swiz xxxx (var_ref inout_tmp) ))) (declare (temporary ) void void_var) The GLSL IR function inlining code seemed to produce correct code even without this but we need the correct IR for GLSL IR -> NIR to be able to understand whats going on. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add function support to glsl_to_nirMatt Turner2019-01-091-9/+119
| | | | | | | Based on a patch from Tim Arceri, but I had to substantially rewrite it as a result of the NIR derefs rework. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fix buffer overflow with an atomic buffer binding out of range.Eric Anholt2019-01-081-1/+2
| | | | | | | | | | | | | | | | | | | The binding is checked against the limits later in the function, so we need to make sure we don't overflow before the check here. Fixes this valgrind warning (and sometimes segfault): ==1460== Invalid write of size 4 ==1460== at 0x74C98DD: ast_declarator_list::hir(exec_list*, _mesa_glsl_parse_state*) (ast_to_hir.cpp:4943) ==1460== by 0x74C054F: _mesa_ast_to_hir(exec_list*, _mesa_glsl_parse_state*) (ast_to_hir.cpp:159) ==1460== by 0x7435C12: _mesa_glsl_compile_shader (glsl_parser_extras.cpp:2130) in dEQP-GLES31.functional.debug.negative_coverage.get_error.compute. exceed_atomic_counters_limit Reviewed-by: Timothy Arceri <[email protected]>
* nir: Make nir_deref_instr_build/get_const_offset actually use size_align.Eric Anholt2019-01-081-3/+2
| | | | | | | | | | | | I think this was copy-and-paste mistake -- nir_opt_large_constants was passing in glsl_get_natural_size_align_bytes() given brw_nir.c's arguments to the opt pass. I wanted to reuse this function for handling constant offsets of arrays of images in V3D. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* glsl/linker: Fix unmatched TCS outputs being reduced to local variableDanylo Piliaiev2019-01-091-0/+6
| | | | | | | | | | | | Always match TCS outputs since they are shared by all invocations within the patch and should not be converted to local variables. This is one of the issues found in Downward. Signed-off-by: Danylo Piliaiev <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104297
* nir: Add nir_lower_tex support for Broadcom's swizzled TG4 results.Eric Anholt2019-01-082-0/+26
| | | | | | | | V3D returns the texels in a different order in the resulting vec4 from what GLSL wants, so we need to put in a swizzle. Fixes dEQP-GLES31.functional.texture.gather.basic.2d.rgba8.base_level.level_1 Reviewed-by: Jason Ekstrand <[email protected]>
* nir: fix warning in nir_lower_io.cCaio Marcelo de Oliveira Filho2019-01-081-1/+1
| | | | | | | | | | | | | | | | | | Initialize the variable with NULL. Fixes the following In file included from ../src/compiler/nir/nir_lower_io.c:34: ../src/compiler/nir/nir_lower_io.c: In function ‘nir_lower_explicit_io’: ../src/compiler/nir/nir.h:668:11: warning: ‘addr’ may be used uninitialized in this function [-Wmaybe-uninitialized] return src; ^~~ ../src/compiler/nir/nir_lower_io.c:735:17: note: ‘addr’ was declared here nir_ssa_def *addr; ^~~~ v2: Avoid using a 'default' case so we get help from the compiler when new deref types are added. (Lionel) Acked-by: Jason Ekstrand <[email protected]>
* nir: rename global/local to private/function memoryKarol Herbst2019-01-0823-86/+86
| | | | | | | | | | | | | | | | | | the naming is a bit confusing no matter how you look at it. Within SPIR-V "global" memory is memory accessible from all threads. glsl "global" memory normally refers to shader thread private memory declared at global scope. As we already use "shared" for memory shared across all thrads of a work group the solution where everybody could be happy with is to rename "global" to "private" and use "global" later for memory usually stored within system accessible memory (be it VRAM or system RAM if keeping SVM in mind). glsl "local" memory is memory only accessible within a function, while SPIR-V "local" memory is memory accessible within the same workgroup. v2: rename local to function as well v3: rename vtn_variable_mode_local as well Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* spirv: Sort supported capabilitiesJason Ekstrand2019-01-071-17/+17
| | | | Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* spirv: Add support for using derefs for UBO/SSBO accessJason Ekstrand2019-01-085-68/+269
| | | | | | | | | For now, it's hidden behind a cap. Hopefully, we can eventually drop that along with all the manual offset code in spirv_to_nir. Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Tested-by: Bas Nieuwenhuizen <[email protected]>
* spirv: Make better use of vtn_pointer_uses_ssa_offsetJason Ekstrand2019-01-081-15/+13
| | | | | | | | | | | The choice of whether or not we should use block_load/store isn't a choice between external and not so much as a choice between deref instructions and manually calculated offsets. In vtn_pointer_from_ssa, we guard the index+offset case behind vtn_pointer_uses_ssa_offset and then branch out from there. Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* spirv: Add explicit pointer typesJason Ekstrand2019-01-082-20/+28
| | | | | | | | Instead of baking in uvec2 for UBO and SSBO pointers and uint for push constant and shared memory pointers, make it configurable. Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>