Skip to content
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

Support shader-printf and remove write-only texture WAR #26

Merged
merged 4 commits into from
Oct 31, 2024

Conversation

kaizhangNV
Copy link
Collaborator

Add shader-printf support in our playground, now user can play with c style printf.

Since slang already support write-only texture type, we can now remove the WAR that using one-channel write-read texture as the storage texture and encode all color channels into one. Now we can use 4 channel texture in our playground.

TODO:
There are still two remaining issues on slang side.

  1. slang doesn't support brga8 format texture, [format('bgra8')] WTexture2D ...; will cause error. slang doesn't support bgra8 format texture. slang#5469
  2. a bug in supporting bit_cast<uint64_t>(double): Bug on supporting bit_cast<uint64_t>(double) slang#5470

interface IPrintf
{
uint32_t typeFlag();
uint32_t writePrintfWords();
Copy link
Contributor

Choose a reason for hiding this comment

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

If we pass the index counter + g_printBuffer directly into this method, we can make vectors and matrices or even arrays implement IPrintf.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yea, good point, but now we can not add g_printBuffer into the function parameter. Looks like wgsl doesn't support it and we need some legalization path like glsl to make this happen.


internal RWStructuredBuffer<FormatedStruct> g_printedBuffer;

interface IPrintf
Copy link
Contributor

Choose a reason for hiding this comment

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

public interface IPrintable.

try-slang.js Outdated Show resolved Hide resolved
compute.js Outdated Show resolved Hide resolved
@kaizhangNV kaizhangNV merged commit efbccca into shader-slang:main Oct 31, 2024
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