summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2008-11-20 01:02:03 +0900
committerJosé Fonseca <[email protected]>2008-11-20 01:02:03 +0900
commit59ae12b5b14a2bf18c4b566abcdf3211aa5eb4d6 (patch)
treee64be30218048f8bed3a233ae0191c0a08313d3d
parent2f153b5487459f04941bbbf35fd531adbf7535a2 (diff)
python/retrace: Dump constants.
-rwxr-xr-xsrc/gallium/state_trackers/python/retrace/interpreter.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py
index 1918fc9bdae..a7ae4c26259 100755
--- a/src/gallium/state_trackers/python/retrace/interpreter.py
+++ b/src/gallium/state_trackers/python/retrace/interpreter.py
@@ -28,6 +28,8 @@
import sys
+import struct
+
import gallium
import model
import parser
@@ -206,7 +208,8 @@ class Winsys(Object):
4,
gallium.PIPE_BUFFER_USAGE_CPU_READ |
gallium.PIPE_BUFFER_USAGE_CPU_WRITE )
- buffer.write(data, size)
+ assert size == len(data)
+ buffer.write(data)
return buffer
def buffer_create(self, alignment, usage, size):
@@ -216,7 +219,8 @@ class Winsys(Object):
pass
def buffer_write(self, buffer, data, size):
- buffer.write(data, size)
+ assert size == len(data)
+ buffer.write(data)
def fence_finish(self, fence, flags):
pass
@@ -369,6 +373,15 @@ class Context(Object):
if state is not None:
self.real.set_constant_buffer(shader, index, state.buffer)
+ if 1:
+ data = state.buffer.read()
+ format = '4f'
+ index = 0
+ for offset in range(0, len(data), struct.calcsize(format)):
+ x, y, z, w = struct.unpack_from(format, data, offset)
+ sys.stdout.write('\tCONST[%2u] = {%10.4f, %10.4f, %10.4f, %10.4f}\n' % (index, x, y, z, w))
+ index += 1
+
def set_framebuffer_state(self, state):
_state = gallium.Framebuffer()
_state.width = state.width