8000 Pragma to force function inlining by eldritchconundrum · Pull Request #462 · laurentlb/shader-minifier · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Pragma to force function inlining #462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 24, 2024
Merged

Pragma to force function inlining #462

merged 4 commits into from
Sep 24, 2024

Conversation

eldritchconundrum
Copy link
Collaborator

No description provided.

src/rewriter.fs Outdated
forceInlineNextFunction <- None
Some tl
| tl -> Some tl
let li = li |> List.choose processPragmas
Copy link
Owner

Choose a reason for hiding this comment

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

not let needed: li |> List.choose processPragmas |>

src/rewriter.fs Outdated
let mutable forceInlineNextFunction = None
let processPragmas tl =
match tl with
| TLDirective ["#pragma function inline"] ->
Copy link
Owner

Choose a reason for hiding this comment

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

String matching is very restricted and will fail if there's any extra whitespace.
In theory, we could parse the pragmas in the parser.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll accept multiple spaces. But I'm not so sure that the parser is the best place to process a format that's specific to minifier rather than specific to the language.

| None -> ()
forceInlineNextFunction <- None
Some tl
| tl -> Some tl
Copy link
Owner

Choose a reason for hiding this comment

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

What if #pragma function inline is not followed by a function?
Do we want to handle that case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could emit a warning for unused function inline pragmas.

@eldritchconundrum eldritchconundrum merged commit cfeae09 into master Sep 24, 2024
1 check passed
@eldritchconundrum eldritchconundrum deleted the pragma-inline branch September 24, 2024 17:37
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
0