[host] DXGI: initial implementation of RGB24 support

This commit breaks damage tracking and the dx12 backend and is not in
a state where it should be used by the general public.
This commit is contained in:
Geoffrey McRae
2023-10-30 08:42:08 +11:00
parent b3879ff1d7
commit 578d98fd22
16 changed files with 559 additions and 232 deletions

View File

@@ -75,6 +75,7 @@ struct iface
unsigned int maxWidth , maxHeight;
unsigned int width , height;
unsigned int frameHeight;
bool resChanged, scale;
unsigned int targetWidth, targetHeight;
@@ -744,12 +745,15 @@ static CaptureResult nvfbc_waitFrame(CaptureFrame * frame,
}
const unsigned int maxHeight = maxFrameSize / (this->shmStride * 4);
this->frameHeight = min(maxHeight, this->grabHeight);
frame->formatVer = this->formatVer;
frame->screenWidth = this->width;
frame->screenHeight = this->height;
frame->dataWidth = this->width;
frame->dataHeight = this->height;
frame->frameWidth = this->grabWidth;
frame->frameHeight = min(maxHeight, this->grabHeight);
frame->frameHeight = this->frameHeight;
frame->truncated = maxHeight < this->grabHeight;
frame->pitch = this->shmStride * 4;
frame->stride = this->shmStride;
@@ -764,8 +768,7 @@ static CaptureResult nvfbc_waitFrame(CaptureFrame * frame,
return CAPTURE_RESULT_OK;
}
static CaptureResult nvfbc_getFrame(FrameBuffer * frame,
const unsigned int height, int frameIndex)
static CaptureResult nvfbc_getFrame(FrameBuffer * frame, int frameIndex)
{
const unsigned int h = DIFF_MAP_DIM(this->grabHeight, this->diffShift);
const unsigned int w = DIFF_MAP_DIM(this->grabWidth, this->diffShift);
@@ -779,7 +782,8 @@ static CaptureResult nvfbc_getFrame(FrameBuffer * frame,
for (unsigned int y = 0; y < h; ++y)
{
const unsigned int ystart = y << this->diffShift;
const unsigned int yend = min(height, (y + 1) << this->diffShift);
const unsigned int yend = min(this->frameHeight, (y + 1)
<< this->diffShift);
for (unsigned int x = 0; x < w; )
{
@@ -804,9 +808,9 @@ static CaptureResult nvfbc_getFrame(FrameBuffer * frame,
}
else if (this->grabStride != this->shmStride)
{
for (int y = 0; y < height; y += 64)
for (int y = 0; y < this->frameHeight; y += 64)
{
int yend = min(height, y + 128);
int yend = min(this->frameHeight, y + 128);
rectCopyUnaligned(frameData, this->frameBuffer, y, yend, 0, this->shmStride * 4,
this->grabStride * 4, this->grabWidth * 4);
framebuffer_set_write_ptr(frame, yend * this->shmStride * 4);
@@ -816,7 +820,7 @@ static CaptureResult nvfbc_getFrame(FrameBuffer * frame,
framebuffer_write(
frame,
this->frameBuffer,
height * this->grabInfo.dwBufferWidth * 4
this->frameHeight * this->grabInfo.dwBufferWidth * 4
);
for (int i = 0; i < LGMP_Q_FRAME_LEN; ++i)