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

Method FinalPass

Source/DX11VideoProcessor.cpp:3189–3233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3187}
3188
3189HRESULT CDX11VideoProcessor::FinalPass(const Tex2D_t& Tex, ID3D11Texture2D* pRenderTarget, const CRect& srcRect, const CRect& dstRect)
3190{
3191 CComPtr<ID3D11RenderTargetView> pRenderTargetView;
3192
3193 HRESULT hr = m_pDevice->CreateRenderTargetView(pRenderTarget, nullptr, &pRenderTargetView);
3194 if (FAILED(hr)) {
3195 DLog(L"CDX11VideoProcessor::FinalPass() : CreateRenderTargetView() failed with error {}", HR2Str(hr));
3196 return hr;
3197 }
3198
3199 hr = FillVertexBuffer(m_pDeviceContext, m_pVertexBuffer, Tex.desc.Width, Tex.desc.Height, srcRect, 0, false);
3200 if (FAILED(hr)) {
3201 return hr;
3202 }
3203
3204 const FLOAT constants[4] = { (float)Tex.desc.Width / dither_size, (float)Tex.desc.Height / dither_size, 0, 0 };
3205 D3D11_MAPPED_SUBRESOURCE mr;
3206 hr = m_pDeviceContext->Map(m_pFinalPassConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mr);
3207 if (FAILED(hr)) {
3208 DLog(L"CDX11VideoProcessor::FinalPass() : Map() failed with error {}", HR2Str(hr));
3209 return hr;
3210 }
3211
3212 memcpy(mr.pData, &constants, sizeof(constants));
3213 m_pDeviceContext->Unmap(m_pFinalPassConstantBuffer, 0);
3214
3215 D3D11_VIEWPORT VP;
3216 VP.TopLeftX = (FLOAT)dstRect.left;
3217 VP.TopLeftY = (FLOAT)dstRect.top;
3218 VP.Width = (FLOAT)dstRect.Width();
3219 VP.Height = (FLOAT)dstRect.Height();
3220 VP.MinDepth = 0.0f;
3221 VP.MaxDepth = 1.0f;
3222
3223 // Set resources
3224 m_pDeviceContext->PSSetShaderResources(1, 1, &m_TexDither.pShaderResource.p);
3225 m_pDeviceContext->PSSetSamplers(1, 1, &m_pSamplerDither.p);
3226
3227 TextureBlt11(m_pDeviceContext, pRenderTargetView, VP, m_pVSimpleInputLayout, m_pVS_Simple, m_pPSFinalPass, Tex.pShaderResource, m_pSamplerPoint, m_pFinalPassConstantBuffer, m_pVertexBuffer);
3228
3229 ID3D11ShaderResourceView* views[1] = {};
3230 m_pDeviceContext->PSSetShaderResources(1, 1, views);
3231
3232 return hr;
3233}
3234
3235void CDX11VideoProcessor::DrawSubtitles(ID3D11Texture2D* pRenderTarget)
3236{

Callers

nothing calls this directly

Calls 4

DLogFunction · 0.85
HR2StrFunction · 0.85
FillVertexBufferFunction · 0.85
TextureBlt11Function · 0.85

Tested by

no test coverage detected