[host/client] added experimental RGBA16 float support (EGL only)

This commit is contained in:
Geoffrey McRae 2020-10-11 19:22:31 +11:00
parent 4f40ce4b40
commit 9c6bd888fd
8 changed files with 47 additions and 13 deletions

View File

@ -197,6 +197,11 @@ bool egl_desktop_update(EGL_Desktop * desktop, const bool sourceChanged, const L
desktop->shader = &desktop->shader_generic; desktop->shader = &desktop->shader_generic;
break; break;
case FRAME_TYPE_RGBA16F:
pixFmt = EGL_PF_RGBA16F;
desktop->shader = &desktop->shader_generic;
break;
case FRAME_TYPE_YUV420: case FRAME_TYPE_YUV420:
pixFmt = EGL_PF_YUV420; pixFmt = EGL_PF_YUV420;
desktop->shader = &desktop->shader_yuv; desktop->shader = &desktop->shader_yuv;

View File

@ -219,6 +219,19 @@ bool egl_texture_setup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, size_
texture->pboBufferSize = height * stride; texture->pboBufferSize = height * stride;
break; break;
case EGL_PF_RGBA16F:
planeCount = 1;
texture->bpp = 8;
texture->format = GL_RGBA;
texture->planes[0][0] = width;
texture->planes[0][1] = height;
texture->planes[0][2] = stride / 8;
texture->offsets[0] = 0;
texture->intFormat = GL_RGB16;
texture->dataType = GL_FLOAT;
texture->pboBufferSize = height * stride;
break;
case EGL_PF_YUV420: case EGL_PF_YUV420:
planeCount = 3; planeCount = 3;
texture->bpp = 4; texture->bpp = 4;

View File

@ -32,6 +32,7 @@ enum EGL_PixelFormat
EGL_PF_RGBA, EGL_PF_RGBA,
EGL_PF_BGRA, EGL_PF_BGRA,
EGL_PF_RGBA10, EGL_PF_RGBA10,
EGL_PF_RGBA16F,
EGL_PF_YUV420 EGL_PF_YUV420
}; };

View File

@ -440,6 +440,11 @@ static int frameThread(void * unused)
lgrFormat.bpp = 32; lgrFormat.bpp = 32;
break; break;
case FRAME_TYPE_RGBA16F:
dataSize = lgrFormat.height * lgrFormat.pitch;
lgrFormat.bpp = 64;
break;
case FRAME_TYPE_YUV420: case FRAME_TYPE_YUV420:
dataSize = lgrFormat.height * lgrFormat.width; dataSize = lgrFormat.height * lgrFormat.width;
dataSize += (dataSize / 4) * 2; dataSize += (dataSize / 4) * 2;

View File

