src/libANGLE/renderer/vulkan/ProgramVk.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi 6a4cad87 2019-05-01T13:04:00 Vulkan: Tighten descriptor stage usage hints Per-stage uniform buffers are marked with the specific stage. Program uniform buffers and images are specified to be used in all graphics stages. Descriptors used in internal shaders are marked for use in either compute or fragment stages. Bug: angleproject:3220 Change-Id: Ifcac36a1224f0392ba5fba50660514e498256401 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1595439 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com>
Courtney Goeltzenleuchter eaf2d928 2019-04-18T16:31:25 Add support for OES_depth_texture Note: Includes workaround for http://anglebug.com/3452 - some Android devices do not indicate filtering support on VK_FORMAT_D16_UNORM. Bug: angleproject:3103 Test: angle_end2end_tests --gtest_filter=DepthStencilFormatsTest.DepthTexture/* angle_end2end_tests --gtest_filter=DepthStencilFormatsTest.PackedDepthStencil/* angle_end2end_tests --gtest_filter=DepthStencilFormatsTest.DepthTextureRender/ES2_VULKAN Change-Id: Ic325fb94ab0e619a17c2e149e0e0865fa4142f3a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1575426 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi b783fbc7 2019-05-10T23:16:17 Vulkan: Fix matrix uniforms A piece of code shared with d3d was used to implement this feature. However, we store the uniform data transposed and row-major in d3d to accomodate the fact that matrix indexing in HLSL is the opposite of GLSL (mat[row][col] in HLSL as opposed to mat[col][row] in GLSL). There were two functions that copied the source matrix fields either as column-major or source-major (corresponding to `transpose` false or true respectively in glUniformMatrix*) into a row-major destination. These functions are refactored into one, which copies from any-major source to any-major destination. The HLSL backend uses the "to row-major" variant and the Vulkan backend uses the "to column-major" variant. Bug: angleproject:3198 Change-Id: I7254da4fbe6916af78c5906abcb82ca01674ab9f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1607541 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 9d519ab1 2019-05-09T23:09:46 Vulkan: Rework layout block storage conversion Previously, a pass over the shader was made, converting shared and packed interface blocks with block storage to std140. This resulted in link success between interface blocks with different storage as they were all translated to std140. With this change, this pass is removed. The link step proceeds with the block storage specifiers as seen by GLES, and only upon Vulkan GLSL shader generation "shared" and "packed" are converted to std140. Bug: angleproject:3199 Change-Id: I069415ab9c9b4e1034bc00f64cd2d9e2d73f5956 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1605262 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi fdbece20 2019-05-09T18:06:34 Vulkan: Support unsigned int uniform types Bug: angleproject:3198 Change-Id: Iac5d1389f4f466b7886246d8ca529e8f26a6a5bd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1603629 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: 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>
Tobin Ehlis e18ff25d 2019-03-21T08:41:08 Vulkan:Refactor SecondaryCommandBuffers A bunch of changes to rework and improve SecondaryCommandBuffers. Inlined all of the command functions and moved them into the header. Created new specialized commands for updating Compute/Graphics DescriptorSets and setting a memoryBarrier. Updated all of the pointer storage to be inferred rather than explicitly stored in order to save space. Also removed various params that are fixed in ANGLE to save space. Bug: angleproject:3136 Change-Id: I994bb70d5e4db6d9e71d38ac62451aaec780a5e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1535704 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
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>
Shahbaz Youssefi 7dafe3eb 2019-01-28T11:39:15 Vulkan: optimize image memory barriers Each image was tracking its current layout, but not the pipeline stage it was used. Additionally, the barrier access masks were inferred from the layout. This incurred two inefficiencies: - The src pipeline stage mask often included all stages, causing unnecessarily heavy barriers. - The access masks included all possible accesses by a layout, which in some cases was overkill, like VK_ACCESS_MEMORY_WRITE_BIT for VK_IMAGE_LAYOUT_GENERAL (which will eventually used for compute shader output). This change instead creates an enum where each element represents the layout, the stage and access masks when transitioning into the layout and the stage and access masks when transitioning out of that layout. The image will instead track a value of this enum (instead of VkImageLayout), which allows it to create the layout transition barriers as tight as possible, since it includes all the necessary information. Bug: angleproject:2999 Change-Id: I91535ce06d10530a6fc217ad3b94b7e288521e25 Reviewed-on: https://chromium-review.googlesource.com/c/1440074 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Jamie Madill 4e712be2 2019-01-03T13:53:59 Refactor BlockLayoutEncoder APIs for std430. This splits HLSL SSBO access into two steps. First we compute a mapping from the collected SSBO variable names to TField pointers. Then during tree traversal we use a block encoding visitor class that uses the shader names to store BlockMemberInfo structures for the structures and variables. Each nested structure is traversed separately so that the BlockMemberInfo offsets are relative to the structure start rather than the enclosing block. The array stride for a structure is the size of the struct after all the alignment is included. This gives the correct results for the SSBO access chain in the HLSL code. It also will allow us to use the same encoding and visiting logic for SSBOs on the API side. Bug: angleproject:3024 Change-Id: I42b1db0e7547782ae77fe5f64a797f803f203f45 Reviewed-on: https://chromium-review.googlesource.com/c/1352731 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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>
Jamie Madill 7c985f5c 2018-11-29T18:16:17 Make angle::Result an enum. This moves away from a class type to a value type. This should improve performance when using angle::Result as a return value. Previously the generated code would return a pointer instead of a value. Improves performance in the most targeted microbenchmark by 10%. In more realistic scanarios it will have a smaller improvement. Also simplifies the class implementation and usage. Includes some unrelated code generation changes. Bug: angleproject:2491 Change-Id: Ifcf86870bf1c00a2f73c39ea6e4f05ca705050aa Reviewed-on: https://chromium-review.googlesource.com/c/1356139 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 5829c03d 2018-11-28T10:39:41 Vulkan: fix ProgramVk never releasing uniform buffers Bug: angleproject:2958 Change-Id: I7fd50e8b2029aad59a35050f401e1cf70d047444 Reviewed-on: https://chromium-review.googlesource.com/c/1354098 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>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Yuly Novikov 27780295 2018-11-09T11:19:49 Vulkan: refactor WrappedObject descendants Methods receive VkDevice instead of Context and return VkResult instead of angle::Result now. Bug: angleproject:2657 Change-Id: I3eca8692ad0b3b6e96e31fd433ed14e04384990e Reviewed-on: https://chromium-review.googlesource.com/c/1330105 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@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>
Shahbaz Youssefi 06270c9e 2018-10-03T17:00:25 Vulkan: Safer struct initialization Using x = {}; before filling out each field, we can be sure any missing field is 0 initialized. This in turn helps us not have to specify certain fields that are generally unused (at the moment), such as pNext. Bug: angleproject:2860 Change-Id: Ia1fa2db3ecfb316673a02ac0c5e13e47e055a19f Reviewed-on: https://chromium-review.googlesource.com/c/1259764 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@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>
Geoff Lang beb0c946 2018-09-27T11:22:23 Vulkan: Make sure the default uniform info arrays match indices. When inserting uniform layout info into the default uniform block, the array sizes need to match but insertion was skipped when the uniform was a sampler. This caused heap corruption when uniform data was written to the wrong offset in the buffer. BUG=angleproject:2859 Change-Id: Ia58a68870e2a4805391266dfe73fe8c8d238931d Reviewed-on: https://chromium-review.googlesource.com/1249562 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Tobin Ehlis f5aad063 2018-09-19T14:39:00 Avoid flush/invalidate of host-coherent memory For DynamicBuffer avoid calling vkFlushMappedMemoryRanges() or vkInvalidateMappedMemoryRanges() if the underlying memory is host- coherent. These calls are not required for host-coherent memory and may negatively impact performance. When currently allocating HOST_VISIBLE memory it's possible to also get HOST_COHERENT memory even though it's not explicitly requested. Because of this, the change updates the memory allocaiton interfaces through the stack to pass back the actual allocated memory properties so that it can be checked to see if it's host-coherent. Bug: angleproject:2804 Change-Id: Ife95c4b98115b16d16c087dd72dba7d9661fdb46 Reviewed-on: https://chromium-review.googlesource.com/1234276 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Yuly Novikov <ynovikov@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 4c310831 2018-08-29T13:43:17 Vulkan: Return VkDeviceSize from DynamicBuffer. This obviates many static_casts. More closely represents what Vulkan is doing. One cast remains where we are using uint32_t for dynamic offsets with uniform buffers. Bug: angleproject:2786 Change-Id: I043ebb5d965f46ee6ebbfcb91d75a58508cacfe3 Reviewed-on: https://chromium-review.googlesource.com/1188949 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@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 3fd614d0 2018-08-13T12:21:58 Refactor Context dependency for resolveCompile The context parameter of Shader::resolveCompile method causes a bad impact that many methods in Shader, Program etc. have to have a same context parameter. By removing it, these methods can be decoupled from Context. BUG=chromium:849576 Change-Id: Ia5545ee9dce45794550f6086bc0e6c4707e1276e Reviewed-on: https://chromium-review.googlesource.com/1172202 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: 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 d34aa362 2018-07-12T15:56:54 Vulkan: Add a create shader helper. This will be useful for line segment rasterization. Bug: angleproject:2598 Change-Id: I84912c976665ecb32903181fa820b8db88786a28 Reviewed-on: https://chromium-review.googlesource.com/1127299 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 b01b4802 2018-07-10T12:43:57 Vulkan: Apply driver uniforms descriptor set. Also modifies the ProgramVk to initialize the Pipeline and Desriptor Set layouts with driver uniforms enabled. Bug: angleproject:2717 Change-Id: I24f7bf6f89b450d1dcb62dcfa7411555ebe3a937 Reviewed-on: https://chromium-review.googlesource.com/1131568 Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e4a6d7a3 2018-07-09T13:32:37 Vulkan: Make DynamicDescriptorPool single pool. This completes a prior refactor. DynamicDescriptorPool couldn't robustly handle multiple pools so only accept one as a parameter. We were already only using one at a time in practice. This removes the need to look up the pool index from the descriptor type which became problematic later on. Bug: angleproject:2717 Change-Id: I7fb92d5ab55bbe1f35b6b9cfcd8981cc1ca358f1 Reviewed-on: https://chromium-review.googlesource.com/1127157 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Luc Ferron a72ebeba 2018-06-28T11:16:58 Vulkan: Fix issue in DynamicBuffer - We weren't keeping track of mSize correctly, causing some very specific index buffer bindings to fail. The size returned when allocating the buffer can be a bit different than the size requested, and that extra space between mSize and the allocated size was not meant to be used, causing errors in the validation layers. Bug: angleproject:2580 Change-Id: I47eb7b8de6f4f657de14385b77ba6a459add599b Reviewed-on: https://chromium-review.googlesource.com/1118607 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Jamie Madill 3bb2bbea 2018-06-15T09:47:03 Program: Sampler uniform query in front-end. We have this information stored in the front-end sampler bindings. This solves sampler uniform query across the various back-ends. Turns on a bunch of uniform_api dEQP tests. Bug: angleproject:2612 Change-Id: If8752a26438595ad103598369df360e2f5e12d53 Reviewed-on: https://chromium-review.googlesource.com/1101572 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill edeaa835 2018-06-22T09:18:41 Vulkan: Fix mixed descriptor pool updates. When updating the Uniforms and Textures pools at different rates we could trigger an ANGLE bug. We would sometimes reset and free the currently bound descriptors. We can fix this by using separate descriptor pools for each descriptor set. Bug: angleproject:2678 Change-Id: I605b558531e7745484e16156a3af5eac40ffcc79 Reviewed-on: https://chromium-review.googlesource.com/1110662 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Jamie Madill caaff169 2018-06-22T08:55:37 Vulkan: Fix releasing Programs that are in use. The bug would only manifest after a glUseProgram(0) at a specific time. Fix the bug by releasing the uniform buffer to the Renderer instead. Bug: angleproject:2397 Change-Id: Ia071da5af00dfc740e0fc20864d41f7b3e0afda4 Reviewed-on: https://chromium-review.googlesource.com/1110712 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Jamie Madill 8a4c49fb 2018-06-21T15:43:06 Vulkan: Refactor DynamicDescriptorPool. Changes the set counting to use a free count by descriptor type. Also changes the init to take a pool size count that more closely mirrors Vulkan. Will lead to a fix for descriptor set recreation. Bug: angleproject:2678 Change-Id: I26816befec28ebb866fb0f3aaba27d2bc1d3be43 Reviewed-on: https://chromium-review.googlesource.com/1110661 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill fddac3a3 2018-06-20T15:21:31 Vulkan: Remove obsolete TODO. Bug: angleproject:2397 Change-Id: I847772aa5ce1c27f7fd232d50d39c15f10135900 Reviewed-on: https://chromium-review.googlesource.com/1108515 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Luc Ferron c252d757 2018-06-14T09:32:40 Vulkan: Fill in glslang resources with our caps This allows us to enable these tests: dEQP-GLES2.functional.shaders.fragdata.valid_static_index Bug: angleproject:2594 Change-Id: I2c9a10063500d96d1c4bfb761f4b45590114b7ef Reviewed-on: https://chromium-review.googlesource.com/1100957 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Luc Ferron f6fd48fd 2018-06-18T08:11:27 Vulkan: Get uniform for array of matrices fix Bug: angleproject:2666 Change-Id: Ib50b0dd89abbd1d8d6c829a5ecf6438acc970da3 Reviewed-on: https://chromium-review.googlesource.com/1104305 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Jamie Madill 50cf2be0 2018-06-15T09:46:57 Reformat some style in touched files. This was triggered by running the code generation script. Bug: angleproject:2665 Change-Id: Id639c78eb618182ee1859678590cf0f559b572c2 Reviewed-on: https://chromium-review.googlesource.com/1101564 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Luc Ferron <lucferron@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 4cc753e0 2018-06-13T13:25:33 Vulkan: Implement sampler arrays. Bug: angleproject:2462 Change-Id: If9c9cb69624d6f9f0895f6883e1eed19a27e6cb4 Reviewed-on: https://chromium-review.googlesource.com/1089809 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>
Jamie Madill c7918ceb 2018-06-13T13:25:31 Vulkan: Add PipelineLayout and DescriptorSetLayout caches. This will be necessary to support more than one PipelineLayout per instance of ANGLE. Sampler array handling requires different layouts for different sampler uses. Bug: angleproject:2462 Change-Id: I1d8b4919eed1a589002ad1898b05186f420061c7 Reviewed-on: https://chromium-review.googlesource.com/1089806 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Luc Ferron fba1f61d 2018-06-04T14:37:17 Vulkan: No-op on ProgramVk::Validate implementation Also enable the dEQP test that was blocked on that UNIMPLEMENTED call. Bug: angleproject:2600 Change-Id: Iae1280d6e4f52c5b8e66c9f7fbaa9b2730c4eb0e Reviewed-on: https://chromium-review.googlesource.com/1085693 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Luc Ferron e9465a61 2018-06-04T10:41:52 Vulkan: Fix wrong read ptr location when updating uniform block Fixes these dEQP tests: dEQP-GLES2.functional.state_query.shader.uniform_value_array dEQP-GLES2.functional.shaders.indexing.uniform_array.vec2_* dEQP-GLES2.functional.shaders.indexing.uniform_array.vec3_* dEQP-GLES2.functional.shaders.struct.uniform.nested_struct_array* dEQP-GLES2.functional.shaders.struct.uniform.loop_nested_struct_array* dEQP-GLES2.functional.shaders.struct.uniform.dynamic_loop_nested_struct_array* dEQP-GLES2.functional.uniform_api.value.assigned.by_value.get_uniform.multiple_nested_structs_arrays.* dEQP-GLES2.functional.uniform_api.value.assigned.basic_array_assign_partial.multiple_basic_array.* dEQP-GLES2.functional.uniform_api.value.assigned.basic_array_assign_full.multiple_basic_array.* dEQP-GLES2.functional.uniform_api.value.assigned.by_value.get_uniform.multiple_basic_array.vertex dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.render.multiple_basic dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.basic_array_first_elem_without_brackets dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.multiple_basic.vertex dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.multiple_basic.fragment dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.multiple_basic.both dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.multiple_basic_array.* dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.multiple_nested_structs_arrays.* dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.struct_in_array.bool_* dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.basic_struct.bool_* dEQP-GLES2.functional.uniform_api.info_query.unused_uniforms.* dEQP-GLES2.functional.uniform_api.value.initial.get_uniform.multiple_basic.vertex dEQP-GLES2.functional.uniform_api.value.initial.get_uniform.multiple_basic.fragment dEQP-GLES2.functional.uniform_api.value.initial.get_uniform.multiple_basic.both dEQP-GLES2.functional.uniform_api.value.initial.get_uniform.multiple_basic_array.* dEQP-GLES2.functional.uniform_api.value.initial.get_uniform.multiple_nested_structs_arrays.* dEQP-GLES2.functional.uniform_api.value.initial.render.basic_struct.* dEQP-GLES2.functional.uniform_api.value.initial.render.struct_in_array.* dEQP-GLES2.functional.uniform_api.value.initial.render.array_in_struct.* dEQP-GLES2.functional.uniform_api.value.initial.render.multiple_basic_array.* dEQP-GLES2.functional.uniform_api.value.initial.render.multiple_nested_structs_arrays.* dEQP-GLES2.functional.uniform_api.value.initial.render.nested_structs_arrays.* dEQP-GLES2.functional.uniform_api.value.assigned.unused_uniforms* Bug: angleproject:2586 Change-Id: I51f619832424131b7c1eeff9589259b14cf4f358 Reviewed-on: https://chromium-review.googlesource.com/1085369 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Luc Ferron c8fbff3d 2018-06-04T10:30:48 Vulkan: Update uniforms bugfix and enable dEQP tests with it If a uniform was already marked as dirty, and the call to setMatrixUniform wasn't updating the data, the flag was flipped to false, causing the descriptor set never to be initialized. This enables these tests: dEQP-GLES2.functional.shaders.conversions.scalar_to_matrix.* Bug: angleproject:2583 Change-Id: I0bcb95cc66951e0ed347af5d874178c403a1c08a Reviewed-on: https://chromium-review.googlesource.com/1085228 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Luc Ferron <lucferron@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 a9ab0f37 2018-05-17T17:03:55 Vulkan: Fix DynamicBuffer usages, need to use specific alignment The alignment used to allocate VkBuffers in the VkBuffer needs to be at least the size of the nonCoherentAtomSize defined in the limits of the VkDevicePhysicalProperties. The latest roll of the vulkan-validation-layers added that check and caused a bunch of errors. This is fixing them. Bug: angleproject:2565 Change-Id: Ia2ad506dce7966adb6220c52ea891903922c47d0 Reviewed-on: https://chromium-review.googlesource.com/1064950 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@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 78feddc2 2018-04-27T11:45:05 Vulkan: Take serials in PipelineDesc::updateShaders. This makes the API easy to use with internal shaders and pipelines. This is useful for the implementation of masked color clear. Also renames the serials as shader serials. This is more precise than program serials. Bug: angleproject:2455 Change-Id: Ie6247d1212ed4df856b561a5e9f16c0378202588 Reviewed-on: https://chromium-review.googlesource.com/1032857 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@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 0cb6dc4c 2018-04-16T10:36:39 Vulkan: Fix texture descriptor set alloc count. We were reserving half the required descriptor sets for our pool. This fixes the counting and ensures we won't regress by adding a test. Also enables the cube map texture sample, and removes an UNIMPLEMENTED warning that was spurious. Bug: angleproject:2318 Change-Id: I371cd7c5b42e1ce980cce7bb0ef04885db72b614 Reviewed-on: https://chromium-review.googlesource.com/1014165 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Luc Ferron d91c3793 2018-04-06T09:36:36 Vulkan: Implement support for structs in uniforms - Also enables 174 additional dEQP tests. Bug: angleproject:2446 Change-Id: I07cce46815d2f7a80fd48e7fd9407f7d528b397f Reviewed-on: https://chromium-review.googlesource.com/998406 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Luc Ferron <lucferron@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 c3755fc5 2018-04-05T08:39:13 Vulkan: Move Streaming data to VertexArrayVk. Instead of the ContextVk owning the translations for the various attributes, make the VertexArrayVk own them. This way they can handle the dirty bit state notifications directly instead of needing their own Observers. Bug: angleproject:2389 Change-Id: I5e571ba6c563e820a4c0d5f92db35031e6f2428a Reviewed-on: https://chromium-review.googlesource.com/989258 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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>
Jamie Madill 858c1ccc 2018-03-31T14:19:13 Vulkan: Move image layout into helper. Now that we're using the helper everywhere, we can clean up the vk::Image class and move the layout tracking into ImageHelper. Bug: angleproject:2318 Change-Id: I9636835a2a3a76f181dac629bd4182bc5815cdee Reviewed-on: https://chromium-review.googlesource.com/980774 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Luc Ferron 24a3137a 2018-04-04T11:49:14 Vulkan: Follow up change to optimize number of condition checks This is a follow up of a comment on this CL: https://chromium-review.googlesource.com/c/angle/angle/+/985954 Bug: angleproject:2442 Change-Id: Id104c1437d77e6102b94351623ee8538a1d6c3d7 Reviewed-on: https://chromium-review.googlesource.com/996012 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Luc Ferron 62059a55 2018-03-29T07:01:35 Vulkan: Support for bools and bvec* uniforms - Also enables the dEQP tests for bools and bvec* Bug: angleproject:2442 Change-Id: Ib9ea017008293bf407bf7e5b5b881f376f226cd0 Reviewed-on: https://chromium-review.googlesource.com/985954 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Luc Ferron 489243fb 2018-03-28T16:55:28 Vulkan: Add support for ivec* for uniforms - This also enables 93 dEQP tests to validate these. Bug: angleproject:2441 Change-Id: I1e0a749dde309788d7921e369cb35881c12c9a33 Reviewed-on: https://chromium-review.googlesource.com/985095 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Luc Ferron 2371acad 2018-03-27T16:03:03 Vulkan: Support for uniform arrays - Enable dEQP tests for uniform arrays - Fix the shader translator to support arrays - Fix for finding the uniforms location - Support get/set of uniform array values Bug: angleproject:2416 Change-Id: I7d0e9c602840ffb915f8ea3ba5d832d03bd74985 Reviewed-on: https://chromium-review.googlesource.com/984599 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@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>
Jiawei Shao 385b3e03 2018-03-21T09:43:28 Use packed enums on shader types in ANGLE renderer This patch uses a packed internal enum ShaderType everywhere we need a shader type instead of the GLenum value of the shader type. This patch also uses program::getAttachedShader(type) everywhere we need to get gl::Shader from a program in ANGLE. BUG=angleproject:2169 Change-Id: I28a7fa1cfe35622c57a486932911110688eaadec Reviewed-on: https://chromium-review.googlesource.com/972844 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 107c7247 2018-03-20T15:45:35 ShaderVariable: separate fields for staticUse and active Thus far the compiler has used the "staticUse" flag to mark variables that should have rather been marked "active", meaning that the code may actually execute in a way that accesses the variable. There's a clear definition for this use of the term "active" in the GLES 3.0.5 spec, section 2.12.6, and in GLES 3.1 section 7.3.1. Having separate fields for recording static use and "activeness" of a variable is the first step to fixing this. According to the spec, usually only active resources should be considered when checking use against max limits. Also, only active uniforms get assigned a location. libANGLE code now correctly checks the active flag rather than the static use flag in these cases. The static use field still mirrors the active field for now, since some code in Chromium also needs to be fixed to use the active field correctly before the two can diverge. After Chromium is fixed, we can fix ANGLE so that static use information is recorded earlier during compilation and will accurately reflect whether variables are statically used. Currently the compiler only records variables once some static use may already have been pruned from the AST. BUG=angleproject:2262 TEST=angle_unittests, angle_end2end_tests Change-Id: I025bb71361246ae00c911a1f8b66ec045f665f29 Reviewed-on: https://chromium-review.googlesource.com/970962 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Luc Ferron daedf4d2 2018-03-16T09:28:53 Vulkan: Add a DynamicDescriptorPool class. In order to manage the life of descriptor sets better and allow allocating descriptor sets infinitely. Bug:angleproject:2392 Change-Id: Ia3c7145d85d697c04e8008e8d8839c428dd2e864 Reviewed-on: https://chromium-review.googlesource.com/966786 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 5eaddbd0 2018-03-14T16:16:03 Vulkan: Flag uniforms as dirty when they are updated. Currently changing uniform values will not always be seen. Bug: angleproject:2392 Bug: angleproject:2403 Change-Id: Ie315a64ad6094f2c23e48e901de2e03e4d98516a Reviewed-on: https://chromium-review.googlesource.com/963296 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Luc Ferron 5b64aca8 2018-03-14T14:55:58 Vulkan: Support of float uniform matrixes (2,3,4). Bug:angleproject:2392 Change-Id: I97efea83e604d19b1745d9db4ab8f02997a1b7fc Reviewed-on: https://chromium-review.googlesource.com/962666 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 57fbfd80 2018-02-14T12:45:34 Vulkan: Pass RendererVk to Allocate helpers. Passing the Renderer pointer instead of the Context pointer makes these methods a bit easier to work with from the "EGL" sections of the code. This is a refactoring-only change to aid the Depth/Stencil implementation. Bug: angleproject:2357 Change-Id: Icbcc72a1daff4edd947a21672744498781cfc064 Reviewed-on: https://chromium-review.googlesource.com/919523 Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 57dd97aa 2018-02-06T17:10:49 Vulkan: Add helper for allocating image memory. Also refactors some memory index searching code that was duplicated. This will lead the way to having more code reuse for our Renderbuffers implementation in Vulkan, and for other types of Texture. Bug: angleproject:2347 Change-Id: I49cbd77328c01f945d66f92e6ec4ba7c552abeff Reviewed-on: https://chromium-review.googlesource.com/904684 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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>
Olli Etuaho 3de2703d 2017-11-30T12:16:47 Fix handling matrix qualifiers on block members Individual block member row_major/column_major layout qualifiers may override the qualifiers set on the block. During parsing, this was already being handled correctly, so that the qualifier is resolved for each block member and recorded for each TField / InterfaceBlockField. Now we always write the qualifiers on a per-member granularity to the output GLSL shaders, so that the native driver gets the correct per-member qualifiers. This replaces earlier behavior where the matrix qualifiers were only written per-block. Also only use qualifiers from individual members in block layout. Since the block-level qualifier information is no longer used after parsing, it is no longer kept in the AST. A dummy value is still set to the InterfaceBlock structs exposed through the ShaderVars interface, since that has existing usage in Chromium that needs to be removed before the field can be removed. Some AMD OpenGL drivers don't seem to handle matrix layout qualifiers correctly, so most of the added tests need to be skipped for AMD GL. On NVIDIA and Intel the tests pass. BUG=angleproject:2271 TEST=angle_unittests, angle_end2end_tests, dEQP-GLES31.functional.program_interface_query.uniform.matrix* Change-Id: I1baa7a633bc2da548743c2190cb72db491b5227a Reviewed-on: https://chromium-review.googlesource.com/800174 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 465835d6 2017-09-26T13:34:10 Support arrays of arrays in the API The ShaderVariable class that is used as an interface between the compiler and the rest of the code gets arrays of arrays support. Array of array variables are passed from the compiler just like any other variables. However, when stored in Program state each innermost array constitutes a separate variable. This is done to make the implementation match the GLES specification for program interface query APIs. This will be tested more fully once support for parsing arrays of arrays lands in the compiler. TEST=angle_end2end_tests, angle_unittests BUG=angleproject:2125 Change-Id: I0f7159000f039be92a87a52b3b68cd9a215a21cb Reviewed-on: https://chromium-review.googlesource.com/684742 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: 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 4dd167fb 2017-11-09T13:08:31 Vulkan: Assign locations to varyings. These were actually always required, but only was caught by the newer versions of the SPIR-V toolchain. BUG=angleproject:2237 Change-Id: I43fef179e8792e46a602b39a6decafcab03b19df Reviewed-on: https://chromium-review.googlesource.com/760638 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: 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>
Olli Etuaho 1734e171 2017-10-27T15:30:27 Only store innermost array offset in VariableLocation Separate entries will be generated for each innermost array of arrays of arrays in the variable tables. Because of this VariableLocation actually only needs to store the innermost array index. BUG=angleproject:2125 TEST=angle_end2end_tests Change-Id: Id1ee35b3cecfc011d96b58e43cf0b1cccbfed408 Reviewed-on: https://chromium-review.googlesource.com/741742 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> 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 e1f3ad4d 2017-10-28T23:00:42 Vulkan: Add vk::GetImpl helper. Using reflection helpers, we can avoid having to pass the return type to the GetImpl method. BUG=angleproject:2200 Change-Id: Id160fbdf0ea8b3de2f219d3cc92394c678189a48 Reviewed-on: https://chromium-review.googlesource.com/742371 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@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 de03e003 2017-10-21T14:04:20 Vulkan: Add shader handling for textures. BUG=angleproject:2167 Change-Id: I33940288331a23b940753795e5e43b8cabcb87f5 Reviewed-on: https://chromium-review.googlesource.com/732189 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@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>