-
Notifications
You must be signed in to change notification settings - Fork 340
Sampler definition #73
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM although I don't remember off the top of my head whether every option is supported in every API. Assuming you or someone investigated this.
One comment
}; | ||
|
||
// Sampler | ||
enum WebGPUFilterMode { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unintentional removal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's on line 121 below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, in that case, I assume you meant to remove the 3 lines below this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
....yep.
Yeah, I did the investigation. The only thing that was non-obvious was the bias parameter - all the shading languages allow specifying the bias in the sample() function, but only HLSL and Vulkan allow setting the bias in the sampler. Emulating it using a constant buffer would be pretty easy in Metal, and we're likely going to have to create these invisible constant buffers anyway, so I figure we can just do that. |
design/sketch.webidl
Outdated
float lodMinClamp = 0, | ||
float lodMaxClamp = FLT_MAX, | ||
unsigned long maxAnisotropy = 1, | ||
boolean normalizedCoordinates = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see something like this in D3D12_SAMPLER_DESC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, you’re right, I missed that. It would have to be emulated, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, we should instead remove this for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM too, we'll need to investigate the lodClamp.
We should discuss emulation in the group. |
Interestingly, we've been calling |
design/sketch.webidl
Outdated
// Samplers | ||
enum WebGPUAddressMode { | ||
"clampToEdge", | ||
"mirrorClampToEdge", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: this requires "VK_KHR_sampler_mirror_clamp_to_edge". It's not supported on Mali/Adreno Android GPUs, and a few desktop ones (e.g. Kabylake GT2 on Linux). Perhaps we can get started without it?
design/sketch.webidl
Outdated
boolean normalizedCoordinates = true, | ||
WebGPUCompareFunction compareFunction = "never", | ||
WebGPUBorderColor borderColor = "transparentBlack" | ||
float bias = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's call it lodBias
for better clarity
Looks like the WebGPUCompareFunction was actually a duplication, I'm going to remove one of them in a cleanup commit to make this pass IDL validation again. |
Flesh out the definition of WebGPUSamplerDescriptor