You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running ./mach run -d tests/html/test_webgl_triangle.html displays a colored triangle.
If you run again with the -w flag: ./mach run -d -w tests/html/test_webgl_triangle.html, nothing is rendered and the following errors are printed to the console:
ERROR:script::dom::webglrenderingcontext: Couldn't create WebGLRenderingContext: CGLCreateContext
ERROR:script::dom::webglrenderingcontext: Couldn't create WebGLRenderingContext: CGLCreateContext
ERROR:js::rust: Error at .../servo/tests/html/test_webgl_triangle.html:17:7: gl is null
@emilio After doing some more digging I found that when creating a context from a shared context, they should both share the same attributes. (CGLCreateContext discussion section). I tried this and there is now a new crash, seems to be related to shader compilation; however, I used apitrace and found that the new contexts that are created from the shared context no longer return the invalid share context error.
The crash occurs when compiling shaders. The non-webrender version uses Legacy OpenGL and webrender uses OpenGL 3.2. Are there any differences in shaders between the two?
@emilio I setup GetProgramInfoLog and GetShaderInfoLog. After using the pixel_format from the main context it creates the new context that uses OpenGL 3.2. The shaders no longer compile because they don't have a #version. When manually setting the new context to legacy OpenGL( < 3.2) it crashes because it can't share the context created by webrender which is OpenGL 3.2. I am not too familiar with angle, but is that supposed to translate the WebGL shader into a shader that OpenGL 3.2 can compile?
I have tried setting the shader output in webglshader.rs to Output::Glsl150Core for Mac; however, when the shader is compiled it does not know what webgl_FragColor is. I assume the translator was supposed to add a out vec4 webgl_FragColor; but for some reason, did not.
Oh, if that's the problem, that's a really easy problem to solve! :)
I forgot WR changed the requirements from OpenGL 3.0 to OpenGL 3.2. Let's just tweak the values of the shader compiler output, to something tha tworks in OpenGL 3.2 core.
During shader compilation, OpenGL errors with Use of undeclared identifier 'webgl_FragColor'. From looking at other examples of translated shaders for angle, it looks like it is missing out vec4 webgl_FragColor;.
@emilio Almost to the bottom of this. It looks like SH_VARIABLES option is required to print out out vec4 webgl_FragColor;. Now it looks like both shaders compile successfully, but there is now another crash. Here is the relevant apitrace dump:
Activity
cbrewster commentedon Apr 2, 2016
This issue only applies to
cglon Mac.cbrewster commentedon Apr 3, 2016
@emilio After doing some more digging I found that when creating a context from a shared context, they should both share the same attributes. (CGLCreateContext discussion section). I tried this and there is now a new crash, seems to be related to shader compilation; however, I used
apitraceand found that the new contexts that are created from the shared context no longer return theinvalid share contexterror.cbrewster commentedon Apr 3, 2016
The crash occurs when compiling shaders. The non-webrender version uses Legacy OpenGL and webrender uses OpenGL 3.2. Are there any differences in shaders between the two?
cbrewster commentedon Apr 3, 2016
@emilio I setup
GetProgramInfoLogandGetShaderInfoLog. After using thepixel_formatfrom the main context it creates the new context that uses OpenGL 3.2. The shaders no longer compile because they don't have a#version. When manually setting the new context to legacy OpenGL( < 3.2) it crashes because it can't share the context created by webrender which is OpenGL 3.2. I am not too familiar with angle, but is that supposed to translate the WebGL shader into a shader that OpenGL 3.2 can compile?I have tried setting the shader output in
webglshader.rstoOutput::Glsl150Corefor Mac; however, when the shader is compiled it does not know whatwebgl_FragColoris. I assume the translator was supposed to add aout vec4 webgl_FragColor;but for some reason, did not.emilio commentedon Apr 3, 2016
Oh, if that's the problem, that's a really easy problem to solve! :)
I forgot WR changed the requirements from OpenGL 3.0 to OpenGL 3.2. Let's just tweak the values of the shader compiler output, to something tha tworks in OpenGL 3.2 core.
https://github.com/emilio/angle/blob/servo/src/hl.rs#L50
Probably the best for compat will be
Glsl130orGlsl150Core, let me know if any of those work for you.cbrewster commentedon Apr 3, 2016
@emilio When using Glsl130, it says version 130 is not supported. Glsl150Core is supported, but the shader gets translated incorrectly:
Original Shader:
Translated Shader:
During shader compilation, OpenGL errors with
Use of undeclared identifier 'webgl_FragColor'. From looking at other examples of translated shaders for angle, it looks like it is missingout vec4 webgl_FragColor;.cbrewster commentedon Apr 4, 2016
@emilio Almost to the bottom of this. It looks like
SH_VARIABLESoption is required to print outout vec4 webgl_FragColor;. Now it looks like both shaders compile successfully, but there is now another crash. Here is the relevantapitracedump:cbrewster commentedon May 12, 2016
Dupe of #11138. Closing this one as the new issue is clearer.