Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/pbkit/pbkit.c
Original file line number Diff line number Diff line change
Expand Up @@ -3712,3 +3712,16 @@ static NTAPI VOID pb_shutdown_notification_routine (PHAL_SHUTDOWN_REGISTRATION S
{
pb_kill();
}

uint8_t* pb_depth_stencil_buffer()
{
return (uint8_t*)pb_DepthStencilAddr;
}

DWORD pb_depth_stencil_pitch() {
return pb_DepthStencilPitch;
}

DWORD pb_depth_stencil_size() {
return pb_DSSize;
}
4 changes: 4 additions & 0 deletions lib/pbkit/pbkit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Copy link
Member

@JayFoxRox JayFoxRox Mar 4, 2023

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.

Copy link
Contributor

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.


#ifdef __cplusplus
}
#endif
Expand Down