summaryrefslogtreecommitdiffstats
path: root/src/glsl/list.h
Commit message (Collapse)AuthorAgeFilesLines
* util: Fix foreach_list_typed_safe when exec_node is not at offset 0.Jason Ekstrand2015-03-121-2/+2
| | | | | | | | | | | | | | | | | | | | __next and __prev are pointers to the structure containing the exec_node link, not the embedded exec_node. NULL checks would fail unless the embedded exec_node happened to be at offset 0 in the parent struct. v2: Jason Ekstrand <[email protected]>: Use "(__node)->__field.next != NULL" to check for the end of the list instead of the "&__next->__field != NULL". The former is far more obviously correct as it matches what the non-safe versions do. The original code tried to avoid any use of __next as the client code may delete it during its execution. However, since the looping condition is checked after the iteration clause but before the client code is executed, we know that __node is valid during the looping condition. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Connor Abbott <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/list: Note that exec_lists may not be realloc'd.Matt Turner2015-02-031-0/+4
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add a foreach_in_list_reverse_safe macro.Matt Turner2015-01-231-0/+6
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/list: Add a foreach_list_typed_safe_reverse macroJason Ekstrand2015-01-151-0/+9
| | | | Reviewed-by: Connor Abbott <[email protected]>
* glsl/list: Fix the exec_list_validate functionJason Ekstrand2015-01-151-3/+1
| | | | | | | | | | Some time while refactoring things to make it look nicer before pushing to master, I completely broke the function. This fixes it to be correct. Just goes to show you why you souldn't push code that has no users yet... Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Connor Abbott <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* exec_list: add a list_foreach_typed_reverse() macroConnor Abbott2015-01-151-0/+6
| | | | Reviewed-by: Eric Anholt <[email protected]>
* glsl/list: Revert unintentional file mode change in previous commit.Vinson Lee2014-11-071-0/+0
| | | | Signed-off-by: Vinson Lee <[email protected]>
* glsl/list: Move declaration before code.Vinson Lee2014-11-071-1/+3
| | | | | | | | | | | | Fixes MSVC build error. shaderapi.c src\glsl\list.h(535) : error C2143: syntax error : missing ';' before 'type' src\glsl\list.h(535) : error C2143: syntax error : missing ')' before 'type' src\glsl\list.h(536) : error C2065: 'node' : undeclared identifier Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86025 Signed-off-by: Vinson Lee <[email protected]>
* glsl/list: Add an exec_list_validate functionJason Ekstrand2014-11-071-0/+19
| | | | | | | This can be very useful for trying to debug list corruptions. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* util: Move ralloc to a new src/util directory.Kenneth Graunke2014-08-041-1/+1
| | | | | | | | | | | | | | | | | | For a long time, we've wanted a place to put utility code which isn't directly tied to Mesa or Gallium internals. This patch creates a new src/util directory for exactly that purpose, and builds the contents as libmesautil.la. ralloc seemed like a good first candidate. These days, it's directly used by mesa/main, i965, i915, and r300g, so keeping it in src/glsl didn't make much sense. Signed-off-by: Kenneth Graunke <[email protected]> v2 (Jason Ekstrand): More realloc uses and some scons fixes Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* glsl: Don't declare variables in for-loop declaration.Matt Turner2014-07-151-2/+2
| | | | | Reported-by: Brian Paul <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* exec_list: Add a function to give the length of a list.Connor Abbott2014-07-151-0/+20
| | | | | | | | | v2 [mattst88]: Remove trailing whitespace. Rename get_size to length. Mark as const. Reviewed-by: Ian Romanick <[email protected]> [v1] Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Connor Abbott <[email protected]>
* exec_list: Add a prepend function.Connor Abbott2014-07-151-1/+19
| | | | | | | | | | This complements the existing append function. It's implemented in a rather simple way right now; it could be changed if performance is a concern. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Connor Abbott <[email protected]>
* glsl: Fix the foreach_in_list_reverse macro.Kenneth Graunke2014-07-081-3/+3
| | | | | | | | | | | We clearly don't want to start at the head and walk backwards; we want to start at the last real element before the tail sentinel. If the list is empty, tail_pred will be the head sentinel, and we'll stop. Nothing uses this function, so I guess nobody noticed it was broken. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Remove now unused foreach_list* macros.Matt Turner2014-07-011-24/+0
| | | | | | foreach_list_typed_const was never used as far as I can tell. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add and use foreach_list_typed_safe.Matt Turner2014-07-011-0/+9
| | | | Acked-by: Ian Romanick <[email protected]>
* mesa: Add and use foreach_in_list_use_after.Matt Turner2014-07-011-0/+5
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add typed foreach_in_list_safe macro.Matt Turner2014-07-011-0/+9
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add typed foreach_in_list/_reverse macros.Matt Turner2014-07-011-0/+10
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add an exec_node_init() function, usable from C.Matt Turner2014-06-101-0/+7
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Make foreach macros usable from C by adding struct keyword.Matt Turner2014-06-101-11/+11
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Make exec_list members just wrap the C API.Matt Turner2014-06-101-77/+13
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Make exec_node members just wrap the C API.Matt Turner2014-06-101-27/+11
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add C API for exec_list.Matt Turner2014-06-101-0/+141
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add C API for exec_node.Matt Turner2014-06-101-0/+82
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Move definition of exec_list member functions out of the struct.Matt Turner2014-06-101-108/+127
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Move definition of exec_node member functions out of the struct.Matt Turner2014-06-101-62/+83
| | | | Reviewed-by: Ian Romanick <[email protected]>
* glsl: Remove exec_list iterators now that nothing uses them.Kenneth Graunke2014-01-131-64/+0
| | | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Use a new foreach_two_lists macro for walking two lists at once.Kenneth Graunke2014-01-131-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When handling function calls, we often want to walk through the list of formal parameters and list of actual parameters at the same time. (Both are guaranteed to be the same length.) Previously, we used a pattern of: exec_list_iterator 1st_iter = <1st list>.iterator(); foreach_iter(exec_list_iterator, 2nd_iter, <2nd list>) { ... 1st_iter.next(); } This was awkward, since you had to manually iterate through one of the two lists. This patch introduces a foreach_two_lists macro which safely walks through two lists at the same time, so you can simply do: foreach_two_lists(1st_node, <1st list>, 2nd_node, <2nd list>) { ... } v2: Rename macro from foreach_list2 to foreach_two_lists, as suggested by Ian Romanick. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Use the new DECLARE_R[Z]ALLOC_CXX_OPERATORS in a bunch of places.Kenneth Graunke2013-09-211-36/+2
| | | | | | | | | This eliminates a lot of boilerplate and should be 100% equivalent. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* Convert everything from the talloc API to the ralloc API.Kenneth Graunke2011-01-311-16/+12
|
* exec_list: replace class with structBrian Paul2010-09-031-1/+1
| | | | To match the definition below.
* exec_node: Add insert_before that inserts an entire listIan Romanick2010-09-031-0/+23
|
* exec_list: Add pop_headIan Romanick2010-09-031-0/+17
|
* glsl2: Fix spelling of "sentinel."Eric Anholt2010-07-291-16/+16
|
* exec_list: Fix foreach_list_safe.Kenneth Graunke2010-07-191-11/+5
| | | | | | | | It now works correctly when nodes are removed, as it was originally intended to do; it no longer processes nodes added to the list before the current node, nor those added immediately after the current node. This matches the behavior of Linux's list_for_each_safe.
* exec_list: Add a new replace_with method.Kenneth Graunke2010-07-141-0/+11
|
* glsl2: Add foreach_list_safe which works even when mutating the list.Kenneth Graunke2010-07-091-0/+14
| | | | | | | | In particular, with foreach_list_safe, one can remove and free the current node without crashes; if new nodes are added after the current node, they will be properly visited as well. Signed-off-by: Ian Romanick <[email protected]>
* exec_list: Add method to append one complete list to anotherIan Romanick2010-07-071-0/+24
|
* glsl2: Move our data from a glsl_shader* on the side to the main gl_shader *.Eric Anholt2010-06-301-0/+19
| | | | | This saves recompiling at link time. gl_shader->ir is made a pointer so that we don't have to bring exec_list into mtypes.h.
* glsl2: Move the compiler to the subdirectory it will live in in Mesa.Eric Anholt2010-06-241-0/+403