[host] don't uselessly try to scale 1:1 textures

This commit is contained in:
Geoffrey McRae 2018-07-28 10:25:16 +10:00
parent 05bd587c74
commit f692284f27
2 changed files with 13 additions and 6 deletions

View File

@ -65,9 +65,9 @@ bool TextureConverter::Initialize(
{
case FRAME_TYPE_YUV420:
result = device->CreatePixelShader(g_RGBtoYUV, sizeof(g_RGBtoYUV), NULL, &m_psConversion);
m_texFormats[0] = DXGI_FORMAT_R8_UNORM; m_scaleFormats[0] = 1.0f;
m_texFormats[1] = DXGI_FORMAT_R8_UNORM; m_scaleFormats[1] = 0.5f;
m_texFormats[2] = DXGI_FORMAT_R8_UNORM; m_scaleFormats[2] = 0.5f;
m_texFormats[0] = DXGI_FORMAT_R8_UNORM; m_scaleFormats[0] = 1;
m_texFormats[1] = DXGI_FORMAT_R8_UNORM; m_scaleFormats[1] = 2;
m_texFormats[2] = DXGI_FORMAT_R8_UNORM; m_scaleFormats[2] = 2;
break;
default:
@ -369,9 +369,16 @@ bool TextureConverter::Convert(ID3D11Texture2DPtr texture, TextureList & output)
ID3D11RenderTargetViewPtr view;
D3D11_TEXTURE2D_DESC srcDesc;
// if there is no scaling
if (m_scaleFormats[i] == 1)
{
output.push_back(src);
continue;
}
src->GetDesc(&srcDesc);
viewPorts[0].Width = srcDesc.Width * m_scaleFormats[i];
viewPorts[0].Height = srcDesc.Height * m_scaleFormats[i];
viewPorts[0].Width = srcDesc.Width / m_scaleFormats[i];
viewPorts[0].Height = srcDesc.Height / m_scaleFormats[i];
srcDesc.Width = (UINT)viewPorts[0].Width;
srcDesc.Height = (UINT)viewPorts[0].Height;

View File

@ -60,7 +60,7 @@ private:
FrameType m_format;
DXGI_FORMAT m_texFormats [3];
float m_scaleFormats [3];
unsigned int m_scaleFormats [3];
ID3D11Texture2DPtr m_targetTexture[3];
ID3D11RenderTargetViewPtr m_renderView [3];