Conversation
Using git revision for grovesNL/glow@666a752 Compatibility fix and pinning for glutin 0.22.0-alpha5, until >0.4.0
This reverts commit c11aa7a.
perl -pe's/gl::([A-Z][a-z])/glow_context().$1/g'
cat src/gl/mod.rs|perl -pe'sub decamelize {
my ($s) = @_;
$s =~ s{(\w+)}{
($a = $1) =~ s<(^[A-Z]|(?![a-z])[A-Z])><
"_" . lc $1
>eg;
substr $a, 1;
}eg;
$s;
}
; s/glow_context\(\)\.(\w+)/"glow_context().".decamelize($1)/ge'>/tmp/a
https://gist.github.com/tyru/358703
|
Down to 36 compile errors, 31 are methods not found in glow::native::Context, will have to find glow equivalents, others are related to parameters. Current list: reference: https://docs.rs/glow/0.4.0/glow/struct.Context.html -> https://docs.rs/glow/0.4.0/glow/trait.HasContext.html and https://github.com/grovesNL/glow/blob/master/src/native.rs |
|
Found most glow method equivalents, except for these four: The underlying OpenGL method names would correspond to
in glow, they would be In addition to missing methods, there are 8 parameter count mismatches and 7 parameter type mismatches, 15 other errors total, will have to adapt to glow's typing. There is an slight impedance mismatch: glow has its own OpenGL wrapper objects, but so does our src/gl/mod.rs (not actually steven_gl, in gl/src, as that is merely a generated gl_generator/khronos_api, which glow does itself): Texture, Program, Shader, Uniform, Attribute, VertexArray, Buffer, Framebuffer. |
…n a loop and it has no WebGL equivalent (19)
|
glMapBuffer - looks like we can use glMapBufferRange with offset 0 and length len, through map_buffer_range. But it intentionally isn't supported by WebGL, see: https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.14
What do we use it for? Not easy to grep (Buffer glMultiDrawElements - https://stackoverflow.com/questions/20035395/webgl-why-no-gl-multidrawelements says:
so could replace with a loop. Maybe have a multi_draw_elements wrapper where on native it uses glMultiDrawElements for speed, and on web it iterates? But, it appears nothing actually calls this method, so it can be removed. glReadBuffer - this one actually does appear in the WebGL 2.0 spec: https://www.khronos.org/registry/webgl/specs/latest/2.0/: /* Framebuffer objects */
...
void readBuffer(GLenum src);
but curiously lacks a wrapper in glow. Add it? glTexImage2DMultisample - apparently multisample renderbuffers are a WebGL2 feature? mrdoob/three.js#8120, but there is this comment, with no follow up:
image_2d_sample is used in src/render/mod.rs for: fb_color.image_2d_sample(gl::TEXTURE_2D_MULTISAMPLE, NUM_SAMPLES, width, height, gl::RGBA8, false);
fb_depth.image_2d_sample(gl::TEXTURE_2D_MULTISAMPLE, NUM_SAMPLES, width, height, gl::DEPTH_COMPONENT24, false);would using glTexImage2D (non-multisample) conditionally on WebGL work acceptably? |
|
https://stackoverflow.com/questions/47934444/webgl-framebuffer-multisampling
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glRenderbufferStorageMultisample.xhtml
vs https://www.khronos.org/opengl/wiki/GLAPI/glTexImage2DMultisample
glow does define glow::TEXTURE_2D_MULTISAMPLE, equivalent to gl::TEXTURE_2D_MULTISAMPLE (GL_TEXTURE_2D_MULTISAMPLE), but doesn't use it. A hint from https://bugs.chromium.org/p/chromium/issues/detail?id=361931:
change from glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE) to glRenderbufferStorageMultisample(GL_RENDERBUFFER), in native, too? I had previously changed this code in ed5d48f, which links to the mysteriously-deleted issue https://github.com/iceiix/steven/issues/5#issuecomment-427669426, recovered partially at #5 (comment) - superseded by #25, one of the first bugs I fixed in this project, may as well change it again… |
|
PR'd glReadBuffer to glow in grovesNL/glow#72, accessible on both platforms, but looking closer, we don't actually use it anywhere. Originally added in e9631f0#diff-dd4fbaefaaa8ed7c96f70be3c784eba7R754 |
|
Current status: now gets far enough to draw the blue sky: but crashes soon after To unblock porting to glow while not changing non-web compatible code yet (incremental progress), branched to iceiix/glow#1 for adding wrappers around native-only (OpenGL) functions
|
|
Now that rendering seems to basically work, back to debugging the stack overflow. While carefully stepping through in the debugger, failed to trigger the crash: apparently because authentication timed out (since I was pausing the program while debugging), failing to login and show the server list. This further suggests the problem is in the server list. Removing auth_token in conf.cfg to force showing the login screen, no crash, confirmed. Working hypothesis was the crash was due to incomplete porting to glow but now that most functions are bridged this seems unlikely. Looking at the backtrace again, reload_server_list frame: Repro: set a breakpoint at So what exactly is __rust_probestack?
https://github.com/rust-lang/compiler-builtins This crash only seems to occur in debug builds. In release builds, I can join and connect to a server. But it does indicate a memory corruption issue...somewhere |
Regression introduced in #262 by the glow port, correct the raw size to account for the matrix. See #141 (comment)
Regression introduced in #262 by the glow port, correct the raw size to include all elements in set_float_multi(). See #141 (comment)



Replace the use of raw OpenGL with the https://github.com/grovesNL/glow wrapper
#34 Investigate rendering backends, such as gfx-rs or wgpu-rs or glow
#171 wasm broken: failed to resolve: could not find
Contextinplatform_impl