Skip to content

UI: avoid shader handle->name->handle round trips#3347

Merged
slipher merged 2 commits intoUnvanquished:masterfrom
slipher:hroundtrip
Mar 18, 2025
Merged

UI: avoid shader handle->name->handle round trips#3347
slipher merged 2 commits intoUnvanquished:masterfrom
slipher:hroundtrip

Conversation

@slipher
Copy link
Copy Markdown
Contributor

@slipher slipher commented Mar 17, 2025

For some UI elements (e.g. weapon and upgrade icons) a round trip of trap_R_RegisterShader( trap_R_ShaderNameFromHandle( handle ) ) was done each time the shader was used, incurring 2 IPC calls. Avoid this by introducing a magic syntax for RML image paths, for example "/$handle/123", which allows a handle to be plumbed through RmlUi.

This gets rid of one of the IPC calls listed in #3157.

For some UI elements (e.g. weapon and upgrade icons) a
round trip of trap_R_RegisterShader( trap_R_ShaderNameFromHandle(
handle ) ) was done each time the shader was used, incurring 2 IPC
calls. Avoid this by introducing a magic syntax for RML image paths,
for example "/$handle/123", which allows a handle to be plumbed through
RmlUi.

NUKE CG_GetShaderNameFromHandle.
Copy link
Copy Markdown
Member

@DolceTriade DolceTriade left a comment

Choose a reason for hiding this comment

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

Can we document this somewhere? high level idea seems ok to me, but the magic will be confusing without sufficient bread crumbs

@slipher
Copy link
Copy Markdown
Contributor Author

slipher commented Mar 17, 2025

Can we document this somewhere? high level idea seems ok to me, but the magic will be confusing without sufficient bread crumbs

I don't see why it would be difficult to figure out. Easy to grep for $handle.

@DolceTriade
Copy link
Copy Markdown
Member

I don't see why it would be difficult to figure out. Easy to grep for $handle.

Yes, but that will result in all usages of $handle too and you need to identify the source. At the very least, I'd like this documented in GetShaderHandle. Some of the other magic prefixes were surprises to me as well.

@slipher
Copy link
Copy Markdown
Contributor Author

slipher commented Mar 17, 2025

At the very least, I'd like this documented in GetShaderHandle.

Done.

@illwieckz
Copy link
Copy Markdown
Member

illwieckz commented Mar 17, 2025

As a side remark, and this also applies to the already existing $levelshot, I would prefer if the syntax of such pseudo-variable has an obvious ending token, like ${handle} or ${levelshot}.

The idea is good though.

@slipher
Copy link
Copy Markdown
Contributor Author

slipher commented Mar 18, 2025

As a side remark, and this also applies to the already existing $levelshot, I would prefer if the syntax of such pseudo-variable has an obvious ending token, like ${handle} or ${levelshot}.

It's not like a variable. More of a magic directory like Unix /proc. Refer to #3214 (comment).

@slipher slipher merged commit 2e03bae into Unvanquished:master Mar 18, 2025
9 checks passed
@slipher slipher deleted the hroundtrip branch March 18, 2025 07:04
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.

3 participants