src/libANGLE/renderer/vulkan/UtilsVk.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi 82219d28 2019-11-26T10:17:11 Vulkan: fix alpha values in convert vertex shader When reading vertex attributes, GLES requires the y and z components to be filled with 0 if missing, and the alpha channel to be filled with 1.0 for float types and 1 for integer types. At the same time, this change reduces the number of variations in this shader. Bug: angleproject:3192 Change-Id: I1bdf491952c296962fa9160f2d29d415eb3d570d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1936708 Reviewed-by: Jaedon Lee <jaedon1.lee@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b066177a 2019-11-19T15:13:20 Vulkan: Remove duplicate shader variation ConvertVertex's UintToUint and HalfFloatToHalfFloat were generating identical shaders. Bug: angleproject:3802 Change-Id: I8eb2d55debbc5501f191830a2723b02d0d1f0827 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1925248 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Hyunchang Kim <hckim.kim@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill beacd8c8 2019-10-17T14:34:02 Vulkan: Rename format fields. Renames 'angleFormat' to 'intendedFormat'. Also renames 'bufferFormat' and 'imageFormat' to 'actualImageFormat' and 'actualBufferFormat'. This renaming should make it clearer to the reader what the meaning of the different format fields are. Intended format is the front-end format and the actual formats are the formats we pass to Vulkan. Also updates the documentation. Bug: angleproject:4009 Change-Id: If61bf7250e88f7ed3d452718574c963d718e27b2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1866077 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Courtney Goeltzenleuchter 7f418fc2 2019-10-01T07:56:53 Vulkan: lineloop support for DrawArrayIndirect Add support for lineloops. Includes a compute shader for generating an index buffer to draw lineloop. Instancing turns out to be a special case for indirect draws if we have vertex attributes that need to be emulated (e.g. divisor too large or native vertex format not available). Test: dEQP.GLES31/functional_draw_indirect_* angle_end2end_tests --gtest_filter=LineLoopIndirectTest.*/* dEQP.GLES3/functional_draw_* Bug: angleproject:3564 Change-Id: I1fdabe2c8a690c8b6df9e252e1e839e08796bcca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1834682 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Courtney Goeltzenleuchter f03259ad 2019-09-19T11:31:40 Vulkan: lineloop support for DrawElementsIndirect Add support for lineloops. Includes a compute shader for converting lineloop index buffer with optional restart into linestrip. Test: dEQP.GLES31/functional_draw_indirect_* angle_end2end_tests --gtest_filter=LineLoopIndirectTest.*/* Bug: angleproject:3564 Change-Id: I12d08db1c8d99867f0611e53be50193647695260 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1797106 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tobin Ehlis <tobine@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>
Courtney Goeltzenleuchter 3c2a5230 2019-09-23T11:07:18 Vulkan: 8bit index support for DrawElementsIndirect Add partial support for DrawElementsIndirect. This supports all primitives types except lineloop. Includes a compute shader for converting 8bit index buffers to 16bit index buffers where the index buffer range is defined in a GPU buffer. Test: dEQP.GLES31/functional_draw_indirect_* Bug: angleproject:3564 Change-Id: Ibe9c55323e46a398f0b703cd8597a72ba6790570 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1792948 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Hyunchang Kim d4c75347 2019-09-18T10:49:34 Vulkan: Enable GPU conversion from RGB16F to RGBA16F - Add proper GPU conversion routine when the source and destination format of vertex attribute is half float data type. - Add an end2end test which utilizes half float GPU conversion path. Bug: angleproject:3802 Test: angle_end2end_tests --gtest_filter=*VertexAttributeTest.HalfFloatBuffer* Change-Id: Ia88a4984156f8967796bea3852c3cde714f2acab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1824799 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Jamie Madill b540da89 2019-09-19T14:19:12 Vulkan: Use ResourceUse to track object lifetime. With the new resource tracking scheme the CommandGraph, tracking a "Context serial" aka "current" serial is no longer necessary for CommandGraphResources. Serial tracking has been moved to the shared ResourceUse struct that gets updated on a command submission. Thus we don't need to store the serial as a current separate piece of info in BufferHelper/ImageHelper. Will lead to further redesign for the multi-threading support for Vulkan. Bug: angleproject:2464 Change-Id: I1ae4bcc27fcfb93422b4ab4c9682a458e482f295 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1785990 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill d7f28aae 2019-09-19T14:19:10 Vulkan: Pass CommandGraph when updating serials. This is in preparation for storing a pointer to a shared resource use structure. Bug: angleproject:2464 Change-Id: I8f4ba1c71de6ad6a27ac06fc8012a0e94267cc16 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1785988 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Mohan Maiya fea65766 2019-09-19T09:30:38 Vulkan: Add support for OES_vertex_type_10_10_10_2 - Add support to CPU/GPU convert vertex formats - Add test cases for type conversion in angle_end2end_tests - Fix a bug in shader script by adding a ceil when calculating bytes Bug: angleproject:3192 Test: angle_end2end_tests --gtest_filter=VertexAttributeTest*Packed1010102* Change-Id: I57bab9fc1c1041cd734746d0e52a33717b635ec0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1788495 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi 050b124d 2019-06-30T03:26:18 Reland "Vulkan: Debug overlay" This is a reland of e54d0f90d1a165404236fd7abd1b05ddd041a686 This was reverted due to a build failure as a result of a missing virtual destructor in the widget base class. Original change's description: > Vulkan: Debug overlay > > A debug overlay system for the Vulkan backend designed with efficiency > and runtime configurability in mind. Overlay widgets are of two > fundamental types: > > - Text widgets: A single line of text with small, medium or large font. > - Graph widgets: A bar graph of data. > > Built on these, various overlay widget types are defined that gather > statistics. Five such types are defined with one widget per type as > example: > > - Count: A widget that counts something. VulkanValidationMessageCount > is an overlay widget of this type that shows the number of validation > messages received from the validation layers. > - Text: A generic text. VulkanLastValidationMessage is an overlay > widget of this type that shows the last validation message. > - PerSecond: A value that gets reset every second automatically. FPS is > an overlay widget of this type that simply gets incremented on every > swap(). > - RunningGraph: A graph of last N values. VulkanCommandGraphSize is an > overlay of this type. On every vkQueueSubmit, the number of nodes in > the command graph is accumulated. On every present(), the value is > taken as the number of nodes for the whole duration of the frame. > - RunningHistogram: A histogram of last N values. Input values are in > the [0, 1] range and they are ranked to N buckets for histogram > calculation. VulkanSecondaryCommandBufferPoolWaste is an overlay > widget of this type. On vkQueueSubmit, the memory waste from command > buffer pool allocations is recorded in the histogram. > > Overlay font is placed in libANGLE/overlay/ which gen_overlay_fonts.py > processes to create an array of bits, which is processed at runtime to > create the actual font image (an image with 3 layers). > > The overlay widget layout is defined in overlay_widgets.json which > gen_overlay_widgets.py processes to generate an array of widgetss, each > of its respective type, and sets their properties, such as color and > bounding box. The json file allows widgets to align against other > widgets as well as against the framebuffer edges. > > Two compute shaders are implemented to efficiently render the UI: > > - OverlayCull: This shader creates a bitset of Text and Graph widgets > whose bounding boxes intersect a corresponding subgroup processed by > OverlayDraw. This is done only when the enabled overlay widgets are > changed (a feature that is not yet implemented) or the surface is > resized. > - OverlayDraw: Using the bitsets generated by OverlayCull, values that > are uniform for each workgroup (set to be equal to hardware subgroup > size), this shader loops over enabled widgets that can possibly > intersect the pixel being processed and renders and blends in texts > and graphs. This is done once per frame on present(). > > Currently, to enable overlay widgets an environment variable is used. > For example: > > $ export ANGLE_OVERLAY=FPS:VulkanSecondaryCommandBufferPoolWaste > $ ./hello_triangle --use-angle=vulkan > > Possible future work: > > - On Android, add settings in developer options and enable widgets based > on those. > - Spawn a small server in ANGLE and write an application that sends > enable/disable commands remotely. > - Implement overlay for other backends. > > Bug: angleproject:3757 > Change-Id: If9c6974d1935c18f460ec569e79b41188bd7afcc > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1729440 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> Bug: angleproject:3757 Change-Id: I47915d88b37b6f882c686c2de13fca309a10b572 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1780897 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Corentin Wallez fc58af47 2019-09-02T07:46:44 Revert "Vulkan: Debug overlay" This reverts commit e54d0f90d1a165404236fd7abd1b05ddd041a686. Reason for revert: causes compile failure on Linux CFI bot. Sample build: https://ci.chromium.org/p/chromium/builders/ci/Linux%20CFI/14810 Sample log: https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8903575125463586160/+/steps/compile/0/stdout?format=raw Original change's description: > Vulkan: Debug overlay > > A debug overlay system for the Vulkan backend designed with efficiency > and runtime configurability in mind. Overlay widgets are of two > fundamental types: > > - Text widgets: A single line of text with small, medium or large font. > - Graph widgets: A bar graph of data. > > Built on these, various overlay widget types are defined that gather > statistics. Five such types are defined with one widget per type as > example: > > - Count: A widget that counts something. VulkanValidationMessageCount > is an overlay widget of this type that shows the number of validation > messages received from the validation layers. > - Text: A generic text. VulkanLastValidationMessage is an overlay > widget of this type that shows the last validation message. > - PerSecond: A value that gets reset every second automatically. FPS is > an overlay widget of this type that simply gets incremented on every > swap(). > - RunningGraph: A graph of last N values. VulkanCommandGraphSize is an > overlay of this type. On every vkQueueSubmit, the number of nodes in > the command graph is accumulated. On every present(), the value is > taken as the number of nodes for the whole duration of the frame. > - RunningHistogram: A histogram of last N values. Input values are in > the [0, 1] range and they are ranked to N buckets for histogram > calculation. VulkanSecondaryCommandBufferPoolWaste is an overlay > widget of this type. On vkQueueSubmit, the memory waste from command > buffer pool allocations is recorded in the histogram. > > Overlay font is placed in libANGLE/overlay/ which gen_overlay_fonts.py > processes to create an array of bits, which is processed at runtime to > create the actual font image (an image with 3 layers). > > The overlay widget layout is defined in overlay_widgets.json which > gen_overlay_widgets.py processes to generate an array of widgetss, each > of its respective type, and sets their properties, such as color and > bounding box. The json file allows widgets to align against other > widgets as well as against the framebuffer edges. > > Two compute shaders are implemented to efficiently render the UI: > > - OverlayCull: This shader creates a bitset of Text and Graph widgets > whose bounding boxes intersect a corresponding subgroup processed by > OverlayDraw. This is done only when the enabled overlay widgets are > changed (a feature that is not yet implemented) or the surface is > resized. > - OverlayDraw: Using the bitsets generated by OverlayCull, values that > are uniform for each workgroup (set to be equal to hardware subgroup > size), this shader loops over enabled widgets that can possibly > intersect the pixel being processed and renders and blends in texts > and graphs. This is done once per frame on present(). > > Currently, to enable overlay widgets an environment variable is used. > For example: > > $ export ANGLE_OVERLAY=FPS:VulkanSecondaryCommandBufferPoolWaste > $ ./hello_triangle --use-angle=vulkan > > Possible future work: > > - On Android, add settings in developer options and enable widgets based > on those. > - Spawn a small server in ANGLE and write an application that sends > enable/disable commands remotely. > - Implement overlay for other backends. > > Bug: angleproject:3757 > Change-Id: If9c6974d1935c18f460ec569e79b41188bd7afcc > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1729440 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=geofflang@chromium.org,syoussefi@chromium.org,jmadill@chromium.org Bug: angleproject:3757 Change-Id: Ib08e2e7b1a9449ca097673acb11655df5d2bbf31 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1778862 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Shahbaz Youssefi e54d0f90 2019-06-30T03:26:18 Vulkan: Debug overlay A debug overlay system for the Vulkan backend designed with efficiency and runtime configurability in mind. Overlay widgets are of two fundamental types: - Text widgets: A single line of text with small, medium or large font. - Graph widgets: A bar graph of data. Built on these, various overlay widget types are defined that gather statistics. Five such types are defined with one widget per type as example: - Count: A widget that counts something. VulkanValidationMessageCount is an overlay widget of this type that shows the number of validation messages received from the validation layers. - Text: A generic text. VulkanLastValidationMessage is an overlay widget of this type that shows the last validation message. - PerSecond: A value that gets reset every second automatically. FPS is an overlay widget of this type that simply gets incremented on every swap(). - RunningGraph: A graph of last N values. VulkanCommandGraphSize is an overlay of this type. On every vkQueueSubmit, the number of nodes in the command graph is accumulated. On every present(), the value is taken as the number of nodes for the whole duration of the frame. - RunningHistogram: A histogram of last N values. Input values are in the [0, 1] range and they are ranked to N buckets for histogram calculation. VulkanSecondaryCommandBufferPoolWaste is an overlay widget of this type. On vkQueueSubmit, the memory waste from command buffer pool allocations is recorded in the histogram. Overlay font is placed in libANGLE/overlay/ which gen_overlay_fonts.py processes to create an array of bits, which is processed at runtime to create the actual font image (an image with 3 layers). The overlay widget layout is defined in overlay_widgets.json which gen_overlay_widgets.py processes to generate an array of widgetss, each of its respective type, and sets their properties, such as color and bounding box. The json file allows widgets to align against other widgets as well as against the framebuffer edges. Two compute shaders are implemented to efficiently render the UI: - OverlayCull: This shader creates a bitset of Text and Graph widgets whose bounding boxes intersect a corresponding subgroup processed by OverlayDraw. This is done only when the enabled overlay widgets are changed (a feature that is not yet implemented) or the surface is resized. - OverlayDraw: Using the bitsets generated by OverlayCull, values that are uniform for each workgroup (set to be equal to hardware subgroup size), this shader loops over enabled widgets that can possibly intersect the pixel being processed and renders and blends in texts and graphs. This is done once per frame on present(). Currently, to enable overlay widgets an environment variable is used. For example: $ export ANGLE_OVERLAY=FPS:VulkanSecondaryCommandBufferPoolWaste $ ./hello_triangle --use-angle=vulkan Possible future work: - On Android, add settings in developer options and enable widgets based on those. - Spawn a small server in ANGLE and write an application that sends enable/disable commands remotely. - Implement overlay for other backends. Bug: angleproject:3757 Change-Id: If9c6974d1935c18f460ec569e79b41188bd7afcc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1729440 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 57ad1e12 2019-08-23T14:53:26 Vulkan: Introduce ContextScoped Scoped is changed to DeviceScoped and a ContextScoped class is added. The former destroys objects at the end of scope, and the latter releases them. Bug: angleproject:3757 Change-Id: Ia0bbded53e94af9c8c72c77d07306d6724c6c409 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1769060 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@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>
James Darpinian 7e48c9eb 2019-08-06T17:17:19 Add explicit integer casts WebKit uses the -Wshorten-64-to-32 flag which warns on these cases. Bug: 3439 Change-Id: I8c1de60da0f173ca2036e2120e79b857f5f2775f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1740866 Commit-Queue: James Darpinian <jdarpinian@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Fei Yang d7500aa8 2019-08-02T15:52:39 Vulkan: Regression issue on AngryBird for read bandwidth Use AllGraphicsShaderReadOnly as the image layout for graphics path. Bug: angleproject:3473 Change-Id: I1e653890e69f347b2aba4a0156a5d5b86109fd0e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1732617 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 8400d05c 2019-08-07T14:52:54 Vulkan: Support the vertex_type_2_10_10_10_rev format - Modify the python script and json file to generate the code which adds the function for vertex_type_2_10_10_10_rev. These functions handle the loading and conversion for vertex_type_2_10_10_10_rev. - Modify ConvertVertex.comp and ConvertVertex.comp.json to perform a GPU based conversion for vertex format of type 2_10_10_10_rev - Modify BindingIsAligned function to check that both stride and binding offset is aligned to the format size when the component size is not aligned to 8 bits. - Modify deqp3 expectations file to enable type_2_10_10_10_rev format vertex array tests. Bug: angleproject:3193 Test: dEQP-GLES3.functional.vertex_arrays.single_attribute.*2_10_10_10* Change-Id: I2358d0d8888f7dfd7eac999dc150f643167de817 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1709035 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jiacheng Lu 758b12fa 2019-07-17T14:55:38 Filter out redundant depth&stencil state updates 1. Compare updating values with active ones at frontend when depth&stencil related gl call happens and do not set any unnecessary dirty bits. 2. Remove d3d and gl backends' checking of depth&stencil states when detect any dirty bits, as it is now being done at frontend. 3. Modification to graphics pipeline description update, make sure it syncs with gl::State initial value. 4. Change gl_vk::CullMode return type to VkCullModeFlagBits, as it only represents single value. Bug: angleproject:3700 Change-Id: Id3aa5186455ee3a10a9c147edad13944e3e41098 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1706903 Commit-Queue: Jiacheng Lu <lujc@google.com> Reviewed-by: Tobin Ehlis <tobine@google.com>
Shahbaz Youssefi 998a37c9 2019-07-15T22:13:14 Vulkan: merge bindGraphics/ComputeDescriptorSets The two called bindDescriptorSets with a fixed GRAPHICS or COMPUTE bind point enum value. The differentation however would result in unnecessary code duplication with upcoming compute support. Bug: angleproject:3562 Change-Id: Ica4400c573a90fda168c64ad777d87aa83256e48 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1703524 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@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 55efe37c 2019-07-03T11:52:21 Vulkan: Cleanup buffer dependencies onWrite now sets the dependency to make sure the order of setting dependency and adding memory barrier is correct. onReadByBuffer is added to handle buffer-to-buffer dependency and barrier setting correctly without causing a graph loop. onExternalWrite is added so that BufferVk doesn't have to track write access flags. Additionally, setting write dependencies now include both read and write flags. This is in preparation for SSBO support where the buffer can be used to read data in addition to write. Bug: angleproject:3561 Change-Id: I2028186ea14459cd159cf79f6d640df54538fc62 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1687119 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill ee21a187 2019-07-04T08:51:34 Store angle::Format in gl::VertexAttribute. Instead of storing type/size/normalized/pureInteger we instead store a pointer to the angle::Format. This makes some code logic simpler and will let us more easily check if a vertex attribute format changes in calls to VertexAttribPointer or VertexAttribFormat. This CL adds extra information to angle::Format to represent the vertex format info needed. It also caches the channel count so that it can be queried faster. Also renames "Int" -> "Sint" in UtilsVk for consistency. Bug: angleproject:3256 Change-Id: I5ef9b983dad8a58c341113c802500b89ce081566 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1684293 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Shahbaz Youssefi a845b599 2019-07-02T10:44:39 Vulkan: fix depth/stencil-only blit The draw-call path was outputting color unconditionally even though only depth/stencil was written by the shader, causing flakiness. Bug: angleproject:3200 Change-Id: I1b28e37160153863e7e6c2875c3002abf4ec176b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1682729 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b1c8dbf3 2019-06-14T23:57:26 Vulkan: Correct synchronization for buffer readback When mapping buffer memory, a flush is performed if the buffer has pending operations followed by a finishToSerial to make sure the buffer is no longer in use by the GPU. This also implements GLES 3.0 buffer mapping flags: GL_MAP_INVALIDATE_RANGE_BIT: No-op. Vulkan's vkMapMemory doesn't have such a feature. GL_MAP_INVALIDATE_BUFFER_BIT: Same GL_MAP_FLUSH_EXPLICIT_BIT: Vulkan automatically flushes host memory writes on vkQueueSubmit, so this is no-op as well. GL_MAP_UNSYNCHRONIZED_BIT: The flush+finishToSerial call is skipped in this case. Bug: angleproject:3213 Change-Id: I6bdb460dffbb57170649f4c9678afbfae331926c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1661252 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
James Dong 2806a898 2019-06-07T12:10:46 Vulkan: implement primitive restart Implements ES 3.0 feature GL_PRIMITIVE_RESTART_FIXED_INDEX, which allows the application to use a fixed "restart" index to restart the primitive during a single draw call. This change does't handle GL_LINE_LOOP primitives, which requires a bit of special handling. Bug: angleproject:3215 Change-Id: I2388852683fd17328a6a76c48d70a24d67ce8b67 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1650301 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
James Dong 0d3cf708 2019-06-12T10:07:02 Vulkan: fix array size for internal shaders Previously array sizes were calculated as the OR of all flag and enum masks, equal to 2^(number of bits used for flags and enums) - 1, which could be less than the actual needed array size. This fix moves array size calculation to the autogen script and changes the size to one more than the maximum potential value. Bug: angleproject:3524 Change-Id: Ia4eb2a83fc7deea84e18958efcda8b57632035f9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1655954 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b407e1a0 2019-06-03T17:15:51 Vulkan: implement ES3 blit Augment the resolve shaders to be able to stretch and blit too. The UtilsVk resolve function is accordingly expanded to include blit. Bug: angleproject:3200 Change-Id: I30b172a5e388089735ab494f55cbfdc2781a8bf9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1635753 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 03bc3db8 2019-06-05T13:48:43 Vulkan: Minor cleanup to UtilsVk. Renames "ContextVk *context" to "ContextVk *contextVk" for consistency. Also adds an "allocateDescriptorSet" helper function. Bug: angleproject:3117 Change-Id: Id03e30432d8e5e35b682350a8e98fd2e62cdf89a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1644776 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi de70a713 2019-06-03T17:05:16 Vulkan: Rename Resolve* shaders to BlitResolve In preparation for adding blit functionality. Bug: angleproject:3200 Change-Id: I77b6b6cbe90b26ee23c25edebaa2b130f3c2987a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1641626 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 5993d899 2019-06-03T13:05:38 Vulkan: Use storage buffers for index conversion shader. This allows us to use the shader regardless of driver support for texel buffer views. It also allows us to convert indices on the GPU unconditionally. We add a new internal compute shader that converts pairs of indices into a packed single uint value that stores two 16-bit values. In the future we could add support for converting primitive restart indices. Should speed up benchmarks on systems which didn't have R8_UINT support for compute shader buffers. Bug: angleproject:3490 Change-Id: I56ca0cabb094e97f36ab4edc779e6c8ad2d2601e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1639058 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 98f21671 2019-05-31T15:34:39 Vulkan: Refactor index buffer convert functions. This is a prepratory refactor for converting index buffers on the GPU using a more generic compute shader. No functional change. Bug: angleproject:3490 Change-Id: Iadf4b1429314db6850320aee33c4113f38577378 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1639057 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 6d9b8908 2019-05-29T13:18:31 Vulkan: Merge Color and Depth/Stencil resolve shaders There is a good deal of overlap in the way these shaders calculate offsets, flip etc. This change merges the two shaders together, as well as the UtilsVk functions that invoke them. This is in preparation for adding blit functionality to the same shader. Bug: angleproject:3200 Change-Id: Id7c2cf12e05db1802ae497766fb361fe4bef6479 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1635750 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Shahbaz Youssefi 172e5d37 2019-05-29T10:00:50 Vulkan: Implement universal stencil resolve This is done by resolving stencil into a temporary buffer and copying that into the stencil aspect of the resolved image. Bug: angleproject:3200 Change-Id: I29111b44db2cb093acc4544034fbe61178f055a1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1635709 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi f2a1c384 2019-05-21T16:32:49 Vulkan: Implement multisampled framebuffers Simultaneously implements ANGLE_framebuffer_multisample and ES3 multisampled framebuffers. Additionally, implements ES3 framebuffer blitting where multisampled framebuffers are involved. Bug: angleproject:3203 Bug: angleproject:3204 Bug: angleproject:3200 Change-Id: I5694a30f71168e807688a9568e3742b81d907918 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1622667 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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>
Shahbaz Youssefi fb8e1b25 2019-05-17T13:18:40 Vulkan: Fix multisampled clear UtilsVk::clearFramebuffer was not setting the sample count. Bug: angleproject:3204 Change-Id: Iab7d385ec58b12f21d888c5dfc9e94b7846ac40c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1616858 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>
Shahbaz Youssefi 9fa248e1 2019-05-06T14:55:18 Vulkan: Implement EXT_draw_buffers In GLES, color attachments are referenced by their indices. These indices match between the API and GLSL. For example, if a shader has: layout(location=0) out color; layout(location=3) out roughness; Then GLES would bind and enable GL_COLOR_ATTACHMENT0 and GL_COLOR_ATTACHMENT3. In Vulkan, the framebuffer object and the corresponding renderpass define the color attachments, and they don't allow gaps in color attachments as GLES does. A render subpass creates the mapping between the color attachments as defined in the framebuffer and the attachments used by the shader (with possible gaps). This change packs the enabled GL color attachments for the sake of the framebuffer, and sets the subpass up in such a way that the shaders continue to use the same color output indices as GLES. In the example above, we have the attachment indices as follows: Status | GLES | GLSL | RenderPass | Subpass enabled 0 0 0 0 disabled 1 - VK_ATTACHMENT_UNUSED disabled 2 - VK_ATTACHMENT_UNUSED enabled 3 3 1 1 That is, the array of color attachments in the Vulkan framebuffer/renderpass is: [0] = GL color attachment 0 [1] = GL color attachment 3 And the array of color attachment references in the Vulkan render subpass is: [0] = 0 (index 0 of the renderpass attachment array) [1] = VK_ATTACHMENT_UNUSED [2] = VK_ATTACHMENT_UNUSED [3] = 1 (index 1 of the renderpass attachment array) Bug: angleproject:2394 Change-Id: Ib6cd2b60882643ea152986eee453270d09cd4aed Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1595442 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@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>
Jamie Madill 0631e19b 2019-04-18T16:09:12 Vulkan: Rename Vulkan "Texture" format to "Image" Also adds some comments to vk_format_utils.h. Bug: angleproject:3372 Change-Id: I529b9b189e4cdfd400c3c981a47139727d9954ab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1565062 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 2249d4a7 2019-04-05T16:48:55 Vulkan: remove clear depth ability from clearWithDraw This partially reverts the following change: 60ec8f576 Vulkan: break dependency to the depthClamp feature The feature is no longer necessary, and simplifies the usage of utility shaders. Bug: angleproject:2361 Change-Id: I1e87ac8d2517c5a3b50e3d0cddd55c852e0e3e7d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1555313 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com>
Shahbaz Youssefi 127990f9 2019-04-04T13:52:04 Vulkan: Use render pass loadOp for scissored clears At this point, every clear is done through render pass loadOp, except masked color or stencil clears. The only fallback is clearWithDraw, that can clear both color and stencil at the same time. Bug: angleproject:2361 Change-Id: I805fc12475e832ad2f573f665cdfeb766e61a6d0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1553740 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com>
Shahbaz Youssefi c7565353 2019-04-03T14:03:56 Vulkan: break dependency to the depthClamp feature Image clear's masked clear path using a draw call was using this feature to clear the depth buffer, but this feature is not available on ARM and some Qualcomm devices. This change adds a push constant to the vertex shader used in this call to export the depth clear value, removing the need to rely on depth clamping. Bug: angleproject:3241 Change-Id: I565cd5f731c441820e0702e51dfdf02d0bc7de06 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1551522 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com>
Shahbaz Youssefi f6c937f8 2019-04-02T17:04:08 Vulkan: fix masked stencil clear Previously, masked stencil clear was done by clearing every stencil bit to the ClearValue & Mask. The correct behavior as implemented in this change is to clear only the bits that are set in Mask. This can only be done through a draw call, with ClearValue as the stencil reference, and Mask as the stencil write mask. Note: this change relies on the depthClamp Vulkan feature which is not available on ARM. Bug: angleproject:3241 Change-Id: I0a181c32f881ee813f144e7bdd6f42c8ea6f1966 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1548442 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com>
Shahbaz Youssefi 43997017 2019-03-30T23:24:01 Vulkan: fix non-float clear with draw Instead of using one draw call that clears all attachments, multiple draw calls are issued that clear a single attachment each. This allows us to have a manageable number of variations for the ImageClear.frag shader, now that non-float format support is introduced. Bug: angleproject:3187 Change-Id: Ic0c1067a396250bd80f31d00cad5a272acff8be8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1545523 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi db4ed317 2019-03-29T00:32:45 Vulkan: glClearBuffer* implementation Refactors FramebufferVk::clear such that specific render targets could be cleared, with clear values not necessarily set through glClearColor etc. FramebufferVk::clearWithRenderPassOp is modified so that loadOp and clear values are set after the render pass has been registered in the graph. This allows multiple glClearBuffer calls to coalesce into the same render pass. glClearBuffer calls are then implemented simply as calls to the refactored clear function with the appropriate parameters. Bug: angleproject:3187 Change-Id: I2fdfcbea5bf244f63ec981b91caca47f5ee3cd3a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1545204 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 0c128e15 2019-03-25T23:50:14 Vulkan: Use render pass ops to clear images when possible On tiling GPUs, render pass loadOp and stencilLoadOp can be used to very cheaply clear an image as it is being render to. This change uses this feature to clear render targets when possible. Bug: angleproject:2361 Change-Id: Ic4bdc908873f4802760d549f4893f84a47beac0f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1500576 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 a8ff8814 2019-03-05T07:06:32 Vulkan:Optimize SecondaryCommandBuffers RELAND of this commit. Had to fix fuzzer build errors. Optimize performance of SecondaryCommandBuffers and enable them as the default build option. To disable this set angle_enable_custom_vulkan_cmd_buffers=false in your build args. This CL enhances the PoolAllocator to have a "fast" mode that can be enabled at class creation. This mode uses an alignment of 1 byte and enables a fastAllocation() call that avoids some bookkeeping overhead. The SecondaryCommandBuffer uses this fastAllocation() function. Furthermore the fast path of fast allocate, using the current page, is inlined for maximum speed. Jamie Madill also updated the SecondaryCommandBuffers to pre-allocate blocks so that the commands occur linearly in memory. This speeds up processing with improved cache coherency and minimizes overhead when recording commands. Also the core Draw functions and their state updates are all inlined as well as the common functions to initialize commands and to copy command pointer data. This change also includes some new, custom commands. One is imageBarrier that is a specialized version of pipelineBarrier that only performs a single image layout transition. There are customized versions of various Draw commands to minimize copying of parameters. There are also specialized commands to bind[Graphics|Compute]Pipeline that have the pipeline type built in to the command. More custom commands and command data size optimizations will be made in follow-on commits. Bug: angleproject:3136 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1497418 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Change-Id: I621d8f8893308fca240b32390928e8ba0036cf06 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1535385 Reviewed-by: Tobin Ehlis <tobine@google.com>
Jamie Madill 896e7811 2019-03-22T14:56:33 Revert "Vulkan:Optimize SecondaryCommandBuffers" This reverts commit 2219b18c984ed69251f3db3c7b5fd69a2fa68c77. Reason for revert: Failing to compile on ASAN builders: https://ci.chromium.org/p/chromium/builders/try/linux-libfuzzer-asan-rel/134782 Currently blocking roll. Original change's description: > Vulkan:Optimize SecondaryCommandBuffers > > Optimize performance of SecondaryCommandBuffers and enable them as the > default build option. > To disable this set angle_enable_custom_vulkan_cmd_buffers=false in > your build args. > > This CL enhances the PoolAllocator to have a "fast" mode that can > be enabled at class creation. This mode uses an alignment of 1 byte and > enables a fastAllocation() call that avoids some bookkeeping overhead. > The SecondaryCommandBuffer uses this fastAllocation() function. > Furthermore the fast path of fast allocate, using the current page, > is inlined for maximum speed. > Jamie Madill also updated the SecondaryCommandBuffers to pre-allocate > blocks so that the commands occur linearly in memory. This speeds up > processing with improved cache coherency and minimizes overhead when > recording commands. > Also the core Draw functions and their state updates are all inlined > as well as the common functions to initialize commands and to copy > command pointer data. > > This change also includes some new, custom commands. One is > imageBarrier that is a specialized version of pipelineBarrier that only > performs a single image layout transition. > There are customized versions of various Draw commands to minimize > copying of parameters. > There are also specialized commands to bind[Graphics|Compute]Pipeline > that have the pipeline type built in to the command. > More custom commands and command data size optimizations will be made > in follow-on commits. > > Bug: angleproject:3136 > Change-Id: I35453cc2656bc8c51f0d84d1adef106900aca9a5 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1497418 > Commit-Queue: Tobin Ehlis <tobine@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=tobine@google.com,syoussefi@chromium.org,jmadill@chromium.org Change-Id: I1c0bfe864ff343eb8ea6c88556523f8715c981d5 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:3136 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1535998 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis 2219b18c 2019-03-05T07:06:32 Vulkan:Optimize SecondaryCommandBuffers Optimize performance of SecondaryCommandBuffers and enable them as the default build option. To disable this set angle_enable_custom_vulkan_cmd_buffers=false in your build args. This CL enhances the PoolAllocator to have a "fast" mode that can be enabled at class creation. This mode uses an alignment of 1 byte and enables a fastAllocation() call that avoids some bookkeeping overhead. The SecondaryCommandBuffer uses this fastAllocation() function. Furthermore the fast path of fast allocate, using the current page, is inlined for maximum speed. Jamie Madill also updated the SecondaryCommandBuffers to pre-allocate blocks so that the commands occur linearly in memory. This speeds up processing with improved cache coherency and minimizes overhead when recording commands. Also the core Draw functions and their state updates are all inlined as well as the common functions to initialize commands and to copy command pointer data. This change also includes some new, custom commands. One is imageBarrier that is a specialized version of pipelineBarrier that only performs a single image layout transition. There are customized versions of various Draw commands to minimize copying of parameters. There are also specialized commands to bind[Graphics|Compute]Pipeline that have the pipeline type built in to the command. More custom commands and command data size optimizations will be made in follow-on commits. Bug: angleproject:3136 Change-Id: I35453cc2656bc8c51f0d84d1adef106900aca9a5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1497418 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Jamie Madill <jmadill@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>
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>
Courtney Goeltzenleuchter b6c1c66d 2019-02-15T08:30:45 Vulkan: Discard scissor if either dimension is 0 Test: adb shell am start -n com.drawelements.deqp/android.app.NativeActivity \ -e cmdLine '"deqp --deqp-case=dEQP-GLES2.functional.color_clear.* \ --deqp-log-filename=/sdcard/dEQP-Log.qpa"' run_angle_end2end_tests --gtest_filter=ClearTest.EmptyScissor/ES2_VULKAN Bug: angleproject:3114 Change-Id: Icd6ec39c993854f1dbc2fd9221b374e7d4541058 Reviewed-on: https://chromium-review.googlesource.com/c/1475235 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Courtney Goeltzenleuchter 6fc22a13 2019-02-01T12:53:01 Vulkan: Discard scissored clears where scissor is null If a clear becomes a no-op because the scissor has a width and height of 0, return early and skip the draw. This also works around a driver issue on some devices where it was ignoring a null scissor and drawing the clear anyway. Found with deqp test: adb shell am start -n com.drawelements.deqp/android.app.NativeActivity \ -e cmdLine '"deqp --deqp-case=dEQP-GLES2.functional.color_clear.* \ --deqp-log-filename=/sdcard/dEQP-Log.qpa"' run_angle_end2end_tests --gtest_filter=ClearTest.EmptyScissor/ES2_VULKAN Bug: angleproject:3114 Change-Id: I6cf2716bd93bb332f74b44c7250e363c68cc614f Reviewed-on: https://chromium-review.googlesource.com/c/1436841 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@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 c09ae15c 2019-02-01T14:16:32 Enable -Wextra-semi and -Wextra-semi-stmt. This will prevent users from accidentally making semicolon errors in the future. Bug: chromium:926235 Change-Id: I79a6fa376fb1ad8f0fcf1b65b1f572a035d1f4e9 Reviewed-on: https://chromium-review.googlesource.com/c/1446493 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 85ca1895 2019-01-16T13:27:15 Vulkan: Store reference to context command buffer. This frees us from checking the FB every draw. Slightly reduces time spent in all draw methods. Improvement seen on the draw call overhead tests. Scores went from 28.17 ns/draw to 26.76 ns/draw on my machine. In a future improvement we could make this command buffer a dirty bit. Currently it's a bit slower to call a handler function due to the dispatch table. Likely we could optimize this by reverting back to a dirty bit switch and inlining the handler functions. That is left for future work. Vulkan is happy enough to run multiple RenderPasses and bind different Pipelines in the same command buffer. But ANGLE defers RenderPass init until we submit our work. Thus we can only support one RenderPass per secondary buffer. Test: angle_perftests DrawCall*/vulkan_null Bug: angleproject:3014 Change-Id: I89fd0d9e0822400a5c5a16acb5a9c400a0e71ab5 Reviewed-on: https://chromium-review.googlesource.com/c/1393905 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill ab2bfa81 2019-01-15T19:06:47 Enable Chromium clang style plugin for libANGLE. This fixes a few style warnings: * auto should not deduce to raw pointer type * inlined virtual methods are not allowed * non-trivial constructors and destructors should be explicit * inlined non-trivial constructors should not be in-class * missing override keywords Bug: angleproject:3069 Change-Id: I3b3e55683691da3ebf6da06a5d3c729c71b6ee53 Reviewed-on: https://chromium-review.googlesource.com/c/1407640 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill c759b8b4 2019-01-03T15:16:50 Vulkan: More Vertex Array optimizations. Inlines a number of Vulkan vertex array methods. Also changes the way vertex buffers are bound. Note that Vulkan doesn't support NULL buffer bindings. Thus we create an emulated NULL buffer to work around the problem of having gaps in the bound vertex buffers. This allows us to use a single bind call for ranges of vertex buffers even when there are gaps. Also changes how vertex array dirty bits are reset. Instead of calling memset to clear the affected buffers we pass a mutable pointer to the Vertex Array sync state. This allows us to only reset the dirty bits that we sync. This saves on the memory clearing time. Improves perf by about 10% in the Vulkan VBO state change test. Bug: angleproject:3014 Change-Id: Ib7b742dff7897fc891606a652ea0b64255a24c86 Reviewed-on: https://chromium-review.googlesource.com/c/1390360 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 633d5e69 2018-12-23T19:58:01 Vulkan: Put viewport and scissor back in pipeline desc. Turns out this is much faster than using dynamic state. When we support multiple viewports it might be easier to use dynamic state since we won't need to make an overly large pipeline description. We could support both methods using a flag to indicate the viewport and/or scissor regions are invalid. Until then we can remove the pipeline and scissor dirty bits. Improves perf by about 15% in the Vulkan VBO state change test. Bug: angleproject:3013 Change-Id: I4572250626a9a0f0ca3451b17e8f0de186416cae Reviewed-on: https://chromium-review.googlesource.com/c/1390359 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: 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>
Shahbaz Youssefi b5ba549a 2019-01-02T15:19:22 Vulkan: Shader path for texture copy when image is not initialized This change implements staging image/texture copies when the destination image is not yet fully initialized. With this change, CPU readback for glCopyTex[Sub]Image2D and glCopy[Sub]TextureCHROMIUM should happen only if the texture formats don't allow a fragment-shader based copy. Bug: angleproject:2958 Change-Id: I04087e14ea8fb6fbc731598c5493e44651c22c01 Reviewed-on: https://chromium-review.googlesource.com/c/1393909 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 4f3b207d 2019-01-01T14:48:25 Vulkan: Shader path for texture-to-texture copy This change implements glCopy[Sub]TextureCHROMIUM in GPU. As with the previous change implementing glCopyTex[Sub]Image2D, it currently only selects the shader path if the texture is already defined. Bug: angleproject:2958 Change-Id: Ia1b5625f92e6c9f91807c9b601e5c34d2d5e5c30 Reviewed-on: https://chromium-review.googlesource.com/c/1392394 Commit-Queue: Shahbaz Youssefi <syoussefi@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>
Jamie Madill c3dc5d48 2018-12-30T12:12:04 Merge gl::Context and gl::ContextState. This reduces the number of indrections when accessing the Extensions or Caps structures. It will provide a small speed-up to some methods. It also cleans up the code. Bug: angleproject:2966 Change-Id: Idddac70758c42c1c2b75c885d0cacc8a5c458685 Reviewed-on: https://chromium-review.googlesource.com/c/1392391 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Markus Tavenrath <matavenrath@nvidia.com>
Shahbaz Youssefi e321940c 2018-12-08T16:54:14 Vulkan: Move image clear functionality to UtilsVk DispatchUtilsVk is renamed to UtilsVk and the functionality in framebuffer's clearWithDraw() is moved to that class. Eventually, more fragment-shader-based internal algorithms will be added to this class as well. Bug: angleproject:2958 Change-Id: I4753c9cb3288b59cd1ed60fe7a57b9f189704322 Reviewed-on: https://chromium-review.googlesource.com/c/1369284 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>