src/libANGLE/renderer/Format.h


Log

Author Commit Date CI Message
Roman Lavrov 31ccf78b 2025-01-07T15:46:15 Inline GetVertexFormatID using lookup tables Before this change the switch produced >1KB of assembly due to all the branching. This reduces the .so size by ~3KB and avoids the function call into a seemingly cold page. No obvious perf improvement in my tests from just this change. Changing underlying enum type to minimize table sizes. Bug: b/383305597 Change-Id: I724aa093ab5edf7af016b5b04764437a345517d1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6153395 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Rafay Khurram 9db2e88b 2024-05-14T11:44:01 CL/Vulkan: Add support for required image formats * Included adding cases for CL_DEPTH, CL_DEPTH_STENCIL, CL_sRGBA, and CL_BGRA Bug: angleproject:42266936 Change-Id: Ie7bd3ee6c6413d8fa89357c81d19f4c807883f36 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5800265 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
hoonee.cho 2ee914a4 2024-03-04T06:54:29 CL: Add cl_image_format map autogeneration * Added map JSON files containing CL image formats * Updated ANGLE format table generator to include CL foramts Tests-Passing: GN Build Signed-off-by: hoonee.cho <hoonee.cho@samsung.com> Bug: angleproject:42266936 Change-Id: I2967ea6d26f69223ffa3ca12d469c05a3844200f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5798054 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Rafay Khurram <r.khurram@samsung.com>
Shahbaz Youssefi 86e21fa2 2023-06-12T13:36:21 Vulkan: Refactor angle::Format depth/stencil checks Bug: b/246008627 Change-Id: If0a2992c5bd66adf27c6866aea04e54ba465a522 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4608489 Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Mohan Maiya 5163cd0c 2021-03-18T18:17:11 Add isYUV to angle::Format In preparation for adding support for more YUV formats add an 'isYUV' field that tracks whether a format is a YUV format. For now it is set if the format string contains the substring 'PLANE'. This is not the case for all known YUV formats but the condition can be expanded when required. Bug: angleproject:5773 Change-Id: Icb574037dc8105584931835dab0b60e8bafa3262 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2774762 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Jamie Madill 2e9706d8 2021-01-08T17:29:42 Vulkan: Use angle::FormatID instead of VkFormat. This change switches the internal enums we pass around from VkFormat to FormatID. The end goal of the refactor is to allow the Vulkan back-end to store packed tables indexed by FormatID. Because VkFormat has large gaps in its enum space we'd otherwise need to use unordered data structures like unordered_map. The change removes the redundant VkFormat storage from vk::Format and uses a new table query to return the VkFormat that 1:1 matches an angle::FormatID. We also include a reverse mapping for use with native Vulkan get functions for Android. Also moves sRGB conversion functions into renderer_utils. A couple sRGB formats that don't exist in GL are no longer handled by the sRGB conversion functions. These formats should be extremely rare. Bug: angleproject:5438 Change-Id: Id8b49773ca0c556f9f5a6a10fcf0d9762b93bbea Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2618204 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi acf004a1 2020-11-19T16:58:30 Vulkan: Use transfer more opportunistically with copyTextureCHROMIUM If the difference between formats is sRGB vs not or normalized vs integer, still allow the transfer path to be taken. Bug: b/159211070 Change-Id: I53334812ed29baec6ad434de1fcd6dde35049c12 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551534 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 5f7eeb93 2020-10-17T11:52:40 Add isSRGB flag to angle::Format. Bug: angleproject:5176 Change-Id: I85fc78206456439ba7dab55c093187fb94364823 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2482290 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Mohan Maiya 7bbe497a 2020-10-16T14:46:45 Vulkan: Implement EXT_texture_sRGB_decode Implement EXT_texture_sRGB_decode. This builds on the existing functionality from EXT_texture_sRGB_override, with 2 major edge cases: 1. sRGB_decode allows the texture state to be overridden by sampler state, which is implemented by forcing a a texture state sync during updateActiveTextures if a texture is bound to the same unit as a sampler with that state 2. texelFetch calls require us to reenable decoding, regardless of decode state. We add a new compiler pass (FlagSamplersWithTexelFetch) to mark samplers that are used with texelFetch in order to support this. This change also re-enables EXT_texture_sRGB_R8, which was disabled due to a dEQP bug that this change will bypass. Bug: angleproject:3609 Bug: angleproject:4503 Test: dEQP.GLES31/functional_srgb_texture_decode_skip_decode_* Test: GLES31/functional_state_query_texture_*_srgb_decode_* Test: GLES31/functional_state_query_sampler_*_srgb_decode_* Test: GLES31/functional_debug_negative_coverage_*_srgb_decode_* Test: GLES31/functional_android_extension_pack_extensions_ext_texture_srgb_decode Test: angle_end2end_tests --gtest_filter=SRGBTextureTest.*Vulkan* Change-Id: I4a67e487dc82e2f57c8c87d4bcd8ef442b6fe220 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2359481 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Hyunchang Kim d4c75347 2019-09-18T10:49:34 Vulkan: Enable GPU conversion from RGB16F to RGBA16F - Add proper GPU conversion routine when the source and destination format of vertex attribute is half float data type. - Add an end2end test which utilizes half float GPU conversion path. Bug: angleproject:3802 Test: angle_end2end_tests --gtest_filter=*VertexAttributeTest.HalfFloatBuffer* Change-Id: Ia88a4984156f8967796bea3852c3cde714f2acab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1824799 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Mohan Maiya 8400d05c 2019-08-07T14:52:54 Vulkan: Support the vertex_type_2_10_10_10_rev format - Modify the python script and json file to generate the code which adds the function for vertex_type_2_10_10_10_rev. These functions handle the loading and conversion for vertex_type_2_10_10_10_rev. - Modify ConvertVertex.comp and ConvertVertex.comp.json to perform a GPU based conversion for vertex format of type 2_10_10_10_rev - Modify BindingIsAligned function to check that both stride and binding offset is aligned to the format size when the component size is not aligned to 8 bits. - Modify deqp3 expectations file to enable type_2_10_10_10_rev format vertex array tests. Bug: angleproject:3193 Test: dEQP-GLES3.functional.vertex_arrays.single_attribute.*2_10_10_10* Change-Id: I2358d0d8888f7dfd7eac999dc150f643167de817 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1709035 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill ee21a187 2019-07-04T08:51:34 Store angle::Format in gl::VertexAttribute. Instead of storing type/size/normalized/pureInteger we instead store a pointer to the angle::Format. This makes some code logic simpler and will let us more easily check if a vertex attribute format changes in calls to VertexAttribPointer or VertexAttribFormat. This CL adds extra information to angle::Format to represent the vertex format info needed. It also caches the channel count so that it can be queried faster. Also renames "Int" -> "Sint" in UtilsVk for consistency. Bug: angleproject:3256 Change-Id: I5ef9b983dad8a58c341113c802500b89ce081566 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1684293 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Jamie Madill ab2bfa81 2019-01-15T19:06:47 Enable Chromium clang style plugin for libANGLE. This fixes a few style warnings: * auto should not deduce to raw pointer type * inlined virtual methods are not allowed * non-trivial constructors and destructors should be explicit * inlined non-trivial constructors should not be in-class * missing override keywords Bug: angleproject:3069 Change-Id: I3b3e55683691da3ebf6da06a5d3c729c71b6ee53 Reviewed-on: https://chromium-review.googlesource.com/c/1407640 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill dbc605ce 2019-01-04T16:39:14 Vulkan: Optimize VBO state changes. Also has some minor optimizations for the front-end. 12% improvement on the Vulkan VBO change test. Bug: angleproject:3014 Change-Id: I38e1a8194edfc14bfe57424be348cb9688e928f4 Reviewed-on: https://chromium-review.googlesource.com/c/1369286 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi f83a28a6 2018-12-09T03:48:34 Vulkan: Shader path for framebuffer-to-texture copy Part 1 in a series of changes to perform image copies on the GPU. Bug: angleproject:2958 Change-Id: I6264a880865c4738c0866f2dc71af63425fc4118 Reviewed-on: https://chromium-review.googlesource.com/c/1370724 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 611bbaab 2018-12-06T01:59:53 Vulkan: Convert vertex attributes in compute In this commit, VertexArrayVk::convertVertexBuffer() is renamed to VertexArrayVk::convertVertexBufferCpu() to explicitly show it does a CPU readback. A new VertexArrayVk::convertVertexBuffer() function is added that has the same functionality in gpu (with some assumptions, where the CPU fallback is used should those assumptions fail). Currently, the only requirement is that buffer offset/stride are divided by the component size. ConvertVertex.comp is the shader responsible for this conversion, and it implements the functionality in renderer/copyvertex.inc, minus a few functions that are not used in the Vulkan backend. Bug: angleproject:2958, angleproject:3009 Change-Id: I8ec9a5f4672509bcf7b9e352cd27663970ad4653 Reviewed-on: https://chromium-review.googlesource.com/c/1364451 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 115e8a26 2018-09-26T07:51:30 Vulkan: Store "is packed" in buffer formats. This more easily allows us to compute the format alignment for use with the vertex input stage. Bug: angleproject:2797 Change-Id: If15281ce18fbed743b6a0c843cece4626bc4ce72 Reviewed-on: https://chromium-review.googlesource.com/1245841 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 522095f7 2018-07-23T14:59:41 Rename "color" functions to "pixel" functions. This extends of the copy, read and write functions to cover depth and stencil formats. Refactoring change only. Bug: angleproject:2673 Change-Id: I4b0b2f4cf8621051cacd95cdbd6d70f94ca612e2 Reviewed-on: https://chromium-review.googlesource.com/1147152 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill db9c69ed 2018-07-18T17:23:47 Make PackPixels take an angle::Format. This removes the format type parameter from places where it isn't needed. It also removes the 'write color' functions map. This map was redundant with the angle::Format write function. Bug: angleproject:2729 Change-Id: I24e4548a89342237d7ed25180fea156fba51ccab Reviewed-on: https://chromium-review.googlesource.com/1142300 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill ba365939 2018-07-18T17:23:46 Rename angle::Format::ID to angle::FormatID. This allow for predeclaring the enum. It solves some include dependency issues. Bug: angleproject:2729 Change-Id: Ibbbab0796e466c62848404ba277c5f454fd9ac62 Reviewed-on: https://chromium-review.googlesource.com/1142299 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 26084d0a 2018-04-09T13:44:04 Vulkan: Create TextureVk's Image lazily. This defers the actual Image initialization until the Image is used as either a Framebuffer Attachment or OpenGL Texture object. This will allow us to construct an Image from multiple sub resources, like when we're initializing a mip chain, or a cube map texture. Also adds a helper "hasDepthOrStencilBits" function to angle::Format. Bug: angleproject:2318 Change-Id: Ife861560216581a90fc6da32a583f69886c7daea Reviewed-on: https://chromium-review.googlesource.com/985202 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6816d843 2018-03-31T14:19:17 Add two new fields to angle::Format. One field determines if a format is a compressed format (called Block format for angle::Format, but basically the same). The second field is the number of bytes in the format, so we can do calculations on pixel size. Both of these will make life cleaner in the Vulkan back-end. Also solves some TODOs in the vk format table init. Bug: angleproject:2318 Bug: angleproject:2358 Change-Id: I8b021b959c5892c86635e0225012295e5e830256 Reviewed-on: https://chromium-review.googlesource.com/987524 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 7b62cf97 2017-11-02T15:20:49 Refactor TextureFormatMap to store an array. std::map lookups are already showing up as a hot spot during some profile trace analysis. We can elimintate these by only doing a single switch at the entry point level to convert the GL internal format to an internal identifier or type info pointer. This change doesn't completely fix the hot spot, since now we are doing multiple switch statements, but it does remove the std::map storage in TextureCapsMap. It replaces it with a flat std::array indexed by angle::Format::ID, and gives us the option in the future to eliminate all by one switch statement. This should allow for a faster texture caps implementation in Vulkan. This also fixes the missing ANGLE format entries for ETC1 compressed formats. BUG=angleproject:2207 Change-Id: I74ea2082e582a6790d5fde90e33246a618a2da0e Reviewed-on: https://chromium-review.googlesource.com/742375 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Geoff Lang aadc8f37 2017-08-11T17:34:44 Implement the CPU fallback for CopyTextureCHROMIUM on OpenGL. BUG=angleproject:1932 Change-Id: Iabc1a3e361d66313dc16bf19b392402b7836f8a5 Reviewed-on: https://chromium-review.googlesource.com/612562 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Geoff Lang 80616218 2017-05-17T15:40:03 Support CHROMIUM_copy_texture for all formats on D3D11. Adds a CPU readback and conversion path when the destination texture is not renderable. BUG=angleproject:1932 Change-Id: I71461ca991dc10dd636ff38e1ae20db2be0f8d63 Reviewed-on: https://chromium-review.googlesource.com/508308 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Frank Henigman aa7203ef 2017-05-03T23:32:29 Inherit privately from angle::NonCopyable. Make all inheritance from angle::NonCopyable private so the compiler complains about this (admittedly unlikely) code: class Foo: angle::NonCopyable { virtual ~Foo() { ... } }; angle::NonCopyable *p = new Foo; delete p; In the above code ~Foo() is not called, only ~NonCopyable(), because the latter is not virtual. Making it virtual would add overhead to all derived classes which don't already have a virtual method. Also tighten access in NonCopyable, because we can. BUG=angleproject:2026 Change-Id: Id0dc4d959cfb7bb82cf49382118129abb1d3a4f0 Reviewed-on: https://chromium-review.googlesource.com/495352 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 2bfc4119 2016-10-28T11:48:54 Put angle::Format table in a cpp file. The best practice is to expose a non-constexpr query function and hide the constexpr table in a cpp, so it won't be included verbatim in multiple other source files. BUG=angleproject:1389 Change-Id: Ic4e19d14c832643be1552c5a14e441826c41970f Reviewed-on: https://chromium-review.googlesource.com/404478 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 4f57e5f9 2016-10-27T17:36:53 D3D11: Make several format tables constexpr. This should guarantee the best memory access patterns. It introduces some indirections for some format queries, but most of these should be direct array lookups, or used infrequently. We can optimize this later if necessary. BUG=angleproject:1389 Change-Id: I5e2c8c530a07798494afd3ea36b6164d7564c02c Reviewed-on: https://chromium-review.googlesource.com/403314 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill e0548ad2 2016-10-06T15:55:35 D3D11: Split off DXGI component type query. This query is currently a part of a std::map. Split it off to its own switch using auto-generation based on the format string. Also introduce a DXGI-to-angle format map. This map is not totally complete because some more esoteric formats don't have corresponding ANGLE formats yet. We should add these other formats (EG NV12) if we need them. BUG=angleproject:1389 BUG=angleproject:1459 Change-Id: I49e045bdc04a52166299c9e22a4c4d3f24069dbc Reviewed-on: https://chromium-review.googlesource.com/392209 Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b80a5e9c 2016-10-05T16:39:09 Store channel bits info in angle::Format. This allows us to delete some duplicated code in the D3D11-side. BUG=angleproject:1389 BUG=angleproject:1459 Change-Id: Ifdcfcd4a56e06ff2ae8f5ca0bda72281d52c2964 Reviewed-on: https://chromium-review.googlesource.com/392208 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 30712068 2016-08-09T11:10:36 Move fast copy functions into angle::Format. These tables were duplicated in D3D11 and D3D9, and would have to be further duplicated into Vulkan. BUG=angleproject:1455 Change-Id: Ice1b81417d7b14f933b61861c4a9997c260ef72e Reviewed-on: https://chromium-review.googlesource.com/367690 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill a5b1561e 2016-08-09T11:10:27 Place format info in angle::Format. Some bits of information, like the copy functions and mipmap gen functions, can be shared across back-ends in the angle::Format class. Also name the info struct angle::Format, and use an enum class angle::Format::ID to identify the particular format. This patch introduces a new table generator for angle formats and updates the D3D11 generator accordingly. BUG=angleproject:1455 Change-Id: I13b8b98822b1186c6a9e436dc232c18fef50980c Reviewed-on: https://chromium-review.googlesource.com/365824 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 20f69ce5 2016-08-09T11:10:26 Introduce angle::Format enum. This general enum can encapsulate different formats between GL/Vulkan/D3D9/D3D11/etc so we can use them in common routines like PackPixels. It also can help us get rid of the ANGLEX enums which we use to represent internal formats not present in GL. It is currently used for Textures/Renderbuffers/Surfaces, but can also be extended in the future to cover things like vertex formats. It mirrors something like a DXGI_FORMAT in D3D11 or VkFormat. BUG=angleproject:1455 Change-Id: I467d7b36d8fc92bb45239d56b9243d06f4e29378 Reviewed-on: https://chromium-review.googlesource.com/365413 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>