Platform/GFX/WebGL2

Design

  • All WebGL functions must be implemented in WebGLContext
  • WebGL function member definitions of WebGLContext should be group by feature as OpenGL ES 3.0 quick reference card do into differents .cpp files

Preliminary

  • [DONE] Add WebGL1Context inheriting from WebGLContext
  • [DONE] Add WebGL2Context C++ class inheriting WebGLContext
    • Enable with about:config flag (webgl.enable-ensecure-webgl2)
    • Add virtual func WebGLContext::IsWebGL2
    • Add WebGL2 IDL inheriting WebGL 1 IDL
    • Edit HTMLCanvasElement::GetContextHelper to allow experimental-webgl2
    • gl.getParameter(gl.VERSION) return "WebGL 2"
  • [CARRY OVER] Edit GLContext to allow getting a GL3 context; let WebGL 2 use it
    • On mac, all OpenGL contexts are shared to each others, therefor they all have to be the same version.
    • Current GFX shader not compatible with OpenGL 3.2 core profile
    • Would need to convert shader with ANGLE to the GLSL version we use.
  • [DONE] Bypass ANGLE shader compilation
    • Bypass only when the shader code contains #version experimental-webgl2
    • Add automatic provide GL_EXT_gpu_shader4
    • Add in/out qualifiers in vertex shaders
    • Add in qualifiers in fragment shaders

High Priority Features

  • [DONE] Add existing WebGL 1 extensions as WebGL 2 features
    • WEBGL_draw_buffers
    • OES_vertex-array_object
  • [DEFERRED] ECT2 texture (need OpenGL 4.3 on mac)
  • [DEFERRED] EAC textures (need OpenGL 4.3 on mac)
  • [ON TRACK] sRGB textures (GL_EXT_texture_sRGB)
  • [ON TRACK] Multisample renderbuffers (GL_EXT_framebuffer_multisample)
  • [DEFERRED] Primitive restart with fixed index (need OpenGL 3.2 on mac)
  • [DONE] Min/max blend equations (GL_EXT_blend_minmax)
  • [DONE] Query objects
    • GL_ARB_occlusion_query
    • GL_EXT_occlusion_query_boolean
  • [ON TRACK] Transform feedback (GL_EXT_transform_feedback)
  • [DONE] Instanced Rendering (GL_ARB_draw_instanced)
  • [WISHLIST] gl.vertexAttribDivisor (GL_ARB_instanced_array)
  • [WISHLIST] gl.drawRangeElements (GL_EXT_draw_range_elements)

Low Priority Features

  • [DEFERRED] Uniform buffer objects (need OpenGL 3.2 on mac)
  • [DEFERRED] Sampler objects (need OpenGL 4.3 on mac)
  • [ON TRACK] 3D textures
  • [ON TRACK] Shadow comparisons
  • [ON TRACK] Non-square and transposable uniform matrices
  • [ON TRACK] R and RG textures (GL_ARB_texture_rg)
  • [DEFERRED] Texture swizzles (need OpenGL 4.3 on mac)
  • [ON TRACK] Unrestricted NPOT textures (GL_ARB_texture_non_power_of_two)
  • [ON TRACK] Mipmap level/LOD tricks
  • [ON TRACK] New renderbuffer/texture formats
  • [ON TRACK] Half-float vertex attributes (GL_ARB_half_float_vertex)
  • [ON TRACK] Stretch blits
  • [ON TRACK] Framebuffer invalidation hints
  • [ON TRACK] Attach any mipmap level to a framebuffer
  • [ON TRACK] Additional pixel store data
  • [ON TRACK] Buffer to buffer copies
  • [ON TRACK] Texture storage

Refactoring

  • [ON TRACK] Move functions definition from WebGLContextGL.cpp to distinct cpp files grouped as same as quick reference card do

Implementation Bugs (Meta WebGL2 889977)

