Files
renderdoc/docs/TipsNTricks.aml
T

121 lines
6.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<topic id="e2878f27-34d3-458a-9077-d0fb32c16829" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>
This page is a random hodge-podge of different tips and tricks that might not be obvious
and aren't practical to make clear in the UI - e.g. keyboard shortcuts, edge cases
and suchlike.
</para>
</introduction>
<section address="Section1">
<title>Tips &amp; Tricks</title>
<content>
<para>
<list class="ordered">
<listItem><para>File associations for .rdc and .cap files can be set up in the installer or in the
<link xlink:href="B1826EEE-2ED1-44E4-8202-37CD8B3FEEB5" />. These allow automatic
opening of capture logs or capture settings files directly from files.</para>
<alert class="note">
<para>These associations must be re-created if RenderDoc is moved to another folder.</para>
</alert>
</listItem>
<listItem><para>RenderDoc can be used as an image viewer! If you drag in or use file &#8594; open, you can
open images in a variety of formats - .dds, .hdr, .exr, .bmp, .jpg, .png, .tga, .gif, .psd. The image
will load up in RenderDoc's texture viewer and you can use the normal controls to view it as if it were
a texture in a log. Note that dds files support all DXGI formats, compressed formats, arrays and mips -
all of which will display as expected. If the file is modified, RenderDoc will reload it and display
it. Note that changing the image's dimensions or format will likely cause problems.</para></listItem>
<listItem><para>If a .cap file is saved with the "auto-start" option enabled, launching RenderDoc
by opening this file will cause RenderDoc to automatically trigger a capture with the given options.
This is useful for saving a common path &amp; set of options that you regularly re-run.</para>
<para>For more information check out the <link xlink:href="D1612D25-C8BA-4349-9CE2-1E57D60F98C5" />
page.</para></listItem>
<listItem><para>If you'd like to see the geometry data with each component separated out and formatted,
either open "Mesh Output" under the window menu, or click the Go Arrow <mediaLinkInline><image xlink:href="GoArrow"/></mediaLinkInline>
on the input layouts in the <link xlink:href="A44E2304-6C11-451D-89C4-0A7397F5D1C6" />.</para></listItem>
<listItem><para>Right clicking on one of the channel buttons in the texture viewer
(R, G, B, A) will either select only that channel, or if it's already the only one
selected it will select all of the others. This is useful e.g. to toggle between viewing
RGB and alpha, or for looking at individual channels in a packed texture or render target.</para></listItem>
<listItem><para>Similarly, right-clicking on the 'auto-fit' button
<mediaLinkInline><image xlink:href="wand"/></mediaLinkInline> will auto-fit whenever the texture
or event changes, so that the visible range is maintained as you move through the frame. This can be useful
if jumping between places where the visible range is very different.</para></listItem>
<listItem><para>You can double click on a thumbnail in the texture viewer to open a
<link xlink:href="32C47E20-0FA2-4F52-B33A-4440EBCCBCE4">locked texture</link> tab</para></listItem>
<listItem><para>You can close tabs by middle clicking on them.</para></listItem>
<listItem><para>You can trigger a capture from code. renderdoc.dll exports a function for this
purpose:
<code language="cpp">
typedef void (__cdecl *pRENDERDOC_TriggerCapture)();
// At init
HMODULE renderdoc = GetModuleHandle(_T("renderdoc.dll"));
pRENDERDOC_TriggerCapture triggerFunc =
(pRENDERDOC_TriggerCapture)GetProcAddress(renderdoc, "RENDERDOC_TriggerCapture");
// When you wish to trigger the capture
triggerFunc();
</code>
</para>
<para>The next <codeInline>Swap()</codeInline> after this call will begin the captured frame,
and the <codeInline>Swap()</codeInline> after that will end it (barring complications)</para>
<para>You can also use the RENDERDOC_StartFrameCapture and RENDERDOC_EndFrameCapture functions
to precisely define the period to be captured. For more information look at the renderdoc_app.h
header in the source code.</para>
</listItem>
<listItem><para>When you have right clicked to select a pixel in the texture viewer, you can
perform precise refinements with the arrow keys to nudge the selection in each direction.</para></listItem>
<listItem><para>To get API debug or error messages, enable "Create Debug Device" when capturing
then check out the <link xlink:href="1f098896-0e60-485a-b879-900a4a320b80" /> window.</para></listItem>
<listItem><para>Detecting RenderDoc from your code can either be done by trying to load and
use the renderdoc in-program API, or through API specific ways:
<code language="cpp">
// For D3D11:
ID3D11Device *devicePointer = ...;
IUnknown *unk = NULL;
HRESULT hr = devicePointer->QueryInterface(MAKE_GUID({A7AA6116-9C8D-4BBA-9083-B4D816B71B78}), &amp;unk);
if(SUCCEEDED(hr)) { /* renderdoc is present; */ }
// For OpenGL:
// if GL_EXT_debug_tool is present (see https://renderdoc.org/debug_tool.txt)
glIsEnabled(GL_DEBUG_TOOL_EXT);
// Until enumerants are assigned (if that ever happens):
#define GL_DEBUG_TOOL_EXT 0x6789
#define GL_DEBUG_TOOL_NAME_EXT 0x678A
#define GL_DEBUG_TOOL_PURPOSE_EXT 0x678B
</code></para></listItem>
<listItem><para>RenderDoc can be informed about separated debug shader blobs through API specific ways:
<code language="cpp">
// For D3D11:
GUID RENDERDOC_ShaderDebugMagicValue = RENDERDOC_ShaderDebugMagicValue_value; // GUID value in renderdoc_app.h
ID3D11VertexShader *shader = ...;
std::string pathName = ...; // path name is in UTF-8
// string parameter must be NULL-terminated, and in UTF-8
shader->SetPrivateData(RENDERDOC_ShaderDebugMagicValue, (UINT)pathName.length(), pathName.c_str());
// Alternatively at build time:
struct { GUID guid; char name[MAX_PATH]; } path;
path.guid = RENDERDOC_ShaderDebugMagicValue;
// must include NULL-terminator, and be in UTF-8
memcpy(path.name, debugPath.c_str(), debugPath.length() + 1);
size_t pathSize = sizeof(GUID) + debugPath.length() + 1;
D3DSetBlobPart(strippedBlob->GetBufferPointer(), strippedBlob->GetBufferSize(), D3D_BLOB_PRIVATE_DATA, 0, &amp;path, pathSize, &amp;annotatedBlob);
// use annotatedBlob instead of strippedBlob from here on
</code></para></listItem>
<listItem><para>More coming soon hopefully :).</para></listItem>
</list>
</para>
</content>
</section>
</developerConceptualDocument>
</topic>