From 7d22448d3f9a3097ab44502549ebfa9800f2e0bd Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 15 Jan 2020 09:23:02 +0000 Subject: [PATCH] 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 --- docs/python_api/examples/renderdoc/decode_mesh.py | 6 +++++- docs/python_api/examples/renderdoc/display_window.py | 6 +++++- docs/python_api/examples/renderdoc/fetch_counters.py | 6 +++++- docs/python_api/examples/renderdoc/fetch_shader.py | 6 +++++- docs/python_api/examples/renderdoc/iter_draws.py | 6 +++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/docs/python_api/examples/renderdoc/decode_mesh.py b/docs/python_api/examples/renderdoc/decode_mesh.py index 54d77fc52..82dc6362a 100644 --- a/docs/python_api/examples/renderdoc/decode_mesh.py +++ b/docs/python_api/examples/renderdoc/decode_mesh.py @@ -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) diff --git a/docs/python_api/examples/renderdoc/display_window.py b/docs/python_api/examples/renderdoc/display_window.py index 46a183fcc..de3d108d2 100644 --- a/docs/python_api/examples/renderdoc/display_window.py +++ b/docs/python_api/examples/renderdoc/display_window.py @@ -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 diff --git a/docs/python_api/examples/renderdoc/fetch_counters.py b/docs/python_api/examples/renderdoc/fetch_counters.py index f1511e26f..f16a032f1 100644 --- a/docs/python_api/examples/renderdoc/fetch_counters.py +++ b/docs/python_api/examples/renderdoc/fetch_counters.py @@ -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) diff --git a/docs/python_api/examples/renderdoc/fetch_shader.py b/docs/python_api/examples/renderdoc/fetch_shader.py index a783ef290..1593ba8dd 100644 --- a/docs/python_api/examples/renderdoc/fetch_shader.py +++ b/docs/python_api/examples/renderdoc/fetch_shader.py @@ -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) diff --git a/docs/python_api/examples/renderdoc/iter_draws.py b/docs/python_api/examples/renderdoc/iter_draws.py index a97c476ef..28ce6002c 100644 --- a/docs/python_api/examples/renderdoc/iter_draws.py +++ b/docs/python_api/examples/renderdoc/iter_draws.py @@ -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)