@ -29,6 +29,7 @@ typedef enum FrameType
FRAME_TYPE_BGRA , // BGRA interleaved: B,G,R,A 32bpp FRAME_TYPE_BGRA , // BGRA interleaved: B,G,R,A 32bpp
FRAME_TYPE_RGBA , // RGBA interleaved: R,G,B,A 32bpp FRAME_TYPE_RGBA , // RGBA interleaved: R,G,B,A 32bpp
FRAME_TYPE_RGBA10 , // RGBA interleaved: R,G,B,A 10,10,10,2 bpp FRAME_TYPE_RGBA10 , // RGBA interleaved: R,G,B,A 10,10,10,2 bpp
FRAME_TYPE_RGBA16F , // RGBA interleaved: R,G,B,A 16,16,16,16 bpp float
FRAME_TYPE_YUV420 , // YUV420 FRAME_TYPE_YUV420 , // YUV420
FRAME_TYPE_MAX , // sentinel value FRAME_TYPE_MAX , // sentinel value
} }
@ -51,7 +52,7 @@ typedef enum CursorType
CursorType; CursorType;
#define KVMFR_MAGIC "KVMFR---" #define KVMFR_MAGIC "KVMFR---"
#define KVMFR_VERSION 3 #define KVMFR_VERSION 4
typedef struct KVMFR typedef struct KVMFR
{ {

View File

@ -35,10 +35,11 @@ CaptureResult;
typedef enum CaptureFormat typedef enum CaptureFormat
{ {
// frame formats // frame formats
CAPTURE_FMT_BGRA , CAPTURE_FMT_BGRA ,
CAPTURE_FMT_RGBA , CAPTURE_FMT_RGBA ,
CAPTURE_FMT_RGBA10, CAPTURE_FMT_RGBA10 ,
CAPTURE_FMT_YUV420, CAPTURE_FMT_RGBA16F,
CAPTURE_FMT_YUV420 ,
// pointer formats // pointer formats
CAPTURE_FMT_COLOR , CAPTURE_FMT_COLOR ,

View File

@ -519,11 +519,18 @@ static bool dxgi_init()
IDXGIOutputDuplication_GetDesc(this->dup, &dupDesc); IDXGIOutputDuplication_GetDesc(this->dup, &dupDesc);
DEBUG_INFO("Source Format : %s", GetDXGIFormatStr(dupDesc.ModeDesc.Format)); DEBUG_INFO("Source Format : %s", GetDXGIFormatStr(dupDesc.ModeDesc.Format));
uint8_t bpp = 8;
switch(dupDesc.ModeDesc.Format) switch(dupDesc.ModeDesc.Format)
{ {
case DXGI_FORMAT_B8G8R8A8_UNORM : this->format = CAPTURE_FMT_BGRA ; break; case DXGI_FORMAT_B8G8R8A8_UNORM : this->format = CAPTURE_FMT_BGRA ; break;
case DXGI_FORMAT_R8G8B8A8_UNORM : this->format = CAPTURE_FMT_RGBA ; break; case DXGI_FORMAT_R8G8B8A8_UNORM : this->format = CAPTURE_FMT_RGBA ; break;
case DXGI_FORMAT_R10G10B10A2_UNORM: this->format = CAPTURE_FMT_RGBA10; break; case DXGI_FORMAT_R10G10B10A2_UNORM : this->format = CAPTURE_FMT_RGBA10 ; break;
case DXGI_FORMAT_R16G16B16A16_FLOAT:
this->format = CAPTURE_FMT_RGBA16F;
bpp = 16;
break;
default: default:
DEBUG_ERROR("Unsupported source format"); DEBUG_ERROR("Unsupported source format");
goto fail; goto fail;
@ -562,7 +569,7 @@ static bool dxgi_init()
goto fail; goto fail;
} }
this->pitch = mapping.RowPitch; this->pitch = mapping.RowPitch;
this->stride = mapping.RowPitch / 4; this->stride = mapping.RowPitch / bpp;
ID3D11DeviceContext_Unmap(this->deviceContext, (ID3D11Resource *)this->texture[0].tex, 0); ID3D11DeviceContext_Unmap(this->deviceContext, (ID3D11Resource *)this->texture[0].tex, 0);
QueryPerformanceFrequency(&this->perfFreq) ; QueryPerformanceFrequency(&this->perfFreq) ;

View File

@ -178,10 +178,11 @@ static int frameThread(void * opaque)
KVMFRFrame * fi = lgmpHostMemPtr(app.frameMemory[app.frameIndex]); KVMFRFrame * fi = lgmpHostMemPtr(app.frameMemory[app.frameIndex]);
switch(frame.format) switch(frame.format)
{ {
case CAPTURE_FMT_BGRA : fi->type = FRAME_TYPE_BGRA ; break; case CAPTURE_FMT_BGRA : fi->type = FRAME_TYPE_BGRA ; break;
case CAPTURE_FMT_RGBA : fi->type = FRAME_TYPE_RGBA ; break; case CAPTURE_FMT_RGBA : fi->type = FRAME_TYPE_RGBA ; break;
case CAPTURE_FMT_RGBA10: fi->type = FRAME_TYPE_RGBA10; break; case CAPTURE_FMT_RGBA10 : fi->type = FRAME_TYPE_RGBA10 ; break;
case CAPTURE_FMT_YUV420: fi->type = FRAME_TYPE_YUV420; break; case CAPTURE_FMT_RGBA16F: fi->type = FRAME_TYPE_RGBA16F; break;
case CAPTURE_FMT_YUV420 : fi->type = FRAME_TYPE_YUV420 ; break;
default: default:
DEBUG_ERROR("Unsupported frame format %d, skipping frame", frame.format); DEBUG_ERROR("Unsupported frame format %d, skipping frame", frame.format);
continue; continue;