-
Notifications
You must be signed in to change notification settings - Fork 77
pbkit: Enable flip stall; expose ramin, print_char, depth buffer internals #628
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
base: master
Are you sure you want to change the base?
Conversation
@@ -2468,7 +2468,7 @@ int pb_finished(void) | |||
p=pb_push1(p,NV20_TCL_PRIMITIVE_3D_WAIT_MAKESPACE,0); //wait/makespace (obtains null status) | |||
p=pb_push1(p,NV20_TCL_PRIMITIVE_3D_PARAMETER_A,pb_back_index); //set param=back buffer index to show up | |||
p=pb_push1(p,NV20_TCL_PRIMITIVE_3D_FIRE_INTERRUPT,PB_FINISHED); //subprogID PB_FINISHED: gets frame ready to show up soon | |||
// p=pb_push1(p,NV20_TCL_PRIMITIVE_3D_STALL_PIPELINE,0); //stall gpu pipeline (not sure it's needed in triple buffering technic) | |||
p=pb_push1(p,NV20_TCL_PRIMITIVE_3D_STALL_PIPELINE,0); //stall gpu pipeline (not sure it's needed in triple buffering technic) |
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.
Why is this needed?
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.
If I remember correctly it was just to mimic end of frame behavior observed in DirectX based titles in order to make tooling (like the pgraph tracer) simpler.
@@ -2630,6 +2631,11 @@ void pb_set_color_format(unsigned int fmt, bool swizzled) { | |||
assert(swizzled == false); | |||
} | |||
|
|||
void pb_set_fb_size_multiplier(unsigned int multiplier) { | |||
assert(multiplier > 0); | |||
pb_FBSizeMultiplier = multiplier; |
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.
When would you use this?
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.
For fullscreen antialiasing: https://github.com/abaire/nxdk_pgraph_tests/blob/e4e1dbce47d2ee7741f4ef1b219952ad6a410f78/src/main.cpp#L154
lib/pbkit/pbkit.h
Outdated
@@ -159,8 +159,6 @@ void pb_create_gr_instance(int ChannelID, | |||
DWORD flags3D, | |||
struct s_CtxDma *pGrObject); | |||
|
|||
// Exposed so pb_print can be overridden using a version of vsprintf that | |||
// supports floats. |
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.
Why was this comment removed?
@@ -144,6 +144,10 @@ void pb_create_gr_ctx( int ChannelID, | |||
struct s_CtxDma *pGrObject ); | |||
void pb_bind_channel(struct s_CtxDma *pCtxDmaObject); | |||
|
|||
uint8_t *pb_depth_stencil_buffer(); | |||
DWORD pb_depth_stencil_pitch(); | |||
DWORD pb_depth_stencil_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.
I always thought pbkit had this interface backwards. Currently pbkit is a mix of a low-level and high-level driver.
pbkit can submit pushbuffers, but it also constructs them, some using rather high level operations.
Instead, I believe that pbkit should allow submission of pushbuffers, but it should primarily be the users responsibility to construct them.
pbkit should only control the hardware so it can process commands from the pushbuffers.
More importantly, pbkit also manages buffers internally (sometimes like a singleton), but doesn't allow the user to manually create or control these buffers.
Instead, I believe that pbkit should provide the user with buffer creation / managing functions, but the user should always explicitly create these buffers and keep track of them.
This means I'd prefer to see something like pb_create_depth_stencil_buffer(size, pitch)
and then the user should be responsible for creating these buffers.
So, in an ideal world, the application would never even have to query for the buffer address / pitch / size, because it created the buffer itself.
This (explicit buffer creation by application) is also required (or at least helpful) for more advanced applications which want to switch render-targets.
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.
Totally agree, Thrimbor also agrees and has plans for a rewrite. My fork uses this as a stopgap; not sure it's worth the effort to take a half-step in the direction of providing user control if there's a major refactor pending. I also think some of this may have been added in commits I upstreamed more recently.
Commit titles don't follow our usual style ( |
Status and is this patch still relevant? |
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 would at least need a rebase since some of the changes were upstreamed and I ended up doing a minor refactor to break pbkit.c into multiple files for ease of maintenance. Personally I don't feel strongly that it's worth the effort given that pbkit is slated for replacement.
@@ -2468,7 +2468,7 @@ int pb_finished(void) | |||
p=pb_push1(p,NV20_TCL_PRIMITIVE_3D_WAIT_MAKESPACE,0); //wait/makespace (obtains null status) | |||
p=pb_push1(p,NV20_TCL_PRIMITIVE_3D_PARAMETER_A,pb_back_index); //set param=back buffer index to show up | |||
p=pb_push1(p,NV20_TCL_PRIMITIVE_3D_FIRE_INTERRUPT,PB_FINISHED); //subprogID PB_FINISHED: gets frame ready to show up soon | |||
// p=pb_push1(p,NV20_TCL_PRIMITIVE_3D_STALL_PIPELINE,0); //stall gpu pipeline (not sure it's needed in triple buffering technic) | |||
p=pb_push1(p,NV20_TCL_PRIMITIVE_3D_STALL_PIPELINE,0); //stall gpu pipeline (not sure it's needed in triple buffering technic) |
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.
If I remember correctly it was just to mimic end of frame behavior observed in DirectX based titles in order to make tooling (like the pgraph tracer) simpler.
@@ -2630,6 +2631,11 @@ void pb_set_color_format(unsigned int fmt, bool swizzled) { | |||
assert(swizzled == false); | |||
} | |||
|
|||
void pb_set_fb_size_multiplier(unsigned int multiplier) { | |||
assert(multiplier > 0); | |||
pb_FBSizeMultiplier = multiplier; |
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.
For fullscreen antialiasing: https://github.com/abaire/nxdk_pgraph_tests/blob/e4e1dbce47d2ee7741f4ef1b219952ad6a410f78/src/main.cpp#L154
@@ -144,6 +144,10 @@ void pb_create_gr_ctx( int ChannelID, | |||
struct s_CtxDma *pGrObject ); | |||
void pb_bind_channel(struct s_CtxDma *pCtxDmaObject); | |||
|
|||
uint8_t *pb_depth_stencil_buffer(); | |||
DWORD pb_depth_stencil_pitch(); | |||
DWORD pb_depth_stencil_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.
Totally agree, Thrimbor also agrees and has plans for a rewrite. My fork uses this as a stopgap; not sure it's worth the effort to take a half-step in the direction of providing user control if there's a major refactor pending. I also think some of this may have been added in commits I upstreamed more recently.
This PR upstreams the pbkit changes required by the pgraph test suite.
They are all combined into one PR, but can be split it if preferred.
CC: @abaire