-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Optionally support SamplerAddressMode::kDecal on the OpenGLES backend #46650
Changes from all commits
dd5b80a
e5fd823
5367092
1852799
ea78ff1
990d7d2
1de6e16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,7 +53,8 @@ static GLint ToParam(MinMagFilter minmag_filter, | |
| FML_UNREACHABLE(); | ||
| } | ||
|
|
||
| static GLint ToAddressMode(SamplerAddressMode mode) { | ||
| static GLint ToAddressMode(SamplerAddressMode mode, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I might just pass in a bool for whether or not decal is supported.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a drive by comment; Is it just me or does anyone else find "decal" mode to be a non-standard and/or overly confusing term? How about just Perhaps later, we can rename this enum value for consistency.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a cost for non-consistency with the underlying graphics API, but there is also a value in matching the framework level enumeration which uses decal as a terminology. I don't feel as strongly about decal as I do about "FilterQuality", which is entirely opaque - at least decal has some semantic meaning
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Done |
||
| bool supports_decal_sampler_address_mode) { | ||
| switch (mode) { | ||
| case SamplerAddressMode::kClampToEdge: | ||
| return GL_CLAMP_TO_EDGE; | ||
|
|
@@ -62,7 +63,10 @@ static GLint ToAddressMode(SamplerAddressMode mode) { | |
| case SamplerAddressMode::kMirror: | ||
| return GL_MIRRORED_REPEAT; | ||
| case SamplerAddressMode::kDecal: | ||
| break; // Unsupported. | ||
| if (supports_decal_sampler_address_mode) { | ||
| return GL_CLAMP_TO_BORDER; | ||
| } | ||
| break; | ||
| } | ||
| FML_UNREACHABLE(); | ||
| } | ||
|
|
@@ -96,10 +100,14 @@ bool SamplerGLES::ConfigureBoundTexture(const TextureGLES& texture, | |
| ToParam(desc.min_filter, mip_filter)); | ||
| gl.TexParameteri(target.value(), GL_TEXTURE_MAG_FILTER, | ||
| ToParam(desc.mag_filter)); | ||
| gl.TexParameteri(target.value(), GL_TEXTURE_WRAP_S, | ||
| ToAddressMode(desc.width_address_mode)); | ||
| gl.TexParameteri(target.value(), GL_TEXTURE_WRAP_T, | ||
| ToAddressMode(desc.height_address_mode)); | ||
| gl.TexParameteri( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do we set the border color?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this defaults to transparent black so we don't need to worry about it?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. according to https://registry.khronos.org/OpenGL-Refpages/es3/html/glTexParameter.xhtml this value defaults to transparent black so we don't need to set anything.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess. I took a look at Vulkan and setting the border color is an extension. But setting it to
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Flutter does not expose an API for setting the border color.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nevermind. Its an extension that is core in 1.1. And we do set it to transparent black. Let's be explicit and do the same here as well please?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its is also dealers choice on Metal at the moment. Let's be explicit and set borderColor here too. In fact, a default border color specification in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah, just didn't want to read the spec to see if the default was transparent black. Just being explicit seemed better. There isn't any bug though.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue filed: flutter/flutter#136153 |
||
| target.value(), GL_TEXTURE_WRAP_S, | ||
| ToAddressMode(desc.width_address_mode, | ||
| gl.GetCapabilities()->SupportsDecalSamplerAddressMode())); | ||
| gl.TexParameteri( | ||
| target.value(), GL_TEXTURE_WRAP_T, | ||
| ToAddressMode(desc.height_address_mode, | ||
| gl.GetCapabilities()->SupportsDecalSamplerAddressMode())); | ||
| return 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.
These can still technically be ifdefs since vulkan/metal always support 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.
Got it, added them back.