diff --git a/src/d3d11/d3d11_texture.cpp b/src/d3d11/d3d11_texture.cpp index 9a28828a..1f3e6d9f 100644 --- a/src/d3d11/d3d11_texture.cpp +++ b/src/d3d11/d3d11_texture.cpp @@ -65,19 +65,10 @@ namespace dxvk { if (Dimension == D3D11_RESOURCE_DIMENSION_TEXTURE3D) imageInfo.flags |= VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR; - // Test whether the combination of image parameters is supported - if (!CheckImageSupport(&imageInfo, VK_IMAGE_TILING_OPTIMAL)) { - throw DxvkError(str::format( - "D3D11: Cannot create texture:", - "\n Format: ", imageInfo.format, - "\n Extent: ", imageInfo.extent.width, - "x", imageInfo.extent.height, - "x", imageInfo.extent.depth, - "\n Samples: ", imageInfo.sampleCount, - "\n Layers: ", imageInfo.numLayers, - "\n Levels: ", imageInfo.mipLevels, - "\n Usage: ", std::hex, imageInfo.usage)); - } + // Some image formats (i.e. the R32G32B32 ones) are + // only supported with linear tiling on most GPUs + if (!CheckImageSupport(&imageInfo, VK_IMAGE_TILING_OPTIMAL)) + imageInfo.tiling = VK_IMAGE_TILING_LINEAR; // Determine map mode based on our findings m_mapMode = DetermineMapMode(&imageInfo); @@ -102,6 +93,20 @@ namespace dxvk { if (imageInfo.tiling == VK_IMAGE_TILING_OPTIMAL) imageInfo.layout = OptimizeLayout(imageInfo.usage); + // Check if we can actually create the image + if (!CheckImageSupport(&imageInfo, imageInfo.tiling)) { + throw DxvkError(str::format( + "D3D11: Cannot create texture:", + "\n Format: ", imageInfo.format, + "\n Extent: ", imageInfo.extent.width, + "x", imageInfo.extent.height, + "x", imageInfo.extent.depth, + "\n Samples: ", imageInfo.sampleCount, + "\n Layers: ", imageInfo.numLayers, + "\n Levels: ", imageInfo.mipLevels, + "\n Usage: ", std::hex, imageInfo.usage)); + } + // If necessary, create the mapped linear buffer if (m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER) m_buffer = CreateMappedBuffer();