src/libANGLE/renderer/vulkan/ShaderInterfaceVariableInfoMap.cpp


Log

Author Commit Date CI Message
Charlie Lao 8fcd4a50 2023-09-19T14:08:14 Cleanup POD struct usage to make them more consistent In recent months, I have made many CLs to wrap various data structures into a trivially copy-able struct. Some of them uses different terminology. This CL replaces all of these to use a consistent name "pod" in the struct, and "mPod" in a class. This CL also turns ActiveVariable methods into macros to remove the code duplication. This CL also moves ProgramInput/ProgramOutput struct implementations from Program.cpp to ProgramExecutable.cpp Bug: b/275102061 Change-Id: Ia2a4210a9ea633f3d323bebe674ee74f8b90b363 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4877335 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com>
Charlie Lao 204c07a5 2023-09-07T10:49:08 Initialize bitfield using constructor default member initializer for bit-field is a C++20 extension. This CL changes it to use constructor to avoid build failure. Bug: b/296433003 Change-Id: I33a45394644719b160f71eadca3a85a4d92f5c4e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4849554 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 632ded9e 2023-09-01T13:43:11 Load ShaderInterfaceVariableInfoMap data members with readStruct This CL groups the remaining data members of ShaderInterfaceVariableInfoMap into a POD (plain old data) struct and load it with readSTruct call (and save it with writeStruct). This CL also uses readVector for mDefaultUniformBlocks[shaderType]->uniformLayout instead of individual reads of each basic elements. Bug: b/296433003 Change-Id: I48b508822cb414cea75a6e384a0794f245460f57 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4833690 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 014e584f 2023-08-21T15:51:30 Vulkan: Separate out XFB data from ShaderInterfaceVariableInfo Right now the transform feedback data is embedded in the ShaderInterfaceVariableInfo. This caused ShaderInterfaceVariableInfo becomes non-trivial copy-able. This CL moves transform feedback related data out and into its own array, and entire vector of ShaderInterfaceVariableInfo is now memcpied. Further, most programs don't use transform feedback. Right now because transform feedback data is embedded in the ShaderInterfaceVariableInfo, it bloated the size of ShaderInterfaceVariableInfo even if you do not use XFB. This CL makes transform feedback variable info data a std::unique_ptr so that if not used, it is just a nullptr. When we load/save the structure, the ones that has nullptr gets skipped. Bug: b/296433003 Change-Id: I61940a683611717ab0445fcbf44b89b1b7166ee4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4799344 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com>
Charlie Lao a8d77dc4 2023-08-18T15:23:39 Vulkan: Move mVariableInfoMap load/save to its own class This is mechanical change only. This CL moves mVariableInfoMap load/save logic from ProgramExecutableVk to ShaderInterfaceVariableInfoMap class. Bug: b/296433003 Change-Id: I9a934fd2223c559fba899f166e40efc17fa1be2e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4794752 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Roman Lavrov <romanl@google.com>
Shahbaz Youssefi ec1f18db 2023-06-21T10:16:51 Vulkan: Remove ShaderVariableType and flatten info map With the conversion of the interface variable info map keys to SPIR-V ids, there is no longer a benefit to bucket resources by their type. This change removes this bucketing and flattens the map. Bug: angleproject:7220 Change-Id: If83cb02ca9e91f72dddb2deb7313fee40f9f06c3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4632577 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b5f87c04 2023-06-20T20:22:15 Vulkan: Simplify shader interface variable map The shader interface variable map had a "resource index" -> info map to optimize descriptor set building. That avoided hashing the resource name when the rest of the map was name-based. With the map using SPIR-V ids now, there is no reason to maintain this map; SPIR-V ids can be used to look up the info just as efficiently. Bug: angleproject:7220 Change-Id: I619783dce558a59184955cc314c1f41e6733f1b7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4630728 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 16d65289 2023-06-20T17:27:01 Vulkan: Remove hashing of the SPIR-V id in variable map The interface variable ids are already mostly packed, so a flat array will do with the id as key. Bug: angleproject:7220 Change-Id: I17cded0378b1b67379b979b00d69bbe04088a840 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4628975 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c1ba8e6f 2023-06-20T16:03:20 Vulkan: Flatten shader interface variable maps This change removes duplicate entries added in the shader shader interface variable maps. One level of arrayness (indexed by shader type) is removed from these maps as now there is only a single entry per linked resource/etc. Bug: angleproject:7220 Change-Id: Ibf2d06a0e1f68e68797c2066f36e14cb9e667f77 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4628677 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi bbcf54bc 2023-06-16T16:02:08 Vulkan: Refactor uniform/block binding duplication code Previously, resource binding assignment was done as such: ``` for each shader stage assign bindings to textures assign bindings to blocks assign bindings to images etc ``` To deduplicate bindings when the same resource was used in multiple stages, a map was used, keyed by the resource's name, to detect when an already visited resource is encountered in a future stage. This was both inefficient and unnecessarily complicated. With this change, resource binding assignment is done as such: ``` for each texture assign one binding to all shader stages for each block assign one binding to all shader stages for each image assign one binding to all shader stages etc ``` The aforementioned map is removed. Because the resource bindings are now changed, the rest of the code (which sets up the pipeline layout, updates descriptor sets, sets dynamic buffer offsets, etc) are all updated to follow the above pattern. As a result, nested loops are avoided and duplicate entries in the variable map are never visited. Bug: angleproject:7220 Change-Id: Iaff7b5f8b2bada8ac5078d21e5c790bf0d27aca7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4622011 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 24f4007b 2023-06-08T00:41:55 Vulkan: Use SPIR-V ids instead of names in the transformer This change removes the SPIR-V transformer's reliance on type and variable names. As a result: - String hashing is removed from the info map data structure and the SPIR-V transformer - The ID discovery class is entirely removed - Internal variable names have become a detail of the compiler alone (and are no longer exposed as part of the compiler interface) - Some front-end name tracking is removed ("parentStructMappedName", etc) This change also properly cleans up xfb emulation types that were previously left over. This change allows the SPIR-V compiler to emit user strings as-is instead of prefixing them with `u_` leading to more readable debug shaders. Additionally, it will make it possible not to emit debug info at all. Both of these changes will be done in follow ups. Bug: angleproject:7220 Change-Id: Iaa127496209a27aaae2e0d14c41b22fffb0b72a2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4600610 Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi acdf8722 2023-06-07T11:26:37 Vulkan: Remove reliance on names for gl_PerVertex-trimmer Instead of passing in gl_Position etc built-in names and then find their index by looking at OpMemberName instructions, this change has the front-end create a bitset of active gl_PerVertex members. The SPIR-V transformer then directly uses this information to trim gl_PerVertex. Bug: angleproject:7220 Change-Id: I5c3d56784801abb310d09d98d9c82c9e6e019de8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4600608 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 40c17b58 2022-12-13T15:35:23 Vulkan: Move SPIR-V transform to vulkan/ No longer used by metal/. Bug: angleproject:7220 Change-Id: Idb3a6369fefbcf87e7993daa652c8702ec53c20f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4104002 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com>