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 BLACK_SCREEN, add format inference, and add new demo #124

Merged
merged 12 commits into from
Apr 2, 2025

Conversation

Devon7925
Copy link
Contributor

@Devon7925 Devon7925 commented Feb 23, 2025

closes #123
closes #119
closes #118
Since the screen size can now be got through measuring the size of a BLACK_SCREEN texture I'm also marking this as
closes #84

This also includes a number of derivative changes for code quality:

  • outputBuffer removed from imageMain.slang and printMain.slang. It wasn't being used.
  • outputTexture size now controlled from BLACK_SCREEN
  • imageMain and printMain are now called via attributes
  • removed computePipeline as it was no longer necessary due to main entrypoints being called from attributes

Deploy: https://devon7925.github.io/slang-playground/

@Devon7925

This comment was marked as outdated.


const static int MAX_BRUSH_SIZE = 16;

[playground::BLACK_SCREEN(1.0, 1.0)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm wondering that if we can extend this attribute to like "COLOR_SCREEN" attribute that we can accept a single color to clear the texture?

Copy link
Contributor Author

@Devon7925 Devon7925 Mar 6, 2025

Choose a reason for hiding this comment

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

I thought about it but decided against it because:

  • People can use a call once shader to set the color anyways
  • Color doesn't generalize well to int, uint, or < 3 component textures
  • It would require either specifying a color for every texture

It might make sense to have a set of DEFAULT_VALUE_ attributes that can also apply to buffers though...

In which case the attributes should be renamed:

  • ZEROS -> BUFFER
  • BLACK -> TEXTURE
  • BLACK_SCREEN -> SCREEN_TEXTURE

Copy link
Collaborator

@kaizhangNV kaizhangNV left a comment

Choose a reason for hiding this comment

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

LGTM overall

@Devon7925 Devon7925 changed the title Support BLACK_SCREEN and add new demo Support BLACK_SCREEN, add format inference, and add new demo Mar 20, 2025
@csyonghe csyonghe merged commit 26c5d41 into shader-slang:main Apr 2, 2025
1 check 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
3 participants