Sample code should take the capture to load as an argument

* This makes it easier to run the examples from the command line without editing
  them
This commit is contained in:
baldurk
2020-01-15 09:23:02 +00:00
parent adac442411
commit 7d22448d3f
5 changed files with 25 additions and 5 deletions
@@ -275,7 +275,11 @@ def loadCapture(filename):
if 'pyrenderdoc' in globals():
pyrenderdoc.Replay().BlockInvoke(sampleCode)
else:
cap,controller = loadCapture('test.rdc')
if len(sys.argv) <= 1:
print('Usage: python3 {} filename.rdc'.format(sys.argv[0]))
sys.exit(0)
cap,controller = loadCapture(sys.argv[1])
sampleCode(controller)
@@ -33,7 +33,11 @@ def loadCapture(filename):
if 'pyrenderdoc' in globals():
raise RuntimeError("This sample should not be run within the RenderDoc UI")
else:
cap,controller = loadCapture('test.rdc')
if len(sys.argv) <= 1:
print('Usage: python3 {} filename.rdc'.format(sys.argv[0]))
sys.exit(0)
cap,controller = loadCapture(sys.argv[1])
# Use tkinter to create windows
import tkinter
@@ -90,7 +90,11 @@ def loadCapture(filename):
if 'pyrenderdoc' in globals():
pyrenderdoc.Replay().BlockInvoke(sampleCode)
else:
cap,controller = loadCapture('test.rdc')
if len(sys.argv) <= 1:
print('Usage: python3 {} filename.rdc'.format(sys.argv[0]))
sys.exit(0)
cap,controller = loadCapture(sys.argv[1])
sampleCode(controller)
@@ -81,7 +81,11 @@ def loadCapture(filename):
if 'pyrenderdoc' in globals():
pyrenderdoc.Replay().BlockInvoke(sampleCode)
else:
cap,controller = loadCapture('test.rdc')
if len(sys.argv) <= 1:
print('Usage: python3 {} filename.rdc'.format(sys.argv[0]))
sys.exit(0)
cap,controller = loadCapture(sys.argv[1])
sampleCode(controller)
@@ -84,7 +84,11 @@ def loadCapture(filename):
if 'pyrenderdoc' in globals():
pyrenderdoc.Replay().BlockInvoke(sampleCode)
else:
cap,controller = loadCapture('test.rdc')
if len(sys.argv) <= 1:
print('Usage: python3 {} filename.rdc'.format(sys.argv[0]))
sys.exit(0)
cap,controller = loadCapture(sys.argv[1])
sampleCode(controller)