src/libANGLE/renderer/vulkan/ProgramExecutableVk.h


Log

Author Commit Date CI Message
Jamie Madill a3961843 2022-02-04T08:45:34 Vulkan: Bind aligned default uniform buffer size. This makes us let reuse caches more often when uniforms change size slightly. It also simplifies the cache key management. Bug: angleproject:6776 Change-Id: I68ab48ab7761237bb9d28c4a4a88f4fc6e2c5af6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3439068 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 70c510eb 2022-02-03T07:54:29 Vulkan: Use common storage for descriptor set descs. This lets us avoid using templates when implementing descriptor set caches. As an added bonus, the key size now scales with the number of active items in the cache. In the case of using a smaller set of active textures, our keys now use sizeof(uint32_t) * (kFastBufferWordLimit) + sizeof(void *) bytes of storage (132/136) instead of sizeof(uint32_t) * 3 * 96 bytes (1152) per set. This reduction should improve cache coherency. Bug: angleproject:6776 Change-Id: I904fc5527ff033af927e25abe6d13d98142e3f14 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3436767 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 959d4be5 2022-02-03T08:03:14 Vulkan: Remove buffer get method from descriptors desc. This will make a future refactor to use a common desc class easier to implement. We have the necessary buffer already in the call context so we can instead pass this buffer down to where it gets used. Bug: angleproject:6776 Change-Id: Ia9782cba9f91c9604b1e937252bb293a346d025c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3436766 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7820ca23 2022-02-02T09:34:07 Vulkan: Binding available buffer range to descriptor. This is fully conformant with GLES including robustness, where robustness specifically allows returning any values in the buffer. The goal is to eventually remove all shader-variable-specific info out of the descriptor set update. This will let us fix cache bugs that pop up when we move the descriptor set cache to the share group. Bug: angleproject:6776 Change-Id: Iccef33ca6174a68e359a07dc957a276b2484f97f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3431725 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 168e0ae5 2022-01-27T16:50:00 Vulkan: Refactor descriptor pool code. This uses vk::Context to init DynamicDescriptorPool, and removes some accesses to ProgramExecutableVk member variables so the methods can more easily be moved into another class. The changes should have no effective behaviour difference. Note that the immutable sampler descriptor count is entirely set by the format of the immutable samplers. However we can't determine this count by looking at the descriptor set layout desc with the current implementation. Bug: angleproject:6776 Change-Id: I0a323d19fa3720b5afd8300401ed9c30b105c0ef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3424657 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kyle Piddington c4a9d416 2022-01-05T15:28:11 Metal: Refactor to build without SPIR-V Refactor ShaderInterfaceInfoMap and constant names to thier own files, allowing Webkit to build without needing to compile SPIRV code via mtl_glslang_utils.cpp. Bug: angleproject:6782 Change-Id: I7a9c7e387145c95807f780e24bd2764e0efb5709 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3364970 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kyle Piddington <kpiddington@apple.com>
Jamie Madill 4e644b33 2022-01-22T16:17:46 Vulkan: Remove ProgramExecutableVk back-pointers. This removes the mProgram and mProgramPipeline back-pointers from ProgramExecutableVk. In order to fix this, we needed to refactor the VkPipeline init functions to call through ProgramExecutableVk only instead of passing through ProgramVk. We also needed to move the early fragment shader optimization boolean out from Program. This CL also fixes a few places where the early fragment test optimization boolean wasn't properly updated. Bug: angleproject:3570 Change-Id: Ie4c48087f6eb022e6f0a4dacc2710085165d49e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3408267 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7c1346bd 2022-01-21T11:35:45 Vulkan: Consolidate uniforms code in ProgramExecutableVk. De-duplicates several methods. Refactoring change only. Bug: angleproject:3570 Change-Id: Ib68bc30b3e9b1087871bb268ea292677e0c9fe2e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3408061 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 0dc0dc2a 2021-12-30T11:35:40 Re-land: "Vulkan: Remove "fillProgramStateMap"." This copies additional shader info like uniforms from the Program to the Program Piplines. There is now a duplication between PPOs and Programs. There is no additional storage required for non-PPO Programs. Re-land fixes fragment in/out uniform updating with PPOs. Bug: angleproject:3570 Change-Id: I64b2db6fbc3a610f3b5e617301f94eb30d915939 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3412999 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Yuly Novikov 6a14e328 2022-01-25T00:49:45 Revert "Vulkan: Remove "fillProgramStateMap"." This reverts commit 38deffe40db83836588e0cd50864945a9ddba36b. Reason for revert: angle_end2end_tests failures on Pixel 6. Original change's description: > Vulkan: Remove "fillProgramStateMap". > > This copies additional shader info like uniforms from the Program > to the Program Piplines. There is now a duplication between PPOs > and Programs. There is no additional storage required for non-PPO > Programs. > > Bug: angleproject:3570 > Change-Id: I5ed6c946df945aaf2f65752f797b16e7649d5584 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3362297 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> > Commit-Queue: Jamie Madill <jmadill@chromium.org> Bug: angleproject:3570 Change-Id: I3a4822c8a65d024070a9fe5df103b88a3c8333d3 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3414024 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 38deffe4 2021-12-30T11:35:40 Vulkan: Remove "fillProgramStateMap". This copies additional shader info like uniforms from the Program to the Program Piplines. There is now a duplication between PPOs and Programs. There is no additional storage required for non-PPO Programs. Bug: angleproject:3570 Change-Id: I5ed6c946df945aaf2f65752f797b16e7649d5584 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3362297 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 158ecba6 2022-01-07T16:40:26 Vulkan: Remove cached Impl pointers from ContextVk. These pointers were a common source of programming error, where sometimes they wouldn't be updated when they were needed. Instead we can pull the objects directly from the GLES state. We added them initially to attempt a performance improvement, but it's likely they didn't significantly decrease memory accesses or the number of instructions we process for GLES calls. Hence removing them should be an improvement in safety without a perf loss. Bug: angleproject:6864 Change-Id: I54107686992065a514077c71d173b804e295515e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3378904 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi acd8fc76 2021-12-16T01:05:02 Vulkan: Distinguish RP and outside-RP command buffer types What goes inside and outside a render pass command buffer is largely mutually exclusive. Moreover, the size and frequency of allocations is different between the two. This change distinguishes the C++ types used for inside and outside render pass command buffers: - The type now documents which command buffer a function is able to receive. - `isRenderPass` flag passing, checking and asserting is largely removed. - A follow up change experiments with using different (Vulkan vs ANGLE) secondary command buffers for inside and outside RP command buffers. - A future change could specialize the pool behaviors per command buffer type. Bug: angleproject:6811 Change-Id: Ia4bc669d26ac7e94e8a0dfb9b361666c82f42cc3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3344373 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 83a670ab 2021-10-29T09:12:26 Vulkan: Implement BufferPool using VMA's virtual allocator VMA's allocation calls used to be sub-allocating a pool of memory. What we really want is sub-allocate a VkBuffer object. VMA recently added support to expose the underlying range allocation algorithm via APIs, which user can use it to sub-allocate any object. This CL uses that new virtual allocation API to sub-allocate from a pool of VkBuffers. In this CL we only switched BufferVk::mBuffer to sub-allocate from the BufferPool object. Bug: b/205337962 Change-Id: Ia6ef00c22e58687e375b31bc12ac515fd89f3488 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3266146 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Mohan Maiya 44d0ef69 2021-11-25T14:37:38 Vulkan: Enhance SamplerDesc for YUV formats In order to uniquely identify a VkSamplerYcbcrConversion, having just the format is insufficient. We need to account for conversion model and color component range. Refactor SamplerDesc by encapsulating YUV related fields into its own YcbcrConversionDesc. Bug: angleproject:6732 Test: Texture2DTestES3.*Yuv*Vulkan Change-Id: I23114c50646232dccde988a52b0649778ad72a90 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3301899 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi 9de37b58 2021-11-20T21:45:02 Vulkan: Fix draw with emulated xfb without xfb active When transform feedback is not active, make sure the code that captures xfb is not generated, even though it's guarded against with an if. This is because no buffer is bound to the capture buffer, and by avoiding generation of code that references that buffer, SwiftShader will not attempt to access the missing descriptor set. Currently, the actual declaration of the buffer is left in the SPIR-V, which seems to be benign. If that causes issues in the future, the SPIR-V transformer can be modified to remove that variable as well. Bug: chromium:1209285 Change-Id: I83da8d1dea5390ecacc681f8ada9f586932deaa4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3294661 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 4a2446c6 2021-10-19T11:55:17 Vulkan: Implement robust shader outputs. In this CL we change ANGLE to pass the mask of missing shader outputs down to pipeline creation. We then use the color mask bits to block SwiftShader writing to unused outputs. This fixes the undefined behaviour present in Genshin Impact. Note that the other GLES implementations we tested don't seem to modify outputs even if they're unused. It was easier to mask out the color attachments in initialize rather than set up the pipeline desc to mask out the attachments. This was because we manipulate the color mask in a fairly complex way before we initialize the pipeline desc. Bug: angleproject:6566 Change-Id: Ie659fcd511cd286fa573fd25e3e6a0b9e123ebd6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3232435 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 191c236a 2021-10-14T17:01:45 Vulkan: Remove "current queue serial". Queries, semaphores, and pipelines instead use the normal vk::Resource design to track their lifetimes. Removes the current serial APIs from all classes. Current serials are still tracked internally in the command queue classes. Bug: b/169788986 Change-Id: Idcd2c2a93bc8225c6f3f7c247eb8fcfb76be1030 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3223644 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3a9f18f1 2021-10-18T10:44:38 Refactor program pipeline handling. In preparation for moving more code from gl::Program to gl::ProgramExecutable so it can be shared with ProgramPipeline. Bug: angleproject:6566 Change-Id: Icb7ecccb37ae8e0d7d5fef8968f0dd7ef6fe6150 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3226305 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill aac5d678 2021-10-20T11:48:57 Make "isCompute" private to ProgramExecutable. This eliminates uses of "isCompute" is the Vulkan back-end. Instead of checking the state flag, we can use the context of the current command to determine if we're running a compute or a graphics command. This will eventually lead to us being able to compile the program pipeline objects before we run a draw or dispatch command. Changes the driver uniforms descriptor desc to bind to both graphics and compute shader stages to simplify the code. This could have theoretical but low-risk performance implications. Bug: angleproject:6595 Change-Id: Ie30d419b6ece5b33f5066a034d3805fe96519b36 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3233903 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@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>
Mohan Maiya 715a49c7 2021-07-03T08:48:07 Vulkan: Handle incompatible immutable sampler formats If the immutable sampler format of an active texture is not compatible with those supported by the pipeline layout, recreate the pipeline layout. Bug: b/155487768 Bug: angleproject:5033 Bug: angleproject:5773 Test: ImageTest.SourceAHBTarget2DExternalCycleThroughYuvTargetsNoData*Vulkan Change-Id: Iea78e1738ea2fb133a24dc88f5b68daf4cc1bdfe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2997289 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 31b06f5f 2021-07-12T10:06:04 Vulkan: Account for immutable samplers that need multiple descriptors It is valid for immutable samplers to need more than 1 descriptor count. Account for this possiblity while calculating descriptor pool size. Bug: b/155487768 Bug: angleproject:5033 Bug: angleproject:5773 Bug: angleproject:6141 Change-Id: Ifb0ed3e4b3c01c61d81dd0c628101f31d4c8bd05 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3005329 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Mohan Maiya e2881e25 2021-06-27T10:45:41 Vulkan: Handle incompatible pipeline layouts It is necessary that a pipeline layout be compatible with active textures. Make sure to recreate the pipeline layout otherwise. Bug: b/155487768 Bug: angleproject:5033 Bug: angleproject:5773 Test: ImageTest.SourceAHBTarget2DExternalCycleThroughRgbAndYuvTargets*Vulkan Change-Id: Iab371a9035b6cd143585e5000e2e68c7302ef447 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2992056 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill ccc0fbaa 2021-03-24T17:56:38 Vulkan: Related fixes for buffer descriptor set cache. Includes some stats counter gathering and a few related refactors and cleanups. Also includes a new overlay widget. Bug: angleproject:5736 Change-Id: Ida8d2cd815c5b598c6a442dd9bbfdf51e9c05180 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2785431 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 0c77f3ad 2021-03-10T15:58:00 Vulkan: Implement shader buffers descriptor cache. Implements a descriptor set cache for UBOs, SSBOs, and atomic counter buffers. Storage Images and framebuffer fetch input attachments are not yet included. Requires moving the buffer barrier handling into ContextVk, similarly to how we handle the barriers for Textures. The packed description key for the descriptors uses a "fast" vector with a basic minimum size. For most cases of a few buffers this will fit easily in stack memory, but for larger programs with many buffers we fit this into heap memory. The key has a large upper bound due to the high ES 3.2 requirements and the need to index several values such as the offset and binding size. We use dynamic offsets for uniform buffers when possible. This ensures applications like Manhattan 3.1 that use sets of common buffers with changing offsets hit the cache most of the time. Because of resource limits we pick at compilation time whether to use dynamic or static descriptor sets. Mostly this applies to tests that use a large number of uniform buffers. A future implementation could be smart and would recompile the program with heuristics to use a minimal number of dynamic indices. Reduces the number of descriptor set updates from ~300 -> ~30 per frame in Manhattan 3.1 and in Asphalt 9 from 900+ to as low as 0 per frame. Bug: angleproject:5736 Change-Id: I5c2a3881bec90d301dab15cc86c8a70e60674ad7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2757515 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill efc53d0f 2021-04-03T21:30:15 Vulkan: Refactor to descriptor offset array. This is in preparation for using dynamic offsets for other sets than the default descriptors. Bug: angleproject:5736 Change-Id: I546e688ad57a35b380f8d7f303ffc0c62773ac18 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2804813 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 776c6015 2021-02-26T00:00:57 Vulkan: Call glslang at compile time With this change, the ANGLE translator immediately compiles the generated GLSL into SPIR-V with glslang and discards the source. This is in preparation for generating SPIR-V directly, by making the frontend and backend already able to digest it. This change also allows the expensive glslang calls to be parallelized, improving the following perf test by about 20%: LinkProgramBenchmark.Run/vulkan_compile_and_link_multi_thread Previously, the test was run as such in the Vulkan backend: Main Thread 1 Thread 2 Compile1 ---> Compile2 ---------------------> Translator Translator <--- <--------------------- Link glslang for shader1 glslang for shader2 Done With this change, it is run as such: Main Thread 1 Thread 2 Compile1 ---> Compile2 ---------------------> Translator Translator glslang glslang <--- <--------------------- Link Done glslang_wrapper_utils no longer interacts with glslang! A rename will follow. Bug: angleproject:4889 Change-Id: If4303e8ba0ba43b1a2f47f8c0a9133d0bee1a19a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2721195 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 572fd801 2021-03-22T16:14:34 Vulkan: Rename Uniforms/XFB descriptor desc. The new name is more consistent with the other names. Refactoring change only. Bug: angleproject:5736 Change-Id: Idc47fef29040e3a422267795c4536163a6f8eb4e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2779953 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 02acc5ee 2021-03-18T16:08:59 Vulkan: More cleanups to perf counters. This refactors the pipeline type in the ContextVk class to also use a packed enum map. It also expands the object perf counters to store both a specific and cumulative version for use in different cases. Bug: angleproject:5736 Change-Id: I6ff78e38065eb577f2b95b1d9c4f9cc31d7f325f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2774184 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill b717952e 2021-03-18T10:39:34 Vulkan: Use packed enum map for descriptor set index. This simplifies a lot of the data structure indexing in the program executable class. Also renames the "DriverUniforms" and "InternalShader" index into a single "Internal" index. Bug: angleproject:5736 Change-Id: I2a51d8b14d5b16b438dbe636f77b11bbc045ba9a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2773321 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 1b08cfcb 2021-03-18T10:01:54 Vulkan: Clean up shader buffer DS allocation. We were using repeated code patterns in several places. Bug: angleproject:5736 Change-Id: I206783dd792c3b0f9d38027235445ec600a60d88 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2773320 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 89d2a96a 2021-03-09T18:37:57 Vulkan: Add test for UBO descriptor allocations. This performance counter test verifies that re-binding the same two buffers repeatedly doesn't allocate new descriptor sets. Currently the test fails because we don't cache descriptor sets for UBOs. Covers equivalent code patterns in Asphalt 9. Reorganizes the perf counters collected for the program objects. Now they are per-frame reset instead of cumulative. This tracking is now consistent for the different counter types. In the future we can add cumulative tracking for all per-object and global perf counters. Bug: angleproject:5736 Change-Id: I23d04b6453e38af1cf4af7274d24382d136efad3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2746176 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi c7c38731 2021-03-04T15:04:07 Vulkan: Move SpirvBlob definition to common/ For use by the translator. Bug: angleproject:4889 Change-Id: Ie95cafd3cfcdde50acc5d26d3c00e6574186a805 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2737276 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 77637f2d 2021-02-19T15:18:52 Vulkan: Generate xfb support code in SPIR-V for emulation path This change moves the code generation at link time from source code to SPIR-V. As a result, transform feedback extension and emulation paths are more similarly handled before SPIR-V transformation (they both store information identically in the ShaderInterfaceVariableInfoMap). This change gets rid of the @@ XFB-OUT @@ marker. With no source code generation at link time, shader compilation can be moved to glCompileShader time. Bug: angleproject:4888 Change-Id: I8cdb89c22b57ce48cf5d226b8e41622d9d550d46 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2713269 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya 907a3cee 2021-02-17T08:07:45 Vulkan: Add support for EXT_shader_framebuffer_fetch_non_coherent EXT_shader_framebuffer_fetch_non_coherent is implemented using subpass input attachments. The extension will be enabled in a follow up change that adds required changes to the Vulkan translator. Bug: angleproject:5454 Test: FramebufferFetchNonCoherentES31.*Vulkan Change-Id: Ic73c66a476c4a21db5269431166a198841f1dc0c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598059 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 79ae52dd 2021-02-11T14:18:41 Vulkan: Fix missing visibility barrier for host-visible buffer writes See https://chromium-review.googlesource.com/c/angle/angle/+/1661252 for context. This was accidentally broken during the command graph rework. This will eventually be validated by syncval. See https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/2329. Bug: angleproject:5070 Change-Id: Ic16fa900e554d46e54b42fc3fbe0f96d5327fa0f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2689379 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 37a0dced 2021-01-28T17:52:05 Vulkan: Disable clip space transform based on EXT_clip_control When depth is set to "ZERO_TO_ONE_EXT" using EXT_clip_control API, don't transform the z position in shader since it now matches Vulkan's depth range. Toggle transformPositionToVulkanClipSpace accordingly. Bug: angleproject:5471 Tests: dEQP-GLES2.functional.clip_control.depth_mode_zero_to_one Change-Id: I7e715cb3c98cecf5aaa5cdc3822a3a83bae9c720 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2615864 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi dfd9bdfd 2021-01-16T11:32:30 Reland "Vulkan: Generate gl_Position pre-rotation in SPIR-V" This reverts commit 3d39b7c5eab88c420d982155ffbb6181c678ceea. Reason for revert: Fixed interaction with the `forceDriverUniformOverSpecConst` workaround. Original change's description: > Revert "Vulkan: Generate gl_Position pre-rotation in SPIR-V" > > This reverts commit 0f86b196ffaffeeee3460e3188f20a7ac120796d. > > Reason for revert: > Breaks pre-rotation for all apps, so they are displayed in portrait instead of landscape. > > Original change's description: > > Vulkan: Generate gl_Position pre-rotation in SPIR-V > > > > Instead of having the translator output pre-rotation code in the vertex > > stage based on a specialization constant, this change makes the SPIR-V > > transformer perform pre-rotation of gl_Position on the last geometry > > stage. > > > > An alternative solution would be to generate pre-rotation code in the > > translator in every geometry stage, each controlled by a separate > > specialization constant. This change avoids unnecessary modifications > > to earlier stages. The generated shaders are also smaller, as they > > don't contain a mat2[8] pre-rotation constant matrix. The SPIR-V > > transformer knows the pre-rotation at transformation time, so it can > > simply use swizzles to achieve the same results. > > > > This also ties in with upcoming changes which move gl_Position.z > > correction to the last geometry shader stage, which is trivially done > > piggy-backing on the infrastructure in this change. > > > > Bug: angleproject:5478 > > Change-Id: I9d5d9d19f3ccda665f5504368ce5ddfa5f383faf > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 > > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Charlie Lao <cclao@google.com> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: I81f237fa6b10c7d59831363bee8999e7ad2f09be > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: angleproject:5478 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633694 > Reviewed-by: Tim Van Patten <timvp@google.com> > Commit-Queue: Tim Van Patten <timvp@google.com> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Bug: angleproject:5478 Change-Id: I7c5eaeef03d9520abd36a1c4a766b6abbf4fdb45 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633709 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 60015ff6 2021-01-14T02:03:07 Vulkan: Redo RewriteStructSamplers This transformation is split into two. The first transformation solely takes out the samplers out of structs, and potentially generates array of array of samplers. A second transformation is added that takes any array of array of opaque uniforms and flattens it. A follow up change will simplify RewriteAtomicCounters which also handles array of arrays (which is no longer possible), and removes dependency on shaderStorageBufferArrayDynamicIndexing. Bug: angleproject:2703 Bug: angleproject:3881 Bug: angleproject:4071 Bug: angleproject:4211 Change-Id: I352bb2bbe65ac49f4d7d753c0ba3160fa3cc925a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2628138 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 3d39b7c5 2021-01-16T00:15:14 Revert "Vulkan: Generate gl_Position pre-rotation in SPIR-V" This reverts commit 0f86b196ffaffeeee3460e3188f20a7ac120796d. Reason for revert: Breaks pre-rotation for all apps, so they are displayed in portrait instead of landscape. Original change's description: > Vulkan: Generate gl_Position pre-rotation in SPIR-V > > Instead of having the translator output pre-rotation code in the vertex > stage based on a specialization constant, this change makes the SPIR-V > transformer perform pre-rotation of gl_Position on the last geometry > stage. > > An alternative solution would be to generate pre-rotation code in the > translator in every geometry stage, each controlled by a separate > specialization constant. This change avoids unnecessary modifications > to earlier stages. The generated shaders are also smaller, as they > don't contain a mat2[8] pre-rotation constant matrix. The SPIR-V > transformer knows the pre-rotation at transformation time, so it can > simply use swizzles to achieve the same results. > > This also ties in with upcoming changes which move gl_Position.z > correction to the last geometry shader stage, which is trivially done > piggy-backing on the infrastructure in this change. > > Bug: angleproject:5478 > Change-Id: I9d5d9d19f3ccda665f5504368ce5ddfa5f383faf > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: I81f237fa6b10c7d59831363bee8999e7ad2f09be No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:5478 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633694 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 0f86b196 2020-12-21T22:54:05 Vulkan: Generate gl_Position pre-rotation in SPIR-V Instead of having the translator output pre-rotation code in the vertex stage based on a specialization constant, this change makes the SPIR-V transformer perform pre-rotation of gl_Position on the last geometry stage. An alternative solution would be to generate pre-rotation code in the translator in every geometry stage, each controlled by a separate specialization constant. This change avoids unnecessary modifications to earlier stages. The generated shaders are also smaller, as they don't contain a mat2[8] pre-rotation constant matrix. The SPIR-V transformer knows the pre-rotation at transformation time, so it can simply use swizzles to achieve the same results. This also ties in with upcoming changes which move gl_Position.z correction to the last geometry shader stage, which is trivially done piggy-backing on the infrastructure in this change. Bug: angleproject:5478 Change-Id: I9d5d9d19f3ccda665f5504368ce5ddfa5f383faf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 093250e0 2020-12-23T12:07:46 Vulkan: Make shader variable info maps a class. Instead of using a map type directly we abstract the info maps into an encapsulated class. We can enforce a specific API set instead of using the same API as the map class. This also cleans up a few of the APIs related to these maps. This change will allow future changes to the way the variables are stored in the class without drastically changing the interface. Bug: angleproject:3572 Bug: angleproject:4524 Change-Id: Ic1a63e1776c39f49b895a1274bae8282d7a6b9b5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2600080 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya 98b56e60 2020-12-12T16:28:21 Vulkan: Accumulate internal cache stats in renderer The CacheStats of all internal caches are accumulated by the renderer. In order to see the hit ratios of all caches, the following GN args must be enabled: is_debug = true angle_enable_perf_counter_output = true Bug: angleproject:5447 Test: Manual verification with angle_end2end_tests Change-Id: Iaca3249192e9e4e130d8291b7759c459d79b06ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2588430 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 46eaba7f 2020-12-12T10:31:26 Vulkan: Add support for internal cache hit and miss counts Add a CacheStats class that provides cache hit and miss bookkeeping. All internal caches make use of this class to keep track of its stats. This provides a means to profile cache hit ratios a.k.a Vulkan object reuse for any application. Bug: angleproject:5447 Test: Manual verification with angle_end2end_tests Change-Id: I44eeb0c2b9b291ec1cdd156fb2be4a5fe80d2848 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2580111 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao aa8b10ae 2020-11-19T11:06:50 Vulkan: Avoid driver call when yflip changed but shader not using it If shader is not using yflip, don't get into driver to ask for a new pipeline program just because yflip has changed. Instead try to use the non-yflipped program. Bug: b/173461931 Change-Id: If938f5dc0632529c4f5e477fcb0c67bf58a1f3d0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2549538 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 24f64249 2020-11-16T17:55:02 Vulkan: Track specialization constant usage bit and feedback to ctx Right now context does not know which specialization constant is used by the shader. Whenever a specialization constant changes, we assume shader program is using it, we always reach into vulkan driver to ask for a new program. Instead we can track shader's usage of specialization constant so that context can utilize this information to avoid recompile pipeline program if an unused specialization constant has changed. This CL implements the plumbing the usage bits form compiler to program object, it does not actually utilize the usage bits to avoid unnecessary compilation yet. Bug: b/173461931 Change-Id: Iebc9d0638c17b1a282c8b6093ce6bae154246e57 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2542866 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao b22f8e8e 2020-10-29T15:50:39 Vulkan: Add specialization constants for surface rotation This plumbing through the specialization constant for surface rotation from ContextVk to pipeline program creation. It has not been used yet, so expecting no real functional change. This CL also converts lineRasterEmulation to use the same specialization constant path as surface rotation. Bug: b/171750979 Change-Id: Ic08c4f8bb576424d1752015e874d0977a58d78bb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2508837 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten ee4e0866 2020-09-24T11:39:49 Vulkan: Add descriptor set allocation counters Add descriptor set allocation counters for the following: - ContextVk - Driver uniform allocations for graphics and compute pipelines. - ProgramExecutableVk - ANGLE driver uniforms - Uniforms - Textures - Other shader resources - UtilsVk - All of the UtilsVk::Function types increment the same counter Each object's counters live within the object itself and the cumulative total is output as part of that object's destruction. On Present, all of the descriptor set counts are collected into a single total which is used to update the overlay each frame. In order to see the cumulative total output for each object, the following GN args must be enabled: is_debug = true angle_enable_perf_counter_output = true To see the descriptor set allocation overlay: ANGLE_OVERLAY=VulkanDescriptorSetAllocations Bug: angleproject:5067 Test: Manual verification with angle_perftests Change-Id: Ie45fda56ade3e68bfba7bf6da9554eb05a02c6b6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2429487 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 0f2542e1 2020-10-21T00:38:40 Vulkan: Validate SPIR-V transformer at link time Using an ASSERT, the SPIR-V transformer is run at link time to catch bugs in tests that link but don't draw. Bug: angleproject:4249 Change-Id: Icbeeb6e968f9901ba003918b1dd1d2eef0792469 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2488227 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten e78d9a61 2020-07-24T11:58:45 Convert unordered_map to absl::flat_hash_map for select files This is the initial CL to start migrating to abseil in various places: - formatutils.h - FramebufferVk.h - Program.h - ProgramExecutableVk.h - RewriteRowMajorMatrices.cpp This intentionally hits a couple different places in the code to make sure the abseil dependencies are added to the required targets. Bug: angleproject:4873 Change-Id: Idd6084dff2ebce47833f304c605bbf3151b97414 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2402382 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Tim Van Patten ed899835 2020-09-11T21:21:55 Vulkan: Allocate descriptor pools with layouts Descriptor set layouts and pools are very tightly coupled, since their binding types and counts must match to ensure the number of available descriptor sets within a pool remains accurate. To enforce this, the descriptor pools will now keep a copy of the VkDescriptorSetLayout that the pool was created for, which is verified when a descriptor set is allocated from the pool. If the handles don't match, an ASSERT() will fire. Bug: angleproject:5033 Test: CQ Change-Id: I4faf82c24f31052e57b656c968788bb0c131b619 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2407282 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Tim Van Patten 233cc31b 2020-09-15T11:05:17 Vulkan: Use linkedShaderStages in GlslangGetShaderSpirvCode() The parameter linkedShaderStages is passed to GlslangGetShaderSpirvCode(), but is unused. This CL uses the parameter, rather than gl::AllShaderTypes(). This CL also removes the unused parameter variableInfoMap from the call chain. Bug: angleproject:3570 Change-Id: Ic60084e87cb2aa2a245e3e963598851331379e89 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2412364 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten f12e4123 2020-08-25T12:01:12 Vulkan: Match descriptor pool sizes to descriptor set layouts When a descriptor pool is created, a list of descriptor types and counts are given to vkCreateDescriptorPool(). Later, when allocating a descriptor set from the pool, we pass along a descriptor set layout to vkAllocateDescriptorSets() which is used to determine how many of each type of descriptor (i.e. binding) to allocate from the pool. In order for our "free descriptor set" counts to be accurate for each pool, the descriptor pools need to be created with descriptor counts that match the descriptor set layout binding counts. This change fixes a bug where the descriptor set layouts were created with more bindings than the descriptor pool sizes, causing the "free descriptor set" count to be inaccurate, leading to allocating too many descriptor sets from a pool. Bug: angleproject:3570 Test: VulkanDescriptorSetTest Change-Id: I660bf02d29a1291391fb15f39e6479bf348d0f83 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2391114 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Xinyi He 377e7487 2020-08-27T17:11:35 Vulkan: Support array of array image type Implement supporting the array of array of image type in uniform. Add a new end2end test for it. Bug: angleproject:3881 Change-Id: Idd757ae1d0ed34d585ae1ca5e0b6577459a0acb7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2379335 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Courtney Goeltzenleuchter ae09e889 2020-09-10T17:00:13 Fix mismatch issue with precision qualifiers. GLSL allows varyings passed from one stage to another to not match in precision (e.g. float & half-float). Vulkan doesn't allow that so adjust those mismatches to use the higher precision. To fix we keep track of the precision of varyings and in the Vulkan backend if we see they are different patch up the SPIR-V to make them match. Bug: angleproject:3078 Change-Id: I385d31e082da46ccdd4817b6612f5f9d9cbce17c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2337755 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 8d412db2 2020-08-29T22:25:18 Revert "Convert unordered_map to absl::flat_hash_map for select files" This reverts commit 1acaf4eced42a26f09b4d9180a9e5db0f37bc9a4. Reason for revert: Fails when is_component_build is not set: lld-link: error: <root>: undefined symbol: public: __cdecl absl::Condition::Condition<struct std::__1::atomic<bool> const>(bool (__cdecl *)(struct std::__1::atomic<bool> const *), struct std::__1::atomic<bool> const *) <snip> Original change's description: > Convert unordered_map to absl::flat_hash_map for select files > > This is the initial CL to start migrating to abseil in various places: > - formatutils.h > - FramebufferVk.h > - Program.h > - ProgramExecutableVk.h > - RewriteRowMajorMatrices.cpp > > This intentionally hits a couple different places in the code to make > sure the abseil dependencies are added to the required targets. > > Bug: angleproject:4873 > Change-Id: I68c7d067b6912b0cc0ecde231501dbed92f0b189 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2321735 > Commit-Queue: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> TBR=timvp@google.com,jmadill@chromium.org,cclao@google.com Change-Id: I75041532fc5126b4c7cc5e0d4529883fb357e05b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:4873 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2383870 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 1acaf4ec 2020-07-24T11:58:45 Convert unordered_map to absl::flat_hash_map for select files This is the initial CL to start migrating to abseil in various places: - formatutils.h - FramebufferVk.h - Program.h - ProgramExecutableVk.h - RewriteRowMajorMatrices.cpp This intentionally hits a couple different places in the code to make sure the abseil dependencies are added to the required targets. Bug: angleproject:4873 Change-Id: I68c7d067b6912b0cc0ecde231501dbed92f0b189 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2321735 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Tim Van Patten 85ddcc93 2020-08-24T14:22:22 Vulkan: Convert ProgramExecutableVk::mDescriptorSets to std::array Currently ProgramExecutableVk::mDescriptorSets is a vector, but it's size is bound so it can be a std::array (DescriptorSetLayoutArray). To ensure the size grows correctly in the future, the various descriptor set indexes are also being converted from independent constexpr uint32_ts into the enum DescriptorSetIndex. Bug: angleproject:4898 Test: CQ Change-Id: I7ae8ff3455bcfb61e24b73bd16cc3f8cf9873087 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2372664 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Jamie Madill 22e6fc03 2020-07-31T15:58:28 Vulkan: Move Resource Serial gen into Renderer. Putting Serial allocation in the Renderer allows the Helper classes to manage allocating its own Serial. The init functions for ImageViewHelper only have access to a vk::Context/RendererVk, not a ContextVk. This will be updated in a future CL. Re-uses the Serial Type X-Macro to do more code generation. Serial allocation now uses an atomic because of its now Renderer shared location. Bug: angleproject:4911 Change-Id: I2d5d3d0bbf613d5468de795a700f66164291bc79 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2332884 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao 8765b46a 2020-07-15T17:10:35 Vulkan: Make mDefaultUniformStorage per ContextVk Right now the dynamic buffer for default uniform is per program. Most of time the buffer is unused. That is a huge waste of memory (and these memory are wired memory). This CL moves the mDefaultUniformStorage from per ProgramVk to ContextVk so that we all share with each other. Bug: b/161391337 Change-Id: I1fe8523b2b2dbc39bec3509a3432e38e34bd5713 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2274870 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 234be194 2020-07-15T14:55:18 Vulkan: Move mEmptyBuffer from program to ContextVk And merge that with TheNUllBuffer as well so that you only have one dummy buffer per context. Bug: b/161391337 Change-Id: I75fddb5c48393876e745ff237e11d9c5672ae10e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2300707 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao cc551385 2020-06-29T10:25:45 Vulkan: Add cache for default uniform descriptor set Instead of free and allocate a descriptor set whenever buffer changes, add it into the descriptorset cache. Every time you get the buffer, we also look in the cache first to see if there is a descriptorset for that buffer or not. If yes, we use the cached descriptor set instead of allocate one. Bug: b/159457348 Change-Id: I64c252dfe22db66ea8188415e1b384af371b82ab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2273698 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao 22e1f3e2 2020-06-26T14:26:50 Vulkan: Let all shader stages share one buffer for default uniform Right now each shader stage has its own vk::DynamicBuffer for default uniform storage. This is less efficient than just share one buffer. This CL moves the storage from per shader stage into its ProgramVk object. Bug: b/159457348 Change-Id: If47248ea23c4e48407d3b211583ae2b048d4d10f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2265281 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Courtney Goeltzenleuchter f61272fb 2020-06-17T11:38:37 Add support for VK_KHR_sampler_ycbcr_conversion This adds ability for applications to import Android Hardware Buffers (AHBs) as OpenGL images which in turn can be sampled from and/or written. This was specifically tested with the common use case of importing a buffer created by an media decoder and using that as a texture source to include that video content on the screen. Tested with: - Angry Birds 2 video player (for ads) requires YUV conversion. - Basic Media Decoder example: https://github.com/android/media-samples/tree/master/BasicMediaDecoder Bug: b/155487768 Change-Id: I9255450f81aa4daa2aace7205d4f6c3f225abcca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2175103 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 68e60a92 2020-06-26T11:10:07 Vulkan: Don't store transformed SPIR-V Since the original SPIR-V is never store after being modified, we don't need to keep the transformed SPIR-V either. Bug: angleproject:4513 Test: CQ Change-Id: I4b70cfa355a08107e6a27377f6258cbf9e4072be Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2270718 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 7993f34d 2020-06-24T18:39:08 Vulkan: Store transformed SPIR-V in ProgramExecutableVk The original SPIR-V is specific to a ProgramVk while the transformed SPIR-V is specific to a ProgramExecutableVk. This CL keeps the original SPIR-V in the ProgramVk::mOriginalShaderInfo and the transformed SPIR-V in ProgramExecutableVk::mTransformedShaderInfo. This allows us to skip an extra copy that was occurring during PPO link(). Bug: angleproject:4513 Test: CQ Change-Id: I796dcd6bcfb2df08d9b8f1a5295b2821a4096f16 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2265484 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten a28efb2f 2020-06-12T13:14:48 Remove mProgramState from ProgramExecutable::updateActiveImages() Use of the member variable mProgramState is being removed to reduce the circular coupling of ProgramExecutable and ProgramState. Bug: angleproject:4520 Test: Build/CQ Change-Id: I31d7e607fb06a374a0b0e1d35eb2a092614badf5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2243323 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis 562602a3 2020-05-05T12:32:56 Vulkan: Move CommandBufferHelper to vk_helpers.h Pull CommandBufferHelper class out of ContextVk.h/cpp and move it to vk_helpers.h/cpp. This is the natural place for it as it's a helper class. Also, this class is planned to be the interface between the main and worker threads so moving it to vk_helpers makes it easy to share between Context and Renderer. Bug: b/154030403 Change-Id: Ie5eeb864164a3787f800905ae885027834bd1a08 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2182177 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
Tim Van Patten 913f4f42 2020-04-15T00:54:37 Vulkan: Support VS, FS, and CS in the same PPO This CL adds support for a Program Pipeline Object to have a VS, FS, and CS attached to the same PPO and then using that PPO for both draw and dispatch calls. Bug: angleproject:3570 Test: KHR-GLES31.core.compute_shader.sso* Change-Id: I262cdbdfd442f6db5ba2b45d1308003102b237cb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2150078 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Charlie Lao dee4d7a5 2020-04-10T10:22:56 Vulkan: Early fragment tests optimization Checks if early fragment tests as an optimization is feasible and enable it if we can. In the link time, if context state diagrees with optimization (in rare case), then remove the ExecutionModeEarlyFragmentTests sprv op code. Bug: angleproject:4508 Change-Id: Ifbb06c0ffb050a9f3ddb16ab50362e908b4b9cf6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2136490 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Tim Van Patten 405f8e7b 2020-02-24T17:38:10 Vulkan: Support Program Pipeline Objects Add support for PPOs to the Vulkan back end. Bug: angleproject:3570 Change-Id: I5403456929847c185467b008d810f31ecfcb60cc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2072652 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Tim Van Patten b387ce93 2020-02-21T16:05:41 Vulkan: Move ProgramInfo/ShaderInfo to ProgramExecutableVk The classes ProgramInfo and ShaderInfo are being moved into ProgramExecutableVk along with the ProgramVk members mDefaultProgramInfo and mLineRasterProgramInfo. This refactor is necessary since these members are common between ProgramVks and ProgramPipelineVks. Bug: angleproject:3570 Change-Id: I94cdb1096c6a0c007d858135af694da58d7897ff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2068901 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 85c076ee 2020-02-20T17:54:35 Vulkan: Make mVariableInfoMap a gl::ShaderMap<> The ShaderInterfaceVariableInfoMap information is specific to each shader stage, since the locations are determined for each shader stage. This change makes mVariableInfoMap a gl::ShaderMap<> to handle this, which will make it easier to compile separable programs, determine the variable locations, and transform the SPIR-V. Bug: angleproject:3570 Change-Id: I28b71a37efe54bbcfe1dcd445fa03ee71e74f0a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2062741 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Tim Van Patten abaa3573 2020-02-20T10:23:02 Vulkan: Only calculate variable locations once Variable locations and descriptor set/binding values are calculated multiple times: - Compiling GLSL->SPIR-V - Creating the Vulkan pipeline layout - Updating descriptor sets These values should instead be calculated once and reused throughout since they won't change without recompiling the shader program. Bug: angleproject:3570 Change-Id: I5d8767b3b2e2f741aade7fec9991eea53ee2eb98 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2067101 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 10ade024 2020-02-13T18:11:54 Create the ProgramExecutableVk Class The ProgramExecutableVk class is being created to collect data structures that are common to both ProgramVks and ProgramPipelineVks, as well as any shared functions. This allows callers to make Program-/ProgramPipeline- specific queries without needing to know exactly which responded by querying the current ProgramExecutableVk. This will also allow the necessary data structures to only be populated and stored within the ProgramExecutableVk when necessary and reused as often as necessary. A few things are being moved into this class: - mVariableInfoMap This information will be required to defer translating the SPIR-V until when the vulkan pipeline layout is determined and the actual locations are known.   This will also allow removing determining these locations twice (during GLSL->SPIR-V compilation and pipeline layout). - createPipelineLayout() - update*DescriptorSet() - Descriptor Set Layout lists - Pipeline Layout - Various other functions/members related to pipeplines, descriptor sets, etc. Bug: angleproject:3570 Change-Id: I4b5ababeafec865148783c8ffd4c15f659f4856d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2055656 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>