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

Panic while using surfman to render in offscreen ? #270

Closed
Brooooooklyn opened this issue Feb 23, 2020 · 5 comments
Closed

Panic while using surfman to render in offscreen ? #270

Brooooooklyn opened this issue Feb 23, 2020 · 5 comments

Comments

@Brooooooklyn
Copy link

If I want rendering canvas in Server, which don't have screen.
Could I use pathfinder with rust-offscreen-rendering-context?

@Brooooooklyn Brooooooklyn changed the title Could use with rust-offscreen-rendering-context ? Could pathfinder use with rust-offscreen-rendering-context ? Feb 23, 2020
@Brooooooklyn
Copy link
Author

Run with rust-offscreen-rendering-context failed:

  let window_size = Vector2I::new(640, 480);
  GLContext::<NativeGLContext>::new_shared_with_dispatcher(
    Size2D::new(window_size.x(), window_size.y()),
    GLContextAttributes::default(),
    ColorAttachmentType::default(),
    sparkle::gl::GlType::Gl,
    OffScreenGlVersion::MajorMinor(4, 1),
    None,
    None,
  )
  .unwrap();

  gl::load_with(|name| GLContext::<NativeGLContext>::get_proc_address(name) as *const _);

  let shaders_dir = PathBuf::from(env::current_dir().unwrap());
  // Create a Pathfinder renderer.
  let mut renderer = Renderer::new(
    GLDevice::new(GLVersion::GL3, 0),
    &FilesystemResourceLoader {
      directory: shaders_dir,
    },
    DestFramebuffer::full_window(window_size),
    RendererOptions {
      background_color: Some(ColorF::white()),
    },
  );
thread 'main' panicked at 'Vertex shader 'fill' compilation failed', /Users/longyinan/.cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/67d12ad/gl/src/lib.rs:360:9
stack backtrace:
   0: std::sys_common::at_exit_imp::push
   1: core::fmt::ArgumentV1::show_usize
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
   6: std::panicking::try::do_call
   7: std::panicking::begin_panic_fmt
             at src/libstd/panicking.rs:326
   8: <pathfinder_gl::GLDevice as pathfinder_gpu::Device>::create_shader_from_source
             at /Users/longyinan/.cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/67d12ad/gl/src/lib.rs:360
   9: <pathfinder_gl::GLDevice as pathfinder_gpu::Device>::create_shader
             at /Users/longyinan/.cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/67d12ad/gl/src/lib.rs:818
  10: pathfinder_gpu::Device::create_program_from_shader_names
             at /Users/longyinan/.cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/67d12ad/gpu/src/lib.rs:111
  11: pathfinder_gpu::Device::create_program
             at /Users/longyinan/.cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/67d12ad/gpu/src/lib.rs:118
  12: pathfinder_renderer::gpu::shaders::FillProgram<D>::new
             at /Users/longyinan/.cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/67d12ad/renderer/src/gpu/shaders.rs:299
  13: pathfinder_renderer::gpu::renderer::Renderer<D>::new
             at /Users/longyinan/.cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/67d12ad/renderer/src/gpu/renderer.rs:130
  14: canvas_bench::main
             at src/main.rs:53
  15: std::rt::lang_start::{{closure}}
             at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/rt.rs:67
  16: std::panicking::try::do_call
  17: panic_unwind::dwarf::eh::read_encoded_pointer
  18: std::panicking::rust_panic_without_hook
  19: std::rt::lang_start
             at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/rt.rs:67
  20: canvas_bench::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@pcwalton
Copy link
Contributor

r-o-r-c is going to be replaced with http://github.com/pcwalton/surfman, and I want to replace SDL with that eventually.

@Brooooooklyn
Copy link
Author

Switch to surfman I got the same error.
Minimal repo to reproduce: https://github.com/Brooooooklyn/pathfinder-offscreen

thread 'main' panicked at 'GL error: 0x506 (INVALID_FRAMEBUFFER_OPERATION)', .cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/5421525/gl/src/lib.rs:1349:7
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:84
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1025
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:193
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:210
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:471
  11: rust_begin_unwind
             at src/libstd/panicking.rs:375
  12: std::thread::local::fast::Key<T>::try_initialize
  13: pathfinder_gl::ck
             at /Users/longyinan/.cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/5421525/gl/src/lib.rs:1349
  14: pathfinder_gl::GLDevice::clear
             at /Users/longyinan/.cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/5421525/gl/src/lib.rs:944
  15: pathfinder_gl::GLDevice::set_render_state
             at /Users/longyinan/.cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/5421525/gl/src/lib.rs:82
  16: <pathfinder_gl::GLDevice as pathfinder_gpu::Device>::draw_elements
             at /Users/longyinan/.cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/5421525/gl/src/lib.rs:698
  17: pathfinder_renderer::gpu::renderer::Renderer<D>::draw_solid_tiles
             at /Users/longyinan/.cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/5421525/renderer/src/gpu/renderer.rs:839
  18: pathfinder_renderer::gpu::renderer::Renderer<D>::render_command
             at /Users/longyinan/.cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/5421525/renderer/src/gpu/renderer.rs:355
  19: pathfinder_renderer::concurrent::scene_proxy::SceneProxy::build_and_render
             at /Users/longyinan/.cargo/git/checkouts/pathfinder-f0bd20e7aa700f92/5421525/renderer/src/concurrent/scene_proxy.rs:90
  20: canvas_bench::main
             at src/main.rs:111
  21: std::rt::lang_start::{{closure}}
             at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/rt.rs:67
  22: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  23: std::panicking::try::do_call
             at src/libstd/panicking.rs:292
  24: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:78
  25: std::panicking::try
             at src/libstd/panicking.rs:270
  26: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  27: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  28: std::rt::lang_start
             at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/rt.rs:67
  29: canvas_bench::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@Brooooooklyn Brooooooklyn changed the title Could pathfinder use with rust-offscreen-rendering-context ? Could pathfinder use with surfman ? Mar 5, 2020
@Brooooooklyn Brooooooklyn changed the title Could pathfinder use with surfman ? Panic while using surfman to render in offscreen ? Mar 12, 2020
@Brooooooklyn
Copy link
Author

@pcwalton could you please help me with this issue? I'm doing a NodeJS bindings for pathfinder, and I need an example to render canvas offscreen.

@Brooooooklyn
Copy link
Author

Close because it seems to be a bug in servo/surfman#163

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

No branches or pull requests

2 participants