mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
GFX: add support for cubemap texture arrays
Previously we only supported cube textures, this patch implements support for cube texture arrays.
This commit is contained in:
parent
aa405dc4c3
commit
2083bc73fa
@ -198,18 +198,35 @@ void CreateTextureResource(TextureAsset_s* textureHeader, INT_PTR imageData)
|
||||
shaderResource.Format = dxgiFormat;
|
||||
shaderResource.Texture2D.MipLevels = textureHeader->textureMipLevels;
|
||||
|
||||
if (textureHeader->arraySize > 1) // Do we have a texture array?
|
||||
const u8 arraySize = textureHeader->arraySize;
|
||||
|
||||
if (arraySize > 1) // Do we have a texture array?
|
||||
{
|
||||
const bool isCubeMap = (textureHeader->layerCount & 2);
|
||||
|
||||
if (!isCubeMap)
|
||||
{
|
||||
shaderResource.Texture2DArray.FirstArraySlice = 0;
|
||||
shaderResource.Texture2DArray.ArraySize = textureHeader->arraySize;
|
||||
shaderResource.ViewDimension = D3D_SRV_DIMENSION_TEXTURE2DARRAY;
|
||||
shaderResource.Texture2DArray.FirstArraySlice = 0;
|
||||
shaderResource.Texture2DArray.ArraySize = arraySize;
|
||||
}
|
||||
else
|
||||
shaderResource.ViewDimension = D3D_SRV_DIMENSION_TEXTURECUBE;
|
||||
{
|
||||
// Cube textures have 6 faces to form the cube; one texture per
|
||||
// cube face. If we have more, we have a cube map array.
|
||||
if (arraySize == 6)
|
||||
shaderResource.ViewDimension = D3D_SRV_DIMENSION_TEXTURECUBE;
|
||||
else
|
||||
{
|
||||
// Must have a multiple of 6 textures per cube in the array,
|
||||
// else we have one or more cubes with missing faces.
|
||||
Assert(arraySize % 6 == 0);
|
||||
|
||||
shaderResource.ViewDimension = D3D_SRV_DIMENSION_TEXTURECUBEARRAY;
|
||||
shaderResource.Texture2DArray.FirstArraySlice = 0;
|
||||
shaderResource.Texture2DArray.ArraySize = arraySize / 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user