diff options
author | José Fonseca <[email protected]> | 2008-12-08 17:26:02 +0900 |
---|---|---|
committer | José Fonseca <[email protected]> | 2008-12-08 17:26:02 +0900 |
commit | d26a43f6c6ba0e1958e3fafc99b5f110b6e3149a (patch) | |
tree | 5269e3b5e8e7f59d78bd8a9dc252fba7e789e625 /src/gallium/state_trackers/python | |
parent | 129c6ed67807db5d1d5ec4bc09bcc32bc5a329d4 (diff) |
python/retrace: Dump vertex buffer contents.
Diffstat (limited to 'src/gallium/state_trackers/python')
-rwxr-xr-x | src/gallium/state_trackers/python/retrace/interpreter.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index a7ae4c26259..63ae54736b9 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -240,6 +240,9 @@ class Winsys(Object): class Screen(Object): + def destroy(self): + pass + def get_name(self): pass @@ -292,6 +295,8 @@ class Context(Object): Object.__init__(self, interpreter, real) self.cbufs = [] self.zsbuf = None + self.vbufs = [] + self.velems = [] def destroy(self): pass @@ -409,6 +414,7 @@ class Context(Object): self.real.set_sampler_texture(i, textures[i]) def set_vertex_buffers(self, n, vbufs): + self.vbufs = vbufs[0:n] for i in range(n): vbuf = vbufs[i] self.real.set_vertex_buffer( @@ -420,6 +426,7 @@ class Context(Object): ) def set_vertex_elements(self, n, elements): + self.velems = elements[0:n] for i in range(n): self.real.set_vertex_element(i, elements[i]) self.real.set_vertex_elements(n) @@ -429,6 +436,23 @@ class Context(Object): pass def draw_arrays(self, mode, start, count): + for index in range(start, start + count): + sys.stdout.write('\t{\n') + for velem in self.velems: + vbuf = self.vbufs[velem.vertex_buffer_index] + + offset = vbuf.buffer_offset + velem.src_offset + vbuf.pitch*index + format = { + gallium.PIPE_FORMAT_R32G32B32_FLOAT: '3f', + gallium.PIPE_FORMAT_B8G8R8A8_UNORM: '4B', + }[velem.src_format] + + data = vbuf.buffer.read() + values = struct.unpack_from(format, data, offset) + sys.stdout.write('\t\t{' + ', '.join(map(str, values)) + '},\n') + assert len(values) == velem.nr_components + sys.stdout.write('\t},\n') + self.real.draw_arrays(mode, start, count) def draw_elements(self, indexBuffer, indexSize, mode, start, count): |