src/libANGLE/renderer/vulkan/ProgramVk.h


Log

Author Commit Date CI Message
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 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>
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>
Tim Van Patten a9de5d99 2021-02-04T20:44:15 Vulkan: setAllDefaultUniformsDirty after createPipelineLayout The default uniform descriptor set is reset while recreating the pipeline layout during handling of immutable samplers and then is never re-allocated and bound before the next draw. The call stack to allocate the program uniforms descriptor set: ProgramExecutableVk::allocUniformAndXfbDescriptorSet ProgramVk::updateUniforms ContextVk::setupDraw ContextVk::drawArrays Context::drawArrays Unfortunately, this occurs before the pipeline layout is reset (and the descriptor sets are reset) due to the presence of an immutable sampler: ProgramExecutableVk::reset <<---- mDescriptorSets.fill(VK_NULL_HANDLE); ProgramExecutableVk::createPipelineLayout ContextVk::updateActiveTextures ContextVk::invalidateCurrentTextures ContextVk::syncState Context::syncDirtyBits Context::prepareForDraw Context::drawArrays This CL calls setAllDefaultUniformsDirty() for the Program/PPO to ensure the default uniforms descriptor sets are re-allocated and re-bound before the next draw command. Bug: b/178424566 Bug: angleproject:5624 Test: CtsCameraTestCases Change-Id: If54a9f2cc09809a5103bc3eac641c77f56362229 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2677385 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
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>
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 d654ac9b 2020-12-30T12:28:41 Program: Support multiple varying packings. Instead of using a single varying packing for all program stages, we switch to using a varying register packing for each pair of input/output shaders. This allows several valid use cases that use many varying to succeed. For instance Geometry Shaders have both an input and output varying packing. With tessellation shaders the upper bound of valid varying packings in one Program goes up even more. We keep multiple varying packings at once inside a new "ProgramVaryingPacking" class. Internally the class keeps a unique varying mapping for each input/output interface in the program. Separable programs with "open" interfaces are handled specially. Fixes a bug where varying counting was artificially limited for programs with more than two shaders. This CL also disables GS support when we're emulating line raster so we don't have to figure out the details on how to place the special position varying. Bug: angleproject:5496 Change-Id: I1f9a327c4750caef570c608d86953e9d0cc5eea3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2606532 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
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>
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>
Courtney Goeltzenleuchter c5b5cf6c 2020-09-10T16:58:18 Refactor to pass ProgramMergedVaryings to link impl Follow-on CL needs the ProgramMergedVaryings in the Vulkan backend to generate valid SPIRV. Bug: angleproject:3078 Change-Id: Ic442a3e0bd713fec36bd6b9420f67f3b1118e5ad Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2404336 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@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 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>
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>
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 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>
Tim Van Patten 68083e89 2020-03-04T15:55:53 Vulkan: Move cached samplers/images and has*() to ProgramExecutable The active samplers and images are being moved from Program into ProgramExecutable to unify interacting with them for Programs and ProgramPipelines Also, create some helper functions for gl::Program that ProgramExecutable can call to make it easier for ProgramPipeline to respond to similar queries for each of the Programs in the ProgramPipeline. Bug: angleproject:3570 Change-Id: I0b37f1a379e56b9659d82d92f6d7a546beee11cd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2087648 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 7e0699a2 2020-02-05T17:04:06 Create the ProgramExecutable Class The ProgramExecutable class is being created to collect data structures that are common to both Programs and ProgramPipelines, as well as any shared functions. This allows callers to request the current ProgramExecutable from the State and make Program-/ProgramPipeline-specific queries without needing to know exactly which responded. This will also allow the necessary data structures to only be populated and stored within the ProgramExecutable when necessary and reused as often as necessary. Bug: angleproject:3570 Change-Id: I101f08ab03421894667b4a426a04d2147489f0e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2040512 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 07467b4a 2020-03-20T10:40:56 Remove GL_CHROMIUM_path_rendering Bug: chromium:1063193 Bug: angleproject:4270 Change-Id: I35b24b7d8d892181955e49dd2495655bc57cb0df Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2112275 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jamie Madill 9d812d35 2020-03-18T15:31:14 Vulkan: Remove public FramebufferVk::getFramebuffer. Goal: enable rendering feedback loop detection for Manhattan. Making getFramebuffer private prevents direct access to the Framebuffer internals. Hiding access lets the FramebufferVk class switch up its implementation to support different VkFramebuffers for feedback loop cases. Also this is a general code cleanup. Bug: angleproject:4490 Change-Id: Ib4f5e34d476ccd8fc43a1adb031933ab347ca7b7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2109333 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill a741abb9 2020-02-21T16:37:37 Vulkan: Rename CommandGraphResource to Resource. Also renames the h and cpp files to ResourceVk (to keep distinct from other resource.h/cpp files) and renames 'onResourceAccess' to 'retain'. Cleans up a few remaining mentions of the command graph in comments. Bug: angleproject:4029 Change-Id: Ifc8e880c8cea3fc48a4aec4730191c88aa35a076 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2065920 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 3b82506a 2020-02-11T09:35:38 Vulkan: Command graph linearization (Step 5). Implements ES 3.1 support. Bug: angleproject:4029 Change-Id: I3c08602cf4ec64621bfdb40cd40d142b666e6edf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2046052 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Jamie Madill 3c066404 2020-02-05T12:43:12 Vulkan: Command graph linearization (Step 4). Implements GLES 3.0 functionality for the new command recording style. Tested with angle_end2end_tests. dEQP/CTS testing will come later. Bug: angleproject:4029 Change-Id: Ibdc4f1355a7b880946699ec227fd9807f4a27af9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2040197 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi e5385ea9 2020-01-27T13:40:18 Vulkan: Compile shaders at link time Since line raster emulation was changed to use specialization constants, it has been possible to compile shaders at link time. However, program pipeline objects would have required keeping the shader sources around for recompilation. Now that all necessary decorations are modified directly in SPIR-V, it's possible to compile the shaders at link time and forget about their sources. Program pipeline objects then simply "reconfigure" the generated SPIR-V. A next step could be to also create the Vulkan pipeline object at link time. A number of failures due to gaps in CTS testing prevent that work currently. In particular, in some situations the generated SPIR-V is not per spec, for example it may contain vertex attributes with aliasing locations, or have transform feedback capture of array elements misconfigured. Bug: angleproject:3394 Bug: angleproject:4253 Change-Id: I54c0884cf056b511a4a306225cc6ed2cef84d257 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2023186 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 71e6afb1 2020-01-14T14:12:31 Vulkan: Set set/binding in SPIR-V This change introduces a SPIR-V transformer that modifies shader interface variable decorations directly in SPIR-V instead of manipulating the input GLSL. Currently, descriptor set and binding indices are set by the transformer. The shader translator outputs arbitrary set and binding indices. Once compiled by glslang, the SPIR-V transformer modifies these decorations. The ultimate goal is to be able to modify the SPIR-V again when program pipeline objects decide a different set/binding is necessary. Bug: angleproject:3394 Change-Id: If358265a72bf1fe9f5676562b39a632cb2e05dc4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2001477 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b36e46ab 2020-01-08T15:49:18 Vulkan: Line raster emulation through specialization constant In preparation for compiling shaders early at link time, this change reworks line raster emulation such that it uses specialization constants instead of a preprocessor condition. This means drawing both triangles and lines with this program will still result in a one-time shader compilation. The compilation is still done at draw time in this change. Bug: angleproject:3394 Change-Id: I0bf91398868d7f7147456533b728906b505192b2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1992365 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 8fde1151 2020-01-09T14:22:35 Vulkan: fix default uniform descriptor rebind on program change When the program binding changes, we set the descriptor sets binding dirty bit if the program had any textures, UBOs, SSBOs, images or atomic counters. The check for default uniforms was missing. So if the two programs had no resources and were only using default uniforms, then drawing with one after the other didn't update the descriptor set binding of the default uniforms for the second draw. Bug: angleproject:4277 Change-Id: I631a1619658ee713484cfaee99fe1e39987e16e7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1993408 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Jamie Madill f10bf6bf 2019-09-26T10:27:18 Vulkan: Implement multi-threaded GL. The main component of this change is to make vk::BufferHelper, vk::ImageHelper and vk::SyncHelper use a common path. We introduce a new "vk::SharedGarbage" helper class that stores small lists of garbage from individual objects like an ImageHelper or BufferHelper. The SharedGarbage is stored in the RendererVk with the ResourceUse of the helper object. The ResourceUse tells RendererVk when it is safe to destroy the GarbageObjects. New "onGraphAccess" commands are added in a few places to enable the common garbage collection path. A couple Context-only resources like default attributes now are referenced where they were not before. Also reorganizes some functions so we can add a few helpful ASSERTs to our graph dependencies. Added "updateCurrentAccessNodes" for this. Also adds a "RendererScoped" helper to replace many uses of "ContextScoped". The multithreading EGL tests mostly pass but have some remaining flakiness so cannot yet be enabled. Bug: angleproject:2464 Change-Id: Ia3e3ae8848d731abf3f21ebe04c33e381e130be0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1808444 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 912e52d8 2019-08-23T00:25:09 Vulkan: Storage image support Image bindings are placed after atomic counters in the "resources" descriptor set. There are two issues yet to be addressed: - GL can create a 2D (array) view of a 3D image, but this is not allowed in Vulkan. If this cannot be made possible, emulation needs to be done. https://github.com/KhronosGroup/Vulkan-Docs/issues/1033 - GL can create an image view of a texture with a different format and have the data reinterpreted. This is not currently done. Bug: angleproject:3563 Change-Id: I95c4d92c50bb033212a9a67f3f2d6f97c074c7bf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1767366 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Fei Yang 4346c8b1 2019-04-09T14:50:23 Vulkan: pipeline cache not populated as blob cache is not set 1. Use vkMergePipelineCaches to recreate pipeline cache after blob cache callbacks are set after eglInititalize. 2. Use a more proper way to save the cache data to disk. Bug: angleproject:3318 Change-Id: Ied1fb572813198b51e02ed9629cbf34e2d9159b2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1683807 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi c13ca2af 2019-07-17T15:46:29 Vulkan: Allow more than one atomic counter buffer binding dEQP assumes there are more than one atomic counter buffers available. This is technically not a requirement by the standard, but nevertheless could be what applications expect as well. This change adds support for multiple atomic counter buffer bindings. This is done by declaring an array of storage buffers for the atomic counter buffers (instead of declaring only one) and passing the (binding, offset) pair around to functions instead of just the offset. The atomic counter is found by indexing `binding` into the storage buffer array first before indexing `offset` into its `uint[]`. ProgramVk's default uniform collection is also fixed not to include atomic counter uniforms. A remaining issue is that atomic counter buffer offsets don't have alignment requirements in GLES, but Vulkan does for storage buffers. Similar to emulated transform feedback buffer offsets, these should be sent to the shader through uniform values. This will be done in a follow up change. Bug: angleproject:3566 Change-Id: I5600225c24c38f1a8ecf5c64388073055733197d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1707931 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi b82d8633 2019-07-15T11:23:08 Vulkan: Atomic counter buffer support Vulkan doesn't treat atomic counters especially, and they are emulated with atomic access to storage buffers. A single atomic counter buffer binding per pipeline is supported. All the atomic counters identify an offset within this buffer. The shader is modified to include a storage buffer definition with `uint counters[];` as the only field. A compiler pass replaces atomic counter definitions with variables that hold the corresponding offset parameter, as well as changing atomic_uint types to just uint (as the offset). Where an atomic counter variable is used, it is replaced with the offset variable (plus the array index, if array). At the same time, built-in `atomicCounter*` functions are replaced with a corresponding `atomic*` function and `memoryBarrierAtomicCounter` is replaced with `memoryBarrierBuffer`. Bug: angleproject:3566 Change-Id: Iefb3d47de6a5cb3072bfa0cb94a46ac6a886d369 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1704635 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 87dc17b5 2019-07-22T11:41:27 Vulkan: Generalize buffers desc set name to include images And atomic counter buffers which are emulated with storage buffers. Bug: angleproject:3566 Change-Id: I102763900c779c3a84661491bad53aec384461f7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1713086 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 9ec3f51d 2019-07-19T13:06:16 Reland "Vulkan: Implement OES_get_program_binary extension" Reason for revert: default uniform initialization was incomplete This change has the following fixes: 1. Add missing default uniform initialization when loading program binaries. 2. Re-enable OES Program Binary capabilities for Vulkan. 3. Added two angle end2end test, - ProgramBinaryES3Test.BinaryWithLargeUniformCount uses several uniforms across the vertex and fragment shaders. - ProgramBinaryES3Test.ActiveUniformShader tests the difference between uniform static and active use Bug: angleproject:3216 Bug: angleproject:3217 Bug: angleproject:3665 Tests: dEQP-GLES3.functional.shader_api.program_binary* angle_end2end_tests --gtest_filter=ProgramBinary* Change-Id: If6886f01241d65bb1e17a21cc3406533021072ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1699069 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi f92fc916 2019-07-15T22:39:23 Vulkan: Compute shader support A DispatchHelper class is created as the equivalent of FramebufferHelper as a command graph resource. There's currently a single dispatcher and all dispatch calls are recorded on that. Context dirty bits are set up in such a way that graphics and compute workloads are independently handled, so that issuing a dispatch call wouldn't cause a framebuffer's render pass to rebind resources. Bug: angleproject:3562 Change-Id: Ib96db48297074d99b04324e44b067cfbfd43e333 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1688504 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
James Dong a9ec8749 2019-07-11T11:31:47 Vulkan: override format for mismatched attribs Prevents Vulkan validation error by replacing the input format for any mismatched vertex attributes with a format compatible to what the shader expects. Bug: angleproject:3436 Change-Id: Ia52f29c084d82bbc4e9149102cd4b5fc25ccb9b3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1698567 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 29fba5e0 2019-07-04T17:08:41 Vulkan: Prepare for variable-stage pipelines Compute (single-stage pipeline) is upcoming, but this change prepares GlslangWrapper to handle any number of stages (mostly). Additionally, this change binds each resource to each stage based on whether it's active, so that we don't hit the per-stage limit of resources by binding every resource to every stage. Bug: angleproject:3633 Bug: angleproject:3562 Change-Id: Ifebf691482846e0371c6e314f514226a4cfee258 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1689330 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 1cde0eab 2019-07-03T10:58:32 Vulkan: Add storage buffer support The storage buffers are placed in the same descriptor set as uniform buffers. Some refactoring is done to reuse code that handles UBOs to handle SSBOs as well. A good number of tests still fail as they test SSBOs in conjunction with compute shaders. Bug: angleproject:3561 Change-Id: Ia33c1f68e6f6402c746f5919ede87b2c308cf81c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1687126 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya a8da8668 2019-07-02T12:21:26 Vulkan: Implement OES_get_program_binary extension - Serialize and deserialize completed shader source of program for saving out for glGetProgramBinary(). - Cleaned up some unnecessary includes in cpp files. - Some refactoring within ProgramVk::ShaderInfo to minimize code duplication. - Added ProgramVk::ShaderInfo::saveShaderSource and ProgramVk::ShaderInfo::loadShaderSource. - Updated vk_caps_utils.cpp to enable getProgramBinary and add the GL_PROGRAM_BINARY_ANGLE program binary format. This follows the pattern for other backends. Bug: angleproject:3216 Tests: dEQP-GLES3.functional.shader_api.program_binary* angle_end2end_tests --gtest_filter=ProgramBinaryTest* Change-Id: I927a27aaf9aa3d7fac550819ee80d2676ec1d1be Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1683099 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 0bfa5504 2019-06-03T10:40:10 Vulkan: Emulate Transform Feedback with vertex shader output In ES 3.0 and 3.1, only non-indexed GL_POINTS, GL_LINES and GL_TRIANGLES is supported for transform feedback. Without tessellation and geometry shaders, we can calculate the exact location where each vertex transform output should be written on the CPU, and have each vertex shader invocation write its data separately to the appropriate location in the buffer. This depends on the vertexPipelineStoresAndAtomics Vulkan feature. Bug: angleproject:3205 Change-Id: I68ccbb80aece597cf20c557a0aee842360fea593 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1645678 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 88596bea 2019-06-13T14:17:48 Vulkan: Implement a texture descriptor cache. We noticed a significant hotspot in vkAllocateDesctiptorSets. The app was repeatedly cycling through a few combinations of active textures. For each state change in ANGLE we were allocating a new desctiptor set. This in turn would trigger internal driver memory allocation and cause jank. Using a cache avoids allocations entirely since the application is rotating through a stable set of textures. The descriptor cache is stored in each program. It is indexed by a set of 32-bit serials. Each texture generates a unique serial for every combination of VkImage and VkSampler that the texture owns. The texture descriptor is refreshed every time a texture changes or is rebound. The descriptor cache is accessed via an unoredered map with the texture serial sets as the hash key. We also store the maximum active texture index in the cache key so we don't need to hash and memcmp on all 64 active textures. This will currently fail if more than MAX_UINT serials are generated. But that number is high enough that it shouldn't be possible to hit in practice in a practical amount of time. Requires shifting the texture sync to ContextVk so we can get the new serial after the textures are updated. And to make sure to update the image layouts even if the descriptors are not dirty. Improves performance of the T-Rex demo. Also improves the score of the texture state change microbenchmark by about 40%. Bug: angleproject:3117 Change-Id: Ieb9bec1e8c1a7619814afab767a1980b959a8241 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1642226 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 266a9e8d 2019-06-05T15:15:10 Vulkan: Move descriptor pools into ProgramVk. Previously ContextVk owned the descriptor pools. We were trying to maximize descriptor reuse to conserve memory. However the default uniforms would have no possible sharing. And because uniform buffers are usually unique to a program it's likely there would be less reuse. Image descriptors could be shared. But with the advent of a descriptor cache in the Program it becomes difficult to manage the cache through descriptor pool recycling. Moving the pools into the Program simplifies the cache management. We could look at adding back more reuse in the future. Also shifts driver uniforms back into the end of the descriptor sets to make indexing into the Program's descriptor pools simpler. Bug: angleproject:3117 Change-Id: I52bb49cf322d944ad7cf08791efdf24b7fe573ce Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1644775 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang ee244c77 2019-05-06T10:30:18 Vulkan: Move command graph and garbage to ContextVk. To support multithreading, contexts should manage their own command graphs and garbage. This allows safe access to vulkan resources such as command pools without thread synchronization. BUG=angleproject:2464 Change-Id: I930149bc9f0793028761ee05ab50b8c0a4dec98a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1516515 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jonah Ryan-Davis 776694cd 2019-05-08T10:28:55 Change all ANGLE workarounds to use struct definition with info. Change each workaround from a simple bool to a struct with info including name, workaround set, description, and bug IDs. This will help with future workaround integration with Chrome. Bug: angleproject:1621 Change-Id: Ia27c180abaf845e280060c803e5994cc3152a057 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1593917 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 216f73d0 2019-04-12T13:32:30 Vulkan: add uniform buffer object support Support for layout qualifiers in interface blocks are added. All interface blocks are adjusted to either be in std140 or std430. In the Vulkan backend, a new descriptor set is added for UBOs. A dirty bit is added for UBO updating and pipeline layouts and descriptor bindings are updated. Bug: angleproject:3199, angleproject:3220 Change-Id: I271fc34ac2e1e8b76dee75e54a7cff0fe15fe4ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1565061 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 2660b503 2019-03-21T12:08:40 Vulkan: Restore CommandBuffer to namespace vk Moved vk::CommandBuffer and vk::SecondaryCommandBuffer to vk::priv:: and aliased vk::CommandBuffer to one or the other. This allows the rest of the classes to continue seeing vk::CommandBuffer as they used to do. Used a special alias for the primary command buffer that gets submitted (vk::PrimaryCommandBuffer). Bug: angleproject:3136 Change-Id: I61236fd182230991db7395d05e3da3be5e3f45be Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1534456 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Tobin Ehlis 134425c7 2019-03-15T17:02:17 Vulkan:Integrate SecondaryCommandBuffers Integrate the custom SecondaryCommandBuffer type into the CommandGraph nodes by adding new ANGLE_USE_CUSTOM_VULKAN_CMD_BUFFERS define that can be set in the BUILD gn args with angle_enable_custom_vulkan_cmd_buffers set to "true." Initially the custom cmd buffers are disabled by default. This adds some support functions to SecondaryCommandBuffer to make the integration easier by matching the wrapped cmd buffer interface: initialize(), end(), valid(). Bug: angleproject:3136 Change-Id: Ib910554583192550757bb8ce89914e3ea8737988 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1526556 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang e332e621 2019-02-14T12:53:04 D3D: Asynchronously load program binaries. Unpack as much of the binary steam as possible before passing the final loading of the shader programs off to a worker thread. Reporting as many possible link errors before becoming asynchronous means that linking should only fail due to unexpected system issues at that point. This also allows other backends to asynchronously load program binaries. BUG=angleproject:2857 Change-Id: I587917a3e54522114dabd41d1b14fc491c8fd18a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1473451 Commit-Queue: Jamie Madill <jmadill@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi d838178d 2019-03-04T11:07:47 Vulkan: Rename vk::Shared* to vk::RefCounted* To be specific regarding what being "shared" entails. Also, avoids confusion w.r.t to an upcoming vk::Shared class. Bug: angleproject:2464 Change-Id: Ib9c112bbb822ae30dab39c75a8cde25dd79b2258 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1499693 Reviewed-by: Jamie Madill <jmadill@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 3f0c4a56 2019-01-10T10:20:35 Vulkan: Faster state transitions. Implements a transition table from Pipeline Cache entry to state change neighbouring Pipeline Cache entries. We use a 64-bit mask to do a quick scan over the pipeline desc. This ends up being a lot faster than doing a full hash and memcmp over the pipeline description. Note that there could be future optimizations to this design. We might keep a hash map of the pipeline transitions instead of a list. Or use a sorted list. This could speed up the search when there are many transitions for cache entries. Also we could skip the transition table and opt to do a full hash when there are more than a configurable number of dirty states. This might be a bit faster in some cases. Likely this will be something we can add performance tests for in the future. Documentation is also added in a README file for the Vulkan back end. This will be extended over time. Improves performance about 30-35% on the VBO state change test. Bug: angleproject:3013 Change-Id: I793f9e3efd8887acf00ad60e4ac2502a54c95dee Reviewed-on: https://chromium-review.googlesource.com/c/1369287 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 254b32cb 2018-11-26T11:58:03 Vulkan: Make DynamicBuffer use BufferHelper This is so that the resulting buffers can be written to by the GPU. Additionally, the class is given the ability to create host-visible or device-local buffers, making map()-on-init() optional. This is in preparation for vertex/index transformations in compute. Bug: angleproject:2958 Change-Id: Ib8f5829e33a1e49fa8f80c70dbde74f313ae49ec Reviewed-on: https://chromium-review.googlesource.com/c/1351113 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Shahbaz Youssefi df066e9c 2018-11-13T15:39:47 Vulkan: Remove vk::ShaderType Use gl::ShaderType instead. For now, only GLES2 shaders are supported in ProgramVk. Bug: angleproject:2522 Change-Id: I17bc9afddb6d39cf45fb4dd37f34c7263a3ed515 Reviewed-on: https://chromium-review.googlesource.com/c/1333970 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill dc65c5bd 2018-11-21T11:07:26 Vulkan: Cache pipelines with Shader Programs. This allows for a few nice things. First and foremost it reduces the size of the PipelineDesc, which is now 232 bytes. It also allows us to completely forego pipeline caches for compute shaders. We also allow sharing vertex and fragment shaders among multiple programs for internal shaders. This is good for memory savings. To allow this we keep the shaders as ref counted objects. Bug: angleproject:2522 Change-Id: I2322be5061979d9669a0b25c152359561eeb80ee Reviewed-on: https://chromium-review.googlesource.com/c/1344449 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 77abad8d 2018-10-25T17:03:48 Remove Context::gatherParams. This won't be used in the future. It saves a few instructions on each entry point. Also refactors a bit of touched code. Also adds in a missed entry point: "glTexStorage2DMultisampleANGLE". Removes related code and moves remaining helper code in params.h into a new file entry_point_utils.h. In total this patch series reduces overhead by up to 5%. Bug: angleproject:2933 Change-Id: Ifb49564597cde6ba82dfc3e185227619fdc62612 Reviewed-on: https://chromium-review.googlesource.com/c/1299478 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill bfe31c42 2018-10-25T17:03:47 Remove uses of DrawCallParams. Packing and referencing this structure was causing unnecessary draw call overhead. This improves performance on all the back-ends. Impacts the GL back-end the most. In total this patch series reduces overhead by up to 5%. Bug: angleproject:2933 Change-Id: Ief416ab874e481baf960d02965978a311214a146 Reviewed-on: https://chromium-review.googlesource.com/c/1299477 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill f4a789f9 2018-10-18T16:56:20 Use angle::Result in front-end (Part 6) Refactors the gl::Program, gl::Compiler and gl::Query classes. Bug: angleproject:2491 Change-Id: I96acecdc6af301a89201bd7f5222a180433e5eb2 Reviewed-on: https://chromium-review.googlesource.com/c/1289711 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 78bcd2be 2018-10-16T15:05:20 Vulkan: Fix deleting in-use descriptor sets. Sequences of many frames with uniform updates could lead to a bug where we attempt to delete descriptor sets that are still in use. To trigger the bug we need to write enough uniform data to trigger a descriptor set to be freed. This would correctly trigger refresh sets in the Program. But if there was a second program idle in the background that also allocated descriptors from the old pool, the bug would manifest. Fix this by storing a shared handle to the descriptor pool in the Program. The dynamic descriptor pool won't recycle descriptor pools internally unless there are zero outstanding references to the pool. We could also improve this in a resource sharing situation by keeping a single shared dynamic descriptor pool per share group. Includes a contribution from tobine@google.com that adds a test to cover the bug. Bug: angleproject:2863 Change-Id: Id585b85f33f8cfa3772ceff3af512d1e4fb0b75a Reviewed-on: https://chromium-review.googlesource.com/c/1271919 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 785e8a0b 2018-10-04T17:42:00 Remove gl::LinkResult. Instead of returning a small struct from LinkProgram calls we use angle::Result. Linking can have 3 cases: - the link was successful -> angle::Result::Continue - the link failed -> angle::Result::Incomplete - there was an internal error -> angle::Result::Stop Note that any unexpected Incomplete is still an error. Each function that accepts Incomplete must check explicitly. This is the last user of ErrorOrResult. Bug: angleproject:2491 Change-Id: Idba23be27efe4b561720a4bdd8fe486b40779497 Reviewed-on: https://chromium-review.googlesource.com/c/1255645 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@google.com>
Jamie Madill b36a4816 2018-09-25T10:15:11 Vulkan: Add OpenGL line segment rasterization. Line rasterization rules are implemented using a shader patch. The patch does a small test and discards pixels that are outside of the OpenGL line region. The feature is disabled on Android until we can determine the root cause of the test failures. Bug: angleproject:2598 Change-Id: Ic76c5e40fa3ceff7643e735e66f5a9050240c80b Reviewed-on: https://chromium-review.googlesource.com/1120153 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 2b858c2f 2018-09-03T13:58:14 Vulkan: More micro-optimizations to setupDraw. Still a hotspot but much improved. Bug: angleproject:2786 Change-Id: Ie68ff314e6c952f281b48f6d9af37b5dcd194d6a Reviewed-on: https://chromium-review.googlesource.com/1194882 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 88fc6da3 2018-08-30T16:18:36 Vulkan: Mega-refactor to VertexArrayVk. This moves a lot of the code in VertexArrayVk into ContextVk. Having the code in a centralized place makes the code a bit more organized since the Context is reponsible for binding state to the command buffers. It also makes it easier to use dirty bits to track the command buffer state. Bug: angleproject:2786 Change-Id: I5cefbb14028e8f3fe651f26e997ca88f8f1c7628 Reviewed-on: https://chromium-review.googlesource.com/1188953 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 70aeda49 2018-08-20T12:17:40 Add gl::Program::syncState and dirty bits. Currently this handles uniform block bindings. Cleans up some logic in D3D. Bug: angleproject:2747 Change-Id: I8c2989738d50a77d6f6d90a9ff11dceab6d3129c Reviewed-on: https://chromium-review.googlesource.com/1172085 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
jchen10 7ae70d8f 2018-07-06T13:47:01 ParallelCompile: Parallelize D3D linking This adds a new linking state to Program. If a Program is in linking state, on the one hand the foreground thread may continue issuing more GL calls, and on the other hand the background linking threads may be accessing Program internally too. Without a proper constraint there must be conflicts between them. For this purpose, we block any further GL calls to Program until it's actually linked. In addition, we prohibit parallel linking an active program, so that ProgramD3D does not have to worry about such similar conflicts. Also changes the WorkerThread to support limiting the number of concurrently running worker threads. BUG=chromium:849576 Change-Id: I52618647539323f8bf27201320bdf7301c4982e6 Reviewed-on: https://chromium-review.googlesource.com/1127495 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 242c4fe8 2018-07-12T15:56:56 Vulkan: Store ProgramVk shaders in ShaderInfo. This encapsulates most of the logic for a Program into a helper class. Now we can store multiple instances of the Program's back-end to implement different shader behaviour at draw time. This will be useful for shader patching for OpenGL line segment raster. Bug: angleproject:2598 Change-Id: I800a737088574e28f3a4ec23b91c0cb2647e4e12 Reviewed-on: https://chromium-review.googlesource.com/1127302 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 84c662b9 2018-07-12T15:56:55 Vulkan: Store program textures cache. The program textures update needs to call into the incomplete textures cache. Moving this step into an update mechanism allows us to avoid some complexity of calling the incomplete textures cache inside the ProgramVk class. This enables further refactors for draw call shader patching and line segment raster. Bug: angleproject:2598 Change-Id: I0fd81ca58d2641572a2dd444992ccddd99ebc823 Reviewed-on: https://chromium-review.googlesource.com/1127301 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 06ca634e 2018-07-12T15:56:53 Vulkan: Refactor for draw call shader patching. This refactors a few methods to enable draw call shader patching. The shader serials in the Pipeline description are inserted right before we query the pipeline cache. This is done during a draw call. Also renames the 'QueueSerial' member of the ObjectAndSerial class to just 'Serial' to more accurately reflect it usage in ShaderAndSerial. Also changes the GlslangWrapper class to have all static methods. If we need to store state we can revert these changes at some point. Also splits the GlslangWrapper link call into two static calls. One call is called to get the linked source code. The second call compiles the linked sources into shader code. Only the second call will be necessary for draw call shader patching to implement OpenGL line rasterization in Vulkan. Bug: angleproject:2598 Change-Id: I7bad3c3eeab1fb062c15a840836db4a28f841a26 Reviewed-on: https://chromium-review.googlesource.com/1127158 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 21061026 2018-07-12T23:56:30 Vulkan: Use angle::Result error handling. Introduces a vk::Context class to contain an error handler and Renderer pointer. This abtracts the common code path for ContextVk + DisplayVk. Removes vk::Error in favor of the POD angle::Result class. There are a few remaining usages of gl::Error that will have to be cleaned up when we can change the front-end APIs. Bug: angleproject:2713 Change-Id: I5e68f223d595c6c561b59d6a85759e5738ed43c6 Reviewed-on: https://chromium-review.googlesource.com/1128924 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 9b168d02 2018-06-13T13:25:32 Vulkan: Store Pipeline/DS Layouts in ProgramVk. We can keep a shared reference to the Pipeline and Descriptor Set layouts in the Program. This ensures they are not in use when they are deleted. Note that they are allowed to be deleted as long as no command buffers are currently recording with them. If the Program is deleted then there should be no further commands using these layouts. Bug: angleproject:2462 Change-Id: I75161b3ce1ee8eae33dd6becee79b4262b844cdd Reviewed-on: https://chromium-review.googlesource.com/1089807 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Luc Ferron 48cdc2e8 2018-05-31T09:58:34 Vulkan: Implement setUniform for matrices correctly This fixes all these tests: dEQP-GLES2.functional.shaders.functions.datatypes.float_mat* dEQP-GLES2.functional.shaders.functions.datatypes.mat* dEQP-GLES2.functional.shaders.linkage.varying_type_mat* dEQP-GLES2.functional.shaders.matrix.* dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.render.basic.mat2_* dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.render.basic.mat3_* dEQP-GLES2.functional.shaders.conversions.matrix_to_matrix.* dEQP-GLES2.functional.shaders.conversions.matrix_combine.* dEQP-GLES2.functional.shaders.random.scalar_conversion* Bug:angleproject:2581 Bug:angleproject:2583 Bug:angleproject:2584 Bug:angleproject:2588 Change-Id: Ib8c03397f0229432292c51f4a6332f954fc8fa12 Reviewed-on: https://chromium-review.googlesource.com/1080392 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Luc Ferron 90968360 2018-05-04T08:47:22 Vulkan: Incomplete textures support 2D multisample is out of scope since its ES 3 only. Bug: angleproject:2499 Change-Id: Id5f81d713a2882ba2a91b7d3f281d71a3e9289f4 Reviewed-on: https://chromium-review.googlesource.com/1046786 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 33318de4 2018-05-01T11:22:54 Vulkan: Use ShaderType enum. This re-uses the same machinery as the GL front-end. It saves a lot of custom casting and array sizing. Currently we only support vertex and fragment shaders in Vulkan. Because of the Pipeline cache sizing, it's easier to stick with just VS/FS and introduce the full set of shaders when we move to packing the cache better. Bug: angleproject:2522 Bug: angleproject:2455 Change-Id: I21432a335c741885af87970d8ee52b4a36338304 Reviewed-on: https://chromium-review.googlesource.com/1036927 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6c7ab7fe 2018-03-31T14:19:15 Vulkan: Reorganize helper classes. This renames ResourceVk to vk::CommandGraphResource, which should help clarify its usage. This also moves LineLoopHandler, ImageHelper, and the DynamicBuffer and DynamicCommandPool classes into a new vk_helpers module. This file contains helper classes that manage other resources. Also this makes DynamicBuffer and DynamicDescriptorPool no longer inherit from CommandGraphResource. In the future, only Impl objects will be allowed to be graph resources. Bug: angleproject:2318 Change-Id: I0fa23da2ac853d90f3c822547a4a314f247cc757 Reviewed-on: https://chromium-review.googlesource.com/985200 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill f3614370 2018-03-31T14:19:14 Vulkan: Rename StreamingBuffer to DynamicBuffer. This makes it consistent with DynamicDescriptorPool, and gives a bit more precise definition. Bug: angleproject:2318 Change-Id: I8953113165ebe2d0dcfc0fc923d94280180442ce Reviewed-on: https://chromium-review.googlesource.com/985199 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Luc Ferron 6ea1b416 2018-03-21T16:13:01 Vulkan: Reallocate only the right uniform descriptor set when needed Bug: angleproject:2421 Change-Id: Ibdd8beee8103062a566b8caa23cdd9b8ac35d3a8 Reviewed-on: https://chromium-review.googlesource.com/974105 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Luc Ferron 7a06ac1b 2018-03-15T10:17:04 Vulkan: Dynamic update of uniforms - This change enables us to update uniforms indefintely using VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC descriptor types. - Enables 219 new dEQP tests in the uniform_api namespace. - Creates a new white box test to validate new buffer allocation. Bug: angleproject:2392 Change-Id: I8146e6104a6b7727f63265a4671577d251a8fca8 Reviewed-on: https://chromium-review.googlesource.com/965929 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Luc Ferron 7cec3353 2018-03-13T13:29:34 Vulkan: Get/SetUniform for float / int and vec* Bug:angleproject:2392 Change-Id: I2110ecde653a85a28b515dc9d8473a1b37a73eb6 Reviewed-on: https://chromium-review.googlesource.com/962718 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Jamie Madill b7d924a8 2018-03-10T11:16:54 Vulkan: Make free part of DescriptorPool. This also fixes a missed VkResult error. In order to do this we also return an error from ProgramImpl::destroy. Bug: angleproject:2396 Change-Id: I649b19e64732785bb33eebadea7f361245137d0f Reviewed-on: https://chromium-review.googlesource.com/958406 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 67ae6c58 2018-03-09T11:49:01 Vulkan: Use free descriptor set bits in pool. This forces us to free descriptor sets when we're done with them, but saves us from needing to track when a descriptor set pool is no longer in use. We may need to revisit this in the future if we want to support pool allocation for performance. Bug: angleproject:2396 Change-Id: I3f3184f3dd9e4c2911e1aade4dcb95962a26c3a7 Reviewed-on: https://chromium-review.googlesource.com/956574 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3c424b48 2018-01-19T12:35:09 Vulkan: Add vk_cache_utils.h. This file contains the Pipeline and RenderPass cache utils. Also renames renderervk_utils.h to vk_utils.h and the format utils file. Refactoring change only. Bug: angleproject:2163 Change-Id: I5113a9a2c6f0b0960d38e6c2d8e391fa2d9f5f6a Reviewed-on: https://chromium-review.googlesource.com/876505 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill f2f6d379 2018-01-10T21:37:23 Vulkan: Add PipelineDesc. The PipelineDesc class is a 512-byte packed description of the entire Vulkan pipeline state. It uses the alignas keyword and some static asserts to verify that the structures are packed. This ensures that when ANGLE uses MurmurHash to hash the entire struct, and memcmp to check for identity, that there are no garbage padding bits. This CL does not implement the Pipeline cache, but it will help, since now we have a packed type that can be used as the key to a hash map. Bug: angleproject:2163 Change-Id: I16efa927f08d30d89a9c4c8943edd211c6878ac8 Reviewed-on: https://chromium-review.googlesource.com/829893 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 8c3988c5 2017-12-21T14:44:56 Vulkan: Use one pipeline layout for all Programs. This simplifies the pipeline state object caching. We will not need to use any extra bits to cache based on program properties - instead all programs will be compatible. The pipeline layout strucutre is described in the design docs. It currently only has two bind groups: the first for default uniforms, and the second for Textures. In the future we might re-organize this to handle driver uniforms, dynamic push constants, and/or program uniform buffers with ES 3.0. Instead of storing only the Textures that are required by a Program, we reserve space for the maximum possible Texture units. We might have to revisit this very simple design in the future to support texture arrays, which are handled specially in Vulkan. Bug: angleproject:2163 Change-Id: I3e1656c2c73045aed56838a5f1267b246a623362 Reviewed-on: https://chromium-review.googlesource.com/837943 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill acf2f3ad 2017-11-21T19:22:44 Apply Chromium style fixes. This addresses several minor code quality issues that are validated in Chromium, but not yet applied to ANGLE: * constructors and destructors must be defined out-of-line * auto is not allowed for simple pointer types * use override everywhere instead of virtual * virtual functions must also be defined out-of-line Slightly reduces binary size for me (~2k on Win, 150k on Linux). Bug: angleproject:1569 Change-Id: I073ca3365188caf5f29fb28d9eb207903c1843e6 Reviewed-on: https://chromium-review.googlesource.com/779959 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6db1c2e8 2017-11-08T09:17:40 Link interface blocks in ProgramImpl::link. This allows the back-end to have access to the interface block info in the link operation, and also allows the interface block info to have direct access to the post-link Impl information. BUG=angleproject:2208 Change-Id: Ib2bfb3c9155eee715bd3d29de1c3fdd67b16eed4 Reviewed-on: https://chromium-review.googlesource.com/753521 Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill c9727f31 2017-11-07T12:37:07 Pass InterfaceBlockLinker to ProgramImpl::link. This change is in preparation for moving the linking logic to the Implementation. Introduces a ProgramLinkedResources class that is passed into the Impl and holds linking-related info such as the UBOs, Varyings, etc. BUG=angleproject:2208 Change-Id: I2ef0824b54bfb462c79d003bffe34e9cfad60d8a Reviewed-on: https://chromium-review.googlesource.com/746204 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 5547b384 2017-10-23T18:16:01 Vulkan: Implement simple static textures. After this change, the SimpleTexture2D sample mostly runs. BUG=angleproject:2167 Change-Id: Ie6d56f890b1aede329e11d1e987d0f8c17a2d0b4 Reviewed-on: https://chromium-review.googlesource.com/720072 Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 76e471e9 2017-10-21T09:56:01 Vulkan: Implement basic uniforms. This implementation adds one descriptor set with two bindings: one for default vertex uniforms and the other for fragment. It adds two corresponding uniform buffers, and the logic for updating the descriptor sets bound to Vulkan. It doesn't handle much in the way of synchronization and dependency management, or uniform update. If there are only vertex or fragment uniforms the empty uniform buffer is omitted from the descriptor set. If both are missing, there is no descriptor set bound. Note that as our implementation progresses we might not be able to initialize our descriptor sets at link time, due to streaming in uniform data. BUG=angleproject:2167 Change-Id: I4ce4c3879ab454114df43bfac8d87ddf817fc045 Reviewed-on: https://chromium-review.googlesource.com/706340 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill c514348e 2017-10-15T20:20:06 Vulkan: Minor cleanups to ProgramVk. This moves the Pipeline Layout and related layout code init into the LinkProgram implementation call. These resources don't depend on anything other than the state at link time. Moving the init makes the calling code a bit simpler since it doesn't need to process error conditions and check for validity every time. Also introduce a reset() method, similar to ProgramD3D. This will allow us to re-link a program multiple times (once resource lifetime management is properly implemented). BUG=angleproject:2167 Change-Id: Ibe76ed9b901adf6b69b51ba8219b3ce79d55b87d Reviewed-on: https://chromium-review.googlesource.com/720071 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Olli Etuaho 855d964b 2017-05-17T14:05:06 Prefix user-defined names in GLSL output Now user-defined names are prefixed by _u in GLSL output in case name hashing is not on. Internal names such as names of temporary variables created in AST transformations are written out as such. This makes handling of internal function names and internal variable names consistent. It also removes the possibility of name conflicts between user-defined names and internal names in case name hashing is not on. In the same vein, it makes it safe to use GLSL reserved words that are not reserved in ESSL as variable names in case name hashing is not on. This also makes the GLSL output more consistent with how names are handled in HLSL output. Name hashing code is shared between VariableInfo and OutputGLSLBase to ensure names are handled consistently in both. The name that's used in the shader source for a given interface variable is written out to ShaderVariable::mappedName. An exception needs to be made for identifiers close to the length limit, since adding any prefix would take them over the limit. But they can be just written out as such, since we don't have any builtins or ANGLE internal variables that have as long names and could create a conflict. BUG=angleproject:2139 BUG=angleproject:2038 TEST=angle_unittests, angle_end2end_tests, WebGL conformance tests Change-Id: Id6ed052c4fab2d091227dc9a3668083053b67a38 Reviewed-on: https://chromium-review.googlesource.com/507647 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 54164b0c 2017-08-28T15:17:37 Add getUniform impl methods. This will let us remove some of the uniform data management code in the GL front-end, and simplify the GL back-end. It will also enable us to implement uniform data more efficiently in the D3D11 back-end, and probably Vulkan back-end later. This also implements a new impl method for the ProgramGL class to flag optimized-out uniforms as no longer used, post-link. This is important because otherwise the optimized uniforms get assigned valid locations, and then the getUniform calls are expected to succeed. We also use a workaround for uniform value queries for the GL back-end. It seems as though some drivers (seen on NVIDIA and AMD) may not properly clamp to the maximum representable integer value when querying out-of-range floating point values. Work around this by always calling the driver with the proper type and then casting the value in ANGLE. BUG=angleproject:1390 Change-Id: I03dc2382e7af52455c356a2bf3971a4d1bd46ec6 Reviewed-on: https://chromium-review.googlesource.com/616785 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 27a60631 2017-06-30T15:12:01 Re-apply UBO binding workaround on program save. The workaround which was previously defined to only apply on load also seems to affect save on some AMD drivers. BUG=angleproject:1637 BUG=angleproject:1897 Change-Id: Ia01a1420a484f3c2682ce97eaab18baccfb66a50 Reviewed-on: https://chromium-review.googlesource.com/558008 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 9cf9e871 2017-06-05T12:59:25 Move LinkResult to the gl:: namespace. This is a derived type from gl::Error so makes sense to be there. Also makes it more accessible than in ProgramImpl.h BUG=angleproject:1897 Change-Id: Id41b13e5a072745d8c361057f5bef8f152e0452b Reviewed-on: https://chromium-review.googlesource.com/522872 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 83418fb1 2017-06-05T12:59:24 Don't allow for error in ProgramImpl::save. Refactoring cleanup patch only. BUG=angleproject:1897 Change-Id: I6d12de5dab16ead9684886a1cf15b570e3c98156 Reviewed-on: https://chromium-review.googlesource.com/522871 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill c564c070 2017-06-01T12:45:42 Pass gl::Context to impl methods instead of ContextImpl. In some cases we might have to call back into the GL layer, passing the Context, and if we just have a ContextImpl pointer this isn't possible. It also removes the need for SafeGetImpl. BUG=angleproject:2044 Change-Id: I6363e84b25648c992c25779d4c43f795aa2866d6 Reviewed-on: https://chromium-review.googlesource.com/516835 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>