Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add minmax-sampling feature
  • Loading branch information
kvark committed Dec 8, 2020
commit 867e5d50e7dbc9eac3b52c4d4c471da407f90b5d
36 changes: 35 additions & 1 deletion spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,7 @@ enum GPUFeatureName {
"pipeline-statistics-query",
"texture-compression-bc",
"timestamp-query",
"minmax-sampling",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is minmax sampling allowed for uint, int textures, but also for comparison samplers?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minmax feature in vulkan doesn't require support for any integer formats, so I assume we wouldn't support any. It also can't be used with comparison samplers apparently (kinda weird).

If the format is a depth/stencil format, this bit only specifies that the depth aspect (not the stencil aspect) of an image of this format supports min/max filtering, and that min/max filtering of the depth aspect is supported when depth compare is disabled in the sampler.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be, but getting the stats for this is hard :(
For now the spec only allows it on a few selected formats (see last commit).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that's not a lot of formats.

};
</script>

Expand Down Expand Up @@ -2349,7 +2350,9 @@ match one texel.
<script type=idl>
enum GPUFilterMode {
"nearest",
"linear"
"linear",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Briefly considering if we try to come up with a word other than linear, since this also describes minmax filters which aren't exactly "linear"? I'm not sure what it would be; "nearest"/"linear"(/"cubic") is well understood terminology. I think they're clearest.

Vulkan has an extension to use min/max with "cubic", too, fwiw: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#textures-texel-cubic-filtering

"minimim",
Comment thread
kvark marked this conversation as resolved.
Outdated
"maximum",
};
</script>

Expand All @@ -2361,6 +2364,16 @@ enum GPUFilterMode {
: <dfn>"linear"</dfn>
::
Select two texels in each dimension and return a linear interpolation between their values.

: <dfn>"minimum"</dfn>
::
Select two texels in each dimension and return the minimum value between them.
Requires {{GPUFeatureName/"minmax-sampling"}} feature to be enabled.

: <dfn>"maximum"</dfn>
::
Select two texels in each dimension and return the maximum value between them.
Requires {{GPUFeatureName/"minmax-sampling"}} feature to be enabled.
</dl>

{{GPUCompareFunction}} specifies the behavior of a comparison sampler. If a comparison sampler is
Expand Down Expand Up @@ -2429,6 +2442,11 @@ enum GPUCompareFunction {
- |descriptor|.{{GPUSamplerDescriptor/lodMinClamp}} is greater than or equal to 0.
- |descriptor|.{{GPUSamplerDescriptor/lodMaxClamp}} is greater than or equal to
|descriptor|.{{GPUSamplerDescriptor/lodMinClamp}}.
- |descriptor|.{{GPUSamplerDescriptor/magFilter}} and |descriptor.{{GPUSamplerDescriptor/mipmapFilter}}
are either {{GPUFilterMode/"nearest"}} or {{GPUFilterMode/"linear"}}, independently.
- if |descriptor|.{{GPUSamplerDescriptor/minFilter}} is {{GPUFilterMode/"minimum"}} or
{{GPUFilterMode/"maximum"}}, then the |device|.{{device/[[features]]}}
[=list/contain=] {{GPUFeatureName/"minmax-sampling"}}.
Comment thread
kvark marked this conversation as resolved.
Outdated
</div>

<dl dfn-type=method dfn-for=GPUDevice>
Expand Down Expand Up @@ -7253,6 +7271,22 @@ The following enums are supported if and only if the {{GPUFeatureName/"timestamp
* {{GPUQueryType/"timestamp"}}
</dl>

## <dfn dfn-type=enum-value dfn-for=GPUFeatureName>minmax-sampling</dfn> ## {#minmax-sampling}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## <dfn dfn-type=enum-value dfn-for=GPUFeatureName>minmax-sampling</dfn> ## {#minmax-sampling}
## <dfn enum-value for=GPUFeatureName>minmax-sampling</dfn> ## {#minmax-sampling}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change this across all features, consistently (as a follow-up)


Allows for sampling modes that take the minimum or maximum of texture values.

**Feature Enums**

The following enums are supported if and only if the {{GPUFeatureName/"minmax-sampling"}}
[=feature=] is enabled:

<dl>
: {{GPUFilterMode}}
::
* {{GPUFilterMode/"minimum"}}
* {{GPUFilterMode/"maximum"}}
</dl>

# Appendices # {#appendices}

## Texture Format Capabilities ## {#texture-format-caps}
Expand Down