summaryrefslogtreecommitdiffstats
path: root/src/compiler/Makefile.sources
Commit message (Collapse)AuthorAgeFilesLines
* nir: add conditional discard optimisation (v4)Dave Airlie2016-11-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This is ported from GLSL and converts if (cond) discard; into discard_if(cond); This removes a block, but also is needed by radv to workaround a bug in the LLVM backend. v2: handle if (a) discard_if(b) (nha) cleanup and drop pointless loop (Matt) make sure there are no dependent phis (Eric) v3: make sure only one instruction in the then block. v4: remove sneaky tabs, add cursor init (Eric) Reviewed-by: Eric Anholt <eric@anholt.net> Cc: "13.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit b16dff2d88302e5113598a818d2f92f8af02cd79)
* glsl: Remove unused function import_prototypesIan Romanick2016-10-171-1/+0
| | | | | | | | | | Once upon a time, this was used to extract prototypes from the shader containing GLSL built-in functions. This was removed by f5692f45 in November 2010 for Mesa 7.10. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Engestrom <eric@engestrom.ch>
* glsl: Add initial functions to implement an on-disk cacheTimothy Arceri2016-09-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code provides for an on-disk cache of objects. Objects are stored and retrieved via names that are arbitrary 20-byte sequences, (intended to be SHA-1 hashes of something identifying for the content). The directory used for the cache can be specified by means of environment variables in the following priority order: $MESA_GLSL_CACHE_DIR $XDG_CACHE_HOME/mesa <user-home-directory>/.cache/mesa By default the cache will be limited to a maximum size of 1GB. The environment variable: $MESA_GLSL_CACHE_MAX_SIZE can be set (at the time of GL context creation) to choose some other size. This variable is a number that can optionally be followed by 'K', 'M', or 'G' to select a size in kilobytes, megabytes, or gigabytes. By default, an unadorned value will be interpreted as gigabytes. The cache will be entirely disabled at runtime if the variable MESA_GLSL_CACHE_DISABLE is set at the time of GL context creation. Many thanks to Kristian Høgsberg <krh@bitplanet.net> for the initial implementation of code that led to this patch. In particular, the idea of using an mmapped file, (indexed by a portion of the SHA-1), for the efficent implementation of cache_has_key was entirely his idea. Kristian also provided some very helpful advice in discussions regarding various race conditions to be avoided in this code. Signed-off-by: Timothy Arceri <timothy.arceri@collabora.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* glsl: Use the generated constant expression codeIan Romanick2016-08-301-0/+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 <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
* glsl: Generate ir_expression_operation_strings.h from PythonIan Romanick2016-08-301-1/+1
| | | | | | | | | | | | 'diff -ud' is clean. v2: Massive rebase. v3: With much help from José Fonseca, fix the SCons build. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Acked-by: Dylan Baker <dylan@pnwbakers.com>
* glsl: Pull operator_strs out to its own fileIan Romanick2016-08-301-0/+1
| | | | | | | | | | No change except to the copyright symbol. The next patch will generate this file with Python, and Unicode + Python = pure rage. v2: Massive rebase. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
* glsl: Generate ir_expression_operation.h from PythonIan Romanick2016-08-301-1/+1
| | | | | | | | | | | | | There are differences in where end-of-line comments are placed, but 'diff -wud' is clean. v2: Massive rebase. v3: With much help from José Fonseca, fix SCons build. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Acked-by: Dylan Baker <dylan@pnwbakers.com>
* glsl: Add a lowering pass to handle advanced blending modes.Kenneth Graunke2016-08-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many GPUs cannot handle GL_KHR_blend_equation_advanced natively, and need to emulate it in the pixel shader. This lowering pass implements all the necessary math for advanced blending. It fetches the existing framebuffer value using the MESA_shader_framebuffer_fetch built-in variables, and the previous commit's state var uniform to select which equation to use. This is done at the GLSL IR level to make it easy for all drivers to implement the GL_KHR_blend_equation_advanced extension and share code. Drivers need to hook up MESA_shader_framebuffer_fetch functionality: 1. Hook up the fb_fetch_output variable 2. Implement BlendBarrier() Then to get KHR_blend_equation_advanced, they simply need to: 3. Disable hardware blending based on ctx->Color._AdvancedBlendEnabled 4. Call this lowering pass. Very little driver specific code should be required. v2: Handle multiple output variables per render target (which may exist due to ARB_enhanced_layouts), and array variables (even with one render target, we might have out vec4 color[1]), and non-vec4 variables (it's easier than finding spec text to justify not handling it). Thanks to Francisco Jerez for the feedback. v3: Lower main returns so that we have a single exit point where we can add our blending epilogue (caught by Francisco Jerez). Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Francisco Jerez <currojerez@riseup.net>
* nir: Add an IO scalarizing pass using the intrinsic's first_component.Eric Anholt2016-08-191-0/+1
| | | | | | | | | | vc4 wants to have per-scalar IO load/stores so that dead code elimination can happen on a more granular basis, which it has been doing in the backend using a multiplication by 4 of the intrinsic's driver_location. We can represent it properly in the NIR using the first_component field, though. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* glsl: Pull enum ir_expression_operation out to its own fileIan Romanick2016-08-171-0/+1
| | | | | | | | | | No change except to the copyright symbol. The next patch will generate this file with Python, and Unicode + Python = pure rage. v2: Massive rebase... I guess a lot can change in a year. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
* glsl: Make the generated sources build rules more like NIRIan Romanick2016-08-171-2/+3
| | | | | Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
* nir: Add a pass for propagating invariant decorationsJason Ekstrand2016-06-201-0/+1
| | | | | | | | | | This pass is similar to propagate_invariance in the GLSL compiler. The real "output" of this pass is that any algebraic operations which are eventually consumed by an invariant variable get marked as "exact". Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Cc: "12.0" <mesa-stable@lists.freedesktop.org>
* nir/spirv: Add string lookup tables for a couple of SPIR-V enumsJason Ekstrand2016-06-031-0/+2
| | | | | Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Cc: "12.0" <mesa-stable@lists.freedesktop.org>
* nir: automake: add nir_search_helpers.h to the sources list(s)Emil Velikov2016-06-041-0/+1
| | | | | | Fixes: dfbae7d64f4 ("nir/algebraic: support for power-of-two optimizations") Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* compiler: Move glsl_to_nir to libglsl.laJason Ekstrand2016-05-261-2/+2
| | | | | | | | Right now libglsl.la depends on libnir.la so putting it in libnir.la adds a dependency on libglsl.la that goes the wrong direction. Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
* glsl: split out libstandaloneRob Clark2016-05-251-1/+2
| | | | | | | | | Split standalone glsl_compiler into a libstandalone.la and a thin main.cpp. This way drivers can re-use the glsl standalone frontend in their own standalone compilers. Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* nir: Add a simple nir_lower_wpos_center() pass for Vulkan drivers.Kenneth Graunke2016-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | nir_lower_wpos_ytransform() is great for OpenGL, which allows applications to choose whether their coordinate system's origin is upper left/lower left, and whether the pixel center should be on integer/half-integer boundaries. Vulkan, however, has much simpler requirements: the pixel center is always half-integer, and the origin is always upper left. No coordinate transform is needed - we just need to add <0.5, 0.5>. This means that we can avoid using (and setting up) a uniform. I thought about adding more options to nir_lower_wpos_ytransform(), but making a new pass that never even touched uniforms seemed simpler. v2: Use normal iterator rather than _safe variant (noticed by Matt). Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Rob Clark <robdclark@gmail.com>
* glsl: rename lower_clip_distance to lower_distance.Dave Airlie2016-05-141-1/+1
| | | | | | | | | | This just renames the file in anticipation of adding cull lowering, and renames the internals. Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de> Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
* nir: rename lower_outputs_to_temporaries -> lower_io_to_temporariesRob Clark2016-05-111-1/+1
| | | | | | Since it will gain support to lower inputs, give it a more generic name. Signed-off-by: Rob Clark <robclark@freedesktop.org>
* nir: lower-io-types passRob Clark2016-05-111-0/+1
| | | | | | | | | | | | | | | | | A pass to lower complex (struct/array/mat) inputs/outputs to primitive types. This allows, for example, linking that removes unused components of a larger type which is not indirectly accessed. In the near term, it is needed for gallium (mesa/st) support for NIR, since only used components of a type are assigned VBO slots, and we otherwise have no way to represent that to the driver backend. But it should be useful for doing shader linking in NIR. v2: use glsl_count_attribute_slots() rather than passing a type_size fxn pointer Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
* nir: passthrough-edgeflags supportRob Clark2016-05-111-0/+1
| | | | | | | | Handled by tgsi_emulate for glsl->tgsi case. Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Connor Abbott <cwabbott0@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* nir: add lowering pass for glBitmapRob Clark2016-05-111-0/+1
| | | | | | Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Connor Abbott <cwabbott0@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* nir: add lowering pass for glDrawPixelsRob Clark2016-05-111-0/+1
| | | | | | Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Connor Abbott <cwabbott0@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* nir: add lowering pass for y-transformRob Clark2016-05-111-0/+1
| | | | | | Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Connor Abbott <cwabbott0@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* spirv: automake: add missing headers to the tarball.Emil Velikov2016-05-011-0/+2
| | | | Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* nir: clamp-color-output supportRob Clark2016-04-301-0/+1
| | | | | | | Handled by tgsi_emulate for glsl->tgsi case. Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
* nir: add a pass to lower some double operationsConnor Abbott2016-04-281-0/+1
| | | | | | | | | | | | v2: Move to compiler/nir (Iago) v3: Use nir_imm_int() to load the constants (Sam) v4 (Sam): - Undo line-wrap (Jason). - Fix comment (Jason). - Improve generated code for get_signed_inf() function (Connor). Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
* spirv: Move to compiler/Jason Ekstrand2016-04-141-7/+7
| | | | | | While it does rely on NIR, it's not really part of the NIR core. At the moment, it still builds as part of libnir but that can be changed later if desired.
* Merge remote-tracking branch 'public/master' into vulkanJason Ekstrand2016-04-131-0/+1
|\
| * nir: add a pass for lowering (un)pack_double_2x32Connor Abbott2016-04-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | v2: Undo unintended change to the signature of nir_normalize_cubemap_coords (Iago). v3: Move to compiler/nir (Iago) v4: Remove Authors from copyright header (Michael Schellenberger) v5 (Sam): - Use nir_channel() and nir_ssa_for_alu_src() helpers (Jason) - Inline lower_double_pack_instr() code into lower_double_pack_block() (Jason). - Initialize nir_builder at lower_double_pack_impl() (Jason). Signed-off-by: Iago Toral Quiroga <itoral@igalia.com> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
| * nir: Add a pass for gathering various bits of shader infoJason Ekstrand2016-04-101-0/+1
| | | | | | | | | | Reviewed-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* | Merge remote-tracking branch 'public/master' into vulkanJason Ekstrand2016-04-011-2/+2
|\ \ | |/
| * nir/Makefile: Fix alphabetizationJason Ekstrand2016-03-281-3/+3
| | | | | | | | Reviewed-by: Rob Clark <robdclark@gmail.com>
* | Merge remote-tracking branch 'public/master' into vulkanJason Ekstrand2016-03-241-0/+1
|\ \ | |/
| * nir: Add a pass to inline functionsJason Ekstrand2016-03-241-0/+1
| | | | | | | | | | | | | | This commit adds a new NIR pass that lowers all function calls away by inlining the functions. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
| * nir: Add return lowering passJason Ekstrand2016-03-241-0/+1
| | | | | | | | | | | | | | | | This commit adds a NIR pass for lowering away returns in functions. If the return is in a loop, it is lowered to a break. If it is not in a loop, it's lowered away by moving/deleting code as needed. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
| * nir: Add a pass to repair SSA formJason Ekstrand2016-03-241-0/+1
| | | | | | | | Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
| * nir: Add a phi node placement helperJason Ekstrand2016-03-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | Right now, we have phi placement code in two places and there are other places where it would be nice to be able to do this analysis. Instead of repeating it all over the place, this commit adds a helper for placing all of the needed phi nodes for a value. v2: Add better documentation Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
| * glsl: Add a pass to propagate the "invariant" and "precise" qualifiersJason Ekstrand2016-03-231-0/+1
| | | | | | | | Reviewed-by: Francisco Jerez <currojerez@riseup.net>
* | Merge remote-tracking branch 'public/master' into vulkanJason Ekstrand2016-03-151-1/+1
|\ \ | |/
| * nir: Add a pass for lower indirect variable dereferencesJason Ekstrand2016-03-081-0/+1
| | | | | | | | | | | | | | | | This new pass lowers load/store_var intrinsics that act on indirect derefs to if-ladder of direct load/store_var intrinsics. The if-ladders perform a simple binary search on the indirect. Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
* | Merge commit mesa-public/master into vulkanJason Ekstrand2016-02-051-0/+16
|/ | | | This pulls in the patches that move all of the compiler stuff around
* glsl: move to compiler/Emil Velikov2016-01-261-0/+147
| | | | | | Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Matt Turner <mattst88@gmail.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
* nir: move to compiler/Emil Velikov2016-01-261-0/+71
| | | | | | Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Matt Turner <mattst88@gmail.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
* compiler: move the glsl_types C wrapper alongside their C++ brethrenEmil Velikov2016-01-261-0/+2
| | | | | | | | | | At a later stage we might want to split out the NIR specific [XXX: which one was it], as to make things move obvious and rename the files appropriately. This patch aims to split it out of nir. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Matt Turner <mattst88@gmail.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
* nir: move glsl_types.{cpp,h} to compilerEmil Velikov2016-01-261-0/+2
| | | | | | | | Allows us to remove the SCons workaround :-) Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Matt Turner <mattst88@gmail.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
* nir: move shader_enums.[ch] to compilerEmil Velikov2016-01-261-1/+3
| | | | | | | | | This way one can reuse it in glsl, nir or other infrastructure without pulling nir as dependency. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Matt Turner <mattst88@gmail.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
* compiler: introduce a libcompiler static libraryEmil Velikov2016-01-261-0/+2
Currently it's an empty library, although it'll be used to store common code between GLSL and NIR that is compiler specific (rather than generic as the one in src/util). XXX: strictly speaking we could add a python/mako parser to generate the relevant files instead including builtin_type_macros.h in such a manner. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Matt Turner <mattst88@gmail.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>