src/libANGLE/renderer/vulkan/TextureVk.cpp


Log

Author Commit Date CI Message
Jamie Madill 3c424b48 2018-01-19T12:35:09 Vulkan: Add vk_cache_utils.h. This file contains the Pipeline and RenderPass cache utils. Also renames renderervk_utils.h to vk_utils.h and the format utils file. Refactoring change only. Bug: angleproject:2163 Change-Id: I5113a9a2c6f0b0960d38e6c2d8e391fa2d9f5f6a Reviewed-on: https://chromium-review.googlesource.com/876505 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 49ac74bd 2017-12-21T14:42:33 Vulkan: Implement command re-ordering. This introduces a new CommandBufferNode class. Nodes are linked together to form a graph based on their dependencies. When the app triggers a readback or swap, the graph is flushed entirely. This sends the queued ANGLE Vulkan work to the Vulkan queue which is then processed on the GPU with the right dependencies. This design allows us to save on some unnecessary RenderPass creation and also allows us to know what load/store ops to use. It also allows us to take advantage of the Vulkan automatic RenderPass transitions for performance. Load/Store ops and automatic transitions will be implemented in later patches. Bug: angleproject:2264 Change-Id: I0e729c719e38254202c6fedcede4e63125eb4810 Reviewed-on: https://chromium-review.googlesource.com/780849 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 5b18f487 2017-11-30T17:24:22 Vulkan: Implement basic TexSubImage2D. This also adds a test for updating a Texture that is in-use. This will ensure our Texture updates occur at the right time when we're implementing command re-ordering. Bug: angleproject:2264 Bug: angleproject:2200 Change-Id: Id6040d7238eca031e3cc7b27564d8ea815bf3d73 Reviewed-on: https://chromium-review.googlesource.com/801031 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 7f738d4e 2017-11-20T17:06:27 Vulkan: Refactor CommandBuffer helper class. This makes the base vk::CommandBuffer class as close to the Vulkan API as possible. It moves the extra functionality and state tracking to a CommandBufferAndState helper class. Also no longer stores a reference to a CommandPool in a CommandBuffer. Eventually we won't need to free CommandBuffers explicitly, since they can be freed en-masse by deallocating the CommandPool on a flush. Bug: angleproject:2200 Change-Id: I5095fe89e8da935ff8273b1a402ccfd6a3ffe0df Reviewed-on: https://chromium-review.googlesource.com/778184 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang 92019431 2017-11-20T13:09:34 Make conversion from GL types to native bools consistant. Some places would compare with "== GL_TRUE" and others with "!= GL_FALSE". This behaviour is not in the OpenGL spec but "!= GL_FALSE" is the most standard and follows the same rules as C and C++. Remove un-necessary validation that params are either GL_TRUE or GL_FALSE. Update some internal storage from GLboolean to bool. BUG=angleproject:2258 Change-Id: I12adbe2d24318a206521ca6ad1099ee7e2bf677e Reviewed-on: https://chromium-review.googlesource.com/779799 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jamie Madill d33c77c0 2017-11-09T13:08:30 Vulkan: Use correct transfer access mask in layout change. When using a transfer destination, we should be using the transfer access mask, not bottom of pipe or other bits. Uncovered by using a newer version of the layers SDK. BUG=angleproject:2237 Change-Id: I3ebcca707ac8889d2ece099e3765f5b0ca3dfdbc Reviewed-on: https://chromium-review.googlesource.com/760636 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 1d7be50a 2017-10-29T18:06:50 Vulkan: Upgrade RGB8 textures to RGBA8. It's unlikely any real hardware supports this format. Hack in a fixed fallback format for RGB8. We could consider implementing conditional support by checking the VkPhysicalDevice properties. This extends the Vulkan format support info in the RendererVk class to distinguish between a Buffer and Texture format. This is closely related to how Vulkan has separate format support bits for Linear Textures, Optimal Textures, and Buffers. We probably won't need to keep separate caps for Linear/Optimal, but it makes sense for Buffers to eventually use the same format tables. BUG=angleproject:2207 Change-Id: I8d427a99db15b314b13dd99f31aa1ac5055f0881 Reviewed-on: https://chromium-review.googlesource.com/742376 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 6a89d227 2017-11-02T11:59:51 Vulkan: Refactor format table. This moves the Vulkan format table to dynamically generated, but keeps it easily indexed. Because Vulkan format support is not able to be fully determined until runtime, we'll need a dynamic way to build the table. The most straight-forward way seems to be to keep a copy of the full table in the Renderer. Initializing it once at startup makes it a bit slower to init, but saves us from any threading shenanigans with lazy init when (and if) we ever support multi- threaded Contexts. BUG=angleproject:2207 Change-Id: Ib1ac879daa562c7ad1a965390be401fa2314e42c Reviewed-on: https://chromium-review.googlesource.com/742374 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@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 1b038241 2017-11-01T15:14:36 Vulkan: Support Texture redefinition. Because initializing the texture can queue a copy from a staging vk::Image, we must ensure we're not in a render pass. To make this easier we move the current render pass tracking into the RendererVk from the FramebufferVk class. (Note: in the future we will have deferred command submission and this will become unnecessary.) BUG=angleproject:2200 Change-Id: Ide8d4d70b50efbd79bbfa7006ad75cbc57cdf4c7 Reviewed-on: https://chromium-review.googlesource.com/741549 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill e88ec8ee 2017-10-31T17:18:14 Vulkan: Refactor GarbageObject. Instead of allocating a small bundle for deferred deletion, store a small triple of {Serial,VkHandle,HandleType}. The HandleType can be used in a generic way to release the VkHandle, without needing to store a pointer and use a virtual call. BUG=angleproject:2200 Change-Id: I30925c2f50fd11dafb1b986ced7d279a7dde827b Reviewed-on: https://chromium-review.googlesource.com/741163 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill b79e7bb6 2017-10-24T13:55:50 Vulkan: Implement simple render-to-texture. This was mostly working already, just needed to set up a few entry points. BUG=angleproject:2200 Change-Id: I9c13d6d4dd42f23c69a58e42e07e3e28877671a1 Reviewed-on: https://chromium-review.googlesource.com/734237 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@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 815a6c9a 2017-10-21T14:33:04 Vulkan: Fix copyImage region parameters. In cases where we were reading back more than one pixel in ReadPixels, and in some cases for texture init, we weren't using the correct parameters to vkCmdCopyImage. This CL fixes both of those by using more correct copy regions, and fixing the row and depth pitch computation using vkGetImageSubresourceLayout. BUG=angleproject:2167 Change-Id: Ib70217ed4a17be6b4b1b8aeec9a8a6199d210d88 Reviewed-on: https://chromium-review.googlesource.com/732190 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 035fd6b3 2017-10-03T15:43:22 Vulkan: Implement very basic textures. This is a quick implementation which supports only one backing Image and one type of ImageView at a time, for 2D texture only. It also implements a helper class for finding compatible memory pools. It's possible we can keep a cache of memory pool indexes given the guarantees the Vulkan spec has on compatible memory types (see the documentation for VkMemoryRequirements). BUG=angleproject:2167 Change-Id: I1d7a8eaec90f240273ad75194e23430d6d4c5dc1 Reviewed-on: https://chromium-review.googlesource.com/680000 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 05b35b21 2017-10-03T09:01:44 D3D11: Lazy robust resource init. This patch moves the robust resource init logic to the GL front-end. Instead of initializing texture resources immediately on creation in D3D11, it defers the clear until before a draw call in some cases, or skips the update if we can determine if a texture (or other resource) has been fully initialized. Currently lazy init is only implemented for Textures, Renderbuffers, and Surfaces. Various places where lazy resource init is triggered: * Framebuffer operations (Draw, Blit, CopyTexImage, Clear, ReadPixels) * Texture operations (SubImage, GenerateMipmap, CopyTexImage) Some efficiency gains remain to be implemented, such as when a SubImage call fills the entire object. Similarly for Blit, and a few other operations. In these cases we can skip lazy init as an optimization. Edge cases with EGLImage are mostly untested. BUG=angleproject:2107 Change-Id: I2bf3a69b1eae0d4feeb5b17daca23451f1037be8 Reviewed-on: https://chromium-review.googlesource.com/576058 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 4928b7ca 2017-06-20T12:57:39 Proliferate gl::Context everywhere. This gives the D3D back-end access to the GL state almost anywhere. This uses the onDestroy hook for Textures to push errors up from destructors, although they still don't quite make it to the Context. There are places, such as in EGL object (Context/Surface) destruction, where we end up calling through to GL implementation internals without having access to a gl::Context. We handle this via a proxy Context to a Display, basically a null context, that has access to impl-side state like the Renderer pointer if necessary. It does not have access to the normal GL state. Also Pass gl::Context to RefCountObject::release(). Since we're using destroy() methods now, we should not ever call the destructor directly. BUG=angleproject:1156 Change-Id: Ie4c32ad6bf6caaff0289901f30b5c6bafa2ce259 Reviewed-on: https://chromium-review.googlesource.com/529707 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Yuly Novikov c4d18aac 2017-03-09T18:45:02 Use ErrorStream everywhere Eliminates one more usage of FormatString and its static initializer. Add more ErrorStream types and replace gl::Error and egl::Error with them. BUG=angleproject:1644 Change-Id: Ib498d0ae4b81a332ec71aed7cf709993b154e6bb Reviewed-on: https://chromium-review.googlesource.com/505429 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill c564c070 2017-06-01T12:45:42 Pass gl::Context to impl methods instead of ContextImpl. In some cases we might have to call back into the GL layer, passing the Context, and if we just have a ContextImpl pointer this isn't possible. It also removes the need for SafeGetImpl. BUG=angleproject:2044 Change-Id: I6363e84b25648c992c25779d4c43f795aa2866d6 Reviewed-on: https://chromium-review.googlesource.com/516835 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 4fd95d54 2017-04-05T11:22:18 Stop using FramebufferAttachment::Target. Target includes the binding (DEPTH/STENCIL/COLOR), which is not useful for many operations. Simplify this to just passing the mip/layer. This allows us to stop using this internal struct in other classes. BUG=angleproject:1635 Change-Id: Ic5a11781bf45fe7835437fa1e363c190b876d453 Reviewed-on: https://chromium-review.googlesource.com/469152 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8897afa1 2017-02-06T17:17:23 Pass Context around to Texture::copyImage. Passing this through the chain will allow us to have access to the platform methods, as well as be useful in the future for Vulkan. BUG=angleproject:1660 Change-Id: I819984fceeb5a2a299aa54e59ef3b428f5f9c91f Reviewed-on: https://chromium-review.googlesource.com/438684 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
JiangYizhou bddc46b4 2016-12-09T09:50:51 ES31: Implement multisampled Textures. Implement TexStorage2DMultisample and getMultisamplefv entry point. Also modify sample state for Textures and Framebuffers. BUG=angleproject:1590 TEST=angle_unittests TEST=angle_end2end_tests TEST=dEQP-GLES31.functional.texture.multisample.samples_*.sample_position TEST=dEQP-GLES31.functional.texture.multisample.samples_*.use_texture_color_2d TEST=dEQP-GLES31.functional.texture.multisample.samples_*.use_texture_depth_2d TEST=dEQP-GLES31.functional.texture.multisample.negative.fbo_attach_different_sample_count_tex_tex TEST=dEQP-GLES31.functional.texture.multisample.negative.fbo_attach_different_sample_count_tex_rbo TEST=dEQP-GLES31.functional.texture.multisample.negative.fbo_attach_non_zero_level TEST=dEQP-GLES31.functional.texture.multisample.negative.texture_high_sample_count TEST=dEQP-GLES31.functional.texture.multisample.negative.texture_zero_sample_count TEST=dEQP-GLES31.functional.shaders.builtin_functions.texture_size.samples_1_texture_2d TEST=dEQP-GLES31.functional.shaders.builtin_functions.texture_size.samples_4_texture_2d Change-Id: I8fa7bd4e73b95745858a3e16b1b92004b4a18712 Reviewed-on: https://chromium-review.googlesource.com/414309 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yunchao He <yunchao.he@intel.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 22416868 2016-06-08T16:14:36 Add dirty bits for internal texture state. Synchronize TextureGL internal state using the dirty bits. TexturesBenchmark scores: Before: 5051 After: 7639 Diff: +51.2% BUG=angleproject:1386 Change-Id: Id04aef778a47175d1a284564495a646045855b4b Reviewed-on: https://chromium-review.googlesource.com/393866 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 9e54b5af 2016-05-25T12:57:39 Add Vulkan stubs. Currently enabled for Windows by default. BUG=angleproject:1319 Change-Id: I87921c579bee466465fb1e3f629bb3a40fdff659 Reviewed-on: https://chromium-review.googlesource.com/328730 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>