[c-host] nvfbc: disable ARGB10 until NVIDIA fix the API (if ever)

This commit is contained in:
Geoffrey McRae 2019-04-11 19:30:42 +10:00
parent 8cedad8241
commit 338bc2e0dc
2 changed files with 17 additions and 9 deletions

View File

@ -1 +1 @@
a12-154-g32bd6d96e3+1 a12-155-g8cedad8241+1

View File

@ -138,7 +138,7 @@ static bool nvfbc_init(void * pointerShape, const unsigned int pointerSize)
HANDLE event; HANDLE event;
if (!NvFBCToSysSetup( if (!NvFBCToSysSetup(
this->nvfbc, this->nvfbc,
BUFFER_FMT_ARGB10, BUFFER_FMT_ARGB,
false, false,
true, true,
false, false,
@ -226,13 +226,21 @@ static CaptureResult nvfbc_getFrame(CaptureFrame * frame)
frame->pitch = this->grabInfo.dwBufferWidth * 4; frame->pitch = this->grabInfo.dwBufferWidth * 4;
frame->stride = this->grabInfo.dwBufferWidth; frame->stride = this->grabInfo.dwBufferWidth;
// the bIsHDR check isn't reliable, if it's not set check a few pixels to see if #if 0
// the alpha channel has data in it. If not HDR the alpha channel should read zeros //NvFBC never sets bIsHDR so instead we check for any data in the alpha channel
this->grabInfo.bIsHDR = //If there is data, it's HDR. This is clearly suboptimal
this->grabInfo.bIsHDR || if (!this->grabInfo.bIsHDR)
(this->frameBuffer[3] != 0) || // top left for(int y = 0; y < frame->height; ++y)
(this->frameBuffer[(((frame->height * frame->stride) / 2) + frame->width / 2) * 4 + 3] != 0) || // center for(int x = 0; x < frame->width; ++x)
(this->frameBuffer[(((frame->height - 1) * frame->stride) + frame->width - 1) * 4 + 3] != 0); // bottom right {
int offset = (y * frame->pitch) + (x * 4);
if (this->frameBuffer[offset + 3])
{
this->grabInfo.bIsHDR = 1;
break;
}
}
#endif
frame->format = this->grabInfo.bIsHDR ? CAPTURE_FMT_RGBA10 : CAPTURE_FMT_BGRA; frame->format = this->grabInfo.bIsHDR ? CAPTURE_FMT_RGBA10 : CAPTURE_FMT_BGRA;
memcpy(frame->data, this->frameBuffer, frame->pitch * frame->height); memcpy(frame->data, this->frameBuffer, frame->pitch * frame->height);