src/libANGLE/MemoryProgramCache.cpp


Log

Author Commit Date CI Message
Jamie Madill 62778cb9 2020-09-22T23:10:04 Rename version/commit headers. Prefix the files with angle_ to disambiguate them from other tools. Bug: b/168736059 Change-Id: I7be25ca18fb69d7f2ab71bdf355932865d134954 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2425197 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tim Van Patten b55f0f78 2020-06-02T18:01:24 Compress Program binaries saved in blob cache The Android blob cache has a limit of 2MB, so ANGLE should compress the Program binaries that are saved into it to maximize its effectiveness. ANGLE will gzip the program binaries before being stored in the blob cache and then uncompress them when retrieved. Using gzip, the binaries are compressed to ~25% of their size when running the T-Rex benchmark. Some examples (in bytes): Uncompressed: 20193, Compressed: 4455 Uncompressed: 8767, Compressed: 2369 Uncompressed: 11144, Compressed: 2927 This doesn't appear to affect the T-Rex benchmark since all of the programs are loaded/decompressed as part of the benchmark initialization, and the programs are small enough to all fit in the blob cache without compression. Bug: b/155184635 Test: T-Rex, CQ Change-Id: Ie6a101c32ab5fd49baae1cb7aecdd26a934e15af Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2227529 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Jamie Madill 0df92012 2020-06-03T17:08:43 Rename Platform.h to PlatformMethods.h. "platform.h" is too common a name and causes headers to be included incorrectly. Disambiguate the header using a more specific name. Solves a problem that came up with the GLES 1 tests and the standalone test harness. Bug: angleproject:3162 Change-Id: I88229a2c9407e0db57f5beee44daa11a4075f700 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2229065 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Geoff Lang dd29370c 2020-04-01T10:42:47 Include the fragment output locations in the program cache key. If the user rebinds the output locations and relinks a program, the wrong program may be loaded from the cache. TEST=gl_tests: TranslatorVariants/EXTBlendFuncExtended* BUG=angleproject:4535 Change-Id: If9a9c2ad935ea4d01c3fe4313810d221e9c9ce38 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2131252 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Geoff Lang 07467b4a 2020-03-20T10:40:56 Remove GL_CHROMIUM_path_rendering Bug: chromium:1063193 Bug: angleproject:4270 Change-Id: I35b24b7d8d892181955e49dd2495655bc57cb0df Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2112275 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang a36f8bd4 2020-01-29T12:10:17 Mark MemoryBuffer allocation functions as NO_DISCARD Not all call sites were checking the return value of MemoryBuffer::resize, mark the return value as NO_DISCARD and fix all the warnings. BUG=chromium:1030835 Change-Id: I762796e3d11efc131a814069d78a195b0d4c9f8f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2028151 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 616a4dc0 2019-09-12T16:10:47 Vulkan: Full support for program interface queries Program interface queries are a generic way to query attributes of the program like uniforms, samplers, attributes, etc. This change supports those queries for program outputs. Bug: angleproject:3596 Test: dEQP-GLES31.functional.program_interface_query.* Test: ProgramInterfaceTest.cpp Change-Id: I0f13692949073b45988b6f930eee9eaa6411bbe2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1801998 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
James Darpinian 7e48c9eb 2019-08-06T17:17:19 Add explicit integer casts WebKit uses the -Wshorten-64-to-32 flag which warns on these cases. Bug: 3439 Change-Id: I8c1de60da0f173ca2036e2120e79b857f5f2775f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1740866 Commit-Queue: James Darpinian <jdarpinian@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Lee Salzman 8ba78da0 2019-04-30T23:42:31 add support for EXT_blend_func_extended to D3D11 Change-Id: Id66868851a490d0a68a7e76280720825c4844a45 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1591192 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang e332e621 2019-02-14T12:53:04 D3D: Asynchronously load program binaries. Unpack as much of the binary steam as possible before passing the final loading of the shader programs off to a worker thread. Reporting as many possible link errors before becoming asynchronous means that linking should only fail due to unexpected system issues at that point. This also allows other backends to asynchronously load program binaries. BUG=angleproject:2857 Change-Id: I587917a3e54522114dabd41d1b14fc491c8fd18a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1473451 Commit-Queue: Jamie Madill <jmadill@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 37d2e606 2019-01-10T12:46:16 Make BlobCache use independent from ANGLE_program_cache_control The decision to enable caching or not was based on the size of the cache as directed by eglProgramCacheResizeANGLE, which is incorrect for applications that only use the ANDROID_blob_cache extension. The new behavior is as follows: - If EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE is specifically requested and set to true, but the size of the cache is 0, caching is disabled for the context. - If EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE is specifically requested and set to false, caching is disabled for the context. - Otherwise, caching is left enabled for the context, although the cache possibly has a size of zero, which effectively disables it. During application execution, if the blob cache callbacks are set, the application cache will be used. Bug: 896406, angleproject:2516 Change-Id: Ic0cabda03fb6bf53994e86e3ede30afc8021d67e Reviewed-on: https://chromium-review.googlesource.com/c/1405708 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi c3abb7f1 2019-01-17T11:26:48 Fix MultiDraw shaders when loaded from cache State updates that need to be done after linking vs. deserializing can get out of sync, as was the case for mDrawIDLocation (introduced in 1bf18ce9e2caca7067b4439373f4fb04a5cd7d21). This commit introduces a common function that's called from both paths to hopefully avoid such issues in the future. The serialize/deserialize functions are moved from MemoryProgramCache to the Program itself. Bug: 890539,angleproject:2516 Change-Id: Idc5b87de53298aacbb1884e79e721b876281fb13 Reviewed-on: https://chromium-review.googlesource.com/c/1417970 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6e18a238 2019-01-16T13:27:14 Optimize more front-end VertexArray binding. Improves perf slightly (1-2%) in the Vulkan VBO state change test. Bug: angleproject:3014 Change-Id: Ia8082b5b3f5e847a6b2775e896893fa8d38c1afd Reviewed-on: https://chromium-review.googlesource.com/c/1393904 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@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 7c985f5c 2018-11-29T18:16:17 Make angle::Result an enum. This moves away from a class type to a value type. This should improve performance when using angle::Result as a return value. Previously the generated code would return a pointer instead of a value. Improves performance in the most targeted microbenchmark by 10%. In more realistic scanarios it will have a smaller improvement. Also simplifies the class implementation and usage. Includes some unrelated code generation changes. Bug: angleproject:2491 Change-Id: Ifcf86870bf1c00a2f73c39ea6e4f05ca705050aa Reviewed-on: https://chromium-review.googlesource.com/c/1356139 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 785e8a0b 2018-10-04T17:42:00 Remove gl::LinkResult. Instead of returning a small struct from LinkProgram calls we use angle::Result. Linking can have 3 cases: - the link was successful -> angle::Result::Continue - the link failed -> angle::Result::Incomplete - there was an internal error -> angle::Result::Stop Note that any unexpected Incomplete is still an error. Each function that accepts Incomplete must check explicitly. This is the last user of ErrorOrResult. Bug: angleproject:2491 Change-Id: Idba23be27efe4b561720a4bdd8fe486b40779497 Reviewed-on: https://chromium-review.googlesource.com/c/1255645 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@google.com>
Olli Etuaho 0ca09753 2018-09-24T11:00:50 Add GLES3 support for EXT_blend_func_extended This adds GLES3 API support for EXT_blend_func_extended. The patch includes the API entrypoints, validation and also implementation on the desktop GL backend. Instead of having built-in fragment color variables, ESSL 3.00 has custom output variables, which can now be bound to either primary or secondary output color locations. The "index" set to a custom output variable determines whether it's used a primary or secondary blending source color. The shader layout qualifier takes precedence over the bind call. This is not specified in the EXT spec, but is specified in desktop OpenGL specs. BUG=angleproject:1085 TEST=angle_end2end_tests Change-Id: Ia24e8e5dadcc165e5e8fbd7c653c7fab6217db88 Reviewed-on: https://chromium-review.googlesource.com/c/1249361 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 996628a4 2018-09-24T16:39:26 Vulkan: Add support for VkPipelineCache The cache is initialized from the application's blob cache and is occasionally written back to it for disk storage. Bug: angleproject:2516 Change-Id: I4cba4b00a7b9641c2983ef07159bc62cd10a5519 Reviewed-on: https://chromium-review.googlesource.com/1241373 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Olli Etuaho a78092cb 2018-09-26T14:16:13 Support ESSL 3.00 EXT_blend_func_extended shaders This adds support for the index layout qualifier that's used in EXT_blend_func_extended to set whether a fragment output should be bound to the primary or secondary blend source color. Output locations are now validated correctly so that two outputs can have the same location as long as they have a different index. Some tests are fixed to allow this. BUG=angleproject:1085 TEST=angle_unittests Change-Id: I1de3ad1406398952287791eca367562bed59d380 Reviewed-on: https://chromium-review.googlesource.com/1245982 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 9137adea 2018-08-27T14:22:37 Add support for EGL_ANDROID_blob_cache The functionality of MemoryProgramCache is divided up in two. BlobCache is now a generic binary cache, which interfaces with the callbacks from EGL_ANDROID_blob_cache. MemoryProgramCache handles program [de]serialization and interacts with BlobCache. Bug: angleproject:2516 Change-Id: Ie4328a2e56a26338e033d84f4e53a1103411937d Reviewed-on: https://chromium-review.googlesource.com/1194285 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Qin Jiajia 9808d38c 2018-08-31T13:12:14 Fix that image texture works incorrectly when loading from program binary This bug is introduced when we implement image texture robust initialization, where we forgot to update active image units mask in program cache. Bug: angleproject:2766 Change-Id: I01de02803173f2cf5b7b9ff740175a4d7cbee4ba Reviewed-on: https://chromium-review.googlesource.com/1198683 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
Jamie Madill 7e4eff11 2018-08-08T15:49:26 Program: Add cache samplers and type masks. This mask cleans up some of the iteration logic in State::syncProgramTextures. It will make it easier to optimize this function in the future. This will also make it easier to recompute the sampler type validation. Leads to a 5% improvement in State::syncProgramTextures. Bug: angleproject:2747 Bug: angleproject:2763 Change-Id: Ic9a555df843ad23b4c562e6e4a2d425bee58a856 Reviewed-on: https://chromium-review.googlesource.com/1164306 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 7ce4a151 2018-06-12T10:19:49 Add support for uint8_t and uint16_t bitsets. These pack very well in some structs. Support is required so the templates work as expected. Also packs the Shader map into 8 bits. This includes a workaround for an unusual warning generated by MSVC. Bug: angleproject:2462 Change-Id: I804d1b9370b3951343718385210dec7d37700d73 Reviewed-on: https://chromium-review.googlesource.com/1091135 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 493f9571 2018-05-24T19:52:15 Add PrimitiveMode packed GLenum. Bug: angleproject:2574 Change-Id: I3d7bd7ca0d69a364a611dc04799ea34906fc4a6c Reviewed-on: https://chromium-review.googlesource.com/1067114 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jiawei Shao 3dd8d291 2018-03-30T09:39:09 Use ShaderBitSet for active use bits on uniforms BUG=angleproject:2169 Change-Id: I192c2e3c453540c8a6d7b0d066218ea3c9fbaab2 Reviewed-on: https://chromium-review.googlesource.com/989411 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@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>
James Darpinian 30b604d8 2018-03-12T17:26:57 Check that transform feedback will not overflow its buffers. Also fix the check for uniform buffer size to use the actual buffer size instead of the size of the bound range. Bug: 820639 Change-Id: Iaa2a617ee7ce5ce7cfabbf64bd1d6f8c82c46b65 Reviewed-on: https://chromium-review.googlesource.com/965627 Commit-Queue: James Darpinian <jdarpinian@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Olli Etuaho 107c7247 2018-03-20T15:45:35 ShaderVariable: separate fields for staticUse and active Thus far the compiler has used the "staticUse" flag to mark variables that should have rather been marked "active", meaning that the code may actually execute in a way that accesses the variable. There's a clear definition for this use of the term "active" in the GLES 3.0.5 spec, section 2.12.6, and in GLES 3.1 section 7.3.1. Having separate fields for recording static use and "activeness" of a variable is the first step to fixing this. According to the spec, usually only active resources should be considered when checking use against max limits. Also, only active uniforms get assigned a location. libANGLE code now correctly checks the active flag rather than the static use flag in these cases. The static use field still mirrors the active field for now, since some code in Chromium also needs to be fixed to use the active field correctly before the two can diverge. After Chromium is fixed, we can fix ANGLE so that static use information is recorded earlier during compilation and will accurately reflect whether variables are statically used. Currently the compiler only records variables once some static use may already have been pruned from the AST. BUG=angleproject:2262 TEST=angle_unittests, angle_end2end_tests Change-Id: I025bb71361246ae00c911a1f8b66ec045f665f29 Reviewed-on: https://chromium-review.googlesource.com/970962 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.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>
Jiawei Shao 0d88ec9f 2018-02-27T16:25:31 ES31: Add link validations on geometry shader uniforms This patch adds the link validations on the uniforms defined in a geometry shader. 1. Validate if there is any link mismatch between a geometry shader uniform and a uniform defined in another shader in the current graphics pipeline. 2. Validate if the number of images, samplers or atomic counters in a geometry shader exceeds the related resource limit. 3. Validate if there is name contradiction between a geometry shader uniform and a vertex shader attribute. BUG=angleproject:1941 TEST=dEQP-GLES31.functional.shaders.linkage.es31.geometry.uniform.* dEQP-GLES31.functional.geometry_shading.basic.* dEQP-GLES31.functional.geometry_shading.conversion.* dEQP-GLES31.functional.geometry_shading.emit.* dEQP-GLES31.functional.geometry_shading.varying.* dEQP-GLES31.functional.geometry_shading.instanced.geometry_* dEQP-GLES31.functional.geometry_shading.instanced.invocation_output_* dEQP-GLES31.functional.geometry_shading.instanced.draw_* Change-Id: I365aee624a3a79658c3e4c7487a586cf9532b529 Reviewed-on: https://chromium-review.googlesource.com/939264 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jiawei Shao 4ed05da2 2018-02-02T14:26:15 ES31: Add link validation on geometry shader itself This patch intends to support program link validation on geometry shader itself. A link error should occur when linking a program with a geometry shader that lacks input primitive or output primitive or the declaration of 'max_vertices'. This patch also adds the support of linking a program with geometry shader in angle_end2end_tests. BUG=angleproject:1941 TEST=angle_end2end_tests dEQP-GLES31.functional.shaders.linkage.es31.geometry.varying.rules.unspecified_* Change-Id: I25fb08514753102f5dd3ab86211c05d2ca4fd185 Reviewed-on: https://chromium-review.googlesource.com/898842 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
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>