Repository navigation
[Flutter GPU] Add 2D texture array support - #190036
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for 2D array textures (TextureType::kTexture2DArray) to the Impeller GLES backend and exposes it to the Flutter GPU Dart API, enabling multi-layer texture allocation, uploading, and sampling. Feedback recommends explicitly casting variables to GLint and GLsizei in OpenGL calls to prevent narrowing conversion warnings, and replacing assert statements with standard expect assertions in Dart tests to ensure they execute across all build modes.
|
@bdero how about this one too, ready to review? |
|
ready to go now! |
gaaclarke
left a comment
There was a problem hiding this comment.
Code looks good, testing looks good, design looks good. I just have a few notes.
| VALIDATION_LOG | ||
| << "2D array textures are not supported on this context."; | ||
| return false; |
There was a problem hiding this comment.
This seems like the sort of thing we should surface up to Dart. Can we add some TODO and file a follow up issue?
There was a problem hiding this comment.
Resolved directly instead of deferring: GpuContext.createTexture now throws when a texture2DArray is requested but doesSupportTextureArrays is false, so callers get a clear error at creation rather than a failed upload. It reads the cached capability at creation time only, nothing on the draw path. This engine check stays as a backstop. No follow-up issue needed. (8cfb9ef)
| desc.size = {width, height}; | ||
| desc.format = flutter::gpu::ToImpellerPixelFormat(format); | ||
| desc.mip_count = static_cast<size_t>(mip_level_count); | ||
| desc.array_layer_count = static_cast<uint16_t>(layer_count); |
There was a problem hiding this comment.
fml_dcheck( layer_count <= uint16_max)
| @@ -0,0 +1 @@ | |||
| /Users/bdero/projects/flutter/flutter/engine/src/flutter/prebuilts No newline at end of file | |||
There was a problem hiding this comment.
Yes, that was an accidental checkin of a local build symlink (the repo .gitignore only matches the prebuilts/ directory, not a symlink, so git add -A caught it). Removed. (d41651d)
b7870c1 to
a2fd5fa
Compare
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
209fb5a to
b03257e
Compare
b03257e to
78566dc
Compare
TextureType.texture2DArray plus a layerCount argument on GpuContext.createTexture create the texture, Texture.overwrite and ColorAttachment.slice address each layer as a slice, and GpuContext.doesSupportTextureArrays reports availability. Capabilities::SupportsTextureArrays reports backend support, BlitPass::AddCopy validates slices against the texture type rather than a fixed cubemap bound, and the GLES backend gains buffer-to-array-layer blits. The capability reports false on GLES for now because shader bundles cannot carry an ES 3.0 shader variant yet, so user shaders there cannot sample arrays.
GpuContext.createTexture now throws when a texture2DArray is requested but doesSupportTextureArrays is false, so callers get a clear error at creation instead of a failed upload later. The check reads a cached capability and runs only at creation, not on any draw path.
d488a58 to
916b679
Compare
|
At the time of writing, |
Related to #188776.
Adds 2D array texture support to Flutter GPU.
TextureType.texture2DArraywith alayerCountargument onGpuContext.createTexturecreates the texture,Texture.overwriteandColorAttachment.sliceaddress each layer as a slice, andGpuContext.doesSupportTextureArraysreports availability. On the engine side,Capabilities::SupportsTextureArraysreports backend support,BlitPass::AddCopyvalidates slices against the texture type rather than a fixed cubemap bound, and the GLES backend gains buffer-to-array-layer blits. The capability reports false on GLES for now because shader bundles cannot carry an ES 3.0 shader variant yet, so user shaders there cannot sample arrays.Pre-launch Checklist
///).