mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 23:52:22 +00:00
[gamecode] Decode the swizzle operand
-yx00 is much easier to interpret than some "random" number.
This commit is contained in:
parent
5f22fd07d9
commit
fb6d3f2f86
2 changed files with 24 additions and 1 deletions
|
@ -511,7 +511,7 @@ swizzle_formats = {
|
||||||
"opcode": "OP_SWIZZLE_{swiz_type[t]}",
|
"opcode": "OP_SWIZZLE_{swiz_type[t]}",
|
||||||
"mnemonic": "swizzle.{swiz_type[t]}",
|
"mnemonic": "swizzle.{swiz_type[t]}",
|
||||||
"opname": "swizzle",
|
"opname": "swizzle",
|
||||||
"format": "%Ga %sb %gc",
|
"format": "%Ga.%Sb %gc",
|
||||||
"widths": "4, 0, 4",
|
"widths": "4, 0, 4",
|
||||||
"types": "{swizzle_types[t]}",
|
"types": "{swizzle_types[t]}",
|
||||||
"args": {
|
"args": {
|
||||||
|
|
|
@ -1182,6 +1182,26 @@ global_string (pr_debug_data_t *data, pr_ptr_t offset, qfot_type_t *type,
|
||||||
return dstr->str;
|
return dstr->str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
swizzle_string (pr_debug_data_t *data, pr_uint_t swiz)
|
||||||
|
{
|
||||||
|
progs_t *pr = data->pr;
|
||||||
|
prdeb_resources_t *res = pr->pr_debug_resources;
|
||||||
|
static char swizzle_components[] = "xyzw";
|
||||||
|
const char *swizzle = "";
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
if (swiz & (0x1000 << i)) {
|
||||||
|
swizzle = va (res->va, "%s0", swizzle);
|
||||||
|
} else {
|
||||||
|
swizzle = va (res->va, "%s%s%c", swizzle,
|
||||||
|
swiz & (0x100 << i) ? "-" : "",
|
||||||
|
swizzle_components[(swiz >> 2 * i) & 3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return swizzle;
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
PR_Debug_ValueString (progs_t *pr, pr_ptr_t offset, qfot_type_t *type,
|
PR_Debug_ValueString (progs_t *pr, pr_ptr_t offset, qfot_type_t *type,
|
||||||
dstring_t *dstr)
|
dstring_t *dstr)
|
||||||
|
@ -1806,6 +1826,9 @@ PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents)
|
||||||
case 's':
|
case 's':
|
||||||
str = dsprintf (res->dva, "%d", (short) opval);
|
str = dsprintf (res->dva, "%d", (short) opval);
|
||||||
break;
|
break;
|
||||||
|
case 'S':
|
||||||
|
str = swizzle_string (&data, opval);
|
||||||
|
break;
|
||||||
case 'O':
|
case 'O':
|
||||||
str = dsprintf (res->dva, "%04x",
|
str = dsprintf (res->dva, "%04x",
|
||||||
addr + (short) opval);
|
addr + (short) opval);
|
||||||
|
|
Loading…
Reference in a new issue