summaryrefslogtreecommitdiffstats
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Relax GLSL 1.10 float suffix error to a warning.Matt Turner2016-04-211-2/+2
| | | | | | | | | | | | Float suffixes are allowed in all subsequent GLSL specifications, and it's obvious what the user meant if they specify one. Accept it with a warning to avoid breaking applications, like Planeshift (although it looks like between 0.6.1 and 0.6.3 they might have removed the suffixes from their shaders). Reviewed-by: Lars Hamre <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: android: add back missing generated glcpp include pathRob Herring2016-04-211-0/+1
| | | | | | | | | | Commit 4db8f15a2576 ("glsl: move the android build scripts a level up") dropped a generated include path for glcpp. Add it back adjusting for the new location. Signed-off-by: Rob Herring <[email protected]> Tested-by: Chih-Wei Huang <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glsl: add forgotten textureOffset function for sampler2DArrayShadowRoland Scheidegger2016-04-211-0/+7
| | | | | | | | | | | | | | | | | | This was part of EXT_gpu_shader4 - as such it should have been supported by glsl 130. It was however forgotten, and not added until glsl 430 - with the wrong syntax no less (glsl 430 mentions it was overlooked). glsl 440 (but revision 8 only) fixed this finally for good. At least nvidia supports this with just version glsl version 1.30 as well (the spec doesn't explicitly say it should be supported retroactively), so just add this to the other glsl 130 textureOffset functions. Passes a (hacked) piglit tex-miplevel-selection test (2DArrayShadow textureOffset -auto) with llvmpipe. v2: fix up comment (by Ian), add testing to commit message. Reviewed-by: Dave Airlie <[email protected]>
* spirv: Trivially handle the NonWriteable decorationJason Ekstrand2016-04-202-0/+4
| | | | Signed-off-by: Jason Ekstrand <[email protected]>
* nir: rename nir_foreach_block*() to nir_foreach_block*_call()Connor Abbott2016-04-2045-70/+70
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir/lower-tex: add srgb->linear loweringRob Clark2016-04-192-0/+53
| | | | | | Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/builder: const'ify swiz paramRob Clark2016-04-191-1/+1
| | | | | | | | No need for it not to be const, and lets caller declare it const if desired. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* nir/lower-tex: make options a local varRob Clark2016-04-191-8/+8
| | | | Signed-off-by: Rob Clark <[email protected]>
* glsl: Properly handle ldexp(0.0f, non-zero-exp).Matt Turner2016-04-181-4/+6
|
* nir: only dereference undef after NULL check. (v2)Dave Airlie2016-04-181-1/+0
| | | | | | | Pointed out by coverity. v2: nuke line, Jason pointed out the constructor does it. Signed-off-by: Dave Airlie <[email protected]>
* Merge remote-tracking branch 'public/master' into vulkanJason Ekstrand2016-04-151-7/+27
|\
| * nir/print: Fix printing variable modeEduardo Lima Mitev2016-04-151-7/+27
| | | | | | | | | | | | | | nir_variable_mode is currently a bitflag enum, while nir_print::print_var_decl() assumes is still a numbered list. Reviewed-by: Jason Ekstrand <[email protected]>
* | Merge remote-tracking branch 'public/master' into vulkanJason Ekstrand2016-04-142-1/+3
|\|
| * nir/lower_io: Add UBOs and SSBOs to get_io_offset_srcJason Ekstrand2016-04-141-0/+3
| | | | | | | | Reviewed-by: Kenneth Graunke <[email protected]>
| * nir/intrinsics: Add a vulkan_resource_index intrinsicJason Ekstrand2016-04-143-0/+34
| | | | | | | | | | | | | | This is used to facilitate the Vulkan binding model where each resource is described by a (descriptor set, binding, array index) tuple. Reviewed-by: Rob Clark <[email protected]>
| * nir: Add a descriptor_set field to nir_variableJason Ekstrand2016-04-141-0/+5
| | | | | | | | | | | | This is needed for supporting the Vulkan binding model Reviewed-by: Rob Clark <[email protected]>
* | Merge remote-tracking branch 'public/master' into vulkanJason Ekstrand2016-04-147-23/+112
|\|
| * nir: Add another index to load_uniform to specify the range readJason Ekstrand2016-04-144-1/+18
| | | | | | | | | | Reviewed-by: Kristian Høgsberg <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
| * scons: Build NIR.Jose Fonseca2016-04-142-0/+74
| | | | | | | | | | | | | | | | | | Emil Velikov: - Attribute the src/{glsl,compiler}/nir move - Flesh out to separate SConscript Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
| * nir: Use _snprintf on Windows.Jose Fonseca2016-04-141-0/+4
| | | | | | | | | | Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
| * nir: Avoid structure initalization expressions.Jose Fonseca2016-04-141-2/+16
| | | | | | | | | | | | | | | | | | | | | | Not supported by MSVC, and completely unnecessary -- inline functions work just as well. NIR_SRC_INIT/NIR_DEST_INIT could and probably should be replaced by the inline functions. Acked-by: Jason Ekstrand <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
| * nir: Remove unistd.h include.Jose Fonseca2016-04-141-1/+0
| | | | | | | | | | | | | | It doesn't seem needed, and is not available on MSVC. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
| * nir: Avoid empty {} struct initializer.Jose Fonseca2016-04-141-10/+10
| | | | | | | | | | | | | | | | | | Not supported by MSVC and consistent through NIR. [Emil Velikov: rebase] Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* | nir/opt_algebraic: Remove the encoding lineJason Ekstrand2016-04-141-1/+0
| | | | | | | | This is an unneeded diff between the vulkan and master branches
* | spirv: Move to compiler/Jason Ekstrand2016-04-1410-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.
* | nir: Remove some pointless delta between vulkan and masterJason Ekstrand2016-04-142-3/+0
| |
* | Merge remote-tracking branch 'public/master' into vulkanJason Ekstrand2016-04-1359-914/+893
|\|
| * nir/dead_variables: Configurably work with any variable modeJason Ekstrand2016-04-132-10/+25
| | | | | | | | | | | | | | The old version of the pass only worked on globals and locals and always left inputs, outputs, uniforms, etc. alone. Reviewed-by: Kenneth Graunke <[email protected]>
| * nir/algebraic: Add lowering for ldexpJason Ekstrand2016-04-131-0/+31
| | | | | | | | | | | | | | | | | | The algorithm used is different from both the naive suggestion from the GLSL spec and the one used in GLSL IR today. Unfortunately, the GLSL IR implementation that we have today doesn't handle denormals (for those that care) or the case where the float source is +-inf. Reviewed-by: Matt Turner <[email protected]>
| * nir: Add more modulus opcodesJason Ekstrand2016-04-132-1/+16
| | | | | | | | | | | | | | These are all needed for SPIR-V Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Matt Turner <[email protected]>
| * nir/lower_io: Allow for a full bitmask of modesJason Ekstrand2016-04-132-7/+7
| | | | | | | | | | | | Acked-by: Eric Anholt <[email protected]> Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
| * nir/lower_indirect: nir_variable_mode is now a bitfieldJason Ekstrand2016-04-132-7/+7
| | | | | | | | | | | | Acked-by: Eric Anholt <[email protected]> Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
| * nir: Convert nir_variable_mode to a bitfieldJason Ekstrand2016-04-132-17/+19
| | | | | | | | | | | | | | | | | | There are several passes where we need to specify some set of variable modes that the pass needs top operate on. This lets us easily do that. Acked-by: Eric Anholt <[email protected]> Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
| * glsl: Rename "vertex_input_slots" -> "is_vertex_input"Matt Turner2016-04-136-14/+14
| | | | | | | | | | | | | | | | | | | | | | vertex_input_slots would be an appropriate name for an integer, but not a bool. Also remove a cond ? true : false from a count_attribute_slots() call site, noticed during the rename. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
| * nir/clone: Copy bit size when cloning registersJason Ekstrand2016-04-121-0/+1
| | | | | | | | | | Reported-by: Mark Janes <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
| * glsl: Don't copy propagate or tree graft precise values.Kenneth Graunke2016-04-123-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is kind of a hack. We currently track precise requirements by decorating ir_variables. Propagating or grafting the RHS of an assignment to a precise value into some other expression tree can lose those decorations. In the long run, it might be better to replace these ir_variable decorations with an "exact" decoration on ir_expression nodes, similar to what NIR does. In the short run, this is probably good enough. It preserves enough information for glsl_to_nir to generate "exact" decorations, and NIR will then handle optimizing these expressions reasonably. Fixes ES31-CTS.gpu_shader5.precise_qualifier. v2: Drop invariant handling, as it shouldn't be necessary (caught by Jason Ekstrand). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
| * glsl/linker: Recurse on struct fields when adding shader variablesKristian Høgsberg Kristensen2016-04-121-6/+45
| | | | | | | | | | | | | | | | | | | | ARB_program_interface_query requires that we add struct fields recursively down to basic types. Fixes 52 struct test cases in dEQP-GLES31.functional.program_interface_query.* Signed-off-by: Kristian Høgsberg Kristensen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
| * glsl/linker: Pass name and type through to create_shader_variable()Kristian Høgsberg Kristensen2016-04-121-9/+12
| | | | | | | | | | | | | | | | No functional change here, but this now lets us recurse throught structs in add_shader_variable(). Signed-off-by: Kristian Høgsberg Kristensen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
| * glsl/linker: Pass absolute location to add_shader_variable()Kristian Høgsberg Kristensen2016-04-121-7/+10
| | | | | | | | | | | | | | | | | | This lets us pass in the absolution location of a variable instead of computing it in add_shader_variable() based on variable location and bias. This is in preparation for recursing into struct variables. Signed-off-by: Kristian Høgsberg Kristensen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
| * glsl/linker: Add add_shader_variable() helperKristian Høgsberg Kristensen2016-04-121-19/+23
| | | | | | | | | | | | | | | | | | | | This consolidates the combination of create_shader_variable() and add_program_resource() into a new helper function. No functional difference, but we'll expand add_shader_variable() in the next few commits. Signed-off-by: Kristian Høgsberg Kristensen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
| * glsl: Reject illegal qualifiers on atomic counter uniforms.Kenneth Graunke2016-04-121-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes dEQP-GLES31.functional.uniform_location.negative.atomic_fragment dEQP-GLES31.functional.uniform_location.negative.atomic_vertex Both of which have lines like layout(location = 3, binding = 0, offset = 0) uniform atomic_uint uni0; The ARB_explicit_uniform_location spec makes a very tangential mention regarding atomic counters, but location isn't something that makes sense with them. Signed-off-by: Ilia Mirkin <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
| * glsl: Add a method to print error messages for illegal qualifiers.Kenneth Graunke2016-04-122-0/+90
| | | | | | | | | | | | | | | | | | Suggested by Timothy Arceri a while back on mesa-dev: https://lists.freedesktop.org/archives/mesa-dev/2016-February/107735.html Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Acked-by: Matt Turner <[email protected]>
| * glsl: Update hash table comments in constant propagationRhys Kidd2016-04-121-3/+3
| | | | | | | | | | Signed-off-by: Rhys Kidd <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
| * nir: Fix typo in commentIan Romanick2016-04-111-1/+1
| | | | | | | | | | | | Trivial. Signed-off-by: Ian Romanick <[email protected]>
| * nir: Merge redudant integer clamping.Markus Wick2016-04-111-1/+4
| | | | | | | | | | | | | | | | | | Dolphin uses them a lot. Range tracking would be better in the long term, but this two lines works fine for now. Signed-off-by: Markus Wick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
| * nir: Silence unused "options" warning in algebraic passes.Kenneth Graunke2016-04-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | Some passes may not refer to options->..., at which point the compiler will warn about an unused variable. Just cast to void unconditionally to shut it up. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Matt Turner <[email protected]>
| * nir: Do basic constant reassociation.Kenneth Graunke2016-04-111-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many shaders contain expression trees of the form: const_1 * (value * const_2) Reorganizing these to (const_1 * const_2) * value will allow constant folding to combine the constants. Sometimes, these constants are 2 and 0.5, so we can remove a multiply altogether. Other times, it can create more immediate constants, which can actually hurt. Finding a good balance here is tricky. While much more could be done, this simple patch seems to have a lot of positive benefit while having a low downside. shader-db results on Broadwell: total instructions in shared programs: 8963768 -> 8961369 (-0.03%) instructions in affected programs: 438318 -> 435919 (-0.55%) helped: 1502 HURT: 245 total cycles in shared programs: 71527354 -> 71421516 (-0.15%) cycles in affected programs: 11541788 -> 11435950 (-0.92%) helped: 3445 HURT: 1224 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Matt Turner <[email protected]>
| * nir/lower_system_values: Add support for several computed valuesJason Ekstrand2016-04-112-3/+73
| | | | | | | | Reviewed-by: Rob Clark <[email protected]>
| * glsl/shader_enums: Add the other two compute builtinsJason Ekstrand2016-04-112-0/+4
| | | | | | | | | | | | | | | | These weren't added before because they are actually calculated values that are computed from other inputs. However, in order to handle them in nir_lower_system_values, it's nice for them to have a cannonical locaiton. Reviewed-by: Rob Clark <[email protected]>
| * glsl/shader_enums: Add an enum for Vulkan InstanceIndexJason Ekstrand2016-04-112-0/+8
| | | | | | | | | | | | | | In Vulkan, you have InstanceIndex which begins at the base instance value rather than the zero-based InstanceID of GL. Reviewed-by: Rob Clark <[email protected]>