src/libANGLE/MemoryProgramCache.cpp


Log

Author Commit Date CI Message
Brandon Jones c405ae71 2017-12-06T14:15:03 Optimize Vertex Shader Attribute Type Validition Improves ValidateVertexShaderAttributeTypeMatch by storing vertex attributes types into masks for quick comparisons when needed. This shows 2% improvement to glDrawElements for the aquarium workload. BUG=angleproject:2202 Change-Id: I87fa3d30c3d8cdba6dfd936cd1a41fd27b1c6b77 Reviewed-on: https://chromium-review.googlesource.com/814795 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Brandon Jones 76746f9b 2017-11-22T11:44:41 Optimize Fragment Shader Type Match Validation Improves ValidateFragmentShaderColorBufferTypeMatch by storing input and output types into a bitmask for quick comparison when validation is needed. This shows a 2% improvement to glDrawElements for the aquarium workload. BUG=angleproject:2203 Change-Id: Iade2ecf28383164e370b48442f01fba6c0962fba Reviewed-on: https://chromium-review.googlesource.com/775019 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 3c1da04e 2017-11-27T18:33:40 Isolate GlslangWrapper header from most of ANGLE. Since we might want to use the ANGLE PoolAlloc in the Vulkan back-end, we want to make completely sure that it doesn't show up in any header that might be included with the Glslang headers, since this could cause a conflict. This change moves as much as possible to forward-declaring instead of including headers directly in ProgramLinkedResources.h. This means making several internal Program helper classes external. I.E. instead of Program::Bindings, we have ProgramBindings. It also redeclares a "using" in two places, since it isn't possible to forward declare these, and it seemed overdesigned to put the using in a separate header. Bug: angleproject:2264 Change-Id: Idd08706580c927327dddf46e86acbcd2c4e3286f Reviewed-on: https://chromium-review.googlesource.com/792270 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Yunchao He 85072e8f 2017-11-14T15:43:28 ES31: Fix detaching/deleting compute shader after LinkProgram. This change also moves the ShaderType enum from D3D renderer to angletype.h. And it uses a bit mask to track the linked shader stages. BUG=angleproject:2247 Change-Id: I5c7ee1445d353a02e24549ffcf6b0ac694dd1069 Reviewed-on: https://chromium-review.googlesource.com/768629 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 465835d6 2017-09-26T13:34:10 Support arrays of arrays in the API The ShaderVariable class that is used as an interface between the compiler and the rest of the code gets arrays of arrays support. Array of array variables are passed from the compiler just like any other variables. However, when stored in Program state each innermost array constitutes a separate variable. This is done to make the implementation match the GLES specification for program interface query APIs. This will be tested more fully once support for parsing arrays of arrays lands in the compiler. TEST=angle_end2end_tests, angle_unittests BUG=angleproject:2125 Change-Id: I0f7159000f039be92a87a52b3b68cd9a215a21cb Reviewed-on: https://chromium-review.googlesource.com/684742 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> 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>
Jiajia Qin 3a9090fa 2017-09-27T14:37:04 ES31: Add BUFFER_VARIABLE and SHADER_STORAGE_BLOCK program interfaces This patch collects the shader storage block members information. It implements getShaderStorageBlockMemberInfo and getShaderStorageBlockSize for OpenGL backend. Meanwhile, it implements BUFFER_VARIABLE and SHADER_STORAGE_BLOCK interfaces for program query. BUG=angleproject:1920 TEST=angle_end2end_tests:ProgramInterfaceTest* dEQP-GLES31.functional.layout_binding.ssbo* dEQP-GLES31.functional.compute.basic.empty dEQP-GLES31.functional.compute.basic.ssbo_rw* dEQP-GLES31.functional.compute.basic.ssbo_local_barrier* dEQP-GLES31.functional.compute.basic.copy_image_to_ssbo_small dEQP-GLES31.functional.compute.basic.copy_ssbo_multiple_groups dEQP-GLES31.functional.compute.basic.copy_ssbo_multiple_invocations dEQP-GLES31.functional.compute.basic.copy_ssbo_single_invocation dEQP-GLES31.functional.compute.basic.copy_ssbo_to_image_small dEQP-GLES31.functional.compute.basic.shared_var* dEQP-GLES31.functional.compute.basic.ubo_to_ssbo* dEQP-GLES31.functional.compute.basic.write_multiple_arr* dEQP-GLES31.functional.compute.shared_var.basic_type.* dEQP-GLES31.functional.compute.shared_var.work_group_size.* dEQP-GLES31.functional.atomic_counter.* Change-Id: Ie8b81fde5a2e919aab77adb3d137c9ff2f193409 Reviewed-on: https://chromium-review.googlesource.com/712235 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 1734e171 2017-10-27T15:30:27 Only store innermost array offset in VariableLocation Separate entries will be generated for each innermost array of arrays of arrays in the variable tables. Because of this VariableLocation actually only needs to store the innermost array index. BUG=angleproject:2125 TEST=angle_end2end_tests Change-Id: Id1ee35b3cecfc011d96b58e43cf0b1cccbfed408 Reviewed-on: https://chromium-review.googlesource.com/741742 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho d255123c 2017-10-26T20:03:33 Store shader interface variables as per query spec GLES 3.1 section 7.3.1.1 specifies how active variable entries should be generated and how active variables are named. The specs for program interface variable queries are built on top of this section. ANGLE has already followed this spec for the most part for generating variable lists in ProgramState, but now we also follow the naming spec for arrays and include [0] at the end of the stored name. This will make implementing arrays of arrays more straightforward. Most logic for variable queries will just keep working as is when arrays of arrays are added instead of needing more complex logic for handling array indexing. BUG=angleproject:2125 TEST=angle_end2end_tests Change-Id: I3acd14253153e10bc312114b0303065da2efb506 Reviewed-on: https://chromium-review.googlesource.com/739826 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho c853804c 2017-09-27T11:20:15 Add support for arrays of arrays to VariableLocation Array indices are sorted so that the outermost index is in the back. This is because we want to be consistent with future arrays of arrays parsing code. In parsing we'll have a utility function to make a TType object into an array, and there it's most natural to push the new outermost sizes to the back of the vector. Further patches will still be needed to parse arrays of arrays and add support to arrays of arrays into the API. BUG=angleproject:2125 TEST=angle_unittests, angle_end2end_tests Change-Id: I6c88edabf68ae9dbd803ec6d20543016c408b702 Reviewed-on: https://chromium-review.googlesource.com/686414 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill fb997ec1 2017-09-20T15:44:27 Removed "name" and "used" from variable location. The used flag was redundant with the index (which used MAXUINT). The name was redundant with the stored uniform. Removing these gives a very minor performance speed up when iterating and retrieving uniform locations. BUG=angleproject:1390 Change-Id: Ieeccdff7c131e1359e754e246d3648b73aad5baf Reviewed-on: https://chromium-review.googlesource.com/659224 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jiajia Qin 729b2c6e 2017-08-14T09:36:11 ES31: Enable shader storage buffer support for OpenGL backend BUG=angleproject:1951 TEST=angle_end2end_tests:ShaderStorageBuffer Change-Id: I1afc3cd005ad2e595c6ce937fc53e17423f8ec8b Reviewed-on: https://chromium-review.googlesource.com/618132 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill f00f7ffe 2017-08-31T14:39:15 Add a Uniform type info table. Currently most uniform type info is determined by switching on the uniform type. Some values are computed from other values, which can result in three or more switch statements plus some multiplies or other math. This patch attempts to improve the speed by pre computing necessary values into constant static tables. Improves performance by about 7% in a uniform stress test. BUG=angleproject:1390 Change-Id: I29bef259a17f6d6536171ade4950e2d712bfd39c Reviewed-on: https://chromium-review.googlesource.com/643791 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 855d964b 2017-05-17T14:05:06 Prefix user-defined names in GLSL output Now user-defined names are prefixed by _u in GLSL output in case name hashing is not on. Internal names such as names of temporary variables created in AST transformations are written out as such. This makes handling of internal function names and internal variable names consistent. It also removes the possibility of name conflicts between user-defined names and internal names in case name hashing is not on. In the same vein, it makes it safe to use GLSL reserved words that are not reserved in ESSL as variable names in case name hashing is not on. This also makes the GLSL output more consistent with how names are handled in HLSL output. Name hashing code is shared between VariableInfo and OutputGLSLBase to ensure names are handled consistently in both. The name that's used in the shader source for a given interface variable is written out to ShaderVariable::mappedName. An exception needs to be made for identifiers close to the length limit, since adding any prefix would take them over the limit. But they can be just written out as such, since we don't have any builtins or ANGLE internal variables that have as long names and could create a conflict. BUG=angleproject:2139 BUG=angleproject:2038 TEST=angle_unittests, angle_end2end_tests, WebGL conformance tests Change-Id: Id6ed052c4fab2d091227dc9a3668083053b67a38 Reviewed-on: https://chromium-review.googlesource.com/507647 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 54164b0c 2017-08-28T15:17:37 Add getUniform impl methods. This will let us remove some of the uniform data management code in the GL front-end, and simplify the GL back-end. It will also enable us to implement uniform data more efficiently in the D3D11 back-end, and probably Vulkan back-end later. This also implements a new impl method for the ProgramGL class to flag optimized-out uniforms as no longer used, post-link. This is important because otherwise the optimized uniforms get assigned valid locations, and then the getUniform calls are expected to succeed. We also use a workaround for uniform value queries for the GL back-end. It seems as though some drivers (seen on NVIDIA and AMD) may not properly clamp to the maximum representable integer value when querying out-of-range floating point values. Work around this by always calling the driver with the proper type and then casting the value in ANGLE. BUG=angleproject:1390 Change-Id: I03dc2382e7af52455c356a2bf3971a4d1bd46ec6 Reviewed-on: https://chromium-review.googlesource.com/616785 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 6c58b062 2017-08-01T13:44:25 Add histograms for the program cache. Also includes some tracking of if a cache hit comes from a binary inserted after a Link call, or sourced from the external disk cache. Chromium-side CL: https://chromium-review.googlesource.com/c/592151/ BUG=angleproject:2118 Change-Id: I80eefd203d8ce31d1ac03dd1a36459d3581128f5 Reviewed-on: https://chromium-review.googlesource.com/590689 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Martin Radev 7cf6166a 2017-07-26T17:10:53 Generate error on program-framebuffer num views mismatch According to the ANGLE_multiview spec Draw* commands should generate an INVALID_OPERATION error if the program uses the multiview extension and the number of views in the active draw framebuffer and active program differs. The patch addresses this by extending the base draw call validation. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: I369070beb5ccb17211dbe61ebec40bfcbcf5bc4e Reviewed-on: https://chromium-review.googlesource.com/586605 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Xinghua Cao 0328b575 2017-06-26T15:51:36 Bind all elements of unbound image arrays to unit zero Spec GLSL ES 3.10, section 4.4.5, Any uniform sampler, image or atomic counter variable declared without a binding qualifier is initially bound to unit zero. If the binding qualifier is used with an array, the first element of the array takes the specified unit and each subsequent element takes the next consecutive unit. BUG=angleproject:1987 TEST=angle_end2end_tests:ComputeShaderTest Change-Id: I6a8188449a91bf3e8ded37e067205dcae4e47fa7 Reviewed-on: https://chromium-review.googlesource.com/547977 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 4c19a8a8 2017-07-24T11:46:06 D3D11: Update cached dynamically recompiled programs. This change makes it so that when we need to recompile a program on a draw call, we also update the cache. It also streamlines the internal queries of the dynamic vertex and fragment shaders such that we only update the input and output signatures a single time per draw. This should also facilitate dirty bit implementations for the D3D11 back- end. BUG=angleproject:2116 Change-Id: Iccb0501b700bc894f40a8c68d7f297ff0c8f46bd Reviewed-on: https://chromium-review.googlesource.com/531798 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill c43be720 2017-07-13T16:22:14 Implement ANGLE_program_cache_control extensions. This will give the browsers the ability to control the cache size, query and populate the contents, and trim cache contents on memory pressure. BUG=angleproject:1897 Change-Id: I6edaa7d307b890223db98792d5b074e4a7fdfaa4 Reviewed-on: https://chromium-review.googlesource.com/563606 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
jchen10 eaef1e5e 2017-06-13T10:44:11 Link atomic counters to buffers Gather counters from each shader and group them according the layout qualifier 'binding' into each buffer. BUG=angleproject:1729 TEST=angle_end2end_tests:AtomicCounterBufferTest Change-Id: I8d0cd0d2bf65be37c035b0e1540481c8bee0bae4
Jamie Madill 27a60631 2017-06-30T15:12:01 Re-apply UBO binding workaround on program save. The workaround which was previously defined to only apply on load also seems to affect save on some AMD drivers. BUG=angleproject:1637 BUG=angleproject:1897 Change-Id: Ia01a1420a484f3c2682ce97eaab18baccfb66a50 Reviewed-on: https://chromium-review.googlesource.com/558008 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 360daeef 2017-06-29T10:36:19 Add platform hook for program cache updates. This will need to be matched with a corresponding browser-side CL. It will enable writing out binary shaders to disk. BUG=angleproject:1897 Change-Id: I443281086050b9711b92a034cf37f808dd919007 Reviewed-on: https://chromium-review.googlesource.com/542963 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 3244736a 2017-06-28T14:53:52 Use MemoryProgramCache. Add the member functions for saving and loading from the binary cache, and hook them into the Program class. Requires that the Renderer supports the program binary extension. BUG=angleproject:1897 Change-Id: I2dc8d21b02da705ded58c5cd1943562c9c97c49b Reviewed-on: https://chromium-review.googlesource.com/522874 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill ffe00c03 2017-06-27T16:26:55 Add program cache transform feedback workaround. On Qualcomm devices, they don't seem to correctly save transform feedback info. Work around this by disabling caching on these devices. This mirrors a Chromium workaround. BUG=angleproject:2088 Change-Id: I6496d2fb6a03788379a6968bcd5eb3a9cb9d15d4 Reviewed-on: https://chromium-review.googlesource.com/549981 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Xinghua Cao 65ec0b2e 2017-03-28T16:10:52 ES31: Add support for bindImageTexture on GL backend This patch refers to https://chromium-review.googlesource.com/c/380636/ BUG=angleproject:1987 Change-Id: If621eed6ecaa7298214843a2a133801ca1487b03 Reviewed-on: https://chromium-review.googlesource.com/462088 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
jchen10 7a20b973 2017-06-13T14:25:26 Refactor uniform block binding Remove mUniformBlockBindings and move its bindings to mUniformBlocks. BUG=angleproject:1442 Change-Id: I62b4471990a44e626d2357c41cb914abc27cb18f Reviewed-on: https://chromium-review.googlesource.com/532834 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 97ee6548 2017-06-07T17:06:05 Shunt more code to StateManager11. Previously the Renderer11 would call directly into the state manager sync methods. Instead make a single updateState method, and make several state sync methods private to the manager. Also rename them to clarify they're for syncing state, not for direct use. BUG=angleproject:1156 Change-Id: I94880a744e7ade3895fa2a312a2436ba4ef38dba Reviewed-on: https://chromium-review.googlesource.com/529705 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 4f86d053 2017-06-05T12:59:26 Introduce MemoryProgramCache. This class will manage GPU binary programs in memory. It will be owned by the Display, and shared between Contexts. Currently this CL just refactors the Program binary saving and loading into static members of this new class. BUG=angleproject:1897 Change-Id: I34f5afb2c02416f6fd80dd65ba3827a8637ce190 Reviewed-on: https://chromium-review.googlesource.com/522873 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>