# Utilities

Contents

- Utilities

  - Maths

  - Logging & Versioning

  - Versioning

  - Settings

  - Self-hosted captures

## Maths

class `renderdoc.``FloatVector`

  A floating point four-component vector

  `w`

    The w component.

  `x`

    The x component.

  `y`

    The y component.

  `z`

    The z component.

`renderdoc.``HalfToFloat`(half)

  A utility function that converts a half (stored in a 16-bit unsigned integer) to a float.

  Parameters

    half (int) – The half stored as an int.

  Returns

    The floating point equivalent.

  Return type

    float

`renderdoc.``FloatToHalf`(flt)

  A utility function that converts a float to a half (stored in a 16-bit unsigned integer).

  Parameters

    flt (float) – The floating point value.

  Returns

    The nearest half-float equivalent stored as an int.

  Return type

    int

## Logging & Versioning

`renderdoc.``LogMessage`(type, project, file, line, text)

  Add a message to RenderDoc’s logfile.

  Parameters

    - type (LogType) – The type of the log message. Error messages will trigger a debugger breakpoint if a debugger is attached, and fatal errors will kill the process after logging.

    - project (str) – A short project tag, which should be uppercase and either 3 or 4 characters.

    - file (str) – The file where this log message came from.

    - line (int) – The line number in `file` where this log message came from.

    - text (str) – The text of the message.

`renderdoc.``SetDebugLogFile`(filename)

  Sets the location for the diagnostic log output, shared by captured programs and the analysis program.

  Parameters

    filename (str) – The path to the new log file.

`renderdoc.``GetLogFile`()

  Gets the location for the diagnostic log output, shared by captured programs and the analysis program.

  Returns

    The path to the current log file.

  Return type

    str

`renderdoc.``GetCurrentProcessMemoryUsage`()

  Returns the current process’s memory usage in bytes

  Returns

    The current memory usage in bytes.

  Return type

    int

`renderdoc.``DumpObject`(obj)

  Returns a string representation of an object. This is quite similar to the built-in repr() function but it iterates over struct members and prints them out, where normally repr() would stop and say something like ‘Swig Object of type …’.

  Parameters

    obj (Any) – The object to dump

  Returns

    The string representation of the object.

  Return type

    str

class `renderdoc.``LogType`(value)

  The type of a log message

  `Debug`

    The log message is a verbose debug-only message that can be discarded in release builds.

  `Comment`

    The log message is informational.

  `Warning`

    The log message describes a warning that could indicate a problem or be useful in diagnostics.

  `Error`

    The log message indicates an error was encountered.

  `Fatal`

    The log message indicates a fatal error occurred which is impossible to recover from.

## Versioning

`renderdoc.``GetVersionString`()

  Retrieves the version string.

  This will be in the form “MAJOR.MINOR”

  Returns

    The version string.

  Return type

    str

`renderdoc.``GetCommitHash`()

  Retrieves the commit hash used to build.

  This will be in the form “0123456789abcdef0123456789abcdef01234567”

  Returns

    The commit hash.

  Return type

    str

`renderdoc.``IsReleaseBuild`()

  Determines if this is a release build of RenderDoc or not.

  Returns

    `True` if the replay is running on a release build.

  Return type

    bool

## Settings

`renderdoc.``GetConfigSetting`(name)

  Return a read-only handle to the `SDObject` corresponding to a given setting’s value object.

  If an empty string is passed, the root object is returned containing all settings and setting categories. Categories contain other categories and settings, settings contain children that include the setting’s value, description, etc.

  If no such setting exists, None is returned.

  Parameters

    name (str) – The name of the setting.

  Returns

    The specified setting.

  Return type

    SDObject

`renderdoc.``SetConfigSetting`(name)

  Return a mutable handle to the `SDObject` corresponding to a given setting’s value object.

  If no such setting exists, None is returned.

  Parameters

    name (str) – The name of the setting.

  Returns

    The specified setting.

  Return type

    SDObject

`renderdoc.``SaveConfigSettings`()

  Flush the current config settings as they are in memory to the config file on disk.

  Without calling this function, settings changes will only be temporary. The settings are not saved to disk on exit implicitly.

## Self-hosted captures

`renderdoc.``StartSelfHostCapture`(dllname)

  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.

  Parameters

    dllname (str) – The name of the self-hosted capture module.

`renderdoc.``EndSelfHostCapture`(dllname)

  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 end a capture.

  Parameters

    dllname (str) – The name of the self-hosted capture module.