Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] flushClearColor throws an error #1931

Closed
yowl opened this issue Jan 23, 2022 · 2 comments · Fixed by #2917
Closed

[BUG] flushClearColor throws an error #1931

yowl opened this issue Jan 23, 2022 · 2 comments · Fixed by #2917

Comments

@yowl
Copy link

yowl commented Jan 23, 2022

Description

Attempting to surface.Canvas.DrawColor(SKColors.White); and flush causes an exception

Code

            surface.Canvas.DrawColor(SKColors.White);

            surface.Canvas.Flush();

Expected Behavior

The canvas goes white

Actual Behavior

Exception occurs,

"RuntimeError: null function or function signature mismatch
    at GrGLFunction<void (float, float, float, float)>::GrGLFunction(void (*)(float, float, float, float))::'lambda'(void const*, float, float, float, float)::__invoke(void const*, float, float, float, float) (http://localhost:8000/wskia.wasm:wasm-function[42972]:0x153e1ca)
    at GrGLGpu::flushClearColor(SkRGBA4f<(SkAlphaType)2> const&) (http://localhost:8000/wskia.wasm:wasm-function[43322]:0x155382e)
    at GrGLGpu::beginCommandBuffer(GrRenderTarget*, SkIRect const&, GrSurfaceOrigin, GrOpsRenderPass::LoadAndStoreInfo const&, GrOpsRenderPass::StencilLoadAndStoreInfo const&) (http://localhost:8000/wskia.wasm:wasm-function[43337]:0x155583a)
    at GrGLOpsRenderPass::begin() (http://localhost:8000/wskia.wasm:wasm-function[43382]:0x155b466)
    at GrOpsTask::onExecute(GrOpFlushState*) (http://localhost:8000/wskia.wasm:wasm-function[43522]:0x1562580)
    at GrDrawingManager::executeRenderTasks(int, int, GrOpFlushState*, int*) (http://localhost:8000/wskia.wasm:wasm-function[42907]:0x1537823)
    at GrDrawingManager::flush(GrSurfaceProxy**, int, SkSurface::BackendSurfaceAccess, GrFlushInfo const&, GrPrepareForExternalIORequests const&) (http://localhost:8000/wskia.wasm:wasm-function[42906]:0x15373aa)
    at GrDrawingManager::flushSurfaces(GrSurfaceProxy**, int, SkSurface::BackendSurfaceAccess, GrFlushInfo const&) (http://localhost:8000/wskia.wasm:wasm-function[42908]:0x15379d8)
    at GrRenderTargetContext::flush(SkSurface::BackendSurfaceAccess, GrFlushInfo const&) (http://localhost:8000/wskia.wasm:wasm-function[32186]:0x1180ca5)
    at SkGpuDevice::flush() (http://localhost:8000/wskia.wasm:wasm-function[36719]:0x12ef302)"

Basic Information

  • Version with issue: WebAssembly 2.0.12
  • Last known good version:
  • IDE: Visual Studio
  • Platform Target Frameworks: WebAssembly/emscripten
  • Target Devices: Chrome Canary
Detailed IDE/OS information (click to expand)

PASTE ANY DETAILED VERSION INFO HERE

Screenshots

Reproduction Link

https://github.com/yowl/wskia/tree/flush

and build with

dotnet publish /p:SelfContained=true -r browser-wasm -c Debug /p:TargetArchitecture=wasm /p:PlatformTarget=AnyCPU /p:MSBuildEnableWorkloadResolver=false  --self-contained /p:EmccExtraArgs=.packages\skiasharp.nativeassets.webassembly\2.80.3\build\netstandard1.0\libSkiaSharp.a\2.0.12\libSkiaSharp.a

Then server using some webserver and open in Chrome canary

@maxkatz6
Copy link
Contributor

maxkatz6 commented Jun 29, 2024

I have a similar exception running Avalonia in NativeAOT-LLVM, but with HarfBuzzSharp

RuntimeError: null function or function signature mismatch
$S_P_CoreLib_System_Runtime_ThunkBlocks__GetNewThunksBlock | @ | dotnet.native.wasm:0x5d68d1
  | $S_P_CoreLib_System_Runtime_ThunksHeap___ctor | @ | dotnet.native.wasm:0xd9869
  | $S_P_CoreLib_System_Runtime_ThunksHeap__CreateThunksHeap | @ | dotnet.native.wasm:0x5bf890
  | $S_P_CoreLib_System_Runtime_InteropServices_PInvokeMarshal__AllocateThunk | @ | dotnet.native.wasm:0xbb27b
  | $S_P_CoreLib_System_Runtime_CompilerServices_ConditionalWeakTable_2_CreateValueCallback<System___Canon__System___Canon>__InvokeOpenStaticThunk | @ | dotnet.native.wasm:0x16c9ae
  | $S_P_CoreLib_System_Runtime_CompilerServices_ConditionalWeakTable_2<System___Canon__System___Canon>__GetValueLocked | @ | dotnet.native.wasm:0x16f5f8
  | $S_P_CoreLib_System_Runtime_CompilerServices_ConditionalWeakTable_2<System___Canon__System___Canon>__GetValue | @ | dotnet.native.wasm:0x4e9f02
  | $S_P_CoreLib_System_Runtime_InteropServices_PInvokeMarshal__GetFunctionPointerForDelegate | @ | dotnet.native.wasm:0x59d17a
  | $S_P_CoreLib_System_Runtime_InteropServices_Marshal__GetFunctionPointerForDelegate | @ | dotnet.native.wasm:0xa138c
  | $S_P_CoreLib_System_Runtime_InteropServices_Marshal__GetFunctionPointerForDelegate_0<System___Canon> | @ | dotnet.native.wasm:0x4c3e9d
  | $HarfBuzzSharp_HarfBuzzSharp_HarfBuzzApi__hb_face_create_for_tables | @ | dotnet.native.wasm:0x1e8179
  | $HarfBuzzSharp_HarfBuzzSharp_Face___ctor_2 | @ | dotnet.native.wasm:0x49520c
  | $Avalonia_Skia_Avalonia_Skia_GlyphTypefaceImpl___ctor | @ | dotnet.native.wasm:0x286869
  | $Avalonia_Skia_Avalonia_Skia_FontManagerImpl__TryCreateGlyphTypeface | @ | dotnet.native.wasm:0x490633
  | $Avalonia_Base_Avalonia_Media_Fonts_SystemFontCollection__TryGetGlyphTypeface | @ | dotnet.native.wasm:0x2804f4
  | $Avalonia_Base_Avalonia_Media_FontManager__TryGetGlyphTypeface | @ | dotnet.native.wasm:0x54369e
  | $Avalonia_Base_Avalonia_Media_Typeface__get_GlyphTypeface | @ | dotnet.native.wasm:0x115cbe

Removing text rendering make app render just fine without this error (at least, a simple rectangle and software render for now).

@maxkatz6
Copy link
Contributor

And to keep experiments with LLVM and SkiaSharp in one place, if I enable WebGL rendering it will throw a different exception:

RuntimeError: memory access out of bounds
    at dotnet.native.wasm.GrMemoryPool::allocate(:51968/unsigned long) (http://localhost:51968/dotnet.native.wasm)
    at dotnet.native.wasm.SkSL::Pool::AllocIRNode(:51968/unsigned long) (http://localhost:51968/dotnet.native.wasm)
    at dotnet.native.wasm.SkSL::Context::Context(:51968/) (http://localhost:51968/dotnet.native.wasm)
    at dotnet.native.wasm.SkSL::Compiler::Compiler(:51968/GrShaderCaps const*, SkSL::Compiler::Flags) (http://localhost:51968/dotnet.native.wasm)
    at dotnet.native.wasm.GrGLContext::compiler(:51968/) const (http://localhost:51968/dotnet.native.wasm)
    at dotnet.native.wasm.GrSkSLtoGLSL(:51968/GrGLContext const&, SkSL::Program::Kind, SkSL::String const&, SkSL::Program::Settings const&, SkSL::String*, GrContextOptions::ShaderErrorHandler*) (http://localhost:51968/dotnet.native.wasm)
    at dotnet.native.wasm.GrGLProgramBuilder::finalize(:51968/GrGLPrecompiledProgram const*) (http://localhost:51968/dotnet.native.wasm)
    at dotnet.native.wasm.GrGLProgramBuilder::CreateProgram(:51968/GrGLGpu*, GrRenderTarget*, GrProgramDesc const&, GrProgramInfo const&, GrGLPrecompiledProgram const*) (http://localhost:51968/dotnet.native.wasm)
    at dotnet.native.wasm.GrGLGpu::ProgramCache::findOrCreateProgram(:51968/GrRenderTarget*, GrProgramDesc const&, GrProgramInfo const&, GrGpu::Stats::ProgramCacheResult*) (http://localhost:51968/dotnet.native.wasm)
    at dotnet.native.wasm.GrGLGpu::ProgramCache::findOrCreateProgram(:51968/GrRenderTarget*, GrProgramInfo const&) (http://localhost:51968/dotnet.native.wasm)

Not sure what triggers it yet, I want to focus on software rendering for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants