Rust-GPU / Rust-GPU/rust-gpu

[Migrated] Emulate Image/Sampler API operations on non-SPIRV platforms

Open
#84 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3.4k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/1065
Old labels: t: enhancement
Originally creatd by Keavon on 2023-05-26T16:12:52Z 👍: 4 ❤️: 2


While the GPU provides hardware for texture sampling and interpolation, on other targets (i.e. CPU in general) it's necessary to emulate that. Currently, the Image and Sampler APIs don't provide texture sampling operations when compiling to non-SPIRV targets.

We need this for an issue on Graphite to support image transformation with graceful CPU fallback (even if the performance would be not ideal), since WebGPU is only available on Chromium browsers for now and thus CPU is still an important target. Having this feature be as performant as possible would be eventually nice, but a slower solution would be a reasonable starting point of greater priority to our use case (something is better than nothing, existing is better than fast).

This issue was discussed in the Embark Discord.

Also on Discord before filing this issue, @eddyb summarized some recollection of the potential main three main concerns involved:

how to feed data into the API, how the API stores the data internally, and how the sampling is implemented - with the middle one, with its potential need to add lifetimes, and/or remove Copy & use Arc, being the worst part, since at least unoptimized sampling is mostly "just" looking up 4 texels and interpolating them

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Image and Sampler APIs and their non-SPIR-V compilation paths. Trace how texture data is supplied and stored, then determine the sampling behavior needed for CPU and other non-SPIR-V targets; done means these APIs provide texture sampling and interpolation outside SPIR-V while preserving the existing GPU behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.