MCPcopy Create free account
hub / github.com/Aleksoid1978/VideoRenderer / Render

Method Render

Source/DX11VideoProcessor.cpp:2599–2813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2597}
2598
2599HRESULT CDX11VideoProcessor::Render(int field, const REFERENCE_TIME frameStartTime)
2600{
2601 CheckPointer(m_TexSrcVideo.pTexture, E_FAIL);
2602 CheckPointer(m_pDXGISwapChain1, E_FAIL);
2603
2604 if (field) {
2605 m_FieldDrawn = field;
2606 }
2607
2608 CComPtr<ID3D11Texture2D> pBackBuffer;
2609 HRESULT hr = m_pDXGISwapChain1->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer));
2610 if (FAILED(hr)) {
2611 DLog(L"CDX11VideoProcessor::Render() : GetBuffer() failed with error {}", HR2Str(hr));
2612 return hr;
2613 }
2614
2615 uint64_t tick1 = GetPreciseTick();
2616
2617 if (!m_windowRect.IsRectEmpty()) {
2618 // fill the BackBuffer with black
2619 ID3D11RenderTargetView* pRenderTargetView;
2620 if (S_OK == m_pDevice->CreateRenderTargetView(pBackBuffer, nullptr, &pRenderTargetView)) {
2621 const FLOAT ClearColor[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
2622 m_pDeviceContext->ClearRenderTargetView(pRenderTargetView, ClearColor);
2623 pRenderTargetView->Release();
2624 }
2625 }
2626
2627 if (m_pDXGISwapChain4) {
2628 if (m_Dovi.bValid) {
2629 if (!m_hdr10.bValid && m_lastHdr10.bValid) {
2630 m_hdr10.bValid = true;
2631 m_hdr10.hdr10 = m_lastHdr10.hdr10;
2632 }
2633
2634 if (m_hdr10.bValid) {
2635 if (m_DoviMaxMasteringLuminance > m_hdr10.hdr10.MaxMasteringLuminance) {
2636 m_hdr10.hdr10.MaxMasteringLuminance = m_DoviMaxMasteringLuminance;
2637 }
2638 if (m_DoviMinMasteringLuminance && m_DoviMinMasteringLuminance != m_hdr10.hdr10.MinMasteringLuminance) {
2639 m_hdr10.hdr10.MinMasteringLuminance = m_DoviMinMasteringLuminance;
2640 }
2641 if (m_DoviMaxContentLightLevel && m_DoviMaxContentLightLevel != m_hdr10.hdr10.MaxContentLightLevel) {
2642 m_hdr10.hdr10.MaxContentLightLevel = m_DoviMaxContentLightLevel;
2643 }
2644 if (m_DoviMaxFrameAverageLightLevel && m_DoviMaxFrameAverageLightLevel != m_hdr10.hdr10.MaxFrameAverageLightLevel) {
2645 m_hdr10.hdr10.MaxFrameAverageLightLevel = m_DoviMaxFrameAverageLightLevel;
2646 }
2647 }
2648 }
2649
2650 const DXGI_COLOR_SPACE_TYPE colorSpace = DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020;
2651 if (m_currentSwapChainColorSpace != colorSpace) {
2652 UINT colorSpaceSupport = 0;
2653 if (SUCCEEDED(m_pDXGISwapChain4->CheckColorSpaceSupport(colorSpace, &colorSpaceSupport))
2654 && (colorSpaceSupport & DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT) == DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT) {
2655 hr = m_pDXGISwapChain4->SetColorSpace1(colorSpace);
2656 DLogIf(FAILED(hr), L"CDX11VideoProcessor::Render() : SetColorSpace1() failed with error {}", HR2Str(hr));

Callers

nothing calls this directly

Calls 12

DLogFunction · 0.85
HR2StrFunction · 0.85
GetPreciseTickFunction · 0.85
AlphaBltFunction · 0.85
GetBufferMethod · 0.80
ReleaseMethod · 0.45
GetDescMethod · 0.45
InitDeviceObjectsMethod · 0.45
SizeMethod · 0.45
SetMethod · 0.45
DrawMethod · 0.45

Tested by

no test coverage detected