Skip to content

Commit

Permalink
[Vulkan] Ensure cubemap TextureViews are created with the correct VkI…
Browse files Browse the repository at this point in the history
…mageViewType.
  • Loading branch information
mellinoe committed Mar 16, 2019
1 parent 2d8d315 commit 632cca3
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/Veldrid/Vk/VkTextureView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,24 @@ public VkTextureView(VkGraphicsDevice gd, ref TextureViewDescription description
imageViewCI.viewType = description.ArrayLayers == 1 ? VkImageViewType.ImageCube : VkImageViewType.ImageCubeArray;
imageViewCI.subresourceRange.layerCount *= 6;
}

switch (tex.Type)
else
{
case TextureType.Texture1D:
imageViewCI.viewType = description.ArrayLayers == 1
? VkImageViewType.Image1D
: VkImageViewType.Image1DArray;
break;
case TextureType.Texture2D:
imageViewCI.viewType = description.ArrayLayers == 1
? VkImageViewType.Image2D
: VkImageViewType.Image2DArray;
break;
case TextureType.Texture3D:
imageViewCI.viewType = VkImageViewType.Image3D;
break;
switch (tex.Type)
{
case TextureType.Texture1D:
imageViewCI.viewType = description.ArrayLayers == 1
? VkImageViewType.Image1D
: VkImageViewType.Image1DArray;
break;
case TextureType.Texture2D:
imageViewCI.viewType = description.ArrayLayers == 1
? VkImageViewType.Image2D
: VkImageViewType.Image2DArray;
break;
case TextureType.Texture3D:
imageViewCI.viewType = VkImageViewType.Image3D;
break;
}
}

vkCreateImageView(_gd.Device, ref imageViewCI, null, out _imageView);
Expand Down

0 comments on commit 632cca3

Please sign in to comment.