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

Texture: Performance issues with hardware sRGB decode. #26183

Closed
clementroche opened this issue Jun 2, 2023 · 44 comments · Fixed by #26521
Closed

Texture: Performance issues with hardware sRGB decode. #26183

clementroche opened this issue Jun 2, 2023 · 44 comments · Fixed by #26521

Comments

@clementroche
Copy link

clementroche commented Jun 2, 2023

Description

Since 0.152.0 VideoTexture takes a lot of GPU ressources, the larger the video the slower it gets.

Windows 11
NVIDIA GeForce RTX 3060 Ti

Maybe related to this commit https://github.com/mrdoob/three.js/pull/25752/commits
cc @donmccurdy

Reproduction steps

Open Chrome Devtools performance tab in v0.152.2 and you gonna notice GPU is busy

Code

See live examples

Live example

v0.152.2 https://codesandbox.io/s/three-0-152-2-videotexture-mj2y8m (bad performance)
v0.151.3 https://codesandbox.io/s/three-0-151-3-videotexture-1et5sq (good performance)

Screenshots

image

Version

">= 0.152.0"

Device

No response

Browser

Chrome

OS

Windows

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 2, 2023

Do you see similar performance issues on macOS or other OS as well? There was an issue with Chromium on Windows but it has been fixed for quite a while now: https://bugs.chromium.org/p/chromium/issues/detail?id=1256340

Can you also make a test with Firefox?

@donmccurdy
Copy link
Collaborator

On my laptop (MacBook Pro, Apple M1 Pro, Chromium-based browser) I don't see a difference, would be curious for the result in Firefox on Windows as well.

@clementroche
Copy link
Author

clementroche commented Jun 2, 2023

@Mugen87 @donmccurdy i'm not familiar with Firefox devTool, it's hard to tell but i would say it's not as obvious as Chrome

@clementroche
Copy link
Author

clementroche commented Jun 2, 2023

I see the difference using MacBook air M1 2020 but less compared to Windows

@toddka
Copy link

toddka commented Jun 2, 2023

I also see a massive performance drop on my M1 macbook air between these two versions on Chrome.

I wonder if this is related to sRGB -> Linear encoding. I recently ran into an issue with updating a CanvasTexture animation and can only get reasonable performance if I set the texture encoding to Linear. Here's a minimal example:
https://codesandbox.io/s/2d-canvas-texture-encoding-performance-iphunc?file=/src/App.js

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 2, 2023

@toddka I see no FPS difference no matter using sRGB or linear-srgb. I'm on Chrome 114.0.5735.90, macOS 13.4 and a M2 Pro. Can you please quantify the difference in performance so we can compare your FPS values?

@toddka
Copy link

toddka commented Jun 2, 2023

I'm on Chrome 114.0.5735.90, M1 2020 Macbook Air, MacOS Ventura 13.0.1.

Canvas width and height seem significant. If I decrease the canvas size FPS increases. I'm seeing the FPS drop from stable 60 FPS to 23-28 FPS when switching to texture.encoding = THREE.sRGBEncoding with a 1725x1280 canvas.

Let me know if I can provide anything more concrete in terms of performance numbers or repro. I'm also not sure if the issue in my sandbox is related to this, so happy to create another issue if requested! I've run into OP's video performance issue as well.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 3, 2023

I've made a more intense test case and now I can confirm performance issues with hardware sRGB decode in Chrome. The following fiddles update a 4096x4096 canvas texture per frame:

(A) CanvasTexture with THREE.LinearSRGBColorSpace: https://jsfiddle.net/8p7tk5y9/3/
(B) CanvasTexture with THREE.SRGBColorSpace: https://jsfiddle.net/8p7tk5y9/2/

(A) runs with 60 FPS, (B) with 7 FPS. The entire tab becomes quite slow with (B).

I don't see this kind of performance difference with Firefox. Both fiddles run with 23 FPS.

Safari slows down from 15 to 8 FPS.

@donmccurdy Can you reproduce on your MacBook?

@Mugen87 Mugen87 changed the title VideoTexture performance Texture: Performance issues with hardware sRGB decode. Jun 3, 2023
@arpu
Copy link

arpu commented Jun 3, 2023

Chrome/114.0.5735.90 Linux ANGLE (AMD, AMD Radeon RX 460 Graphics (polaris11 LLVM 16.0.4), OpenGL 4.6 (Core Profile) Mesa 23.0.3)

(A) 60 FPS
(B) 4 FPS

@arpu
Copy link

arpu commented Jun 3, 2023

DEV Chrome/115.0.5790.3 Linux ANGLE (AMD, Vulkan 1.3.238 (AMD Radeon RX 460 Graphics (RADV POLARIS11) (0x000067EF)), radv-23.0.3)], DRIVER_VENDOR=AMD, DRIVER_VERSION=23.0.3

(A) 60 FPS
(B) 60 FPS

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 3, 2023

Interesting. I've made a test with Chrome Canary (116.0.5809.0) and both fiddles run with 60 FPS!

@LeviPesin
Copy link
Contributor

So it seems that the issue was fixed in Chrome 115?

@dfeehrer
Copy link

dfeehrer commented Jun 3, 2023

I'm still seeing this issue across wide variety of hardware, browser and OS versions, including Chrome 116:

Tested both of @Mugen87's fiddles:

  • Chrome 116 and 115 – Mac OS Ventura, M1 Max, 16 inch

    • 60 FPS with Linear
    • 8-10 FPS with sRGB
  • Chrome 116 and 115 – Mac OS Catalina, Intel i9, AMD Radeon Pro 5500M 8GB

    • 60 FPS with Linear
    • 3 FPS with sRGB
  • Edge 112, Chrome 116 and 115 – Windows 10, Intel i5, Nvidia GTX 1650

    • 30-40 FPS with Linear
    • 2-3 FPS with sRGB

This issue is currently blocking us from shipping a new feature, let us know how we can help.

@dfeehrer
Copy link

dfeehrer commented Jun 3, 2023

For what it's worth:

Tested both of @Mugen87's fiddles again:

Firefox performs bad, but consistently bad, no difference between those fiddles:

Firefox 109, Mac OS Ventura, M1 Max, 16 inch:

  • Linear: 20 FPS
  • sRGB: 20 FPS

Firefox 109, Mac OS Catalina, Intel i9, AMD Radeon Pro 5500M 8GB

  • Linear: 4-5 FPS
  • sRGB: 4-5 FPS

Firefox 109, Windows 10, Intel i5, Nvidia GTX 1650:

  • Linear: 4-5 FPS
  • sRGB: 4-5 FPS

Safari 16.3, Ventura M1 Max 16 inch:

  • Linear: 15 FPS
  • sRGB: 7 FPS

Safari 13.1.3, Catalina, Intel i9, AMD Radeon Pro 5500M 8GB:

  • Linear: 10 FPS
  • sRGB 16 FPS (only test so far where sRGB outperformed)

@dfeehrer
Copy link

dfeehrer commented Jun 3, 2023

I'm also seeing that something broke with sRGBColorSpace between three 151 and 152:

Forked the sRGB canvas fiddle:
~~three 152.0: https://jsfiddle.net/dfeehrer/grmv47js/3/ ~~
- 8-10 FPS on M1 Max Mac, Chrome 115 and 116

three 151.3: https://jsfiddle.net/dfeehrer/4zegy02k/13/
- 60 FPS FPS on M1 Max Mac, Chrome 115 and 116

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 3, 2023

Nothing broke. r151 does not know about colorSpace so when you assign it, it is not processed. Meaning the texture stays in linear-srb.

Here is the fiddle using the deprecated encoding property. It produces the same performance issues: https://jsfiddle.net/x7nkbcd1/

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 3, 2023

It is strange that Chrome >= 115 fixes the issue for some setups, but not for all. Probably worth reporting the issue to the Chromium bug tracker.

@dfeehrer
Copy link

dfeehrer commented Jun 3, 2023

Nothing broke. r151 does not know about colorSpace so when you assign it, it is not processed. Meaning the texture stays in linear-srb.

@Mugen87 ah you're right, forgot about the name change

@donmccurdy
Copy link
Collaborator

Is it possible to check if the ANGLE WebGL backend is enabled or disabled?

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 3, 2023

@dfeehrer Do you mind typing chrome://gpu/ in the address bar of Chrome on one of your systems and copy the report in this issue?

@dfeehrer
Copy link

dfeehrer commented Jun 3, 2023

