[Mesa-dev] [PATCH 3/4] glapi/gen: remove old code for dispatch tree generation

Stefan Brüns stefan.bruens at rwth-aachen.de
Sun Mar 3 16:41:53 PST 2013


Signed-off-by: Stefan Brüns <stefan.bruens at rwth-aachen.de>
---
 src/mapi/glapi/gen/glX_server_table.py |   89 
+-------------------------------
 1 file changed, 2 insertions(+), 87 deletions(-)

diff --git a/src/mapi/glapi/gen/glX_server_table.py 
b/src/mapi/glapi/gen/glX_server_table.py
index cc78c48..589c47c 100644
--- a/src/mapi/glapi/gen/glX_server_table.py
+++ b/src/mapi/glapi/gen/glX_server_table.py
@@ -38,17 +38,6 @@ def log2(value):
     return -1
 
 
-def round_down_to_power_of_two(n):
-    """Returns the nearest power-of-two less than or equal to n."""
-
-    for i in range(30, 0, -1):
-        p = 1 << i
-        if p <= n:
-            return p
-
-    return -1
-
-
 class function_table:
     def __init__(self, name, do_size_check):
         self.name_base = name
@@ -56,7 +45,6 @@ class function_table:
 
 
         self.max_bits = 1
-        self.next_opcode_threshold = (1 << self.max_bits)
         self.max_opcode = 0
 
         self.functions = {}
@@ -76,13 +64,9 @@ class function_table:
         if opcode > self.max_opcode:
             self.max_opcode = opcode
 
-            if opcode > self.next_opcode_threshold:
-                bits = log2(opcode)
-                if (1 << bits) <= opcode:
-                    bits += 1
-
+            if opcode > (1 << self.max_bits):
+                bits = log2(opcode+1)
                 self.max_bits = bits
-                self.next_opcode_threshold = 1 << bits
         return
 
 
@@ -160,75 +144,6 @@ class function_table:
         return
 
 
-    def divide_group(self, min_opcode, total):
-        """Divide the group starting min_opcode into subgroups.
-        Returns a tuple containing the number of bits consumed by
-        the node, the list of the children's tuple, and the number
-        of entries in the final array used by this node and its
-        children, and the depth of the subtree rooted at the node."""
-
-        remaining_bits = self.max_bits - total
-        next_opcode = min_opcode + (1 << remaining_bits)
-        empty_children = 0
-
-        for M in range(0, remaining_bits):
-            op_count = 1 << (remaining_bits - M);
-            child_count = 1 << M;
-
-            empty_children = 0
-            full_children = 0
-            for i in range(min_opcode, next_opcode, op_count):
-                used = 0
-                empty = 0
-
-                for j in range(i, i + op_count):
-                    if self.functions.has_key(j):
-                        used += 1;
-                    else:
-                        empty += 1;
-
-
-                if empty == op_count:
-                    empty_children += 1
-
-                if used == op_count:
-                    full_children += 1
-
-            if (empty_children > 0) or (full_children == child_count) or 
(op_count <= self.min_op_count):
-                break
-
-
-        # If all the remaining bits are used by this node, as is the
-        # case when M is 0 or remaining_bits, the node is a leaf.
-
-        if (M == 0) or (M == remaining_bits):
-            return [remaining_bits, [], 0, 0]
-        else:
-            children = []
-            count = 1
-            depth = 1
-            all_children_are_nonempty_leaf_nodes = 1
-            for i in range(min_opcode, next_opcode, op_count):
-                n = self.divide_group(i, total + M)
-
-                if not (n[1] == [] and not self.is_empty_leaf(i, n[0])):
-                    all_children_are_nonempty_leaf_nodes = 0
-
-                children.append(n)
-                count += n[2] + 1
-
-                if n[3] >= depth:
-                    depth = n[3] + 1
-
-            # If all of the child nodes are non-empty leaf nodes, pull
-            # them up and make this node a leaf.
-
-            if all_children_are_nonempty_leaf_nodes:
-                return [remaining_bits, [], 0, 0]
-            else:
-                return [M, children, count, depth]
-
-
     def is_empty_leaf(self, base_opcode, M):
         for op in range(base_opcode, base_opcode + (1 << M)):
             if self.functions.has_key(op):
-- 
1.7.10.4



More information about the mesa-dev mailing list