baldurk / renderdoc

RenderDoc is a stand-alone graphics debugging tool.
https://renderdoc.org
MIT License
8.62k stars 1.3k forks source link

python API can't take a capture from local machine #3314

Closed limtexpe closed 1 month ago

limtexpe commented 1 month ago

Description

Thanks for your great work!!! I use this python script to capture frame from local machine, but the call to target.ReceiveMessage always returns TargetControlMessageType.Noop. I think there are two possible reasons for this issue:

  1. No data is available to receive.
  2. The received message type is ePacket_Noop.

However, since I'm using Python, it seems difficult for me to further verify why it keeps returning Noop. Besides, I noticed that issues #2440, #2741, and #2438 raised similar questions, but there don't seem to be any solutions provided.

Steps to reproduce

import renderdoc as rd

app = "D:\\my\\my.exe"
workingDir = "D:\\my"
cmdLine = ""
env = []
capturefile = ""
opts = rd.GetDefaultCaptureOptions()
waitForExit = False

result = rd.ExecuteAndInject(app, workingDir, cmdLine, env, capturefile, opts, waitForExit)
target = rd.CreateTargetControl('', result.ident, "test", True)
target.TriggerCapture(1) 

msg = None
while msg is None or msg.type != rd.TargetControlMessageType.NewCapture:
    msg = target.ReceiveMessage(None)
    print(msg.type)

Environment

baldurk commented 1 month ago

I'm sorry but realistically I can't give general help with writing scripts using the RenderDoc python API. This API is used for the nightly tests so it's known to be working, and running your script works for me, so the issue is most likely a bug in your script or expected behaviour of your program and is not in RenderDoc.

Unless you can show specific evidence that there's a bug in RenderDoc then you would need to debug your scripts yourself.

limtexpe commented 1 month ago

Oh my gosh! I know I shouldn't comment on a closed issue, but your mention of "running your script works for me" suddenly inspired me. In fact, the workingDir I used was not the same folder as the .exe file. That's the issue! Thank you so much!! It also works for me now~