Skip to content

[Impeller] Rendering error in blur hash shader due to uniform padding. #161645

@xioxin

Description

@xioxin

Steps to reproduce

I am the developer of blurhash_shader. After upgrading to version 3.27.2 and using the Impeller rendering engine with Vulkan as the backend, I encounter incorrect rendering results.

I have noticed that the higher the computational cost of the shader, the greater the potential errors that may occur. The blurhash can store a different number of color samples, and in the code sample, the blurhash contains 60 colors, which requires looping 60 times in the shader.

Device: Xiaomi Redmi K70
System: Android 15
Vulkan API: 1.3

  1. Create an empty project.
  2. Install the blurhash_shader package.
  3. Use the code sample.
  4. Run the project on a device that supports Vulkan, using the Impeller rendering engine.

Expected results

Refer to Skia screenshot

Actual results

Refer to Impeller screenshot

Code sample

Code sample

https://github.com/xioxin/blurhash_shader

import 'package:blurhash_shader/blurhash_shader.dart';
import 'package:flutter/material.dart';

class ListPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("List"),
      ),
      body: GridView.builder(
          gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 4,
            crossAxisSpacing: 10,
            mainAxisSpacing: 10,
          ),
          itemBuilder: (context, index) {
            return BlurHash(
                r"rLLXc8J7.Ao~9FIAkXITR,_3=|soM_M{bca#kCRj.9adD%IUs,%gi^R*n%-;RjMxtRbwRPkXofkCR3bbnO%Mx]MxRjazWXO@jFtSRjjYbbR5ozs:");
          }),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
  • The message in the old device logs indicates "Known bad Vulkan driver encountered, falling back to OpenGLES," which is displayed the same as with Skia.
Impeller(Vulkan) Skia / Impeller(OpenGLES) *
Image Image

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.27.2, on macOS 15.1.1 24B91 darwin-arm64, locale zh-Hans-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.96.2)
[✓] Connected device (5 available)
    ! Error: Browsing on the local area network for **iPad. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for ** Ensure the device is unlocked and discoverable via Bluetooth. (code -27)
[✓] Network resources

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    e: impellerImpeller rendering backend issues and features requestsr: fixedIssue is closed as already fixed in a newer versionteam-engineOwned by Engine team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions