Skip to content

[Impeller] impellerc will blow up if you specify a layout(location= on a sampler2D. #141219

@dnfield

Description

@dnfield

Error looks like

Compilation failed.
/Users/dnfield/src/flutter_shaders/lib/shaders/pixelation.frag: GLSL to SPIRV failed; Compilation error. 0 error(s) and 2 warning(s).
/Users/dnfield/src/flutter_shaders/lib/shaders/pixelation.frag:10: warning: 'uPixels' : ignoring layout qualifier for uniform location
/Users/dnfield/src/flutter_shaders/lib/shaders/pixelation.frag:11: warning: 'uSize' : ignoring layout qualifier for uniform location
shaderc: internal error: compilation succeeded but failed to optimize: [VUID-StandaloneSpirv-Location-06672] Location decoration must not be applied to this storage class
  %uTexture = OpVariable %_ptr_UniformConstant_44 UniformConstant





Target debug_android_application failed: ShaderCompilerException: Shader compilation of "/Users/dnfield/src/flutter_shaders/lib/shaders/pixelation.frag" to "/Users/dnfield/src/flutter_shaders/example/build/app/intermediates/flutter/debug/flutter_assets/packages/flutter_shaders/shaders/pixelation.frag" failed with exit code 1.
impellerc stdout:

impellerc stderr:
Compilation failed.
/Users/dnfield/src/flutter_shaders/lib/shaders/pixelation.frag: GLSL to SPIRV failed; Compilation error. 0 error(s) and 2 warning(s).
/Users/dnfield/src/flutter_shaders/lib/shaders/pixelation.frag:10: warning: 'uPixels' : ignoring layout qualifier for uniform location
/Users/dnfield/src/flutter_shaders/lib/shaders/pixelation.frag:11: warning: 'uSize' : ignoring layout qualifier for uniform location
shaderc: internal error: compilation succeeded but failed to optimize: [VUID-StandaloneSpirv-Location-06672] Location decoration must not be applied to this storage class
  %uTexture = OpVariable %_ptr_UniformConstant_44 UniformConstant

The solution is to remove the location directive (or even just remove the whole layout specifier).

The error is probably going to be hard for users to understand, but I think it's also probably not super commonly used and maybe the users who do come across it will just know what to do.

I don't know if there's any way to get shaderc to be more permissive of such errors, but I'm also not sure how much more we want shaderc to accept weird input data. The path forward is probably flutter_gpu for this kind of thing anyway?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecte: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.team-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions