1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-30 20:52:11 +01:00

[d3d11] Use VK_IMAGE_VIEW_TYPE_CUBE_ARRAY for non-array cube maps

Games may bind simple cube map views to a resource slot that requires
a cube map array view. Fixes GPU lockups in Nier: Automata.
This commit is contained in:
Philip Rebohle 2018-01-09 00:51:10 +01:00
parent 7fd1f57902
commit 180cc35c84
2 changed files with 10 additions and 2 deletions

View File

@ -283,7 +283,10 @@ namespace dxvk {
break;
case D3D11_SRV_DIMENSION_TEXTURECUBE:
viewInfo.type = VK_IMAGE_VIEW_TYPE_CUBE;
// Some applications bind non-array cube maps to cube map
// array slots. In order to support this, we'll use a cube
// map array view even for non-array cube maps.
viewInfo.type = VK_IMAGE_VIEW_TYPE_CUBE_ARRAY;
viewInfo.minLevel = desc.TextureCube.MostDetailedMip;
viewInfo.numLevels = desc.TextureCube.MipLevels;
viewInfo.minLayer = 0;
@ -1326,6 +1329,7 @@ namespace dxvk {
enabled.samplerAnisotropy = VK_TRUE;
enabled.shaderClipDistance = VK_TRUE;
enabled.shaderCullDistance = VK_TRUE;
enabled.robustBufferAccess = VK_TRUE;
}
if (featureLevel >= D3D_FEATURE_LEVEL_9_2) {

View File

@ -649,7 +649,8 @@ namespace dxvk {
case DxbcResourceDim::Texture2DMs: return { spv::Dim2D, 0, 1, isUav ? 2u : 1u };
case DxbcResourceDim::Texture2DMsArr: return { spv::Dim2D, 1, 1, isUav ? 2u : 1u };
case DxbcResourceDim::Texture3D: return { spv::Dim3D, 0, 0, isUav ? 2u : 1u };
case DxbcResourceDim::TextureCube: return { spv::DimCube, 0, 0, isUav ? 2u : 1u };
// Some applications bind non-array cube maps to cube map array slots
case DxbcResourceDim::TextureCube: return { spv::DimCube, 1, 0, isUav ? 2u : 1u };
case DxbcResourceDim::TextureCubeArr: return { spv::DimCube, 1, 0, isUav ? 2u : 1u };
default: throw DxvkError(str::format("DxbcCompiler: Unsupported resource type: ", resourceType));
}
@ -660,6 +661,7 @@ namespace dxvk {
case DxbcResourceDim::Buffer: m_module.enableCapability(spv::CapabilityImageBuffer); break;
case DxbcResourceDim::Texture1D: m_module.enableCapability(spv::CapabilityImage1D); break;
case DxbcResourceDim::Texture1DArr: m_module.enableCapability(spv::CapabilityImage1D); break;
case DxbcResourceDim::TextureCube:
case DxbcResourceDim::TextureCubeArr: m_module.enableCapability(spv::CapabilityImageCubeArray); break;
case DxbcResourceDim::Texture2DMsArr: m_module.enableCapability(spv::CapabilityImageMSArray); break;
default: break; // No additional capabilities required
@ -1782,6 +1784,7 @@ namespace dxvk {
const DxbcRegisterValue src = emitRegisterLoad(ins.src[2], ins.dst[0].mask);
const uint32_t typeId = getVectorTypeId(src.type);
// TODO fix
DxbcRegisterValue result;
result.type = src.type;
result.id = isSigned
@ -1804,6 +1807,7 @@ namespace dxvk {
const DxbcRegisterValue insert = emitRegisterLoad(ins.src[2], ins.dst[0].mask);
const DxbcRegisterValue base = emitRegisterLoad(ins.src[3], ins.dst[0].mask);
// TODO fix
DxbcRegisterValue result;
result.type = base.type;
result.id = m_module.opBitFieldInsert(