mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-25 07:05:48 +00:00
Allow overriding replay options in test cases
This commit is contained in:
@@ -6,16 +6,20 @@ import renderdoc
|
||||
rd = renderdoc
|
||||
|
||||
|
||||
def open_capture(filename="", cap: rd.CaptureFile=None):
|
||||
def open_capture(filename="", cap: rd.CaptureFile=None, opts: rd.ReplayOptions=None):
|
||||
"""
|
||||
Opens a capture file and begins a replay.
|
||||
|
||||
:param filename: The filename to open, or empty if cap is used.
|
||||
:param cap: The capture file to use, or ``None`` if a filename is given.
|
||||
:param opts: The replay options to use, or ``None`` to use the default options.
|
||||
:return: A replay controller for the capture
|
||||
:rtype: renderdoc.ReplayController
|
||||
"""
|
||||
|
||||
if opts is None:
|
||||
opts = rd.ReplayOptions()
|
||||
|
||||
# Open a capture file handle
|
||||
own_cap = False
|
||||
api = "Unknown"
|
||||
@@ -40,7 +44,7 @@ def open_capture(filename="", cap: rd.CaptureFile=None):
|
||||
cap.Shutdown()
|
||||
raise RuntimeError("{} capture cannot be replayed".format(api))
|
||||
|
||||
status, controller = cap.OpenCapture(rd.ReplayOptions(), None)
|
||||
status, controller = cap.OpenCapture(opts, None)
|
||||
|
||||
if own_cap:
|
||||
cap.Shutdown()
|
||||
|
||||
@@ -168,6 +168,15 @@ class TestCase:
|
||||
else:
|
||||
raise TestFailureException('Assertion Failure: {}'.format(msg))
|
||||
|
||||
def get_replay_options(self):
|
||||
"""
|
||||
Method to overload if you want to override the replay options used.
|
||||
|
||||
:return: The renderdoc.ReplayOptions to use.
|
||||
"""
|
||||
|
||||
return rd.ReplayOptions()
|
||||
|
||||
def get_capture(self):
|
||||
"""
|
||||
Method to overload if not implementing a run(), using the default run which
|
||||
@@ -287,7 +296,7 @@ class TestCase:
|
||||
|
||||
log.print("Loading capture")
|
||||
|
||||
self.controller = analyse.open_capture(self.capture_filename)
|
||||
self.controller = analyse.open_capture(self.capture_filename, opts=self.get_replay_options())
|
||||
|
||||
log.print("Checking capture")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user