Ejemplo n.º 1
0
ID3D11RenderTargetView* CD3DTexture::GetRenderTarget()
{
  if (!m_texture)
    return nullptr;

  if (!m_renderTarget)
  {
    CD3D11_RENDER_TARGET_VIEW_DESC cRTVDesc(D3D11_RTV_DIMENSION_TEXTURE2D);
    if (FAILED(g_Windowing.Get3D11Device()->CreateRenderTargetView(m_texture, &cRTVDesc, &m_renderTarget)))
    {
      CLog::Log(LOGWARNING, __FUNCTION__ " - cannot create texture view.");
    }
  }

  return m_renderTarget;
}
Ejemplo n.º 2
0
ID3D11RenderTargetView* CD3DTexture::GetRenderTargetInternal(unsigned idx)
{
  if (idx > 1)
    return nullptr;

  if (!m_texture)
    return nullptr;

  if (!g_Windowing.IsFormatSupport(m_format, D3D11_FORMAT_SUPPORT_RENDER_TARGET))
    return nullptr;

  if (!m_renderTargets[idx])
  {
    CD3D11_RENDER_TARGET_VIEW_DESC cRTVDesc(D3D11_RTV_DIMENSION_TEXTURE2DARRAY, DXGI_FORMAT_UNKNOWN, 0, idx, 1);
    if (FAILED(g_Windowing.Get3D11Device()->CreateRenderTargetView(m_texture, &cRTVDesc, &m_renderTargets[idx])))
    {
      CLog::Log(LOGWARNING, __FUNCTION__ " - cannot create texture view.");
    }
  }

  return m_renderTargets[idx];
}