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

Add Custom Pixel Function to graphx #450

Open
beckadamtheinventor opened this issue Nov 4, 2023 · 1 comment
Open

Add Custom Pixel Function to graphx #450

beckadamtheinventor opened this issue Nov 4, 2023 · 1 comment

Comments

@beckadamtheinventor
Copy link
Contributor

It would be nice if GraphX had a way of setting a global pixel function for drawing routines. (especially primitives)
This would be useful for example in texturing and shading. Yes I know this would lower performance, but it'd be really cool.
The pixel function (and state information) would probably have to be loaded into cursorImage (fast ram) to have any semblance of speed.

In places that don't already call the existing global pixel function it could be padded with nop opcodes and SMC'd into a call if the custom pixel function is set. To handle alternative argument combinations multiple functions could be used to move the arguments around for the user's pixel function. As for preserving registers during, use the shadow registers and disable interrupts as part of setting the custom function. (documented in bold obviously)
I'll probably work on this myself at some point, as well as (attempt) to write a shader compiler of sorts for generating more efficient code for said pixel function.

@calc84maniac
Copy link
Contributor

Practically all of the filled drawing functions don't use a global set pixel function, but a horizontal line function (which is also already being called via C ABI and tends to be chosen based on clipped or non-clipped variants of the routines). In my opinion, this would be a much more effective customization point for efficiency purposes, at a minimum of added code - simply add a new API for each filled graphics routine that accepts a horizontal line draw function as its last parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants