| 891 | } |
| 892 | |
| 893 | HRESULT CD3D11VP::Process(ID3D11Texture2D* pRenderTarget, const D3D11_VIDEO_FRAME_FORMAT sampleFormat, const bool second) |
| 894 | { |
| 895 | ASSERT(m_pVideoDevice); |
| 896 | ASSERT(m_pVideoContext); |
| 897 | |
| 898 | if (!second) { |
| 899 | m_pVideoContext->VideoProcessorSetStreamFrameFormat(m_pVideoProcessor, 0, sampleFormat); |
| 900 | |
| 901 | if (m_bUpdateFilters) { |
| 902 | for (UINT i = 0; i < std::size(m_VPFilters); i++) { |
| 903 | auto& filter = m_VPFilters[i]; |
| 904 | if (filter.support) { |
| 905 | BOOL bEnable = (filter.value != filter.range.Default); |
| 906 | m_pVideoContext->VideoProcessorSetStreamFilter(m_pVideoProcessor, 0, (D3D11_VIDEO_PROCESSOR_FILTER)i, bEnable, filter.value); |
| 907 | } |
| 908 | } |
| 909 | m_bUpdateFilters = false; |
| 910 | } |
| 911 | } |
| 912 | |
| 913 | D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC OutputViewDesc = {}; |
| 914 | OutputViewDesc.ViewDimension = D3D11_VPOV_DIMENSION_TEXTURE2D; |
| 915 | CComPtr<ID3D11VideoProcessorOutputView> pOutputView; |
| 916 | HRESULT hr = m_pVideoDevice->CreateVideoProcessorOutputView(pRenderTarget, m_pVideoProcessorEnum, &OutputViewDesc, &pOutputView); |
| 917 | if (FAILED(hr)) { |
| 918 | DLog(L"CD3D11VP::Process() : CreateVideoProcessorOutputView() failed with error {}", HR2Str(hr)); |
| 919 | return hr; |
| 920 | } |
| 921 | |
| 922 | D3D11_VIDEO_PROCESSOR_STREAM StreamData = {}; |
| 923 | StreamData.Enable = TRUE; |
| 924 | StreamData.InputFrameOrField = m_nInputFrameOrField; |
| 925 | if (second) { |
| 926 | StreamData.OutputIndex = 1; |
| 927 | } else { |
| 928 | StreamData.InputFrameOrField--; |
| 929 | } |
| 930 | |
| 931 | auto FillStreamData = [&] (auto& input) { |
| 932 | UINT idx = input.Size(); |
| 933 | if (m_nFutureFrames) { |
| 934 | idx -= m_nFutureFrames; |
| 935 | StreamData.FutureFrames = m_nFutureFrames; |
| 936 | StreamData.ppFutureSurfaces = input.GetInputView(idx); |
| 937 | } |
| 938 | idx--; |
| 939 | StreamData.pInputSurface = *input.GetInputView(idx); |
| 940 | if (m_nPastFrames) { |
| 941 | idx -= m_nPastFrames; |
| 942 | StreamData.PastFrames = m_nPastFrames; |
| 943 | StreamData.ppPastSurfaces = input.GetInputView(idx); |
| 944 | } |
| 945 | }; |
| 946 | |
| 947 | if (m_VideoTextures.Size()) { |
| 948 | FillStreamData(m_VideoTextures); |
| 949 | } |
| 950 | else if (m_VideoInputData.Size()) { |
nothing calls this directly
no test coverage detected