src/libANGLE/Texture.cpp


Log

Author Commit Date CI Message
Brandon Schade 8f6d1af9 2020-03-19T14:35:48 Vulkan: Implement EXT_texture_format_sRGB_override Implemented support for EXT_texture_format_sRGB_override This is done by creating new imageviews for textures with sRGB overridden that reinterpret the format to its sRGB counterpart. As preparation for this, textures that use this feature are reallocated with VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT. This will have a performance cost for textures that use this feature, but should have no performance cost for regular textures, since they will not have this bit set. Bug: angleproject:4561 Test: angle_end2end_tests --gtest_filter=SRGBTextureTest.*Vulkan* Change-Id: Iba25f1f2b0a7227959c1cb4ba6e3ca8311c20d06 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2152145 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Cody Northrop 712fea9a 2020-05-06T15:45:25 Sync state when calling getTexImage ANGLE's mid-execution capture was failing after changes to defer clears. There were still textures with pending updates and dirty bits after SwapBuffers. This caused our calls to Texture::getTexImage to assert. This was due to a bug where getTexImage was not syncing state. This change makes the function non-const so that it can update state directly. TBR=cnorthrop@google.com,courtneygo@google.com,jmadill@chromium.org Test: Manhattan MEC Bug: angleproject:4517 Change-Id: I717ad44cfc60ae0d4483721f1c91e47c5dda3939 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2186170 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Mohan Maiya daed369c 2020-05-05T14:24:26 EGL: Add support for GL_EXT_EGL_image_array extension Add support for creating 2D array EGLImages. 2D array textures are core in GLES3.0. Enable the eglImageArray bool that controls exposure of the extension for all contexts >= GLES3.0 Bug: angleproject:4604 Tests: angle_end2end_tests --gtest_filter=ImageTest.*2DArray* Change-Id: Iebc1ad184fe7209ca89d620290337438ac251c56 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2176109 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 2a0c3596 2020-03-31T15:36:45 Vulkan: Clean up robust and emulated image clears. This change consolidates image clears in multiple places into a single site in ImageHelper initialization. It adds support for appending clear image commands as well as prepend (the default). We prepend clears because image initialization happens after data upload. The Vulkan robust clear path now works like the other back-ends. The change flushed out a bug where partially uninitialized CopyTexImage was not correctly initializing a texture before triggering a full resource clear. Texture::copyImage now uses a workaround where we first init the image before clearing it. After the init we upload the new data. We'll use the appending clears path when implementing deferred clears. Bug: angleproject:4517 Change-Id: If9212f3b8cdd0fc8b7e729d364530801a644e164 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2130627 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Jamie Madill 78a471ba 2020-04-03T16:21:21 TextureGL: Signal DirtyBitsChanged on dirty bits. This is a refactoring change only in preparation for a change in the Vulkan back-end. We'll need to split the handling for Vulkan and GL into different functions. Bug: angleproject:4517 Change-Id: I2ddf9c70fe247d1dcb4e0aa9ca929bbbd61bd42b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2135893 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 1c95795f 2020-04-03T14:49:45 Use ImageIndex in ensureSubImageInitialized. Passes an already initialized struct so we don't need to separately pass a level and layer. Also removes some redundant gl:: prefixes in Texture.cpp and adds a new helper function doesSubImageNeedInit. Refactoring change only. Bug: angleproject:4517 Change-Id: Ib2d8a5c9ceaada03cc8d299adcb5aed53a0cf13c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2135928 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill c9c4e4ed 2020-04-02T10:29:52 Track rendering feedback loops by-context. This fixes an issue where feedback loops detection would trigger false positives based on texture use in multiple contexts. 1) there are two contexts, C1 and C2, sharing resources 2) in C1, there is a texture T bound to GL_TEXTURE_2D, and a program in use that will sample C1 3) in C2, a framebuffer is created and T is bound to it This fix indexes each set of active bindings in an object by ContextID. We can potentially redo this solution in the future if this proves to have too much tracking overhead. Includes a test writen by Ken Russell. Bug: angleproject:4517 Change-Id: I67012e68947c42d863dca193972576c82d5f3712 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2134406 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@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>
Kenneth Russell e39d055d 2020-03-23T17:45:57 Fix robust resource initialization with clipped CopyTexSubImage2D. When CopyTexSubImage2D calls were clipped against the bounds of the read framebuffer by the underlying renderer backends, the robust resource initialization code assumed that the original destination area would be overwritten by the renderer, which was not the case. Add new tests which were previously failing on macOS with the ES2_OpenGL and ES3_OpenGL backends. The Metal backend is still failing and a follow-on bug has been filed. Bug: angleproject:4504 Change-Id: I34821dd90597f31b3cbf0921b94756556e485c91 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2116873 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Mohan Maiya 62b72552 2020-03-20T07:51:26 Add support for EXT_EGL_image_external_wrap_modes Allows for more wrap modes to TEXTURE_EXTERNAL_OES textures Test: angle_end2end_tests --gtest_filter=ExternalWrapTest.* Bug: angleproject:4443 Change-Id: I37bde091b166d7471c13c14fd6b0174136b52ecf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2103433 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b1eb44bf 2020-03-18T15:33:13 Track if a Texture is bound as a sampler. This will more easily allow us to detect rendering feedback loops. We'll need to support feedback loops to enable Manhattan. Bug: angleproject:4490 Change-Id: I442deebd89dcf0139411688eaa204c5e5b2c2799 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2109334 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jamie Madill e54f7ed7 2020-03-17T18:20:44 Capture/Replay: Fix compressed texture subImage caching. The prior code was caching the last subImage data. In fact we should be caching and updating a pixel rectangle. Multiple subImage calls will update the same rectangle until the final capture call sets up the replay with the complete initial data. This was causing an issue with Manhattan and the initial data for 3D compressed textures. Manhattan uploads these one layer at a time. So the prior code was trying to pass a single layer's data to the subImage call for the entire level. Bug: angleproject:4488 Change-Id: I76765dcea884f9d8ea07908c44e97578ddb0ff0d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2107761 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@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>
Jamie Madill c431d596 2019-12-16T10:59:44 Add Serial to all GL resources. The Serial will help track active resources for filtering out inactive setup calls in capture/replay. Bug: angleproject:4223 Change-Id: I64ba50f27d656c12d45155dc735e9b6f9c04528f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1969062 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Ian Elliott 5f857839 2019-12-04T15:30:50 Improve current multisampled renderbuffer/texture support This is split off from a change to implement multisampled textures for the Vulkan back-end, and will come before that change. The changes include: - Make a common utility rx::GetSamplePosition() function. D3D11 and Vulkan use the same standard sample positions/locations for 1, 2, 4, 8, and 16 samples. The D3D11 back-end has a utility function for this, which is being moved to a common location--for use by both the D3D11 and Vulkan back-ends. - Texture::setStorageMultisample() handles converting the "requested number of samples" to the actual number of samples used (e.g. converting 3 to 4), supported by the underlying back-end). The actual number used is stored in gl::TextureState::mImageDescs, for use by other GLES commands. - Change some end2end tests to not make assumptions about the supported number of samples, but to properly query what is supported. Bug: angleproject:3565 Bug: angleproject:4196 Change-Id: I1dc12fedd0f8fb4975f90d87486e443b069b7141 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1948535 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com>
Sunny Sun df415528 2019-10-24T09:22:39 Vulkan: Enable VK_IMAGE_USAGE_STORAGE_BIT when it is needed VK_IMAGE_USAGE_STORAGE_BIT is always enabled for vkImage, this increases memory bandwidth in some platforms. This CL changes the behavior to enable VK_IMAGE_USAGE_STORAGE_BIT when necessary. Bug: angleproject:3904 Test: angle_end2end_tests Test: angle_deqp_gles2_tests Change-Id: I8ffd37efa8d99d04328fa6232de0755be3273d9e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1857799 Commit-Queue: Sunny Sun <sunny.sun@arm.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill dfc20daf 2019-10-28T13:51:42 Plumb more logic for ANGLE_get_image. Also implements and tests validation / negative API. Bug: angleproject:3944 Change-Id: I3385a4255f4fab6a12eee2abfa5ffcce2107359a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1879961 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Xinyi He 052167bc 2019-08-13T14:09:04 Vulkan: Mipmap is unconditionally enabled in ANGLE ANGLE always enables the Mipmap. The fix does redefining the image with mipmaps and replace the origin one only when it is necessary. Bug: angleproject:3737 Change-Id: Ia33a16fd7feae303fb114988059c4eec58c4232d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1750627 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com>
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>
Cody Northrop 6acfca3a 2019-10-04T08:06:29 Vulkan: Handle texStorage when base level is set In this scenario, we allow the texStorage call to fully populate the image, then let dirty bits change the vkImage to reflect the base level. Bug: angleproject:3948 Bug: angleproject:3949 Test: dEQP-GLES3.functional.shaders.texture_functions.texturesize.* Change-Id: I1f453653a23b9d1802a374def40c9372ada8822a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1841275 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill f703443b 2019-09-21T14:10:35 Use Resource IDs in RefCountObject. This lets us use strongly typed IDs pretty much everywhere. Only one or two additional places still use GLuint IDs. Mostly for external queries and for Framebuffer Attachments. With some clever type reflection helpers lets us define a single template function for handling operator== and != for resource IDs. Refactor in preparation for more Capture/Replay work. Bug: angleproject:3611 Change-Id: I1c0c848e89eb8a4b769714d57686f816daf01634 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1815550 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com>
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2ab08edc 2019-08-12T16:20:21 Use TextureID in place of GLuint handles. Bug: angleproject:3611 Change-Id: Ie6156e8732b3ca4dc6c4439c059a5481a4dfd250 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1738753 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill da2b649c 2019-07-22T09:56:26 Texture: Make ImageIndex store layer counts. Only for 2D array textures. Bug: angleproject:3189 Change-Id: I9958ab60ffa464aa63f5cb321cbbe14b378f3647 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1709109 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Jamie Madill 44168468 2019-06-20T09:50:23 Vulkan: Sync image in TextureVk::syncState. We can use the DIRTY_BIT_IMPLEMENTATION internal dirty bit in the gl::Texture class to force calls to ContextVk::syncState. In syncState we can ensure we call ensureImageInitialized before we get to the ContextVk. This in turn means we can remove some of the command graph breaks from TextureVk. We need to make sure the dirty bits are propagated to EGL Image siblings with this method. This fixes a potential implementation issue with EGL images with the GL back-end. Also makes a state change test a little better by removing some of the VAO and program init calls before the draw. Improves perf on the texture change microbenchmark by 12.5%. Bug: angleproject:3539 Bug: angleproject:3117 Change-Id: I2b5481690801fa98f859a6c02e3f4b974590cd3d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1663839 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 857880e5 2019-05-27T13:39:15 GL: Add extensions to enable hardware video decode on Android. The Android SurfaceTexture API has to be initialized with a texture id which Chrome has to query from an ANGLE external texture. It also rebinds and sets the texture dimensions on calls to SurfaceTexture.updateTexImage so ANGLE must be notified about these changes so that state tracking and validation continue to function. BUG=967410 Change-Id: I92e9077f75835b088da3a8caffb3ff40e9ad0361 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1630293 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 124f78c2 2019-06-18T11:48:24 Remove gl::Context parameter from Observer functions. It was only used in exactly one instance in VertexArray. Instead we can cache a bool and avoid needing to pass it around. Will make signaling dirty easier in the Vulkan back-end. Bug: angleproject:3539 Change-Id: Ia570aec051a24a5280df49edc4345c54022b46ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1663838 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6722009e 2019-05-20T11:12:53 Vulkan: Handle dirty RTs with state messages. Prior to this CL we were handling dirty state change notifications by flushing the RT Images just prior to use or just after they were changed. This could lead to a few redundant checks in several places. It also meant we needed an owner pointer from the RT to the parent Image. This pointer would be null for Surfaces and Renderbuffers. This cleans up the image flushing logic to be handled by dirty bit notifications. When an app updates an attached Texture with TexSubImage or related calls it will send a notification to the Framebuffer. The Framebuffer then sets a dirty contents bit that is handled in the implementation. In Vulkan this means flushing the dirty bits. Requires adding a flag to the FramebufferImpl class to determine if we need to syncState before we checkStatus. Adding the option allows us to only call syncState for the GL back-end. Not calling syncState allows the robust resource init operation to happen *before* we syncState. Which in turn allows FramebuffeVk to initialize the VkImages in one go. Added new regression tests for Texture updates. This might not cover all cases. I found it was very hard to trigger some of the resource update staging in TextureVk. Bug: angleproject:3427 Change-Id: Idfa177436ba7fcb9d398f2b67922e085f778f82a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1601552 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 0a1eeb80 2019-05-13T13:53:18 Call robust resource init before object sync. This should let the Vulkan back-end only need to sync the Image data once before we use them. Bug: angleproject:3427 Change-Id: I8c6e8794e861f855bddbf651997351e8415e3479 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1602912 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill e4faae21 2019-05-10T08:27:00 Rename state change notification messages. This makes the style use CamelCase instead of ALL_CAPS. It also cleans up some of the naming. It also changes some uses of the messages in some of the objects to hopefully be more consistent. See the comments added to the enum SubjectMessage in Observer.h for more details. Bug: angleproject:3427 Change-Id: I6dff4f6d335ecf1a27e48df65743b1490bd3025a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1600411 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
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>
Jamie Madill e4458b7b 2019-04-08T16:26:50 Fix glCopyTexSubImage3D. Two bugs were present in our implementation. We were using the y offset for z in ensureSubImageInitialized. And for our D3D back-end we were potentially reading from the wrong image index. Bug: chromium:947342 Change-Id: If39671a911e08fcc641b9ba6f5910e3a2c16eb5d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1558671 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Geoff Lang 3702d8c9 2019-04-08T13:44:06 Propogate dirty bit signals from TextureImpl to Texture up to Context. If TextureImpl sets a local dirty bit and signals gl::Texture of it, the dirtyness is not propogated to context. This can result in draw calls with textures that are not synchronized BUG=949985 Change-Id: I9baf82c96598265a6a4850f1fd48e213b5e98ab5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1556699 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
James Darpinian 5fd08af4 2019-03-13T19:35:36 Sampler state overrides texture state if set The new validation added in http://crbug.com/809237 failed to consider that sampler object state overrides texture object state if a sampler object is bound. State caching makes this complicated to fix. Fixes WebGL conformance test incompatible-texture-type-for-sampler.html https://github.com/KhronosGroup/WebGL/pull/2823 Bug: 940080, 809237 Change-Id: I26b0fb35c5630c36248edae80f0298a0cb7e14b8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1522364 Commit-Queue: James Darpinian <jdarpinian@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
James Darpinian e4109f27 2018-12-13T16:25:53 WebGL: validate texture format matches sampler type WebGL requires that drawing produces INVALID_OPERATION if a texture's format doesn't match the sampler type it is bound to. This is a little confusing because samplers have two attributes that could be called "type": addressing mode (2D/3D/Cube), and component format (float/signed/unsigned/shadow). ANGLE already handled checking the addressing mode; this change adds checking for the component format. Fixes WebGL conformance test conformance2/uniforms/incompatible-texture-type-for-sampler.html Bug: chromium:809237 Change-Id: I52ebfecd92625e3ee10274cb5f548d7e53de72dd Reviewed-on: https://chromium-review.googlesource.com/c/1377611 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: James Darpinian <jdarpinian@chromium.org>
Jamie Madill 0c667215 2019-01-01T14:40:36 Pass ErrorSet to ContextImpl constructor. This removes the need for the setErrorSet method. Also update some egl::Error TODO bugs. Bug: angleproject:2491 Change-Id: I0aba07c4a53b579835a88c3dacae294f752e6b17 Reviewed-on: https://chromium-review.googlesource.com/c/1392393 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: 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>
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 e3e680ca 2018-12-03T17:49:08 Remove State::syncProgramTextures. Removes the concept of the program textures dirty object. Instead we use a set of dirty bits to represent dirty texture samples. We mark certain textures dirty and update state structures whenever there is a new Texture/Program/Sampler bound, or when Texture/Program/Sampler state changes. This is in preparation for making clearing the uncleared active textures into a dirty bit as well. Also includes new dirty bit handling for texture image units. These are a GLES 3.1 feature. Bug: angleproject:2966 Change-Id: Ibb8619dd2669bb39fdbcd75e3685be9a8aeeee91 Reviewed-on: https://chromium-review.googlesource.com/c/1346649 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 66f0d2c1 2018-11-30T15:25:36 Make Framebuffer attachments angle::Subjects. Now that there's storage change notifications in the GL front-end we no longer need to give the back-end access to the angle::Subject. The Texture object is a special case where it has mirrored dirty bits. To keep the gl::Texture class notified of when the Impl has dirty bits we make the TextureImpl class an angle::Subject that is observed by the gl::Texture class. This will enable further dirty bits improvements. Bug: angleproject:2966 Change-Id: Id22da0926f51ff4679e58af3e62903f4d7948915 Reviewed-on: https://chromium-review.googlesource.com/c/1347670 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e90d4ee9 2018-11-28T14:04:00 Pass Context to setLabel. This is useful for triggering a dirty state notification for Textures. It will lead to improvements for program and texture dirty bits. Bug: angleproject:2966 Change-Id: Iaba625da8a970a558f7d158bfa2f09c964f6761a Reviewed-on: https://chromium-review.googlesource.com/c/1347669 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 4f6592fa 2018-11-27T16:37:45 Remove gl::Error. Removes several TODOs. Only egl::Error remains. Also slightly decreases binary size. Bug: angleproject:2491 Change-Id: I3a9d1c22eb0884ca9e37362463fddd0083faf826 Reviewed-on: https://chromium-review.googlesource.com/c/1337462 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 526392dd 2018-11-16T09:35:14 Use angle::Result in front-end (Part 9) This removes the ANGLE_TRY_HANDLE macro. Also the internal uses of gl::ErrorStreamBase. There are remaining uses in the validation code. Further progress will be blocked on removing egl::Error and the use of gl::Error in the validation layer. Also reduces binary size by up to 4k. Bug: angleproject:2491 Change-Id: I3e0481f99738f9f24256c10e73f3efcce9826a35 Reviewed-on: https://chromium-review.googlesource.com/c/1334427 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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>
Till Rathmann b8543630 2018-10-02T19:46:14 Support GL_OES_texture_border_clamp Added support for GL_TEXTURE_BORDER_COLOR and GL_CLAMP_TO_BORDER in OpenGL/OpenGLES, Direct3D9 and Direct3D11 backends. For integer textures in OpenGLES3 contexts these additional entry points are available now: void glTexParameterIivOES(enum target, enum pname, const int *params); void glTexParameterIuivOES(enum target, enum pname, const uint *params); void glGetTexParameterIivOES(enum target, enum pname, int *params); void glGetTexParameterIuivOES(enum target, enum pname, uint *params); void glSamplerParameterIivOES(uint sampler, enum pname, const int *params); void glSamplerParameterIuivOES(uint sampler, enum pname, const uint *params); void glGetSamplerParameterIivOES(uint sampler, enum pname, int *params); void glGetSamplerParameterIuivOES(uint sampler, enum pname, uint *params); BUG=angleproject:2890 TEST=angle_end2end_tests.TextureBorderClamp* Change-Id: Iee3eeb399d8d7851b3b30694ad8f21a2111f5828 Reviewed-on: https://chromium-review.googlesource.com/c/1257824 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 79b91407 2018-10-04T15:11:30 Add an extension for querying esimated GPU memory size of resources. BUG=892288 Change-Id: I56fc3ab00c06d711e1a21eb1ad4b2224126730dc Reviewed-on: https://chromium-review.googlesource.com/c/1262021 Reviewed-by: Yuly Novikov <ynovikov@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jamie Madill 1c7f08c3 2018-10-10T16:13:02 Inline RefCountObject::release. Also don't return errors from the object release methods. Not returning errors reduces the amount of code generated. Also we shouldn't be exiting early from destructor type functions. Increases object binding performance. Bug: angleproject:2877 Change-Id: Ieb8120d885b946915e355419825e1f52f31d7b49 Reviewed-on: https://chromium-review.googlesource.com/c/1270218 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: 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>
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 f668a4b5 2018-09-23T17:01:20 Skip Texture::syncState when no dirty bits. We sometimes generate local dirty bits in TextureGL. To make sure the local dirty bits don't get skipped we use a Subject/Observer pattern between the TextureGL and gl::Texture. This allows us to skip syncState in the hot path. Also inlines a couple of other texture functions. And fixes a stray header in EGLBlobCacheTest. Bug: angleproject:2763 Change-Id: Ie1d8a5865deaf2a563a358c31ae28bef6b2458b1 Reviewed-on: https://chromium-review.googlesource.com/1228374 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 8a561914 2018-09-12T11:03:06 Pack SamplerState into small struct. Is much faster for completeness cache checks in syncProgramTextures. Bug: angleproject:2763 Change-Id: Iffdacbb8a4f6640caa5051643c379a7b4c3311b6 Reviewed-on: https://chromium-review.googlesource.com/1171508 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 097d3c0c 2018-09-12T11:03:05 Make SamplerState a contained class. This will more easily allow us to use a cached completeness comparison value. The cached value only gets updated on certain setters. Bug: angleproject:2763 Change-Id: Ib80db8517560617087ae8360f7af69d6c2392b76 Reviewed-on: https://chromium-review.googlesource.com/1171507 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@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 dff32a0d 2018-08-28T14:35:50 Support multisample arrays in shader programs The added tests check that using textureSize() and texelFetch() on textures with a fixed point format return expected results. texelFetch is also covered for integer format textures. dEQP GLES 3.1 tests also cover a variety of multisampled array texture formats. BUG=angleproject:2775 TEST=angle_end2end_tests, angle_deqp_gles31_tests Change-Id: I99b422e24b39e3563ed72f0fb85c9c1907df807d Reviewed-on: https://chromium-review.googlesource.com/1196521 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Yuly Novikov 2eb54074 2018-08-22T16:41:26 Fix EGLImage pixel format validation This fixes the scenario when EGLImage source and target have different types. For example, a texture is created with unsigned format using glTexImage2D, it is used as a source of EGLImage with eglCreateImageKHR, and then the EGLImage is used to create a renderbuffer target with glEGLImageTargetRenderbufferStorageOES. OES_EGL_image doesn't specify what should happen in this case, but GL implementations (Nexus 5X) seem to allow using this renderbuffer in glFramebufferRenderbuffer and the resulting framebuffer is complete. Thus, in this case, instead of checking whether the renderbuffer format can be used in glFramebufferRenderbuffer, we need to check whether the original texture can be used in glFramebufferTexture2D. Similarly in reverse direction. Also, for the case of source renderbuffer and target texture, presume that glEGLImageTargetTexture2DOES will succeed regardless of renderbuffer format. 1. Add isRenderable and isTexturable checks to egl::Image class, and perform different checks depending on source type. 2. Add isRenderable check to FramebufferAttachment and delegate EGLImage attachments check to egl::Image. 3. Use these checks in validation of EGLImageTargetTexture2D, EGLImageTargetRenderbufferStorage and when checking attachment completeness Bug: angleproject:2567 Change-Id: I8e9f4a2930a4075a4d8464f62582c6825270187e Reviewed-on: https://chromium-review.googlesource.com/1192585 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 0c5a9e22 2018-08-27T14:36:23 Implement TexStorage3DMultisample on the GL backend BUG=angleproject:2775 TEST=angle_end2end_tests Change-Id: Ic980d86cd787bcf29f622e68b0c38b0eb6ca5688 Reviewed-on: https://chromium-review.googlesource.com/1190182 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Geoff Lang 9d05b930 2018-07-27T15:47:18 Don't store a ref from an EGL image to its source. ImageSiblings no longer inherit from RefCountObeject because they may be EGL or GL objects and should handle their own deletion. This can cause GL resources to outlive their contexts. When the GL resource is deleted, simply orphan the image. BUG=angleproject:2668 Change-Id: I4a5c12bbe6e725f946209f9b48345a4097c9c91c Reviewed-on: https://chromium-review.googlesource.com/1153601 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill e62489f3 2018-07-16T19:12:33 Surface: Use ref count for bindTexImage. This frees up one more use of ProxyContext. It will also keep the bound surface alive until it is unbound from a Texture. Two usages of the proxy context remains. * DisplayD3D::restoreLostDevice. * Display::destroyImage. Bug: angleproject:2714 Change-Id: Ied72c6ebe060d7fc1743b3313e162d540fcbfe02 Reviewed-on: https://chromium-review.googlesource.com/1137878 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Lingfeng Yang f97641c1 2018-06-21T19:22:45 GLES1: Texture parameters Note: minimum buffer size is now checked for texture parameters in GLES2. - Mipmap generation hint - Crop rect - Update test expectations BUG=angleproject:2306 Change-Id: Ib459b8191111732a1326b44f2226b72ca297325a Reviewed-on: https://chromium-review.googlesource.com/1111575 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Lingfeng Yang <lfy@google.com>
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>
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>
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 26084d0a 2018-04-09T13:44:04 Vulkan: Create TextureVk's Image lazily. This defers the actual Image initialization until the Image is used as either a Framebuffer Attachment or OpenGL Texture object. This will allow us to construct an Image from multiple sub resources, like when we're initializing a mip chain, or a cube map texture. Also adds a helper "hasDepthOrStencilBits" function to angle::Format. Bug: angleproject:2318 Change-Id: Ife861560216581a90fc6da32a583f69886c7daea Reviewed-on: https://chromium-review.googlesource.com/985202 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 93edca16 2018-03-30T10:43:18 Vulkan: Add an Image helper class. This class wraps a lot of the common functionality of a vk::Image. It keeps an associated DeviceMemory and ImageView. Eventually we can probably merge this class with RenderTargetVk. We can also use it to implement the same functionality between Renderbuffer and Texture and abstract different storage types, like 2D and Cube. Bug: angleproject:2318 Change-Id: I39239f47b483cfb96290a15b06edd264f7f4bb34 Reviewed-on: https://chromium-review.googlesource.com/980772 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d7518622 2018-03-27T09:44:31 Buffer11: Refactor Subject/Observer pattern. Instead of having a direct/static observer distinction, add two messages for 'Contents Changed' and 'Storage Changed'. This makes Buffer11 itself the subject with two different message handling cases in the onSubjectStateChange methods. Bug: angleproject:2389 Change-Id: I645cd4b7cc7ce51cb7f48a01c7fc72939cbe89fe Reviewed-on: https://chromium-review.googlesource.com/957940 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jiawei Shao 385b3e03 2018-03-21T09:43:28 Use packed enums on shader types in ANGLE renderer This patch uses a packed internal enum ShaderType everywhere we need a shader type instead of the GLenum value of the shader type. This patch also uses program::getAttachedShader(type) everywhere we need to get gl::Shader from a program in ANGLE. BUG=angleproject:2169 Change-Id: I28a7fa1cfe35622c57a486932911110688eaadec Reviewed-on: https://chromium-review.googlesource.com/972844 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 74ba598f 2018-03-13T11:22:16 Fix cubemap robust resource init for GenerateMipmap The code in gl::Texture would only check whether the first cube map face is correctly initialized but not for the others. BUG=angleproject:2169 Change-Id: Ib565579a4570e731da785b5c74c8d1a6511ebcd4 Reviewed-on: https://chromium-review.googlesource.com/960571 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@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>
Lingfeng Yang a5d583e9 2018-02-08T10:59:05 GLES1: state: Add crop rect / generate mipmap texparameters GLES1 has at least two places where all texture objects can carry more state: - Crop rectangle, used with glDrawTex - Generate mipmap parameter, which lets the user auto-generate mipmaps for textures from a texture parameter This CL adds them to the Texture / TextureState classes. BUG=angleproject:2306 Change-Id: Ia43882d36f166b49a09434e77f8c288478e2a454 Reviewed-on: https://chromium-review.googlesource.com/909579 Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Lingfeng Yang <lfy@google.com>
Corentin Wallez f0e89be6 2017-11-08T14:00:32 Use packed enums for the texture types and targets, part 1 In OpenGL there are two enum "sets" used by the API that are very similar: texture types (or bind point) and texture targets. They only differ in that texture types have GL_TEXTURE_CUBEMAP and target have GL_TEXTURE_CUBEMAP_[POSITIVE|NEGATIVE]_[X|Y|Z]. This is a problem because in ANGLE we use GLenum to pass around both types of data, making it difficult to know which of type and target a variable is. In addition these enums are placed somewhat randomly in the space of OpenGL enums, making it slow to have a mapping from texture types to some data. Such a mapping is in hot-code with gl::State::mTextures. This commit stack makes the texture types and target enums be translated to internal packed enums right at the OpenGL entry point and used throughout ANGLE to have type safety and performance gains. This is the first of two commit which does the refactor for all of the validation and stops inside gl::Context. This was the best place to split patches without having many conversions from packed enums to GL enums. BUG=angleproject:2169 Change-Id: Ib43da7e71c253bd9fe210fb0ec0de61bc286e6d3 Reviewed-on: https://chromium-review.googlesource.com/758835 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Jamie Madill d444255a 2018-02-27T22:03:47 Refactor signal utils into Observer pattern. These types were over-generalized. All use cases featured arrays of resources attached to single parent resources. The channel ID is sufficient to identify the child resource in the parent, and having variadic template arguments wasn't necessary. Futhermore we can rename these types to use the common Observer pattern. This should make them more readable to new developers. Also update some classes to inherit from Subject instead of having a member Subject. This cleans up the code in a few places. This should lead to a simpler refactor to allow dependent dirty bits notifications in the Vulkan back-end. In the following patch the signal_utils files will be renamed. They are not renamed in this patch to ensure git history is preserved. Bug: angleproject:2372 Change-Id: I17a3f2c8d92afd4bb3cba2d378c3a2e8a6d7fb11 Reviewed-on: https://chromium-review.googlesource.com/936690 Reviewed-by: Luc Ferron <lucferron@chromium.org> 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>
Yunchao He bacaa714 2018-01-30T14:01:39 ES31: support stencil texture via DEPTH_STENCIL_TEXTURE_MODE. BUG=angleproject:2373 Change-Id: I5edd9db6ef6101b0ad75f71fdcdfbb1261100583 Reviewed-on: https://chromium-review.googlesource.com/936421 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 9db70de8 2017-07-04T18:28:42 Reland: Implement EGL_ANGLE_iosurface_client_buffer Includes a fix for creating pbuffers with <buftype> EGL_D3D_TEXTURE with EGL_WIDTH and EGL_HEIGHT attributes. BUG=angleproject:1649 TBR=geofflang@chromium.org Change-Id: Id2974b8fab02c3218febfac708b9b034e65cbc53 Reviewed-on: https://chromium-review.googlesource.com/823248 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez 7f5c3eb7 2017-12-12T14:54:17 Revert "Implement EGL_ANGLE_iosurface_client_buffer" This reverts commit c7abc08034a30a41748eefc5b628a76d4e2daa8a. Reason for revert: Might have broken Chromium Win10 composition due to validation changes. Original change's description: > Implement EGL_ANGLE_iosurface_client_buffer > > BUG=angleproject:1649 > > Change-Id: I1e72c31d7c9497ad14039a8d3fb97317ab193cb2 > Reviewed-on: https://chromium-review.googlesource.com/559107 > Reviewed-by: Corentin Wallez <cwallez@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Corentin Wallez <cwallez@chromium.org> TBR=geofflang@chromium.org,cwallez@chromium.org Change-Id: I605b710b6d76056d6276b09822cd6ddca277bfd0 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:1649 Reviewed-on: https://chromium-review.googlesource.com/822172 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez c7abc080 2017-07-04T18:28:42 Implement EGL_ANGLE_iosurface_client_buffer BUG=angleproject:1649 Change-Id: I1e72c31d7c9497ad14039a8d3fb97317ab193cb2 Reviewed-on: https://chromium-review.googlesource.com/559107 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Geoff Lang e51ba63b 2017-11-21T11:45:25 Optimize Texture initialization tracking with extra caching. In both Texture and State, track when all images/textures are initailized so that State::clearUnclearedActiveTextures can early-exit. Improves performance on the WebGL Aquarium by 26% (23->29 FPS) with 30000 fish. BUG=angleproject:2188 Change-Id: Ie2860a81d7be19ee87262325d8cf27bde43f80b8 Reviewed-on: https://chromium-review.googlesource.com/782339 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill acf2f3ad 2017-11-21T19:22:44 Apply Chromium style fixes. This addresses several minor code quality issues that are validated in Chromium, but not yet applied to ANGLE: * constructors and destructors must be defined out-of-line * auto is not allowed for simple pointer types * use override everywhere instead of virtual * virtual functions must also be defined out-of-line Slightly reduces binary size for me (~2k on Win, 150k on Linux). Bug: angleproject:1569 Change-Id: I073ca3365188caf5f29fb28d9eb207903c1843e6 Reviewed-on: https://chromium-review.googlesource.com/779959 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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>
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 cc4ce4a2 2017-10-23T16:40:12 Don't initialize textures on SubImage calls if the whole image will be filled. BUG=angleproject:2107 BUG=angleproject:2196 Change-Id: I3e7e78bfc64f1683921af2e48fe20c7be0b85af3 Reviewed-on: https://chromium-review.googlesource.com/734228 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
JiangYizhou 0f2aa31d 2017-07-10T11:28:37 ES31: Fix bug on incomplete texture validation of internalformat and filterable Multisampled texture with unfilterable internalformat and default filter state shouldn't be justified as incomplete texture in angle. However, the default filter state is set to LINEAR and internalformat like R8I or R8UI is not filterable, which lead to texture incomplete. In es 3.1 spec 8.16, 'The effective internal format specified for the texture arrays is a sized internal color format that is not texture - filterable(see table 8.13), and either the magnification filter is not NEAREST or the minification filter is neither NEAREST nor NEAREST_MIPMAP_NEAREST'. As to Table 20.11, The default value of minFilter is NEAREST_MIPMAP_LINEAR, magFilter is LINEAR. Because in 11.1.3.3,'Multisample textures are not filtered when samples are fetched, and filter state is ignored.' So we ignore filtering for multismaple texture completeness. BUG=angleproject:1590 TEST=dEQP-GLES31.functional.shaders.builtin_functions.texture_size.samples_*_texture_2d TEST=dEQP-GLES31.functional.shaders.builtin_functions.texture_size.samples_*_texture_int_2d TEST=dEQP-GLES31.functional.shaders.builtin_functions.texture_size.samples_*_texture_uint_2d TEST=dEQP-GLES31.functional.texture.multisample.samples_*.use_texture_color_2d TEST=dEQP-GLES31.functional.texture.multisample.samples_*.use_texture_int_2d TEST=dEQP-GLES31.functional.texture.multisample.samples_*.use_texture_uint_2d TEST=dEQP-GLES31.functional.texture.multisample.samples_*.use_texture_depth_2d Change-Id: I0533bd028e0bbb66d9f731a2395f6c8ae7db8938 Reviewed-on: https://chromium-review.googlesource.com/564843 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Martin Radev 7e2c0d37 2017-09-15T14:25:42 Fix cubemap completeness check The patch updates the cubemap completeness check to use the base level instead of always level 0. Without this change the cubemap faces at level 0 would have to be created in order to specify another base level through TexParameteri. BUG=angleproject:2153 TEST=angle_end2end_tests Change-Id: Iee1fdc6adf0e69d797821a2ce2f2b2b85dfcdfc1 Reviewed-on: https://chromium-review.googlesource.com/668439 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@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 06ef36b9 2017-09-09T23:32:46 Add top-level state sync for Samplers. This also reformats the Sampler class to use a shared state struct with the implementation. It removes the call to sync the sampler state from the StateManagerGL::setGenericShaderState method, since it should all be handled at the front-end now. Also rename 'syncImplState' to 'syncState' methods. BUG=angleproject:1387 Change-Id: I5f0219b719aee99aaaa486ec188b2af0c9128e6a Reviewed-on: https://chromium-review.googlesource.com/648054 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 81c2e253 2017-09-09T23:32:46 Add top-level dirty bits for texture and samplers. These will have to be fleshed out in the back-ends. Also currently uses a single bit for all the bindings, and we can extend this to more fine-grained updates in the future. This patch implements top-level updates for texture completeness. Sampler completeness caches are removed from the Texture class, and replaced by a cache in the gl::State class. The State class also keeps a channel binding to the bound textures so it can be notified when textures might change from complete <-> incomplete. In future CLs we skip updating back-ends if texture state doesn't change. BUG=angleproject:1387 Change-Id: If580b4851303c86f3240e62891f5f6047eefb6a2 Reviewed-on: https://chromium-review.googlesource.com/648053 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 13c0dd46 2017-07-04T18:27:01 Add texture rectangle extension. This is needed to support binding IOSurfaces to textures on OSX. This commit adds support in the API and tests, but didn't need to implement compiler changes as it already supported ARB_texture_rectangle. Implementation of CHROMIUM_opy_texture for rectangle texture and the spec are left for follow-up commits. Change-Id: I45c66be763a9d3f6f619640f9f95f39b05c70867 Reviewed-on: https://chromium-review.googlesource.com/559106 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 96a483bc 2017-06-27T16:49:21 Add a ResourceMap class for faster GL resource maps. This gives a very fast query time for handles that are within a fixed range. For WebGL, where we don't allow create-on-bind, this will be 100% of the time, unless we create a very large number of resources. It is implemented as a two-tier map - the first uses a flat array to index into a handle buffer. The second tier uses a map for out-of- range values. BUG=angleproject:1458 Change-Id: I421bb3725cf523918cdfdbfaab035ad0dd3bf82d Reviewed-on: https://chromium-review.googlesource.com/544684 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Geoff Lang 579d8c7d 2017-06-21T14:56:55 Only use the last context for the texture completeness cache. The frequency of contexts switches is very slow compared to draw calls. Instead of doing a map lookup, only store the completeness cache for the last context used with the texture. BUG=angleproject:2078 Change-Id: Ia24c891e1b5781b61fd463ce70e90d4b394c6f8a Reviewed-on: https://chromium-review.googlesource.com/542946 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Geoff Lang <geofflang@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>
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>
Geoff Lang 857c09db 2017-05-16T15:55:04 Add missing completeness checks for texture attachments. Texture attachments need to validate that the attached mip level is within the [baseLevel,maxLevel] range and that the texture is complete if the attached mip level is not the base level. BUG=722684 Change-Id: I859766506b295638572b75a0e2e9fed168be047a Reviewed-on: https://chromium-review.googlesource.com/506928 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Geoff Lang <geofflang@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>
Geoff Lang ca27139e 2017-04-05T12:30:00 Key the format tables on internal format and type. Keying the format tables on internal format alone is not enough to fully validate the unsized formats which require additional type information. This CL has no functional changes, it just splits the tables and updates the calls to GetInternalFormat info to provide type information when the format is not sized. BUG=angleproject:1523 BUG=angleproject:1958 BUG=angleproject:1228 Change-Id: I37e5201e7f54fa8eca01b8a6e64b11a6b94484e7 Reviewed-on: https://chromium-review.googlesource.com/468449 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>