Skip to content

Conversation

@Sharlock93
Copy link
Contributor

Description

When adding an array variable to the Watch window the VariableTag of the members do not have offsets so when they are sorted they are sorted by text which causes [2] to show after [10]:

Before:
image

After:
image

I'm not 100% sure if this is correct or not. Its worth noting that the High Level Variables
tab does have this sorted correctly and the member offset is set to the index of the member. At least
from just a cursory look. So this is just copying that behavior.

Same variable in the High Level Variables tab.
image

@Sharlock93
Copy link
Contributor Author

I just noticed that high level variables when they are built in like (gl_MeshVerticesEXT) are also
not sorted correctly. I have a small fix for the High Level Variables tab using the sourceVarIdx
however that information doesn't get lowered to the Watch window. I will have to take a bit of a deeper look.

@Sharlock93
Copy link
Contributor Author

I was able to fix both the High Level Variables and Watched variables for built-in arrays:

High Level Variables, Before:
image

High Level Variables, After:
image

Watch window for Built-in variables, Before:
image

Watch window for Built-in variables, After:
image

@Zorro666 Zorro666 self-assigned this Jan 4, 2026
Copy link
Collaborator

@Zorro666 Zorro666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fixes. I have noticed these problems before but it was never a priority to chase down.
I tested the fixes on DXIL and Spirv debugging and they worked very nicely.

Just one thing before the final approval.

Please could you edit the commit message description to remove what looks like the same information repeated a few times and please could it mention that the commit also fixes the sorting order in the "High Level Variables" windows for arrays.

You can force push your branch with the edited commit message to ensure a clean history of a single commit.

After your PR is merged I might copy the existing two duplicated pieces of code for sorting to use a common sort function to keep consistency of sorting in the watch window and combineStructures.

i.e. the current commit message


This sets the offset of the VariableTag for array members in the watch
window. This ensures they are sorted correctly when displayed.

Sorting array members in the watch window correctly

This sets the offset of the VariableTag for array members in the watch
window. This ensures they are sorted correctly when displayed.

Sorting array members in the watch window correctly

This sets the offset of the VariableTag for array members in the watch
window. This ensures they are sorted correctly when displayed.```

This sets the offset of the VariableTag for array members in the watch
window. This ensures they are sorted correctly when displayed.
This also adds sorting by sourceVarIdx if the memebers are
globalSourceVars which fixes the sorting in the High Level Variables
window for built-in Variables
@Sharlock93 Sharlock93 changed the title Sorting array members in the watch window correctly Sorting array members in the Watch and High Level Variables window Jan 5, 2026
@Sharlock93
Copy link
Contributor Author

Please could you edit the commit message description to remove what looks like the same information repeated a few times and please could it mention that the commit also fixes the sorting order in the "High Level Variables" windows for arrays.

I did not notice that at all! should be fixed.

After your PR is merged I might copy the existing two duplicated pieces of code for sorting to use a common sort function to keep consistency of sorting in the watch window and combineStructures.

I went ahead and did that. Hopefully this saves you a PR :)

@Sharlock93 Sharlock93 requested a review from Zorro666 January 5, 2026 15:08
Copy link
Collaborator

@Zorro666 Zorro666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for the iteration on the PR including adding the common helper function for sorting.

@Zorro666 Zorro666 merged commit 2a1b67e into baldurk:v1.x Jan 6, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants