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

Sampler Precision define likely needed? #234

Open
vade opened this issue Nov 4, 2024 · 0 comments
Open

Sampler Precision define likely needed? #234

vade opened this issue Nov 4, 2024 · 0 comments

Comments

@vade
Copy link
Collaborator

vade commented Nov 4, 2024

When working in Metal (and I presume other languages), there are times where you want to work in say, Float 16 (Half 4) rather than full Float since on Apple Silicon that type is more performant.

While I can change the types for some classes of functions when I use them using say

#define CHROMAAB_TYPE half3

There is a widely held assumption (at least in the sampler folder) that most samplers will return float type:

float4 sampleClamp2edge(SAMPLER_TYPE tex, float2 st, float2 texResolution)

for example.

We may want to introduce a define

#ifndef SAMPLER_PRECISION
#define SAMPLER_PRECISION half4
#endif

which we can use like

SAMPLER_PRECISION sampleClamp2edge(SAMPLER_TYPE tex, float2 st, float2 texResolution)

While will allow callees to adjust the sampler type and precision like so:

#define SAMPLER_PRECISION half4
#define SAMPLER_TYPE texture2d<half>

To opt into fast path on their hardware?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant