mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/sm1: Introduce a parser for the legacy D3D byte-code format.
This is largely derived from the parser in Wine/wined3d, as of wine-6.18. Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
committed by
Alexandre Julliard
parent
28316b2694
commit
f7662f9878
@@ -132,22 +132,25 @@ static int get_escape_char(int c)
|
||||
}
|
||||
}
|
||||
|
||||
const char *debugstr_a(const char *str)
|
||||
const char *debugstr_an(const char *str, size_t n)
|
||||
{
|
||||
char *buffer, *ptr;
|
||||
int escape_char;
|
||||
char c;
|
||||
|
||||
if (!str)
|
||||
return "(null)";
|
||||
if (n == SIZE_MAX)
|
||||
n = strlen(str);
|
||||
|
||||
ptr = buffer = get_buffer();
|
||||
|
||||
*ptr++ = '"';
|
||||
while ((c = *str++) && ptr <= buffer + VKD3D_DEBUG_BUFFER_SIZE - 8)
|
||||
while (n-- && ptr <= buffer + VKD3D_DEBUG_BUFFER_SIZE - 8)
|
||||
{
|
||||
int escape_char = get_escape_char(c);
|
||||
c = *str++;
|
||||
|
||||
if (escape_char)
|
||||
if ((escape_char = get_escape_char(c)))
|
||||
{
|
||||
*ptr++ = '\\';
|
||||
*ptr++ = escape_char;
|
||||
@@ -167,7 +170,7 @@ const char *debugstr_a(const char *str)
|
||||
}
|
||||
*ptr++ = '"';
|
||||
|
||||
if (c)
|
||||
if (++n)
|
||||
{
|
||||
*ptr++ = '.';
|
||||
*ptr++ = '.';
|
||||
@@ -178,6 +181,11 @@ const char *debugstr_a(const char *str)
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const char *debugstr_a(const char *str)
|
||||
{
|
||||
return debugstr_an(str, SIZE_MAX);
|
||||
}
|
||||
|
||||
static const char *debugstr_w16(const uint16_t *wstr)
|
||||
{
|
||||
char *buffer, *ptr;
|
||||
|
Reference in New Issue
Block a user