diff options
author | Alan Hourihane <[email protected]> | 2008-12-09 16:17:45 +0000 |
---|---|---|
committer | Alan Hourihane <[email protected]> | 2008-12-09 16:17:45 +0000 |
commit | ee0735fa2d4b2d2a9eae1f55e8f93f1f57feaf6d (patch) | |
tree | 1eb05270973ea3a5c396f3175d1500b5297176ef /src | |
parent | e8a1b31ddf39f0b09eb85653cebb9808a5daf0a9 (diff) | |
parent | 51d9642f74c3f418b2f8a56b4b17c94eb91b39d1 (diff) |
Merge commit 'origin/gallium-0.1' into gallium-0.2
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/util/p_debug.c | 2 | ||||
-rwxr-xr-x | src/gallium/state_trackers/python/retrace/interpreter.py | 67 |
2 files changed, 68 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/p_debug.c b/src/gallium/auxiliary/util/p_debug.c index 0d019808b09..210332f87a5 100644 --- a/src/gallium/auxiliary/util/p_debug.c +++ b/src/gallium/auxiliary/util/p_debug.c @@ -376,7 +376,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)) diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index a7ae4c26259..f418f80d7b4 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) @@ -428,13 +435,73 @@ class Context(Object): # FIXME pass + 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] + + 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') + + 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): |