Full Query
ID Priority Summary Status Assigned to
890049 -- WebGL2 Add WebGL1Context inheriting from WebGLContext RESOLVED Guillaume Abadie
890311 -- WebGL2 Add WebGL2Context inheriting from WebGLContext RESOLVED Guillaume Abadie
890379 -- WebGL2 Add existing WebGL 1 extensions as WebGL 2 features RESOLVED Guillaume Abadie
890926 -- WebGL2 Min/max blend equations RESOLVED Guillaume Abadie
891033 -- WebGL2 Edit GLContext to allow getting a GL3 context; let WebGL 2 use it RESOLVED
891539 -- WebGL2 sRGB textures RESOLVED Guillaume Abadie
892169 -- WebGL2 Bypass ANGLE shader compilation RESOLVED Guillaume Abadie
892546 -- WebGL2 Instanced Rendering RESOLVED Guillaume Abadie
892978 -- WebGL2 Query objects (GL_ARB_occlusion_query) RESOLVED Guillaume Abadie
893180 -- WebGL2 gl.vertexAttribDivisor (GL_ARB_instanced_array) RESOLVED Guillaume Abadie
894482 -- [meta] WebGL2 prototype feed RESOLVED Guillaume Abadie
894492 -- [meta] WebGL2 prototype bugs support RESOLVED Guillaume Abadie
894740 -- WebGL conformance test update to 1.0.2 RESOLVED
896254 -- WebGL2RenderingContext WebIDL interface should be disabled on release channels RESOLVED Guillaume Abadie
898475 -- WebGL2 draw_range_elements RESOLVED Guillaume Abadie
898615 -- let WebGL use extension group queries RESOLVED Guillaume Abadie
900199 -- Parse OpenGL registry xml to generates constants RESOLVED Guillaume Abadie
902488 -- WebGL2 Occlusion queries optimization on desktop RESOLVED Guillaume Abadie
903455 -- WebGL2 transform feedback - RASTERIZER_DISCARD RESOLVED Guillaume Abadie
903480 -- WebGL2 transform feedback - Queries RESOLVED Guillaume Abadie
903481 -- WebGL2 transform feedback - Buffers RESOLVED Guillaume Abadie
903594 -- WebGL2 transform feedback objects RESOLVED Guillaume Abadie
905282 -- Add OpenGL constant prefixed by MOZ_GL_, next to the LOCAL_GL_ for incremental transition. RESOLVED Guillaume Abadie
908232 -- WebGL2 RASTERIZER_DISCARD tracking RESOLVED Guillaume Abadie
908316 -- WebGL2 factor query object's targets RESOLVED Guillaume Abadie
908662 -- WebGL2 Refactor WebIDL RESOLVED Guillaume Abadie
908841 -- WebGL2 Add more natively supported extensions RESOLVED Guillaume Abadie
908985 -- WebGL2 bug on indexed binding RESOLVED Guillaume Abadie
917505 -- Add ETC2 compressed texture format for WebGL RESOLVED Morris Tseng [:mtseng] [:Morris] (Inactive)
1002279 -- WebGL2 - Cleanup - Remove execute bit from CanvasRenderingContext2D.cpp RESOLVED u480271
1002281 -- WebGL2 - Refactor common functions into WebGLBindableName. RESOLVED u480271
1002302 -- WebGL2 - Stub WebGL 2.0 WebIDL and functions in WebGL2Context RESOLVED u480271
1048666 -- WebGL2 - Implement clearbuffer RESOLVED u480271
1048719 -- WebGL2 - Implement WebGLQuery RESOLVED u480271
1048720 -- WebGL2 - Implement WebGLSampler RESOLVED u480271
1048721 -- WebGL2 - Implement WebGLSync RESOLVED u480271
1048724 -- WebGL2 - Implement WebGLTransformFeedback RESOLVED u480271
1048731 -- WebGL2 - Implement Buffer Objects RESOLVED u480271
1048732 -- WebGL2 - Implement Framebuffer Objects RESOLVED u480271
1048733 -- WebGL2 - Implement Renderbuffer Objects RESOLVED u480271
1048741 -- WebGL2 - Implement Texture Objects RESOLVED
1048743 -- WebGL2 - Implement Programs and Shaders RESOLVED u480271
1048745 -- WebGL2 - Implement Uniforms and Attributes RESOLVED u480271
1048747 -- WebGL2 - Implement Uniform Buffer Objects RESOLVED u480271
1050599 -- Clean up GL Extension list RESOLVED u480271
1067436 -- WebGL2 - context creation causes assertion failure on VERTEX_ARRAY_BINDING cached state RESOLVED
1067524 -- Update WebGL2 IDL for recently removed constants RESOLVED
1067538 -- WebGL2: rename getQueryObject to getQueryParameter to adapt to spec change RESOLVED
1067542 -- WebGL2: crash in CompileShader on conformance2/core/frag-depth.html test RESOLVED
1097411 -- Extend error reporting for GL enums. RESOLVED u480271
1097413 -- Replace hard-coded version numbers in GLFeature RESOLVED u480271
1097416 -- WebGL2 - Feature checks RESOLVED u480271
1145501 -- WebGL2 - Extend BufferData usage flags. RESOLVED u480271
1170452 -- WebGL 2 - Constants incorrectly exposed via DOM RESOLVED u480271
1170454 -- WebGL 2 - Vertex Array Objects are not exposed properly via DOM RESOLVED u480271
1170455 -- WebGL 2 - getVertexAttrib(..., gl.CURRENT_VERTEX_ATTRIB) doesn't have integer types. RESOLVED u480271
1170462 -- WebGL 2 - Finish implementing 3D Textures RESOLVED Kyle Fung
1170842 -- WebGL 2 - Finish implementing framebuffers RESOLVED u480271
1170845 -- WebGL 2 - Implement vertex divisor restrictions RESOLVED u480271
1170849 -- WebGL 2 - Rendering to MRT failures RESOLVED
1170853 -- WebGL 2 - gl.SHADING_LANGUAGE_VERSION is wrong RESOLVED u480271
1170855 -- WebGL 2 - Expose new state via gl.getParameter RESOLVED u480271
1170872 -- WebGL 2 - Desktop Enums are accepted RESOLVED
1170873 -- WebGL 2 - copyTexImage2D fails with npot textures. RESOLVED
1170883 -- WebGL 2 - Texture format support is lacking for 2D and 3D textures. RESOLVED u480271
1170885 -- WebGL 2 - Drawing fails in tex-mipmap-levels test (npot?) RESOLVED
1170890 -- WebGL 2 - Textures accept valid GL but invalid WebGL constants RESOLVED
1170891 -- WebGL 2 - gl.getTexParameter fails on valid enums. RESOLVED
1170893 -- WebGL 2 - gl.getFramebufferAttachmentParameter causes MOZ_ASSERT to fire RESOLVED Edwin Flores [inactive from 2016-12-01] [:eflores] [:edwin]
1179556 -- WebGL 2 - MOZ_ASSERT failure in WebGLFramebuffer::EnsureColorAttachPoints RESOLVED u480271
1184402 -- WebGL 2 - renderbufferStorageMultisample fails for new sized internal formats. RESOLVED u480271
1184786 -- WebGL 2 - ReadBuffer returns incorrect errors RESOLVED u480271
1205168 -- WebGL 2 - Make loading textures from canvas elements work for all new texture formats. RESOLVED Ethan Lin[:ethlin]
1207206 P3 tracking: webgl2 on angle RESOLVED
1215279 -- Pass WebGL2 UBO conformance tests RESOLVED
1218938 -- Pass WEBGL2 transform feedback tests RESOLVED
1219890 -- Support WebGL2 on top of ES3 RESOLVED Jeff Muizelaar [:jrmuizel]
1220828 -- Pass WEBLG2 renderbuffers tests RESOLVED
1228488 -- Pass WEBLG2 gl-enum-test test RESOLVED Morris Tseng [:mtseng] [:Morris] (Inactive)
1228949 -- Pass WebGL2 buffer-copying-restrictions and buffer-type-restrictions RESOLVED Ethan Lin[:ethlin]
1229152 -- BuildES3FormatSet does not expose GL_RBGA, GL_RGBA, GL_FLOAT as required by GL_OES_texture_float RESOLVED Jeff Muizelaar [:jrmuizel]
1229210 -- Handle the new formats required by WebGL2 in ReadPixels RESOLVED Jeff Muizelaar [:jrmuizel]
1230089 -- Pass WEBLG2 sampler-drawing-test test RESOLVED Morris Tseng [:mtseng] [:Morris] (Inactive)
1231657 -- Don't allow linking different versions shaders RESOLVED Jeff Muizelaar [:jrmuizel]
1231832 -- Deleting queries can crash if they haven't been used. RESOLVED Jeff Muizelaar [:jrmuizel]
1232502 -- CopyTexImage2D of RGBA8 to Luminance8 fails on OpenGL core RESOLVED Jeff Muizelaar [:jrmuizel]
1232668 -- Allow using kTex2DBlit_FragShaderSource on non-ES targets RESOLVED Jeff Muizelaar [:jrmuizel]
1233353 -- Pass WebGL2 conformance test multisampled-renderbuffer-initialization RESOLVED Ethan Lin[:ethlin]
1235299 -- Pass WebGL2 conformance test copy-tex-image-2d-formats RESOLVED Ethan Lin[:ethlin]
1236080 -- Null check format in GetParameter RESOLVED Jeff Muizelaar [:jrmuizel]
1236091 -- Null check in BlitFramebuffer RESOLVED Jeff Muizelaar [:jrmuizel]
1236394 -- [meta] WebGL conformance test error in gl-object-get-calls.html RESOLVED Jerry Shih[:jerry] (UTC+8) (inactive)
1237676 P3 WebGL2 GLSL ES 3.00 textureLod() instructions are misinterpreted to depend on implicit partial derivatives NEW
1238865 -- Pass WebGL2 conformance test read-pixels-from-fbo-test RESOLVED Morris Tseng [:mtseng] [:Morris] (Inactive)
1239144 -- Check that the level passed in is in the required range. RESOLVED
1239259 -- Pass WebGL2 conformance test tex-mipmap-levels RESOLVED Ethan Lin[:ethlin]
1239541 -- Pass WebGL2 conformance test tex-input-validation RESOLVED Ethan Lin[:ethlin]
1240438 -- Pass WebGL2 conformance test framebuffer-object-attachment RESOLVED Ethan Lin[:ethlin]
1240662 -- Pass WebGL2 conformance test framebuffer-texture-layer RESOLVED Morris Tseng [:mtseng] [:Morris] (Inactive)
1240673 -- Pass WebGL2 conformance test framebuffer-test RESOLVED Ethan Lin[:ethlin]
1241040 P3 Enable ES3 compressed texture formats RESOLVED
1242336 -- Pass WebGL2 conformance test gl-get-calls RESOLVED Ethan Lin[:ethlin]
1242347 -- Pass WebGL2 conformance test texture-npot RESOLVED Morris Tseng [:mtseng] [:Morris] (Inactive)
1243287 -- WebGL2 should generate INCOMPLETE_DIMENSIONS, too. RESOLVED Morris Tseng [:mtseng] [:Morris] (Inactive)
1243663 -- Maximum Uniform and Attribute Location Lengths in WebGL2 should be 1024. RESOLVED Morris Tseng [:mtseng] [:Morris] (Inactive)
1249189 -- Fix YCbCr convert problem when using TexImage2D RESOLVED Ethan Lin[:ethlin]
1250710 -- Implement ReadPixels for PBOs (PIXEL_PACK_BUFFER) RESOLVED Kelsey Gilbert [:jgilbert]
1266617 -- [META] WebGL 2 Feature-Complete RESOLVED
1267147 -- WebGL2 conformance test fail: conformance/misc/uninitialized-test.html RESOLVED Ethan Lin[:ethlin]
1267149 -- WebGL2 conformance test fail: conformance2/textures/misc/tex-input-validation.html RESOLVED
1279766 P3 WebGL2 reporting incorrect uniforms RESOLVED Kelsey Gilbert [:jgilbert]
1281250 P3 [meta] WebGL 2 blockers RESOLVED Kelsey Gilbert [:jgilbert]
1285086 -- Turn on WebGLSampler RESOLVED Ethan Lin[:ethlin]
1285100 -- Pass WebGL2 conformance buffer-data-and-buffer-sub-data.html RESOLVED Ethan Lin[:ethlin]
1285117 -- Pass WebGL2 conformance conformance/extensions/webgl-compressed-texture-atc.html RESOLVED Kelsey Gilbert [:jgilbert]
1296345 P3 WebGL2 failure on a new driver, with "Error during native OpenGL init" on Windows RESOLVED
1307657 P3 Enable all tests under webgl-conf/checkout/conformance(2)/textures RESOLVED
1313584 -- Hit MOZ_CRASH(GFX: Unhandled pname) at /Volumes/firefoxos/gecko-dev/dom/canvas/WebGLSampler.cpp:112 RESOLVED Vincent Liu[:vliu]
1314505 -- signal 11 was received by running dom/canvas/test/webgl-conf/checkout/deqp/functional/gles3/indexedstatequery.html RESOLVED Vincent Liu[:vliu]
1315979 -- Crash at [@ memcpy | rx::Buffer11::BufferStorage::setData ] RESOLVED Kelsey Gilbert [:jgilbert]
1320029 -- Upgrade WebGL conformance tests to 2.0.1 RESOLVED Vincent Liu[:vliu]
1323626 -- [WebGL2 conformance test] Pass conformance2/textures/misc/tex-mipmap-levels.html RESOLVED Kelsey Gilbert [:jgilbert]

122 Total; 1 Open (0.82%); 121 Resolved (99.18%); 0 Verified (0%);


WebGL for contributors

Updates feed

Anyone one who wants to tests and play with our WebGL 2 prototype, just get follow this bug to get all landed updates.

  • 894482 Contributor & pre-alpha testers feed about WebGL 2 prototype updates

Feel free to report any WebGL 2 prototype's bugs by blocking 894492.

WebGL 2 Bugs reported

Full Query
ID Priority Summary Status Assigned to
898386 -- WebGL2 bug report -Firefox crashes in mozilla::WebGLContext::GenerateWarning with "MOZ_WEBGL_FORCE_OPENGL=1" RESOLVED
900439 -- WebGL2 unable to initialize OpenGL on Linux/Nvidia GT 330M RESOLVED Guillaume Abadie
1053440 -- WebGL2 bug report - not context available under Mesa (ES3) RESOLVED

3 Total; 0 Open (0%); 3 Resolved (100%); 0 Verified (0%);