src/libANGLE/renderer/d3d/TextureD3D.cpp


Log

Author Commit Date CI Message
Chris Dalton 1f8bc491 2022-12-15T21:04:32 Make sure D3D11 textures never lose bind flags We hit an issue where a texture was used alternatively as a UAV and a render target. When used as a render target, ensureBindFlags created a new storage with just the render target bind flag. When used as a UAV, ensureBindFlags created a new storage again, this time with just the UAV bind flag. And so on. This change updates ensureBindFlags to ensure all previous bind flags are preserved when creating a new storage. Bug: angleproject:7855 Change-Id: I8c03c011e3df6eee5fbad22e45663e8fee731d57 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4112763 Reviewed-by: Stephen White <senorblanco@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Rafael Cintron c9360ccb 2022-08-10T16:05:49 Reflect TextureD3D label updates with storage object When developers change a label with the KHR_debug extension, TextureD3D calls TextureStorage::onLabelUpdate. However, onLableUpdate was still using the out of date member variable (mTextureLabel) that was set in the constructor. This change adds a setLabel method to the TextureStorage class which properly updates the texture label member variable. Calls to onLabelUpdate now retrieve the most up-to-date label. This change also renames TextureStorage::mTextureLabel to mKHRDebugLabel to make it more clear which label was being stored. Bug: angleproject:7569 Change-Id: I6bc65c35dfb2237b5da88a6ed0e2d872a14857ba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3825357 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Stephen White 3f59c285 2022-07-12T17:29:36 D3D11: implement image load/store format reinterpretation. Reinterpretation requires all UAV textures to be in a TYPELESS format. Implement an ensureUnorderedAccess() that converts the texture's storage to one with the D3D11_BIND_UNORDERED_ACCESS flag, which, prior to this change, was set unconditionally for all textures in an >= ES 3.1 context. If this flag is set at D3D texture creation time, use the appropriate TYPELESS format. Implementation uses a BindFlags struct, which subsumes the existing renderTarget for clarity. Factor out the relevant bits of ensureRenderTarget() into an ensureBindFlags() helper function, and make ensureRenderTarget() and ensureUnorderedAccess() wrappers around it. Add the corresponding typeless formats to the texture format table. Bug: angleproject:7501, angleproject:7520 Change-Id: Id21b9db3229aceca121da6ba6507704417034ec4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3780588 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org>
Mark Lobodzinski 7fb021b0 2022-05-12T16:19:14 Reland "Add Vulkan backend support for texture labels" This is a reland of commit 1afb80587e302e2ce9a901a69fd66e5ef98a73b6 Added check to ensure vkSetDebugUtilsObjectName fcn ptr is valid before use. Fixes failures on mac-swangle-chromium-try-x64. Original change's description: > Add Vulkan backend support for texture labels > > Add onLableUpdate support for textures in the Vulkan backend. > > Bug: b/229105865 > Change-Id: Id9e5b2b81352e97b7843a63f27709739005dc2f3 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3645854 > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Ian Elliott <ianelliott@google.com> Bug: b/229105865 Change-Id: I994da6db2771671c204e4ab01c69912c1be4a48f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3674296 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Kai Ninomiya 7ad48b84 2022-05-26T00:23:35 Revert "Add Vulkan backend support for texture labels" This reverts commit 1afb80587e302e2ce9a901a69fd66e5ef98a73b6. Reason for revert: Null-dereference crash starting here: https://ci.chromium.org/ui/p/chromium/builders/ci/mac-swangle-chromium-x64/26323/blamelist (see angle blamelist) Crash reason: EXC_BAD_ACCESS / KERN_INVALID_ADDRESS Crash address: 0x0 Process uptime: 24 seconds Thread 0 (crashed) 0 0x0 rax = 0x0000011c0113c000 rdx = 0x0000011c09094590 rcx = 0x0000000000000006 rbx = 0x0000011c0e2a0000 rsi = 0x00007ffedfc11500 rdi = 0x0000011c01378010 rbp = 0x00007ffedfc11540 rsp = 0x00007ffedfc114f8 r8 = 0x0000000000000006 r9 = 0x0000000123a6ccc4 r10 = 0x0000011c011018d0 r11 = 0x00007ffdbc1a4834 r12 = 0x0000000000000006 r13 = 0x0000011c090944b0 r14 = 0x0000011c0e34c000 r15 = 0x00007ffedfc11550 rip = 0x0000000000000000 Found by: given as instruction pointer in context 1 libGLESv2.dylib!gl::Context::objectLabel(unsigned int, unsigned int, int, char const*) + 0x156 rbp = 0x00007ffedfc116a0 rsp = 0x00007ffedfc11550 rip = 0x00000001357b38e6 Found by: previous frame's frame pointer 2 libGLESv2.dylib!_GL_ObjectLabelKHR + 0xa5 rbp = 0x00007ffedfc116f0 rsp = 0x00007ffedfc116b0 rip = 0x000000013578e7e5 Found by: previous frame's frame pointer 3 Chromium Framework!gpu::gles2::GLES2DecoderPassthroughImpl::DoBindTexture(unsigned int, unsigned int) + 0x1ea rbp = 0x00007ffedfc11780 rsp = 0x00007ffedfc11700 rip = 0x000000011e7dcd4a Found by: previous frame's frame pointer Original change's description: > Add Vulkan backend support for texture labels > > Add onLableUpdate support for textures in the Vulkan backend. > > Bug: b/229105865 > Change-Id: Id9e5b2b81352e97b7843a63f27709739005dc2f3 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3645854 > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Ian Elliott <ianelliott@google.com> Bug: b/229105865 Change-Id: I5a5e00084e1320a486c43fec9d41b9ae6cb2b1db Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3669657 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Mark Lobodzinski 1afb8058 2022-05-12T16:19:14 Add Vulkan backend support for texture labels Add onLableUpdate support for textures in the Vulkan backend. Bug: b/229105865 Change-Id: Id9e5b2b81352e97b7843a63f27709739005dc2f3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3645854 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
Hailin Zhang b7474d0a 2022-04-28T14:44:54 D3D11: Add GL_EXT_texture_buffer support tested: deqp-gles31.exe --deqp-gl-context-type=egl --deqp-case=dEQP-GLES31.functional.texture.texture_buffer.* passed Bug: b/206367167 Change-Id: I31a6f84bd701a737735a6bac2f4eef780c24a979 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3639722 Commit-Queue: Hailin Zhang <hailinzhang@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 459c367e 2022-01-21T10:02:33 D3D: Initialize storage after generating mipmap images. When TextureD3D generates mipmaps without a storage present, it initializes all the images and then generates mipmaps on the CPU. Attempt to generate a storage after initializing all the mip images so that the mipmap generation can be done on the GPU. Fix several edge cases where texture storage was not copied back to images when redefining for mipmap generation. This resulted in the newly generated mipmaps not using the correct data. Bug: chromium:1256340 Change-Id: I76122d36385450d973bf00f7d07402a1f975492c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3406643 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Alexey Knyazev 52904367 2022-05-10T00:00:00 D3D: Mark images clean after syncing from storage Bug: angleproject:2192 Change-Id: I114da8962f6f7aec3134d39bc51c62455e4a62ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3637565 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Kimmo Kinnunen 15895160 2022-04-05T15:43:52 Avoid leaking gl::Framebuffers in gl::Context Fix by holding framebuffer via UniqueFramebufferPointer. Removes redundant functions from gl::Surface. Replaces UniqueObjectPointerBase with unique_ptr. The use-case needs default initialization, move assign and operator bool. With these implemented, UniqueObjectPointerBase would have been an imitation of unique_ptr. Patch by David Kilzer <ddkilzer@apple.com> Bug: angleproject:6920 Change-Id: Id0c8fda95f62caa54c89d0a70684e386804db094 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3568382 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Jamie Madill 2dd13ebb 2022-04-21T11:25:00 Track Surface color & depth/stencil init separately. This clears up some trace testing confusion due when robust resource init is enabled, and the app clears color but not depth on the default surface. Bug: angleproject:7221 Change-Id: Id97871aec32ad831b663aaa9116e04b582ab5a36 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3600375 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 4cca6b3e 2022-03-08T14:54:02 Early return when rebinding the same buffer, sampler or texture Bug: angleproject:6955 Test: SimpleStateChangeTestES3.BindingSame* Change-Id: If946a7cf534809d21e49138d9f34dcee61a73627 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3029049 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 6fe13477 2021-11-11T00:47:14 Vulkan: Add external's pNext to ANGLE_external_objects_flags ANGLE was chaining VkImageFormatListCreateInfoKHR to VkImageCreateInfo::pNext to support sRGB extensions. For external images, it was unknown whether that was valid because there was no way to know if external used an identical chain of pNexts. This was causing a discrepancy between images created by Chrome and those created by ANGLE as part of an import. This change updates ANGLE_external_objects_flags to take in the pNext chain external has used to create the image so ANGLE could create the image identically. Bug: chromium:1266094 Change-Id: I479b9e7ff39d437425dc91c79834880749766f99 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3274177 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Peng Huang <penghuang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill e84b0154 2021-09-13T16:04:20 Update extension boolean names. This is in preparation for auto-gen, which uses a simple naming scheme. This fixes the bool names to be totally consistent with the extension names. Bug: angleproject:6379 Change-Id: Ia212449be04accb0e4f006b55b1813ab4481fa0b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3157417 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 1ca1589f 2021-09-13T10:56:58 Give GLES extension bools a vendor suffix. This is in preparation for auto-generation which will give all of these bools suffixes. Bug: angleproject:6379 Change-Id: I7e3f6c9b644c41a2165e6bf7b62d661fd352a250 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3158503 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Aditya Kushwah f015ae81 2021-08-02T12:47:32 Implement onLabelUpdate method. This change will implement the onLabelUpdate method by calling from every TextureStorage object. Instead of using setDebugName, introduced two new functions, setInternalName and setKHRDebugLabel, which will set the internal name and KHR label respectively that will further be sent to D3D string. Bug: chromium:1164111 Change-Id: I401ca9f6e8a2099a8807f0d7f321efe74269f9f0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3067921 Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
SeongHwan Park 16a61bbb 2021-08-05T23:06:22 D3D: Fix not notifying RenderTarget release in TextureD3D This could lead to use-after-free for the RenderTarget object. Bug: chromium:1234829 Change-Id: I73d4547b8f09f2f2cf3f7f8394f7f573fe5a4ef5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3063858 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Aditya Kushwah c9dcc553 2021-06-22T18:55:39 Move Objectlabel from Texture object to TextureState object. Created a subscriber function onLabelUpdated in the storage base class. The derived storage class will pass the label reference to the base storage class in the constructor. Future changes will use this label reference to update the label string with D3D. Bug: chromium:1164111 Change-Id: Ic5ca73bac61427afe392bb5bcc6a6eab8e785941 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2981451 Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Geoff Lang 0a80f2e1 2021-03-15T16:56:08 D3D: Mark images dirty after recovering from storage When images are recovered from storage due to resizing storage, they were marked as clean and not always re-copied to the new storage. Bug: angleproject:5757 Bug: chromium:1188854 Change-Id: Idd11025820433ab74ff769cd9508efcec4575c32 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2763282 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Stephen White a476d16b 2021-02-24T12:58:56 Check that pixel store params are 0 for fastUnpack path on D3D. Bug: angleproject:5679 Change-Id: I4b4d0e2340592383e20849ad6be99c1608c048c7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2716705 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org>
Trevor David Black de32c3d2 2020-11-04T13:16:31 Reland "Created test and fixed texture storage bug in d3d11" This is a reland of 03f3ba5b1454ee7c15cd9391e77307cf1d274b48 Original change's description: > Created test and fixed texture storage bug in d3d11 > > Bug: b/172489285 > Change-Id: If7d88cf50d99da3380082c60fb3936ae0b20c4e5 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2519876 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Jamie Madill <jmadill@chromium.org> Bug: b/172489285 Change-Id: I6b8226164a09aed208c56cb78b5d2c1385298cbe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2546034 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Trevor David Black <vantablack@google.com> Commit-Queue: Trevor David Black <vantablack@google.com>
Jamie Madill 246de6ba 2020-11-11T12:32:39 Revert "Created test and fixed texture storage bug in d3d11" This reverts commit 03f3ba5b1454ee7c15cd9391e77307cf1d274b48. Reason for revert: Suspected for causing Dawn tests failure: SharedImageGLBackingProduceDawnTest.Basic https://chromium-review.googlesource.com/c/chromium/src/+/2530246 Original change's description: > Created test and fixed texture storage bug in d3d11 > > Bug: b/172489285 > Change-Id: If7d88cf50d99da3380082c60fb3936ae0b20c4e5 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2519876 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Jamie Madill <jmadill@chromium.org> TBR=geofflang@chromium.org,jmadill@chromium.org,vantablack@google.com Change-Id: Ic0be42e070c9b9b986b724d2aa74cfdeff375245 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: b/172489285 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2532654 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Trevor David Black 03f3ba5b 2020-11-04T13:16:31 Created test and fixed texture storage bug in d3d11 Bug: b/172489285 Change-Id: If7d88cf50d99da3380082c60fb3936ae0b20c4e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2519876 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 1179b299 2020-09-25T21:33:10 D3D11: Enable renderable mipmap generation. This path might have been broken some time back with the "setData" path enabled. This speeds up sRGB mipmap generation considerably. Bug: chromium:1130678 Change-Id: Id1c22bc1cfb815339bad5955ce990fe9f48d8b5b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2432112 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 331581e9 2020-08-27T11:55:16 Make copy*Texture parameters consistent for level indices They were passed as size_t, while GL level indices are GLint throughout ANGLE. Bug: angleproject:4880 Change-Id: I43bc9f01a607e457b55a061f473450d3360db808 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2380230 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Tim Van Patten 48ba75ac 2020-08-06T15:26:53 Remove TextureCommand TextureCommand::GenerateMipmap can be moved into gl::Command allowing us to remove TextureCommand. Bug: angleproject:4753 Test: CQ Change-Id: Idc546df519e199ffd3a8b8e03b9868cd9152e9ef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2338823 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi fc4bd898 2020-08-03T16:29:06 Vulkan: Support ANGLE_external_objects_flags With this extension, it is possible to import Vulkan images into ANGLE (similar to EXT_external_objects) while specifying the Vulkan create and usage flags used to create that image. This can be used by the application to drop usage flags it does not need to improve performance, or add create flags as it requires. Bug: angleproject:4912 Bug: fuchsia:52759 Change-Id: Ia568973b19670999dd0e69f6ac5548e8ef0c3eec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2335020 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Michael Spang <spang@chromium.org>
Shahbaz Youssefi b772a955 2020-06-16T23:32:47 Vulkan: Make texture syncState aware of upcoming generateMipmap By letting TextureVk::syncState know it's being called for generateMipmap, it can make a better decision to initialize the image: - Staged updates to mips that are going to be overwritten are dropped - The image is created with full mipchain to avoid a redefine in the following generateMipmap() call. Bug: angleproject:4551 Change-Id: Ic70ee6c0a0b29c7bd62beaff612b2f2d5276defb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2249340 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jiajie Hu e7d27705 2020-04-30T05:50:21 Fix corruption when changing the base level of a framebuffer texture attachment In the D3D renderer, changing the base level may trigger re-allocation of the texture storage, for example if the new base level has a different aspect ratio. During the process, image contents in the texture storage should be backed up properly. The D3D11 backend does this if an image has been associated with the texture storage, but it may happen such an association has never been established, and corruption will be observed then. The proposed patch mitigates the problem by introducing a new method named findRenderTarget(), with which one can tell if a mip level has been used as the render target. This works based on the fact that render targets are cached in the texture storage object. Hence all mip levels of interest can be found, without relying on the association between images and texture storage. Bug: angleproject:2291 Change-Id: Ic73af7b603be25c65760928f276bec16df003baf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2158830 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill e4aa679c 2020-04-01T17:46:31 Texture: Pass explicit unpack buffer to setImage. This will allow us to call setImage internally even if there's an unpack buffer bound. Useful when implementing robust resource init with copyTexImage in some edge cases. Bug: angleproject:4517 Change-Id: I7e8e9536ab9222c620e572f7b6c20b08fa29d646 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2133088 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Alexis Hetu 94de306d 2020-01-14T16:18:56 Extensions suffixes Added NV/OES suffixes to relevant Extensions members. Bug: angleproject:3104 Change-Id: Ia1798157086230bde8d11c6fcb4fe93211e996ab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2013168 Reviewed-by: Alexis Hétu <sugoi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Yan 17b3c2f3 2019-10-14T14:13:59 Implement SamplerVideoWEBGL for WEBGL_video_texture extension on desktop WEBGL_video_texture is an extension that will improve uploading video frame to WebGL performance. (https://www.khronos.org/registry/webgl/extensions/proposals/WEBGL_video_texture/) This extension introduced a new texture type TEXTURE_VIDEO_IMAGE_WEBGL and a new sampler type samplerVideoWEBGL to sample it. In chromium implementation, TEXTURE_VIDEO_IMAGE_WEBGL maps to different native texture type based on platform. On desktop, it maps to GL_TEXTURE2D(Currently supported). On Android, it should map to GL_TEXTURE_EXTERNAL(TODO). SamplerVideoWEBGL needs to be mapped to sampler2D or samplerExternalOES according to TEXTURE_VIDEO_IMAGE_WEBGL implementation. This patch implements samplerVideoWEBGL in Angle to support WEBGL_video_texture on desktop. In this case, samplerVideoWEBGL should map to sampler2D. Bug: chromium:776222, angleproject:3889 Change-Id: Idb0a5fcde37ca75ccc1181226b91f257212e7500 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1866274 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Mingyu Hu 2d0e5b55 2019-08-27T13:49:07 GL_EXT_multisampled_render_to_texture extension. Part 2. For textures that use this extension, a multisampled texture is implicitly created for the texture. Upon write or read, the multisampled texture is either return to be drawn to or resolved and returned as a single sampled texture. This is the functionality change with end2end tests. Bug: angleproject:980428 Change-Id: I5776875a132fed7a3f4f00fb02f9e8e250684630 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1773717 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mingyu Hu 7e44ec26 2019-08-26T15:59:48 GL_EXT_multisampled_render_to_texture extension. Part 1. Adding new parameters for extension without adding any real code change. Since no new code paths were added, we expect all tests to pass as before. Bug: angleproject:980428 Change-Id: I551b46a66f422eabd357fd021e00cf266a991efb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1772377 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Geoff Lang <geofflang@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>
Jamie Madill 4e71b2bc 2019-07-08T13:23:38 Framebuffer: Clean up query naming. Changes instances where we were querying 'color buffers' and 'depth buffers' to 'color attachments' and 'depth attachments', etc. Bug: angleproject:3611 Change-Id: I7af7d33e5204f21d288f5bcad997988d36eabfc5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1690679 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Geoff Lang 5ff8cae9 2019-06-21T11:09:25 GL/D3D: Use texture uploads instead of clearing for robust init. Chrome uses regular texture uploads on all platforms except OpenGL on Mac to do robust resource init for textures because multiple bugs have been observed with texture corruption. BUG=883276 BUG=882580 BUG=941620 Change-Id: I5fcd6862147822a08c7533e6a6a9277223034ebd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1669104 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jonah Ryan-Davis beb0eb2d 2019-06-14T15:10:33 Clean up workarounds/features to single location. Rename all workarounds structs to features, and move the lists to a shared location in include/platform (to help with documentation, see: https://cs.chromium.org/chromium/src/ui/gl/gl_switches.cc?sq=package:chromium&g=0&l=69) Bug: angleproject:1621 Change-Id: I4069f08131db5e886047a007efb5d7764dfee5f2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1660952 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Kimmo Kinnunen 4a757416 2019-06-03T14:04:01 D3D: Fix heap corruption when copying texture arrays Do not use depth dimension when copying normal 2D textures of a 2d texture array. It copies past the end of the buffer obtained via ID3D11DeviceContext::Map(). Fixes a case which can be reproed with the payload disabled: gn args out\debug --args="is_debug=true" ninja -C out\debug angle_end2end_tests out\debug\angle_end2end_tests ^ --gtest_filter=Texture2DArrayCopy.SnormFormats* --gtest_catch_exceptions=0 ^ --gtest_repeat=-1 Bug: angleproject:2865 Change-Id: Id9bc5489fa41749d1b1d2e87992166b1a0af76fc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1641247 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@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>
Geoff Lang 5a0f64b6 2019-04-23T16:06:47 D3D: Require cube completeness to create render targets TextureD3D_Cube::isFaceLevelComplete skips checks for the base level because it assumes that isCubeComplete has already been called to verify the base level. This assumption is not correct for some cases like glCopyTextureCHROMIUM which attempts to create a render target from cube maps that may not be complete. This caused us to create render targets from incomplete cube maps and then fail to upload data to the cube faces because the sizes or formats did not match between the images and render target. TEST=conformance/more/conformance/quickCheckAPI-S_V.html BUG=angleproject:3384 Change-Id: Iceb9415debfa07436fea1eb4bc23d0ec05679839 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1578957 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Michael Spang f02a767d 2019-04-09T18:45:23 Vulkan: Implement glTexStorageMem2DEXT This implements support for creating textures that alias vulkan images allocated inside external memory. Bug: angleproject:3289 Change-Id: Iad071f353a217793102ae737647c7cd572f7b0ad Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1552029 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Michael Spang <spang@chromium.org>
Qin Jiajia e7da32f1 2018-12-27T15:31:47 Fix the failure in UpdateImageTextureInUse If we update the texture data between two dispatch calls, ReadPixels can't get right result after the second dispatch call. The failure reason is that after the first dispatch, ReadPixels will sync framebufer state which will update color render target. Finally, TextureD3D::ensureRenderTarget is reached. However, we are in compute pipeline. mTexStorage->isRenderTarget() will be false. That results the current texture will create a new render target storage. But the UAV is still bound with the previous texture storage. If there is no texture dirty bit between these two dispatch calls, applyTexturesForCompute won't be called. After the second dispatch, readPixels will read data from the new texture storage which is not updated. Bug: angleproject:3015 Change-Id: Ib2494ab8bf6e12faefc0a7370719d383526c36ba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1390710 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
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>
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>
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>
Jamie Madill e4634a13 2018-11-14T09:54:35 Apply code formatting. Several files were formatted by the code generation script. Bug: angleproject:2957 Change-Id: I8a5cbf2c17297a3644686004a8981ab2305c1ada Reviewed-on: https://chromium-review.googlesource.com/c/1334428 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 666818ea 2018-11-14T09:54:33 Use angle::Result in front-end (Part 8) Refactors the gl::Texture class and a few related methods. Also reduces binary size by up to 4k. Bug: angleproject:2491 Change-Id: Ib9a69d7f507b0dce35abb17b90532f812bf43214 Reviewed-on: https://chromium-review.googlesource.com/c/1291845 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill c1fd7376 2018-10-26T22:48:39 Move index range calculations into VertexArray. This is in preparation for removing the entire DrawCallParams struct. This struct was big enough to cause a performance hit on draw call perf tests just by virtue of initializing the fields. Also dereferencing the struct members is slower than reading function parameters since it adds an indirection. Also includes some error refactoring to enable moving code to a shared location. In total this patch series reduces overhead by up to 5%. Bug: angleproject:2933 Change-Id: Ib663f2538c14ac30d4c31fd10d6350be469626e2 Reviewed-on: https://chromium-review.googlesource.com/c/1298380 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6f755b21 2018-10-09T12:48:54 Use angle::Result in front-end. (Part 1) This covers most of the hot paths used in draw calls. Gives in the order of a 5% reduction in draw call overhead. Bug: angleproject:2491 Change-Id: I2d53afb1163eaceed61fb9cd9ce6c1267c85c0fa Reviewed-on: https://chromium-review.googlesource.com/c/1258149 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill abfbc0fe 2018-10-09T12:48:52 Use angle::Result in allocation and math check macros. Replace these with ANGLE_CHECK_*_ALLOC and ANGLE_CHECK_*_MATH depending on the specific error type. Bug: angleproject:2491 Change-Id: Ic4395101fe701c563ae2b92aa2c55c93b934a7de Reviewed-on: https://chromium-review.googlesource.com/c/1262737 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e39e8f46 2018-10-05T08:17:38 GL back-end error refactor. Adds explicit error handling to a few scoped state handler classes. Otherwise mostly mechanical refactoring. Bug: angleproject:2753 Change-Id: I2bf969a68f45880902b6e7902297c1340a76a1c4 Reviewed-on: https://chromium-review.googlesource.com/c/1255647 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Brandon Jones 4e6f2aea 2018-09-19T11:09:51 Implement ANGLE_copy_texture_3d Extension Adds copyTexture3DANGLE and copySubTexture3DANGLE that adds copy operations on volumetric textures. Bug: angleproject:2762 Test: angle_end2end_tests Change-Id: I0076989c2b7ed69abfc73143c325065bdb06a360 Reviewed-on: https://chromium-review.googlesource.com/c/1207216 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 55e57f96 2018-09-18T11:32:43 Remove some redundant dirty bits notifications. These were already being signaled in the front end. Bug: angleproject:2763 Change-Id: Id78d3d764e80e687c29c08395b59048d314bfbe2 Reviewed-on: https://chromium-review.googlesource.com/1204490 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho daab0014 2018-09-13T14:56:28 Test and fix robust resource init for multisampled textures New test coverage for robust initialization of multisampled textures is added in angle_end2end_tests. Some missing functionality that was affecting the initialization of multisampled 2D array textures is now fixed. BUG=angleproject:2775 TEST=angle_end2end_tests Change-Id: I1d9d3cd154ca2910159941fe8b1bef4ae6320bdd Reviewed-on: https://chromium-review.googlesource.com/1224530 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho efbabde2 2018-08-29T14:37:36 Support multisample array textures on D3D11 This implements complete support for multisample array textures on the D3D11 backend. There's a specialized TextureD3D class as well as a TextureStorage11 class for multisample array textures that have the bulk of the functionality. BUG=angleproject:2775 TEST=angle_end2end_tests, angle_deqp_gles31_tests Change-Id: I68116635c01cef0e48c089fd9da05a844ef2d802 Reviewed-on: https://chromium-review.googlesource.com/1216003 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 8370e6bc 2018-09-11T17:56:23 Rename constant to kCubeFaceCount. This corrects the naming style for this constant variable. Also updates many usages in TextureD3D.cpp and TextureGL.cpp. Bug: angleproject:2470 Change-Id: I029dd98e925cabf23a4bb26467a62afe6c5bb6e0 Reviewed-on: https://chromium-review.googlesource.com/1220726 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 0d0fb43f 2018-09-07T17:43:32 Pass unpack buffer as explicit parameter to texSubImage. This allows us to override it in the incomplete texture init. Any back-end that used incomplete textures was vulnerable to a bug where the unpack buffer would be used to initialize the incomplete texture. Bug: chromium:880906 Change-Id: Ica558e4a4d81de9212f0bc6619ccd812a048ad45 Reviewed-on: https://chromium-review.googlesource.com/1214207 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 80aa5592 2018-08-29T15:50:39 Clean up TextureD3D_2DMultisample This removes some duplicate unreachable calls from TextureD3D_External and TextureD3D_2DMultisample. There will be further use for this once TextureD3D_2DMultisampleArray is implemented. This also cleans up some no-ops from TextureD3D_2DMultisample and sets it correctly as immutable. BUG=angleproject:2775 TEST=angle_end2end_tests Change-Id: Ia253a1ed6f418a24bb0c4a4e61654b1c061dba97 Reviewed-on: https://chromium-review.googlesource.com/1193950 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill ec1fe5b7 2018-08-10T10:05:52 D3D: Use angle::Result error pattern. This completes the refactor for the D3D9/D3D11 back-ends. Bug: angleproject:2752 Change-Id: Ie35a925f75c902d8f9fdab6bc33b3bb9c937f85b Reviewed-on: https://chromium-review.googlesource.com/1167209 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b1565903 2018-07-27T08:12:48 D3D: Pass gl::Context to many more functions. This makes the Context more available for logging errors. Also includes more refactoring to VertexDataManager to ensure we can access the gl::Context. Bug: angleproject:2738 Change-Id: Iae3d22a1403078d236bfe63a3e2d203c13678dc4 Reviewed-on: https://chromium-review.googlesource.com/1151449 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill dec86230 2018-07-11T09:01:18 Generalize Context scratch buffer errors. This refactor will allow us to generate different error types in different backends. This makes Vulkan happy because it won't have to generate gl::Errors and can stay with vk::Error. Bug: angleproject:2713 Change-Id: I981402450f3b519d4f79851982547695d583355a Reviewed-on: https://chromium-review.googlesource.com/1128921 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill ca2ff38b 2018-07-11T09:01:17 Refactor internal format pixel math methods. This removes the use of the ErrorOrResult class from these methods. This will enable more performant Error handling. Also cleans up the ANGLE_TRY_CHECKED_MATH macro to be more general. Bug: angleproject:2713 Change-Id: I349947d320907839ca88ec1f9251e6ddc3858a08 Reviewed-on: https://chromium-review.googlesource.com/1128920 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jiawei Shao a8802477 2018-05-28T11:17:47 ES31: Implement FramebufferTextureEXT on OpenGL back-ends This patch intends to implement FramebufferTextureEXT on OpenGL back-ends. 1. Support layered framebuffer attachments. 2. Add new framebuffer completeness rules on layered framebuffer attachments. 3. Support FRAMEBUFFER_ATTACHMENT_LAYERED_EXT as a valid <pname> parameter of GetFramebufferAttachmentParameteriv. Note that for an entire level of a cube map: 1. It has no TextureTarget because TEXTURE_CUBE is not a valid target for TexImage*D. 2. It corresponds to 6 ImageDescs (that represents its faces) in class Texture, so when the cube map is cube complete, we return the ImageDesc of its first face, meanwhile we do not allow querying ImageDesc if it is not cube complete. BUG=angleproject:1941 TEST=angle_end2end_tests dEQP-GLES31.functional.geometry_shading.query.framebuffer_attachment_layers dEQP-GLES31.functional.geometry_shading.query.framebuffer_incomplete_layer_targets dEQP-GLES31.functional.geometry_shading.layered.* dEQP-GLES31.functional.geometry_shading.instanced.invocation_per_layer_* dEQP-GLES31.functional.geometry_shading.instanced.multiple_layers_per_invocation_* Change-Id: I44393b513ec8f1a682fd1c47d3eaa6f3b3fae877 Reviewed-on: https://chromium-review.googlesource.com/1075811 Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiawei Shao 6a455206 2018-05-31T14:20:36 Use IsCubeMapFaceTarget on texture targets This patch introduces IsCubeMapFaceTarget() to determine if a teture target belongs to cube map. BUG=angleproject:2169 Change-Id: I3968ee267887665835f3eb3eda281c054e5d4375 Reviewed-on: https://chromium-review.googlesource.com/1080450 Reviewed-by: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Geoff Lang f2807385 2018-04-24T15:25:35 D3D: Use an alignment of 1 when uploading zero data to initialize textures. BUG=836131 Change-Id: I1206c8eda465da563e15cf43f2e5c9320bb65eae Reviewed-on: https://chromium-review.googlesource.com/1026460 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Luc Ferron 4bba74f0 2018-04-19T14:40:45 Refactor Texture::syncState to pass down the Context Also returning a gl::Error everywhere. Bug: angleproject:2478 Change-Id: Ic8cae0ee7aee318bb95b3588044c34c62707b578 Reviewed-on: https://chromium-review.googlesource.com/1020083 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
Jamie Madill cc129377 2018-04-12T09:13:18 ImageIndex: Consolidate layer/cube face. In terms of the Texture or Image resource, a cube face refers to a layer of a 2D texture. This layer has a special meaning for cube textures, but it is represented as a layer with a layer index. Cube array textures are no different, they just use a different indexing scheme for the array layers. This also cleans up the ImageIndex helper to have a class structure with private data, and cleans up a few cases to use generic Make functions and iterators where they were setting properties of the index directly. This will make it easier to have ImageIndexes address entire levels of a Cube map in the future, and makes the layer count logic in Vulkan cleaner. Bug: angleproject:2318 Change-Id: Iea9842e233f974a9896282ca224cb001f7882bd1 Reviewed-on: https://chromium-review.googlesource.com/987525 Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 56c8577b 2018-04-06T16:31:47 TextureD3D_2D::CopyImage clear using initializeContents When using glCopyTexImage2D clearing of the mip level needs to happen when running in WebGL or robust resource init mode and any pixel would be sampled outside of the framebuffer. Previously the code was using "setImage" for this purpose, causing issues when a PIXEL_UNPACK_BUFFER was bound. Also add a regression test. BUG=chromium:827667 Change-Id: I03be20d8272730ab30afdab2f8919be853e729b6 Reviewed-on: https://chromium-review.googlesource.com/1000182 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill c4f27e4b 2018-03-31T14:19:18 Texture: Pass ImageIndex to relevant methods. The Vulkan back-end will be using this helper struct, so make it available everywhere. This cleans up a lot of the code for D3D. Potentially in the future we could generate these in the entry points if we supported packing multiple arguments into one. Also changes a few parameter types to GLint for compatibility. Also updates the Vulkan Texture implementation check the stored vk::Format on setImage changes. Bug: angleproject:2318 Change-Id: I57cea4a42483ab51859229517d783b58f206b8e7 Reviewed-on: https://chromium-review.googlesource.com/985203 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Jamie Madill 690c8eb7 2018-03-12T15:20:03 Framebuffer: syncState before internal format query. Since querying the internal format of an attachment might need ot look at the RenderTarget for some back-ends, or otherwise flush attachment changes, we should call syncState internally. This means that we can't mark these queries as const. Bug: angleproject:2372 Change-Id: I9bfb43a472bcd7dfdd6ea7fab4751d494e1126bb Reviewed-on: https://chromium-review.googlesource.com/948784 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 99d492c2 2018-02-27T15:17:10 Use packed enums for the texture types and targets, part 2 This completes the refactor by using the packed enums in the gl:: layer and in the backends. The packed enum code generation is modified to support explicitly assigning values to the packed enums so that the TextureTarget cube map faces are in the correct order and easy to iterate over. BUG=angleproject:2169 Change-Id: I5903235e684ccf382e92a8a1e10c5c85b4b16a04 Reviewed-on: https://chromium-review.googlesource.com/939994 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 888081d5 2018-02-27T00:24:46 D3D11: Refactor dependent Framebuffer state changes. Previously, when a state change would cause a Texture to recreate its storage specific to D3D11, we would use a dependent notification from RenderTarget11 to Framebuffer11 to re-check internal dirty bits. In this new method, we instead set dirty bits on the gl::Frambuffer directly. This also means we use fewer internal objects for these notifications, because we share the same structures between the D3D11 back-end notifications and the top-level notifications we use for Robust init and Framebuffer completeness. This also allows us to get rid of one "if" that we check on every draw call in D3D11. This also introduces a dirty bits guard concept - a shadow set of dirty bits that is checked in dependent state changes to ensure that extra bits aren't set inside syncState. This also implements Framebuffer dirty bits for the D3D9 back-end. This has the side effect of cleaning up the "null colorbuffer" D3D9 workaround. Bug: angleproject:2372 Change-Id: Ie346d39030f4f6df583d735685b0babea4e745a8 Reviewed-on: https://chromium-review.googlesource.com/936691 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang b52fac03 2018-02-21T15:45:35 Refactor ImageIndex to have separate type and target members. BUG=angleproject:2169 Change-Id: Ib3fb699058f76d0eb810a9691ea1d64311dadbb1 Reviewed-on: https://chromium-review.googlesource.com/929650 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang f81d17c2 2018-02-02T15:10:37 D3D11: Downsample when copying to emulated 16-bit texture formats. BUG=angleproject:2313 Change-Id: Ic1e679164d82f3024bb6842c9af2716aa10feb76 Reviewed-on: https://chromium-review.googlesource.com/900042 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Dzmitry Malyshau 57f4b73e 2018-01-11T15:24:43 Fix the format check in TextureD3D_2DArray::redefineImage Note: by the time the old code used to call `getBaseLevelInternalFormat`, the base level image has already been updated with `redefine()` call above, thus the check `internalformat != storageFormat` wasn't correct. Change-Id: I3da6df54490d6e72e5094388ed7e39a4c7d920d2 Reviewed-on: https://chromium-review.googlesource.com/862256 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Dzmitry Malyshau <dmalyshau@mozilla.com> Commit-Queue: Geoff Lang <geofflang@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 0acb268c 2017-11-14T12:40:37 TextureD3D: Only update storage if images dirty. This uses the existing dirty bit mDirtyImages to early return in the TextureD3D::updateStorage methods. Also fixes a couple missing cases for setting dirty images. The code could be improved in the future by using a bitset of dirty images per mip level instead of a single bit. BUG=angleproject:1392 Change-Id: I58df2be455b6ee51c3e3f76a6fa44ad585d1480d Reviewed-on: https://chromium-review.googlesource.com/761243 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 336129f6 2017-10-17T15:55:40 Use a packed enum for buffer targets. BUG=angleproject:2169 Change-Id: I4e08973d0e16404b7b8ee2f119e29ac502e28669 Reviewed-on: https://chromium-review.googlesource.com/723865 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez cda6af19 2017-10-30T19:20:37 Split pixelBuffer from pack/unpack state This will refactor will help use packed enums for buffer targets. BUG=angleproject:2169 Change-Id: Ie7ed3e105f89457c67027e6598d7e29503ad355c Reviewed-on: https://chromium-review.googlesource.com/745181 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 56ff3ce2 2017-10-20T16:52:42 D3D9: Implement the CPU-copy path for CopyTextureCHROMIUM. This path is hit for LUMA formats. Only copy from storage to image when the storage is renderable, otherwise it already has up-to-date data. D3D9 cannot sync storage to image without it being renderable. Commit the region after CPU copies to make sure everything is synchronized afterwards. TEST=conformance/textures/canvas/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html BUG=angleproject:2192 Change-Id: I74ff748bd051a52cf472ca7ff77f54dfb5ba65b9 Reviewed-on: https://chromium-review.googlesource.com/730493 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 42975644 2017-10-12T12:31:51 Move incomplete texture logic to shared helper. The incomplete texture handling is similar between the D3D and Vulkan back-ends. We create 1x1 textures, initialize them to black, and bind them when we detect incomplete textures. We would also bind incomplete textures when we detect feedback loops. In the GL back-end, we wouldn't detect feedback loops, and would allow the driver to handle incompleteness. Instead implement this in a shared helper class, and do the feedback loop detection in the front-end for every back-end. This makes our behaviour more consistent between back-ends, and prevents undefined behaviour. Because initializing multisample textures is tricky (they can't be updated with TexImage calls) we do a bit of a workaround so the back-end can clear the incomplete multisample texture initially. This progresses the initial Vulkan textures implementation. BUG=angleproject:2167 Change-Id: I79ddcc0711fcc986f2578a52ac6f701231d241ac Reviewed-on: https://chromium-review.googlesource.com/700993 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang a1506213 2017-09-21T10:49:18 Remove initialization of ImageD3D objects now that lazy init covers them Inintialize all D3D11 texture allocations with dummy values in debug. BUG=angleproject:2107 BUG=angleproject:1635 Change-Id: Ibcc6cc30480b32430563143f35f38dda16fdb83c Reviewed-on: https://chromium-review.googlesource.com/678477 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@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 ea84f6ff 2017-09-20T13:20:30 Pass Context to Framebuffer11 dirty callback. This allows us to call StateManager11::invalidateRenderTarget from the Framebuffer11::signal function, which will then trigger state refresh on the next draw call. This requires passing Context through a few more Renderbuffer methods, and reorganizing the RenderTarget signalling so that it doesn't signal dirty in the destructor. Instead they are signaled as they are destroyed in the containing classes. BUG=angleproject:2151 Change-Id: I4cf575e4a01b48275ff78d75bc55b2d1fced591d Reviewed-on: https://chromium-review.googlesource.com/673139 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 136a2742 2017-09-20T12:29:44 TextureStorage11: Use unique_ptr for RenderTargets. This ensures they are auto-freed when the Storage is destroyed. Also remove the 'delete this' design pattern. BUG=angleproject:2151 Change-Id: I784b94c7125a1bbc15f5d6ae90e55317e199faa6 Reviewed-on: https://chromium-review.googlesource.com/673137 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 33510107 2017-09-20T10:39:18 Pass gl::Context to more Buffer methods. This will allow us to pull out the Renderer from the Context in more places in Buffer11, for state update. Impacts a few method calls in a few places. BUG=angleproject:2151 Change-Id: I1360caea65a94d3de4cd9f52d1b74b10439b02b3 Reviewed-on: https://chromium-review.googlesource.com/673136 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 71c88b31 2017-09-14T22:20:29 Enable [[nodiscard]] for gl::Error. This forces all return values to be checked for gl::Error. Requires quite a bit of minor refactoring. I also added a macro to swallow an error without returning from a function. We could look at storing the errors in the Context at some point, since almost always when we're generating errors that we need to discard we have access to the Context as a parameter. BUG=angleproject:2150 Change-Id: I457e48a30c002eda0993acbcd3180ba87bf169fb Reviewed-on: https://chromium-review.googlesource.com/665173 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 3cb4894c 2017-08-18T10:03:01 Make TextureD3D::clearLevel work with depth/stencil. Although we only used this method in one place that didn't need to clear depth or stencil, the method itself doesn't seem like it should be limited. It will become useful in later patches which initialize depth and stencil textures robustly. BUG=angleproject:2107 Change-Id: I7dc67608972f2b31c0cb4d309941be10f47d1d47 Reviewed-on: https://chromium-review.googlesource.com/585600 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Frank Henigman 936ea325 2017-08-04T20:58:06 Clip to framebuffer when copying to cube map. In D3D cube map textures use different code paths than regular 2D textures. Add outside-the-framebuffer handling to those paths, same as was added the other paths earlier. Change-Id: I51896a07f73ae8d761cd9d7b18c68076f38d32a3 Reviewed-on: https://chromium-review.googlesource.com/603050 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang a0bcc50b 2017-08-02T14:45:58 TextureD3D: Mark images clean after binding a surface. By marking the images as dirty after binding a surface, the surface would be cleared when it was first read or written to. BUG=750813 BUG=angleproject:1635 Change-Id: Ic0d1c985151d55a0f1a1af67bb1edc4b0e8f2063 Reviewed-on: https://chromium-review.googlesource.com/598731 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill b3f26b9e 2017-07-19T15:07:41 Add a zero-filled scratch buffer to Context. We need this in a few places for handling resource init. Centralize this in the context so we don't have to recreate and re-fill a large zero buffer. BUG=angleproject:2107 Change-Id: Icf9ce417e7ee3498f03e47741dfff89e81b49519 Reviewed-on: https://chromium-review.googlesource.com/576057 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang c7ba85c9 2017-07-14T22:17:01 TexutreD3D: Only update storage level if it exists. This was causing an assertion failure in updateStorageLevel when the storage didn't contain the requested level. Gate the call behind an isValidLevel check. TEST=conformance/misc/type-conversion-test.html BUG=angleproject:1815 Change-Id: Iadf46d232d5a117ae1ae74c6e71677b1e06a5321 Reviewed-on: https://chromium-review.googlesource.com/572705 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang c5af8ba6 2017-07-11T12:18:31 D3D11: Make sure to resolve the storage for CopyTexImage3D. TextureD3D_3D::copySubImage worked around missing functionality in D3D11 for copying a framebuffer directly to a texture storage but didn't handle the case of a texture storage already existing. This caused the image to have out-of-date data before the new data was copied into it. Simply copy the data from the storage back into the image before performing the copy from the framebuffer and then copy back to the storage afterwards. TEST=conformance2/textures/misc/copy-texture-image-webgl-specific.html BUG=angleproject:1815 Change-Id: I308d6a1d3ecbc738f7d0e232bece433e6b353638 Reviewed-on: https://chromium-review.googlesource.com/567199 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang d90b214f 2017-07-12T15:33:35 D3D11: If an image is dirty, copy it to the storage before copying from a FB. If a storage already existed, it may have old data in it. Check if the image is dirty and copy the initialized memory into the storage before copying data from the framebuffer. TEST=conformance/textures/misc/copy-tex-image-and-sub-image-2d BUG=angleproject:1815 Change-Id: Ic69c5519b2e09e4b62025b1bf413d2a71a4a2afb Reviewed-on: https://chromium-review.googlesource.com/568410 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
JiangYizhou 34bc315d 2017-03-29T14:56:01 ES31: Implement multisampled Textures for D3D part. Implement TexStorage2DMultisample api for d3d part. BUG=angleproject:1590 TEST=angle_end2end_tests --gtest_filter=TextureMultisampleTest* TEST=angle_deqp_gles31_tests --deqp-case=dEQP-GLES31.functional.texture.multisample.negative.fbo_* Change-Id: Icbfba45b9c2965af02b54dd4060b7b49970cb74b Reviewed-on: https://chromium-review.googlesource.com/457161 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang bc5d7add 2017-07-10T16:17:26 D3D11: Clip copy rect to the source framebuffer for copyTexImage3D. TEST=conformance2/textures/misc/copy-texture-image-webgl-specific.html BUG=angleproject:1815 Change-Id: I146fcf97a9c90f07d6270672c5e44e05602eecf8
Geoff Lang 88318b44 2017-07-05T14:39:01 Fall back to CPU copies for srgb textures in copy_texture_CHROMIUM. The copied data is not supposed to have sRGB conversions applied to it when written to the destination texture but an sRGB SRV is used by Blit11. Instead of creating multiple sRGB and non-sRGB SRVs for textures, simply fall back to the CPU copy path for this format for now. Clip color channels that should not exist in the destination texture formats in Image11::CopyImage. This works around issues with texture formats with emulated channels. TEST=conformance2/textures/image_bitmap_from_canvas/tex-2d-srgb8-rgb-unsigned_byte TEST=conformance2/textures/image_bitmap_from_canvas/tex-2d-srgb8_alpha8-rgba-unsigned_byte BUG=angleproject:1932 Change-Id: Ieeda3569f80d016fda781e7eb498acd3b97568d0 Reviewed-on: https://chromium-review.googlesource.com/559857 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Frank Henigman 95ba174e 2017-06-22T20:38:04 Clip TextureD3D_2D::copyImage to framebuffer. WebGL CopyTexImage needs to zero the part of the texture corresponding to area outside the framebuffer, so we zero the whole texture then clip the read area. The clipping also avoids problems with code lower down that isn't prepared for read areas not entirely within the framebuffer. Enable corresponding test. BUG=angleproject:1815 Change-Id: Ia7e0243ca72fa7c8f5bacda4d2022061d6a6d4f0 Reviewed-on: https://chromium-review.googlesource.com/551056 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
Frank Henigman ab04e6a7 2017-06-22T20:38:04 Clip TextureD3D_2D::copySubImage to framebuffer. WebGL CopyTexSubImage does not allow touching parts of the texture that correspond to area outside the framebuffer, so we clip the read area to the framebuffer. The clipping also avoids problems with code lower down that isn't prepared for read areas not entirely within the framebuffer. Enable corresponding test. BUG=angleproject:1815 Change-Id: I411223669dae2a456dfc3e22acda907b73177988 Reviewed-on: https://chromium-review.googlesource.com/527411 Commit-Queue: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>