summaryrefslogtreecommitdiffstats
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* 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]>
* compiler: android: flesh out nir into separate makefileEmil Velikov2016-04-113-23/+51
| | | | | Signed-off-by: Emil Velikov <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* compiler: automake: flesh out NIR into separate makefile.Emil Velikov2016-04-112-70/+94
| | | | | | | | Analogous to previous commit - improved readability at the expense of an extra file. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* compiler: automake: split out glsl into separate makefileEmil Velikov2016-04-112-194/+218
| | | | | | | | | | | Preserve the functionality while keeping the files smaller and more readable. v2: Do not include Makefile.sources from the GLSL makefile (silences automake warnings) Signed-off-by: Emil Velikov <[email protected]> Acked-by: Jason Ekstrand <[email protected]> (v1)
* compiler: remove {glsl,nir}/Makefile.sourcesEmil Velikov2016-04-114-534/+1
| | | | | | | | | No longer used as of last commit. v2: Rebase. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Jason Ekstrand <[email protected]> (v1)
* glsl: move the android build scripts a level upEmil Velikov2016-04-113-7/+10
| | | | | | | Analogous to previous commit. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* glsl: move the scons build script a level upEmil Velikov2016-04-113-20/+20
| | | | | | | It will allow us to remove the duplicate glsl/Makefile.sources. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* nir: add a pass for lowering (un)pack_double_2x32Connor Abbott2016-04-115-0/+100
| | | | | | | | | | | | | | | | | | | 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 <[email protected]> Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add split versions of (un)pack_double_2x32Connor Abbott2016-04-111-0/+36
| | | | | | | | v2 (Sam): - Use uint64 instead of float64 for sources and destinations. (Connor) Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: don't try to scalarize unpack_double_2x32Connor Abbott2016-04-111-0/+3
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add support for (un)pack_double_2x32Connor Abbott2016-04-112-0/+35
| | | | | | | | v2 (Sam): - Use uint64 instead of float64 for sources and destinations. (Connor) Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add i2d and u2d opcodesIago Toral Quiroga2016-04-112-0/+10
| | | | | | | v2: - Assert supports_int and don't fallback to nir_fmov (Jason) Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add d2i, d2u, d2b opcodesIago Toral Quiroga2016-04-112-0/+6
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add support for d2f and f2dConnor Abbott2016-04-112-0/+5
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir/glsl_to_nir: set bit_size on ssbo_load resultIago Toral Quiroga2016-04-111-2/+3
| | | | | | | v2 (Sam): - Add missing bit_size assignment when ssbo_load destination is a boolean. Reviewed-by: Jason Ekstrand <[email protected]>
* nir/glsl_to_nir: add bit-size info to add_instr()Samuel Iglesias Gonsálvez2016-04-111-10/+14
| | | | | Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/split_var_copies: handle doublesConnor Abbott2016-04-111-0/+2
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir/instr_set: handle 64-bit bit-sizesConnor Abbott2016-04-111-5/+17
| | | | | | | v2: Revert spurious change in nir_opt_cse.c (Iago) Signed-off-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: handle doubles in nir_deref_get_const_initializer_load()Connor Abbott2016-04-111-1/+5
| | | | | | | | v2 (Sam): - Use proper bitsize value when calling to nir_load_const_instr_create() (Jason). Reviewed-by: Jason Ekstrand <[email protected]>
* nir/print: add support for printing doubles and bitsizeConnor Abbott2016-04-111-3/+16
| | | | | | | | | | | v2: - Squash the printing doubles related patches into one patch (Sam). v3: - Print using PRIx64 format: long is 32-bit on some 32-bit platforms but long long is basically always 64-bit (Jason). Reviewed-by: Jason Ekstrand <[email protected]>
* nir/glsl_to_nir: support doublesConnor Abbott2016-04-111-26/+38
| | | | | | | | v2: - Don't set sized types to the destination of texture related opcodes. (Jason) Reviewed-by: Jason Ekstrand <[email protected]>
* nir/lower_load_const_to_scalar: support doubles and multiple bit sizesIago Toral Quiroga2016-04-111-2/+6
| | | | | | | v2 (Sam): - Add assert to detect bitsizes differents than 32 and 64 (Jason). Reviewed-by: Jason Ekstrand <[email protected]>
* nir/lower_to_source_mods: Handle different bit sizesIago Toral Quiroga2016-04-111-2/+3
| | | | | | | v2 (Sam): - Use helper to get base type from nir_alu_type. Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add bit_size info to nir_load_const_instr_create()Samuel Iglesias Gonsálvez2016-04-119-15/+20
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir/lower_vec: adapt to different bit sizesConnor Abbott2016-04-111-0/+1
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir: add bit_size info to nir_ssa_undef_instr_create()Samuel Iglesias Gonsálvez2016-04-119-12/+20
| | | | | | | | v2: - Make the users to give the right bit_sizes as arguments (Jason). Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/locals_to_regs: adapt to different bit sizesConnor Abbott2016-04-111-0/+1
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir/from_ssa: adapt to different bit sizesConnor Abbott2016-04-111-0/+2
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Add a pass for gathering various bits of shader infoJason Ekstrand2016-04-104-0/+164
| | | | | Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Don't remove XFB-only varyings.Kenneth Graunke2016-04-101-1/+1
| | | | | | | | | | | | | | | | | Consider the case of linking a program with both a vertex and fragment shader. The VS may compute output varyings that are intended for transform feedback, and not read by the fragment shader. In this case, var->data.is_unmatched_generic_inout will be true, but we still cannot eliminate the varyings. We need to also check !var->data.is_xfb_only. Fixes failures in ES31-CTS.gpu_shader5.fma_precision_*, which happen to use transform feedback in a way we apparently hadn't seen before. Cc: [email protected] Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: allow usage of the keyword buffer before GLSL 430 / ESSL 310Ilia Mirkin2016-04-091-1/+1
| | | | | | | | | | The GLSL 4.20 and ESSL 3.00 specs don't list 'buffer' as a reserved keyword. Make the parser ignore it unless GLSL 4.30 / ESSL 3.10 are used, or ARB_shader_storage_buffer_objects is enabled. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Cc: [email protected]
* glsl: handle unsigned int wraparound in link_shaders()Lars Hamre2016-04-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | v2: change check_explicit_uniform_locations() to return an unsigned 0 (Timothy Arceri) We were storing the int result of check_explicit_uniform_locations() in num_explicit_uniform_locs as an unsigned int which caused it to be 4294967295 when a -1 was returned. This in turn would cause the following error during linking: error: count of uniform locations > MAX_UNIFORM_LOCATIONS(4294967295 > 98304) Results from running piglit tests/all with this patch and when ARB_explicit_uniform_location disabled: changes: 178 fixes: 176 regressions: 2 The two regressions are for the following tests: glean@glsl1-matrix column check (1) glean@glsl1-matrix column check (2) which regress from FAIL to CRASH. The regressions are acceptable because the tests are currently failing due to the aforementioned linker error. Signed-off-by: Lars Hamre <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* nir/types: Add a wrapper for count_attribute_slotsJason Ekstrand2016-04-072-0/+10
| | | | Reviewed-by: Rob Clark <[email protected]>
* glsl: use has_shader_storage_buffer_objects helperIlia Mirkin2016-04-051-2/+1
| | | | | | | | Replaces open-coded logic with existing helper. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl: remove remaining tabs in link_uniform_blocks.cppTimothy Arceri2016-04-061-5/+5
| | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* mesa: remove unused IsShaderStorage fieldTimothy Arceri2016-04-061-1/+0
| | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* glsl: fully split apart buffer block arraysTimothy Arceri2016-04-066-238/+251
| | | | | | | | | | | | With this change we create the UBO and SSBO arrays separately from the beginning rather than putting them into a combined array and splitting it apart later. A bug is with UBO and SSBO stage reference querying is also fixed as we now use the block index to lookup the references in the separate arrays not the combined buffer block array. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* nir: Use PRIi64 and PRIu64 instead of %ld and %lu.Kenneth Graunke2016-04-041-2/+3
| | | | | | | | | %ld and %lu aren't the right format specifiers for int64_t and uint64_t on 32-bit (x86) systems. They're %zu on Linux and %Iu on Windows. Use the standard C99 macros in hopes that they work everywhere. Signed-off-by: Kenneth Graunke <[email protected]>
* glsl: Lower variable indexing of system value arrays unconditionally.Kenneth Graunke2016-04-041-0/+20
| | | | | | | | | | | | | | | | | | | lower_variable_index_to_cond_assign() did not handle system values. gl_SampleMaskIn[] is a system value, and also an array. Accessing it with a variable index would trigger an unreachable() assert. Rather than adding a new EmitNoIndirectSystemValues flag, we simply lower unconditionally. There is exactly one case where this occurs, and for all current drivers, lowering produces optimal code. Even for future drivers with 32x MSAA, it produces reasonable code. Fixes Piglit's new samplemaskin-indirect test. Also fixes many ES31-CTS tests when OES_sample_variables is enabled. Cc: [email protected] Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]>