-
Notifications
You must be signed in to change notification settings - Fork 427
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
Broken shader example in the guide #576
Comments
I'm not a fan of this solution, but it does work: # given a shader, returns a square image
def render(depth):
bend d = 0, i = 0:
when d < depth:
# create more pixels
pixel = (fork(d+1, i*2+0), fork(d+1, i*2+1))
else:
width = depth / 2
# calculate the color of the pixel
bend i = i % width, y = i / width:
# for this demo, it just busy loops
when i < 10:
color = fork(i + 1, y)
else:
color = 0x000001
pixel = color
return pixel
# renders a 256x256 image using demo_shader
def main:
return render(5) Any other ideas? @developedby @imaqtkatt |
you can just
|
Oh 🤦 that's much easier |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reproducing the behavior
The PR HigherOrderCO/HVM#379 broke one of the examples in the guide, namely:
Bend/GUIDE.md
Lines 748 to 772 in c3b1a36
It's also one of Bend's automated tests:
Bend/tests/golden_tests/run_file/guide_shader_dummy.bend
Lines 1 to 23 in c3b1a36
This is because
demo_shader
is now marked as unsafe since it contains a DUP (it duplicatesi
), andrender
tries to duplicate it by running it in every step of its recursion.We could fix this by inlining
demo_shader
.System Settings
MacBook Air M2
Additional context
No response
The text was updated successfully, but these errors were encountered: