Python接口
qrenderdoc.ExtensionManager.OpenFileName(caption, dir, filter)
qrenderdoc.ExtensionManager.OpenFileName(caption, dir)
qrenderdoc.ExtensionManager.OpenFileName(caption)
qrenderdoc.ExtensionManager.OpenFileName()
浏览要打开的文件名
参数:
-
caption(str):可选,对话框标题 -
dir(str):可选,浏览的起始目录 -
filter(str):可选,应用文件名的过滤器
return:str:选择的文件名,未选择则返回空字符
ctx: qrenderdoc.CaptureContext
open_file_name = ctx.Extensions().OpenFileName("请选择打开的文件")
renderdoc.OpenCaptureFile()
创建捕获文件的句柄
return:CaptureFile:指定路径的句柄
cap = renderdoc.OpenCaptureFile()
renderdoc.CaptureFile.OpenFile(filename,filetype,progress)
获取打开文件的状态
参数:
return:renderdoc.ReplayStatus:返回打开操作的状态
cap = renderdoc.OpenCaptureFile()
status = cap.OpenFile(filename,"",None)
if status != rd.ReplayStatus.Succeeded:
Raise RuntimeError("Couldn't open file: "+str(status))
renderdoc.CaptureFile.OpenCapture(opts,progress)
创建本地重播的句柄及打开状态
参数:
return:[ReplayStatus,ReplayController]:[返回打开操作的状态,成功的捕获句柄]
cap = renderdoc.OpenCaptureFile()
status,controller = cap.OpenCapture(rd.ReplayOptions(),None)
if status != rd.ReplayStatus.Succeeded:
Raise RuntimeError("Couldn't initialise replay: "+str(status))
renderdoc.ReplayController.GetRootActions()
获取捕获的操作列表
return:List[ActionDescription]:捕获的操作列表
actions = controller.GetRootActions()
renderdoc.ReplayController.GetResources()
获取资源列表
return:List[ResourceDescription]:捕获的资源列表
resources = controller.GetResources()
renderdoc.ReplayController.GetStructuredFile()
获取加载的捕获的结构化数据表示
return:SDFile:捕获的结构化文件
sdfile = controller.GetStructuredFile()
renderdoc.ReplayController.GetTextures()
获取捕获的纹理列表
return:List[TextureDescription]:捕获的纹理列表
textures = controller.GetTextures()
renderdoc.ReplayController.GetShader(pipeline, shader, entry)
获取捕获的shader信息
参数:
-
pipeline(ResourceId):着色器绑定的管道状态对象 -
shader(ResourceId):获取反射数据的着色器 -
entry(ShaderEntryPoint):着色器的反射入口点
return:ShaderReflection:shader反射信息
shaders = controller.GetShader(controller.GetPipelineState().GetGraphicsPipelineObject(),resource.resourceId,controller.GetShaderEntryPoints(resource.resourceId))
renderdoc.ReplayController.SaveTexTure(saveData,path)
保存捕获的纹理
参数:
return:bool:纹理的保存结果
texsave.mip = 0
texsave.slice.sliceIndex = 0
texsave.alpha = rd.AlphaMapping.Preserve
texsave.destType = rd.FileType.PNG
controller.SaveTexture(texsave, outTexPath)
renderdoc.ReplayController.GetPipelineState()
获取管道状态信息
return:PipeState:当前管道的状态
state = controller.GetPipelineState()
renderdoc.PepeState.GetGraphicsPipelineObject()
获取图形管道对象
return:ResourceId:指定管道的资源id
pipe = state.GetGraphicsPipelineObject()
renderdoc.ReplayController.FetchCounters(counters)
检索一组指定计数器的值
参数:
return:List[CounterResult]:一组计数器的值
results = controller.FetchCounters([rd.GPUCounter.EventGPUDuration])
for result in results:
for action in actions:
??If action.eventId == r.eventId:
????print("name {0},event time {1}".format(action.GetName(controller.GetStructuredFile()),result.value.d))
部分数据获取
results = controller.FetchCounters([rd.GPUCounter.EventGPUDuration])
# eventTime(微秒)
results.value.d actions = controller.GetRootActions()
# action name
action.GetName(controller.GetStructuredFile())
# action eventId
action.eventId
# action events非dc事件
action.events
# 顶点数 action.numIndices
sdfile = controller.GetStructuredFile()
chunk = sdfile.chunks[event.chunkIndex]
if chunk.type.basetype == rd.SDBasic.Chunk
#非dc下事件name
name = chunk.name
# 子资源数量
chunk.NumChildren()
# 通过索引获取孩子
child = chunk.GetChild(index)
# 引用的孩子的资源id
child.data.basic.id
# 纹理尺寸 textures = controller.GetTextures()
texture in textures
texture.height
texture.width
texture.format.Name()
texture.byteSize
# shader code
entry = controller.GetShaderEntryPoints(resource.resourceId)
e in entry shaders = controller.GetShader(pipe,resource.resourceId,e)
file in shaders.debugInfo.files
file.contents
|