libobs/graphics: Add NV12 texture support

This commit is contained in:
jp9000
2018-10-05 03:15:13 -07:00
parent b64d7d71d0
commit 93fc61fa82
8 changed files with 237 additions and 8 deletions

View File

@@ -41,3 +41,28 @@ gs_stage_surface::gs_stage_surface(gs_device_t *device, uint32_t width,
if (FAILED(hr))
throw HRError("Failed to create staging surface", hr);
}
gs_stage_surface::gs_stage_surface(gs_device_t *device, uint32_t width,
uint32_t height)
: gs_obj (device, gs_type::gs_stage_surface),
width (width),
height (height),
format (GS_UNKNOWN),
dxgiFormat (DXGI_FORMAT_NV12)
{
HRESULT hr;
memset(&td, 0, sizeof(td));
td.Width = width;
td.Height = height;
td.MipLevels = 1;
td.ArraySize = 1;
td.Format = dxgiFormat;
td.SampleDesc.Count = 1;
td.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
td.Usage = D3D11_USAGE_STAGING;
hr = device->device->CreateTexture2D(&td, NULL, texture.Assign());
if (FAILED(hr))
throw HRError("Failed to create staging surface", hr);
}