Introduce a new Texture type with DX,VK,MTL implementations.#1020
Open
EmilioLaiso wants to merge 19 commits intollvm:mainfrom
Open
Introduce a new Texture type with DX,VK,MTL implementations.#1020EmilioLaiso wants to merge 19 commits intollvm:mainfrom
Texture type with DX,VK,MTL implementations.#1020EmilioLaiso wants to merge 19 commits intollvm:mainfrom
Conversation
ee21f04 to
48dadd6
Compare
217f6ef to
505d3f0
Compare
de634bd to
0bf7cfc
Compare
damyanp
reviewed
Apr 1, 2026
e1c50e9 to
eb9f868
Compare
| const CPUBuffer &B = *P.Bindings.RTargetBufferPtr; | ||
| memcpy(B.Data[0].get(), Mapped, B.size()); | ||
| vkUnmapMemory(Device, ResRef.Host.Memory); | ||
| vkUnmapMemory(Device, IS.RTReadback->Memory); |
Contributor
There was a problem hiding this comment.
NOTE: unmapping is not necessary in Vulkan or DX12. It's fine to leave it as is, but I thought it was good to know it's fine to leave this persistently mapped.
Contributor
manon-traverse
left a comment
There was a problem hiding this comment.
Just a couple of small comments, but other than that looks good to me
ec128cd to
4c4f1a6
Compare
…reateDesc` and `Buffer` to `Buffer.h`
…ure description validation accordingly and have it return an error rather than a bool.
…ffer to align with other API in preparation of unified API
…h shared Device::createRenderTarget and createBuffer APIs
…sDepth` to help validating code during transition. Remove `ResourceBundle FrameBufferResource` from `InvocationState`
… stencil target through all backends (vk was using depth stencil, dx and metal weren't)
4c4f1a6 to
c0ab760
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Texture.hwith a sharedTextureCreateDesc,TextureFormatenum,TextureUsageflags,ClearValuevariant (ClearColor/ClearDepthStencil), andvalidateTextureCreateDescreturning specificllvm::ErrormessagescreateTextureto all three backends (DX, Vulkan, Metal) as a virtual method onDevice, handling resource creation, optimized clear values, and format/usage validationcreateRenderTargetFromCPUBuffer(Device&, CPUBuffer&)free function — all backends now route throughcreateTextureinstead of manually calling API-specific resource creationcreateDefaultDepthStencilTarget(Device&, Width, Height)free function withD32FloatS8Uintformat — added depth testing to DX and Metal backends (previously only Vulkan had it)createBufferAPI withMemoryLocation::GpuToCpu; Metal refactored fromStorageModeSharedtexture withgetBytes()toStorageModePrivatetexture + blit copy to readback buffer (this is to align functionality between backends in preparation of api-agnostic code-flow. Sacrifices had to be made 😛)VkImageView(VK) are now created atcreateTexturetime forRenderTarget/DepthStencilusage, removing view creation boilerplate from pipeline setupshared_ptr<VulkanTexture>/shared_ptr<VulkanBuffer>onInvocationStatetoTextureFormat(DataFormat, Channels)as a bridge function while refactoring, withvalidateTextureDescMatchesCPUBufferto catch mismatches between the old and new description systemsgetMetalTextureStorageModeandgetMetalBufferResourceOptionsbecauseGpuToCpumaps differently for textures (Managed) vs buffers (Shared)Future direction
Added for context to better understand some of the changes in this PR.
DataFormat + Channelsdual description.createBuffer— still uses the oldResourceRef/BufferRefsystemInvocationStateacross backends