-
Notifications
You must be signed in to change notification settings - Fork 9
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
print: use OpName
s to replace the T1
/F2
/v3
style, when unambiguous.
#36
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eddyb
changed the title
[WIP] start using
Use Jun 9, 2023
OpName
s to replace e.g. type123
in some cases.OpName
s to replace the type1
/func2
/v3
style, when unambiguous.
eddyb
added a commit
that referenced
this pull request
Jun 11, 2023
…dth back to 120. (#37) *Originally found/fixed during the #33/#34/#35/#36 series of pretty-printing PRs.* Before this PR, we were treating all text the same, regardless of style, but this PR introduces the concept of "fractional columns" (integer multiples of `0.1ch`, because our `font-size`s are always integer multiples of `0.1em`). The result is much more accurate, and so far appears to perfectly match browser behavior (i.e. the transition of `MAX_LINE_WIDTH` from `N-1` to `N`, where multi-line layout gets replaced with single-line layout, results in a line that "tightly fits" in a `max-width: Nch` container, with no spurious gaps or overflows). Note however that the increased accuracy makes the layout favor HTML over plaintext (and we don't have a plaintext-vs-HTML "simultaneous layout", nor a way to hint what the output of pretty layout will be used for), so the plaintext output may feel more inconsistent as a result (but its aesthetics are of dubious value anyway).
eddyb
added a commit
that referenced
this pull request
Jun 13, 2023
… syntax. (#35) This moves us from my ad-hoc `#{A, B, C}` to a Rust-style `#[A] #[B] #[C]` attribute syntax, and removes the idea of a "attribute set shorthand" (`attrs123 = #{...}` followed by uses of `#attrs123`), which was more annoying than useful (attributes can't refer to other attributes so there was no "exponential deduplication" need for it). With `#[...]` syntax, it also makes sense to never say e.g. `OpDecorate` (as the operand itself will contain the word `Decoration`), or to use `#[name = "..."]` Rust-style syntax for `OpName`. (I didn't touch `OpMember{Name,Decorate}`, might be worth having a SPIR-T `struct` type declaration syntax just to clean those up but it feels even more ad-hoc than usual - maybe it might make more sense after #36?) Comparison (using Kajiya's `assets/shaders/raster_simple_ps.hlsl`, compiled by DXC, like #33): |[**Before**](https://htmlpreview.github.io/?https://gist.github.com/eddyb/124d807950059893678ad55f51ee5107/raw/0-before-spirt%252335-raster_simple_ps.hlsl.structured.spirt.html)<br><sub>(click for complete pretty HTML example)</sub>|[**After**](https://htmlpreview.github.io/?https://gist.github.com/eddyb/124d807950059893678ad55f51ee5107/raw/1-after-spirt%252335-raster_simple_ps.hlsl.structured.spirt.html)<br><sub>(click for complete pretty HTML example)</sub>| |-|-| |![image](https://github.com/EmbarkStudios/spirt/assets/77424/82ee846a-0ed7-4f6b-be4f-7c6ccd1ba2fa)|![image](https://github.com/EmbarkStudios/spirt/assets/77424/f725b9bd-7715-4c96-8e4e-e573e41a8478)|
eddyb
added a commit
that referenced
this pull request
Jun 14, 2023
This is something I realized while looking at the output of #36, where keywords like `type` or `const` were overly verbose. I've kept the keywords but only on definitions, so e.g. `type T5 = ...` is referred to as `T5`. Comparison (using Kajiya's `assets/shaders/ircache/raster_origins_vs.hlsl`, compiled by DXC): |[**Before**](https://htmlpreview.github.io/?https://gist.github.com/eddyb/809b734460afeaa5c72c31992c9d0bbb/raw/0-before-spirt%252339-raster_origins_vs.hlsl.structured.spirt.html)<br><sub>(click for complete pretty HTML example)</sub>|[**After**](https://htmlpreview.github.io/?https://gist.github.com/eddyb/809b734460afeaa5c72c31992c9d0bbb/raw/1-after-spirt%252339-raster_origins_vs.hlsl.structured.spirt.html)<br><sub>(click for complete pretty HTML example)</sub>| |-|-| |![image](https://github.com/EmbarkStudios/spirt/assets/77424/51526d40-f404-47f9-a54b-535367658ee6)|![image](https://github.com/EmbarkStudios/spirt/assets/77424/5bd320ad-f559-4ace-9180-1aa707973973)| |![image](https://github.com/EmbarkStudios/spirt/assets/77424/c3f75dc3-fdad-487e-866c-c9c35d770275)|![image](https://github.com/EmbarkStudios/spirt/assets/77424/96c8eb55-a14e-48f8-886d-a10b8f8c8550)|
eddyb
changed the title
Use
print: use Jun 15, 2023
OpName
s to replace the type1
/func2
/v3
style, when unambiguous.OpName
s to replace the T1
/F2
/v3
style, when unambiguous.
eddyb
force-pushed
the
print-names
branch
2 times, most recently
from
June 15, 2023 08:52
e703079
to
20828bf
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've also made the
T1
style use subscripts (so more likeT₁
), because I wasn't happy with the aesthetics of having digits exactly as large as the prefix.The reason I haven't done the subscript change earlier is e.g.
v5
already looks great, andv₅
andT₅
still looks different because theT
is larger than thev
- the missing trick was to make the subscripts larger when the prefix is uppercase, which seems to balance things out.Comparison (using Kajiya's
assets/shaders/ircache/raster_origins_vs.hlsl
, compiled by DXC, like #39):(click for complete pretty HTML example)
(click for complete pretty HTML example)