* Given socket corruption or network errors these strings could contain
unprintable characters so we sanitise them reasonably. This also ameliorates a
potential security concern with arbitrary strings being written to a log, but
these connections are still considered trusted and users should not be
exposing RenderDoc ports to the internet.
Fixes compilation on non i386/x86_64 Linux targets.
Don't use arch specific assembly for other architectures because
in most cases it breaks gdb ability to do next step.
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
* It complains that there is switch fallthrough after an unconditional return,
when it's inside a do{}while(0). Simplifying the while condition seems to
address it.
* Most of the main entry points that can fail with relevant reasons now has a
way of specifying a message to return with it. This message can be displayed
to the user to give more information or context about an error.
Block-compressed textures with dimensions that are not evenly divisible
by the block size are typically padded internally to align with the
block size. load_dds_from_file() was previously corrected to account for
this alignment when calculating the number of rows of blocks to read
from a DDS file, but the fix was not applied to write_dds_to_file(),
resulting in missing rows of texels or loading failures when attempting
to open a DDS file generated by RenderDoc from a texture whose
dimensions are not a multiple of four.
* We need to ensure we remodify LD_LIBRARY_PATH and LD_PRELOAD before fork/exec
if the application (say bash running a script) has overwritten them. We also
don't want these to be accidentally inherited into children if we're not
hooking children - the same for the vulkan env var, which can't be unset
immediately on process injection like the others because it needs to hang
around indefinitely.
* This prevents unnecessary conversions back and forth between rdcstr and const
char * when going through interfaces. In the OS specific layer this is rarely
an issue because most of the implementations don't convert to rdcstr, but it
is convenient to be able to pass in an rdcstr directly. The few cases where
there's an unecessary construction of an rdcstr is acceptable.
* A couple of places in the public API need to return a string from a global
function, so can't return an rdcstr due to C ABI, so they still return a const
char *.
* Similarly const char * is kept for logging, to avoid a dependency on rdcstr
and because that's one place where unnecessary conversions/constructions may
be impactful.
* The cost of searching a few more pools to check allocations isn't so bad
especially if we can move IsAlloc() off the hot path. Better that than
allocating 100MB in pools.
* We don't expect contention on this, the only time it will contend is when
actively capturing a frame between updates and submits reading the descriptor
contents, so we penalise that case while making the background case faster -
since a spinlock is 'free' to take when there's no contention.
* Due to standards nonsense the availability of isinf/isnan in C++ is quite
complex and varies a lot between compilers. Trying to access them reliably is
quite brittle and they're easy to implement with bit-inspection of float
patterns, so we do that instead.