Refactor public interface to be less strict C and more python friendly

* Generally this means removing ref out parameters and instead returning
  values. In a couple of cases we will want to avoid copies in future
  either by returning const references (e.g. to the pipeline state which
  is immutable).
* At the same time, some pointless bool return values that were always
  true and didn't indicate errors have been removed. They can be added
  again if an error condition comes back.
* Some free functions still have out parameters as C linkage doesn't
  allow returning user types by value.
* The C# UI still invokes into C wrappers for all the C++ classes, which
  handle taking the return value and doing a copy into an out parameter
  still for compatibility.
This commit is contained in:
baldurk
2017-04-07 11:04:26 +01:00
parent a1f2fdacbc
commit f6c045f473
27 changed files with 805 additions and 1001 deletions
+7 -10
View File
@@ -50,8 +50,7 @@ void DisplayRendererPreview(IReplayRenderer *renderer, uint32_t width, uint32_t
if(renderer == NULL)
return;
rdctype::array<TextureDescription> texs;
renderer->GetTextures(&texs);
rdctype::array<TextureDescription> texs = renderer->GetTextures();
TextureDisplay d;
d.mip = 0;
@@ -83,8 +82,7 @@ void DisplayRendererPreview(IReplayRenderer *renderer, uint32_t width, uint32_t
}
}
rdctype::array<DrawcallDescription> draws;
renderer->GetDrawcalls(&draws);
rdctype::array<DrawcallDescription> draws = renderer->GetDrawcalls();
if(draws.count > 0 && draws[draws.count - 1].flags & DrawFlags::Present)
{
@@ -324,7 +322,7 @@ struct CaptureCommand : public Command
uint32_t ident = RENDERDOC_ExecuteAndInject(
executable.c_str(), workingDir.empty() ? "" : workingDir.c_str(),
cmdLine.empty() ? "" : cmdLine.c_str(), NULL, logFile.empty() ? "" : logFile.c_str(), &opts,
cmdLine.empty() ? "" : cmdLine.c_str(), NULL, logFile.empty() ? "" : logFile.c_str(), opts,
parser.exist("wait-for-exit"));
if(ident == 0)
@@ -385,7 +383,7 @@ struct InjectCommand : public Command
std::cout << "Injecting into PID " << PID << std::endl;
uint32_t ident = RENDERDOC_InjectIntoProcess(PID, NULL, logFile.empty() ? "" : logFile.c_str(),
&opts, parser.exist("wait-for-exit"));
opts, parser.exist("wait-for-exit"));
if(ident == 0)
{
@@ -497,11 +495,10 @@ struct ReplayCommand : public Command
std::cerr << "Copying capture file to remote server" << std::endl;
float progress = 0.0f;
rdctype::str remotePath = remote->CopyCaptureToRemote(filename.c_str(), &progress);
rdctype::str remotePath = remote->CopyCaptureToRemote(filename.c_str(), NULL);
IReplayRenderer *renderer = NULL;
status = remote->OpenCapture(~0U, remotePath.elems, &progress, &renderer);
std::tie(status, renderer) = remote->OpenCapture(~0U, remotePath.elems, NULL);
if(status == ReplayStatus::Succeeded)
{
@@ -639,7 +636,7 @@ struct CapAltBitCommand : public Command
RENDERDOC_SetDebugLogFile(debuglog.c_str());
int ret = RENDERDOC_InjectIntoProcess(parser.get<uint32_t>("pid"), env,
parser.get<string>("log").c_str(), &cmdopts, false);
parser.get<string>("log").c_str(), cmdopts, false);
RENDERDOC_FreeEnvironmentModificationList(env);