KhronosGroup / SPIRV-Cross

SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.
Apache License 2.0
1.97k stars 549 forks source link

[HLSL] Option for treat all textures as texture arrays. #1472

Open konstantinegorov opened 3 years ago

konstantinegorov commented 3 years ago

d3d does not provide the ability to specify an array slice when creating a non-arrayed texture view from an arrayed texture. If hlsl will treat all textures as texture arrays, the d3d limitation can be bypassed since I can always create an arrayed view with a single array slice:

d3d_view_desc->Dimension = TextureArray;
d3d_view_desc->TextureArray.MostDetailedMip = mip_level;
d3d_view_desc->TextureArray.MipLevels = mip_level_count;
d3d_view_desc->TextureArray.FirstArraySlice = array_slice;
d3d_view_desc->TextureArray.ArraySize = 1;
HansKristian-Work commented 3 years ago

I believe it is legal for HLSL Texture2D to map to a single-slice Texture2DArray.

konstantinegorov commented 3 years ago

It's not possible to map a slice of Texture2DArray to HLSL Texture2D, if array size > 1 and slice != 0;