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

DARRAY Instruction implemented #68

Merged
merged 1 commit into from
Sep 14, 2024
Merged

Conversation

DerelictDrone
Copy link
Member

@DerelictDrone DerelictDrone commented Sep 10, 2024

Implements the DARRAY instruction

Though the only documentation of its existence was a commented out CPULIB entry stating that it took VEC2F, and STRUCT as arguments, and the description stating "Draw an array of pixels", this adds it in a functional state.

VEC2F is position to start draw
STRUCT is a pointer to a struct made up of:
Resolution X
Resolution Y
Pixel Width
Pixel Height
Color Mode (this currently has the same set of color modes as the digital screen)
Pointer to color buffer

Uses a quota interrupt like MCOPY to allow a buffer of any size to be drawn.

Color modes available:
0 = RGBXXX (1 cell per pixel)
1 = R G B (3 cells per pixel)
2 = 24 Bit RGB / True Color Mode (1 cell per pixel)
3 = RRRGGGBBB / Digit packed RGB mode (1 cell per pixel)
4 = Mono color / Grayscale (1 cell per pixel)

Color modes 0, 2, and 3 all cache colors and add an arbitrarily defined cycle penalty for each uncached color that needs processing.
Cycle penalty for mode 0 = 8 cycles
Cycle penalty for mode 2 = 10 cycles
Cycle penalty for mode 3 = 15 cycles

All examples below are running on a GPU in a 2.1MHz async thread, and are using color mode 2

Example showing its rendering speed for a 512x512 pattern of 8 colors

renderspeed.512512.mp4

Example showing its rendering speed for a 512x512 pattern of unique colors(262144 colors total, getting full caching penalty for each pixel)

512512.darray.zerocache.mp4

Example showing it rendering an 128x128 image of the workshop image for wire-cpu, scaled up to 512x512 by setting Pixel Width and Pixel Height to 4,4 in the DARRAY struct

wirecpu.rendertest.128128.mp4

@DerelictDrone DerelictDrone merged commit 13da808 into wiremod:master Sep 14, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants