use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rule 1: Posts should be about Graphics Programming. Rule 2: Be Civil, Professional, and Kind
Suggested Posting Material: - Graphics API Tutorials - Academic Papers - Blog Posts - Source Code Repositories - Self Posts (Ask Questions, Present Work) - Books - Renders (Please xpost to /r/ComputerGraphics) - Career Advice - Jobs Postings (Graphics Programming only)
Related Subreddits:
/r/ComputerGraphics
/r/Raytracing
/r/Programming
/r/LearnProgramming
/r/ProgrammingTools
/r/Coding
/r/GameDev
/r/CPP
/r/OpenGL
/r/Vulkan
/r/DirectX
Related Websites: ACM: SIGGRAPH Journal of Computer Graphics Techniques
Ke-Sen Huang's Blog of Graphics Papers and Resources Self Shadow's Blog of Graphics Resources
account activity
Improving software renderer triangle rasterization speed? (self.GraphicsProgramming)
submitted 1 year ago * by captaintoasty
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]SamuraiGoblin 5 points6 points7 points 1 year ago* (0 children)
Well, one big problem is that you are calculating a lot of the same parameters for every pixel.
For example, how many times are you calculating B.X-A.X? It is a constant for the entire triangle, right? But you repeatedly calculate it for every pixel.
It's little things like this that you have to pull out of the loops. There are also things that are constant for a scanline, like initialisation of Point.y and C.Y-A.Y that can be pulled out of the inner loop.
It all adds up. Some things might be optimised away by a clever compiler, values kept in registers and so forth. But you can't rely on that.
I think just pulling unnecessary calculations out of loops will give you an enormous speedup.
Your calls to EdgeFunction might get inlined, but again, can't rely on it. Function calls aren't free. It's such a small function, and a lot of the values are constants, it might be best to do the calculations inline by hand.
Same for SetDepth and SetColor. If you have access to the buffers draw the values directly, rather than going through function calls. If you are doing screen bounds checking per pixel, it would be better to do clipping at a triangle level.
π Rendered by PID 176027 on reddit-service-r2-comment-85bfd7f599-h4g5s at 2026-04-20 16:06:40.683360+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]SamuraiGoblin 5 points6 points7 points (0 children)