src/image_util/loadimage.h


Log

Author Commit Date CI Message
Amirali Abdolrashidi f27d1719 2025-07-29T16:41:27 Vulkan: Prefer BGR565 for RGB565 if enabled Some platforms exhibit better performance when using BGR565 instead of RGB565, including when loading buffer data to the image. This change allows such platforms to use a BGR565 image in the backend instead of an RGB565 image when using Vulkan, when the corresponding flag is enabled: preferBGR565ToRGB565 * Updated the formats to include B5G6R5 as a fallback to R5G6B5, which would be triggered when the corresponding feature flag is enabled. * The only exception would be when the surface is being initialized as R5G6B5. * In addition, this format will not be subject to forced format fallback. * Added VVL skip that specifically does not allow undefined format for border color for certain formats, including B5G6R5 if flag enabled. * Some suites with RGB565 tests will be run with preferBGR565ToRGB565 enabled on SwS to provide better test coverage. Bug: b/409867243 Change-Id: Ibb8c71b024ba318862f62ded8abd2d07835e8a40 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6799253 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Amirali Abdolrashidi ad7ee7fa 2025-09-08T11:53:57 Fix RGB565/BGR565 loading functions The BGR565-related loading functions seem to have been defined based on D3D11, especially since D3D11 only has format support for B5G6R5. However, if other backends, such as Vulkan, try to use BGR565, the loading functions do not work as intended. This change aims to correct the loading functions in order to have a single loading methodology for all backends, and to prepare for the future changes that allow the proper usage of B5G6R5 for Vulkan. * Updated the component order in the loading functions related to RGB565 and BGR565. * Updated D3D function map and data related to BGR565 for consistency. * Reverted the PackPixels() exception for RGB565 in Renderer11. * Fixed typo in D3D format data. Bug: b/441803462 Bug: b/409867243 Change-Id: I4d3e497a9435bd65bdf64b527b094267a0353cb8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6916353 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Sungyong Choi 2b8f216c 2025-08-13T08:44:34 Fix GCC -Wdeprecated-copy warning in ImageLoadContext Add an explicit copy assignment operator to ImageLoadContext to replace the implicitly-declared, deprecated version. This makes the intended assignment behavior explicit and silences the GCC warning when assigning a default-initialized value. BUG: angleproject:438226513 Change-Id: I44d9b8bf12c5e3172d30ce5413460d881e61449b Signed-off-by: Sungyong Choi <sywow.choi@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6845482 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Panfeng Hou a504b6a2 2024-11-25T15:59:05 Support GL_OES_required_internalformat Enable GL_OES_required_internalformat GLES extension. Bug: angleproject:364069034 Change-Id: Ia57548469abff189472aa20b13ca99179c45f2c0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6038448 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Panfeng Hou <panfeng.hou@arm.com>
Liza Burakova 4f498eaa 2024-07-24T14:31:23 WebGPU: Add more format support This CL adds a new FormatTable class that initializes webgpu texture and vertex formats. It also adds this class to the display so it can be used in the ImageHelper. This CL changes the previously hardcoded RGBA8 texture format that was initially used when creating textures to use the format passed into the methods. Bug: angleproject:344814096 Change-Id: I768b85335329116496dbf721aac54d1137aaae9f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5660397 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Liza Burakova <liza@chromium.org>
Hailin Zhang 76608554 2023-10-02T15:07:45 Vulkan: use cpu transcoding for small texture size. Bug: b/250042517 Change-Id: I9a70fb7d4823d10b09f498bfc01b5384951e2ce4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4908660 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Hailin Zhang <hailinzhang@google.com>
Alexey Knyazev 17931e23 2023-01-27T00:00:00 Fix stencil and depth/stencil data uploads Multiple changes were made to depth and stencil load functions, removing redundant code and fixing issues. Failures were caused by incorrect assumptions about component locations in combined formats. * D32_FLOAT_S8X24_UINT has the same layout as GL_FLOAT_32_UNSIGNED_INT_24_8_REV * D24_UNORM_S8_UINT has stencil data in its MSBs, while GL_UNSIGNED_INT_24_8 puts it in LSBs. Bugfixes * Added LoadD24S8ToS8D24 that swaps D24 and S8 components * Added LoadS8ToS8X24 for stencil-only uploads on D3D * Replaced LoadD24S8ToD32F with LoadD32ToD32F * Fixed D and S extraction in LoadD24S8ToD32FS8X24 * Fixed stencil load and store in LoadD32FS8X24ToS8D24 and LoadD32FS8X24ToD32FS8X24 * Fixed S8_UINT subresource updates in Vulkan * Fixed D24_UNORM_S8_UINT subresource updates from GL_FLOAT_32_UNSIGNED_INT_24_8_REV data in Vulkan Cleanup * Renamed LoadUNorm16To32F to LoadD16ToD32F * Removed LoadUNorm32To32F, replaced it with LoadD32ToD32F * Renamed LoadR32ToR24G8 to LoadD32ToX8D24 * Renamed LoadD32FS8X24ToD24S8 to LoadD32FS8X24ToS8D24 * Removed unused LoadG8R24ToR24G8 * Removed Metal-specific LoadS8D24S8ToD32FX24S8, made use of the fixed LoadD24S8ToD32FS8X24 instead * Simplifed LoadD24S8ToD32F Added Texture2DTestES3.TexImageWithStencilData. Fixed: chromium:1408004 Fixed: angleproject:5317 Change-Id: I231345353aa4a7cebe46ded8458ac80de2c59e01 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4203427 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Shahbaz Youssefi 025504b9 2022-10-17T17:03:03 Pass worker pools to image load functions In preparation for the ASTC decoder using threaded decoding. Bug: b/250688943 Change-Id: I70d669bcb57b900dbb633304182e174aec362203 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3961339 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Greg Schlomoff <gregschlom@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Constantine Shablya ff7aa214 2022-09-29T19:56:28 GL_PALETTE* sampling Implement GL_PALETTE* formats by decoding them into a R8G8B8A8_UNORM image at load time. Test: angle_end2end_tests --gtest_filter="PalettedTextureTest.*" Bug: angleproject:7599 Bug: angleproject:7688 Bug: angleproject:7710 Change-Id: I94d51e2c480fcdd39f1a0ad241b311d3b4de1579 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3863251 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Constantine Shablya <constantine.shablya@collabora.com>
Constantine Shablya e82eaff9 2022-09-22T16:01:06 Stubs for paletted images Bug: angleproject:7599 Change-Id: Idb49f8ba07ebd3b6cad461fa9e90b856af666183 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3909396 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Constantine Shablya <constantine.shablya@collabora.com>
Lubosz Sarnecki 45e5cf01 2022-06-03T14:29:23 Vulkan: Implement ASTC emulation. Implement ASTC emulation using the astc-encoder library. Add copy_image tests to deqp_gles31_test_expectations for desktop cards. Add emulatedAstc limitation. Don't expose emulated ASTC from WebGL contexts. Introduce ANGLE_HAS_ASTCENC define to check for build availability. Only build on angle_standalone configurations. DEPS: Add astc-encoder. image_util: Decode ASTC to RGBA. TracePerfTest: Skip car_chase and genshin_impact on NVIDIA. Bug: angleproject:7415 Change-Id: Ib2f3fd3f710164a2ecd5d5edf780227031bbfb84 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3697999 Commit-Queue: Lubosz Sarnecki <lubosz.sarnecki@collabora.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Gregg Tavares 604610b4 2021-11-01T12:03:31 Metal: Use Depth32F for DEPTH_COMPONENT16 depth16unorm is broken on Metal. This is a workaround. Bug: angleproject:6597 Change-Id: I1748f9fab587b22980d13e8a141fa880eb6f9db0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3255666 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
Mohan Maiya 5c8bf081 2021-06-08T13:12:24 Vulkan: Add support for YUV internal format extension 1. Add a function to upload YUV image data to textures 2. Modify stageSubresourceUpdate method to account for YUV images 3. Create VkSamplerYcbcrConversion when initializing ImageHelper 4. Update hasImmutableSampler to account for native YUV format support 5. Skip initializeNonZeroMemory for YUV formats Bug: angleproject:5773 Test: Texture2DTestES3.TexStorage2D*Yuv*Vulkan* Change-Id: I270f04bbf903cf2bf19f100eb95f32953d491c39 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2947767 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Courtney Goeltzenleuchter cb2b5136 2020-01-10T11:04:38 Vulkan: Simplify format table generation Remove the "override" table. That gets in the way of some solutions. If a format cannot be supported by a native Vulkan format as indicated in the "map" table, then check fallbacks. Also add support for native RGBA4 and R5G5B5A1 support. Previously those formats would be emulated with RGBA8 due to the override, but now code will check if the native format is available and use it. Bug: angleproject:4282 Change-Id: Ib33ea40543d91a2c2a95075b277f825a8822037c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1994538 Reviewed-by: Tobin Ehlis <tobine@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Geoff Lang 2fa9d734 2019-10-07T16:35:38 Partially Revert "Convert DXT1 RGB data to DXT3 RGBA when uploading to the GPU." This reverts commit e6582161b04beaa368f3081897912ede89d7800d. Remove the DXT1->DXT3 transcoding but leave in the MacOS workarounds for fixing the alpha channel of DXT1 textures. BUG=angleproject:3729 Change-Id: Ib276c1e4a58155866da8c661cba2063a4e4304fe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1846015 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Courtney Goeltzenleuchter a333b87c 2019-09-27T14:00:14 Vulkan: Handle D24 -> D32FS8X24 depth fallback Swiftshader's depth support requires that ANGLE fall back to using the D32FS8X24 depth format. Some conversion routines needed to be added to support that use. Test: dEQP.GLES3/functional_texture_format_sized_* Bug: angleproject/3937 Change-Id: I979dc5e9b01dac40f564daad4f4817b61bd056ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1829170 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang e6582161 2019-09-16T12:39:18 Convert DXT1 RGB data to DXT3 RGBA when uploading to the GPU. DXT1 has a specific 'BLACK' code that results in transparent black pixels when sampled. D3D does not have specific RGB-only DXT1 formats like OpenGL does so when this code is encountered, we sample 0 alpha for these pixels when GL would expect 1 because the alpha channel should not exist. Work around this by converting to DXT3 RGBA, adding an extra block of 1.0 alpha pixels for each color block. Mac Intel OpenGL requires additional workarounds to always sample 1.0 alpha. Set the texture swizzle parameters to force it. BUG=angleproject:3729 Change-Id: Ia3647085acd97bb01af4e95ef3f6f21dcfb6a554 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1804880 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Jaedon Lee 3b46885e 2019-07-30T16:50:36 Vulkan: Implement EXT_texture_type_2_10_10_10_REV - Expose GLES 3.0 feature of 2_10_10_10_REV texture type on GLES 2.0 as EXT. - Handle alpha channel value as 1.0 when used with RGB format. - Add test for "RGB+UNSIGNED_INT_2_10_10_10_REV" case into TextureUploadFormatTest. BUG=angleproject:3232. Test: dEQP-GLES2.capability.extensions.uncompressed_texture_formats.GL_EXT_texture_type_2_10_10_10_REV dEQP-GLES2.functional.fbo.completeness.renderable.texture.*2_10_10_10_rev dEQP-GLES3.functional.fbo.completeness.renderable.texture.*2_10_10_10_rev KHR-GLES2.core.internalformat.*2_10_10_10_rev* KHR-GLES3.core.internalformat.*2_10_10_10_rev* Change-Id: Iac00517971f9242161115c7256117a69093fb5df Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1732618 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Courtney Goeltzenleuchter 01867144 2019-07-19T14:51:29 Vulkan: Add support for D32F_S8 depth_texture Test: angle_deqp_khr_gles3_tests --deqp-egl-display-type=angle-vulkan --gtest_filter=dEQP.KHR_GLES3/packed_depth_stencil_verify_read_pixels_depth24_stencil8 angle_deqp_khr_gles3_tests --deqp-egl-display-type=angle-vulkan --gtest_filter=dEQP.KHR_GLES3/packed_depth_stencil_clear_buffer_depth32f_stencil8 Full passing results are blocked by suspected driver issues: Bug: angleproject:3683 Bug: angleproject:3689 Bug: angleproject:3457 Change-Id: I7ce1a7824802ebca2c0479a3467fac26013829eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1704791 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tim Van Patten cbabea73 2019-07-11T17:24:17 Vulkan: Desktop ETC/EAC formats support Initial attempt to give desktop ETC/EAC formats support. Bug: angleproject:3676 Change-Id: Id147b0c1808e30df77097d0c7ff6a06534554b93 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1699307 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang d9c17107 2019-07-10T14:56:26 Add support for GL_OES_texture_compression_astc This extension adds 3D compressed texture formats, something ANGLE has not seen before. This requires tracking a compressed block depth for validation and image size computations. Update the ldr and hdr extension checks to be in line with the spec. HDR requires LDR and is not detectable by texture formats alone. Expose all of the ASTC extensions on the GL backend. BUG=angleproject:3675 Change-Id: Id04c7c8ef8541e9556579536cdba899b64303caf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1695923 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Courtney Goeltzenleuchter 943fe34e 2019-06-24T16:51:57 Vulkan: Upload packed depth-stencil Bug: angleproject:3437 Test: angle_end2end_tests --gtest_filter=DepthStencilFormatsTest.VerifyStencilData/* Change-Id: Iffab48eaea6aa35888560859e9f502a4f814b833 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1674663 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Tom Anderson 08146a27 2019-05-17T10:40:44 Remove non-source sources from binary targets No behavior changes. BUG=chromium:964411 Change-Id: I843757e65f110882c01514fe6bf4aed28e07dd21 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1617011 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 507e8d30 2019-03-15T16:49:48 Add missing entries in texture load functions map GetLoadFunctionsMap() is expected to cover all possible combinations of texture internalformat and upload data format. Several of these combinations were missing, especially w.r.t to compressed types. This change adds the missing combinations that are hit on any of the configurations being tested. An assert is added to catch missing conversion functions in the future. Bug: angleproject:2670 Change-Id: I793ac2c57f65eeb1cc8da8f1b223f6a9a44c7708 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1524462 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 44dcb911 2018-02-02T12:51:41 Decode R11 and RG11 EAC formats into 16-bit textures. 8-bit textures are not precise enough but no tests were failing because dEQP was using 4-bit backbuffers. Preserve the old decode-to-8-bits paths because they are still used by Chrome. BUG=angleproject:2336 Change-Id: Ieb651325e2a05c85bcc97f8e6d868afaf37aff0d Reviewed-on: https://chromium-review.googlesource.com/899701 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Minmin Gong 390208b5 2017-02-28T18:03:06 Implements ETC lossy decode for ETC2 formats. This is the 2nd payload of GL_ANGLE_lossy_etc_decode feature. In this change, RGB8, SRGB8, RGB8A1, and SRGB8A1 formats in ETC2 family can be converted to BC1. BUG=angleproject:1285 Change-Id: I96fe2f07c62716a31d37f20a202b6cabbb4ebbd2 Reviewed-on: https://chromium-review.googlesource.com/447846 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 4107dda9 2016-07-13T14:19:49 Clamp float32 depth data when uploading. BUG=angleproject:1095 Change-Id: I4c272aef0f94733fc7b5297ddaa1fa2bc765fe62 Reviewed-on: https://chromium-review.googlesource.com/360029 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang 5695fc99 2016-07-05T14:47:30 Clean up the SSE detection logic. * Include the correct header right in the SSE check in platform.h. * Don't use separate SSE versions of the load functions, have them use SSE automatically. BUG=612205 Change-Id: I70f9a5513e144db4d16c1f3ad922debeb6c50268 Reviewed-on: https://chromium-review.googlesource.com/358108 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang 6e4cfceb 2016-06-13T15:06:31 Refactor ANGLE's image manipulation code into a static library. Allows for chromium to make use of some of the functionality. BUG=612205 Change-Id: Ib4435ca44775a3a554b0fb3bd384bd4d31d7952d Reviewed-on: https://chromium-review.googlesource.com/351753 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>