3 # Copyright (c) 2014, 2016-2017, 2019-2020 Intel Corporation
4 # Copyright (c) 2019 Collabora Ltd
5 # Copyright © 2020 Valve Corporation.
7 # Permission is hereby granted, free of charge, to any person obtaining a
8 # copy of this software and associated documentation files (the "Software"),
9 # to deal in the Software without restriction, including without limitation
10 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 # and/or sell copies of the Software, and to permit persons to whom the
12 # Software is furnished to do so, subject to the following conditions:
14 # The above copyright notice and this permission notice shall be included
15 # in all copies or substantial portions of the Software.
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 # OTHER DEALINGS IN THE SOFTWARE.
25 # SPDX-License-Identifier: MIT
28 """ Module providing a RenderDoc dump backend for replayer """
32 from framework
import exceptions
34 from .abstract
import DumpBackend
, dump_handler
35 from .register
import Registry
43 class RenderDocBackend(DumpBackend
):
44 """ replayer's RenderDoc dump backend
46 This backend uses RenderDoc for replaying its traces.
49 _get_last_frame_call
= None # this silences the abstract-not-subclassed warning
51 def __init__(self
, trace_path
, output_dir
=None, calls
=None, **kwargs
):
52 super(RenderDocBackend
, self
).__init
__(trace_path
, output_dir
, calls
,
54 extension
= path
.splitext(self
._trace
_path
)[1]
56 if extension
!= '.rdc':
57 raise exceptions
.PiglitFatalError(
58 'Invalid trace_path: "{}" tried to be dumped '
59 'by the RenderDocBackend.\n'.format(self
._trace
_path
))
63 script_path
= path
.dirname(path
.abspath(__file__
))
64 cmd
= [path
.join(script_path
, 'renderdoc/renderdoc_dump_images.py'),
65 self
._trace
_path
, self
._output
_dir
]
66 cmd
.extend(self
._calls
)
67 self
._run
_logged
_command
(cmd
, None)
72 backend
=RenderDocBackend
,