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

[dxbc] Map 1D and 2D textures to their respective array type

As with cube textures, some games think it's a good idea to bind a
non-array view to a slot that expects an array view or vice versa.
Fixes clouds not appearing in TrackMania 2 Stadium (#191).
This commit is contained in:
Philip Rebohle 2018-04-21 14:15:10 +02:00
parent 0558a3b2c5
commit 906355b0da
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 6 additions and 7 deletions

View File

@ -369,7 +369,7 @@ namespace dxvk {
switch (desc.ViewDimension) {
case D3D11_SRV_DIMENSION_TEXTURE1D:
viewInfo.type = VK_IMAGE_VIEW_TYPE_1D;
viewInfo.type = VK_IMAGE_VIEW_TYPE_1D_ARRAY;
viewInfo.minLevel = desc.Texture1D.MostDetailedMip;
viewInfo.numLevels = desc.Texture1D.MipLevels;
viewInfo.minLayer = 0;
@ -385,7 +385,7 @@ namespace dxvk {
break;
case D3D11_SRV_DIMENSION_TEXTURE2D:
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
viewInfo.type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
viewInfo.minLevel = desc.Texture2D.MostDetailedMip;
viewInfo.numLevels = desc.Texture2D.MipLevels;
viewInfo.minLayer = 0;

View File

@ -810,13 +810,12 @@ namespace dxvk {
const uint32_t sampledTypeId = getScalarTypeId(sampledType);
// Declare the resource type
// TODO test multisampled images
const DxbcImageInfo typeInfo = [resourceType, isUav] () -> DxbcImageInfo {
switch (resourceType) {
case DxbcResourceDim::Buffer: return { spv::DimBuffer, 0, 0, isUav ? 2u : 1u };
case DxbcResourceDim::Texture1D: return { spv::Dim1D, 0, 0, isUav ? 2u : 1u };
case DxbcResourceDim::Texture1D: return { spv::Dim1D, 1, 0, isUav ? 2u : 1u };
case DxbcResourceDim::Texture1DArr: return { spv::Dim1D, 1, 0, isUav ? 2u : 1u };
case DxbcResourceDim::Texture2D: return { spv::Dim2D, 0, 0, isUav ? 2u : 1u };
case DxbcResourceDim::Texture2D: return { spv::Dim2D, 1, 0, isUav ? 2u : 1u };
case DxbcResourceDim::Texture2DArr: return { spv::Dim2D, 1, 0, isUav ? 2u : 1u };
case DxbcResourceDim::Texture2DMs: return { spv::Dim2D, 0, 1, isUav ? 2u : 1u };
case DxbcResourceDim::Texture2DMsArr: return { spv::Dim2D, 1, 1, isUav ? 2u : 1u };
@ -6214,9 +6213,9 @@ namespace dxvk {
case DxbcResourceDim::Buffer:
case DxbcResourceDim::RawBuffer:
case DxbcResourceDim::StructuredBuffer: return VK_IMAGE_VIEW_TYPE_MAX_ENUM;
case DxbcResourceDim::Texture1D: return VK_IMAGE_VIEW_TYPE_1D;
case DxbcResourceDim::Texture1D: return VK_IMAGE_VIEW_TYPE_1D_ARRAY;
case DxbcResourceDim::Texture1DArr: return VK_IMAGE_VIEW_TYPE_1D_ARRAY;
case DxbcResourceDim::Texture2D: return VK_IMAGE_VIEW_TYPE_2D;
case DxbcResourceDim::Texture2D: return VK_IMAGE_VIEW_TYPE_2D_ARRAY;
case DxbcResourceDim::Texture2DMs: return VK_IMAGE_VIEW_TYPE_2D;
case DxbcResourceDim::Texture2DArr: return VK_IMAGE_VIEW_TYPE_2D_ARRAY;
case DxbcResourceDim::Texture2DMsArr: return VK_IMAGE_VIEW_TYPE_2D_ARRAY;