Skip to content

Commit 886d7f6

Browse files
committed
RD DXIL Disassembly simplify the getelementr ptr demangle code
Similar to DXBC::BasicDemangle() which can't be used because the pointer string is an escaped string
1 parent 44fdde8 commit 886d7f6

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

renderdoc/driver/shaders/dxil/dxil_disassemble.cpp

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4080,32 +4080,15 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
40804080

40814081
// arg[0] : ptr
40824082
rdcstr ptrStr = ArgToString(inst.args[0], false);
4083-
// Try to de-mangle the pointer name
4084-
// @"\01?shared_pos@@3PAY0BC@$$CAMA.1dim" -> shared_pos
4085-
// Take the string between first alphabetical character and last
4086-
// alphanumeric character or "_"
4087-
start = 0;
4088-
int strEnd = (int)ptrStr.size();
4089-
while(start < strEnd)
4083+
// Simple demangle take string between first "?" and next "@"
4084+
int nameStart = ptrStr.indexOf('?');
4085+
if(nameStart > 0)
40904086
{
4091-
if(isalpha(ptrStr[start]))
4092-
break;
4093-
++start;
4087+
nameStart++;
4088+
int nameEnd = ptrStr.indexOf('@', nameStart);
4089+
if(nameEnd > nameStart)
4090+
ptrStr = ptrStr.substr(nameStart, nameEnd - nameStart);
40944091
}
4095-
if(start < strEnd)
4096-
{
4097-
end = start + 1;
4098-
while(end < strEnd)
4099-
{
4100-
char c = ptrStr[end];
4101-
if(!isalnum(c) && c != '_')
4102-
break;
4103-
++end;
4104-
}
4105-
}
4106-
if(end > start)
4107-
ptrStr = ptrStr.substr(start, end - start);
4108-
41094092
lineStr += ptrStr;
41104093
// arg[1] : index 0
41114094
bool first = true;

0 commit comments

Comments
 (0)