Here's the report for the M1 Max Mac, Chrome 115:

GPU report Graphics Feature Status Canvas: Hardware accelerated Canvas out-of-process rasterization: Enabled Direct Rendering Display Compositor: Disabled Compositing: Hardware accelerated Multiple Raster Threads: Enabled OpenGL: Enabled Rasterization: Hardware accelerated Raw Draw: Disabled Skia Graphite: Disabled Video Decode: Hardware accelerated Video Encode: Hardware accelerated WebGL: Hardware accelerated WebGL2: Hardware accelerated WebGPU: Hardware accelerated Driver Bug Workarounds adjust_src_dst_region_for_blitframebuffer clamp_texture_base_level_and_max_level decode_encode_srgb_for_generatemipmap disable_2d_canvas_auto_flush enable_webgl_timer_query_extensions get_frag_data_info_bug pack_parameters_workaround_with_pack_buffer regenerate_struct_names remove_dynamic_indexing_of_swizzled_vector remove_invariant_and_centroid_for_essl3 set_zero_level_before_generating_mipmap unfold_short_circuit_as_ternary_operation unpack_alignment_workaround_with_unpack_buffer use_intermediary_for_copy_texture_image use_unused_standard_shared_blocks disabled_extension_GL_KHR_blend_equation_advanced disabled_extension_GL_KHR_blend_equation_advanced_coherent disabled_extension_GL_MESA_framebuffer_flip_y Problems Detected Unfold short circuit on Mac OS X: [307751](http://crbug.com/307751) Applied Workarounds: unfold_short_circuit_as_ternary_operation Mac drivers handle struct scopes incorrectly: [403957](http://crbug.com/403957) Applied Workarounds: regenerate_struct_names glGenerateMipmap fails if the zero texture level is not set on some Mac drivers: [560499](http://crbug.com/560499) Applied Workarounds: set_zero_level_before_generating_mipmap Pack parameters work incorrectly with pack buffer bound: [563714](http://crbug.com/563714) Applied Workarounds: pack_parameters_workaround_with_pack_buffer Alignment works incorrectly with unpack buffer bound: [563714](http://crbug.com/563714) Applied Workarounds: unpack_alignment_workaround_with_unpack_buffer copyTexImage2D fails when reading from IOSurface on multiple GPU types.: [581777](http://crbug.com/581777) Applied Workarounds: use_intermediary_for_copy_texture_image glGetFragData{Location|Index} works incorrectly on Max: [638340](http://crbug.com/638340) Applied Workarounds: get_frag_data_info_bug Decode and encode before generateMipmap for srgb format textures on macosx: [634519](http://crbug.com/634519) Applied Workarounds: decode_encode_srgb_for_generatemipmap Insert statements to reference all members in unused std140/shared blocks on Mac: [618464](http://crbug.com/618464) Applied Workarounds: use_unused_standard_shared_blocks adjust src/dst region if blitting pixels outside framebuffer on Mac: [644740](http://crbug.com/644740) Applied Workarounds: adjust_src_dst_region_for_blitframebuffer Mac driver GL 4.1 requires invariant and centroid to match between shaders: [639760](http://crbug.com/639760), [641129](http://crbug.com/641129) Applied Workarounds: remove_invariant_and_centroid_for_essl3 Disable KHR_blend_equation_advanced until cc shaders are updated: [661715](http://crbug.com/661715) Applied Workarounds: disable(GL_KHR_blend_equation_advanced), disable(GL_KHR_blend_equation_advanced_coherent) Expose WebGL's disjoint_timer_query extensions on platforms with site isolation: [808744](http://crbug.com/808744), [870491](http://crbug.com/870491) Applied Workarounds: enable_webgl_timer_query_extensions glFlush error on Mac: [841755](http://crbug.com/841755) Applied Workarounds: disable_2d_canvas_auto_flush Clamp texture's BASE_LEVEL/MAX_LEVEL for GenerateMipmap: [913301](http://crbug.com/913301) Applied Workarounds: clamp_texture_base_level_and_max_level Disable GL_MESA_framebuffer_flip_y for desktop GL: [964010](http://crbug.com/964010) Applied Workarounds: disable(GL_MESA_framebuffer_flip_y) Remove dynamic indexing for swizzled vectors on Mac: [709351](http://crbug.com/709351) Applied Workarounds: remove_dynamic_indexing_of_swizzled_vector ANGLE Features allowCompressedFormats (Frontend workarounds): Enabled: true Allow compressed formats cacheCompiledShader (Frontend features) [anglebug:7036](http://anglebug.com/7036): Disabled Enable to cache compiled shaders disableAnisotropicFiltering (Frontend workarounds): Disabled Disable support for anisotropic filtering disableDrawBuffersIndexed (Frontend features) [anglebug:7724](http://anglebug.com/7724): Disabled Disable support for OES_draw_buffers_indexed and EXT_draw_buffers_indexed disableProgramBinary (Frontend features) [anglebug:5007](http://anglebug.com/5007): Disabled: IsPowerVrRogue(functions) Disable support for GL_OES_get_program_binary disableProgramCaching (Frontend features) [anglebug:1423136](http://anglebug.com/1423136): Disabled Disables saving programs to the cache disableProgramCachingForTransformFeedback (Frontend workarounds): Disabled: !isMesa && isQualcomm On some GPUs, program binaries don't contain transform feedback varyings dumpShaderSource (Frontend features) [anglebug:7760](http://anglebug.com/7760): Disabled Write shader source to temp directory emulatePixelLocalStorage (Frontend features) [anglebug:7279](http://anglebug.com/7279): Enabled: true Emulate ANGLE_shader_pixel_local_storage using shader images enableCaptureLimits (Frontend features) [anglebug:5750](http://anglebug.com/5750): Disabled Set the context limits like frame capturing was enabled enableProgramBinaryForCapture (Frontend features) [anglebug:5658](http://anglebug.com/5658): Disabled Even if FrameCapture is enabled, enable GL_OES_get_program_binary enableShaderSubstitution (Frontend workarounds) [anglebug:7761](http://anglebug.com/7761): Disabled Check the filesystem for shaders to use instead of those provided through glShaderSource forceDepthAttachmentInitOnClear (Frontend workarounds) [anglebug:7246](https://anglebug.com/7246): Disabled Force depth attachment initialization on clear ops forceGlErrorChecking (Frontend features) https://issuetracker.google.com/220069903: Disabled Force GL error checking (i.e. prevent applications from disabling error checking forceInitShaderVariables (Frontend features): Disabled Force-enable shader variable initialization forceRobustResourceInit (Frontend features) [anglebug:6041](http://anglebug.com/6041): Disabled Force-enable robust resource init loseContextOnOutOfMemory (Frontend workarounds): Enabled: true Some users rely on a lost context notification if a GL_OUT_OF_MEMORY error occurs scalarizeVecAndMatConstructorArgs (Frontend workarounds) [1165751](http://crbug.com/1165751): Disabled: false Always rewrite vec/mat constructors to be consistent singleThreadedTextureDecompression (Frontend workarounds): Disabled Disables multi-threaded decompression of compressed texture formats RGBA4IsNotSupportedForColorRendering (OpenGL workarounds): Disabled: functions->standard == STANDARD_GL_DESKTOP && isIntel GL_RGBA4 is not color renderable RGBDXT1TexturesSampleZeroAlpha (OpenGL workarounds) [anglebug:3729](http://anglebug.com/3729): Enabled: IsApple() Sampling BLACK texels from RGB DXT1 textures returns transparent black on Mac. addAndTrueToLoopCondition (OpenGL workarounds): Disabled: IsApple() && isIntel Calculation of loop conditions in for and while loop has bug adjustSrcDstRegionForBlitFramebuffer (OpenGL workarounds) [830046](http://crbug.com/830046): Disabled: IsLinux() || (IsAndroid() && isNvidia) || (IsWindows() && isNvidia) || (IsApple() && functions->standard == STANDARD_GL_ES) Many platforms have issues with blitFramebuffer when the parameters are large. allowAstcFormats (OpenGL workarounds): Enabled: !isMesa || isIntel && (Is9thGenIntel(device) || IsGeminiLake(device) || IsCoffeeLake(device) || Is11thGenIntel(device) || Is12thGenIntel(device)) Enable ASTC on desktop OpenGL allowClearForRobustResourceInit (OpenGL workarounds) [848952](https://crbug.com/848952%20http://crbug.com/883276): Enabled: IsApple() Using glClear for robust resource initialization is buggy on some drivers and leads to texture corruption. Default to data uploads except on MacOS where it is very slow. allowETCFormats (OpenGL workarounds): Disabled: isIntel && !IsSandyBridge(device) && !IsIvyBridge(device) && !IsHaswell(device) Enable ETC2/EAC on desktop OpenGL alwaysCallUseProgramAfterLink (OpenGL workarounds) [110263](http://crbug.com/110263): Enabled: true Always call useProgram after a successful link to avoid a driver bug alwaysUnbindFramebufferTexture2D (OpenGL workarounds) [anglebug:5536](https://anglebug.com/5536): Disabled: isNvidia && (IsWindows() || IsLinux()) Force unbind framebufferTexture2D before binding renderbuffer to work around driver bug. avoid1BitAlphaTextureFormats (OpenGL workarounds): Disabled: functions->standard == STANDARD_GL_DESKTOP && isAMD Issue with 1-bit alpha framebuffer formats bindFramebufferForTimerQueries (OpenGL workarounds) [1356053](https://crbug.com/1356053): Disabled: IsMali(functions) Some drivers require a non-zero framebuffer when beginQuery for TimeElapsed orTimestampis called. bindTransformFeedbackBufferBeforeBindBufferRange (OpenGL workarounds) [anglebug:5140](https://anglebug.com/5140): Enabled: IsApple() Bind transform feedback buffers to the generic binding point before calling glBindBufferBase or glBindBufferRange. clampArrayAccess (OpenGL workarounds) [anglebug:2978](http://anglebug.com/2978): Enabled: IsAndroid() || isAMD || !functions->hasExtension("GL_KHR_robust_buffer_access_behavior") Clamp uniform array access to avoid reading invalid memory. clampFragDepth (OpenGL workarounds): Disabled: isNvidia gl_FragDepth is not clamped correctly when rendering to a floating point depth buffer clampMscRate (OpenGL workarounds) [1042393](https://crbug.com/1042393): Disabled: IsLinux() && IsWayland() Some drivers return bogus values for GetMscRate, so we clamp it to 30Hz clampPointSize (OpenGL workarounds): Disabled: IsAndroid() || isNvidia The point size range reported from the API is inconsistent with the actual behavior clearToZeroOrOneBroken (OpenGL workarounds) [710443](https://crbug.com/710443): Disabled: IsApple() && isIntel && GetMacOSVersion() < OSVersion(10, 12, 6) Clears when the clear color is all zeros or ones do not work. clipSrcRegionForBlitFramebuffer (OpenGL workarounds) [830046](http://crbug.com/830046): Enabled: IsApple() || (IsLinux() && isAMD) Issues with blitFramebuffer when the parameters don't match the framebuffer size. decodeEncodeSRGBForGenerateMipmap (OpenGL workarounds) [anglebug:4646](http://anglebug.com/4646): Enabled: IsApple() Decode and encode before generateMipmap for srgb format textures. disableBaseInstanceVertex (OpenGL workarounds) [anglebug:8172](http://anglebug.com/8172): Disabled: IsMaliValhall(functions) Some Mali drivers have buggy implementations of glDraw*BaseVertex*. disableBlendFuncExtended (OpenGL workarounds) [anglebug:1085](http://anglebug.com/1085): Disabled: (!isMesa && isQualcomm) || (IsApple() && isIntel && GetMacOSVersion() < OSVersion(10, 14, 0)) ARB_blend_func_extended does not pass the tests disableClipControl (OpenGL features) [1434317](http://crbug.com/1434317): Disabled: IsMaliG72OrG76(functions) Some ARM Mali devices genenerate errors when querying the clip control state. disableDrawBuffersIndexed (OpenGL workarounds): Disabled: IsWindows() && isAMD Disable OES_draw_buffers_indexed extension. disableGPUSwitchingSupport (OpenGL workarounds) [1091824](https://crbug.com/1091824): Disabled: isDualGPUMacWithNVIDIA Disable GPU switching support (use only the low-power GPU) on older MacBook Pros. disableMultisampledRenderToTexture (OpenGL workarounds) [anglebug:2894](http://anglebug.com/2894): Disabled: isAdreno4xxOnAndroidLessThan51 || isAdreno4xxOnAndroid70 || isAdreno5xxOnAndroidLessThan70 || isAdreno5xxOnAndroid71 || isLinuxVivante || IsAndroid() Many drivers have bugs when using GL_EXT_multisampled_render_to_texture disableNativeParallelCompile (OpenGL workarounds) [1094869](http://crbug.com/1094869): Disabled: isTSANBuild && IsLinux() && isNvidia Do not use native KHR_parallel_shader_compile even when available. disableSemaphoreFd (OpenGL workarounds) [1046462](https://crbug.com/1046462): Disabled: IsLinux() && isAMD && isMesa && mesaVersion < (std::array{19, 3, 5}) Disable GL_EXT_semaphore_fd extension disableSyncControlSupport (OpenGL workarounds) [1137851](https://crbug.com/1137851): Disabled: IsLinux() && isIntel && isMesa && mesaVersion[0] == 20 Speculative fix for issues on Linux/Wayland where exposing GLX_OML_sync_control renders Chrome unusable disableTextureClampToBorder (OpenGL workarounds) [anglebug:7405](https://anglebug.com/7405): Disabled: isImagination Imagination devices generate INVALID_ENUM when setting the texture border color. disableTimestampQueries (OpenGL workarounds) [811661](https://crbug.com/811661): Disabled: (IsLinux() && isVMWare) || (IsAndroid() && isNvidia) || (IsAndroid() && GetAndroidSdkLevel() < 27 && IsAdreno5xxOrOlder(functions)) || (!isMesa && IsMaliT8xxOrOlder(functions)) || (!isMesa && IsMaliG31OrOlder(functions)) Disable GL_EXT_disjoint_timer_query extension disableWorkerContexts (OpenGL workarounds) [849576](http://crbug.com/849576): Disabled: (IsWindows() && (isIntel || isAMD)) || (IsLinux() && isNvidia) || IsIOS() || IsAndroid() || IsAndroidEmulator(functions) Some tests have been seen to fail using worker contexts doWhileGLSLCausesGPUHang (OpenGL workarounds) [644669](http://crbug.com/644669): Disabled: IsApple() && functions->standard == STANDARD_GL_DESKTOP && GetMacOSVersion() < OSVersion(10, 11, 0) Some GLSL constructs involving do-while loops cause GPU hangs doesSRGBClearsOnLinearFramebufferAttachments (OpenGL workarounds): Disabled: isIntel || isAMD Issue clearing framebuffers with linear attachments when GL_FRAMEBUFFER_SRGB is enabled dontInitializeUninitializedLocals (OpenGL workarounds) [anglebug:2046](http://anglebug.com/2046): Disabled: !isMesa && isQualcomm Initializing uninitialized locals caused odd behavior in a few WebGL 2 tests dontRelinkProgramsInParallel (OpenGL workarounds) [anglebug:3045](http://anglebug.com/3045): Disabled: IsAndroid() || (IsWindows() && isIntel) Relinking a program in parallel is buggy dontUseLoopsToInitializeVariables (OpenGL workarounds) [809422](http://crbug.com/809422): Disabled: (!isMesa && isQualcomm) || (isIntel && IsApple()) For loops used to initialize variables hit native GLSL compiler bugs emulateAbsIntFunction (OpenGL workarounds) [642227](http://crbug.com/642227): Disabled: IsApple() && isIntel abs(i) where i is an integer returns unexpected result emulateAtan2Float (OpenGL workarounds) [672380](http://crbug.com/672380): Disabled: isNvidia atan(y, x) may return a wrong answer emulateClipDistanceState (OpenGL workarounds): Disabled: isQualcomm Some drivers ignore GL_CLIP_DISTANCEi_EXT state. emulateCopyTexImage2D (OpenGL workarounds): Enabled: isApple Replace CopyTexImage2D with TexImage2D + CopyTexSubImage2D. emulateCopyTexImage2DFromRenderbuffers (OpenGL workarounds) [anglebug:4674](https://anglebug.com/4674): Disabled: IsApple() && functions->standard == STANDARD_GL_ES && !(isAMD && IsWindows()) CopyTexImage2D spuriously returns errors on iOS when copying from renderbuffers. emulateImmutableCompressedTexture3D (OpenGL workarounds) [1060012](https://crbug.com/1060012): Disabled: isQualcomm Use non-immutable texture allocation to work around a driver bug. emulateIsnanFloat (OpenGL workarounds) [650547](http://crbug.com/650547): Disabled: isIntel && IsApple() && IsSkylake(device) && GetMacOSVersion() < OSVersion(10, 13, 2) Using isnan() on highp float will get wrong answer emulateMaxVertexAttribStride (OpenGL workarounds) [anglebug:1936](http://anglebug.com/1936): Disabled: IsLinux() && functions->standard == STANDARD_GL_DESKTOP && isAMD Some drivers return 0 when MAX_VERTEX_ATTRIB_STRIED queried emulatePackSkipRowsAndPackSkipPixels (OpenGL workarounds) [anglebug:4849](https://anglebug.com/4849): Enabled: IsApple() GL_PACK_SKIP_ROWS and GL_PACK_SKIP_PIXELS are ignored in Apple's OpenGL driver. emulatePrimitiveRestartFixedIndex (OpenGL workarounds) [anglebug:3997](http://anglebug.com/3997): Enabled: functions->standard == STANDARD_GL_DESKTOP && functions->isAtLeastGL(gl::Version(3, 1)) && !functions->isAtLeastGL(gl::Version(4, 3)) When GL_PRIMITIVE_RESTART_FIXED_INDEX is not available, emulate it with GL_PRIMITIVE_RESTART and glPrimitiveRestartIndex. emulateRGB10 (OpenGL workarounds) [1300575](https://crbug.com/1300575): Enabled: functions->standard == STANDARD_GL_DESKTOP Emulate RGB10 support using RGB10_A2. finishDoesNotCauseQueriesToBeAvailable (OpenGL workarounds): Disabled: functions->standard == STANDARD_GL_DESKTOP && isNvidia glFinish doesn't cause all queries to report available result flushBeforeDeleteTextureIfCopiedTo (OpenGL workarounds) [anglebug:4267](http://anglebug.com/4267): Disabled: IsApple() && isIntel Some drivers track CopyTex{Sub}Image texture dependencies incorrectly. Flush before glDeleteTextures in this case flushOnFramebufferChange (OpenGL workarounds) [1181068](http://crbug.com/1181068): Disabled: IsApple() && Has9thGenIntelGPU(systemInfo) Switching framebuffers without a flush can lead to crashes on Intel 9th Generation GPU Macs. initFragmentOutputVariables (OpenGL workarounds) [1171371](http://crbug.com/1171371): Disabled: IsAdreno42xOr3xx(functions) No init gl_FragColor causes context lost initializeCurrentVertexAttributes (OpenGL workarounds): Disabled: isNvidia During initialization, assign the current vertex attributes to the spec-mandated defaults keepBufferShadowCopy (OpenGL workarounds): Disabled: !CanMapBufferForRead(functions) Maintain a shadow copy of buffer data when the GL API does not permit reading data back. limitMax3dArrayTextureSizeTo1024 (OpenGL workarounds) [927470](http://crbug.com/927470): Disabled: limitMaxTextureSize Limit max 3d texture size and max array texture layers to 1024 to avoid system hang limitMaxMSAASamplesTo4 (OpenGL workarounds) [797243](http://crbug.com/797243): Disabled: IsAndroid() || (IsApple() && (isIntel || isAMD || isNvidia)) Various rendering bugs have been observed when using higher MSAA counts limitWebglMaxTextureSizeTo4096 (OpenGL workarounds) [927470](http://crbug.com/927470): Disabled: IsAndroid() || limitMaxTextureSize Limit webgl max texture size to 4096 to avoid frequent out-of-memory errors packLastRowSeparatelyForPaddingInclusion (OpenGL workarounds) [anglebug:1512](http://anglebug.com/1512): Enabled: IsApple() || isNvidia When uploading textures from an pack buffer, some drivers count an extra row padding packOverlappingRowsSeparatelyPackBuffer (OpenGL workarounds): Disabled: isNvidia In the case of packing to a pixel pack buffer, pack overlapping rows row by row passHighpToPackUnormSnormBuiltins (OpenGL workarounds) [anglebug:7527](http://anglebug.com/7527): Disabled: isQualcomm packUnorm4x8 fails on Pixel 4 if it is not passed a highp vec4. preAddTexelFetchOffsets (OpenGL workarounds) [642605](http://crbug.com/642605): Disabled: IsApple() && isIntel Intel Mac drivers mistakenly consider the parameter position of nagative vaule as invalid even if the sum of position and offset is in range, so we need to add workarounds by rewriting texelFetchOffset(sampler, position, lod, offset) into texelFetch(sampler, position + offset, lod). promotePackedFormatsTo8BitPerChannel (OpenGL workarounds) [anglebug:5469](http://anglebug.com/5469): Disabled: IsApple() && hasAMD Packed color formats are buggy on Macs with AMD GPUs queryCounterBitsGeneratesErrors (OpenGL workarounds) [anglebug:3027](http://anglebug.com/3027): Disabled: IsNexus5X(vendor, device) Drivers generate errors when querying the number of bits in timer queries readPixelsUsingImplementationColorReadFormatForNorm16 (OpenGL workarounds) [anglebug:4214](http://anglebug.com/4214): Disabled: !isIntel && functions->standard == STANDARD_GL_ES && functions->isAtLeastGLES(gl::Version(3, 1)) && functions->hasGLESExtension("GL_EXT_texture_norm16") Quite some OpenGL ES drivers don't implement readPixels for RGBA/UNSIGNED_SHORT from EXT_texture_norm16 correctly reapplyUBOBindingsAfterUsingBinaryProgram (OpenGL workarounds) [anglebug:1637](http://anglebug.com/1637): Disabled: isAMD || IsAndroid() Some drivers forget about UBO bindings when using program binaries regenerateStructNames (OpenGL workarounds) [403957](http://crbug.com/403957): Enabled: IsApple() All Mac drivers do not handle struct scopes correctly. This workaround overwrites a structname with a unique prefix. removeDynamicIndexingOfSwizzledVector (OpenGL workarounds) [709351](http://crbug.com/709351): Enabled: IsApple() || IsAndroid() || IsWindows() Dynamic indexing of swizzled l-values doesn't work correctly on various platforms. removeInvariantAndCentroidForESSL3 (OpenGL workarounds): Enabled: functions->isAtMostGL(gl::Version(4, 1)) || (functions->standard == STANDARD_GL_DESKTOP && isAMD) Fix spec difference between GLSL 4.1 or lower and ESSL3 resetTexImage2DBaseLevel (OpenGL workarounds) [705865](https://crbug.com/705865): Disabled: IsApple() && isIntel && GetMacOSVersion() >= OSVersion(10, 12, 4) Reset texture base level before calling glTexImage2D to work around pixel comparison failure. rewriteFloatUnaryMinusOperator (OpenGL workarounds) [308366](http://crbug.com/308366): Disabled: IsApple() && isIntel && GetMacOSVersion() < OSVersion(10, 12, 0) Using '-' will get wrong answer rewriteRepeatedAssignToSwizzled (OpenGL workarounds): Disabled: isNvidia Repeated assignment to swizzled values inside a GLSL user-defined function have incorrect results rewriteRowMajorMatrices (OpenGL workarounds) [anglebug:2273](http://anglebug.com/2273): Disabled: false Rewrite row major matrices in shaders as column major as a driver bug workaround sanitizeAMDGPURendererString (OpenGL workarounds) [1181193](http://crbug.com/1181193): Disabled: IsLinux() && hasAMD Strip precise kernel and DRM version information from amdgpu renderer strings. setPrimitiveRestartFixedIndexForDrawArrays (OpenGL workarounds) [anglebug:3997](http://anglebug.com/3997): Disabled: features->emulatePrimitiveRestartFixedIndex.enabled && IsApple() && isIntel Some drivers discard vertex data in DrawArrays calls when the fixed primitive restart index is within the number of primitives being drawn. setZeroLevelBeforeGenerateMipmap (OpenGL workarounds): Enabled: IsApple() glGenerateMipmap fails if the zero texture level is not set on some Mac drivers. shiftInstancedArrayDataWithOffset (OpenGL workarounds) [1144207](http://crbug.com/1144207): Disabled: IsApple() && IsIntel(vendor) && !IsHaswell(device) glDrawArraysInstanced is buggy on certain new Mac Intel GPUs supportsFragmentShaderInterlockARB (OpenGL features) [anglebug:7279](http://anglebug.com/7279): Disabled: functions->isAtLeastGL(gl::Version(4, 5)) && functions->hasGLExtension("GL_ARB_fragment_shader_interlock") Backend GL context supports ARB_fragment_shader_interlock extension supportsFragmentShaderInterlockNV (OpenGL features) [anglebug:7279](http://anglebug.com/7279): Disabled: functions->isAtLeastGL(gl::Version(4, 3)) && functions->hasGLExtension("GL_NV_fragment_shader_interlock") Backend GL context supports NV_fragment_shader_interlock extension supportsFragmentShaderOrderingINTEL (OpenGL features) [anglebug:7279](http://anglebug.com/7279): Disabled: functions->isAtLeastGL(gl::Version(4, 4)) && functions->hasGLExtension("GL_INTEL_fragment_shader_ordering") Backend GL context supports GL_INTEL_fragment_shader_ordering extension supportsShaderFramebufferFetchEXT (OpenGL features) [anglebug:7279](http://anglebug.com/7279): Disabled: functions->hasGLESExtension("GL_EXT_shader_framebuffer_fetch") Backend GL context supports EXT_shader_framebuffer_fetch extension supportsShaderFramebufferFetchNonCoherentEXT (OpenGL features) [anglebug:7279](http://anglebug.com/7279): Disabled: functions->hasGLESExtension("GL_EXT_shader_framebuffer_fetch_non_coherent") Backend GL context supports EXT_shader_framebuffer_fetch_non_coherent extension supportsShaderPixelLocalStorageEXT (OpenGL features) [anglebug:7279](http://anglebug.com/7279): Disabled: functions->hasGLESExtension("GL_EXT_shader_pixel_local_storage") Backend GL context supports EXT_shader_pixel_local_storage extension syncVertexArraysToDefault (OpenGL workarounds) [anglebug:5577](http://anglebug.com/5577): Disabled: !nativegl::SupportsVertexArrayObjects(functions) Only use the default VAO because of missing support or driver bugs unbindFBOBeforeSwitchingContext (OpenGL workarounds) [1181193](http://crbug.com/1181193): Disabled: IsPowerVR(vendor) Imagination GL drivers are buggy with context switching. unfoldShortCircuits (OpenGL workarounds) [anglebug:482](http://anglebug.com/482): Enabled: IsApple() Mac incorrectly executes both sides of && and || expressions when they should short-circuit. unpackLastRowSeparatelyForPaddingInclusion (OpenGL workarounds) [anglebug:1512](http://anglebug.com/1512): Enabled: IsApple() || isNvidia When uploading textures from an unpack buffer, some drivers count an extra row padding unpackOverlappingRowsSeparatelyUnpackBuffer (OpenGL workarounds): Disabled: isNvidia In the case of unpacking from a pixel unpack buffer, unpack overlapping rows row by row unsizedSRGBReadPixelsDoesntTransform (OpenGL workarounds) [550292](http://crbug.com/550292%20http://crbug.com/565179): Disabled: !isMesa && isQualcomm Drivers returning raw sRGB values instead of linearized values when calling glReadPixels on unsized sRGB texture formats uploadTextureDataInChunks (OpenGL workarounds) [1181068](http://crbug.com/1181068): Enabled: IsApple() Upload texture data in <120kb chunks to work around Mac driver hangs and crashes. useUnusedBlocksWithStandardOrSharedLayout (OpenGL workarounds): Enabled: (IsApple() && functions->standard == STANDARD_GL_DESKTOP) || (IsLinux() && isAMD) Unused std140 or shared uniform blocks will be treated as inactive vertexIDDoesNotIncludeBaseVertex (OpenGL workarounds): Disabled: IsApple() && isAMD gl_VertexID in GLSL vertex shader doesn't include base vertex value DAWN Info

Metal backend - Apple M1 Max
[WebGPU Status]
Available
[Default Toggle Names]
always_resolve_into_zero_level_and_layer: https://crbug.com/dawn/56: When the resolve target is a texture view that is created on the non-zero level or layer of a texture, we first resolve into a temporarily 2D texture with only one mipmap level and one array layer, and copy the result of MSAA resolve into the true resolve target. This workaround is enabled by default on the Metal drivers that have bugs when setting non-zero resolveLevel or resolveSlice. It is also enabled by default on Qualcomm Vulkan drivers, which have similar bugs.
lazy_clear_resource_on_first_use: https://crbug.com/dawn/145: Clears resource to zero on first usage. This initializes the resource so that no dirty bits from recycled memory is present in the new resource.
metal_enable_vertex_pulling: https://crbug.com/dawn/480: Uses vertex pulling to protect out-of-bounds reads on Metal
disallow_unsafe_apis: http://crbug.com/1138528: Produces validation errors on API entry points or parameter combinations that aren't considered secure yet.
metal_use_mock_blit_encoder_for_write_timestamp: https://crbug.com/dawn/1473: Add mock blit command to blit encoder when encoding writeTimestamp as workaround on Metal.This toggle is enabled by default on Metal backend where GPU counters cannot be stored tosampleBufferAttachments on empty blit encoder.
metal_fill_empty_occlusion_queries_with_zero: https://crbug.com/dawn/1707: Apple GPUs leave stale results in the visibility result buffer instead of writing zero if an occlusion query is empty. Workaround this by explicitly filling it with zero if there are no draw calls.
[WebGPU Forced Toggles - enabled]
disallow_spirv: https://crbug.com/1214923: Disallow usage of SPIR-V completely so that only WGSL is used for shader modules. This is useful to prevent a Chromium renderer process from successfully sending SPIR-V code to be compiled in the GPU process.
[Supported Features]
texture-compression-bc
texture-compression-etc2
texture-compression-astc
timestamp-query
depth-clip-control
depth32float-stencil8
indirect-first-instance
shader-f16
rg11b10ufloat-renderable
bgra8unorm-storage
float32-filterable
dawn-internal-usages
multiplanar-formats
dawn-native
implicit-device-sync
surface-capabilities
transient-attachments

Metal backend - Apple M1 Max
[WebGPU Status]
Available
[Default Toggle Names]
always_resolve_into_zero_level_and_layer: https://crbug.com/dawn/56: When the resolve target is a texture view that is created on the non-zero level or layer of a texture, we first resolve into a temporarily 2D texture with only one mipmap level and one array layer, and copy the result of MSAA resolve into the true resolve target. This workaround is enabled by default on the Metal drivers that have bugs when setting non-zero resolveLevel or resolveSlice. It is also enabled by default on Qualcomm Vulkan drivers, which have similar bugs.
lazy_clear_resource_on_first_use: https://crbug.com/dawn/145: Clears resource to zero on first usage. This initializes the resource so that no dirty bits from recycled memory is present in the new resource.
metal_enable_vertex_pulling: https://crbug.com/dawn/480: Uses vertex pulling to protect out-of-bounds reads on Metal
disallow_unsafe_apis: http://crbug.com/1138528: Produces validation errors on API entry points or parameter combinations that aren't considered secure yet.
metal_use_mock_blit_encoder_for_write_timestamp: https://crbug.com/dawn/1473: Add mock blit command to blit encoder when encoding writeTimestamp as workaround on Metal.This toggle is enabled by default on Metal backend where GPU counters cannot be stored tosampleBufferAttachments on empty blit encoder.
metal_fill_empty_occlusion_queries_with_zero: https://crbug.com/dawn/1707: Apple GPUs leave stale results in the visibility result buffer instead of writing zero if an occlusion query is empty. Workaround this by explicitly filling it with zero if there are no draw calls.
[WebGPU Forced Toggles - enabled]
disallow_spirv: https://crbug.com/1214923: Disallow usage of SPIR-V completely so that only WGSL is used for shader modules. This is useful to prevent a Chromium renderer process from successfully sending SPIR-V code to be compiled in the GPU process.
[Supported Features]
texture-compression-bc
texture-compression-etc2
texture-compression-astc
timestamp-query
depth-clip-control
depth32float-stencil8
indirect-first-instance
shader-f16
rg11b10ufloat-renderable
bgra8unorm-storage
float32-filterable
dawn-internal-usages
multiplanar-formats
dawn-native
implicit-device-sync
surface-capabilities
transient-attachments

Vulkan backend - SwiftShader Device (LLVM 10.0.0)
[WebGPU Status]
Blocklisted
[Default Toggle Names]
lazy_clear_resource_on_first_use: https://crbug.com/dawn/145: Clears resource to zero on first usage. This initializes the resource so that no dirty bits from recycled memory is present in the new resource.
use_temporary_buffer_in_texture_to_texture_copy: https://crbug.com/dawn/42: Split texture-to-texture copy into two copies: copy from source texture into a temporary buffer, and copy from the temporary buffer into the destination texture when copying between compressed textures that don't have block-aligned sizes. This workaround is enabled by default on all Vulkan drivers to solve an issue in the Vulkan SPEC about the texture-to-texture copies with compressed formats. See #1005 (KhronosGroup/Vulkan-Docs#1005) for more details.
vulkan_use_d32s8: https://crbug.com/dawn/286: Vulkan mandates support of either D32_FLOAT_S8 or D24_UNORM_S8. When available the backend will use D32S8 (toggle to on) but setting the toggle to off will make it use the D24S8 format when possible.
vulkan_use_s8: https://crbug.com/dawn/666: Vulkan has a pure stencil8 format but it is not universally available. When this toggle is on, the backend will use S8 for the stencil8 format, otherwise it will fallback to D32S8 or D24S8.
disallow_unsafe_apis: http://crbug.com/1138528: Produces validation errors on API entry points or parameter combinations that aren't considered secure yet.
use_placeholder_fragment_in_vertex_only_pipeline: https://crbug.com/dawn/136: Use a placeholder empty fragment shader in vertex only render pipeline. This toggle must be enabled for OpenGL ES backend, the Vulkan Backend, and serves as a workaround by default enabled on some Metal devices with Intel GPU to ensure the depth result is correct.
use_vulkan_zero_initialize_workgroup_memory_extension: https://crbug.com/dawn/1302: Initialize workgroup memory with OpConstantNull on Vulkan when the Vulkan extension VK_KHR_zero_initialize_workgroup_memory is supported.
[WebGPU Forced Toggles - enabled]
disallow_spirv: https://crbug.com/1214923: Disallow usage of SPIR-V completely so that only WGSL is used for shader modules. This is useful to prevent a Chromium renderer process from successfully sending SPIR-V code to be compiled in the GPU process.
[Supported Features]
texture-compression-bc
texture-compression-etc2
texture-compression-astc
timestamp-query
timestamp-query-inside-passes
depth-clip-control
depth32float-stencil8
indirect-first-instance
rg11b10ufloat-renderable
bgra8unorm-storage
float32-filterable
dawn-internal-usages
dawn-native
implicit-device-sync
surface-capabilities
transient-attachments

Vulkan backend - SwiftShader Device (LLVM 10.0.0)
[WebGPU Status]
Blocklisted
[Default Toggle Names]
lazy_clear_resource_on_first_use: https://crbug.com/dawn/145: Clears resource to zero on first usage. This initializes the resource so that no dirty bits from recycled memory is present in the new resource.
use_temporary_buffer_in_texture_to_texture_copy: https://crbug.com/dawn/42: Split texture-to-texture copy into two copies: copy from source texture into a temporary buffer, and copy from the temporary buffer into the destination texture when copying between compressed textures that don't have block-aligned sizes. This workaround is enabled by default on all Vulkan drivers to solve an issue in the Vulkan SPEC about the texture-to-texture copies with compressed formats. See #1005 (KhronosGroup/Vulkan-Docs#1005) for more details.
vulkan_use_d32s8: https://crbug.com/dawn/286: Vulkan mandates support of either D32_FLOAT_S8 or D24_UNORM_S8. When available the backend will use D32S8 (toggle to on) but setting the toggle to off will make it use the D24S8 format when possible.
vulkan_use_s8: https://crbug.com/dawn/666: Vulkan has a pure stencil8 format but it is not universally available. When this toggle is on, the backend will use S8 for the stencil8 format, otherwise it will fallback to D32S8 or D24S8.
disallow_unsafe_apis: http://crbug.com/1138528: Produces validation errors on API entry points or parameter combinations that aren't considered secure yet.
use_placeholder_fragment_in_vertex_only_pipeline: https://crbug.com/dawn/136: Use a placeholder empty fragment shader in vertex only render pipeline. This toggle must be enabled for OpenGL ES backend, the Vulkan Backend, and serves as a workaround by default enabled on some Metal devices with Intel GPU to ensure the depth result is correct.
use_vulkan_zero_initialize_workgroup_memory_extension: https://crbug.com/dawn/1302: Initialize workgroup memory with OpConstantNull on Vulkan when the Vulkan extension VK_KHR_zero_initialize_workgroup_memory is supported.
[WebGPU Forced Toggles - enabled]
disallow_spirv: https://crbug.com/1214923: Disallow usage of SPIR-V completely so that only WGSL is used for shader modules. This is useful to prevent a Chromium renderer process from successfully sending SPIR-V code to be compiled in the GPU process.
[Supported Features]
texture-compression-bc
texture-compression-etc2
texture-compression-astc
timestamp-query
timestamp-query-inside-passes
depth-clip-control
depth32float-stencil8
indirect-first-instance
rg11b10ufloat-renderable
bgra8unorm-storage
float32-filterable
dawn-internal-usages
dawn-native
implicit-device-sync
surface-capabilities
transient-attachments
Version Information
Data exported
2023-06-03T18:20:49.472Z
Chrome version
Chrome/115.0.5790.13
Operating system
Mac OS X 13.2.1
Software rendering list URL
https://chromium.googlesource.com/chromium/src/+/5f740d00e862007bdf092401a21f54a6e735c3f3/gpu/config/software_rendering_list.json
Driver bug list URL
https://chromium.googlesource.com/chromium/src/+/5f740d00e862007bdf092401a21f54a6e735c3f3/gpu/config/gpu_driver_bug_list.json
ANGLE commit id
2ec39fd22fe9
2D graphics backend
Skia/115 3e827bac0cc99f8cb552079a4bc8c2a79ac2460b
Command Line
/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta --flag-switches-begin --enable-experimental-web-platform-features --flag-switches-end
Driver Information
Initialization time
426
In-process GPU
false
Passthrough Command Decoder
true
Sandboxed
true
GPU0
VENDOR= 0x106b [Google Inc. (Apple)], DEVICE=0x0000 [ANGLE (Apple, Apple M1 Max, OpenGL 4.1 Metal - 83)], DRIVER_VENDOR=Apple, DRIVER_VERSION=83 ACTIVE
Optimus
false
AMD switchable
false
GPU CUDA compute capability major version
0
Pixel shader version
1.00
Vertex shader version
1.00
Max. MSAA samples
4
Machine model name
MacBookPro
Machine model version
18.2
GL implementation parts
(gl=egl-angle,angle=opengl)
Display type
ANGLE_OPENGL
GL_VENDOR
Google Inc. (Apple)
GL_RENDERER
ANGLE (Apple, Apple M1 Max, OpenGL 4.1 Metal - 83)
GL_VERSION
OpenGL ES 2.0.0 (ANGLE 2.1.21140 git hash: 2ec39fd22fe9)
GL_EXTENSIONS
GL_AMD_performance_monitor GL_ANGLE_base_vertex_base_instance GL_ANGLE_base_vertex_base_instance_shader_builtin GL_ANGLE_client_arrays GL_ANGLE_depth_texture GL_ANGLE_framebuffer_blit GL_ANGLE_framebuffer_multisample GL_ANGLE_get_serialized_context_string GL_ANGLE_get_tex_level_parameter GL_ANGLE_instanced_arrays GL_ANGLE_logic_op GL_ANGLE_memory_size GL_ANGLE_multi_draw GL_ANGLE_polygon_mode GL_ANGLE_program_cache_control GL_ANGLE_provoking_vertex GL_ANGLE_request_extension GL_ANGLE_robust_client_memory GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_ANGLE_texture_external_update GL_ANGLE_texture_rectangle GL_ANGLE_translated_shader_source GL_APPLE_clip_distance GL_ARB_sync GL_CHROMIUM_bind_generates_resource GL_CHROMIUM_bind_uniform_location GL_CHROMIUM_color_buffer_float_rgb GL_CHROMIUM_color_buffer_float_rgba GL_CHROMIUM_copy_texture GL_CHROMIUM_lose_context GL_CHROMIUM_sync_query GL_EXT_base_instance GL_EXT_blend_func_extended GL_EXT_blend_minmax GL_EXT_color_buffer_half_float GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_depth_clamp GL_EXT_disjoint_timer_query GL_EXT_draw_buffers GL_EXT_draw_elements_base_vertex GL_EXT_float_blend GL_EXT_frag_depth GL_EXT_instanced_arrays GL_EXT_map_buffer_range GL_EXT_multi_draw_indirect GL_EXT_multisample_compatibility GL_EXT_occlusion_query_boolean GL_EXT_read_format_bgra GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT_shader_texture_lod GL_EXT_shadow_samplers GL_EXT_texture_border_clamp GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_rgtc GL_EXT_texture_compression_s3tc_srgb GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_mirror_clamp_to_edge GL_EXT_texture_norm16 GL_EXT_texture_rg GL_EXT_texture_sRGB_decode GL_EXT_texture_storage GL_EXT_texture_type_2_10_10_10_REV GL_EXT_unpack_subimage GL_KHR_debug GL_KHR_parallel_shader_compile GL_NV_depth_buffer_float2 GL_NV_fence GL_NV_framebuffer_blit GL_NV_pack_subimage GL_NV_pixel_buffer_object GL_NV_polygon_mode GL_NV_read_depth GL_NV_read_stencil GL_OES_depth24 GL_OES_depth32 GL_OES_depth_texture GL_OES_draw_elements_base_vertex GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_surfaceless_context GL_OES_texture_3D GL_OES_texture_border_clamp GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_array_object
Disabled Extensions
GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_MESA_framebuffer_flip_y
Disabled WebGL Extensions
Window system binding vendor
Window system binding version
Window system binding extensions
Direct rendering version
unknown
Reset notification strategy
0x0000
GPU process crash count
0
gfx::BufferFormats supported for allocation and texturing
R_8: not supported, R_16: not supported, RG_88: not supported, RG_1616: not supported, BGR_565: not supported, RGBA_4444: not supported, RGBX_8888: not supported, RGBA_8888: not supported, BGRX_8888: not supported, BGRA_1010102: not supported, RGBA_1010102: not supported, BGRA_8888: not supported, RGBA_F16: not supported, YVU_420: not supported, YUV_420_BIPLANAR: not supported, YUVA_420_TRIPLANAR: not supported, P010: not supported
Compositor Information
Tile Update Mode
Zero-copy
Partial Raster
Enabled
GpuMemoryBuffers Status
R_8
GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, SCANOUT_VEA_CPU_READ, SCANOUT_FRONT_RENDERING
R_16
GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, SCANOUT_VEA_CPU_READ, SCANOUT_FRONT_RENDERING
RG_88
GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, SCANOUT_VEA_CPU_READ, SCANOUT_FRONT_RENDERING
RG_1616
GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, SCANOUT_VEA_CPU_READ, SCANOUT_FRONT_RENDERING
BGR_565
Software only
RGBA_4444
Software only
RGBX_8888
GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, SCANOUT_VEA_CPU_READ, SCANOUT_FRONT_RENDERING
RGBA_8888
GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, SCANOUT_VEA_CPU_READ, SCANOUT_FRONT_RENDERING
BGRX_8888
GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, SCANOUT_VEA_CPU_READ, SCANOUT_FRONT_RENDERING
BGRA_1010102
GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, SCANOUT_VEA_CPU_READ, SCANOUT_FRONT_RENDERING
RGBA_1010102
Software only
BGRA_8888
GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, SCANOUT_VEA_CPU_READ, SCANOUT_FRONT_RENDERING
RGBA_F16
GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, SCANOUT_VEA_CPU_READ, SCANOUT_FRONT_RENDERING
YVU_420
Software only
YUV_420_BIPLANAR
GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, SCANOUT_VEA_CPU_READ, SCANOUT_FRONT_RENDERING
YUVA_420_TRIPLANAR
GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, SCANOUT_VEA_CPU_READ, SCANOUT_FRONT_RENDERING
P010
GPU_READ, SCANOUT, SCANOUT_CPU_READ_WRITE, GPU_READ_CPU_READ_WRITE, SCANOUT_VEA_CPU_READ, SCANOUT_FRONT_RENDERING
Display(s) Information
Info
Display[5] bounds=[0,0 2560x1440], workarea=[0,25 2560x1337], scale=2, rotation=0, panel_rotation=0 external.
Color space (all)
{primaries:P3, transfer:0.0777x + 0.0000 if x < 0.0450 else (0.9495x + 0.0495)**2.3955 + 0.0003, matrix:RGB, range:FULL}
Buffer format (all)
RGBA_8888
Color volume
{name:'p3', r:[0.6800, 0.3200], g:[0.2650, 0.6900], b:[0.1500, 0.3200], w:[0.3127, 0.3290]}
SDR white level in nits
203
HDR relative maximum luminance
1
Bits per color component
8
Bits per pixel
24
Refresh Rate in Hz
59
Video Acceleration Information
Decoding
Decode h264 baseline
16x16 to 4096x4096 pixels
Decode h264 extended
16x16 to 4096x4096 pixels
Decode h264 main
16x16 to 4096x4096 pixels
Decode h264 high
16x16 to 4096x4096 pixels
Decode vp9 profile0
16x16 to 4096x4096 pixels
Decode vp9 profile2
16x16 to 4096x4096 pixels
Decode hevc main
16x16 to 8192x8192 pixels
Decode hevc main 10
16x16 to 8192x8192 pixels
Decode hevc main still-picture
16x16 to 8192x8192 pixels
Decode hevc range extensions
16x16 to 8192x8192 pixels
Encoding
Encode h264 baseline
0x0 to 4096x2304 pixels, and/or 120.000 fps.
Encode h264 baseline
2x2 to 4096x2304 pixels, and/or 120.000 fps (software codec).
Encode h264 main
0x0 to 4096x2304 pixels, and/or 120.000 fps.
Encode h264 main
2x2 to 4096x2304 pixels, and/or 120.000 fps (software codec).
Encode h264 high
0x0 to 4096x2304 pixels, and/or 120.000 fps.
Encode h264 high
2x2 to 4096x2304 pixels, and/or 120.000 fps (software codec).
Vulkan Information
Device Performance Information
Log Messages

@arpu
Copy link

arpu commented Jun 3, 2023

on Chrome/116.0.5803.2 on Linux Vulcan is enabled as default on this system when i disable vulkan with chrome://flags
same problem with 4 fps (B) is reproducible.

[ANGLE (AMD, AMD Radeon RX 460 Graphics (polaris11 LLVM 16.0.4), OpenGL 4.6 (Core Profile) Mesa 23.1.1)], DRIVER_VENDOR=Mesa, DRIVER_VERSION=23.1.1 ACTIVE

@toddka
Copy link

toddka commented Jun 3, 2023

Another data point. Windows 11. Chrome Version 116.0.5809.2 (Official Build) canary (64-bit). 3070 with Ryzen 5 5600x. Measured GPU and CPU load with HWiNFO. Only 4-7 fps on the sRGB texture example. 165 fps on linear. Increased CPU and GPU load. Is it possible the color conversion is happening on the CPU? That seems unlikely but CPU load increases by a larger percentage compared to GPU load.

chart

@dfeehrer
Copy link

dfeehrer commented Jun 3, 2023

On the M1 Mac this issue only shows up in the default OpenGL ANGLE backend, not in the Metal ANGLE backend

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 4, 2023

@dfeehrer @toddka Would one of you be willing to report this issue at the Chromium bug tracker instead? You can use my fiddles from above for reproduction test cases. It would be good if someone reports the issue who has still issues with Chrome 115/116.

The URL is: https://bugs.chromium.org/p/chromium/issues/list

BTW: When filing the issue, please add the chrome://gpu/ report as an attachment. I could not see something suspicious when investigating @dfeehrer's report but a Chromium dev can analyze the report better than myself. The component of the bug (it's category) would be Blink>WebGL.

@toddka
Copy link

toddka commented Jun 4, 2023

Chromium bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=1451195

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 5, 2023

Thanks! I've added a comment to highlight that the issue is related to the WebGL format SRGB8_ALPHA8. That is the internal format a sRGB canvas texture is using. I suppose browsers do not handle this format properly in all cases.

@toddka
Copy link

toddka commented Jun 5, 2023

@Mugen87 awesome thanks! Really appreciate all of the helping addressing this.

This seems like it would be a fairly common use case. I wonder how many people are running projects on Metal or Vulcan and are unaware that their users are hitting this performance issue. Is there a workaround we could suggest for the time being given that browser bugs may take a long time to fix?

One idea I have is to write a custom shader for the canvas texture that does the linear -> sRGB encoding. I'm not sure if this is possible or nontrivial (I'm a complete WebGL/GLSL noob), but I'd be willing to work on it and post a solution here for others while we wait for a Chromium fix.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 5, 2023

