Skip to content

[DRAFT] [DX/VK/MTL] TextureCube / TextureCubeArray / Texture3D resource kinds (with mip support) #1265

@alsepkow

Description

@alsepkow

⚠️ DRAFT — not ready for pickup. Title still being refined; do not assign or start work yet.

Background

#1039 added multi-mip SRV support for Texture2D / RWTexture2D via PR #1230. Extending the same to TextureCube / TextureCubeArray / Texture3D is genuinely a new-resource-kind workstream, not a small mip extension:

  • The shared ResourceKind enum in include/API/Enums.h does not currently contain any of TextureCube, TextureCubeArray, or Texture3D. No backend (DX/VK/MTL) has any code path for these types — there are zero matches in the first-party tree.
  • D3D12 cube textures use DepthOrArraySize = 6 (cube) or 6*N (cube array) with D3D12_RESOURCE_DIMENSION_TEXTURE2D and D3D12_SRV_DIMENSION_TEXTURECUBE / TEXTURECUBEARRAY. D3D12 3D textures use D3D12_RESOURCE_DIMENSION_TEXTURE3D with DepthOrArraySize = Depth, D3D12_SRV_DIMENSION_TEXTURE3D, and D3D12_UAV_DIMENSION_TEXTURE3D (for RWTexture3D). Per-mip semantics differ: cube has 6 array slices × mips; 3D has depth halving per mip within the single subresource per mip.
  • VK needs VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT + arrayLayers = 6 for cube, VK_IMAGE_TYPE_3D for 3D, plus VK_IMAGE_VIEW_TYPE_CUBE / CUBE_ARRAY / _3D.
  • MTL needs MTL::TextureTypeCube / CubeArray / Type3D.
  • YAML parser must accept the new kinds. Per-mip upload loops must handle the per-type subresource math (cube: subresource = mip + slice * MipLevels; 3D: just mip, and depth halves automatically).
  • Tests need at least one Load / Sample test per type with multiple mip levels.

Originally added as an AC on #1039 (2026-06-01) and reverted later the same day after scope analysis: the work spans the shared ResourceKind enum + YAML + 3 backends × 3 new resource types × per-type subresource semantics + tests for each (>3 days), large enough that it would obscure the simpler "Texture2D mips done" milestone if folded into #1039.

Acceptance criteria

  • Add ResourceKind::TextureCube, TextureCubeArray, Texture3D (and RWTexture3D if UAV writes are in scope) to include/API/Enums.h.
  • Extend YAML parser in lib/Support/Pipeline.cpp to accept the new strings.
  • DX: extend getDXDimension, getResourceDescription, getSRVDescription, getUAVDescription, and the per-mip upload loop in bindResources / createResource for cube + cube-array + 3D semantics.
  • VK: extend getVkImageType, getVkImageViewType, and image-create-info construction in lib/API/VK/Device.cpp for cube-compatible + 3D.
  • MTL: extend the image-type switch in lib/API/MTL/MTLDevice.cpp (start as llvm_unreachable stub for convergence).
  • Add one Load + one Sample test per new type with MipLevels > 1 under test/Feature/Textures/.
  • Gate VK/MTL tests on a lit feature if the backend impl is stubbed.

Notes

  • Estimated 3–5 days.

Refs #1039, llvm/wg-hlsl#400.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

Status
Planning

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions