src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp


Log

Author Commit Date CI Message
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 215d00b1 2021-08-03T23:34:02 D3D11: Add validation for storages size in updateBufferStorage The source/dest BufferStorage used by the updateBufferStorage may have a raw buffer ptr value of null. Add size validation to prevent null crashes. Bug: angleproject:6235 Change-Id: I57ed1ae0e558bd2f61273c64ed067958a1603425 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3069000 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis d7276586 2020-08-26T11:27:13 Vulkan:Use roundUpPow2 where possible Utility function roundUpPow2 is more optimal than roundUp so use it. Bug: b/166462979 Change-Id: I616fa9f487b818137b1b496d93e292c3bd1f428c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2377119 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com>
Xinghua Cao c68dfaf3 2020-04-01T16:36:25 Avoid GPU-GPU copy for StructuredBuffer If uniform block is translated to StructureBuffer on D3D backend, must do a GPU-GPU copy when updating uniform buffer. If buffer's latest usage is StructuredBuffer, directly upload to structured buffer. Bug: angleproject:3682 Change-Id: I7303866d08705a43238732e5f5ae4858f0a33d63 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2131871 Commit-Queue: Xinghua Cao <xinghua.cao@intel.com> Reviewed-by: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Jamie Madill cc414d57 2020-01-28T12:58:30 D3D11: Fix uninitialized BufferEx SRV. This was causing an unrelated error that was complicating diagnosing test failures with the command graph refactor. Bug: angleproject:4029 Change-Id: I31df76e7ea1c7fb731b49e97ac8a527a165efd48 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2024331 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Xinghua Cao 0af8b596 2019-09-03T16:24:45 D3D11: Translate uniform blocks to StructuredBuffer when necessary fxc exhibits slow compile performance with dynamic cbuffer indexing. So when a uniform block contains only one large array member, which is an array of structures, translate this uniform block to a StructuredBuffer instead. Bug: angleproject:3682 TEST=angle_end2end_tests.UniformBufferTest.* Change-Id: Ife80dba8aae65b761737e095895e00a570230f88 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1782046 Commit-Queue: Xinghua Cao <xinghua.cao@intel.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Xinyi He 4c7db77e 2019-10-31T15:42:31 Vulkan: Set limitation on maxComputeWorkGroupCount According to Table 20.45 and Chapter 17 in the ES 3.1 spec, MAX_COMPUTE_WORK_GROUP_COUNT is get as a GLint by using GetIntegeri_v. However, it is an unsigned integer in the Vulkan. It needs to set limitation on maxComputeWorkGroupCount[] during translating. 1. Change the data type to GLint stored in Caps. 2. Ensure that the limitation is set during initialization. 3. Add workaround for angleproject:4120 Bug: angleproject:4066 Change-Id: I1659ba1d560e30b9599cace0feeab8a18890c3ff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1890586 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jonah Ryan-Davis a787b618 2019-10-03T12:59:12 D3D11: Buffers larger than MAX_UNIFORM_BLOCK_SIZE We had clamped all UBOs to MAX_UNIFORM_BLOCK_SIZE, when D3D11 allows the underlying buffer to be larger as long as each UBO binding is still within the max. Bug: 906683 Bug: angleproject:3388 Change-Id: Id5536302dd73a41c0882fddd77e94f4503f00730 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1837356 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
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>
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>
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>
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>
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>
Qin Jiajia 49c9dfe3 2018-12-29T16:48:20 Fix the SSBO sync bug in two dispatch calls We should make sure that the raw buffer is the latest buffer before each dispatch call since the dispatch itself can update the raw buffer content. Bug: angleproject:3037 Change-Id: I75dddfd3e57b3c9cbcc58c02ed057c66cc8e1785 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1392379 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
Enrico Galli 8922ac23 2018-12-14T13:44:29 ES31: Enable glBindBufferRange on SSBOs in the D3D renderer This patch enables binding a subset of a buffer with glBindBufferRange on the D3D renderer. Bug: angleproject:2990 Test: angle_end2end_tests Change-Id: Ib15b6257891191e28801f52c539b8b2daa80fa68 Reviewed-on: https://chromium-review.googlesource.com/c/1409880 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d51fbe34 2019-01-25T15:03:39 Fold buffer access validation into extensions. We only need to perform vertex array buffer validation if the WebGL compatiblity extension is enabled and robust access is not available. Although sometimes the range checks are useful for determining undefined behaviour they are not required by the OpenGL spec. They also slow down state updates significantly. This migrates the OOR tests into specific WebGL tests. It also requires a change to a Chromium test on the passthrough decoder. Improves perf by about 10% in the Vulkan VBO state change test. Also fixes some robust resource access cases for D3D11. Bug: angleproject:3000 Change-Id: Ice37f38f01c2f27bf32ed55657a30e69d8508335 Reviewed-on: https://chromium-review.googlesource.com/c/1390362 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Bryan Bernhart 48bbc53e 2018-12-03T16:17:00 ES31: Fix for reading back initialized SSBO buffers in D3D11 If a SSBO is initialized with data, a staging buffer was created. When the data was read back, it was read from the staging buffer instead of the GPU. This patch fixes that by making the UAV buffer the latest buffer. Bug: angleproject:2990 Test: angle_end2end_tests Change-Id: I43c8c85144c74cc9b317577b7c834e3f7e347f72 Reviewed-on: https://chromium-review.googlesource.com/c/1359712 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com> Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7c985f5c 2018-11-29T18:16:17 Make angle::Result an enum. This moves away from a class type to a value type. This should improve performance when using angle::Result as a return value. Previously the generated code would return a pointer instead of a value. Improves performance in the most targeted microbenchmark by 10%. In more realistic scanarios it will have a smaller improvement. Also simplifies the class implementation and usage. Includes some unrelated code generation changes. Bug: angleproject:2491 Change-Id: Ifcf86870bf1c00a2f73c39ea6e4f05ca705050aa Reviewed-on: https://chromium-review.googlesource.com/c/1356139 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8dc27f99 2018-11-29T11:45:44 Use packed enum for DrawElementsType. The packing and unpacking take a few extra instructions. But it completely obviates the need for any switches in the validation code. Speed is slightly faster or the similar depending on the back-end. Also add gl_angle_ext.xml to GL entry point generator inputs. This was missing and would cause the code generation to miss certain changes. Bug: angleproject:2985 Change-Id: I1ea41a71db71135000166ead8305ec42d22ff7b3 Reviewed-on: https://chromium-review.googlesource.com/c/1351729 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@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 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 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 ae108bd1 2018-10-18T15:00:38 Use angle::Result in front-end (Part 5) Refactors gl::Buffer and implementation. Bug: angleproject:2491 Change-Id: Ic6860dac2faf33067965e7117ea8e98dc6a8dc7a Reviewed-on: https://chromium-review.googlesource.com/c/1283310 Reviewed-by: Jamie Madill <jmadill@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>
Qin Jiajia a602f906 2018-09-11T14:40:24 ES31: Support shader storage buffer in D3D-API side. Bug: angleproject:1951 Test: angle_end2end_tests Change-Id: I0d8a4f8cf00fc7fd2d85315138e2b7457fd0b90c Reviewed-on: https://chromium-review.googlesource.com/1242846 Commit-Queue: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 7620c739 2018-09-24T11:45:55 Prevent crash in robust access mode when buffer has no data This fixes a crash appearing in robust access mode when a buffer has no data by stopping the draw call. A better fix would be to ensure that fetches from an empty buffer result in zero, but this fix requires a lot more effort. This is not necessarily warranted since the client is either way doing something incorrect in this case. BUG=angleproject:2840 TEST=angle_end2end_tests Change-Id: Ie4ef5b1ca7c0091d7d26f91678d6e4768cc0c650 Reviewed-on: https://chromium-review.googlesource.com/1238622 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@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 7a5814e2 2018-07-27T08:12:50 D3D11: Use angle::Result error pattern. 3/3 This completes the initial refactor for the D3D11 back-end. Bug: angleproject:2738 Change-Id: I6bc59d6a1a724b3c64d6cd904e6748c2acf8f67d Reviewed-on: https://chromium-review.googlesource.com/1151452 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 306b6c16 2018-07-27T08:12:49 D3D11: Use angle::Result error pattern. 1/3 This CL improves performance on the draw call microbenchmark by 10% when no-oping driver calls. Bug: angleproject:2738 Change-Id: I4f5c11db90d9056ce4557b2a4432bc55b42b5bba Reviewed-on: https://chromium-review.googlesource.com/1150093 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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 02b5328b 2018-07-24T11:06:47 D3D: Make computeOffset not use ErrorOrResult. Unblocks further error refactoring. Also cleans up some checked math logic. Bug: angleproject:2738 Change-Id: I0c9fba9bb908dfc8424921d0db9871241b86e7de Reviewed-on: https://chromium-review.googlesource.com/1142954 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 20d6d48c 2018-07-24T11:06:47 D3D11: Make createStagingTexture return Error. This removes the use of the ErrorOrResult pattern in Renderer11. Bug: angleproject:2738 Change-Id: Icc046ddd86394df56ca1acd10b1804fd6afa8ad0 Reviewed-on: https://chromium-review.googlesource.com/1142953 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill df0e48fe 2018-07-24T11:06:46 Buffer11: Don't use ErrorOrResult. This pattern isn't available when using angle::Result instead of gl::Error. Refactor the Buffer11 class to use gl::Error instead. This unblocks further return value refactoring for perf. Bug: angleproject:2738 Change-Id: I739044ae318c6b1fc40756a4f1fcadf609276c1a Reviewed-on: https://chromium-review.googlesource.com/1142952 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 0946393d 2018-04-04T05:26:59 Move Buffer Subject/Observer to front end. This makes BufferImpl into an Observer Subject. It also refactors the Vertex Array updates for the D3D11 backend use more of a dirty bit coding style. This change makes it so Buffer contents changes trigger front-end dirty bits from the back-end, which may be undesirable. Bug: angleproject:2389 Change-Id: Iac8ce1171284a86851c18cd1373ddf24fcefe40b Reviewed-on: https://chromium-review.googlesource.com/979812 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 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>
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>
Bryan Bernhart (Intel Americas Inc) ca71c75d 2017-12-15T13:39:57 Fix error handling of ID3D11DeviceContext::Map Refactors error handling should map() fail to avoid crashing during a device error event. BUG=angleproject:2284 Change-Id: Ib1eb676860fa5c3a81e523f49aab82b7e6700f73 Reviewed-on: https://chromium-review.googlesource.com/826485 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8e4bb4b1 2017-11-22T18:59:51 D3D11: Cache element array buffer updates. This attempts to reduce the amount of redundant validation done between indexed draw calls. It keeps the cached info in the VertexArray11 class. It also includes a fix to a missing direct buffer invalidation in CopyBufferSubData which was turning up with the new caching. Reduces overhead in the D3D11 indexed rendering perf test such that it leads to an increased score of about 20%. BUG=angleproject:2229 Change-Id: I63121bea19a9c8198e1925ed6a1460838e8f8955 Reviewed-on: https://chromium-review.googlesource.com/765262 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill acf2f3ad 2017-11-21T19:22:44 Apply Chromium style fixes. This addresses several minor code quality issues that are validated in Chromium, but not yet applied to ANGLE: * constructors and destructors must be defined out-of-line * auto is not allowed for simple pointer types * use override everywhere instead of virtual * virtual functions must also be defined out-of-line Slightly reduces binary size for me (~2k on Win, 150k on Linux). Bug: angleproject:1569 Change-Id: I073ca3365188caf5f29fb28d9eb207903c1843e6 Reviewed-on: https://chromium-review.googlesource.com/779959 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 1eda27a6 2017-11-16T13:06:38 Buffer11: Allow CopySubData from uninitialized. This fixes a very odd use case where an app would try to copy from an uninitialized buffer. I didn't search the spec too closely, but it's likely a valid operation that produces undefined buffer contents. Previously to this change we would genearte an OOM error. Also includes an unrelated fix to ensure the latest buffer storage is never nullptr when we have any data. Bug: angleproject:1155 Change-Id: I4292bd302cc2b84d125a7d3e8d28e4d2b0210e53 Reviewed-on: https://chromium-review.googlesource.com/774991 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill fea1e754 2017-11-14T16:42:37 Buffer11: Cleanup onCopyStorage. BUG=angleproject:1155 Change-Id: I7bc5c196d10ae040487ecd1137d9b18c3000775a Reviewed-on: https://chromium-review.googlesource.com/769730 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 36f34243 2017-11-13T21:41:42 Buffer11: Cache latest buffer storage. This saves needing to scan the list of buffers every time we query the latest buffer storage. Should slightly improve speed. BUG=angleproject:1155 Change-Id: I6be8457aca1ee5aa871090241e6f67ae16b094a5 Reviewed-on: https://chromium-review.googlesource.com/761242 Reviewed-by: Jamie Madill <jmadill@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>
Corentin Wallez 2e568cfb 2017-09-18T17:05:22 Add generator for packed GL enums. For testing this also converts two unimportant GLenums, gl::BufferUsage and gl::CullModeFace. BUG=angleproject:2169 Change-Id: If1e86a97d0fed3fd567303aca6506ec579503076 Reviewed-on: https://chromium-review.googlesource.com/688000 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@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 da7185fb 2017-09-12T15:23:07 D3D11: Consolidate SRV and Sampler application. This adds an internal and external version of the setShaderResource method. The external version sets the state as dirty. BUG=angleproject:2052 Change-Id: I6d2d47490c0af89ff5592d4e9c53eb69f8a3264d Reviewed-on: https://chromium-review.googlesource.com/659397 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d63961d0 2017-09-12T15:22:57 D3D11: Move Constant Buffer state to StateManager11. Also moves the logic of the constant buffer sync to StateManager11. Removes a few of the remaining virtual methods in RendererD3D. BUG=angleproject:1390 BUG=angleproject:2052 Change-Id: Ia6c1c3949fff84323331510d80bbfb6e1665d294 Reviewed-on: https://chromium-review.googlesource.com/659226 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill d28758de 2017-08-30T15:32:48 D3D11: Re-enable updateVertexBuffer dirty bits. In some cases, when the app would call glBufferSubData to do a small data update in an existing vertex buffer, the sync code would not flush out the data to the native D3D11 buffer from the temporary staging buffer. Fix this problem by notifying the VertexArray11 class when buffer data is updated. Note that in the future we can improve this by using a different update notification for when the buffer data changes and when the underlying storage changes. For now take a very broad approach. BUG=angleproject:1156 Change-Id: I2e0fabc97c1f1d5a14d609247e61c602e9a5a85f Reviewed-on: https://chromium-review.googlesource.com/644208 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
jchen10 56375021 2017-06-21T11:38:04 D3D11: Fix Buffer11 for GPU-to-CPU storage copy. When copying from a non-mappable NativeStorage to a system memory based storage, a staging buffer storage should be used. Currently this is only done for PackStorage. This covers the missed SystemMemoryStorage and EmulatedIndexedStorage. Also it adds a triggering test case to expose the bug. BUG=angleproject:2076 Change-Id: I278a0eef85751e966c1c48ddd71010092a14a3f7 Reviewed-on: https://chromium-review.googlesource.com/542595 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 4928b7ca 2017-06-20T12:57:39 Proliferate gl::Context everywhere. This gives the D3D back-end access to the GL state almost anywhere. This uses the onDestroy hook for Textures to push errors up from destructors, although they still don't quite make it to the Context. There are places, such as in EGL object (Context/Surface) destruction, where we end up calling through to GL implementation internals without having access to a gl::Context. We handle this via a proxy Context to a Display, basically a null context, that has access to impl-side state like the Renderer pointer if necessary. It does not have access to the normal GL state. Also Pass gl::Context to RefCountObject::release(). Since we're using destroy() methods now, we should not ever call the destructor directly. BUG=angleproject:1156 Change-Id: Ie4c32ad6bf6caaff0289901f30b5c6bafa2ce259 Reviewed-on: https://chromium-review.googlesource.com/529707 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Yuly Novikov c4d18aac 2017-03-09T18:45:02 Use ErrorStream everywhere Eliminates one more usage of FormatString and its static initializer. Add more ErrorStream types and replace gl::Error and egl::Error with them. BUG=angleproject:1644 Change-Id: Ib498d0ae4b81a332ec71aed7cf709993b154e6bb Reviewed-on: https://chromium-review.googlesource.com/505429 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill c564c070 2017-06-01T12:45:42 Pass gl::Context to impl methods instead of ContextImpl. In some cases we might have to call back into the GL layer, passing the Context, and if we just have a ContextImpl pointer this isn't possible. It also removes the need for SafeGetImpl. BUG=angleproject:2044 Change-Id: I6363e84b25648c992c25779d4c43f795aa2866d6 Reviewed-on: https://chromium-review.googlesource.com/516835 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill bdc1e2a2 2017-05-24T14:40:27 D3D11: Consolidate Buffer allocation. We now allocate and release all buffer resources from a single place, allowing us to allocate junk memory, clear on init, and track the currently allocated buffer memory. BUG=angleproject:2034 Change-Id: Id60b63a7f77bc369dfc494a7587ab06c8d34a8e2 Reviewed-on: https://chromium-review.googlesource.com/503253 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2c479d6e 2017-05-24T14:37:22 D3D11: Use TextureHelper11 everywhere. This consolidates all texture allocation into ResourceManager11. It removes a lot of error checking and resource management code. In a few places we're storing some redundant information, like in TextureStorage11, we might store the Format pointer in two places, or the Texture's size. BUG=angleproject:2034 Change-Id: I9369e76925a67632c444c662e5667c5ed7875547 Reviewed-on: https://chromium-review.googlesource.com/503252 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 9d7d719c 2017-05-24T14:35:59 D3D11: Move CreateStagingTexture to Renderer11. This will make staging texture tracking easier. BUG=angleproject:2034 Change-Id: I2f0418cc5784100bf6fba59b4bda1b2dd9dc18d1 Reviewed-on: https://chromium-review.googlesource.com/503251 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e0e009fe 2017-05-19T14:13:03 D3D11: Consolidate SRV allocation. This change also moves all SRV storage to use the custom smart pointer classes in ResourceManager11. Every single SRV is now allocated in ResourceManager11. For TextureStorage11 and RenderTarget11, we use a shared pointer type since the SRVs use shared ownership by both classes. BUG=angleproject:2034 Change-Id: I90666fbbbc23ff10870b7401f3da09ef79258136 Reviewed-on: https://chromium-review.googlesource.com/503250 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 231c7f56 2017-04-26T13:45:37 Apply clang-format to many files. This cleans up the formatting in many places. BUG=None Change-Id: I6c6652ebc042f1f0ffecced53582d09d66b4f384 Reviewed-on: https://chromium-review.googlesource.com/487884 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 876429b7 2017-04-20T15:46:24 Update gl2.h and update entry points. Some method signatures were updated. Types like GLclampf and GLvoid were replaced with other equivalents. BUG=angleproject:1309 Change-Id: I05e8e2072c5a063d87ad96a855b907424661e680 Reviewed-on: https://chromium-review.googlesource.com/475011 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 25e297e9 2017-04-20T17:01:20 D3D11: Alias dirty buffer channel bindings. The types for this were a bit disorganized. Clean this up. BUG=angleproject:1635 Change-Id: I669d347697e0c7c5b06ed7165fa0997c375e876e Reviewed-on: https://chromium-review.googlesource.com/483315 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 1e5499db 2017-04-05T11:22:16 Refactor Signal utils into template classes. This will allow us to pass on extra information to the receiving end, such as the specific texture levels that are dirty. BUG=angleproject:1635 Change-Id: Idb7ca1d625499e50e7712c458b694f6e9bfc0595 Reviewed-on: https://chromium-review.googlesource.com/453382 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Qin Jiajia fbe49a8f 2016-12-19T14:19:10 ES31: Implement DrawArraysIndirect D3D part There are four buffer types for vertex attribute storage in D3D11: DIRECT STATIC DYNAMIC CURRENT_VALUE When drawing, it will call applyVertexBuffer to bind the right type buffers in D3D11. DIRECT uses the gl buffer directly without any translation. CURRENT_VALUE uses a single value for the attribute. STATIC translates the whole vertex buffer once. So it doesn't need the first, count and instance informations since it always translates the whole buffer. DYNAMIC translates the data every frame. To improve the performance, in implementation, it only translates 'count' vertexes from 'first' location in vertex buffer with one drawing for non-instanced vertices. 'first' and 'count' are got from draw parameter list. And for the translated vertex buffer, when drawing, the first vertex location is 0. From above analysis, we can see that if all attribute storages are non-dynamic, we can directly use the indirect buffer to draw. But for dynamic storages, we have to calculate the first, count, and instances from indirect buffer and apply them to translate the dynamic type buffers. Meanwhile, we have to set the first to 0 (see above description)when drawing. DrawArrysIndirect implementation is like below: 1. Check whether all vertex attributes are non-dynamic 2. If yes, applyVertexBuffer and DrawInstancedIndirect 3. If no, 1) calculate first, count, and instances from indirect buffer. 2) applyVertexBuffer with these parameters. 4) Use DrawInstanced instead of DrawInstancedIndirect. BUG=angleproject:1595 TEST=dEQP-GLES31.functional.draw_indirect.draw_arrays_indirect* Change-Id: I36431f416443279d51de523b07ce60727914cbbf Reviewed-on: https://chromium-review.googlesource.com/446690 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 9f9b1d2d 2017-03-06T18:25:22 Make ScratchBuffer its own type. This helper tool in Renderer11 can be useful in other back-ends, or even in the front end. BUG=angleproject:1635 Change-Id: I18ec19a891a9bdfa7b80dea1b8e308abf206906b Reviewed-on: https://chromium-review.googlesource.com/450919 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 5f56ddb9 2017-01-13T17:29:55 Buffer: Pass Context to all impl methods. This allows us to retrieve Device handles for Vulkan, and could allow us to avoid storing some pointers for other back-ends. BUG=angleproject:1684 Change-Id: Iccd5b97cf1c3a332d62a38ad0fcf21c352270439 Reviewed-on: https://chromium-review.googlesource.com/426400 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b8353b01 2017-01-25T12:57:21 Vulkan: Simple buffer creation. This is necessary to initialize vertex arrays. BUG=angleproject:1579 Change-Id: Ic5a232d5cdfaa75b41241901de842e62ff3b173f Reviewed-on: https://chromium-review.googlesource.com/406645 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill c1a5d16e 2017-01-18T23:01:35 Buffer11: Fix use-after-free with system memory storage. Certain use patterns could trigger a deallocation of the system memory storage as it was being initialized. Fix this by resetting the idle counter before we enter into the internal update which would trigger the deallocation check. BUG=chromium:682020 Change-Id: Ic3dac78ffa778cbaf103820a23eea009ce439d5c Reviewed-on: https://chromium-review.googlesource.com/430304 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
He Yunchao acd1898e 2017-01-04T10:46:42 Replace Error(GL_NO_ERROR) with NoError(). In order to make the errors be consistent throughout ANGLE. BUG=angleproject:1686 Change-Id: I0a2d86091d640aedeac94beae345c1fb6971b00d Reviewed-on: https://chromium-review.googlesource.com/424835 Commit-Queue: Yunchao He <yunchao.he@intel.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 555009ce 2016-11-16T11:51:01 Buffer11: Intel workaround for constant buffers. This workaround avoids using inter-buffer copies involving constant buffers. Instead of copying from a staging storage to a constant buffer (or vice-versa), the Buffer memory managment will keep the system memory storage around permanently. This uses a bit more memory but should fix all the problematic cases where we have the canonical version of the buffer data inside GPU memory. BUG=chromium:593024 Change-Id: I2ce0cfd22784aa43e819ce2df2d0da540d0a0cfe Reviewed-on: https://chromium-review.googlesource.com/412140 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 96ed3527 2016-11-16T11:27:43 Buffer11: Slight cleanup in copyFromStorage. We can call setData internally to re-use the same code. BUG=chromium:593024 Change-Id: I9f53bef1e86a11fc23799123937c354bf45de014 Reviewed-on: https://chromium-review.googlesource.com/411919 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3ae14613 2016-11-16T11:18:44 Buffer11: Refactor constant buffer range getter. This getter will now return the offset to bind along with the ID3D11Buffer pointer. This encapsulates the logic of the emulation so that we only actually check the capabilities of the driver in a single place. This solves the issue of needing to edit the code in multiple places when trying to force the caps for debugging, and also encapsulates the offset calculation in the Buffer11 class. BUG=chromium:593024 Change-Id: Idb09d560868ae12b98bcaf4ea031c4e0b6c82b4a Reviewed-on: https://chromium-review.googlesource.com/411918 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8f775607 2016-11-03T16:45:34 Introduce a gl::BufferState class. This state can share vital pieces of information with the impl. The most elementary state is the buffer size, which then the impl doesn't need to replicate. BUG=angleproject:1579 Change-Id: I341393c64a6e49de65c1d53b1bad2fa143209862 Reviewed-on: https://chromium-review.googlesource.com/406644 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d89792f4 2016-10-30T22:41:53 Buffer11: Keep system memory storage for large UBOs. The system memory storage is needed to back UBOs larger than the max constant buffer size in D3D11 Windows 7. Because readback from UBOs can be tricky, the system memory storage keeps the canonical copy of the data in this case. We can also extend this to add a workaround to fix the outstanding failure cases of UBOs on Intel. BUG=chromium:660670 Change-Id: Ia3119d3064d10c4262def4c5a967972b4de2d10f Reviewed-on: https://chromium-review.googlesource.com/405367 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 5677e4d1 2016-10-28T15:27:07 Buffer11: Ensure we don't overflow on setData. When mapping uniform buffers for very large buffers, we could end up copying past buffer bounds. This would trigger crashes on some configs. We can fix this by clamping the copy size correctly. BUG=chromium:659892 Change-Id: I9d1af984da34867692d4c7b8908c016ebec7a63b Reviewed-on: https://chromium-review.googlesource.com/404931 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3b5ffe5c 2016-10-24T15:47:16 Fix ASSERT in Buffer11::PackStorage::copyFromStorage. This ASSERT was being overly restrictive, when the code would work correctly when reading from system memory storage as well as staging. BUG=angleproject:1555 Change-Id: Ib45185d8c127a1fb2ce54db9e96fe41d68d5ff2e Reviewed-on: https://chromium-review.googlesource.com/402269 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill c4431804 2016-10-03T15:41:38 D3D11: Fix Buffer11::copyFromStorage and UBOs. The change to initialize a constant buffer immediately after calling BufferData in D3D11 led to a bug where we would map the UBO for writing with the wrong map bits. Fix this by using the same map method as the rest of the code. The D3D11 runtime seems to allow arbitrarily large constant buffers on Windows 10, but not Windows 7. Thus this CL also fixes a bug in our constant buffer size clamping to not copy more than the available buffer size for uniform buffers. BUG=chromium:651493 Change-Id: I876767691d02db90ecb08a8fa78199f03339a35e Reviewed-on: https://chromium-review.googlesource.com/391167 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 1ce09ace 2016-09-21T10:43:38 D3D11: Free buffer staging storage when idle. Using the same policy as for system memory storage, we release the staging buffer if it has been unmodified for several uses. We could further extend this technique to other storage buffers using a nearly identical policy. We might need to mitigate the cost of iterating over all the storages of all the buffers. BUG=angleproject:516 Change-Id: Ib24ef03cf4184ef6f0c24f83347538df82de5f58 Reviewed-on: https://chromium-review.googlesource.com/387200 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2e60034b 2016-09-19T13:56:40 D3D11: Store Buffer SRVs in native storage. This allows us to not store std::pairs to identify SRVs. Instead we can release the cached SRVs directly when we re-create the native buffer. BUG=angleproject:1513 Change-Id: I6f6d5edc659aa843c9439b97661073415f1a772b Reviewed-on: https://chromium-review.googlesource.com/385818 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 57b9424f 2016-09-09T12:48:00 D3D11: Release SRV cache in Buffer11 destructor. This was leading to a resouce leak with fast unpack. BUG=angleproject:1513 Change-Id: I4ff6c6e3c889392e314654d63f2db8f671b6913c Reviewed-on: https://chromium-review.googlesource.com/383711 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 29639857 2016-09-02T15:00:09 D3D11: Work around Intel uniform buffers bug. When copying from a staging buffer to a uniform buffer, the first upload would be incorrect. Work around this by trying to upload directly to a uniform buffer on the first BufferSubData call. BUG=chromium:593024 Change-Id: I0df3a1422b962bf3ece5d445f435df01e3544b67 Reviewed-on: https://chromium-review.googlesource.com/368774 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill c2c106d4 2016-08-11T12:42:14 D3D11: Clean up buffer calls a bit. BUG=None Change-Id: I3b697c3b721b5be4888d039a5cefd160ab5b23f8 Reviewed-on: https://chromium-review.googlesource.com/367877 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 11b30612 2016-08-02T12:31:58 D3D11: Store ANGLEFormatSets instead of ANGLEFormats. This saves us looking up the FormatSet repeatedly. BUG=angleproject:1455 Change-Id: I77890c1eb427e7d087ceaf194a5001b8b03585d4 Reviewed-on: https://chromium-review.googlesource.com/359084 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang 91bc2907 2016-07-14T13:38:52 D3D11: Add support for pack parameters when packing to PBOs. BUG=angleproject:1268 TEST=conformance2/reading/read-pixels-pack-parameters.html Change-Id: Ia7d69bdabd94d146bc027e6a6d3bb619b1ada2e8 Reviewed-on: https://chromium-review.googlesource.com/360491 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 5733801a 2016-06-23T18:10:38 D3D11: Refactor depth/stencil blit code. Blit11 refactorings enable re-using some code for multisample resolve blits. Also some Renderer11 refactorings to use TextureHelper11 make the code more flexible for the multisample resolve, to come later. BUG=angleproject:1246 Change-Id: Id0c168cef75b0f487cb3995a906f6473989edcd5 Reviewed-on: https://chromium-review.googlesource.com/354420 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e02a6834 2016-06-09T06:52:41 Refactor how we signal dependent state changes. Dependent state changes happen when the user calls TexImage on a Texture attached to a Framebuffer. The Framebuffer should be told 'hey, you should know about this'. Other objects also have dependent relationships, like VertexArrays and Buffers. This refactoring uses a binding pointer design, similar to the type 'RefCountObject'. This design fixes the need for manual decoupling when one or the other is destroyed. The pointers are cleaned up in destructors, and do no-ops when either the source or dest is missing. Also move these new classes to a location where they are accessible to the GL layer; they will be important for framebuffer completeness. BUG=angleproject:1388 Change-Id: I92610acb85dae6f9c009b8f071e121fde53782ae Reviewed-on: https://chromium-review.googlesource.com/348953 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d2b50a0b 2016-06-09T00:13:35 Move ReadPixels logic to helper methods. These routines were pretty much duplicated between D3D9 and D3D11. Since I was going to have to rewrite them again for Vulkan, I figured it would be best to move them into a common location and clean them up a bit. BUG=angleproject:1319 Change-Id: I15d39b052daf3e1020dbd0880f01ae84f3686a0a Reviewed-on: https://chromium-review.googlesource.com/349630 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e2e406c3 2016-06-02T13:04:10 Add base::numerics for safe math and conversions. This replaces are "IsUnsignedXXXSafe" family of methods. Also add overflow checks to unpack block sizes. BUG=angleproject:1397 Change-Id: Ib47be149b0486c70f795b0d0f8899441faac9340 Reviewed-on: https://chromium-review.googlesource.com/348062 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 53ea9cc6 2016-05-17T10:12:52 Replace rx::Renderer with rx::ContextImpl. Previously Context had no Impl class, but had a special relationship with the instanced Renderer class. Having a ContextImpl backing every Context will allow new designs to enable things like multithreading (where each ContextImpl stores a Context-specific device) or non- virtual Contexts on Android or other platforms where it is more efficient. A large refactoring patch that touches every back-end. BUG=angleproject:1363 Change-Id: Icb73a7d37447f08a664eeb499a310ba05d71a57e Reviewed-on: https://chromium-review.googlesource.com/342052 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e4857c7d 2016-04-21T14:13:53 Buffer11: Use adaptive threshold for releasing system memory. The hard-coded threshold of five uses before a release was regressing the Oort online benchmark, which seems to use an index buffer many times, then change to a different range of indices, which would need to check the system memory for index range validation. Also add a performance regression test, and an update to the perf runner script which checks for the most recent binary among the search directories. BUG=594066 Change-Id: Id09cc32fd00bff1c72cbe9b6fb7c210fd047a551 Reviewed-on: https://chromium-review.googlesource.com/339271 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 52b09c2f 2016-04-11T14:12:31 Re-re-land "D3D11: Implement dirty bits for VertexArray11."" Translated attributes are now stored in the VertexArray11 in a cache, and only updated when dirty bits change. Currently dynamic attributes must be re-translated every call, so these are stored in a list and processed repeatedly. This skips doing a lot of the VertexDataManager work for vertex attributes that don't change between draw calls. Current value attributes, which correspond to disabled attributes that the program will pulls vertex data from, are owned by the Context, so these need to be handled outside of the VertexArray11. Further changes will be necessary to reduce the redundant work we do in the InputLayoutCache. We shouldn't need to re-check the cache if nothing relevant changed. This give about a 23% performance improvement on the draw call benchmark on my machine. Re-land with a fix for the start vertex offset. Re-re-land with a fix for using XFB with deleted buffers. BUG=angleproject:1327 Change-Id: I0fba49515375c149bbf54d933f8d1f747fbb8158 Reviewed-on: https://chromium-review.googlesource.com/338003 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 53a36004 2016-04-08T19:03:18 Revert "Re-land "D3D11: Implement dirty bits for VertexArray11.""" Seems to make the following dEQP test flaky: dEQP-GLES3.functional.lifetime.attach.deleted_output.buffer_transform_feedback doesn't show up on every bot test, but run it a few times and it'll flake. Reverting while I investigate. BUG=angleproject:1327 This reverts commit 3477f3a62dc139a253a0b361ee138116e9fa881f. Change-Id: Ic23a392526f5f6e107cf0aa06448389804d6b208 Reviewed-on: https://chromium-review.googlesource.com/337961 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3477f3a6 2016-03-29T17:15:29 Re-land "D3D11: Implement dirty bits for VertexArray11."" Translated attributes are now stored in the VertexArray11 in a cache, and only updated when dirty bits change. Currently dynamic attributes must be re-translated every call, so these are stored in a list and processed repeatedly. This skips doing a lot of the VertexDataManager work for vertex attributes that don't change between draw calls. Current value attributes, which correspond to disabled attributes that the program will pulls vertex data from, are owned by the Context, so these need to be handled outside of the VertexArray11. Further changes will be necessary to reduce the redundant work we do in the InputLayoutCache. We shouldn't need to re-check the cache if nothing relevant changed. This give about a 23% performance improvement on the draw call benchmark on my machine. Re-land with a fix for the start vertex offset. BUG=angleproject:1327 Change-Id: Ic23e48fb18ed7f29c1999914a2f799ac04aa03e9 Reviewed-on: https://chromium-review.googlesource.com/334225 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill da123308 2016-03-29T17:00:48 Add ANGLE_TRY macros to reduce boilerplate with gl/egl Errors. The macros don't need to disambiguate between GL/EGL. Also make helpers to deal with ErrorOrResult. BUG=angleproject:1310 BUG=angleproject:1327 Change-Id: I8041c4b17a859fe1f236bca3ad266453d67a8fd4 Reviewed-on: https://chromium-review.googlesource.com/335826 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7d712e7d 2016-03-29T21:54:33 Re-land "Clean up Buffer11." This cleans up some messy stuff from the emulated index buffers, which were caching variables that didn't need to be cached. Also add in missing error checks. This touches a lot of code. Re-land with a fix for clang-win build. BUG=angleproject:1327 BUG=angleproject:1310 Change-Id: I31ed81c7242782bef7c5f6cde2192552f7ff9403 Reviewed-on: https://chromium-review.googlesource.com/336052 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e34deaa3 2016-03-30T01:50:40 Revert "Clean up Buffer11." Fails Clang-win because of std::forward ..\..\third_party\angle\src\libANGLE/Error.h(60,40): error: no matching function for call to 'forward' BUG=598944 BUG=angleproject:1327 BUG=angleproject:1310 This reverts commit 041d678b4764484386f934df927f00a5df48a351. Change-Id: I9fb0685cd01090b1faf8417ffa3c9b49eeb4510e Reviewed-on: https://chromium-review.googlesource.com/336040 Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 041d678b 2016-03-29T17:00:47 Clean up Buffer11. This cleans up some messy stuff from the emulated index buffers, which were caching variables that didn't need to be cached. Also add in missing error checks. This touches a lot of code. BUG=angleproject:1327 BUG=angleproject:1310 Change-Id: Icd722d57d9449388fbabc62c7ea37f0526a568ff Reviewed-on: https://chromium-review.googlesource.com/334731 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 00f394ec 2016-03-16T12:09:11 Revert Dirty bits for VertexArray11 This is a combination of two reverts: Revert "D3D11: Remove unused mRenderer from VertexArray11." Revert "D3D11: Implement dirty bits for VertexArray11." Reverting only the first commit would trigger warnings on the Windows clang bot. BUG=594509 BUG=angleproject:1327 This reverts commit fc4712b5ed270436f2993bfda9e916d4f92684a4. This reverts commit 7d8585b802b7eb741b380bd0d05769281d9507c9. Change-Id: I612dbba0816d6144f71ce815701c13a798585bc7 Reviewed-on: https://chromium-review.googlesource.com/332989 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7d8585b8 2016-03-09T15:53:12 D3D11: Implement dirty bits for VertexArray11. Translated attributes are now stored in the VertexArray11 in a cache, and only updated when dirty bits change. Currently dynamic attributes must be re-translated every call, so these are stored in a list and processed repeatedly. This skips doing a lot of the VertexDataManager work for vertex attributes that don't change between draw calls. Current value attributes, which correspond to disabled attributes that the program will pulls vertex data from, are owned by the Context, so these need to be handled outside of the VertexArray11. Further changes will be necessary to reduce the redundant work we do in the InputLayoutCache. We shouldn't need to re-check the cache if nothing relevant changed. This give about a 23% performance improvement on the draw call benchmark on my machine. BUG=angleproject:1327 Change-Id: I7fb944d32ea7e6c78b9e478406bdb7e10a7fc05b Reviewed-on: https://chromium-review.googlesource.com/330173 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>