(controller)
| 21 | iterDraw(d, indent + ' ') |
| 22 | |
| 23 | def sampleCode(controller): |
| 24 | # Iterate over all of the root actions, so we have names for each |
| 25 | # eventId |
| 26 | for d in controller.GetRootActions(): |
| 27 | iterDraw(d) |
| 28 | |
| 29 | # Enumerate the available counters |
| 30 | counters = controller.EnumerateCounters() |
| 31 | |
| 32 | if not (rd.GPUCounter.SamplesPassed in counters): |
| 33 | raise RuntimeError("Implementation doesn't support Samples Passed counter") |
| 34 | |
| 35 | # Now we fetch the counter data, this is a good time to batch requests of as many |
| 36 | # counters as possible, the implementation handles any book keeping. |
| 37 | results = controller.FetchCounters([rd.GPUCounter.SamplesPassed]) |
| 38 | |
| 39 | # Get the description for the counter we want |
| 40 | samplesPassedDesc = controller.DescribeCounter(rd.GPUCounter.SamplesPassed) |
| 41 | |
| 42 | # Describe each counter |
| 43 | for c in counters: |
| 44 | desc = controller.DescribeCounter(c) |
| 45 | |
| 46 | print("Counter %d (%s):" % (c, desc.name)) |
| 47 | print(" %s" % desc.description) |
| 48 | print(" Returns %d byte %s, representing %s" % (desc.resultByteWidth, desc.resultType, desc.unit)) |
| 49 | |
| 50 | # Look in the results for any draws with 0 samples written - this is an indication |
| 51 | # that if a lot of draws appear then culling could be better. |
| 52 | for r in results: |
| 53 | draw = actions[r.eventId] |
| 54 | |
| 55 | # Only care about draws, not about clears and other misc events |
| 56 | if not (draw.flags & rd.ActionFlags.Drawcall): |
| 57 | continue |
| 58 | |
| 59 | if samplesPassedDesc.resultByteWidth == 4: |
| 60 | val = r.value.u32 |
| 61 | else: |
| 62 | val = r.value.u64 |
| 63 | |
| 64 | if val == 0: |
| 65 | print("EID %d '%s' had no samples pass depth/stencil test!" % (r.eventId, draw.GetName(controller.GetStructuredFile()))) |
| 66 | |
| 67 | def loadCapture(filename): |
| 68 | # Open a capture file handle |
no test coverage detected