-
Notifications
You must be signed in to change notification settings - Fork 0
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
Dummy Xbox port #1
base: master
Are you sure you want to change the base?
Conversation
65e722d
to
afb6020
Compare
xbox/alloca.h
Outdated
@@ -0,0 +1 @@ | |||
#define alloca(size) __builtin_alloca (size) |
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.
Should be upstreamed.
48f8816
to
c315cfc
Compare
cc6a30e
to
7190173
Compare
xbox/matrix.h
Outdated
memcpy(r, m, sizeof(m)); | ||
} | ||
|
||
void _math_matrix_rotate( GLfloat *m, GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) |
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.
Review this - I took out some optimization to keep the code short. I also moved the initialization into the caller as done for other functions already (WHY?!).
GL TODO List for XGUGetters
Clearing
Buffers
Vertex buffers
Also see https://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/attributes.php note about nvidia in "Custom Vertex Attributes" - I'm not sure if Xbox GPU exposes 2 interfaces (1. named vertex attributes, 2. nvidia indices for names), but they should be doing mostly the same, the index based interface would probably be fine for now These functions also set various GPU registers, so each of them will have various commands for setting different things: setting address, setting type, setting count, ... - the proper NV function to be handled are Draw calls
These will also require Matrix functions
GL_TEXTURE is for the active texture slot, so we need to be able to submit the data for a specified Textures
TexEnv
This controls register combiners; so we specifically need all of Renderstates
Compare Neverball gl.h with possible values for glDisable and glEnable; Remember that the xgu API is GPU focused, so it's not
Stencil actions
Note: Probably broken in pbkit, but xgu API can still be made Misc.
Pixel readback
Lighting
Materials
Pixel pushing
Misc XGU stuffWe'll also want |
xbox/xbox.c
Outdated
| MASK(NV097_SET_COMBINER_COLOR_OCW_MUX_ENABLE, 0) | ||
| MASK(NV097_SET_COMBINER_COLOR_OCW_AB_DOT_ENABLE, 0) | ||
| MASK(NV097_SET_COMBINER_COLOR_OCW_CD_DOT_ENABLE, 0) | ||
| MASK(NV097_SET_COMBINER_COLOR_OCW_OP, NV097_SET_COMBINER_COLOR_OCW_OP_NOSHIFT)); |
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.
FIXME about RGB_SCALE and ALPHA_SCALE
| MASK(NV097_SET_COMBINER_ALPHA_ICW_B_SOURCE, x_b) | MASK(NV097_SET_COMBINER_ALPHA_ICW_B_ALPHA, x_b_alpha) | MASK(NV097_SET_COMBINER_ALPHA_ICW_B_MAP, x_b_map) | ||
| MASK(NV097_SET_COMBINER_ALPHA_ICW_C_SOURCE, x_c) | MASK(NV097_SET_COMBINER_ALPHA_ICW_C_ALPHA, x_c_alpha) | MASK(NV097_SET_COMBINER_ALPHA_ICW_C_MAP, x_c_map) | ||
| MASK(NV097_SET_COMBINER_ALPHA_ICW_D_SOURCE, x_d) | MASK(NV097_SET_COMBINER_ALPHA_ICW_D_ALPHA, x_d_alpha) | MASK(NV097_SET_COMBINER_ALPHA_ICW_D_MAP, x_d_map)); | ||
} |
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.
This entire if / else garbage should probably be part of XGUX with underlying crap in XGU
CC @dracc
xbox/xbox.c
Outdated
if (mask & GL_STENCIL_BUFFER_BIT) { flags |= XGU_CLEAR_STENCIL; } | ||
|
||
uint32_t* p = pb_begin(); | ||
//FIXME: Set clear region |
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.
Reminder as this might crash
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.
No crash, but doesn't seem to work yet either. Did not try setting region yet - currently falling back to pb_fill()
xbox/xbox.c
Outdated
} | ||
|
||
GL_API void GL_APIENTRY glDepthMask (GLboolean flag) { | ||
//FIXME: Missing from XGU |
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.
Waiting for this CC @dracc
xbox/xbox.c
Outdated
} | ||
|
||
GL_API void GL_APIENTRY glDepthFunc (GLenum func) { | ||
//FIXME: Missing from XGU |
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.
Waiting for this CC @dracc
xbox/xbox.c
Outdated
|
||
// Stencil actions | ||
GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask) { | ||
//FIXME: Missing from XGU |
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.
Waiting for this CC @dracc
xbox/xbox.c
Outdated
} | ||
|
||
GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units) { | ||
//FIXME: Missing from XGU |
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.
Not really important (and potentially tricky); but still waiting for this CC @dracc
ff0a818
to
fcf314d
Compare
Normalization of light direction vectors / position seems to be incorrect: https://discord.com/channels/428359196719972353/428399682239332354/713814011182841859 (an issue for XQEMU must be created) |
Build using:
Missing ports (in xbox.c unless noted otherwise):
libjpeg (should exist already)(Ported, untested)libpng (should exist already)(Ported, untested)nxdk-sdlJoystick API (should exist already; review(Fixed by nxdk-sdl PR.. why?!)#include
and linker?)SDL_JoystickClose
SDL_JoystickEventState
SDL_JoystickInstanceID
SDL_JoystickOpen
Audio API (dummy driver needs to be linked; see issue on nxdk-sdl)(Fixed by nxdk-sdl PR)SDL_LockAudio
SDL_OpenAudio
SDL_PauseAudio
SDL_UnlockAudio
SDL_CloseAudio
dirent.h (consider https://github.com/tronkko/dirent [only supports wide-string] or port share/dir.c)(Ported share/dir.c, but missingGetFileAttributes
in nxdk winapi)_mkdir
only; part of Windows CRT see https://stackoverflow.com/questions/49747236/create-a-directory-in-c-for-kernel-driver for impl.)sys/time.h ((only for mapc)gettimeofday
only)access
andstat
only; alternatively port share/common.c)math.h ((use nxdk-pdclib ahead of master)floor
only; already a PR on nxdk-pdclib)ogg(Ported, untested)vorbis(Ported, untested)(Current hack is fine)pick_home_path
must be fixed in share/base_config.cSet(Uses safe defaults)CONFIG_USER
,CONFIG_DATA
andCONFIG_LOCALE
in Makefile.nxdk(Workaround present, waiting for upstream issue)argv[0]
in main function must be path to executable (see upstream issue 195)SDL2 needs ability to create a window with fake GL context(Workaround: GL init disabled in share/video.c)mapc did also compile. Compilation of Neverputt was not tested.
Compare against development machine using: