gpu, metal: bind TextureCube/CubeArray/3D/2D views with matching MTLTextureType, fix UAV MipSlice in image_words, and decode D3D12 samplers #573
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-28T05:45:43Z.
Refs #258, #521
Problem
MTLTextureTypeor dropped mip/format overrides on Metal:victory-shaderlowers GFX10image_sample ... dim:CUBEto DXILTextureCube(compiled by Metal Shader Converter to MSLtexturecube), whileMetal::create_textureallocates 6-face cubemap resources asMTLTextureType::Type2DArray.native::descriptors::decodeonly routedTEXTURE_2D(4) andTEXTURE_2D_ARRAY(5) throughtexture_view;TEXTURE_CUBE(9),TEXTURE_CUBE_ARRAY(10),TEXTURE_3D(8),TEXTURE_1D(2),TEXTURE_1D_ARRAY(3), andTEXTURE_2DMS*(6,7) fell through withmips: None, slices: None(losingMipSlice/ mip ranges, cube-array slice ranges, and format casts onRWTexture3D/Texture3D/TextureCube*).create_texture_viewran (e.g. for placed views),Metal::create_texture_viewkeptlet ty = t.tex.textureType(), never creatingMTLTextureType::TypeCube,MTLTextureType::TypeCubeArray,MTLTextureType::Type2D(over aType2DArrayslice), orMTLTextureType::Type2DArray(over a 1-sliceType2D), andtex_slicesinMetalblits treatedTypeCube/TypeCubeArrayas 1 slice instead of6/6 * arrayLength.descriptor::image_wordsreadsd[4]instead ofd[2]asMipSliceon UAVs:D3D12_UNORDERED_ACCESS_VIEW_DESC,MipSliceis atd[2]whiled[4]holdsArraySize(Texture2DArray) /WSize(Texture3D, often0xFFFF_FFFF) /0(Texture2D).image_wordsused(true, _) => (ty, d[4], 1), corrupting descriptor-word size queries onRWTexture2Dmips> 0,RWTexture2DArray, andRWTexture3D.D3D12_SAMPLER_DESC(CreateSampler,View::Sampler) is not decoded on the native host:ID3D12Device::CreateSamplerinstead ofCreateSamplerXfailsdescriptors::decode(a descriptor was not mirrored).Proposed Fix
ViewDim(D2,D2Array,D3,Cube,CubeArray) toViewDescand carry view dimension, mip ranges, and slice/face ranges throughdescriptors::decodeandNativeHost::mirrorintoMetal::create_texture_view(and fixMTLTextureslice counting forTypeCube,TypeCubeArray,Type1DArray, andType2DMultisampleArray).descriptor::image_wordsto readd[2](MipSlice) forunordered == true.D3D12_SAMPLER_DESC(View::Sampler) insampler::d3d12_fieldsandnative::descriptors::decode.TextureCube(v_cubeid_f32/v_cubesc_f32/v_cubetc_f32/v_cubema_f32+image_sample ... dim:CUBE).Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-28T05:45:44Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T05:45:54Z.
Claimed by @Sheffy007. Open a draft pull request with
Refs #573in its description within 24 hours, or the claim expires.