1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 19:24:12 +01:00

[d3d11] Implement VideoProcessorSetStreamSourceRect scaling

This commit is contained in:
Rémi Bernon 2024-04-24 14:02:18 +02:00 committed by Philip Rebohle
parent dacb8b434b
commit b99d42c688

View File

@ -1262,12 +1262,29 @@ namespace dxvk {
viewport.height = float(cStreamState.dstRect.bottom) - viewport.y;
}
VkExtent3D viewExtent = cViews[0]->mipLevelExtent(0);
VkViewport srcViewport;
if (cStreamState.srcRectEnabled) {
srcViewport.x = float(cStreamState.srcRect.left);
srcViewport.y = float(cStreamState.srcRect.top);
srcViewport.width = float(cStreamState.srcRect.right) - srcViewport.x;
srcViewport.height = float(cStreamState.srcRect.bottom) - srcViewport.y;
} else {
srcViewport.x = 0.0f;
srcViewport.y = 0.0f;
srcViewport.width = float(viewExtent.width);
srcViewport.height = float(viewExtent.height);
}
UboData uboData = { };
uboData.colorMatrix[0][0] = 1.0f;
uboData.colorMatrix[1][1] = 1.0f;
uboData.colorMatrix[2][2] = 1.0f;
uboData.coordMatrix[0][0] = 1.0f;
uboData.coordMatrix[1][1] = 1.0f;
uboData.coordMatrix[0][0] = srcViewport.width / float(viewExtent.width);
uboData.coordMatrix[1][1] = srcViewport.height / float(viewExtent.height);
uboData.coordMatrix[2][0] = srcViewport.x / float(viewExtent.width);
uboData.coordMatrix[2][1] = srcViewport.y / float(viewExtent.height);
uboData.yMin = 0.0f;
uboData.yMax = 1.0f;
uboData.isPlanar = cViews[1] != nullptr;