Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add support of Texture.CopyTexture() #216

Closed
JohnMasen opened this issue Mar 31, 2022 · 1 comment
Closed

Please add support of Texture.CopyTexture() #216

JohnMasen opened this issue Mar 31, 2022 · 1 comment
Labels
proposal 💡 A proposal for a new feature untriaged 🧰 A new issue that needs initial triage

Comments

@JohnMasen
Copy link

Description (optional)

I found the library is using texture copy inside AllocateReadOnlyTexture2D<T,TPixel>(), however the texture copy method is not exposed to public.
The idea is able to create a texture processing pipleline like this:
Upload ->CopyTo Texture -> Process Texture ->Readback result

Rationale

I'm trying to use ComputeSharp to build a fast image resize/resample pipeline for AI Model(ONNX) inference, the stream from video source is RGBA32 format, I wish I could use UploadTexutre2D to upload the stream then copy it to ReadOnlyTexture2D .

Proposed API

Add CopyTexture<TSource,TTarget>(Texture texture) to UploadTexture.

Drawbacks

TBD

Alternatives

Other thoughts

It is also suggested add a customer type mapper to allow map user data structure to DXPixelFormat just like DXGIFormatHelper. User can create UploadTexture/ReadOnlyTexture with the custom mapper to

  1. Map ImageSharp pixel formats directly to DirectX PixelFormats without MemoryMarshal.Cast()
  2. use DXGI_FORMAT_NV12 directly from DXVA GPU decoded video frame

example:
device.AllocateUploadTexture2D(ReadonlySpan buffer, int w, int h, DXGITypeMapper mapper );

Thanks

@JohnMasen JohnMasen added proposal 💡 A proposal for a new feature untriaged 🧰 A new issue that needs initial triage labels Mar 31, 2022
@Sergio0694
Copy link
Owner

Duplicate of #215 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal 💡 A proposal for a new feature untriaged 🧰 A new issue that needs initial triage
Projects
None yet
Development

No branches or pull requests

2 participants