I think the overhead only becomes a problem if you updating texture data per frame. TBH, I would like to wait for the feedback of the Chromium team first and see how fast it can be fixed.

I would prefer to not add inline decoding back. Devs how still want it can keep their textures in linear-srgb and implement the inline decode via Material.onBeforeCompile().

@danrossi
Copy link

danrossi commented Jun 13, 2023

I'm experiencing this issue with video textures and WebGPU renderer on Chrome Windows. cpu usage 20%. On Firefox cpu usage is 1% and gpu 2-3% it was surprising the difference. . On Canary 3-5% cpu but 20-40% gpu.

I have to set the colorspace to LinearSRGBColorSpace to fix a gamma problem when using webgpu.

https://danrossi.github.io/three-webgpu-renderer/tests/webgpu_video_panorama_equirectangular.html
https://danrossi.github.io/three-webgpu-renderer/tests/webgl_video_panorama_equirectangular.html

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 14, 2023

@danrossi Nit: Unfortunately, your post at the Chromium bug tracker is unrelated since WebGPU issues are tackled in completely different Chromium components (Blink>WebGPU vs Blink>WebGL).

@danrossi
Copy link

My issue #26266 is related to this for WebGLRenderer but it might be causing the same problem for WebGPURenderer. WebGPURenderer is 20% cpu usage, the use of SRGB8_ALPHA8 produces 10% cpu in webgl and when using RGBA8 it's 1-2%. With video textures.

