From d26a43f6c6ba0e1958e3fafc99b5f110b6e3149a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 8 Dec 2008 17:26:02 +0900 Subject: python/retrace: Dump vertex buffer contents. --- .../state_trackers/python/retrace/interpreter.py | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src') 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): -- cgit v1.2.3 From 2ce2a40a732923461142d371548ba3243791422e Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 9 Dec 2008 19:35:52 +0900 Subject: gallium: Abort by default on windows user space. --- src/gallium/auxiliary/util/p_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/p_debug.c b/src/gallium/auxiliary/util/p_debug.c index 6ff3e6e0a62..125f3daf00b 100644 --- a/src/gallium/auxiliary/util/p_debug.c +++ b/src/gallium/auxiliary/util/p_debug.c @@ -329,7 +329,7 @@ void _debug_assert_fail(const char *expr, const char *function) { _debug_printf("%s:%u:%s: Assertion `%s' failed.\n", file, line, function, expr); -#if defined(PIPE_OS_WINDOWS) +#if defined(PIPE_OS_WINDOWS) && !defined(PIPE_SUBSYSTEM_WINDOWS_USER) if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", FALSE)) #else if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", TRUE)) -- cgit v1.2.3 From 51d9642f74c3f418b2f8a56b4b17c94eb91b39d1 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 9 Dec 2008 19:37:25 +0900 Subject: python/retrace: Dump indices too. --- .../state_trackers/python/retrace/interpreter.py | 45 +++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index 63ae54736b9..f418f80d7b4 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -435,15 +435,21 @@ class Context(Object): # FIXME pass - def draw_arrays(self, mode, start, count): + def dump_vertices(self, start, count): for index in range(start, start + count): + if index >= start + 16: + sys.stdout.write('\t...\n') + break 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_R32_FLOAT: 'f', + gallium.PIPE_FORMAT_R32G32_FLOAT: '2f', gallium.PIPE_FORMAT_R32G32B32_FLOAT: '3f', + gallium.PIPE_FORMAT_R32G32B32A32_FLOAT: '4f', gallium.PIPE_FORMAT_B8G8R8A8_UNORM: '4B', }[velem.src_format] @@ -452,13 +458,50 @@ class Context(Object): sys.stdout.write('\t\t{' + ', '.join(map(str, values)) + '},\n') assert len(values) == velem.nr_components sys.stdout.write('\t},\n') + + def dump_indices(self, ibuf, isize, start, count): + format = { + 1: 'B', + 2: 'H', + 4: 'I', + }[isize] + + assert struct.calcsize(format) == isize + + data = ibuf.read() + maxindex, minindex = 0, 0xffffffff + + sys.stdout.write('\t{\n') + for i in range(start, start + count): + if i >= start + 16: + sys.stdout.write('\t...\n') + break + offset = i*isize + index, = struct.unpack_from(format, data, offset) + sys.stdout.write('\t\t%u,\n' % index) + minindex = min(minindex, index) + maxindex = max(maxindex, index) + sys.stdout.write('\t},\n') + + return minindex, maxindex + + def draw_arrays(self, mode, start, count): + self.dump_vertices(start, count) self.real.draw_arrays(mode, start, count) def draw_elements(self, indexBuffer, indexSize, mode, start, count): + minindex, maxindex = self.dump_indices(indexBuffer, indexSize, start, count) + self.dump_vertices(minindex, maxindex - minindex) + self.real.draw_elements(indexBuffer, indexSize, mode, start, count) def draw_range_elements(self, indexBuffer, indexSize, minIndex, maxIndex, mode, start, count): + minindex, maxindex = self.dump_indices(indexBuffer, indexSize, start, count) + minindex = min(minindex, minIndex) + maxindex = min(maxindex, maxIndex) + self.dump_vertices(minindex, maxindex - minindex) + self.real.draw_range_elements(indexBuffer, indexSize, minIndex, maxIndex, mode, start, count) def flush(self, flags): -- cgit v1.2.3