Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
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
Prev Previous commit
Next Next commit
add case for texturegles.
  • Loading branch information
jonahwilliams committed Feb 10, 2024
commit b3d9c1e53d3c8d4b5837df13eb02723d3243ba2c
6 changes: 5 additions & 1 deletion impeller/renderer/backend/gles/texture_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ struct TexImage2DData {
external_format = GL_ALPHA;
type = GL_UNSIGNED_BYTE;
break;
case PixelFormat::kR8UNormInt:
Copy link
Member

Choose a reason for hiding this comment

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

GL_RED is ES 3.0 and above only. A8 was chosen based on the ES 2.0 floors cap.

I agree that we should NOT depend on swizzles however. We observed some pretty dire performance cliffs with swizzles on older drivers. Though, to perform a swizzle via GL_TEXTURE_SWIZZLE_ requires ES 3.0 too. So we can't do it on ES 2.0 (and we shouldn't).

I suggest having a kGrayBitmap that maps to the backend native format and have an ifdef in the shader to pick the right format directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack, will do some more digging on that. I thought I observed Skia consistently using red bitmaps but that might just be on newer devices.

Copy link
Member

Choose a reason for hiding this comment

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

👍🏽 go/es2-reference and go/es3-reference might come in handy. I also have Dash docsets for the different versions so checking up flag compatibility is easier. If you use Dash though.

internal_format = GL_RED;
external_format = GL_RED;
type = GL_UNSIGNED_BYTE;
break;
case PixelFormat::kR8G8B8A8UNormInt:
case PixelFormat::kB8G8R8A8UNormInt:
case PixelFormat::kR8G8B8A8UNormIntSRGB:
Expand Down Expand Up @@ -161,7 +166,6 @@ struct TexImage2DData {
break;
case PixelFormat::kUnknown:
case PixelFormat::kD32FloatS8UInt:
case PixelFormat::kR8UNormInt:
case PixelFormat::kR8G8UNormInt:
case PixelFormat::kB10G10R10XRSRGB:
case PixelFormat::kB10G10R10XR:
Expand Down