summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: add a parse check to check for the index layout qualifierRyan Houdek2015-11-191-0/+5
| | | | | | | This can only be used if EXT_blend_func_extended is enabled Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: add GL_EXT_blend_func_extended preprocessor defineRyan Houdek2015-11-191-0/+2
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: add support for EXT_blend_func_extended builtinsRyan Houdek2015-11-192-0/+92
| | | | | | | | | | | gl_MaxDualSourceDrawBuffersEXT - Maximum dual-source draw buffers supported For ESSL 1.0, it provides two builtins since you can't have user-defined color output variables: gl_SecondaryFragColorEXT gl_SecondaryFragDataEXT[MaxDSDrawBuffers] Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: add EXT_blend_func_extended parser enablesRyan Houdek2015-11-192-0/+8
| | | | | | | | | This adds a state for the maximum dual source draw variables available and the variable for determining if the extension has been enabled in the program shaders. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: fix ir_constant::equals() for doublesConnor Abbott2015-11-191-2/+7
| | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* glsl: fix isinf() for doublesConnor Abbott2015-11-191-1/+10
| | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* nir: fix constant folding of bfiConnor Abbott2015-11-191-2/+2
| | | | Reviewed-by: Edward O'Callaghan <[email protected]>
* glsl: Fix off-by-one error in array size check assertionIan Romanick2015-11-181-2/+1
| | | | | | | | | | Apparently, this has been a bug since 2010 (c30f6e5d). Also use ARRAY_SIZE instead of open coding it. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: [email protected]
* glsl: Silence unused parameter warningsIan Romanick2015-11-181-2/+2
| | | | | | | | | | | | builtin_functions.cpp:5289:52: warning: unused parameter 'num_arguments' [-Wunused-parameter] unsigned num_arguments, ^ builtin_functions.cpp:5290:52: warning: unused parameter 'flags' [-Wunused-parameter] unsigned flags) ^ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: Silence ignored qualifier warningIan Romanick2015-11-181-1/+1
| | | | | | | | | | | | | I think the intention was to mark the "this" parameter as const, but const goes on the other end to do that. In file included from glsl_symbol_table.cpp:26:0: ast.h:339:35: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] const bool is_single_dimension() ^ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* nir: Add support for cloning shadersJason Ekstrand2015-11-184-0/+682
| | | | | | | | This commit is heavily based on one by Rob Clark <[email protected]> but reworked to re-use nir_create functions and do less hashing. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* i965/nir: Validate that NIR passes call nir_metadata_preserve().Kenneth Graunke2015-11-182-0/+41
| | | | | | | | | | | | | | | | | | | | | Failing to call nir_metadata_preserve() can have nasty consequences: some pass breaks dominance information, but leaves it marked as valid, causing some subsequent pass to go haywire and probably crash. This pass adds a simple validation mechanism to ensure passes handle this properly. We add a new bogus metadata flag that isn't used for anything in particular, set it before each pass, and ensure it *isn't* still set after the pass. nir_metadata_preserve will reset the flag, so correct passes will work, and bad passes will assert fail. (I would have made these functions static inline, but nir.h is included in C++, so we can't bit-or enums without lots of casting...) Thanks to Dylan Baker for the idea. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* nir: add array length fieldRob Clark2015-11-182-0/+10
| | | | | | | | This will simplify things somewhat in clone. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* nir: remove nir_variable::max_ifc_array_accessRob Clark2015-11-182-22/+0
| | | | | | | | No users. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* nir: fix typo in idiv lowering, causing large-udiv-udiv failuresIlia Mirkin2015-11-181-1/+1
| | | | | | | | | | | | | In nv50, and in the python script that Rob circulated, we do: bld.mkCmp(OP_SET, CC_GE, TYPE_U32, (s = bld.getSSA()), TYPE_U32, m, b); Do the same in the nir div lowering pass. This fixes the large-udiv-udiv piglit tests on freedreno. Signed-off-by: Ilia Mirkin <[email protected]> Cc: [email protected] Signed-off-by: Rob Clark <[email protected]>
* nir: Store the size of the TCS output patch in nir_shader_info.Kenneth Graunke2015-11-182-0/+9
| | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: rename location layout helperTimothy Arceri2015-11-181-5/+5
| | | | | | | Change name from validate -> apply to more accurately describe what the function does. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* glsl: don't validate binding when its not neededTimothy Arceri2015-11-181-2/+5
| | | | | | | | | | | Checking that the flag has been set is all the validation thats needed here. Also not calling the binding validation function will make things much simpler when adding compile time constant support as we won't need to resolve the binding value. Reviewed-by: Emil Velikov <[email protected]>
* glsl: remove temp variable to make code easier to readTimothy Arceri2015-11-181-10/+7
| | | | Reviewed-by: Emil Velikov <[email protected]>
* glsl: cleanup and fix validate matrix function for arraysTimothy Arceri2015-11-181-10/+1
| | | | | | | | | Previously if the member was an array of matrices then a warning message would be incorrectly given. Also the struct case could never be met so it has been removed. Reviewed-by: Emil Velikov <[email protected]>
* glsl: use better location in struct and block error messagesTimothy Arceri2015-11-181-7/+3
| | | | | | | | Previously we only gave the location for some members and never gave the variable location. In those cases we were just giving the location of the struct/block. Reviewed-by: Emil Velikov <[email protected]>
* glsl: only do type and qualifier validation once per declarationTimothy Arceri2015-11-181-99/+97
| | | | | | | | | | | | | | | For struct and block members previously we were doing it for every variable declaration. So for example struct S { atomic_uint x, y, z; }; Would previously generate three error messages when one is sufficient. Reviewed-by: Emil Velikov <[email protected]>
* glsl: rename function that processes struct and iface membersTimothy Arceri2015-11-181-30/+30
| | | | | | | As of the previous commit this function handles only struct/iface members. Reviewed-by: Emil Velikov <[email protected]>
* glsl: move block validation outside function that validates membersTimothy Arceri2015-11-181-8/+8
| | | | Reviewed-by: Emil Velikov <[email protected]>
* glsl: move ast layout qualifier handling code into its own functionTimothy Arceri2015-11-181-202/+212
| | | | | | | | | We now also only apply these rules to variables rather than also trying to apply them to function params. V2: move code for handling stream layout qualifier Reviewed-by: Emil Velikov <[email protected]>
* glsl: copy each field's precision information in glsl_types's structure ↵Samuel Iglesias Gonsálvez2015-11-171-0/+1
| | | | | | | constructor Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: copy each field's precision information from the old gl_PerVertex ↵Samuel Iglesias Gonsálvez2015-11-171-0/+2
| | | | | | | interface block Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: copy each field's precision information when generating varying variablesSamuel Iglesias Gonsálvez2015-11-171-0/+1
| | | | | Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: initialize data.precision value in ir_variable constructorSamuel Iglesias Gonsálvez2015-11-171-0/+1
| | | | | Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl/nir: initialize precision field in glsl_struct_field constructorSamuel Iglesias Gonsálvez2015-11-171-1/+2
| | | | | Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* nir: reduce memory footprint of glsl_struct_field's precisionSamuel Iglesias Gonsálvez2015-11-171-1/+1
| | | | | Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: initialize precision when adding per vertex record fieldsTapani Pälli2015-11-171-0/+1
| | | | | | | | | Fixes issues with tessellation builtin variables since precision was introduced to IR with commit f84bc57d7dc02fceb805803131426c791eadeff9. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/glsl: Fix copy-n-paste mistakes from commit 213f864.Matt Turner2015-11-161-3/+3
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/glsl_to_nir: use _mesa_fls() to compute num_texturesJuan A. Suarez Romero2015-11-161-7/+2
| | | | | | | | | | | | | Replace the current loop by a direct call to _mesa_fls() function. It also fixes an implicit bug in the current code where num_textures seems to be one value less than it should be when sh->Program->SamplersUsed > 0. For instance, num_textures is 0 instead of 1 when sh->Program->SamplersUsed is 1. Signed-off-by: Juan A. Suarez Romero <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* nir/copy_propagate: do not copy-propagate MOV srcs with source modifiersIago Toral Quiroga2015-11-161-1/+6
| | | | | | | | | | | | | If a source operand in a MOV has source modifiers, then we cannot copy-propagate it from the parent instruction and remove the MOV. v2: remove the check for source modifiers from is_move() (Jason) v3: Put the check for source modifiers back into is_move() since this function is called from copy_prop_alu_src(). Add source modifiers checks to is_vec() instead. Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Silence GCC maybe-uninitialized warnings.Vinson Lee2015-11-131-0/+3
| | | | | | | | | | | | | nir/nir_control_flow.c: In function ‘split_block_cursor.isra.11’: nir/nir_control_flow.c:460:15: warning: ‘after’ may be used uninitialized in this function [-Wmaybe-uninitialized] *_after = after; ^ nir/nir_control_flow.c:458:16: warning: ‘before’ may be used uninitialized in this function [-Wmaybe-uninitialized] *_before = before; ^ Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* glsl: Allow implicit int -> uint conversions for the % operator.Kenneth Graunke2015-11-131-9/+28
| | | | | | | | | | | | | | | | | GLSL 4.00 and GL_ARB_gpu_shader5 introduced a new int -> uint implicit conversion rule and updated the rules for modulus to use them. (In earlier languages, none of the implicit conversion rules did anything relevant, so there was no point in applying them.) This allows expressions such as: int foo; uint bar; uint mod = foo % bar; Cc: [email protected] Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* nir: Add helpers for getting input/output intrinsic sources.Kenneth Graunke2015-11-132-0/+45
| | | | | | | | | | With the many variants of IO intrinsics, particular sources are often in different locations. It's convenient to say "give me the indirect offset" or "give me the vertex index" and have it just work, without having to think about exactly which kind of intrinsic you have. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Don't lower TCS outputs to temporaries.Kenneth Graunke2015-11-131-0/+3
| | | | | | | | We'd like to shadow these when possible, but the current code doesn't work properly for TCS outputs. For now, disable it. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Allow outputs reads and add the relevant intrinsics.Kenneth Graunke2015-11-134-8/+21
| | | | | | | | | | | | | | | | | | | | | | | | | Normally, we rely on nir_lower_outputs_to_temporaries to create shadow variables for outputs, buffering the results and writing them all out at the end of the program. However, this is infeasible for tessellation control shader outputs. Tessellation control shaders can generate multiple output vertices, and write per-vertex outputs. These are arrays indexed by the vertex number; each thread only writes one element, but can read any other element - including those being concurrently written by other threads. The barrier() intrinsic synchronizes between threads. Even if we tried to shadow every output element (which is of dubious value), we'd have to read updated values in at barrier() time, which means we need to allow output reads. Most stages should continue using nir_lower_outputs_to_temporaries(), but in theory drivers could choose not to if they really wanted. v2: Rebase to accomodate Jason's review feedback. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/lower_io: Introduce nir_store_per_vertex_output intrinsics.Kenneth Graunke2015-11-133-5/+26
| | | | | | | | | | | Similar to nir_load_per_vertex_input, but for outputs. This is not useful in geometry shaders, but will be useful in tessellation shaders. v2: Change stage_uses_per_vertex_outputs() to is_per_vertex_output(), taking a nir_variable (requested by Jason Ekstrand). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/lower_io: Use load_per_vertex_input intrinsics for TCS and TES.Kenneth Graunke2015-11-131-4/+8
| | | | | | | | | | | | | | | | Tessellation control shader inputs are an array indexed by the vertex number, like geometry shader inputs. There aren't per-patch TCS inputs. Tessellation evaluation shaders have both per-vertex and per-patch inputs. Per-vertex inputs get the new intrinsics; per-patch inputs continue to use the ordinary load_input intrinsics, as they already work like we want them to. v2: Change stage_uses_per_vertex_inputs into is_per_vertex_input(), which takes a variable (requested by Jason Ekstrand). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* Revert "nir/copy_propagate: do not copy-propagate MOV srcs with source ↵Iago Toral Quiroga2015-11-131-10/+7
| | | | | | | | | | modifiers" The change proposed in the review leads to piglit regressions because is_move() is used in other places and relies on the checks for source modifiers to be there. Revert this until we agree on a better solution.
* glsl: fix 'shared' layout qualifier related regressionsSamuel Iglesias Gonsálvez2015-11-131-0/+5
| | | | | | | | | | | | | | | | Commit 8b28b35 added 'shared' as a keyword for compute shaders but it broke the existing 'shared' layout qualifier support for uniform and shader storage blocks. This patch fixes 578 dEQP-GLES31.functional.ssbo.* tests. v2: - Move SHARED to interface_block_layout_qualifier (Timothy) - Don't remove "shared" case insensitive check (Timothy) - Remove the clearing of shared_storage flag (Timothy) Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* nir/copy_propagate: do not copy-propagate MOV srcs with source modifiersIago Toral Quiroga2015-11-131-7/+10
| | | | | | | | | If a source operand in a MOV has source modifiers, then we cannot copy-propagate it from the parent instruction and remove the MOV. v2: remove the check for source source modifiers from is_move() (Jason) Reviewed-by: Jason Ekstrand <[email protected]>
* nir/vars_to_ssa: Delete dead output set codeJason Ekstrand2015-11-121-7/+0
| | | | | | | | This was a remnant of an early attempt to handle output reads in vars_to_ssa. That attempt was abandon a long time ago but these few lines were aparently left in the pass and managed to evade review. Reviewed-by: Connor Abbott <[email protected]>
* nir/vars_to_ssa: Rework copy set handling in lower_copies_to_load_storeJason Ekstrand2015-11-121-1/+4
| | | | | | | | | | | | | | | | | | | | | Previously, we walked through a given deref_node's copies and, after lowering the copy away, removed it from both the source and destination copy sets. This commit changes this to only remove it from the other node's copy set (not the one we're lowering). At the end of the loop, we just throw away the copy set for the node we're lowering since that node no longer has any copies. This has two advantages: 1) It's more efficient because we're doing potentially half as many set search operations. 2) It now properly handles copies from a node to itself. Perviously, it would delete the copy from the set when processing the destinatioon and then assert-fail when we couldn't find it for the source. Cc: "11.0" <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92588 Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir/validate: Allow subroutine types for the tails of derefsJason Ekstrand2015-11-121-2/+6
| | | | | | | | | | The shader-subroutine code creates uniforms of type SUBROUTINE for subroutines that are then read as integers in the backends. If we ever want to do any optimizations on these, we'll need to come up with a better plan where they are actual scalars or something, but this works for now. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92859 Reviewed-by: Connor Abbott <[email protected]>
* mesa: Replace gl_extensions::EXT_texture3D with ::dummy_trueNanley Chery2015-11-122-2/+1
| | | | | | | | | | Mesa unconditionally sets this driver flag to true in _mesa_init_extensions(). There is therefore no need for the driver to communicate support for this extension. Replace the driver capability flag with ::dummy_true. Signed-off-by: Nanley Chery <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* glsl: add gl_HelperInvocation system valueIlia Mirkin2015-11-122-0/+4
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Matt Turner <[email protected]>