trace: Fix parsing of recent traces.
authorJose Fonseca <jfonseca@vmware.com>
Thu, 24 May 2018 15:51:38 +0000 (16:51 +0100)
committerJose Fonseca <jfonseca@vmware.com>
Mon, 4 Jun 2018 20:06:31 +0000 (21:06 +0100)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/tools/trace/dump_state.py

index 4531843279e3f142d842a8d881ae507d06c7e97c..2622d130bf84efbcd49620b4410abe98aca2c05f 100755 (executable)
@@ -137,6 +137,7 @@ class Translator(model.Visitor):
     def visit_struct(self, node):
         struct = Struct()
         for member_name, member_node in node.members:
+            member_name = member_name.replace('.', '_')
             member_value = self.visit(member_node)
             setattr(struct, member_name, member_value)
         self.result = struct
@@ -185,7 +186,7 @@ class Screen(Dispatcher):
     def destroy(self):
         pass
 
-    def context_create(self):
+    def context_create(self, priv=None, flags=0):
         return Context(self.interpreter)
     
     def is_format_supported(self, format, target, sample_count, bind, geom_flags):
@@ -498,10 +499,11 @@ class Context(Dispatcher):
             vertex = []
             for velem in self._state.vertex_elements:
                 vbuf = self._state.vertex_buffers[velem.vertex_buffer_index]
-                if vbuf.buffer is None:
+                resource = vbuf.buffer_resource
+                if resource is None:
                     continue
 
-                data = vbuf.buffer.data
+                data = resource.data
 
                 offset = vbuf.buffer_offset + velem.src_offset + vbuf.stride*index
                 format = {
@@ -523,7 +525,7 @@ class Context(Dispatcher):
                     'PIPE_FORMAT_R16G16B16_SNORM': '3h',
                 }[velem.src_format]
 
-                data = vbuf.buffer.data
+                data = resource.data
                 attribute = unpack_from(format, data, offset)
                 vertex.append(attribute)
 
@@ -551,7 +553,7 @@ class Context(Dispatcher):
 
         self._state.draw = info
 
-        if info.indexed:
+        if info.index_size != 0:
             min_index, max_index = self._merge_indices(info)
         else:
             min_index = info.start
@@ -637,6 +639,25 @@ class Context(Dispatcher):
     def tex_transfer_destroy(self, transfer):
         self.interpreter.unregister_object(transfer)
 
+    def buffer_subdata(self, resource, usage, data, box=None, offset=None, size=None, level=None, stride=None, layer_stride=None):
+        if box is not None:
+            # XXX trace_context_transfer_unmap generates brokens buffer_subdata
+            assert offset is None
+            assert size is None
+            assert level == 0
+            offset = box.x
+            size = box.width
+            box = None
+
+        if resource is not None and resource.target == PIPE_BUFFER:
+            data = data.getValue()
+            assert len(data) >= size
+            assert offset + size <= len(resource.data)
+            resource.data[offset : offset + size] = data[:size]
+
+    def texture_subdata(self, resource, level, usage, box, data, stride, layer_stride):
+        pass
+
     def transfer_inline_write(self, resource, level, usage, box, stride, layer_stride, data):
         if resource is not None and resource.target == PIPE_BUFFER:
             data = data.getValue()