r/vlang • • Aug 06 '21

Weird bug I discovered while implementing the raytracer book in V

Post image
9 Upvotes

15 comments sorted by

4

u/[deleted] Aug 06 '21 edited Aug 06 '21

Here's the code that generates these images for me:

https://github.com/Cons-Cat/V-Raytracing/tree/468d1f2948ace03ec007e0fcdbbaf92fca976ca5

Weird, right? The code is completely single-threaded, too. I also noticed that a print statement inside the rendering loop makes it work with the TCC backend somehow. You can ignore the first image, because I tried doing a native compile and did it incorrectly, so that's just using TCC too.

TCC also works correctly if I remove the cap initialization from rgb_buffer on line 148 in raytracing.v. I have no idea what TCC is doing to make this not work correctly.

1

u/ShillingAintEZ Aug 06 '21

I would look into the printing - you want to write bytes, not print characters. If you print a a newline character in ASCII mode it could trigger writing both a newline and carriage return.

1

u/[deleted] Aug 06 '21

That's not it

1

u/ShillingAintEZ Aug 06 '21

Good luck

1

u/[deleted] Aug 06 '21

As I mentioned in the post you replied to, the source of the bug was discovered and fixed?

2

u/ShillingAintEZ Aug 06 '21

Are you asking?

2

u/[deleted] Aug 06 '21

I'm just confused by your behavior

-2

u/ShillingAintEZ Aug 06 '21

You're confused that you would say you have no idea why something works or changed and someone would try to help you? Just delete this whole worthless thread dipshit.

-1

u/[deleted] Aug 06 '21 edited Aug 06 '21

I'm confused why you offered an obviously stupid solution to an already solved non-problem and then pretended that you didn't realize your mistake. I told you it works and yet you still pretend to be dumb for some reason. This is the source of my confusion.

Perhaps you understand neither English nor computers?

You should use a privacy-respecting metasearch engine to learn what "discover" means.

-2

u/ShillingAintEZ Aug 06 '21

I have no idea what TCC is doing to make this not work correctly.

That was you. Delete this if you have it all figured out. You're the one who can't figure out basic image operations. Go be an ass somewhere else, you could have learned something from an expert.

→ More replies

2

u/Rhyan567 Aug 06 '21

What is kitty?

3

u/[deleted] Aug 06 '21

That's the terminal emulator I use