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

[d3d11] Fix stencil component mapping in shader resource views

Fixes terrain rendering in Far Cry 5.
This commit is contained in:
Philip Rebohle 2018-05-05 15:15:09 +02:00
parent 8177898151
commit 5a639797d2
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -383,6 +383,13 @@ namespace dxvk {
viewInfo.aspect = formatInfo.Aspect; viewInfo.aspect = formatInfo.Aspect;
viewInfo.swizzle = formatInfo.Swizzle; viewInfo.swizzle = formatInfo.Swizzle;
// Shaders expect the stencil value in the G component
if (viewInfo.aspect == VK_IMAGE_ASPECT_STENCIL_BIT) {
viewInfo.swizzle = VkComponentMapping {
VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_R,
VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_ZERO };
}
switch (desc.ViewDimension) { switch (desc.ViewDimension) {
case D3D11_SRV_DIMENSION_TEXTURE1D: case D3D11_SRV_DIMENSION_TEXTURE1D:
viewInfo.type = VK_IMAGE_VIEW_TYPE_1D; viewInfo.type = VK_IMAGE_VIEW_TYPE_1D;