Video textures for WebGL has to be set to THREE.SRGBColorSpace. Unless this function is disabled in the shader. `linearToOutputTexel which I've done so in a shadermaterial

@ashthornton
Copy link

ashthornton commented Jun 22, 2023

I've recently come across this issue when trying to render a 4K video in Three.js VR using an Oculus Quest 1. Both my Windows Chrome browser and the Oculus browser (which is Chromium based) were running at a max of 15fps. The quick solution was to set the Three.js WebGLRenderer outputColorSpace to LinearSRGBColorSpace and leaving the VideoTexture colorSpace as default (three.js r153). I'm only rendering a VideoTexture and nothing else so this solution works fine for me in the meantime.

@danrossi
Copy link

danrossi commented Jun 22, 2023

That is the one. Mine is cpu related than dropping frames. I have even higher cpu issues with WebGPU and drops frames every 30 seconds of playback and fan ramps up.

With WebGL using LinearSRGBColorSpace produces a wierd gamma issue because of a conversion in the shader. It requires srgb colorspace setting like webgpu does now. One of my usages is a video grid rendering multiple video textures so performance is needed.

Here is my work around for now. Using a shadermaterial with the shader function causing the gamma issue removed when using linearsrgb

https://github.com/danrossi/three-webgpu-renderer/blob/master/tests/webgpu_video_panorama_equirectangular.html#L139

I was constantly advised my problem was not related so made a new ticket. Its when SRGB8_ALPHA8 is used as the internal format for the video texture.

https://bugs.chromium.org/p/chromium/issues/detail?id=1456882&q=SRGB8_ALPHA8&can=2

if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( colorSpace === SRGBColorSpace && forceLinearTransfer === false ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 22, 2023

It would be great when affected users could stare the Chromium bug so it becomes more visible (and hopefully gets a higher priority).

https://bugs.chromium.org/p/chromium/issues/detail?id=1451195

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 22, 2023

Devs how still want it can keep their textures in linear-srgb and implement the inline decode via Material.onBeforeCompile().

Here is a live example that implements the workaround: https://jsfiddle.net/em6vasdg/3/

@danrossi
Copy link

danrossi commented Jun 22, 2023

I've updated my test and seems to work. No color issue using linear colorspace. https://github.com/danrossi/three-webgpu-renderer/blob/master/tests/webgl_video_panorama_equirectangular_nosrgb.html#L121

They are looking at my own ticket which is not frame dropping related but cpu. https://bugs.chromium.org/p/chromium/issues/detail?id=1456882&q=SRGB8_ALPHA8&can=2

@mrdoob
Copy link
Owner

mrdoob commented Jun 22, 2023

I've recently come across this issue when trying to render a 4K video in Three.js VR using an Oculus Quest 1.

/ping @rcabanier

@danrossi
Copy link

danrossi commented Jun 23, 2023

WebGPU issue is much worse in the other ticket. The chrome people reported 35-40% cpu but my Ryzen produces 20% cpu. And not sure if it's a chrome problem yet With WebGL Oh no this isn't good. I just rechecked firefox and producing the same cpu usage with srgb as Chrome. And low cpu usage with the linear work around. So maybe I wasted my time reporting it to Chrome. I'll try and make a vanilla webgl texture test to see what is going on with the format.

high cpu in Firefox - https://danrossi.github.io/three-webgpu-renderer/tests/webgl_video_panorama_equirectangular.html
low cpu in Firefox - https://danrossi.github.io/three-webgpu-renderer/tests/webgl_video_panorama_equirectangular_nosrgb.html

@danrossi
Copy link

danrossi commented Jun 24, 2023

My chrome issue got merged into the one referenced here as its the same problem. I found a work around but for video. I'm about to make vanilla webgl texture tests with the different formats set. If you use video callback instead of 60fps animation it uses less cpu.

https://github.com/danrossi/three-webgpu-renderer/blob/master/tests/webgl_video_panorama_equirectangular_30fps.html#L157

I have a throttled animation frame solution as fallback in my animation

https://github.com/danrossi/three-webgpu-renderer/blob/master/src/util/VideoAnimation.js#L20

UPDATE:

I made a bunch of vanilla webgl tests. SRGB format at 30fps is 1-5%. at 60fps its 14% and chrome freezes. I have to update chrome ticket.

https://danrossi.github.io/three-webgpu-renderer/tests/webgl_vanilla_srgb.html
https://danrossi.github.io/three-webgpu-renderer/tests/webgl_vanilla_srgb_60fps.html

with the other non srgb format its low cpu at 60fps

https://danrossi.github.io/three-webgpu-renderer/tests/webgl_vanilla_nosrgb_60fps.html

@ashconnell
Copy link
Contributor

Is it worth considering adding this shader decoding (back) into the ThreeJS codebase?

Without it, most new and existing users aren't going to know that they need to add an obscure shader found in this issue, in order to make sure videos have acceptable performance in ThreeJS.

@danrossi
Copy link

danrossi commented Jul 29, 2023

Claims to have been fixed in Chrome Canary on Jul 9th. Need to check it now.

Update:.Nothing changed.

I just checked Chrome canary. And I still get 10-13% cpu and 6-7% gpu usage with video textures.

No SRGB fix 0.7-1% cpu and 2.1% gpu usage

@danrossi
Copy link

danrossi commented Aug 1, 2023

I've created a custom material module for this purpose with tests. I reported to chrome the resource issue with a vanilla example but got glazed over. It's when this is used for texture render of video

gl.texImage2D( gl.TEXTURE_2D, 0, gl.SRGB8_ALPHA8, gl.RGBA, gl.UNSIGNED_BYTE, video);

https://github.com/danrossi/three-webgpu-renderer/blob/master/build/linearsrgb-material.module.js

https://danrossi.github.io/three-webgpu-renderer/tests/webgl_video_panorama_equirectangular_nosrgb.html

example bundling

https://github.com/danrossi/three-troika/blob/main/three.rollup.config.js#L113

@danrossi
Copy link

danrossi commented Aug 2, 2023

I noticed something was reverted which will be hard to keep builds future proofed. I'm sorry I just checked Canary with vanilla texture render and cpu is low. It's in three somewhere like the webgpu issue.

vanilla seems ok to me although no srgb vanilla is less cpu which I have updated the chrome ticket about.
https://danrossi.github.io/three-webgpu-renderer/tests/webgl_vanilla_srgb.html

https://danrossi.github.io/three-webgpu-renderer/tests/webgl_vanilla_nosrgb.html

cpu jumps up in three. I'm not sure what the issue is but they may have fixed it.

https://danrossi.github.io/three-webgpu-renderer/tests/webgl_video_panorama_equirectangular.html

The srgb cpu usage has dropped iin Canary but there is an obvious difference using RGBA8

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

Successfully merging a pull request may close this issue.