-
Notifications
You must be signed in to change notification settings - Fork 62
Add software renderer implementation for SDL 1.2 backend #128
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
Draft
iProgramMC
wants to merge
45
commits into
ButterscotchRunner:main
Choose a base branch
from
iProgramMC:sw-renderer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 10 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
ed0aca8
Add initial software renderer implementation.
iProgramMC b813cff
Remove redundant src/image inclusion.
iProgramMC c6791e7
Add build rules for Makefile
iProgramMC 8bb4bc1
Fix oopsie
iProgramMC 0fe1273
* endFrameInit/endFrameEnd no longer print "NYI"
iProgramMC 01b7312
fix build
Un1q32 560d035
Merge pull request #2 from Un1q32/sw-pr
iProgramMC d978ae5
Merge branch 'sw-renderer' of github.com:iProgramMC/Butterscotch into…
iProgramMC 9a01740
Prepare for surface work
iProgramMC a443be3
Relocate a function
iProgramMC 0e1ccac
chmod -x
Un1q32 c2a71bd
no binary litterals in C99
Un1q32 d7249d7
likely macro compat
Un1q32 9e2c1d8
Merge pull request #4 from Un1q32/sw-pr
iProgramMC 1032617
Attempt to fix a big-endian issue by byte-swapping the color channel …
iProgramMC deb760d
Don't call Runner_setNextFrame twice in a frame.
iProgramMC 0d9a25f
Merge remote-tracking branch 'upstream/main' into sw-pr
Un1q32 e72eb28
fix
Un1q32 81ea0e9
Merge pull request #5 from Un1q32/sw-pr
iProgramMC 1bddaaf
Implement big endian mode for the software renderer.
iProgramMC 05d57f1
* Add initial support for sprite surfaces.
iProgramMC a70e786
* Fix yet another rotation pivot issue.
iProgramMC 83c3c17
* Fix a bug where createSpriteFromSurface completely ignored screen s…
iProgramMC c2aac32
* Fix a bug where pivotX/Y didn't take into account the diff between …
iProgramMC 5e43ec9
* SDL Frontend: Use fbWidth/fbHeight instead of reqW/reqH for the SDL…
iProgramMC 66d1235
Revert "* SDL Frontend: Use fbWidth/fbHeight instead of reqW/reqH for…
iProgramMC d08d786
Merge branch 'main' of https://github.com/MrPowerGamerBR/Butterscotch…
iProgramMC cb5c0be
Add enableApplicationSurface.
iProgramMC ee34b16
Merge branch 'main' of github.com:iProgramMC/Butterscotch into sw-ren…
iProgramMC c951bd6
* Update drawText / drawTextColor definitions
iProgramMC e8eef6d
* Fix a bug with rotations
iProgramMC c2980fb
Merge branch 'main' of https://github.com/MrPowerGamerBR/Butterscotch…
iProgramMC 1024353
* Add support for drawLineColor.
iProgramMC a81e9c0
* Add support for gradient lines.
iProgramMC 2eafb16
Merge branch 'main' of https://github.com/MrPowerGamerBR/Butterscotch…
iProgramMC cea76f1
* Add initial implementation of the triangle render function.
iProgramMC 3f3b3d0
* Actually apply transforms to this triangle + remove the test code.
iProgramMC 140304e
* Bugfixes with the triangle renderer
iProgramMC 23bd43d
* Fix a bug where drawSpritePart was doubly handling sprite flipping.
iProgramMC 08090dc
* Small 8bpp renderer fix
iProgramMC 29bd1d3
* Attempt at optimization that I'll revert
iProgramMC 30150cb
Revert "* Attempt at optimization that I'll revert"
iProgramMC 7e09706
Merge pull request #6 from Un1q32/sw-pr
Un1q32 7b961d9
add letterboxing and pillarboxing instead of streching (#7)
Un1q32 ad8ee62
* Increase precision of fixed point increment when scaling sprites.
iProgramMC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #pragma once | ||
|
|
||
| #define LIKELY(cond) __builtin_expect(!!(cond), 1) | ||
| #define UNLIKELY(cond) __builtin_expect(!!(cond), 0) | ||
|
|
||
| #define UNUSED __attribute__ ((unused)) | ||
| #define FORCE_INLINE static inline __attribute__((always_inline)) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| #pragma once | ||
|
|
||
| #include "defines.h" | ||
|
|
||
| // CONFIG: Change the size of a pixel. | ||
| // | ||
| // 32-bit: 0xAARRGGBB | ||
| // 16-bit: 0b0RRRRRGGGGGBBBBB | ||
| // 8-bit: 0bBBGGGRRR | ||
| #define PIXEL_SIZE 32 | ||
| //#define PIXEL_SIZE 16 | ||
| //#define PIXEL_SIZE 8 | ||
|
|
||
| #if PIXEL_SIZE == 32 | ||
| typedef uint32_t uintpixel_t; | ||
| #elif PIXEL_SIZE == 16 | ||
| typedef uint16_t uintpixel_t; | ||
| #elif PIXEL_SIZE == 8 | ||
| typedef uint8_t uintpixel_t; | ||
| #define PXL_TRANSPARENT (0b10101010) | ||
| #else | ||
| #error "Unknown pixel size!" | ||
| #endif | ||
|
|
||
| typedef union | ||
| { | ||
| struct { | ||
| uint8_t r, g, b, a; | ||
| } p; | ||
| uint32_t l; | ||
| } | ||
| Pixel32ABGR; | ||
|
|
||
| typedef union | ||
| { | ||
| struct { | ||
| uint8_t b, g, r, a; | ||
| } p; | ||
| uint32_t l; | ||
| } | ||
| Pixel32ARGB; | ||
|
|
||
| FORCE_INLINE UNUSED | ||
| uint16_t abgr8888_to_rgb1555(uint32_t xl) | ||
| { | ||
| Pixel32ABGR x; | ||
| x.l = xl; | ||
| return (x.p.b >> 3) | ((x.p.g >> 3) << 5) | ((x.p.r >> 3) << 10) | ((x.p.a >> 7) << 15); | ||
| } | ||
|
|
||
| FORCE_INLINE UNUSED | ||
| uint8_t abgr8888_to_rgb332(uint32_t xl) | ||
| { | ||
| Pixel32ABGR x; | ||
| x.l = xl; | ||
|
|
||
| #if PIXEL_SIZE == 8 | ||
| //check if transparent | ||
| if (x.p.a < 128) | ||
| return PXL_TRANSPARENT; | ||
| #endif | ||
|
|
||
| uint8_t pxl = (x.p.r >> 5) | ((x.p.g >> 5) << 3) | ((x.p.b >> 6) << 6); | ||
|
|
||
| #if PIXEL_SIZE == 8 | ||
| //hacky fixup | ||
| if (pxl == PXL_TRANSPARENT) | ||
| pxl++; | ||
| #endif | ||
|
|
||
| return pxl; | ||
| } | ||
|
|
||
| FORCE_INLINE UNUSED | ||
| uintpixel_t swrConvertPixelTexture(uint32_t gmPixel) | ||
| { | ||
| #if PIXEL_SIZE == 32 | ||
| return (gmPixel & 0xFF00FF00) | ((gmPixel & 0xFF) << 16) | ((gmPixel >> 16) & 0xFF); | ||
| #elif PIXEL_SIZE == 16 | ||
| return abgr8888_to_rgb1555(gmPixel); | ||
| #elif PIXEL_SIZE == 8 | ||
| return abgr8888_to_rgb332(gmPixel); | ||
| #endif | ||
| } | ||
|
|
||
| #if PIXEL_SIZE == 8 | ||
| #define swrConvertPixel(x) swrConvertPixelTexture((x) | 0xFF000000) | ||
| #else | ||
| #define swrConvertPixel swrConvertPixelTexture | ||
| #endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should have a windows path and be in common.h
Also is there any reason to have UNUSED when we have MAYBE_UNUSED?