Skip to content

Update ToVkImageViewType to support VK_IMAGE_VIEW_TYPE_2D_ARRAY - #9220

Merged
tomspilman merged 1 commit into
MonoGame:developfrom
acarteas:9212-macos-vulkan-texture-array-fix
Feb 12, 2026
Merged

tomspilman merged 1 commit into
MonoGame:developfrom
acarteas:9212-macos-vulkan-texture-array-fix

Conversation

@acarteas

Copy link
Copy Markdown
Contributor

Fixes #9212

Description of Change

This PR addresses an issue on the Vulkan where textures that were 2D arrays were getting mapped to VK_IMAGE_VIEW_TYPE_2D instead of VK_IMAGE_VIEW_TYPE_2D_ARRAY. On MacOS, this mismatch causes an application crash.

The approach chosen was to add an additional optional layerCount parameter to ToVkImageViewType that can be used to distinguish between 2D and 2D Array types.

Note that there is a similarly named ToVkImageType that performs a conversion between MGTextureType and Vulkan constants. It does not include this new switching logic because it doesn't seem to affect the MacOS runtime problem which is what motivated the creation of #9212.

Contributor Declaration

  • I certify that no LLM's were used to generate any code or documentation in this contribution.

…to determine whether the supplied MGTextureType is a 2D array or 2D image
@acarteas

Copy link
Copy Markdown
Contributor Author

I forgot to change the PR name and it doesn't appear as though I'm able to do so. If it matters, Update ToVkImageViewType to support VK_IMAGE_VIEW_TYPE_2D_ARRAY might be more succinct.

@tomspilman tomspilman changed the title Update ToVkImageViewType to take an optional layerCount that is used … Update ToVkImageViewType to support VK_IMAGE_VIEW_TYPE_2D_ARRAY Feb 12, 2026
@tomspilman
tomspilman merged commit 5ca4402 into MonoGame:develop Feb 12, 2026
9 checks passed
@acarteas
acarteas deleted the 9212-macos-vulkan-texture-array-fix branch April 20, 2026 18:55
@tomspilman tomspilman modified the milestones: 3.8.6, 3.8.5 Jul 14, 2026
zignd pushed a commit to zigrok/MonoGame that referenced this pull request Jul 30, 2026
MonoGame#9220)

Fixes MonoGame#9212 


### Description of Change
This PR addresses an issue on the Vulkan where textures that were 2D
arrays were getting mapped to `VK_IMAGE_VIEW_TYPE_2D` instead of
`VK_IMAGE_VIEW_TYPE_2D_ARRAY`. On MacOS, this mismatch causes an
application crash.

The approach chosen was to add an additional optional `layerCount`
parameter to `ToVkImageViewType` that can be used to distinguish between
2D and 2D Array types.

Note that there is a similarly named `ToVkImageType` that performs a
conversion between `MGTextureType` and Vulkan constants. It does not
include this new switching logic because it doesn't seem to affect the
MacOS runtime problem which is what motivated the creation of MonoGame#9212.

### Contributor Declaration

- [x] I certify that no LLM's were used to generate any code or
documentation in this contribution.

Co-authored-by: Adam Carter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DesktopVK] macos crashes when supplying Texture2DArray to shader with error newSliceRange.length(3) must equal (1) for textureType (MTLTextureType2D).

2 participants