diff --git a/qrenderdoc/Code/CaptureContext.cpp b/qrenderdoc/Code/CaptureContext.cpp index 6773ec28d..580816789 100644 --- a/qrenderdoc/Code/CaptureContext.cpp +++ b/qrenderdoc/Code/CaptureContext.cpp @@ -201,19 +201,19 @@ void CaptureContext::LoadLogfileThreaded(const QString &logFile, const QString & // fetch initial data like drawcalls, textures and buffers m_Renderer.BlockInvoke([this](IReplayRenderer *r) { - r->GetFrameInfo(&m_FrameInfo); + m_FrameInfo = r->GetFrameInfo(); m_APIProps = r->GetAPIProperties(); m_PostloadProgress = 0.2f; - r->GetDrawcalls(&m_Drawcalls); + m_Drawcalls = r->GetDrawcalls(); AddFakeProfileMarkers(); m_PostloadProgress = 0.4f; - r->GetSupportedWindowSystems(&m_WinSystems); + m_WinSystems = r->GetSupportedWindowSystems(); #if defined(RENDERDOC_PLATFORM_WIN32) m_CurWinSystem = WindowingSystem::Win32; @@ -236,22 +236,22 @@ void CaptureContext::LoadLogfileThreaded(const QString &logFile, const QString & m_X11Display = QX11Info::display(); #endif - r->GetBuffers(&m_BufferList); + m_BufferList = r->GetBuffers(); for(BufferDescription &b : m_BufferList) m_Buffers[b.ID] = &b; m_PostloadProgress = 0.8f; - r->GetTextures(&m_TextureList); + m_TextureList = r->GetTextures(); for(TextureDescription &t : m_TextureList) m_Textures[t.ID] = &t; m_PostloadProgress = 0.9f; - r->GetD3D11PipelineState(&m_CurD3D11PipelineState); - r->GetD3D12PipelineState(&m_CurD3D12PipelineState); - r->GetGLPipelineState(&m_CurGLPipelineState); - r->GetVulkanPipelineState(&m_CurVulkanPipelineState); + m_CurD3D11PipelineState = r->GetD3D11PipelineState(); + m_CurD3D12PipelineState = r->GetD3D12PipelineState(); + m_CurGLPipelineState = r->GetGLPipelineState(); + m_CurVulkanPipelineState = r->GetVulkanPipelineState(); m_CurPipelineState.SetStates(m_APIProps, &m_CurD3D11PipelineState, &m_CurD3D12PipelineState, &m_CurGLPipelineState, &m_CurVulkanPipelineState); @@ -555,10 +555,10 @@ void CaptureContext::SetEventID(const QVector &exclude, uint32 m_Renderer.BlockInvoke([this, eventID, force](IReplayRenderer *r) { r->SetFrameEvent(eventID, force); - r->GetD3D11PipelineState(&m_CurD3D11PipelineState); - r->GetD3D12PipelineState(&m_CurD3D12PipelineState); - r->GetGLPipelineState(&m_CurGLPipelineState); - r->GetVulkanPipelineState(&m_CurVulkanPipelineState); + m_CurD3D11PipelineState = r->GetD3D11PipelineState(); + m_CurD3D12PipelineState = r->GetD3D12PipelineState(); + m_CurGLPipelineState = r->GetGLPipelineState(); + m_CurVulkanPipelineState = r->GetVulkanPipelineState(); m_CurPipelineState.SetStates(m_APIProps, &m_CurD3D11PipelineState, &m_CurD3D12PipelineState, &m_CurGLPipelineState, &m_CurVulkanPipelineState); }); diff --git a/qrenderdoc/Code/RenderManager.cpp b/qrenderdoc/Code/RenderManager.cpp index 11bdc47ed..6159ce7f7 100644 --- a/qrenderdoc/Code/RenderManager.cpp +++ b/qrenderdoc/Code/RenderManager.cpp @@ -91,8 +91,7 @@ QStringList RenderManager::GetRemoteSupport() { QMutexLocker autolock(&m_RemoteLock); - rdctype::array supported; - m_Remote->RemoteSupportedReplays(&supported); + rdctype::array supported = m_Remote->RemoteSupportedReplays(); for(rdctype::str &s : supported) ret << ToQStr(s); } @@ -368,13 +367,13 @@ uint32_t RenderManager::ExecuteAndInject(const QString &exe, const QString &work { QMutexLocker autolock(&m_RemoteLock); ret = m_Remote->ExecuteAndInject(exe.toUtf8().data(), workingDir.toUtf8().data(), - cmdLine.toUtf8().data(), envList, &opts); + cmdLine.toUtf8().data(), envList, opts); } else { ret = RENDERDOC_ExecuteAndInject(exe.toUtf8().data(), workingDir.toUtf8().data(), cmdLine.toUtf8().data(), envList, logfile.toUtf8().data(), - &opts, false); + opts, false); } RENDERDOC_FreeEnvironmentModificationList(envList); @@ -403,7 +402,8 @@ void RenderManager::run() IReplayRenderer *renderer = NULL; if(m_Remote) - m_CreateStatus = m_Remote->OpenCapture(~0U, m_Logfile.toUtf8().data(), m_Progress, &renderer); + std::tie(m_CreateStatus, renderer) = + m_Remote->OpenCapture(~0U, m_Logfile.toUtf8().data(), m_Progress); else m_CreateStatus = RENDERDOC_CreateReplayRenderer(m_Logfile.toUtf8().data(), m_Progress, &renderer); diff --git a/qrenderdoc/Code/pyrenderdoc/renderdoc.i b/qrenderdoc/Code/pyrenderdoc/renderdoc.i index bcc9d1f18..42c4e461f 100644 --- a/qrenderdoc/Code/pyrenderdoc/renderdoc.i +++ b/qrenderdoc/Code/pyrenderdoc/renderdoc.i @@ -1,6 +1,7 @@ %module renderdoc %feature("autodoc", "0"); +%feature("autodoc:noret", "1"); // just define linux platform to make sure things compile with no extra __declspec attributes #define RENDERDOC_PLATFORM_LINUX diff --git a/qrenderdoc/Windows/APIInspector.cpp b/qrenderdoc/Windows/APIInspector.cpp index 58d580a82..d6e4f7b5d 100644 --- a/qrenderdoc/Windows/APIInspector.cpp +++ b/qrenderdoc/Windows/APIInspector.cpp @@ -98,8 +98,7 @@ void APIInspector::on_apiEvents_itemSelectionChanged() if(ev.callstack.count > 0) { m_Ctx.Renderer().AsyncInvoke([this, ev](IReplayRenderer *r) { - rdctype::array trace; - r->GetResolve(ev.callstack.elems, ev.callstack.count, &trace); + rdctype::array trace = r->GetResolve(ev.callstack); GUIInvoke::call([this, trace]() { addCallstack(trace); }); }); diff --git a/qrenderdoc/Windows/BufferViewer.cpp b/qrenderdoc/Windows/BufferViewer.cpp index b89309e55..730ed4417 100644 --- a/qrenderdoc/Windows/BufferViewer.cpp +++ b/qrenderdoc/Windows/BufferViewer.cpp @@ -1239,11 +1239,11 @@ void BufferViewer::OnEventChanged(uint32_t eventID) if(len == UINT64_MAX) len = 0; - r->GetBufferData(m_BufferID, m_ByteOffset, len, &data); + data = r->GetBufferData(m_BufferID, m_ByteOffset, len); } else { - r->GetTextureData(m_BufferID, m_TexArrayIdx, m_TexMip, &data); + data = r->GetTextureData(m_BufferID, m_TexArrayIdx, m_TexMip); } buf->data = new byte[data.count]; @@ -1303,8 +1303,8 @@ void BufferViewer::RT_FetchMeshData(IReplayRenderer *r) rdctype::array idata; if(ib != ResourceId() && draw && (draw->flags & DrawFlags::UseIBuffer)) - r->GetBufferData(ib, ioffset + draw->indexOffset * draw->indexByteWidth, - draw->numIndices * draw->indexByteWidth, &idata); + idata = r->GetBufferData(ib, ioffset + draw->indexOffset * draw->indexByteWidth, + draw->numIndices * draw->indexByteWidth); uint32_t *indices = NULL; if(m_ModelVSIn->indices) @@ -1399,9 +1399,8 @@ void BufferViewer::RT_FetchMeshData(IReplayRenderer *r) BufferData *buf = new BufferData; if(used) { - rdctype::array bufdata; - r->GetBufferData(vb.Buffer, vb.ByteOffset + offset * vb.ByteStride, - (maxIdx + 1) * vb.ByteStride, &bufdata); + rdctype::array bufdata = r->GetBufferData( + vb.Buffer, vb.ByteOffset + offset * vb.ByteStride, (maxIdx + 1) * vb.ByteStride); buf->data = new byte[bufdata.count]; memcpy(buf->data, bufdata.elems, bufdata.count); @@ -1412,13 +1411,13 @@ void BufferViewer::RT_FetchMeshData(IReplayRenderer *r) m_ModelVSIn->buffers.push_back(buf); } - r->GetPostVSData(m_Config.curInstance, MeshDataStage::VSOut, &m_PostVS); + m_PostVS = r->GetPostVSData(m_Config.curInstance, MeshDataStage::VSOut); m_ModelVSOut->numRows = m_PostVS.numVerts; if(draw && m_PostVS.idxbuf != ResourceId() && (draw->flags & DrawFlags::UseIBuffer)) - r->GetBufferData(m_PostVS.idxbuf, ioffset + draw->indexOffset * draw->indexByteWidth, - draw->numIndices * draw->indexByteWidth, &idata); + idata = r->GetBufferData(m_PostVS.idxbuf, ioffset + draw->indexOffset * draw->indexByteWidth, + draw->numIndices * draw->indexByteWidth); indices = NULL; if(m_ModelVSOut->indices) @@ -1454,8 +1453,7 @@ void BufferViewer::RT_FetchMeshData(IReplayRenderer *r) if(m_PostVS.buf != ResourceId()) { BufferData *postvs = new BufferData; - rdctype::array bufdata; - r->GetBufferData(m_PostVS.buf, m_PostVS.offset, 0, &bufdata); + rdctype::array bufdata = r->GetBufferData(m_PostVS.buf, m_PostVS.offset, 0); postvs->data = new byte[bufdata.count]; memcpy(postvs->data, bufdata.elems, bufdata.count); @@ -1466,7 +1464,7 @@ void BufferViewer::RT_FetchMeshData(IReplayRenderer *r) m_ModelVSOut->buffers.push_back(postvs); } - r->GetPostVSData(m_Config.curInstance, MeshDataStage::GSOut, &m_PostGS); + m_PostGS = r->GetPostVSData(m_Config.curInstance, MeshDataStage::GSOut); m_ModelGSOut->numRows = m_PostGS.numVerts; @@ -1476,8 +1474,7 @@ void BufferViewer::RT_FetchMeshData(IReplayRenderer *r) if(m_PostGS.buf != ResourceId()) { BufferData *postgs = new BufferData; - rdctype::array bufdata; - r->GetBufferData(m_PostGS.buf, m_PostGS.offset, 0, &bufdata); + rdctype::array bufdata = r->GetBufferData(m_PostGS.buf, m_PostGS.offset, 0); postgs->data = new byte[bufdata.count]; memcpy(postgs->data, bufdata.elems, bufdata.count); @@ -2194,8 +2191,10 @@ void BufferViewer::render_clicked(QMouseEvent *e) { m_Ctx.Renderer().AsyncInvoke("PickVertex", [this, curpos](IReplayRenderer *r) { uint32_t instanceSelected = 0; - uint32_t vertSelected = m_Output->PickVertex(m_Ctx.CurEvent(), (uint32_t)curpos.x(), - (uint32_t)curpos.y(), &instanceSelected); + uint32_t vertSelected = 0; + + std::tie(vertSelected, instanceSelected) = + m_Output->PickVertex(m_Ctx.CurEvent(), (uint32_t)curpos.x(), (uint32_t)curpos.y()); if(vertSelected != ~0U) { @@ -2736,13 +2735,11 @@ void BufferViewer::debugVertex() m_CurView->model()->data(m_CurView->model()->index(idx.row(), 1), Qt::DisplayRole).toUInt(); m_Ctx.Renderer().AsyncInvoke([this, vertid, index](IReplayRenderer *r) { - ShaderDebugTrace *trace = new ShaderDebugTrace; - - bool success = + ShaderDebugTrace *trace = r->DebugVertex(vertid, m_Config.curInstance, index, m_Ctx.CurDrawcall()->instanceOffset, - m_Ctx.CurDrawcall()->vertexOffset, trace); + m_Ctx.CurDrawcall()->vertexOffset); - if(!success || trace->states.count == 0) + if(trace->states.count == 0) { delete trace; diff --git a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp index edf65c385..4ae0eb5b3 100644 --- a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp +++ b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp @@ -111,8 +111,7 @@ void ConstantBufferPreviewer::OnEventChanged(uint32_t eventID) if(!m_formatOverride.empty()) { m_Ctx.Renderer().AsyncInvoke([this, offs, size](IReplayRenderer *r) { - rdctype::array data; - r->GetBufferData(m_cbuffer, offs, size, &data); + rdctype::array data = r->GetBufferData(m_cbuffer, offs, size); rdctype::array vars = applyFormatOverride(data); GUIInvoke::call([this, vars] { setVariables(vars); }); }); @@ -120,9 +119,8 @@ void ConstantBufferPreviewer::OnEventChanged(uint32_t eventID) else { m_Ctx.Renderer().AsyncInvoke([this, entryPoint, offs](IReplayRenderer *r) { - rdctype::array vars; - r->GetCBufferVariableContents(m_shader, entryPoint.toUtf8().data(), m_slot, m_cbuffer, offs, - &vars); + rdctype::array vars = r->GetCBufferVariableContents( + m_shader, entryPoint.toUtf8().data(), m_slot, m_cbuffer, offs); GUIInvoke::call([this, vars] { setVariables(vars); }); }); } diff --git a/qrenderdoc/Windows/Dialogs/LiveCapture.cpp b/qrenderdoc/Windows/Dialogs/LiveCapture.cpp index 0b4afd909..11887e4c1 100644 --- a/qrenderdoc/Windows/Dialogs/LiveCapture.cpp +++ b/qrenderdoc/Windows/Dialogs/LiveCapture.cpp @@ -994,8 +994,7 @@ void LiveCapture::connectionThreadEntry() return; } - TargetControlMessage msg; - m_Connection->ReceiveMessage(&msg); + TargetControlMessage msg = m_Connection->ReceiveMessage(); if(msg.Type == TargetControlMessageType::RegisterAPI) { diff --git a/qrenderdoc/Windows/EventBrowser.cpp b/qrenderdoc/Windows/EventBrowser.cpp index c40673e07..8818e38ad 100644 --- a/qrenderdoc/Windows/EventBrowser.cpp +++ b/qrenderdoc/Windows/EventBrowser.cpp @@ -263,10 +263,7 @@ void EventBrowser::on_timeDraws_clicked() { m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *r) { - GPUCounter counters[] = {GPUCounter::EventGPUDuration}; - - rdctype::array results; - r->FetchCounters(counters, 1, &results); + rdctype::array results = r->FetchCounters({GPUCounter::EventGPUDuration}); GUIInvoke::call([this, results]() { SetDrawcallTimes(ui->events->topLevelItem(0), results); }); }); diff --git a/qrenderdoc/Windows/MainWindow.cpp b/qrenderdoc/Windows/MainWindow.cpp index 9a9b1a008..e5b6fe830 100644 --- a/qrenderdoc/Windows/MainWindow.cpp +++ b/qrenderdoc/Windows/MainWindow.cpp @@ -381,7 +381,7 @@ void MainWindow::OnInjectTrigger(uint32_t PID, const QList msgs; - r->GetDebugMessages(&msgs); + rdctype::array msgs = r->GetDebugMessages(); bool disconnected = false; diff --git a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp index 06c3d83fd..e51f43d0f 100644 --- a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp @@ -331,8 +331,10 @@ void PipelineStateViewer::EditShader(ShaderStage shaderType, ResourceId id, uint flags = shaderDetails->DebugInfo.compileFlags; ResourceId from = id; - ResourceId to = r->BuildTargetShader( - entryFunc.toUtf8().data(), compileSource.toUtf8().data(), flags, shaderType, &errs); + ResourceId to; + + std::tie(to, errs) = r->BuildTargetShader( + entryFunc.toUtf8().data(), compileSource.toUtf8().data(), flags, shaderType); GUIInvoke::call([viewer, errs]() { viewer->ShowErrors(ToQStr(errs)); }); if(to == ResourceId()) diff --git a/qrenderdoc/Windows/PixelHistoryView.cpp b/qrenderdoc/Windows/PixelHistoryView.cpp index c371a04e5..f06acebc2 100644 --- a/qrenderdoc/Windows/PixelHistoryView.cpp +++ b/qrenderdoc/Windows/PixelHistoryView.cpp @@ -635,13 +635,12 @@ void PixelHistoryView::startDebug(EventTag tag) { m_Ctx.SetEventID({this}, tag.eventID, tag.eventID); - ShaderDebugTrace *trace = new ShaderDebugTrace; + ShaderDebugTrace *trace = NULL; bool success = false; - m_Ctx.Renderer().BlockInvoke([this, &success, trace](IReplayRenderer *r) { - success = - r->DebugPixel((uint32_t)m_Pixel.x(), (uint32_t)m_Pixel.y(), m_Display.sampleIdx, ~0U, trace); + m_Ctx.Renderer().BlockInvoke([this, &success, &trace](IReplayRenderer *r) { + trace = r->DebugPixel((uint32_t)m_Pixel.x(), (uint32_t)m_Pixel.y(), m_Display.sampleIdx, ~0U); }); if(!success || trace->states.count == 0) diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index b022e4190..be751552c 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -652,12 +652,12 @@ void TextureViewer::RT_FetchCurrentPixel(uint32_t x, uint32_t y, PixelValue &pic if(m_TexDisplay.FlipY) y = (texptr->height - 1) - y; - m_Output->PickPixel(m_TexDisplay.texid, true, x, y, m_TexDisplay.sliceFace, m_TexDisplay.mip, - m_TexDisplay.sampleIdx, &pickValue); + pickValue = m_Output->PickPixel(m_TexDisplay.texid, true, x, y, m_TexDisplay.sliceFace, + m_TexDisplay.mip, m_TexDisplay.sampleIdx); if(m_TexDisplay.CustomShader != ResourceId()) - m_Output->PickPixel(m_TexDisplay.texid, false, x, y, m_TexDisplay.sliceFace, m_TexDisplay.mip, - m_TexDisplay.sampleIdx, &realValue); + realValue = m_Output->PickPixel(m_TexDisplay.texid, false, x, y, m_TexDisplay.sliceFace, + m_TexDisplay.mip, m_TexDisplay.sampleIdx); } void TextureViewer::RT_PickPixelsAndUpdate(IReplayRenderer *) @@ -713,18 +713,15 @@ void TextureViewer::RT_UpdateVisualRange(IReplayRenderer *) if(m_TexDisplay.CustomShader != ResourceId()) fmt.compCount = 4; - bool success = true; - bool channels[] = { m_TexDisplay.Red ? true : false, m_TexDisplay.Green && fmt.compCount > 1, m_TexDisplay.Blue && fmt.compCount > 2, m_TexDisplay.Alpha && fmt.compCount > 3, }; - rdctype::array histogram; - success = m_Output->GetHistogram(ui->rangeHistogram->rangeMin(), ui->rangeHistogram->rangeMax(), - channels, &histogram); + rdctype::array histogram = m_Output->GetHistogram( + ui->rangeHistogram->rangeMin(), ui->rangeHistogram->rangeMax(), channels); - if(success) + if(!histogram.empty()) { QVector histogramVec(histogram.count); if(histogram.count > 0) @@ -2127,9 +2124,7 @@ void TextureViewer::thumb_clicked(QMouseEvent *e) else { m_Ctx.Renderer().AsyncInvoke([this, id](IReplayRenderer *r) { - rdctype::array usage; - - r->GetUsage(id, &usage); + rdctype::array usage = r->GetUsage(id); GUIInvoke::call([this, id, usage]() { OpenResourceContextMenu(id, usage); }); }); @@ -2977,9 +2972,8 @@ void TextureViewer::AutoFitRange() m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *r) { PixelValue min, max; - bool success = m_Output->GetMinMax(&min, &max); + std::tie(min, max) = m_Output->GetMinMax(); - if(success) { float minval = FLT_MAX; float maxval = -FLT_MAX; @@ -3286,11 +3280,9 @@ void TextureViewer::on_debugPixelContext_clicked() int y = m_PickedPoint.y() >> (int)m_TexDisplay.mip; m_Ctx.Renderer().AsyncInvoke([this, x, y](IReplayRenderer *r) { - ShaderDebugTrace *trace = new ShaderDebugTrace; + ShaderDebugTrace *trace = r->DebugPixel((uint32_t)x, (uint32_t)y, m_TexDisplay.sampleIdx, ~0U); - bool success = r->DebugPixel((uint32_t)x, (uint32_t)y, m_TexDisplay.sampleIdx, ~0U, trace); - - if(!success || trace->states.count == 0) + if(trace->states.count == 0) { delete trace; @@ -3335,14 +3327,11 @@ void TextureViewer::on_pixelHistory_clicked() LambdaThread *thread = new LambdaThread([this, texptr, x, y, hist]() { QThread::msleep(150); m_Ctx.Renderer().AsyncInvoke([this, texptr, x, y, hist](IReplayRenderer *r) { - rdctype::array *history = new rdctype::array(); - r->PixelHistory(texptr->ID, (uint32_t)x, (int32_t)y, m_TexDisplay.sliceFace, m_TexDisplay.mip, - m_TexDisplay.sampleIdx, m_TexDisplay.typeHint, history); + rdctype::array history = + r->PixelHistory(texptr->ID, (uint32_t)x, (int32_t)y, m_TexDisplay.sliceFace, + m_TexDisplay.mip, m_TexDisplay.sampleIdx, m_TexDisplay.typeHint); - GUIInvoke::call([hist, history] { - hist->SetHistory(*history); - delete history; - }); + GUIInvoke::call([hist, history] { hist->SetHistory(history); }); }); }); thread->selfDelete(true); @@ -3483,8 +3472,9 @@ void TextureViewer::reloadCustomShaders(const QString &filter) m_Ctx.Renderer().AsyncInvoke([this, fn, key, source](IReplayRenderer *r) { rdctype::str errors; - ResourceId id = - r->BuildCustomShader("main", source.toUtf8().data(), 0, ShaderStage::Pixel, &errors); + ResourceId id; + std::tie(id, errors) = + r->BuildCustomShader("main", source.toUtf8().data(), 0, ShaderStage::Pixel); if(m_CustomShaderEditor.contains(key)) { diff --git a/renderdoc/api/replay/renderdoc_replay.h b/renderdoc/api/replay/renderdoc_replay.h index cf71a494b..567556f1f 100644 --- a/renderdoc/api/replay/renderdoc_replay.h +++ b/renderdoc/api/replay/renderdoc_replay.h @@ -203,7 +203,7 @@ DOCUMENT(R"(This is an opaque identifier that uniquely locates a resource. struct ResourceId { ResourceId() : id() {} - DOCUMENT("A helper function that explicitly creates an empty/invalid/null ``ResourceId``."); + DOCUMENT("A helper function that explicitly creates an empty/invalid/null :class:`ResourceId`."); inline static ResourceId Null() { return ResourceId(); } DOCUMENT("Compares two ``ResourceId`` objects for equality."); bool operator==(const ResourceId u) const { return id == u.id; } @@ -240,14 +240,14 @@ The different types are enumerated in :class:`ReplayOutputType`. struct IReplayOutput { DOCUMENT("Sets the :class:`TextureDisplay` configuration for a texture output."); - virtual bool SetTextureDisplay(const TextureDisplay &o) = 0; + virtual void SetTextureDisplay(const TextureDisplay &o) = 0; DOCUMENT("Sets the :class:`MeshDisplay` configuration for a mesh output."); - virtual bool SetMeshDisplay(const MeshDisplay &o) = 0; + virtual void SetMeshDisplay(const MeshDisplay &o) = 0; DOCUMENT( "Clear and release all thumbnails associated with this output. See :meth:`AddThumbnail`."); - virtual bool ClearThumbnails() = 0; + virtual void ClearThumbnails() = 0; DOCUMENT(R"(Sets up a thumbnail for displaying a particular texture with sensible defaults. @@ -264,7 +264,7 @@ Should only be called for texture outputs. :type data: opaque void * pointer. :param ResourceId texID: The texture ID to display in the thumbnail preview. :return: A boolean indicating if the thumbnail was successfully created. -:rtype: bool +:rtype: ``bool`` )"); virtual bool AddThumbnail(WindowingSystem system, void *data, ResourceId texID, CompType typeHint) = 0; @@ -273,7 +273,7 @@ Should only be called for texture outputs. This will also render any thumbnails and the pixel context, if enabled. )"); - virtual bool Display() = 0; + virtual void Display() = 0; DOCUMENT(R"(Sets up a zoomed in pixel context view around a particular pixel selection. @@ -286,7 +286,7 @@ Should only be called for texture outputs. :param data: The native window data, in a format defined by the system. :type data: opaque void * pointer. :return: A boolean indicating if the pixel context was successfully configured. -:rtype: bool +:rtype: ``bool`` )"); virtual bool SetPixelContext(WindowingSystem system, void *data) = 0; @@ -294,7 +294,7 @@ Should only be called for texture outputs. Should only be called for texture outputs. )"); - virtual bool SetPixelContextLocation(uint32_t x, uint32_t y) = 0; + virtual void SetPixelContextLocation(uint32_t x, uint32_t y) = 0; DOCUMENT("Disable the pixel context view from rendering."); virtual void DisablePixelContext() = 0; @@ -303,12 +303,10 @@ Should only be called for texture outputs. Should only be called for texture outputs. -:param PixelValue minval: A reference to a ``PixelValue`` to receive the minimum values, or ``None`` - if the minimum isn't desired. -:param PixelValue maxval: A reference to a ``PixelValue`` to receive the maximum values, or ``None`` - if the maximum isn't desired. +:return: A tuple with the minimum and maximum pixel values respectively. +:rtype: ``tuple`` of PixelValue and PixelValue )"); - virtual bool GetMinMax(PixelValue *minval, PixelValue *maxval) = 0; + virtual rdctype::pair GetMinMax() = 0; DOCUMENT(R"(Retrieve a list of values that can be used to show a histogram of values for the current texture. @@ -324,10 +322,10 @@ Should only be called for texture outputs. not added to any bucket. :param list channels: A list of four ``bool`` values indicating whether each of RGBA should be included in the count. -:param PixelValue maxval: A reference to a list to receive the bucket values. +:return: A list of the unnormalised bucket values. +:rtype: ``list`` of ``int`` )"); - virtual bool GetHistogram(float minval, float maxval, bool channels[4], - rdctype::array *histogram) = 0; + virtual rdctype::array GetHistogram(float minval, float maxval, bool channels[4]) = 0; DOCUMENT(R"(Retrieves the :class:`ResourceId` containing the contents of the texture after being passed through a custom shader pass. @@ -350,11 +348,11 @@ Should only be called for texture outputs. :param int sliceFace: The slice of an array or 3D texture, or face of a cubemap texture. :param int mip: The mip level to pick from. :param int sample: The multisample sample to pick from. -:param PixelValue val: A reference to a :class:`PixelValue` object that will be filled with the - contents of the pixel. +:return: The contents of the pixel. +:rtype: PixelValue )"); - virtual bool PickPixel(ResourceId texID, bool customShader, uint32_t x, uint32_t y, - uint32_t sliceFace, uint32_t mip, uint32_t sample, PixelValue *val) = 0; + virtual PixelValue PickPixel(ResourceId texID, bool customShader, uint32_t x, uint32_t y, + uint32_t sliceFace, uint32_t mip, uint32_t sample) = 0; DOCUMENT(R"(Retrieves the vertex and instance that is under the cursor location, when viewed relative to the current window with the current mesh display configuration. @@ -364,12 +362,11 @@ Should only be called for mesh outputs. :param int eventID: The event ID to pick at. :param int x: The x co-ordinate to pick from. :param int y: The y co-ordinate to pick from. -:param int pickedInstance: A reference to an integer to receive the picked instance, or - ``None`` if this value isn't wanted. -:return: The vertex index in the mesh, or ``0xffffffff`` if no vertex was found. -:rtype: int +:return: A tuple with the first value being the vertex index in the mesh, and the second value being + the instance index. The values are set to ``0xffffffff`` if no vertex was found, +:rtype: ``tuple`` of ``int`` and ``int`` )"); - virtual uint32_t PickVertex(uint32_t eventID, uint32_t x, uint32_t y, uint32_t *pickedInstance) = 0; + virtual rdctype::pair PickVertex(uint32_t eventID, uint32_t x, uint32_t y) = 0; protected: IReplayOutput() = default; @@ -390,10 +387,10 @@ struct IReplayRenderer DOCUMENT(R"(Retrieves the supported :class:`WindowingSystem` systems by the local system. -:param systems: A reference to a list to receive the supported systems. -:type systems: reference to a list +:return: The list of supported systems. +:rtype: ``list`` of :class:`WindowingSystem` )"); - virtual void GetSupportedWindowSystems(rdctype::array *systems) = 0; + virtual rdctype::array GetSupportedWindowSystems() = 0; DOCUMENT(R"(Creates a replay output of the given type to the given native window @@ -421,7 +418,7 @@ struct IReplayRenderer DOCUMENT(R"(Query if per-event or per-draw callstacks are available in this capture. :return: ``True`` if any callstacks are available, ``False`` otherwise. -:rtype: bool +:rtype: ``bool`` )"); virtual bool HasCallstacks() = 0; @@ -433,7 +430,7 @@ comes to a point where a problem is encountered that the user cannot solve. That used to present a progress dialog and repeatedly queried to see when to allow the user to continue. :return: ``True`` if any callstacks are available, ``False`` otherwise. -:rtype: bool +:rtype: ``bool`` )"); virtual bool InitResolver() = 0; @@ -444,43 +441,47 @@ used to present a progress dialog and repeatedly queried to see when to allow th :param bool force: ``True`` if the internal replay should refresh even if the ``eventID`` is already current. This can be useful if external factors might cause the replay to vary. )"); - virtual bool SetFrameEvent(uint32_t eventID, bool force) = 0; + virtual void SetFrameEvent(uint32_t eventID, bool force) = 0; DOCUMENT(R"(Retrieve the current :class:`D3D11_State` pipeline state. This pipeline state will be filled with default values if the capture is not using the D3D11 API. You should use :meth:`GetAPIProperties` to determine the API of the capture. -:param D3D11_State state: A reference to receive the pipeline state. +:return: The current D3D11 pipeline state. +:rtype: D3D11_State )"); - virtual bool GetD3D11PipelineState(D3D11Pipe::State *state) = 0; + virtual D3D11Pipe::State GetD3D11PipelineState() = 0; DOCUMENT(R"(Retrieve the current :class:`D3D12_State` pipeline state. This pipeline state will be filled with default values if the capture is not using the D3D12 API. You should use :meth:`GetAPIProperties` to determine the API of the capture. -:param D3D12_State state: A reference to receive the pipeline state. +:return: The current D3D12 pipeline state. +:rtype: D3D12_State )"); - virtual bool GetD3D12PipelineState(D3D12Pipe::State *state) = 0; + virtual D3D12Pipe::State GetD3D12PipelineState() = 0; DOCUMENT(R"(Retrieve the current :class:`GL_State` pipeline state. This pipeline state will be filled with default values if the capture is not using the OpenGL API. You should use :meth:`GetAPIProperties` to determine the API of the capture. -:param GL_State state: A reference to receive the pipeline state. +:return: The current OpenGL pipeline state. +:rtype: GL_State )"); - virtual bool GetGLPipelineState(GLPipe::State *state) = 0; + virtual GLPipe::State GetGLPipelineState() = 0; DOCUMENT(R"(Retrieve the current :class:`VK_State` pipeline state. This pipeline state will be filled with default values if the capture is not using the Vulkan API. You should use :meth:`GetAPIProperties` to determine the API of the capture. -:param VK_State state: A reference to receive the pipeline state. +:return: The current Vulkan pipeline state. +:rtype: VK_State )"); - virtual bool GetVulkanPipelineState(VKPipe::State *state) = 0; + virtual VKPipe::State GetVulkanPipelineState() = 0; DOCUMENT(R"(Builds a shader suitable for running on the local replay instance as a custom shader. @@ -492,13 +493,14 @@ See :data:`TextureDisplay.CustomShader`. :param str source: The source file. :param int compileFlags: API-specific compilation flags. :param ShaderStage type: The stage that this shader will be executed at. -:param str errors: A reference to a ``str`` that will receive any errors/warnings from compilation. -:return: The id of the new shader if compilation was successful, :meth:`ResourceId.Null` otherwise. -:rtype: bool +:return: A ``tuple`` with the id of the new shader if compilation was successful, + :meth:`ResourceId.Null` otherwise, and a ``str`` with any warnings/errors from compilation. +:rtype: ``tuple`` of :class:`ResourceId` and ``str``. )"); - virtual ResourceId BuildCustomShader(const char *entry, const char *source, - const uint32_t compileFlags, ShaderStage type, - rdctype::str *errors) = 0; + virtual rdctype::pair BuildCustomShader(const char *entry, + const char *source, + const uint32_t compileFlags, + ShaderStage type) = 0; DOCUMENT(R"(Free a previously created custom shader. @@ -506,7 +508,7 @@ See :meth:`BuildCustomShader`. :param ResourceId id: The id of the custom shader to free. )"); - virtual bool FreeCustomShader(ResourceId id) = 0; + virtual void FreeCustomShader(ResourceId id) = 0; DOCUMENT(R"(Builds a shader suitable for running in the capture's API as a replacement shader. @@ -516,13 +518,14 @@ The language used is native to the API's renderer - HLSL for D3D based renderers :param str source: The source file. :param int compileFlags: API-specific compilation flags. :param ShaderStage type: The stage that this shader will be executed at. -:param str errors: A reference to a ``str`` that will receive any errors/warnings from compilation. -:return: The id of the new shader if compilation was successful, :meth:`ResourceId.Null` otherwise. -:rtype: bool +:return: A ``tuple`` with the id of the new shader if compilation was successful, + :meth:`ResourceId.Null` otherwise, and a ``str`` with any warnings/errors from compilation. +:rtype: ``tuple`` of :class:`ResourceId` and ``str``. )"); - virtual ResourceId BuildTargetShader(const char *entry, const char *source, - const uint32_t compileFlags, ShaderStage type, - rdctype::str *errors) = 0; + virtual rdctype::pair BuildTargetShader(const char *entry, + const char *source, + const uint32_t compileFlags, + ShaderStage type) = 0; DOCUMENT(R"(Replace one resource with another for subsequent replay and analysis work. @@ -534,7 +537,7 @@ See :meth:`BuildTargetShader`, :meth:`RemoveReplacement`. :param ResourceId original: The id of the original resource that should be substituted. :param ResourceId replacement: The id of the new resource that should be used instead. )"); - virtual bool ReplaceResource(ResourceId original, ResourceId replacement) = 0; + virtual void ReplaceResource(ResourceId original, ResourceId replacement) = 0; DOCUMENT(R"(Remove any previously specified replacement for an object. @@ -542,7 +545,7 @@ See :meth:`ReplaceResource`. :param ResourceId id: The id of the original resource that was previously being substituted. )"); - virtual bool RemoveReplacement(ResourceId id) = 0; + virtual void RemoveReplacement(ResourceId id) = 0; DOCUMENT(R"(Free a previously created target shader. @@ -550,76 +553,80 @@ See :meth:`BuildTargetShader`. :param ResourceId id: The id of the target shader to free. )"); - virtual bool FreeTargetResource(ResourceId id) = 0; + virtual void FreeTargetResource(ResourceId id) = 0; DOCUMENT(R"(Retrieve the information about the frame contained in the capture. -:param FrameDescription frame: A reference to receive the frame information. +:return: The frame information. +:rtype: FrameDescription )"); - virtual bool GetFrameInfo(FrameDescription *frame) = 0; + virtual FrameDescription GetFrameInfo() = 0; DOCUMENT(R"(Retrieve the list of root-level drawcalls in the capture. -:param list draws: A reference to a list receive the :class:`DrawcallDescription` drawcalls. +:return: The list of root-level drawcalls in the capture. +:rtype: ``list`` of :class:`DrawcallDescription` )"); - virtual bool GetDrawcalls(rdctype::array *draws) = 0; + virtual rdctype::array GetDrawcalls() = 0; DOCUMENT(R"(Retrieve the values of a specified set of counters. -:param list counters: The list of counters. -:param int results: The length of the counter list. -:param list results: A reference to a list receive the :class:`CounterResult` results. +:param list counters: The list of :class:`GPUCounter` to fetch results for. +:return: The list of counter results generated. +:rtype: ``list`` of :class:`CounterResult` )"); - virtual bool FetchCounters(GPUCounter *counters, uint32_t numCounters, - rdctype::array *results) = 0; + virtual rdctype::array FetchCounters(const rdctype::array &counters) = 0; DOCUMENT(R"(Retrieve a list of which counters are available in the current capture analysis implementation. -:param list counters: A reference to a list receive the :class:`GPUCounter` IDs. +:return: The list of counters available. +:rtype: ``list`` of :class:`GPUCounter` )"); - virtual bool EnumerateCounters(rdctype::array *counters) = 0; + virtual rdctype::array EnumerateCounters() = 0; DOCUMENT(R"(Get information about what a counter actually represents, in terms of a human-readable understanding as well as the type and unit of the resulting information. :param GPUCounter counterID: The counter to query about. -:param CounterDescription desc: A reference to a :class:`CounterDescription` to receive the - description. +:return: The description of the counter. +:rtype: CounterDescription )"); - virtual bool DescribeCounter(GPUCounter counterID, CounterDescription *desc) = 0; + virtual CounterDescription DescribeCounter(GPUCounter counterID) = 0; DOCUMENT(R"(Retrieve the list of textures alive in the capture. -:param list texs: A reference to a list receive the :class:`TextureDescription` textures. +:return: The list of textures in the capture. +:rtype: ``list`` of :class:`TextureDescription` )"); - virtual bool GetTextures(rdctype::array *texs) = 0; + virtual rdctype::array GetTextures() = 0; DOCUMENT(R"(Retrieve the list of buffers alive in the capture. -:param list bufs: A reference to a list receive the :class:`BufferDescription` buffers. +:return: The list of buffers in the capture. +:rtype: ``list`` of :class:`BufferDescription` )"); - virtual bool GetBuffers(rdctype::array *bufs) = 0; + virtual rdctype::array GetBuffers() = 0; DOCUMENT(R"(Retrieve the list of buffers alive in the capture. Must only be called after :meth:`InitResolver` has returned ``True``. :param list callstack: The integer addresses in the original callstack. -:param int callstackLen: The length of the callstack list. -:param list trace: A reference to a list that recieves the string callstack entries. +:return: The list of resolved callstack entries as strings. +:rtype: ``list`` of ``str`` )"); - virtual bool GetResolve(uint64_t *callstack, uint32_t callstackLen, - rdctype::array *trace) = 0; + virtual rdctype::array GetResolve(const rdctype::array &callstack) = 0; DOCUMENT(R"(Retrieve a list of any newly generated diagnostic messages. Every time this function is called, any debug messages returned will not be returned again. Only newly generated messages will be returned after that. -:param list msgs: A reference to a list receive the :class:`DebugMessage` messages. +:return: The list of the :class:`DebugMessage` messages. +:rtype: ``list`` of :class:`DebugMessage` )"); - virtual bool GetDebugMessages(rdctype::array *msgs) = 0; + virtual rdctype::array GetDebugMessages() = 0; DOCUMENT(R"(Retrieve the history of modifications to the selected pixel on the selected texture. @@ -630,12 +637,12 @@ newly generated messages will be returned after that. :param int mip: The mip level to pick from. :param int sampleIdx: The multi-sampled sample. Ignored if non-multisampled texture. :param CompType typeHint: A hint on how to interpret textures that are typeless. -:param PixelModification trace: A reference to a list of :class:`PixelModification` that receives - the resulting history, or ``None`` if something went wrong. +:return: The list of pixel history events. +:rtype: ``list`` of :class:`PixelModification` )"); - virtual bool PixelHistory(ResourceId texture, uint32_t x, uint32_t y, uint32_t slice, - uint32_t mip, uint32_t sampleIdx, CompType typeHint, - rdctype::array *history) = 0; + virtual rdctype::array PixelHistory(ResourceId texture, uint32_t x, uint32_t y, + uint32_t slice, uint32_t mip, + uint32_t sampleIdx, CompType typeHint) = 0; DOCUMENT(R"(Retrieve a debugging trace from running a vertex shader. @@ -645,11 +652,11 @@ newly generated messages will be returned after that. indexed draws or drawn from the index buffer. This must have all drawcall offsets applied. :param int instOffset: The value from :data:`DrawcallDescription.instanceOffset`. :param int vertOffset: The value from :data:`DrawcallDescription.vertexOffset`. -:param ShaderDebugTrace trace: A reference to a :class:`ShaderDebugTrace` that receives the - resulting trace, or ``None`` if something went wrong debugging. +:return: The resulting trace resulting from debugging. +:rtype: ShaderDebugTrace )"); - virtual bool DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, - uint32_t vertOffset, ShaderDebugTrace *trace) = 0; + virtual ShaderDebugTrace *DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx, + uint32_t instOffset, uint32_t vertOffset) = 0; DOCUMENT(R"(Retrieve a debugging trace from running a pixel shader. @@ -658,27 +665,28 @@ newly generated messages will be returned after that. :param int sample: The multi-sampled sample. Ignored if non-multisampled texture. :param int primitive: Debug the pixel from this primitive if there's ambiguity. If set to ``0xffffffff`` then a random fragment writing to the given co-ordinate is debugged. -:param ShaderDebugTrace trace: A reference to a :class:`ShaderDebugTrace` that receives the - resulting trace, or ``None`` if something went wrong debugging. +:return: The resulting trace resulting from debugging. +:rtype: ShaderDebugTrace )"); - virtual bool DebugPixel(uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive, - ShaderDebugTrace *trace) = 0; + virtual ShaderDebugTrace *DebugPixel(uint32_t x, uint32_t y, uint32_t sample, + uint32_t primitive) = 0; DOCUMENT(R"(Retrieve a debugging trace from running a compute thread. :param groupid: A list containing the 3D workgroup index. :param threadid: A list containing the 3D thread index within the above workgroup. -:param ShaderDebugTrace trace: A reference to a :class:`ShaderDebugTrace` that receives the - resulting trace, or ``None`` if something went wrong debugging. +:return: The resulting trace resulting from debugging. +:rtype: ShaderDebugTrace )"); - virtual bool DebugThread(uint32_t groupid[3], uint32_t threadid[3], ShaderDebugTrace *trace) = 0; + virtual ShaderDebugTrace *DebugThread(uint32_t groupid[3], uint32_t threadid[3]) = 0; DOCUMENT(R"(Retrieve a list of ways a given resource is used. :param ResourceId id: The id of the texture or buffer resource to be queried. -:param list usage: A reference to a list receive the :class:`EventUsage` usage. +:return: The list of usages of the resource. +:rtype: ``list`` of :class:`EventUsage` )"); - virtual bool GetUsage(ResourceId id, rdctype::array *usage) = 0; + virtual rdctype::array GetUsage(ResourceId id) = 0; DOCUMENT(R"(Retrieve the contents of a constant block by reading from memory or their source otherwise. @@ -689,11 +697,14 @@ otherwise. :param ResourceId buffer: The id of the buffer to use for data. If :data:`ConstantBlock.bufferBacked` is ``False`` this is ignored. :param int offs: Retrieve buffer contents starting at this byte offset. -:param list vars: A reference to a list receive the :class:`ShaderVariable` variables with values. +:return: The shader variables with their contents. +:rtype: ``list`` of :class:`ShaderVariable` )"); - virtual bool GetCBufferVariableContents(ResourceId shader, const char *entryPoint, - uint32_t cbufslot, ResourceId buffer, uint64_t offs, - rdctype::array *vars) = 0; + virtual rdctype::array GetCBufferVariableContents(ResourceId shader, + const char *entryPoint, + uint32_t cbufslot, + ResourceId buffer, + uint64_t offs) = 0; DOCUMENT(R"(Save a texture to a file on disk, with possible transformation to map a complex texture to something compatible with the target file format. @@ -701,7 +712,7 @@ texture to something compatible with the target file format. :param TextureSave saveData: The configuration settings of which texture to save, and how :param str path: The path to save to on disk. :return: ``True`` if the texture was saved successfully, ``False`` otherwise. -:rtype: bool +:rtype: ``bool`` )"); virtual bool SaveTexture(const TextureSave &saveData, const char *path) = 0; @@ -709,19 +720,20 @@ texture to something compatible with the target file format. :param int instID: The index of the instance to retrieve data for. :param MeshDataStage stage: The stage of the geometry processing pipeline to retrieve data from. -:param MeshFormat data: A reference to a :class:`MeshFormat` to receive the mesh information. +:return: The information describing where the post-transform data is stored. +:rtype: MeshFormat )"); - virtual bool GetPostVSData(uint32_t instID, MeshDataStage stage, MeshFormat *data) = 0; + virtual MeshFormat GetPostVSData(uint32_t instID, MeshDataStage stage) = 0; DOCUMENT(R"(Retrieve the contents of a range of a buffer as a ``bytes``. :param ResourceId buff: The id of the buffer to retrieve data from. :param int offset: The byte offset to the start of the range. :param int len: The length of the range, or 0 to retrieve the rest of the bytes in the buffer. -:param bytes data: A reference to a ``bytes`` to receive the data. +:return: The requested buffer contents. +:rtype: ``bytes`` )"); - virtual bool GetBufferData(ResourceId buff, uint64_t offset, uint64_t len, - rdctype::array *data) = 0; + virtual rdctype::array GetBufferData(ResourceId buff, uint64_t offset, uint64_t len) = 0; DOCUMENT(R"(Retrieve the contents of one subresource of a texture as a ``bytes``. @@ -732,10 +744,10 @@ sample 0, etc. :param ResourceId tex: The id of the texture to retrieve data from. :param int arrayIdx: The slice of an array or 3D texture, or face of a cubemap texture. :param int mip: The mip level to pick from. -:param bytes data: A reference to a ``bytes`` to receive the data. +:return: The requested texture contents. +:rtype: ``bytes`` )"); - virtual bool GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip, - rdctype::array *data) = 0; + virtual rdctype::array GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip) = 0; protected: IReplayRenderer() = default; @@ -755,35 +767,35 @@ struct ITargetControl DOCUMENT(R"(Determines if the connection is still alive. :return: ``True`` if the connection still appears to be working, ``False`` if it has been closed. -:rtype: bool +:rtype: ``bool`` )"); virtual bool Connected() = 0; DOCUMENT(R"(Retrieves the target's name or identifier - typically the name of the executable. :return: The target name. -:rtype: str +:rtype: ``str`` )"); virtual const char *GetTarget() = 0; DOCUMENT(R"(Retrieves the API currently in use by the target. :return: The API name, or empty if no API is initialised yet. -:rtype: str +:rtype: ``str`` )"); virtual const char *GetAPI() = 0; DOCUMENT(R"(Retrieves the Process ID (PID) of the target on its local system. :return: The Process ID, or 0 if that's not applicable on the target platform. -:rtype: int +:rtype: ``int`` )"); virtual uint32_t GetPID() = 0; DOCUMENT(R"(If a busy message was received, determine the client keeping the target busy. :return: The name of the client currently connected to the target. -:rtype: str +:rtype: ``str`` )"); virtual const char *GetBusyClient() = 0; @@ -828,9 +840,10 @@ The details of the types of messages that can be received are listed under This function will block but only to a limited degree. If no message is waiting after a small time it will return with a No-op message to allow further processing. -:param int remoteID: The identifier of the remote capture. +:return: The message that was received. +:rtype: TargetControlMessage )"); - virtual void ReceiveMessage(TargetControlMessage *msg) = 0; + virtual TargetControlMessage ReceiveMessage() = 0; protected: ITargetControl() = default; @@ -854,7 +867,7 @@ struct IRemoteServer :return: ``True`` if the ping was sent and received successfully, ``False`` if something went wrong and the connection is no longer alive. -:rtype: bool +:rtype: ``bool`` )"); virtual bool Ping() = 0; @@ -862,22 +875,24 @@ struct IRemoteServer These will be strings like "D3D11" or "OpenGL". -:param local local: A reference to a list receive the names of the local proxies. +:return: A list of names of the local proxies. +:rtype: ``list`` of ``str`` )"); - virtual bool LocalProxies(rdctype::array *local) = 0; + virtual rdctype::array LocalProxies() = 0; DOCUMENT(R"(Retrieve a list of renderers supported by the remote server. These will be strings like "D3D11" or "OpenGL". -:param local remote: A reference to a list receive the names of the remote renderers. +:return: A list of names of the remote renderers. +:rtype: ``list`` of ``str`` )"); - virtual bool RemoteSupportedReplays(rdctype::array *remote) = 0; + virtual rdctype::array RemoteSupportedReplays() = 0; DOCUMENT(R"(Retrieve the path on the remote system where browsing can begin. :return: The 'home' path where browsing for files or folders can begin. -:rtype: str +:rtype: ``str`` )"); virtual rdctype::str GetHomeFolder() = 0; @@ -887,7 +902,7 @@ If an error occurs, a single :class:`PathEntry` will be returned with appropriat :param str path: The remote path to list. :return: The contents of the specified folder. -:rtype: PathEntry list +:rtype: ``list`` of :class:`PathEntry` )"); virtual rdctype::array ListFolder(const char *path) = 0; @@ -904,10 +919,10 @@ This happens on the remote system, so all paths are relative to the remote files :param CaptureOptions opts: The capture options to use when injecting into the program. :return: The ident where the new application is listening for target control, or 0 if something went wrong. -:rtype: int +:rtype: ``int`` )"); virtual uint32_t ExecuteAndInject(const char *app, const char *workingDir, const char *cmdLine, - void *env, const CaptureOptions *opts) = 0; + void *env, const CaptureOptions &opts) = 0; DOCUMENT(R"(Take ownership over a capture file. @@ -931,9 +946,9 @@ the capture must be available on the machine where the replay happens. :param str filename: The path to the file on the local system. :param float progress: A reference to a float value that will be updated as the copy happens from - ``0.0`` to ``1.0``. + ``0.0`` to ``1.0``. The parameter can be ``None`` if no progress update is desired. :return: The path on the remote system where the capture was saved temporarily. -:rtype: str +:rtype: ``str`` )"); virtual rdctype::str CopyCaptureToRemote(const char *filename, float *progress) = 0; @@ -944,7 +959,7 @@ This function will block until the copy is fully complete, or an error has occur :param str remotepath: The remote path where the file should be copied from. :param str localpath: The local path where the file should be saved. :param float progress: A reference to a ``float`` value that will be updated as the copy happens - from ``0.0`` to ``1.0``. + from ``0.0`` to ``1.0``. The parameter can be ``None`` if no progress update is desired. )"); virtual void CopyCaptureFromRemote(const char *remotepath, const char *localpath, float *progress) = 0; @@ -965,14 +980,14 @@ or an error has occurred. :param str logfile: The path on the remote system where the file is. If the file is only available locally you can use :meth:`CopyCaptureToRemote` to transfer it over the remote connection. :param float progress: A reference to a ``float`` value that will be updated as the copy happens - from ``0.0`` to ``1.0``. -:param ReplayRenderer rend: A reference to a :class:`ReplayRenderer` where the capture handle will - be stored. -:return: The status of opening the capture, whether success or failure. -:rtype: ReplayStatus + from ``0.0`` to ``1.0``. The parameter can be ``None`` if no progress update is desired. +:return: A tuple containing the status of opening the capture, whether success or failure, and the + resulting :class:`ReplayRenderer` handle if successful. +:rtype: ``tuple`` of :class:`ReplayStatus` and :class:`ReplayRenderer` )"); - virtual ReplayStatus OpenCapture(uint32_t proxyid, const char *logfile, float *progress, - IReplayRenderer **rend) = 0; + virtual rdctype::pair OpenCapture(uint32_t proxyid, + const char *logfile, + float *progress) = 0; DOCUMENT(R"(Close a capture analysis handle previously opened by :meth:`OpenCapture`. @@ -1020,7 +1035,7 @@ float. :param int half: The half stored as an int. :return: The floating point equivalent. -:rtype: float +:rtype: ``float`` )"); extern "C" RENDERDOC_API float RENDERDOC_CC Maths_HalfToFloat(uint16_t half); @@ -1029,7 +1044,7 @@ integer). :param float f: The floating point value. :return: The nearest half-float equivalent stored as an int. -:rtype: int +:rtype: ``int`` )"); extern "C" RENDERDOC_API uint16_t RENDERDOC_CC Maths_FloatToHalf(float f); @@ -1040,7 +1055,7 @@ topology. :param Topology topology: The topology to query about. :return: The number of vertices in a single primitive. -:rtype: int +:rtype: ``int`` )"); extern "C" RENDERDOC_API uint32_t RENDERDOC_CC Topology_NumVerticesPerPrimitive(Topology topology); @@ -1051,7 +1066,7 @@ case of strip topologies. :param Topology topology: The topology to query about. :param int primitive: The primitive to query about. :return: The vertex offset where the primitive starts. -:rtype: int +:rtype: ``int`` )"); extern "C" RENDERDOC_API uint32_t RENDERDOC_CC Topology_VertexOffset(Topology topology, uint32_t primitive); @@ -1123,7 +1138,7 @@ This function will block for a variable timeout depending on how many targets ar :param str host: The hostname to connect to. If blank, the local machine is used. :param int nextIdent: The next ident to scan. :return: The ident of the next active target, or ``0xffffffff`` if no other targets exist. -:rtype: int +:rtype: ``int`` )"); extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_EnumerateRemoteTargets(const char *host, uint32_t nextIdent); @@ -1135,7 +1150,7 @@ extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_EnumerateRemoteTargets( DOCUMENT(R"(Retrieves the default ports where remote servers listen. :return: The port where remote servers listen by default. -:rtype: int +:rtype: ``int`` )"); extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_GetDefaultRemoteServerPort(); @@ -1189,7 +1204,7 @@ all new processes started on the system. )"); extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_StartGlobalHook(const char *pathmatch, const char *logfile, - const CaptureOptions *opts); + const CaptureOptions &opts); DOCUMENT(R"(Launch an application and inject into it to allow capturing. @@ -1203,11 +1218,11 @@ DOCUMENT(R"(Launch an application and inject into it to allow capturing. :param bool waitForExit: If ``True`` this function will block until the process exits. :return: The ident where the new application is listening for target control, or 0 if something went wrong. -:rtype: int +:rtype: ``int`` )"); extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_ExecuteAndInject(const char *app, const char *workingDir, const char *cmdLine, void *env, - const char *logfile, const CaptureOptions *opts, bool32 waitForExit); + const char *logfile, const CaptureOptions &opts, bool32 waitForExit); DOCUMENT(R"(Where supported by operating system and permissions, inject into a running process. @@ -1217,10 +1232,10 @@ DOCUMENT(R"(Where supported by operating system and permissions, inject into a r :param bool waitForExit: If ``True`` this function will block until the process exits. :return: The ident where the new application is listening for target control, or 0 if something went wrong. -:rtype: int +:rtype: ``int`` )"); extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_InjectIntoProcess( - uint32_t pid, void *env, const char *logfile, const CaptureOptions *opts, bool32 waitForExit); + uint32_t pid, void *env, const char *logfile, const CaptureOptions &opts, bool32 waitForExit); DOCUMENT(R"(When debugging RenderDoc it can be useful to capture itself by doing a side-build with a temporary name. This function wraps up the use of the in-application API to start a capture. @@ -1267,7 +1282,7 @@ DOCUMENT(R"(Gets the location for the diagnostic log output, shared by captured analysis program. :return: The path to the current log file. -:rtype: str +:rtype: ``str`` )"); extern "C" RENDERDOC_API const char *RENDERDOC_CC RENDERDOC_GetLogFile(); @@ -1295,7 +1310,7 @@ DOCUMENT(R"(Retrieves the version string. This will be in the form "MAJOR.MINOR" :return: The version string. -:rtype: str +:rtype: ``str`` )"); extern "C" RENDERDOC_API const char *RENDERDOC_CC RENDERDOC_GetVersionString(); @@ -1306,7 +1321,7 @@ specific to the particular build and may take many values. A common one is ``-of releases generated upstream. :return: The commit string. -:rtype: str +:rtype: ``str`` )"); extern "C" RENDERDOC_API const char *RENDERDOC_CC RENDERDOC_GetCommitHash(); diff --git a/renderdoc/core/remote_server.cpp b/renderdoc/core/remote_server.cpp index b9f729094..82ca14bbf 100644 --- a/renderdoc/core/remote_server.cpp +++ b/renderdoc/core/remote_server.cpp @@ -450,7 +450,7 @@ static void ActiveRemoteClientThread(void *data) if(threadData->allowExecution) { ident = Process::LaunchAndInjectIntoProcess(app.c_str(), workingDir.c_str(), - cmdLine.c_str(), env, "", &opts, false); + cmdLine.c_str(), env, "", opts, false); } else { @@ -751,24 +751,22 @@ public: return type == eRemoteServer_Ping; } - bool LocalProxies(rdctype::array *out) + rdctype::array LocalProxies() { - if(out == NULL) - return false; + rdctype::array out; - create_array_uninit(*out, m_Proxies.size()); + create_array_uninit(out, m_Proxies.size()); size_t i = 0; for(auto it = m_Proxies.begin(); it != m_Proxies.end(); ++it, ++i) - out->elems[i] = it->second; + out[i] = it->second; - return true; + return out; } - bool RemoteSupportedReplays(rdctype::array *out) + rdctype::array RemoteSupportedReplays() { - if(out == NULL) - return false; + rdctype::array out; { Serialiser sendData("", Serialiser::WRITING, false); @@ -784,7 +782,7 @@ public: uint32_t count = 0; ser->Serialise("", count); - create_array_uninit(*out, count); + create_array_uninit(out, count); for(uint32_t i = 0; i < count; i++) { @@ -793,14 +791,14 @@ public: ser->Serialise("", driver); ser->Serialise("", name); - out->elems[i] = name; + out[i] = name; } delete ser; } } - return true; + return out; } rdctype::str GetHomeFolder() @@ -897,14 +895,12 @@ public: } uint32_t ExecuteAndInject(const char *app, const char *workingDir, const char *cmdLine, void *env, - const CaptureOptions *opts) + const CaptureOptions &opts) { const char *host = hostname().c_str(); if(Android::IsHostADB(host)) return Android::StartAndroidPackageForCapture(host, app); - CaptureOptions capopts = opts ? *opts : CaptureOptions(); - string appstr = app && app[0] ? app : ""; string workstr = workingDir && workingDir[0] ? workingDir : ""; string cmdstr = cmdLine && cmdLine[0] ? cmdLine : ""; @@ -915,7 +911,7 @@ public: sendData.Serialise("app", appstr); sendData.Serialise("workingDir", workstr); sendData.Serialise("cmdLine", cmdstr); - sendData.Serialise("opts", capopts); + sendData.Serialise("opts", (CaptureOptions &)opts); uint64_t envListSize = 0; if(envList) @@ -1017,18 +1013,20 @@ public: Send(eRemoteServer_TakeOwnershipCapture, sendData); } - ReplayStatus OpenCapture(uint32_t proxyid, const char *filename, float *progress, - IReplayRenderer **rend) + rdctype::pair OpenCapture(uint32_t proxyid, const char *filename, + float *progress) { - if(rend == NULL) - return ReplayStatus::InternalError; + rdctype::pair ret; + ret.first = ReplayStatus::InternalError; + ret.second = NULL; string logfile = filename; if(proxyid != ~0U && proxyid >= m_Proxies.size()) { RDCERR("Invalid proxy driver id %d specified for remote renderer", proxyid); - return ReplayStatus::InternalError; + ret.first = ReplayStatus::InternalError; + return ret; } float dummy = 0.0f; @@ -1060,7 +1058,10 @@ public: } if(!m_Socket || progressSer == NULL || type != eRemoteServer_LogOpened) - return ReplayStatus::NetworkIOFailed; + { + ret.first = ReplayStatus::NetworkIOFailed; + return ret; + } ReplayStatus status = ReplayStatus::Succeeded; progressSer->Serialise("status", status); @@ -1070,7 +1071,10 @@ public: *progress = 1.0f; if(status != ReplayStatus::Succeeded) - return status; + { + ret.first = status; + return ret; + } RDCLOG("Log ready on replay host"); @@ -1081,26 +1085,28 @@ public: { if(proxyDriver) proxyDriver->Shutdown(); - return status; + ret.first = status; + return ret; } - ReplayRenderer *ret = new ReplayRenderer(); + ReplayRenderer *rend = new ReplayRenderer(); ReplayProxy *proxy = new ReplayProxy(m_Socket, proxyDriver); - status = ret->SetDevice(proxy); + status = rend->SetDevice(proxy); if(status != ReplayStatus::Succeeded) { - SAFE_DELETE(ret); - return status; + SAFE_DELETE(rend); + ret.first = status; + return ret; } // ReplayRenderer takes ownership of the ProxySerialiser (as IReplayDriver) // and it cleans itself up in Shutdown. - *rend = ret; - - return ReplayStatus::Succeeded; + ret.first = ReplayStatus::Succeeded; + ret.second = rend; + return ret; } void CloseCapture(IReplayRenderer *rend) @@ -1150,10 +1156,10 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC RemoteServer_Ping(IRemoteServer *re return remote->Ping(); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC -RemoteServer_LocalProxies(IRemoteServer *remote, rdctype::array *out) +extern "C" RENDERDOC_API void RENDERDOC_CC RemoteServer_LocalProxies(IRemoteServer *remote, + rdctype::array *out) { - return remote->LocalProxies(out); + *out = remote->LocalProxies(); } extern "C" RENDERDOC_API void RENDERDOC_CC RemoteServer_GetHomeFolder(IRemoteServer *remote, @@ -1173,15 +1179,15 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RemoteServer_ListFolder(IRemoteServer *dirlist = files; } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC +extern "C" RENDERDOC_API void RENDERDOC_CC RemoteServer_RemoteSupportedReplays(IRemoteServer *remote, rdctype::array *out) { - return remote->RemoteSupportedReplays(out); + *out = remote->RemoteSupportedReplays(); } extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RemoteServer_ExecuteAndInject(IRemoteServer *remote, const char *app, const char *workingDir, - const char *cmdLine, void *env, const CaptureOptions *opts) + const char *cmdLine, void *env, const CaptureOptions &opts) { return remote->ExecuteAndInject(app, workingDir, cmdLine, env, opts); } @@ -1216,7 +1222,10 @@ extern "C" RENDERDOC_API ReplayStatus RENDERDOC_CC RemoteServer_OpenCapture(IRem float *progress, IReplayRenderer **rend) { - return remote->OpenCapture(proxyid, logfile, progress, rend); + auto ret = remote->OpenCapture(proxyid, logfile, progress); + if(rend) + *rend = ret.second; + return ret.first; } extern "C" RENDERDOC_API void RENDERDOC_CC RemoteServer_CloseCapture(IRemoteServer *remote, diff --git a/renderdoc/core/target_control.cpp b/renderdoc/core/target_control.cpp index e20ffb25c..1dc851726 100644 --- a/renderdoc/core/target_control.cpp +++ b/renderdoc/core/target_control.cpp @@ -484,12 +484,13 @@ public: } } - void ReceiveMessage(TargetControlMessage *msg) + TargetControlMessage ReceiveMessage() { + TargetControlMessage msg; if(m_Socket == NULL) { - msg->Type = TargetControlMessageType::Disconnected; - return; + msg.Type = TargetControlMessageType::Disconnected; + return msg; } if(!m_Socket->IsRecvDataWaiting()) @@ -497,15 +498,15 @@ public: if(!m_Socket->Connected()) { SAFE_DELETE(m_Socket); - msg->Type = TargetControlMessageType::Disconnected; + msg.Type = TargetControlMessageType::Disconnected; } else { Threading::Sleep(2); - msg->Type = TargetControlMessageType::Noop; + msg.Type = TargetControlMessageType::Noop; } - return; + return msg; } PacketType type; @@ -517,8 +518,8 @@ public: { SAFE_DELETE(ser); - msg->Type = TargetControlMessageType::Disconnected; - return; + msg.Type = TargetControlMessageType::Disconnected; + return msg; } else { @@ -526,8 +527,8 @@ public: { SAFE_DELETE(ser); - msg->Type = TargetControlMessageType::Noop; - return; + msg.Type = TargetControlMessageType::Noop; + return msg; } else if(type == ePacket_Busy) { @@ -539,94 +540,95 @@ public: SAFE_DELETE(m_Socket); RDCLOG("Got busy signal: '%s", existingClient.c_str()); - msg->Type = TargetControlMessageType::Busy; - msg->Busy.ClientName = existingClient; - return; + msg.Type = TargetControlMessageType::Busy; + msg.Busy.ClientName = existingClient; + return msg; } else if(type == ePacket_CopyCapture) { - msg->Type = TargetControlMessageType::CaptureCopied; + msg.Type = TargetControlMessageType::CaptureCopied; - ser->Serialise("", msg->NewCapture.ID); + ser->Serialise("", msg.NewCapture.ID); SAFE_DELETE(ser); - msg->NewCapture.path = m_CaptureCopies[msg->NewCapture.ID]; + msg.NewCapture.path = m_CaptureCopies[msg.NewCapture.ID]; - if(!RecvChunkedFile(m_Socket, ePacket_CopyCapture, msg->NewCapture.path.elems, ser, NULL)) + if(!RecvChunkedFile(m_Socket, ePacket_CopyCapture, msg.NewCapture.path.elems, ser, NULL)) { SAFE_DELETE(ser); SAFE_DELETE(m_Socket); - msg->Type = TargetControlMessageType::Disconnected; - return; + msg.Type = TargetControlMessageType::Disconnected; + return msg; } - m_CaptureCopies.erase(msg->NewCapture.ID); + m_CaptureCopies.erase(msg.NewCapture.ID); SAFE_DELETE(ser); - return; + return msg; } else if(type == ePacket_NewChild) { - msg->Type = TargetControlMessageType::NewChild; + msg.Type = TargetControlMessageType::NewChild; - ser->Serialise("", msg->NewChild.PID); - ser->Serialise("", msg->NewChild.ident); + ser->Serialise("", msg.NewChild.PID); + ser->Serialise("", msg.NewChild.ident); - RDCLOG("Got a new child process: %u %u", msg->NewChild.PID, msg->NewChild.ident); + RDCLOG("Got a new child process: %u %u", msg.NewChild.PID, msg.NewChild.ident); SAFE_DELETE(ser); - return; + return msg; } else if(type == ePacket_NewCapture) { - msg->Type = TargetControlMessageType::NewCapture; + msg.Type = TargetControlMessageType::NewCapture; - ser->Serialise("", msg->NewCapture.ID); - ser->Serialise("", msg->NewCapture.timestamp); + ser->Serialise("", msg.NewCapture.ID); + ser->Serialise("", msg.NewCapture.timestamp); string path; ser->Serialise("", path); - msg->NewCapture.path = path; - msg->NewCapture.local = m_Local; + msg.NewCapture.path = path; + msg.NewCapture.local = m_Local; int32_t thumblen = 0; ser->Serialise("", thumblen); - create_array_uninit(msg->NewCapture.thumbnail, thumblen); + create_array_uninit(msg.NewCapture.thumbnail, thumblen); size_t l = 0; - byte *buf = &msg->NewCapture.thumbnail[0]; + byte *buf = &msg.NewCapture.thumbnail[0]; ser->SerialiseBuffer("", buf, l); - RDCLOG("Got a new capture: %d (time %llu) %d byte thumbnail", msg->NewCapture.ID, - msg->NewCapture.timestamp, thumblen); + RDCLOG("Got a new capture: %d (time %llu) %d byte thumbnail", msg.NewCapture.ID, + msg.NewCapture.timestamp, thumblen); SAFE_DELETE(ser); - return; + return msg; } else if(type == ePacket_RegisterAPI) { - msg->Type = TargetControlMessageType::RegisterAPI; + msg.Type = TargetControlMessageType::RegisterAPI; ser->Serialise("", m_API); - msg->RegisterAPI.APIName = m_API; + msg.RegisterAPI.APIName = m_API; RDCLOG("Used API: %s", m_API.c_str()); SAFE_DELETE(ser); - return; + return msg; } } SAFE_DELETE(ser); - msg->Type = TargetControlMessageType::Noop; + msg.Type = TargetControlMessageType::Noop; + return msg; } private: @@ -692,7 +694,7 @@ extern "C" RENDERDOC_API void RENDERDOC_CC TargetControl_DeleteCapture(ITargetCo extern "C" RENDERDOC_API void RENDERDOC_CC TargetControl_ReceiveMessage(ITargetControl *control, TargetControlMessage *msg) { - control->ReceiveMessage(msg); + *msg = control->ReceiveMessage(); } extern "C" RENDERDOC_API ITargetControl *RENDERDOC_CC RENDERDOC_CreateTargetControl( diff --git a/renderdoc/os/os_specific.h b/renderdoc/os/os_specific.h index 9f53e8b78..07ecd8f66 100644 --- a/renderdoc/os/os_specific.h +++ b/renderdoc/os/os_specific.h @@ -64,9 +64,9 @@ void RegisterEnvironmentModification(EnvironmentModification modif); void ApplyEnvironmentModification(); -void StartGlobalHook(const char *pathmatch, const char *logfile, const CaptureOptions *opts); +void StartGlobalHook(const char *pathmatch, const char *logfile, const CaptureOptions &opts); uint32_t InjectIntoProcess(uint32_t pid, EnvironmentModification *env, const char *logfile, - const CaptureOptions *opts, bool waitForExit); + const CaptureOptions &opts, bool waitForExit); struct ProcessResult { string strStdout, strStderror; @@ -76,7 +76,7 @@ uint32_t LaunchProcess(const char *app, const char *workingDir, const char *cmdL ProcessResult *result = NULL); uint32_t LaunchAndInjectIntoProcess(const char *app, const char *workingDir, const char *cmdLine, EnvironmentModification *env, const char *logfile, - const CaptureOptions *opts, bool waitForExit); + const CaptureOptions &opts, bool waitForExit); void *LoadModule(const char *module); void *GetFunctionAddress(void *module, const char *function); uint32_t GetCurrentPID(); diff --git a/renderdoc/os/posix/posix_process.cpp b/renderdoc/os/posix/posix_process.cpp index ff269acfa..9e9cf3c09 100644 --- a/renderdoc/os/posix/posix_process.cpp +++ b/renderdoc/os/posix/posix_process.cpp @@ -404,7 +404,7 @@ static pid_t RunProcess(const char *app, const char *workingDir, const char *cmd } uint32_t Process::InjectIntoProcess(uint32_t pid, EnvironmentModification *env, const char *logfile, - const CaptureOptions *opts, bool waitForExit) + const CaptureOptions &opts, bool waitForExit) { RDCUNIMPLEMENTED("Injecting into already running processes on linux"); return 0; @@ -461,7 +461,7 @@ uint32_t Process::LaunchProcess(const char *app, const char *workingDir, const c uint32_t Process::LaunchAndInjectIntoProcess(const char *app, const char *workingDir, const char *cmdLine, EnvironmentModification *envList, - const char *logfile, const CaptureOptions *opts, + const char *logfile, const CaptureOptions &opts, bool waitForExit) { if(app == NULL || app[0] == 0) @@ -504,7 +504,7 @@ uint32_t Process::LaunchAndInjectIntoProcess(const char *app, const char *workin string optstr; { optstr.reserve(sizeof(CaptureOptions) * 2 + 1); - byte *b = (byte *)opts; + byte *b = (byte *)&opts; for(size_t i = 0; i < sizeof(CaptureOptions); i++) { optstr.push_back(char('a' + ((b[i] >> 4) & 0xf))); @@ -607,7 +607,7 @@ uint32_t Process::LaunchAndInjectIntoProcess(const char *app, const char *workin return ret; } -void Process::StartGlobalHook(const char *pathmatch, const char *logfile, const CaptureOptions *opts) +void Process::StartGlobalHook(const char *pathmatch, const char *logfile, const CaptureOptions &opts) { RDCUNIMPLEMENTED("Global hooking of all processes on linux"); } diff --git a/renderdoc/os/win32/sys_win32_hooks.cpp b/renderdoc/os/win32/sys_win32_hooks.cpp index 29004ddad..653df66fc 100644 --- a/renderdoc/os/win32/sys_win32_hooks.cpp +++ b/renderdoc/os/win32/sys_win32_hooks.cpp @@ -320,7 +320,7 @@ private: // inherit logfile and capture options uint32_t ident = RENDERDOC_InjectIntoProcess(lpProcessInformation->dwProcessId, NULL, RenderDoc::Inst().GetLogFile(), - &RenderDoc::Inst().GetCaptureOptions(), false); + RenderDoc::Inst().GetCaptureOptions(), false); RenderDoc::Inst().AddChildProcess((uint32_t)lpProcessInformation->dwProcessId, ident); } @@ -404,7 +404,7 @@ private: // inherit logfile and capture options uint32_t ident = RENDERDOC_InjectIntoProcess(lpProcessInformation->dwProcessId, NULL, RenderDoc::Inst().GetLogFile(), - &RenderDoc::Inst().GetCaptureOptions(), false); + RenderDoc::Inst().GetCaptureOptions(), false); RenderDoc::Inst().AddChildProcess((uint32_t)lpProcessInformation->dwProcessId, ident); } diff --git a/renderdoc/os/win32/win32_process.cpp b/renderdoc/os/win32/win32_process.cpp index af563292d..5cf1cd3f5 100644 --- a/renderdoc/os/win32/win32_process.cpp +++ b/renderdoc/os/win32/win32_process.cpp @@ -481,12 +481,8 @@ static PROCESS_INFORMATION RunProcess(const char *app, const char *workingDir, c } uint32_t Process::InjectIntoProcess(uint32_t pid, EnvironmentModification *env, const char *logfile, - const CaptureOptions *opts, bool waitForExit) + const CaptureOptions &opts, bool waitForExit) { - CaptureOptions options; - if(opts) - options = *opts; - wstring wlogfile = logfile == NULL ? L"" : StringFormat::UTF82Wide(logfile); HANDLE hProcess = @@ -494,7 +490,7 @@ uint32_t Process::InjectIntoProcess(uint32_t pid, EnvironmentModification *env, PROCESS_VM_WRITE | PROCESS_VM_READ | SYNCHRONIZE, FALSE, pid); - if(options.DelayForDebugger > 0) + if(opts.DelayForDebugger > 0) { RDCDEBUG("Waiting for debugger attach to %lu", pid); uint32_t timeout = 0; @@ -508,14 +504,14 @@ uint32_t Process::InjectIntoProcess(uint32_t pid, EnvironmentModification *env, Sleep(10); timeout += 10; - if(timeout > options.DelayForDebugger * 1000) + if(timeout > opts.DelayForDebugger * 1000) break; } if(debuggerAttached) RDCDEBUG("Debugger attach detected after %.2f s", float(timeout) / 1000.0f); else - RDCDEBUG("Timed out waiting for debugger, gave up after %u s", options.DelayForDebugger); + RDCDEBUG("Timed out waiting for debugger, gave up after %u s", opts.DelayForDebugger); } RDCLOG("Injecting renderdoc into process %lu", pid); @@ -732,7 +728,7 @@ uint32_t Process::InjectIntoProcess(uint32_t pid, EnvironmentModification *env, string optstr; { optstr.reserve(sizeof(CaptureOptions) * 2 + 1); - byte *b = (byte *)opts; + byte *b = (byte *)&opts; for(size_t i = 0; i < sizeof(CaptureOptions); i++) { optstr.push_back(char('a' + ((b[i] >> 4) & 0xf))); @@ -868,9 +864,8 @@ uint32_t Process::InjectIntoProcess(uint32_t pid, EnvironmentModification *env, InjectFunctionCall(hProcess, loc, "RENDERDOC_SetDebugLogFile", (void *)debugLogfile.c_str(), debugLogfile.size() + 1); - if(opts != NULL) - InjectFunctionCall(hProcess, loc, "INTERNAL_SetCaptureOptions", (CaptureOptions *)opts, - sizeof(CaptureOptions)); + InjectFunctionCall(hProcess, loc, "INTERNAL_SetCaptureOptions", (CaptureOptions *)&opts, + sizeof(CaptureOptions)); InjectFunctionCall(hProcess, loc, "INTERNAL_GetTargetControlIdent", &controlident, sizeof(controlident)); @@ -965,7 +960,7 @@ uint32_t Process::LaunchProcess(const char *app, const char *workingDir, const c uint32_t Process::LaunchAndInjectIntoProcess(const char *app, const char *workingDir, const char *cmdLine, EnvironmentModification *env, - const char *logfile, const CaptureOptions *opts, + const char *logfile, const CaptureOptions &opts, bool waitForExit) { void *func = @@ -1003,7 +998,7 @@ uint32_t Process::LaunchAndInjectIntoProcess(const char *app, const char *workin return ret; } -void Process::StartGlobalHook(const char *pathmatch, const char *logfile, const CaptureOptions *opts) +void Process::StartGlobalHook(const char *pathmatch, const char *logfile, const CaptureOptions &opts) { if(pathmatch == NULL) return; @@ -1034,7 +1029,7 @@ void Process::StartGlobalHook(const char *pathmatch, const char *logfile, const string optstr; { optstr.reserve(sizeof(CaptureOptions) * 2 + 1); - byte *b = (byte *)opts; + byte *b = (byte *)&opts; for(size_t i = 0; i < sizeof(CaptureOptions); i++) { optstr.push_back(char('a' + ((b[i] >> 4) & 0xf))); diff --git a/renderdoc/replay/entry_points.cpp b/renderdoc/replay/entry_points.cpp index 10375f4a7..fb10bb6fb 100644 --- a/renderdoc/replay/entry_points.cpp +++ b/renderdoc/replay/entry_points.cpp @@ -401,7 +401,7 @@ RENDERDOC_CreateReplayRenderer(const char *logfile, float *progress, IReplayRend extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_ExecuteAndInject(const char *app, const char *workingDir, const char *cmdLine, void *env, - const char *logfile, const CaptureOptions *opts, bool32 waitForExit) + const char *logfile, const CaptureOptions &opts, bool32 waitForExit) { return Process::LaunchAndInjectIntoProcess(app, workingDir, cmdLine, (Process::EnvironmentModification *)env, logfile, opts, @@ -415,13 +415,13 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_GetDefaultCaptureOptions(Ca extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_StartGlobalHook(const char *pathmatch, const char *logfile, - const CaptureOptions *opts) + const CaptureOptions &opts) { Process::StartGlobalHook(pathmatch, logfile, opts); } extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_InjectIntoProcess( - uint32_t pid, void *env, const char *logfile, const CaptureOptions *opts, bool32 waitForExit) + uint32_t pid, void *env, const char *logfile, const CaptureOptions &opts, bool32 waitForExit) { return Process::InjectIntoProcess(pid, (Process::EnvironmentModification *)env, logfile, opts, waitForExit != 0); diff --git a/renderdoc/replay/replay_output.cpp b/renderdoc/replay/replay_output.cpp index af3cb166b..d20632f03 100644 --- a/renderdoc/replay/replay_output.cpp +++ b/renderdoc/replay/replay_output.cpp @@ -117,7 +117,7 @@ ReplayOutput::~ReplayOutput() ClearThumbnails(); } -bool ReplayOutput::SetTextureDisplay(const TextureDisplay &o) +void ReplayOutput::SetTextureDisplay(const TextureDisplay &o) { if(o.overlay != m_RenderData.texDisplay.overlay) { @@ -133,16 +133,14 @@ bool ReplayOutput::SetTextureDisplay(const TextureDisplay &o) } m_RenderData.texDisplay = o; m_MainOutput.dirty = true; - return true; } -bool ReplayOutput::SetMeshDisplay(const MeshDisplay &o) +void ReplayOutput::SetMeshDisplay(const MeshDisplay &o) { if(o.showWholePass != m_RenderData.meshDisplay.showWholePass) m_OverlayDirty = true; m_RenderData.meshDisplay = o; m_MainOutput.dirty = true; - return true; } void ReplayOutput::SetFrameEvent(int eventID) @@ -214,14 +212,12 @@ void ReplayOutput::RefreshOverlay() } } -bool ReplayOutput::ClearThumbnails() +void ReplayOutput::ClearThumbnails() { for(size_t i = 0; i < m_Thumbnails.size(); i++) m_pDevice->DestroyOutputWindow(m_Thumbnails[i].outputID); m_Thumbnails.clear(); - - return true; } bool ReplayOutput::SetPixelContext(WindowingSystem system, void *data) @@ -232,7 +228,7 @@ bool ReplayOutput::SetPixelContext(WindowingSystem system, void *data) RDCASSERT(m_PixelContext.outputID > 0); - return true; + return m_PixelContext.outputID != 0; } bool ReplayOutput::AddThumbnail(WindowingSystem system, void *data, ResourceId texID, @@ -284,17 +280,10 @@ bool ReplayOutput::AddThumbnail(WindowingSystem system, void *data, ResourceId t return true; } -bool ReplayOutput::GetMinMax(PixelValue *minval, PixelValue *maxval) +rdctype::pair ReplayOutput::GetMinMax() { - PixelValue *a = minval; - PixelValue *b = maxval; - - PixelValue dummy; - - if(a == NULL) - a = &dummy; - if(b == NULL) - b = &dummy; + PixelValue minval; + PixelValue maxval; ResourceId tex = m_pDevice->GetLiveID(m_RenderData.texDisplay.texid); @@ -311,15 +300,13 @@ bool ReplayOutput::GetMinMax(PixelValue *minval, PixelValue *maxval) sample = 0; } - return m_pDevice->GetMinMax(tex, slice, mip, sample, typeHint, &a->value_f[0], &b->value_f[0]); + m_pDevice->GetMinMax(tex, slice, mip, sample, typeHint, &minval.value_f[0], &minval.value_f[0]); + + return rdctype::make_pair(minval, maxval); } -bool ReplayOutput::GetHistogram(float minval, float maxval, bool channels[4], - rdctype::array *histogram) +rdctype::array ReplayOutput::GetHistogram(float minval, float maxval, bool channels[4]) { - if(histogram == NULL) - return false; - vector hist; ResourceId tex = m_pDevice->GetLiveID(m_RenderData.texDisplay.texid); @@ -337,22 +324,20 @@ bool ReplayOutput::GetHistogram(float minval, float maxval, bool channels[4], sample = 0; } - bool ret = - m_pDevice->GetHistogram(tex, slice, mip, sample, typeHint, minval, maxval, channels, hist); + m_pDevice->GetHistogram(tex, slice, mip, sample, typeHint, minval, maxval, channels, hist); - if(ret) - *histogram = hist; - - return ret; + return hist; } -bool ReplayOutput::PickPixel(ResourceId tex, bool customShader, uint32_t x, uint32_t y, - uint32_t sliceFace, uint32_t mip, uint32_t sample, PixelValue *ret) +PixelValue ReplayOutput::PickPixel(ResourceId tex, bool customShader, uint32_t x, uint32_t y, + uint32_t sliceFace, uint32_t mip, uint32_t sample) { - if(ret == NULL || tex == ResourceId()) - return false; + PixelValue ret; - RDCEraseEl(ret->value_f); + RDCEraseEl(ret.value_f); + + if(tex == ResourceId()) + return ret; bool decodeRamp = false; @@ -376,20 +361,20 @@ bool ReplayOutput::PickPixel(ResourceId tex, bool customShader, uint32_t x, uint } m_pDevice->PickPixel(m_pDevice->GetLiveID(tex), x, y, sliceFace, mip, sample, typeHint, - ret->value_f); + ret.value_f); if(decodeRamp) { for(size_t c = 0; c < ARRAY_COUNT(overdrawRamp); c++) { - if(fabs(ret->value_f[0] - overdrawRamp[c].x) < 0.00005f && - fabs(ret->value_f[1] - overdrawRamp[c].y) < 0.00005f && - fabs(ret->value_f[2] - overdrawRamp[c].z) < 0.00005f) + if(fabs(ret.value_f[0] - overdrawRamp[c].x) < 0.00005f && + fabs(ret.value_f[1] - overdrawRamp[c].y) < 0.00005f && + fabs(ret.value_f[2] - overdrawRamp[c].z) < 0.00005f) { - ret->value_i[0] = (int32_t)c; - ret->value_i[1] = 0; - ret->value_i[2] = 0; - ret->value_i[3] = 0; + ret.value_i[0] = (int32_t)c; + ret.value_i[1] = 0; + ret.value_i[2] = 0; + ret.value_i[3] = 0; break; } } @@ -398,44 +383,44 @@ bool ReplayOutput::PickPixel(ResourceId tex, bool customShader, uint32_t x, uint if(m_RenderData.texDisplay.overlay == DebugOverlay::TriangleSizePass || m_RenderData.texDisplay.overlay == DebugOverlay::TriangleSizeDraw) { - float bucket = (float)ret->value_i[0]; + float bucket = (float)ret.value_i[0]; // decode bucket into approximate triangle area if(bucket <= 0.5f) - ret->value_f[0] = 0.0f; + ret.value_f[0] = 0.0f; else if(bucket < 2.0f) - ret->value_f[0] = 16.0f; + ret.value_f[0] = 16.0f; else - ret->value_f[0] = -2.5f * logf(1.0f + (bucket - 22.0f) / 20.1f); + ret.value_f[0] = -2.5f * logf(1.0f + (bucket - 22.0f) / 20.1f); } } - return true; + return ret; } -uint32_t ReplayOutput::PickVertex(uint32_t eventID, uint32_t x, uint32_t y, uint32_t *pickedInstance) +rdctype::pair ReplayOutput::PickVertex(uint32_t eventID, uint32_t x, uint32_t y) { DrawcallDescription *draw = m_pRenderer->GetDrawcallByEID(eventID); + const rdctype::pair errorReturn = rdctype::make_pair(~0U, ~0U); + if(!draw) - return ~0U; + return errorReturn; if(m_RenderData.meshDisplay.type == MeshDataStage::Unknown) - return ~0U; + return errorReturn; if(!(draw->flags & DrawFlags::Drawcall)) - return ~0U; + return errorReturn; MeshDisplay cfg = m_RenderData.meshDisplay; if(cfg.position.buf == ResourceId()) - return ~0U; + return errorReturn; cfg.position.buf = m_pDevice->GetLiveID(cfg.position.buf); cfg.position.idxbuf = m_pDevice->GetLiveID(cfg.position.idxbuf); cfg.second.buf = m_pDevice->GetLiveID(cfg.second.buf); cfg.second.idxbuf = m_pDevice->GetLiveID(cfg.second.idxbuf); - *pickedInstance = 0; - // input data either doesn't vary with instance, or is trivial (all verts the same for that // element), so only care about fetching the right instance for post-VS stages if((draw->flags & DrawFlags::Instanced) && m_RenderData.meshDisplay.type != MeshDataStage::VSIn) @@ -469,30 +454,27 @@ uint32_t ReplayOutput::PickVertex(uint32_t eventID, uint32_t x, uint32_t y, uint if(fmt.buf != ResourceId()) cfg.position.offset = fmt.offset + elemOffset; - uint32_t ret = m_pDevice->PickVertex(m_EventID, cfg, x, y); - if(ret != ~0U) + uint32_t vert = m_pDevice->PickVertex(m_EventID, cfg, x, y); + if(vert != ~0U) { - *pickedInstance = inst; - return ret; + return rdctype::make_pair(vert, inst); } } - return ~0U; + return errorReturn; } else { - return m_pDevice->PickVertex(m_EventID, cfg, x, y); + return rdctype::make_pair(m_pDevice->PickVertex(m_EventID, cfg, x, y), 0U); } } -bool ReplayOutput::SetPixelContextLocation(uint32_t x, uint32_t y) +void ReplayOutput::SetPixelContextLocation(uint32_t x, uint32_t y) { m_ContextX = RDCMAX((float)x, 0.0f); m_ContextY = RDCMAX((float)y, 0.0f); DisplayContext(); - - return true; } void ReplayOutput::DisablePixelContext() @@ -568,7 +550,7 @@ void ReplayOutput::DisplayContext() m_pDevice->FlipOutputWindow(m_PixelContext.outputID); } -bool ReplayOutput::Display() +void ReplayOutput::Display() { if(m_pDevice->CheckResizeOutputWindow(m_MainOutput.outputID)) { @@ -654,7 +636,7 @@ bool ReplayOutput::Display() m_pDevice->FlipOutputWindow(m_MainOutput.outputID); m_pDevice->BindOutputWindow(m_PixelContext.outputID, false); m_pDevice->FlipOutputWindow(m_PixelContext.outputID); - return true; + return; } m_MainOutput.dirty = false; @@ -669,8 +651,6 @@ bool ReplayOutput::Display() m_pDevice->FlipOutputWindow(m_MainOutput.outputID); DisplayContext(); - - return true; } void ReplayOutput::DisplayTex() @@ -860,20 +840,20 @@ void ReplayOutput::DisplayMesh() m_pDevice->RenderMesh(m_EventID, secondaryDraws, mesh); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_SetTextureDisplay(IReplayOutput *output, - const TextureDisplay &o) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_SetTextureDisplay(IReplayOutput *output, + const TextureDisplay &o) { - return output->SetTextureDisplay(o); + output->SetTextureDisplay(o); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_SetMeshDisplay(IReplayOutput *output, - const MeshDisplay &o) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_SetMeshDisplay(IReplayOutput *output, + const MeshDisplay &o) { - return output->SetMeshDisplay(o); + output->SetMeshDisplay(o); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_ClearThumbnails(IReplayOutput *output) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_ClearThumbnails(IReplayOutput *output) { - return output->ClearThumbnails(); + output->ClearThumbnails(); } extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_AddThumbnail(IReplayOutput *output, WindowingSystem system, @@ -883,9 +863,9 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_AddThumbnail(IReplayOu return output->AddThumbnail(system, data, texID, typeHint); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_Display(IReplayOutput *output) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_Display(IReplayOutput *output) { - return output->Display(); + output->Display(); } extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_SetPixelContext(IReplayOutput *output, @@ -894,10 +874,11 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_SetPixelContext(IRepla { return output->SetPixelContext(system, data); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC -ReplayOutput_SetPixelContextLocation(IReplayOutput *output, uint32_t x, uint32_t y) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_SetPixelContextLocation(IReplayOutput *output, + uint32_t x, + uint32_t y) { - return output->SetPixelContextLocation(x, y); + output->SetPixelContextLocation(x, y); } extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_DisablePixelContext(IReplayOutput *output) { @@ -911,25 +892,27 @@ extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_GetCustomShaderTexID(IRe *id = output->GetCustomShaderTexID(); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_GetMinMax(IReplayOutput *output, - PixelValue *minval, - PixelValue *maxval) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_GetMinMax(IReplayOutput *output, + PixelValue *minval, + PixelValue *maxval) { - return output->GetMinMax(minval, maxval); + auto ret = output->GetMinMax(); + *minval = ret.first; + *maxval = ret.second; } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_GetHistogram(IReplayOutput *output, float minval, float maxval, bool32 channels[4], rdctype::array *histogram) { bool chans[4] = {channels[0] != 0, channels[1] != 0, channels[2] != 0, channels[3] != 0}; - return output->GetHistogram(minval, maxval, chans, histogram); + *histogram = output->GetHistogram(minval, maxval, chans); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_PickPixel( +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_PickPixel( IReplayOutput *output, ResourceId texID, bool32 customShader, uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, uint32_t sample, PixelValue *val) { - return output->PickPixel(texID, customShader != 0, x, y, sliceFace, mip, sample, val); + *val = output->PickPixel(texID, customShader != 0, x, y, sliceFace, mip, sample); } extern "C" RENDERDOC_API uint32_t RENDERDOC_CC ReplayOutput_PickVertex(IReplayOutput *output, @@ -937,5 +920,7 @@ extern "C" RENDERDOC_API uint32_t RENDERDOC_CC ReplayOutput_PickVertex(IReplayOu uint32_t y, uint32_t *pickedInstance) { - return output->PickVertex(eventID, x, y, pickedInstance); + auto ret = output->PickVertex(eventID, x, y); + *pickedInstance = ret.second; + return ret.first; } diff --git a/renderdoc/replay/replay_renderer.cpp b/renderdoc/replay/replay_renderer.cpp index 2aab8e91f..fad93765c 100644 --- a/renderdoc/replay/replay_renderer.cpp +++ b/renderdoc/replay/replay_renderer.cpp @@ -164,7 +164,7 @@ ReplayRenderer::~ReplayRenderer() m_pDevice = NULL; } -bool ReplayRenderer::SetFrameEvent(uint32_t eventID, bool force) +void ReplayRenderer::SetFrameEvent(uint32_t eventID, bool force) { if(eventID != m_EventID || force) { @@ -179,62 +179,31 @@ bool ReplayRenderer::SetFrameEvent(uint32_t eventID, bool force) FetchPipelineState(); } - - return true; } -bool ReplayRenderer::GetD3D11PipelineState(D3D11Pipe::State *state) +D3D11Pipe::State ReplayRenderer::GetD3D11PipelineState() { - if(state) - { - *state = m_D3D11PipelineState; - return true; - } - - return false; + return m_D3D11PipelineState; } -bool ReplayRenderer::GetD3D12PipelineState(D3D12Pipe::State *state) +D3D12Pipe::State ReplayRenderer::GetD3D12PipelineState() { - if(state) - { - *state = m_D3D12PipelineState; - return true; - } - - return false; + return m_D3D12PipelineState; } -bool ReplayRenderer::GetGLPipelineState(GLPipe::State *state) +GLPipe::State ReplayRenderer::GetGLPipelineState() { - if(state) - { - *state = m_GLPipelineState; - return true; - } - - return false; + return m_GLPipelineState; } -bool ReplayRenderer::GetVulkanPipelineState(VKPipe::State *state) +VKPipe::State ReplayRenderer::GetVulkanPipelineState() { - if(state) - { - *state = m_VulkanPipelineState; - return true; - } - - return false; + return m_VulkanPipelineState; } -bool ReplayRenderer::GetFrameInfo(FrameDescription *info) +FrameDescription ReplayRenderer::GetFrameInfo() { - if(info == NULL) - return false; - - *info = m_FrameRecord.frameInfo; - - return true; + return m_FrameRecord.frameInfo; } DrawcallDescription *ReplayRenderer::GetDrawcallByEID(uint32_t eventID) @@ -245,52 +214,36 @@ DrawcallDescription *ReplayRenderer::GetDrawcallByEID(uint32_t eventID) return m_Drawcalls[eventID]; } -bool ReplayRenderer::GetDrawcalls(rdctype::array *draws) +rdctype::array ReplayRenderer::GetDrawcalls() { - if(draws == NULL) - return false; - - *draws = m_FrameRecord.drawcallList; - return true; + return m_FrameRecord.drawcallList; } -bool ReplayRenderer::FetchCounters(GPUCounter *counters, uint32_t numCounters, - rdctype::array *results) +rdctype::array ReplayRenderer::FetchCounters(const rdctype::array &counters) { - if(results == NULL) - return false; - vector counterArray; - counterArray.reserve(numCounters); - for(uint32_t i = 0; i < numCounters; i++) + counterArray.reserve(counters.count); + for(int32_t i = 0; i < counters.count; i++) counterArray.push_back(counters[i]); - *results = m_pDevice->FetchCounters(counterArray); - - return true; + return m_pDevice->FetchCounters(counterArray); } -bool ReplayRenderer::EnumerateCounters(rdctype::array *counters) +rdctype::array ReplayRenderer::EnumerateCounters() { - if(counters == NULL) - return false; - - *counters = m_pDevice->EnumerateCounters(); - - return true; + return m_pDevice->EnumerateCounters(); } -bool ReplayRenderer::DescribeCounter(GPUCounter counterID, CounterDescription *desc) +CounterDescription ReplayRenderer::DescribeCounter(GPUCounter counterID) { - if(desc == NULL) - return false; + CounterDescription ret; - m_pDevice->DescribeCounter(counterID, *desc); + m_pDevice->DescribeCounter(counterID, ret); - return true; + return ret; } -bool ReplayRenderer::GetBuffers(rdctype::array *out) +rdctype::array ReplayRenderer::GetBuffers() { if(m_Buffers.empty()) { @@ -302,16 +255,10 @@ bool ReplayRenderer::GetBuffers(rdctype::array *out) m_Buffers[i] = m_pDevice->GetBuffer(ids[i]); } - if(out) - { - *out = m_Buffers; - return true; - } - - return false; + return m_Buffers; } -bool ReplayRenderer::GetTextures(rdctype::array *out) +rdctype::array ReplayRenderer::GetTextures() { if(m_Textures.empty()) { @@ -323,132 +270,102 @@ bool ReplayRenderer::GetTextures(rdctype::array *out) m_Textures[i] = m_pDevice->GetTexture(ids[i]); } - if(out) - { - *out = m_Textures; - return true; - } - - return false; + return m_Textures; } -bool ReplayRenderer::GetResolve(uint64_t *callstack, uint32_t callstackLen, - rdctype::array *arr) +rdctype::array ReplayRenderer::GetResolve(const rdctype::array &callstack) { - if(arr == NULL || callstack == NULL || callstackLen == 0) - return false; + rdctype::array ret; + + if(callstack.empty()) + return ret; Callstack::StackResolver *resolv = m_pDevice->GetCallstackResolver(); if(resolv == NULL) - { - create_array_uninit(*arr, 1); - arr->elems[0] = ""; - return true; - } + return ret; - create_array_uninit(*arr, callstackLen); - for(size_t i = 0; i < callstackLen; i++) + create_array_uninit(ret, (size_t)callstack.count); + for(int32_t i = 0; i < callstack.count; i++) { Callstack::AddressDetails info = resolv->GetAddr(callstack[i]); - arr->elems[i] = info.formattedString(); + ret[i] = info.formattedString(); } - return true; + return ret; } -bool ReplayRenderer::GetDebugMessages(rdctype::array *msgs) +rdctype::array ReplayRenderer::GetDebugMessages() { - if(msgs) - { - *msgs = m_pDevice->GetDebugMessages(); - return true; - } - - return false; + return m_pDevice->GetDebugMessages(); } -bool ReplayRenderer::GetUsage(ResourceId id, rdctype::array *usage) +rdctype::array ReplayRenderer::GetUsage(ResourceId id) { - if(usage) - { - *usage = m_pDevice->GetUsage(m_pDevice->GetLiveID(id)); - return true; - } - - return false; + return m_pDevice->GetUsage(m_pDevice->GetLiveID(id)); } -bool ReplayRenderer::GetPostVSData(uint32_t instID, MeshDataStage stage, MeshFormat *data) +MeshFormat ReplayRenderer::GetPostVSData(uint32_t instID, MeshDataStage stage) { - if(data == NULL) - return false; - DrawcallDescription *draw = GetDrawcallByEID(m_EventID); MeshFormat ret; RDCEraseEl(ret); if(draw == NULL || !(draw->flags & DrawFlags::Drawcall)) - { - *data = MeshFormat(); - return false; - } + return MeshFormat(); instID = RDCMIN(instID, draw->numInstances - 1); - *data = m_pDevice->GetPostVSBuffers(draw->eventID, instID, stage); - - return true; + return m_pDevice->GetPostVSBuffers(draw->eventID, instID, stage); } -bool ReplayRenderer::GetBufferData(ResourceId buff, uint64_t offset, uint64_t len, - rdctype::array *data) +rdctype::array ReplayRenderer::GetBufferData(ResourceId buff, uint64_t offset, uint64_t len) { - if(data == NULL || buff == ResourceId()) - return false; + rdctype::array ret; + + if(buff == ResourceId()) + return ret; ResourceId liveId = m_pDevice->GetLiveID(buff); if(liveId == ResourceId()) { RDCERR("Couldn't get Live ID for %llu getting buffer data", buff); - return false; + return ret; } vector retData; m_pDevice->GetBufferData(liveId, offset, len, retData); - create_array_init(*data, retData.size(), !retData.empty() ? &retData[0] : NULL); + create_array_init(ret, retData.size(), !retData.empty() ? &retData[0] : NULL); - return true; + return ret; } -bool ReplayRenderer::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip, - rdctype::array *data) +rdctype::array ReplayRenderer::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip) { - if(data == NULL) - return false; + rdctype::array ret; ResourceId liveId = m_pDevice->GetLiveID(tex); if(liveId == ResourceId()) { RDCERR("Couldn't get Live ID for %llu getting texture data", tex); - return false; + return ret; } size_t sz = 0; byte *bytes = m_pDevice->GetTextureData(liveId, arrayIdx, mip, GetTextureDataParams(), sz); if(sz == 0 || bytes == NULL) - create_array_uninit(*data, 0); + create_array_uninit(ret, 0); else - create_array_init(*data, sz, bytes); + create_array_init(ret, sz, bytes); SAFE_DELETE_ARRAY(bytes); - return true; + return ret; } bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) @@ -1245,10 +1162,13 @@ bool ReplayRenderer::SaveTexture(const TextureSave &saveData, const char *path) return success; } -bool ReplayRenderer::PixelHistory(ResourceId target, uint32_t x, uint32_t y, uint32_t slice, - uint32_t mip, uint32_t sampleIdx, CompType typeHint, - rdctype::array *history) +rdctype::array ReplayRenderer::PixelHistory(ResourceId target, uint32_t x, + uint32_t y, uint32_t slice, + uint32_t mip, uint32_t sampleIdx, + CompType typeHint) { + rdctype::array ret; + for(size_t t = 0; t < m_Textures.size(); t++) { if(m_Textures[t].ID == target) @@ -1257,9 +1177,7 @@ bool ReplayRenderer::PixelHistory(ResourceId target, uint32_t x, uint32_t y, uin { RDCDEBUG("PixelHistory out of bounds on %llu (%u,%u) vs (%u,%u)", target, x, y, m_Textures[t].width, m_Textures[t].height); - history->count = 0; - history->elems = NULL; - return false; + return ret; } if(m_Textures[t].msSamp == 1) @@ -1334,64 +1252,55 @@ bool ReplayRenderer::PixelHistory(ResourceId target, uint32_t x, uint32_t y, uin if(events.empty()) { RDCDEBUG("Target %llu not written to before %u", target, m_EventID); - history->count = 0; - history->elems = NULL; - return false; + return ret; } - *history = m_pDevice->PixelHistory(events, m_pDevice->GetLiveID(target), x, y, slice, mip, - sampleIdx, typeHint); + ret = m_pDevice->PixelHistory(events, m_pDevice->GetLiveID(target), x, y, slice, mip, sampleIdx, + typeHint); SetFrameEvent(m_EventID, true); - return true; + return ret; } -bool ReplayRenderer::DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx, - uint32_t instOffset, uint32_t vertOffset, ShaderDebugTrace *trace) +ShaderDebugTrace *ReplayRenderer::DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx, + uint32_t instOffset, uint32_t vertOffset) { - if(trace == NULL) - return false; + ShaderDebugTrace *ret = new ShaderDebugTrace; - *trace = m_pDevice->DebugVertex(m_EventID, vertid, instid, idx, instOffset, vertOffset); + *ret = m_pDevice->DebugVertex(m_EventID, vertid, instid, idx, instOffset, vertOffset); SetFrameEvent(m_EventID, true); - return true; + return ret; } -bool ReplayRenderer::DebugPixel(uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive, - ShaderDebugTrace *trace) +ShaderDebugTrace *ReplayRenderer::DebugPixel(uint32_t x, uint32_t y, uint32_t sample, + uint32_t primitive) { - if(trace == NULL) - return false; + ShaderDebugTrace *ret = new ShaderDebugTrace; - *trace = m_pDevice->DebugPixel(m_EventID, x, y, sample, primitive); + *ret = m_pDevice->DebugPixel(m_EventID, x, y, sample, primitive); SetFrameEvent(m_EventID, true); - return true; + return ret; } -bool ReplayRenderer::DebugThread(uint32_t groupid[3], uint32_t threadid[3], ShaderDebugTrace *trace) +ShaderDebugTrace *ReplayRenderer::DebugThread(uint32_t groupid[3], uint32_t threadid[3]) { - if(trace == NULL) - return false; + ShaderDebugTrace *ret = new ShaderDebugTrace; - *trace = m_pDevice->DebugThread(m_EventID, groupid, threadid); + *ret = m_pDevice->DebugThread(m_EventID, groupid, threadid); SetFrameEvent(m_EventID, true); - return true; + return ret; } -bool ReplayRenderer::GetCBufferVariableContents(ResourceId shader, const char *entryPoint, - uint32_t cbufslot, ResourceId buffer, uint64_t offs, - rdctype::array *vars) +rdctype::array ReplayRenderer::GetCBufferVariableContents( + ResourceId shader, const char *entryPoint, uint32_t cbufslot, ResourceId buffer, uint64_t offs) { - if(vars == NULL) - return false; - vector data; if(buffer != ResourceId()) m_pDevice->GetBufferData(m_pDevice->GetLiveID(buffer), offs, 0, data); @@ -1400,15 +1309,12 @@ bool ReplayRenderer::GetCBufferVariableContents(ResourceId shader, const char *e m_pDevice->FillCBufferVariables(m_pDevice->GetLiveID(shader), entryPoint, cbufslot, v, data); - *vars = v; - - return true; + return v; } -void ReplayRenderer::GetSupportedWindowSystems(rdctype::array *systems) +rdctype::array ReplayRenderer::GetSupportedWindowSystems() { - if(systems) - *systems = m_pDevice->GetSupportedWindowSystems(); + return m_pDevice->GetSupportedWindowSystems(); } ReplayOutput *ReplayRenderer::CreateOutput(WindowingSystem system, void *data, ReplayOutputType type) @@ -1436,9 +1342,8 @@ void ReplayRenderer::Shutdown() delete this; } -ResourceId ReplayRenderer::BuildTargetShader(const char *entry, const char *source, - const uint32_t compileFlags, ShaderStage type, - rdctype::str *errors) +rdctype::pair ReplayRenderer::BuildTargetShader( + const char *entry, const char *source, const uint32_t compileFlags, ShaderStage type) { ResourceId id; string errs; @@ -1451,7 +1356,9 @@ ResourceId ReplayRenderer::BuildTargetShader(const char *entry, const char *sour case ShaderStage::Geometry: case ShaderStage::Pixel: case ShaderStage::Compute: break; - default: RDCERR("Unexpected type in BuildShader!"); return ResourceId(); + default: + RDCERR("Unexpected type in BuildShader!"); + return rdctype::pair(); } m_pDevice->BuildTargetShader(source, entry, compileFlags, type, &id, &errs); @@ -1459,15 +1366,11 @@ ResourceId ReplayRenderer::BuildTargetShader(const char *entry, const char *sour if(id != ResourceId()) m_TargetResources.insert(id); - if(errors) - *errors = errs; - - return id; + return rdctype::make_pair(id, errs); } -ResourceId ReplayRenderer::BuildCustomShader(const char *entry, const char *source, - const uint32_t compileFlags, ShaderStage type, - rdctype::str *errors) +rdctype::pair ReplayRenderer::BuildCustomShader( + const char *entry, const char *source, const uint32_t compileFlags, ShaderStage type) { ResourceId id; string errs; @@ -1480,7 +1383,9 @@ ResourceId ReplayRenderer::BuildCustomShader(const char *entry, const char *sour case ShaderStage::Geometry: case ShaderStage::Pixel: case ShaderStage::Compute: break; - default: RDCERR("Unexpected type in BuildShader!"); return ResourceId(); + default: + RDCERR("Unexpected type in BuildShader!"); + return rdctype::pair(); } m_pDevice->BuildCustomShader(source, entry, compileFlags, type, &id, &errs); @@ -1488,29 +1393,22 @@ ResourceId ReplayRenderer::BuildCustomShader(const char *entry, const char *sour if(id != ResourceId()) m_CustomShaders.insert(id); - if(errors) - *errors = errs; - - return id; + return rdctype::make_pair(id, errs); } -bool ReplayRenderer::FreeTargetResource(ResourceId id) +void ReplayRenderer::FreeTargetResource(ResourceId id) { m_TargetResources.erase(id); m_pDevice->FreeTargetResource(id); - - return true; } -bool ReplayRenderer::FreeCustomShader(ResourceId id) +void ReplayRenderer::FreeCustomShader(ResourceId id) { m_CustomShaders.erase(id); m_pDevice->FreeCustomShader(id); - - return true; } -bool ReplayRenderer::ReplaceResource(ResourceId from, ResourceId to) +void ReplayRenderer::ReplaceResource(ResourceId from, ResourceId to) { m_pDevice->ReplaceResource(from, to); @@ -1519,11 +1417,9 @@ bool ReplayRenderer::ReplaceResource(ResourceId from, ResourceId to) for(size_t i = 0; i < m_Outputs.size(); i++) if(m_Outputs[i]->GetType() != ReplayOutputType::Headless) m_Outputs[i]->Display(); - - return true; } -bool ReplayRenderer::RemoveReplacement(ResourceId id) +void ReplayRenderer::RemoveReplacement(ResourceId id) { m_pDevice->RemoveReplacement(id); @@ -1532,8 +1428,6 @@ bool ReplayRenderer::RemoveReplacement(ResourceId id) for(size_t i = 0; i < m_Outputs.size(); i++) if(m_Outputs[i]->GetType() != ReplayOutputType::Headless) m_Outputs[i]->Display(); - - return true; } ReplayStatus ReplayRenderer::CreateDevice(const char *logfile) @@ -1678,7 +1572,7 @@ extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetAPIProperties(IRepl extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetSupportedWindowSystems( IReplayRenderer *rend, rdctype::array *systems) { - rend->GetSupportedWindowSystems(systems); + *systems = rend->GetSupportedWindowSystems(); } extern "C" RENDERDOC_API IReplayOutput *RENDERDOC_CC ReplayRenderer_CreateOutput( @@ -1710,31 +1604,31 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_InitResolver(IReplay return rend->InitResolver(); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_SetFrameEvent(IReplayRenderer *rend, - uint32_t eventID, - bool32 force) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_SetFrameEvent(IReplayRenderer *rend, + uint32_t eventID, + bool32 force) { - return rend->SetFrameEvent(eventID, force != 0); + rend->SetFrameEvent(eventID, force != 0); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetD3D11PipelineState(IReplayRenderer *rend, D3D11Pipe::State *state) { - return rend->GetD3D11PipelineState(state); + *state = rend->GetD3D11PipelineState(); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetD3D12PipelineState(IReplayRenderer *rend, D3D12Pipe::State *state) { - return rend->GetD3D12PipelineState(state); + *state = rend->GetD3D12PipelineState(); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetGLPipelineState(IReplayRenderer *rend, - GLPipe::State *state) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetGLPipelineState(IReplayRenderer *rend, + GLPipe::State *state) { - return rend->GetGLPipelineState(state); + *state = rend->GetGLPipelineState(); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC -ReplayRenderer_GetVulkanPipelineState(IReplayRenderer *rend, VKPipe::State *state) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetVulkanPipelineState(IReplayRenderer *rend, + VKPipe::State *state) { - return rend->GetVulkanPipelineState(state); + *state = rend->GetVulkanPipelineState(); } extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_BuildCustomShader( @@ -1744,12 +1638,16 @@ extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_BuildCustomShader( if(shaderID == NULL) return; - *shaderID = rend->BuildCustomShader(entry, source, compileFlags, type, errors); + auto ret = rend->BuildCustomShader(entry, source, compileFlags, type); + + *shaderID = ret.first; + if(errors) + *errors = ret.second; } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_FreeCustomShader(IReplayRenderer *rend, - ResourceId id) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_FreeCustomShader(IReplayRenderer *rend, + ResourceId id) { - return rend->FreeCustomShader(id); + rend->FreeCustomShader(id); } extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_BuildTargetShader( @@ -1759,113 +1657,128 @@ extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_BuildTargetShader( if(shaderID == NULL) return; - *shaderID = rend->BuildTargetShader(entry, source, compileFlags, type, errors); + auto ret = rend->BuildTargetShader(entry, source, compileFlags, type); + + *shaderID = ret.first; + if(errors) + *errors = ret.second; } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_ReplaceResource(IReplayRenderer *rend, - ResourceId from, - ResourceId to) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_ReplaceResource(IReplayRenderer *rend, + ResourceId from, + ResourceId to) { - return rend->ReplaceResource(from, to); + rend->ReplaceResource(from, to); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_RemoveReplacement(IReplayRenderer *rend, - ResourceId id) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_RemoveReplacement(IReplayRenderer *rend, + ResourceId id) { - return rend->RemoveReplacement(id); + rend->RemoveReplacement(id); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_FreeTargetResource(IReplayRenderer *rend, - ResourceId id) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_FreeTargetResource(IReplayRenderer *rend, + ResourceId id) { - return rend->FreeTargetResource(id); + rend->FreeTargetResource(id); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetFrameInfo(IReplayRenderer *rend, - FrameDescription *frame) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetFrameInfo(IReplayRenderer *rend, + FrameDescription *frame) { - return rend->GetFrameInfo(frame); + *frame = rend->GetFrameInfo(); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetDrawcalls(IReplayRenderer *rend, rdctype::array *draws) { - return rend->GetDrawcalls(draws); + *draws = rend->GetDrawcalls(); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_FetchCounters(IReplayRenderer *rend, GPUCounter *counters, uint32_t numCounters, rdctype::array *results) { - return rend->FetchCounters(counters, numCounters, results); + rdctype::array counterArray; + create_array_init(counterArray, (size_t)numCounters, counters); + *results = rend->FetchCounters(counterArray); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_EnumerateCounters(IReplayRenderer *rend, rdctype::array *counters) { - return rend->EnumerateCounters(counters); + *counters = rend->EnumerateCounters(); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_DescribeCounter(IReplayRenderer *rend, - GPUCounter counterID, - CounterDescription *desc) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_DescribeCounter(IReplayRenderer *rend, + GPUCounter counterID, + CounterDescription *desc) { - return rend->DescribeCounter(counterID, desc); + *desc = rend->DescribeCounter(counterID); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetTextures(IReplayRenderer *rend, rdctype::array *texs) { - return rend->GetTextures(texs); + *texs = rend->GetTextures(); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetBuffers(IReplayRenderer *rend, rdctype::array *bufs) { - return rend->GetBuffers(bufs); + *bufs = rend->GetBuffers(); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetResolve(IReplayRenderer *rend, uint64_t *callstack, uint32_t callstackLen, rdctype::array *trace) { - return rend->GetResolve(callstack, callstackLen, trace); + rdctype::array stack; + create_array_init(stack, (size_t)callstackLen, callstack); + *trace = rend->GetResolve(stack); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetDebugMessages(IReplayRenderer *rend, rdctype::array *msgs) { - return rend->GetDebugMessages(msgs); + *msgs = rend->GetDebugMessages(); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_PixelHistory( +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_PixelHistory( IReplayRenderer *rend, ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, uint32_t sampleIdx, CompType typeHint, rdctype::array *history) { - return rend->PixelHistory(target, x, y, slice, mip, sampleIdx, typeHint, history); + *history = rend->PixelHistory(target, x, y, slice, mip, sampleIdx, typeHint); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_DebugVertex(IReplayRenderer *rend, uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, uint32_t vertOffset, ShaderDebugTrace *trace) { - return rend->DebugVertex(vertid, instid, idx, instOffset, vertOffset, trace); + ShaderDebugTrace *ret = rend->DebugVertex(vertid, instid, idx, instOffset, vertOffset); + *trace = *ret; + delete ret; } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_DebugPixel(IReplayRenderer *rend, - uint32_t x, uint32_t y, - uint32_t sample, - uint32_t primitive, - ShaderDebugTrace *trace) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_DebugPixel(IReplayRenderer *rend, + uint32_t x, uint32_t y, + uint32_t sample, + uint32_t primitive, + ShaderDebugTrace *trace) { - return rend->DebugPixel(x, y, sample, primitive, trace); + ShaderDebugTrace *ret = rend->DebugPixel(x, y, sample, primitive); + *trace = *ret; + delete ret; } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_DebugThread(IReplayRenderer *rend, - uint32_t groupid[3], - uint32_t threadid[3], - ShaderDebugTrace *trace) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_DebugThread(IReplayRenderer *rend, + uint32_t groupid[3], + uint32_t threadid[3], + ShaderDebugTrace *trace) { - return rend->DebugThread(groupid, threadid, trace); + ShaderDebugTrace *ret = rend->DebugThread(groupid, threadid); + *trace = *ret; + delete ret; } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC -ReplayRenderer_GetUsage(IReplayRenderer *rend, ResourceId id, rdctype::array *usage) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetUsage(IReplayRenderer *rend, + ResourceId id, + rdctype::array *usage) { - return rend->GetUsage(id, usage); + *usage = rend->GetUsage(id); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetCBufferVariableContents( +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetCBufferVariableContents( IReplayRenderer *rend, ResourceId shader, const char *entryPoint, uint32_t cbufslot, ResourceId buffer, uint64_t offs, rdctype::array *vars) { - return rend->GetCBufferVariableContents(shader, entryPoint, cbufslot, buffer, offs, vars); + *vars = rend->GetCBufferVariableContents(shader, entryPoint, cbufslot, buffer, offs); } extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_SaveTexture(IReplayRenderer *rend, @@ -1875,23 +1788,27 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_SaveTexture(IReplayR return rend->SaveTexture(saveData, path); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetPostVSData(IReplayRenderer *rend, - uint32_t instID, - MeshDataStage stage, - MeshFormat *data) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetPostVSData(IReplayRenderer *rend, + uint32_t instID, + MeshDataStage stage, + MeshFormat *data) { - return rend->GetPostVSData(instID, stage, data); + *data = rend->GetPostVSData(instID, stage); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetBufferData( - IReplayRenderer *rend, ResourceId buff, uint64_t offset, uint64_t len, rdctype::array *data) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetBufferData(IReplayRenderer *rend, + ResourceId buff, + uint64_t offset, uint64_t len, + rdctype::array *data) { - return rend->GetBufferData(buff, offset, len, data); + *data = rend->GetBufferData(buff, offset, len); } -extern "C" RENDERDOC_API bool32 RENDERDOC_CC -ReplayRenderer_GetTextureData(IReplayRenderer *rend, ResourceId tex, uint32_t arrayIdx, - uint32_t mip, rdctype::array *data) +extern "C" RENDERDOC_API void RENDERDOC_CC ReplayRenderer_GetTextureData(IReplayRenderer *rend, + ResourceId tex, + uint32_t arrayIdx, + uint32_t mip, + rdctype::array *data) { - return rend->GetTextureData(tex, arrayIdx, mip, data); + *data = rend->GetTextureData(tex, arrayIdx, mip); } diff --git a/renderdoc/replay/replay_renderer.h b/renderdoc/replay/replay_renderer.h index e824b2630..f66ffa4a3 100644 --- a/renderdoc/replay/replay_renderer.h +++ b/renderdoc/replay/replay_renderer.h @@ -38,27 +38,26 @@ struct ReplayRenderer; struct ReplayOutput : public IReplayOutput { public: - bool SetTextureDisplay(const TextureDisplay &o); - bool SetMeshDisplay(const MeshDisplay &o); + void SetTextureDisplay(const TextureDisplay &o); + void SetMeshDisplay(const MeshDisplay &o); - bool ClearThumbnails(); + void ClearThumbnails(); bool AddThumbnail(WindowingSystem system, void *data, ResourceId texID, CompType typeHint); - bool Display(); + void Display(); ReplayOutputType GetType() { return m_Type; } bool SetPixelContext(WindowingSystem system, void *data); - bool SetPixelContextLocation(uint32_t x, uint32_t y); + void SetPixelContextLocation(uint32_t x, uint32_t y); void DisablePixelContext(); - bool GetMinMax(PixelValue *minval, PixelValue *maxval); - bool GetHistogram(float minval, float maxval, bool channels[4], - rdctype::array *histogram); + rdctype::pair GetMinMax(); + rdctype::array GetHistogram(float minval, float maxval, bool channels[4]); ResourceId GetCustomShaderTexID() { return m_CustomShaderResourceId; } - bool PickPixel(ResourceId texID, bool customShader, uint32_t x, uint32_t y, uint32_t sliceFace, - uint32_t mip, uint32_t sample, PixelValue *val); - uint32_t PickVertex(uint32_t eventID, uint32_t x, uint32_t y, uint32_t *pickedInstance); + PixelValue PickPixel(ResourceId texID, bool customShader, uint32_t x, uint32_t y, + uint32_t sliceFace, uint32_t mip, uint32_t sample); + rdctype::pair PickVertex(uint32_t eventID, uint32_t x, uint32_t y); private: ReplayOutput(ReplayRenderer *parent, WindowingSystem system, void *data, ReplayOutputType type); @@ -133,59 +132,59 @@ public: bool HasCallstacks(); bool InitResolver(); - bool SetFrameEvent(uint32_t eventID, bool force); + void SetFrameEvent(uint32_t eventID, bool force); void FetchPipelineState(); - bool GetD3D11PipelineState(D3D11Pipe::State *state); - bool GetD3D12PipelineState(D3D12Pipe::State *state); - bool GetGLPipelineState(GLPipe::State *state); - bool GetVulkanPipelineState(VKPipe::State *state); + D3D11Pipe::State GetD3D11PipelineState(); + D3D12Pipe::State GetD3D12PipelineState(); + GLPipe::State GetGLPipelineState(); + VKPipe::State GetVulkanPipelineState(); - ResourceId BuildCustomShader(const char *entry, const char *source, const uint32_t compileFlags, - ShaderStage type, rdctype::str *errors); - bool FreeCustomShader(ResourceId id); + rdctype::pair BuildCustomShader(const char *entry, const char *source, + const uint32_t compileFlags, + ShaderStage type); + void FreeCustomShader(ResourceId id); - ResourceId BuildTargetShader(const char *entry, const char *source, const uint32_t compileFlags, - ShaderStage type, rdctype::str *errors); - bool ReplaceResource(ResourceId from, ResourceId to); - bool RemoveReplacement(ResourceId id); - bool FreeTargetResource(ResourceId id); + rdctype::pair BuildTargetShader(const char *entry, const char *source, + const uint32_t compileFlags, + ShaderStage type); + void ReplaceResource(ResourceId from, ResourceId to); + void RemoveReplacement(ResourceId id); + void FreeTargetResource(ResourceId id); - bool GetFrameInfo(FrameDescription *frame); - bool GetDrawcalls(rdctype::array *draws); - bool FetchCounters(GPUCounter *counters, uint32_t numCounters, - rdctype::array *results); - bool EnumerateCounters(rdctype::array *counters); - bool DescribeCounter(GPUCounter counterID, CounterDescription *desc); - bool GetTextures(rdctype::array *texs); - bool GetBuffers(rdctype::array *bufs); - bool GetResolve(uint64_t *callstack, uint32_t callstackLen, rdctype::array *trace); - bool GetDebugMessages(rdctype::array *msgs); + FrameDescription GetFrameInfo(); + rdctype::array GetDrawcalls(); + rdctype::array FetchCounters(const rdctype::array &counters); + rdctype::array EnumerateCounters(); + CounterDescription DescribeCounter(GPUCounter counterID); + rdctype::array GetTextures(); + rdctype::array GetBuffers(); + rdctype::array GetResolve(const rdctype::array &callstack); + rdctype::array GetDebugMessages(); - bool PixelHistory(ResourceId target, uint32_t x, uint32_t y, uint32_t slice, uint32_t mip, - uint32_t sampleIdx, CompType typeHint, - rdctype::array *history); - bool DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, - uint32_t vertOffset, ShaderDebugTrace *trace); - bool DebugPixel(uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive, - ShaderDebugTrace *trace); - bool DebugThread(uint32_t groupid[3], uint32_t threadid[3], ShaderDebugTrace *trace); + rdctype::array PixelHistory(ResourceId target, uint32_t x, uint32_t y, + uint32_t slice, uint32_t mip, uint32_t sampleIdx, + CompType typeHint); + ShaderDebugTrace *DebugVertex(uint32_t vertid, uint32_t instid, uint32_t idx, uint32_t instOffset, + uint32_t vertOffset); + ShaderDebugTrace *DebugPixel(uint32_t x, uint32_t y, uint32_t sample, uint32_t primitive); + ShaderDebugTrace *DebugThread(uint32_t groupid[3], uint32_t threadid[3]); - bool GetPostVSData(uint32_t instID, MeshDataStage stage, MeshFormat *data); + MeshFormat GetPostVSData(uint32_t instID, MeshDataStage stage); - bool GetUsage(ResourceId id, rdctype::array *usage); + rdctype::array GetUsage(ResourceId id); - bool GetBufferData(ResourceId buff, uint64_t offset, uint64_t len, rdctype::array *data); - bool GetTextureData(ResourceId buff, uint32_t arrayIdx, uint32_t mip, rdctype::array *data); + rdctype::array GetBufferData(ResourceId buff, uint64_t offset, uint64_t len); + rdctype::array GetTextureData(ResourceId buff, uint32_t arrayIdx, uint32_t mip); bool SaveTexture(const TextureSave &saveData, const char *path); - bool GetCBufferVariableContents(ResourceId shader, const char *entryPoint, uint32_t cbufslot, - ResourceId buffer, uint64_t offs, - rdctype::array *vars); + rdctype::array GetCBufferVariableContents(ResourceId shader, const char *entryPoint, + uint32_t cbufslot, ResourceId buffer, + uint64_t offs); - void GetSupportedWindowSystems(rdctype::array *systems); + rdctype::array GetSupportedWindowSystems(); ReplayOutput *CreateOutput(WindowingSystem, void *data, ReplayOutputType type); diff --git a/renderdoccmd/renderdoccmd.cpp b/renderdoccmd/renderdoccmd.cpp index e23ded53e..2b296e4d1 100644 --- a/renderdoccmd/renderdoccmd.cpp +++ b/renderdoccmd/renderdoccmd.cpp @@ -50,8 +50,7 @@ void DisplayRendererPreview(IReplayRenderer *renderer, uint32_t width, uint32_t if(renderer == NULL) return; - rdctype::array texs; - renderer->GetTextures(&texs); + rdctype::array texs = renderer->GetTextures(); TextureDisplay d; d.mip = 0; @@ -83,8 +82,7 @@ void DisplayRendererPreview(IReplayRenderer *renderer, uint32_t width, uint32_t } } - rdctype::array draws; - renderer->GetDrawcalls(&draws); + rdctype::array 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("pid"), env, - parser.get("log").c_str(), &cmdopts, false); + parser.get("log").c_str(), cmdopts, false); RENDERDOC_FreeEnvironmentModificationList(env); diff --git a/renderdoccmd/renderdoccmd_linux.cpp b/renderdoccmd/renderdoccmd_linux.cpp index 69ecc5b21..fd225192c 100644 --- a/renderdoccmd/renderdoccmd_linux.cpp +++ b/renderdoccmd/renderdoccmd_linux.cpp @@ -266,8 +266,7 @@ void DisplayRendererPreview(IReplayRenderer *renderer, TextureDisplay &displayCf xcb_map_window(connection, window); - rdctype::array systems; - renderer->GetSupportedWindowSystems(&systems); + rdctype::array systems = renderer->GetSupportedWindowSystems(); bool xcb = false, xlib = false; diff --git a/renderdocui/Interop/ReplayRenderer.cs b/renderdocui/Interop/ReplayRenderer.cs index 10149448a..a0e55feeb 100644 --- a/renderdocui/Interop/ReplayRenderer.cs +++ b/renderdocui/Interop/ReplayRenderer.cs @@ -119,22 +119,22 @@ namespace renderdoc public class ReplayOutput { [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayOutput_SetTextureDisplay(IntPtr real, TextureDisplay o); + private static extern void ReplayOutput_SetTextureDisplay(IntPtr real, TextureDisplay o); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayOutput_SetMeshDisplay(IntPtr real, MeshDisplay o); + private static extern void ReplayOutput_SetMeshDisplay(IntPtr real, MeshDisplay o); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayOutput_ClearThumbnails(IntPtr real); + private static extern void ReplayOutput_ClearThumbnails(IntPtr real); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] private static extern bool ReplayOutput_AddThumbnail(IntPtr real, UInt32 windowSystem, IntPtr wnd, ResourceId texID, FormatComponentType typeHint); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayOutput_Display(IntPtr real); + private static extern void ReplayOutput_Display(IntPtr real); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] private static extern bool ReplayOutput_SetPixelContext(IntPtr real, UInt32 windowSystem, IntPtr wnd); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayOutput_SetPixelContextLocation(IntPtr real, UInt32 x, UInt32 y); + private static extern void ReplayOutput_SetPixelContextLocation(IntPtr real, UInt32 x, UInt32 y); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] private static extern void ReplayOutput_DisablePixelContext(IntPtr real); @@ -142,12 +142,12 @@ namespace renderdoc private static extern void ReplayOutput_GetCustomShaderTexID(IntPtr real, ref ResourceId texid); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayOutput_GetMinMax(IntPtr real, IntPtr outminval, IntPtr outmaxval); + private static extern void ReplayOutput_GetMinMax(IntPtr real, IntPtr outminval, IntPtr outmaxval); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayOutput_GetHistogram(IntPtr real, float minval, float maxval, bool[] channels, IntPtr outhistogram); + private static extern void ReplayOutput_GetHistogram(IntPtr real, float minval, float maxval, bool[] channels, IntPtr outhistogram); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayOutput_PickPixel(IntPtr real, ResourceId texID, bool customShader, + private static extern void ReplayOutput_PickPixel(IntPtr real, ResourceId texID, bool customShader, UInt32 x, UInt32 y, UInt32 sliceFace, UInt32 mip, UInt32 sample, IntPtr outval); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] private static extern UInt32 ReplayOutput_PickVertex(IntPtr real, UInt32 eventID, UInt32 x, UInt32 y, IntPtr outPickedInstance); @@ -156,18 +156,18 @@ namespace renderdoc public ReplayOutput(IntPtr real) { m_Real = real; } - public bool SetTextureDisplay(TextureDisplay o) + public void SetTextureDisplay(TextureDisplay o) { - return ReplayOutput_SetTextureDisplay(m_Real, o); + ReplayOutput_SetTextureDisplay(m_Real, o); } - public bool SetMeshDisplay(MeshDisplay o) + public void SetMeshDisplay(MeshDisplay o) { - return ReplayOutput_SetMeshDisplay(m_Real, o); + ReplayOutput_SetMeshDisplay(m_Real, o); } - public bool ClearThumbnails() + public void ClearThumbnails() { - return ReplayOutput_ClearThumbnails(m_Real); + ReplayOutput_ClearThumbnails(m_Real); } public bool AddThumbnail(IntPtr wnd, ResourceId texID, FormatComponentType typeHint) { @@ -175,9 +175,9 @@ namespace renderdoc return ReplayOutput_AddThumbnail(m_Real, 1u, wnd, texID, typeHint); } - public bool Display() + public void Display() { - return ReplayOutput_Display(m_Real); + ReplayOutput_Display(m_Real); } public bool SetPixelContext(IntPtr wnd) @@ -185,9 +185,9 @@ namespace renderdoc // 1 == eWindowingSystem_Win32 return ReplayOutput_SetPixelContext(m_Real, 1u, wnd); } - public bool SetPixelContextLocation(UInt32 x, UInt32 y) + public void SetPixelContextLocation(UInt32 x, UInt32 y) { - return ReplayOutput_SetPixelContextLocation(m_Real, x, y); + ReplayOutput_SetPixelContextLocation(m_Real, x, y); } public void DisablePixelContext() { @@ -203,31 +203,21 @@ namespace renderdoc return ret; } - public bool GetMinMax(out PixelValue minval, out PixelValue maxval) + public void GetMinMax(out PixelValue minval, out PixelValue maxval) { IntPtr mem1 = CustomMarshal.Alloc(typeof(PixelValue)); IntPtr mem2 = CustomMarshal.Alloc(typeof(PixelValue)); - bool success = ReplayOutput_GetMinMax(m_Real, mem1, mem2); + ReplayOutput_GetMinMax(m_Real, mem1, mem2); - if (success) - { - minval = (PixelValue)CustomMarshal.PtrToStructure(mem1, typeof(PixelValue), true); - maxval = (PixelValue)CustomMarshal.PtrToStructure(mem2, typeof(PixelValue), true); - } - else - { - minval = null; - maxval = null; - } + minval = (PixelValue)CustomMarshal.PtrToStructure(mem1, typeof(PixelValue), true); + maxval = (PixelValue)CustomMarshal.PtrToStructure(mem2, typeof(PixelValue), true); CustomMarshal.Free(mem1); CustomMarshal.Free(mem2); - - return success; } - public bool GetHistogram(float minval, float maxval, + public void GetHistogram(float minval, float maxval, bool Red, bool Green, bool Blue, bool Alpha, out UInt32[] histogram) { @@ -235,28 +225,20 @@ namespace renderdoc bool[] channels = new bool[] { Red, Green, Blue, Alpha }; - bool success = ReplayOutput_GetHistogram(m_Real, minval, maxval, channels, mem); + ReplayOutput_GetHistogram(m_Real, minval, maxval, channels, mem); - histogram = null; - - if (success) - histogram = (UInt32[])CustomMarshal.GetTemplatedArray(mem, typeof(UInt32), true); + histogram = (UInt32[])CustomMarshal.GetTemplatedArray(mem, typeof(UInt32), true); CustomMarshal.Free(mem); - - return success; } public PixelValue PickPixel(ResourceId texID, bool customShader, UInt32 x, UInt32 y, UInt32 sliceFace, UInt32 mip, UInt32 sample) { IntPtr mem = CustomMarshal.Alloc(typeof(PixelValue)); - bool success = ReplayOutput_PickPixel(m_Real, texID, customShader, x, y, sliceFace, mip, sample, mem); + ReplayOutput_PickPixel(m_Real, texID, customShader, x, y, sliceFace, mip, sample, mem); - PixelValue ret = null; - - if(success) - ret = (PixelValue)CustomMarshal.PtrToStructure(mem, typeof(PixelValue), false); + PixelValue ret = (PixelValue)CustomMarshal.PtrToStructure(mem, typeof(PixelValue), false); CustomMarshal.Free(mem); @@ -299,74 +281,74 @@ namespace renderdoc private static extern bool ReplayRenderer_InitResolver(IntPtr real); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_SetFrameEvent(IntPtr real, UInt32 eventID, bool force); + private static extern void ReplayRenderer_SetFrameEvent(IntPtr real, UInt32 eventID, bool force); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetD3D11PipelineState(IntPtr real, IntPtr mem); + private static extern void ReplayRenderer_GetD3D11PipelineState(IntPtr real, IntPtr mem); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetD3D12PipelineState(IntPtr real, IntPtr mem); + private static extern void ReplayRenderer_GetD3D12PipelineState(IntPtr real, IntPtr mem); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetGLPipelineState(IntPtr real, IntPtr mem); + private static extern void ReplayRenderer_GetGLPipelineState(IntPtr real, IntPtr mem); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetVulkanPipelineState(IntPtr real, IntPtr mem); + private static extern void ReplayRenderer_GetVulkanPipelineState(IntPtr real, IntPtr mem); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] private static extern void ReplayRenderer_BuildCustomShader(IntPtr real, IntPtr entry, IntPtr source, UInt32 compileFlags, ShaderStageType type, ref ResourceId shaderID, IntPtr errorMem); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_FreeCustomShader(IntPtr real, ResourceId id); + private static extern void ReplayRenderer_FreeCustomShader(IntPtr real, ResourceId id); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] private static extern void ReplayRenderer_BuildTargetShader(IntPtr real, IntPtr entry, IntPtr source, UInt32 compileFlags, ShaderStageType type, ref ResourceId shaderID, IntPtr errorMem); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_ReplaceResource(IntPtr real, ResourceId from, ResourceId to); + private static extern void ReplayRenderer_ReplaceResource(IntPtr real, ResourceId from, ResourceId to); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_RemoveReplacement(IntPtr real, ResourceId id); + private static extern void ReplayRenderer_RemoveReplacement(IntPtr real, ResourceId id); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_FreeTargetResource(IntPtr real, ResourceId id); + private static extern void ReplayRenderer_FreeTargetResource(IntPtr real, ResourceId id); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetFrameInfo(IntPtr real, IntPtr outframe); + private static extern void ReplayRenderer_GetFrameInfo(IntPtr real, IntPtr outframe); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetDrawcalls(IntPtr real, IntPtr outdraws); + private static extern void ReplayRenderer_GetDrawcalls(IntPtr real, IntPtr outdraws); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_FetchCounters(IntPtr real, IntPtr counters, UInt32 numCounters, IntPtr outresults); + private static extern void ReplayRenderer_FetchCounters(IntPtr real, IntPtr counters, UInt32 numCounters, IntPtr outresults); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_EnumerateCounters(IntPtr real, IntPtr outcounters); + private static extern void ReplayRenderer_EnumerateCounters(IntPtr real, IntPtr outcounters); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_DescribeCounter(IntPtr real, UInt32 counter, IntPtr outdesc); + private static extern void ReplayRenderer_DescribeCounter(IntPtr real, UInt32 counter, IntPtr outdesc); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetTextures(IntPtr real, IntPtr outtexs); + private static extern void ReplayRenderer_GetTextures(IntPtr real, IntPtr outtexs); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetBuffers(IntPtr real, IntPtr outbufs); + private static extern void ReplayRenderer_GetBuffers(IntPtr real, IntPtr outbufs); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetResolve(IntPtr real, UInt64[] callstack, UInt32 callstackLen, IntPtr outtrace); + private static extern void ReplayRenderer_GetResolve(IntPtr real, UInt64[] callstack, UInt32 callstackLen, IntPtr outtrace); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetDebugMessages(IntPtr real, IntPtr outmsgs); + private static extern void ReplayRenderer_GetDebugMessages(IntPtr real, IntPtr outmsgs); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_PixelHistory(IntPtr real, ResourceId target, UInt32 x, UInt32 y, UInt32 slice, UInt32 mip, UInt32 sampleIdx, FormatComponentType typeHint, IntPtr history); + private static extern void ReplayRenderer_PixelHistory(IntPtr real, ResourceId target, UInt32 x, UInt32 y, UInt32 slice, UInt32 mip, UInt32 sampleIdx, FormatComponentType typeHint, IntPtr history); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_DebugVertex(IntPtr real, UInt32 vertid, UInt32 instid, UInt32 idx, UInt32 instOffset, UInt32 vertOffset, IntPtr outtrace); + private static extern void ReplayRenderer_DebugVertex(IntPtr real, UInt32 vertid, UInt32 instid, UInt32 idx, UInt32 instOffset, UInt32 vertOffset, IntPtr outtrace); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_DebugPixel(IntPtr real, UInt32 x, UInt32 y, UInt32 sample, UInt32 primitive, IntPtr outtrace); + private static extern void ReplayRenderer_DebugPixel(IntPtr real, UInt32 x, UInt32 y, UInt32 sample, UInt32 primitive, IntPtr outtrace); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_DebugThread(IntPtr real, UInt32[] groupid, UInt32[] threadid, IntPtr outtrace); + private static extern void ReplayRenderer_DebugThread(IntPtr real, UInt32[] groupid, UInt32[] threadid, IntPtr outtrace); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetUsage(IntPtr real, ResourceId id, IntPtr outusage); + private static extern void ReplayRenderer_GetUsage(IntPtr real, ResourceId id, IntPtr outusage); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetCBufferVariableContents(IntPtr real, ResourceId shader, IntPtr entryPoint, UInt32 cbufslot, ResourceId buffer, UInt64 offs, IntPtr outvars); + private static extern void ReplayRenderer_GetCBufferVariableContents(IntPtr real, ResourceId shader, IntPtr entryPoint, UInt32 cbufslot, ResourceId buffer, UInt64 offs, IntPtr outvars); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] private static extern bool ReplayRenderer_SaveTexture(IntPtr real, TextureSave saveData, IntPtr path); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetPostVSData(IntPtr real, UInt32 instID, MeshDataStage stage, IntPtr outdata); + private static extern void ReplayRenderer_GetPostVSData(IntPtr real, UInt32 instID, MeshDataStage stage, IntPtr outdata); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetBufferData(IntPtr real, ResourceId buff, UInt64 offset, UInt64 len, IntPtr outdata); + private static extern void ReplayRenderer_GetBufferData(IntPtr real, ResourceId buff, UInt64 offset, UInt64 len, IntPtr outdata); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool ReplayRenderer_GetTextureData(IntPtr real, ResourceId tex, UInt32 arrayIdx, UInt32 mip, IntPtr outdata); + private static extern void ReplayRenderer_GetTextureData(IntPtr real, ResourceId tex, UInt32 arrayIdx, UInt32 mip, IntPtr outdata); private IntPtr m_Real = IntPtr.Zero; @@ -417,19 +399,16 @@ namespace renderdoc public bool InitResolver() { return ReplayRenderer_InitResolver(m_Real); } - public bool SetFrameEvent(UInt32 eventID, bool force) - { return ReplayRenderer_SetFrameEvent(m_Real, eventID, force); } + public void SetFrameEvent(UInt32 eventID, bool force) + { ReplayRenderer_SetFrameEvent(m_Real, eventID, force); } public GLPipelineState GetGLPipelineState() { IntPtr mem = CustomMarshal.Alloc(typeof(GLPipelineState)); - bool success = ReplayRenderer_GetGLPipelineState(m_Real, mem); + ReplayRenderer_GetGLPipelineState(m_Real, mem); - GLPipelineState ret = null; - - if (success) - ret = (GLPipelineState)CustomMarshal.PtrToStructure(mem, typeof(GLPipelineState), true); + GLPipelineState ret = (GLPipelineState)CustomMarshal.PtrToStructure(mem, typeof(GLPipelineState), true); CustomMarshal.Free(mem); @@ -440,12 +419,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(D3D11PipelineState)); - bool success = ReplayRenderer_GetD3D11PipelineState(m_Real, mem); + ReplayRenderer_GetD3D11PipelineState(m_Real, mem); - D3D11PipelineState ret = null; - - if (success) - ret = (D3D11PipelineState)CustomMarshal.PtrToStructure(mem, typeof(D3D11PipelineState), true); + D3D11PipelineState ret = (D3D11PipelineState)CustomMarshal.PtrToStructure(mem, typeof(D3D11PipelineState), true); CustomMarshal.Free(mem); @@ -456,12 +432,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(D3D12PipelineState)); - bool success = ReplayRenderer_GetD3D12PipelineState(m_Real, mem); + ReplayRenderer_GetD3D12PipelineState(m_Real, mem); - D3D12PipelineState ret = null; - - if (success) - ret = (D3D12PipelineState)CustomMarshal.PtrToStructure(mem, typeof(D3D12PipelineState), true); + D3D12PipelineState ret = (D3D12PipelineState)CustomMarshal.PtrToStructure(mem, typeof(D3D12PipelineState), true); CustomMarshal.Free(mem); @@ -472,12 +445,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(VulkanPipelineState)); - bool success = ReplayRenderer_GetVulkanPipelineState(m_Real, mem); + ReplayRenderer_GetVulkanPipelineState(m_Real, mem); - VulkanPipelineState ret = null; - - if (success) - ret = (VulkanPipelineState)CustomMarshal.PtrToStructure(mem, typeof(VulkanPipelineState), true); + VulkanPipelineState ret = (VulkanPipelineState)CustomMarshal.PtrToStructure(mem, typeof(VulkanPipelineState), true); CustomMarshal.Free(mem); @@ -505,8 +475,8 @@ namespace renderdoc return ret; } - public bool FreeCustomShader(ResourceId id) - { return ReplayRenderer_FreeCustomShader(m_Real, id); } + public void FreeCustomShader(ResourceId id) + { ReplayRenderer_FreeCustomShader(m_Real, id); } public ResourceId BuildTargetShader(string entry, string source, UInt32 compileFlags, ShaderStageType type, out string errors) { @@ -529,23 +499,20 @@ namespace renderdoc return ret; } - public bool ReplaceResource(ResourceId from, ResourceId to) - { return ReplayRenderer_ReplaceResource(m_Real, from, to); } - public bool RemoveReplacement(ResourceId id) - { return ReplayRenderer_RemoveReplacement(m_Real, id); } - public bool FreeTargetResource(ResourceId id) - { return ReplayRenderer_FreeTargetResource(m_Real, id); } + public void ReplaceResource(ResourceId from, ResourceId to) + { ReplayRenderer_ReplaceResource(m_Real, from, to); } + public void RemoveReplacement(ResourceId id) + { ReplayRenderer_RemoveReplacement(m_Real, id); } + public void FreeTargetResource(ResourceId id) + { ReplayRenderer_FreeTargetResource(m_Real, id); } public FetchFrameInfo GetFrameInfo() { IntPtr mem = CustomMarshal.Alloc(typeof(FetchFrameInfo)); - bool success = ReplayRenderer_GetFrameInfo(m_Real, mem); + ReplayRenderer_GetFrameInfo(m_Real, mem); - FetchFrameInfo ret = null; - - if (success) - ret = (FetchFrameInfo)CustomMarshal.PtrToStructure(mem, typeof(FetchFrameInfo), true); + FetchFrameInfo ret = (FetchFrameInfo)CustomMarshal.PtrToStructure(mem, typeof(FetchFrameInfo), true); CustomMarshal.Free(mem); @@ -587,13 +554,12 @@ namespace renderdoc for (int i = 0; i < counters.Length; i++) Marshal.WriteInt32(countersmem, sizeof(UInt32) * i, (int)counters[i]); - bool success = ReplayRenderer_FetchCounters(m_Real, countersmem, (uint)counters.Length, mem); + ReplayRenderer_FetchCounters(m_Real, countersmem, (uint)counters.Length, mem); CustomMarshal.Free(countersmem); Dictionary> ret = null; - if (success) { CounterResult[] resultArray = (CounterResult[])CustomMarshal.GetTemplatedArray(mem, typeof(CounterResult), true); @@ -618,14 +584,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - bool success = ReplayRenderer_EnumerateCounters(m_Real, mem); + ReplayRenderer_EnumerateCounters(m_Real, mem); - UInt32[] ret = null; - - if (success) - { - ret = (UInt32[])CustomMarshal.GetTemplatedArray(mem, typeof(UInt32), true); - } + UInt32[] ret = (UInt32[])CustomMarshal.GetTemplatedArray(mem, typeof(UInt32), true); CustomMarshal.Free(mem); @@ -636,14 +597,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(CounterDescription)); - bool success = ReplayRenderer_DescribeCounter(m_Real, counterID, mem); + ReplayRenderer_DescribeCounter(m_Real, counterID, mem); - CounterDescription ret = null; - - if (success) - { - ret = (CounterDescription)CustomMarshal.PtrToStructure(mem, typeof(CounterDescription), false); - } + CounterDescription ret = (CounterDescription)CustomMarshal.PtrToStructure(mem, typeof(CounterDescription), false); CustomMarshal.Free(mem); @@ -654,11 +610,10 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - bool success = ReplayRenderer_GetDrawcalls(m_Real, mem); + ReplayRenderer_GetDrawcalls(m_Real, mem); FetchDrawcall[] ret = null; - if (success) { ret = (FetchDrawcall[])CustomMarshal.GetTemplatedArray(mem, typeof(FetchDrawcall), true); @@ -677,12 +632,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - bool success = ReplayRenderer_GetTextures(m_Real, mem); + ReplayRenderer_GetTextures(m_Real, mem); - FetchTexture[] ret = null; - - if (success) - ret = (FetchTexture[])CustomMarshal.GetTemplatedArray(mem, typeof(FetchTexture), true); + FetchTexture[] ret = (FetchTexture[])CustomMarshal.GetTemplatedArray(mem, typeof(FetchTexture), true); CustomMarshal.Free(mem); @@ -693,12 +645,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - bool success = ReplayRenderer_GetBuffers(m_Real, mem); + ReplayRenderer_GetBuffers(m_Real, mem); - FetchBuffer[] ret = null; - - if (success) - ret = (FetchBuffer[])CustomMarshal.GetTemplatedArray(mem, typeof(FetchBuffer), true); + FetchBuffer[] ret = (FetchBuffer[])CustomMarshal.GetTemplatedArray(mem, typeof(FetchBuffer), true); CustomMarshal.Free(mem); @@ -711,12 +660,9 @@ namespace renderdoc UInt32 len = (UInt32)callstack.Length; - bool success = ReplayRenderer_GetResolve(m_Real, callstack, len, mem); + ReplayRenderer_GetResolve(m_Real, callstack, len, mem); - string[] ret = null; - - if (success) - ret = CustomMarshal.TemplatedArrayToStringArray(mem, true); + string[] ret = CustomMarshal.TemplatedArrayToStringArray(mem, true); CustomMarshal.Free(mem); @@ -727,12 +673,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - bool success = ReplayRenderer_GetDebugMessages(m_Real, mem); + ReplayRenderer_GetDebugMessages(m_Real, mem); - DebugMessage[] ret = null; - - if (success) - ret = (DebugMessage[])CustomMarshal.GetTemplatedArray(mem, typeof(DebugMessage), true); + DebugMessage[] ret = (DebugMessage[])CustomMarshal.GetTemplatedArray(mem, typeof(DebugMessage), true); CustomMarshal.Free(mem); @@ -743,12 +686,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - bool success = ReplayRenderer_PixelHistory(m_Real, target, x, y, slice, mip, sampleIdx, typeHint, mem); + ReplayRenderer_PixelHistory(m_Real, target, x, y, slice, mip, sampleIdx, typeHint, mem); - PixelModification[] ret = null; - - if (success) - ret = (PixelModification[])CustomMarshal.GetTemplatedArray(mem, typeof(PixelModification), true); + PixelModification[] ret = (PixelModification[])CustomMarshal.GetTemplatedArray(mem, typeof(PixelModification), true); CustomMarshal.Free(mem); @@ -759,12 +699,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(ShaderDebugTrace)); - bool success = ReplayRenderer_DebugVertex(m_Real, vertid, instid, idx, instOffset, vertOffset, mem); + ReplayRenderer_DebugVertex(m_Real, vertid, instid, idx, instOffset, vertOffset, mem); - ShaderDebugTrace ret = null; - - if (success) - ret = (ShaderDebugTrace)CustomMarshal.PtrToStructure(mem, typeof(ShaderDebugTrace), true); + ShaderDebugTrace ret = (ShaderDebugTrace)CustomMarshal.PtrToStructure(mem, typeof(ShaderDebugTrace), true); CustomMarshal.Free(mem); @@ -775,12 +712,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(ShaderDebugTrace)); - bool success = ReplayRenderer_DebugPixel(m_Real, x, y, sample, primitive, mem); + ReplayRenderer_DebugPixel(m_Real, x, y, sample, primitive, mem); - ShaderDebugTrace ret = null; - - if (success) - ret = (ShaderDebugTrace)CustomMarshal.PtrToStructure(mem, typeof(ShaderDebugTrace), true); + ShaderDebugTrace ret = (ShaderDebugTrace)CustomMarshal.PtrToStructure(mem, typeof(ShaderDebugTrace), true); CustomMarshal.Free(mem); @@ -791,12 +725,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(ShaderDebugTrace)); - bool success = ReplayRenderer_DebugThread(m_Real, groupid, threadid, mem); + ReplayRenderer_DebugThread(m_Real, groupid, threadid, mem); - ShaderDebugTrace ret = null; - - if (success) - ret = (ShaderDebugTrace)CustomMarshal.PtrToStructure(mem, typeof(ShaderDebugTrace), true); + ShaderDebugTrace ret = (ShaderDebugTrace)CustomMarshal.PtrToStructure(mem, typeof(ShaderDebugTrace), true); CustomMarshal.Free(mem); @@ -807,12 +738,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - bool success = ReplayRenderer_GetUsage(m_Real, id, mem); + ReplayRenderer_GetUsage(m_Real, id, mem); - EventUsage[] ret = null; - - if (success) - ret = (EventUsage[])CustomMarshal.GetTemplatedArray(mem, typeof(EventUsage), true); + EventUsage[] ret = (EventUsage[])CustomMarshal.GetTemplatedArray(mem, typeof(EventUsage), true); CustomMarshal.Free(mem); @@ -825,12 +753,9 @@ namespace renderdoc IntPtr entry_mem = CustomMarshal.MakeUTF8String(entryPoint); - bool success = ReplayRenderer_GetCBufferVariableContents(m_Real, shader, entry_mem, cbufslot, buffer, offs, mem); + ReplayRenderer_GetCBufferVariableContents(m_Real, shader, entry_mem, cbufslot, buffer, offs, mem); - ShaderVariable[] ret = null; - - if (success) - ret = (ShaderVariable[])CustomMarshal.GetTemplatedArray(mem, typeof(ShaderVariable), true); + ShaderVariable[] ret = (ShaderVariable[])CustomMarshal.GetTemplatedArray(mem, typeof(ShaderVariable), true); CustomMarshal.Free(entry_mem); CustomMarshal.Free(mem); @@ -853,13 +778,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(MeshFormat)); - MeshFormat ret = new MeshFormat(); - ret.buf = ResourceId.Null; + ReplayRenderer_GetPostVSData(m_Real, instID, stage, mem); - bool success = ReplayRenderer_GetPostVSData(m_Real, instID, stage, mem); - - if (success) - ret = (MeshFormat)CustomMarshal.PtrToStructure(mem, typeof(MeshFormat), true); + MeshFormat ret = (MeshFormat)CustomMarshal.PtrToStructure(mem, typeof(MeshFormat), true); CustomMarshal.Free(mem); @@ -870,12 +791,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - bool success = ReplayRenderer_GetBufferData(m_Real, buff, offset, len, mem); + ReplayRenderer_GetBufferData(m_Real, buff, offset, len, mem); - byte[] ret = new byte[] { }; - - if (success) - ret = (byte[])CustomMarshal.GetTemplatedArray(mem, typeof(byte), true); + byte[] ret = (byte[])CustomMarshal.GetTemplatedArray(mem, typeof(byte), true); CustomMarshal.Free(mem); @@ -886,12 +804,9 @@ namespace renderdoc { IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - bool success = ReplayRenderer_GetTextureData(m_Real, tex, arrayIdx, mip, mem); + ReplayRenderer_GetTextureData(m_Real, tex, arrayIdx, mip, mem); - byte[] ret = new byte[] { }; - - if (success) - ret = (byte[])CustomMarshal.GetTemplatedArray(mem, typeof(byte), true); + byte[] ret = (byte[])CustomMarshal.GetTemplatedArray(mem, typeof(byte), true); CustomMarshal.Free(mem); @@ -911,9 +826,9 @@ namespace renderdoc private static extern bool RemoteServer_Ping(IntPtr real); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool RemoteServer_LocalProxies(IntPtr real, IntPtr outlist); + private static extern void RemoteServer_LocalProxies(IntPtr real, IntPtr outlist); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] - private static extern bool RemoteServer_RemoteSupportedReplays(IntPtr real, IntPtr outlist); + private static extern void RemoteServer_RemoteSupportedReplays(IntPtr real, IntPtr outlist); [DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] private static extern void RemoteServer_GetHomeFolder(IntPtr real, IntPtr outfolder); @@ -1012,12 +927,9 @@ namespace renderdoc public string[] LocalProxies() { IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - bool success = RemoteServer_LocalProxies(m_Real, mem); + RemoteServer_LocalProxies(m_Real, mem); - string[] ret = null; - - if (success) - ret = CustomMarshal.TemplatedArrayToStringArray(mem, true); + string[] ret = CustomMarshal.TemplatedArrayToStringArray(mem, true); CustomMarshal.Free(mem); @@ -1027,12 +939,9 @@ namespace renderdoc public string[] RemoteSupportedReplays() { IntPtr mem = CustomMarshal.Alloc(typeof(templated_array)); - bool success = RemoteServer_RemoteSupportedReplays(m_Real, mem); + RemoteServer_RemoteSupportedReplays(m_Real, mem); - string[] ret = null; - - if (success) - ret = CustomMarshal.TemplatedArrayToStringArray(mem, true); + string[] ret = CustomMarshal.TemplatedArrayToStringArray(mem, true); CustomMarshal.Free(mem); diff --git a/renderdocui/Windows/TextureViewer.cs b/renderdocui/Windows/TextureViewer.cs index 205f78c92..a2bbb5a1b 100644 --- a/renderdocui/Windows/TextureViewer.cs +++ b/renderdocui/Windows/TextureViewer.cs @@ -3341,9 +3341,8 @@ namespace renderdocui.Windows m_Core.Renderer.BeginInvoke((ReplayRenderer r) => { PixelValue min, max; - bool success = m_Output.GetMinMax(out min, out max); + m_Output.GetMinMax(out min, out max); - if (success) { float minval = float.MaxValue; float maxval = -float.MaxValue; @@ -3437,17 +3436,14 @@ namespace renderdocui.Windows if (m_TexDisplay.CustomShader != ResourceId.Null) fmt.compCount = 4; - bool success = true; - uint[] histogram; - success = m_Output.GetHistogram(rangeHistogram.RangeMin, rangeHistogram.RangeMax, + m_Output.GetHistogram(rangeHistogram.RangeMin, rangeHistogram.RangeMax, m_TexDisplay.Red, m_TexDisplay.Green && fmt.compCount > 1, m_TexDisplay.Blue && fmt.compCount > 2, m_TexDisplay.Alpha && fmt.compCount > 3, out histogram); - if (success) { this.BeginInvoke(new Action(() => {