src/libANGLE/Program.h


Log

Author Commit Date CI Message
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 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>
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 c3dc5d48 2018-12-30T12:12:04 Merge gl::Context and gl::ContextState. This reduces the number of indrections when accessing the Extensions or Caps structures. It will provide a small speed-up to some methods. It also cleans up the code. Bug: angleproject:2966 Change-Id: Idddac70758c42c1c2b75c885d0cacc8a5c458685 Reviewed-on: https://chromium-review.googlesource.com/c/1392391 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Markus Tavenrath <matavenrath@nvidia.com>
Markus Tavenrath cb9609fe 2018-12-26T00:52:44 Optimize glDrawElements performance A call to glDrawElements results in a calling depth of up to 4 * glDrawElements * gl::Context::DrawElements * rx::ContextGL::DrawElements * VertexArrayGL::syncDrawState. Each function call has to save/restore a lot of registers which results in a stall in the prologue of rx::ContextGL::DrawElements due to memory bandwidth limitations. The main change is the function gl::Context::DrawElements being inlined to reduce the calling depth by one. In addition the call to ContextGL::syncDrawElementsState is now protected so that it gets called only if it's required. Finally a few small getter functions have been inlined where the calling code was bigger than the actual function. In total this change improves performance of the DrawElementsPerfBenchmark.Run/gl benchmark by 16%. Bug: angleproject:2966 Change-Id: I423d18452f2f5b520ab52850fda2054e1da86991 Reviewed-on: https://chromium-review.googlesource.com/c/1389988 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Markus Tavenrath <matavenrath@nvidia.com>
Jamie Madill e3e680ca 2018-12-03T17:49:08 Remove State::syncProgramTextures. Removes the concept of the program textures dirty object. Instead we use a set of dirty bits to represent dirty texture samples. We mark certain textures dirty and update state structures whenever there is a new Texture/Program/Sampler bound, or when Texture/Program/Sampler state changes. This is in preparation for making clearing the uncleared active textures into a dirty bit as well. Also includes new dirty bit handling for texture image units. These are a GLES 3.1 feature. Bug: angleproject:2966 Change-Id: Ibb8619dd2669bb39fdbcd75e3685be9a8aeeee91 Reviewed-on: https://chromium-review.googlesource.com/c/1346649 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill e90d4ee9 2018-11-28T14:04:00 Pass Context to setLabel. This is useful for triggering a dirty state notification for Textures. It will lead to improvements for program and texture dirty bits. Bug: angleproject:2966 Change-Id: Iaba625da8a970a558f7d158bfa2f09c964f6761a Reviewed-on: https://chromium-review.googlesource.com/c/1347669 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 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>
Austin Eng 1bf18ce9 2018-10-19T15:34:02 Implement GL_ANGLE_multi_draw This patch adds entrypoints glMultiDrawArraysANGLE, glMultiDrawElementsANGLE, glMultiDrawArraysInstancedANGLE, annd glMultiDrawElementsInstancedANGLE Bug: chromium:890539 Change-Id: Ic9c374c53892460f44ca6e73a253b78473ac2dff Reviewed-on: https://chromium-review.googlesource.com/c/1282268 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
Jamie Madill f4a789f9 2018-10-18T16:56:20 Use angle::Result in front-end (Part 6) Refactors the gl::Program, gl::Compiler and gl::Query classes. Bug: angleproject:2491 Change-Id: I96acecdc6af301a89201bd7f5222a180433e5eb2 Reviewed-on: https://chromium-review.googlesource.com/c/1289711 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 956ab4d9 2018-10-10T16:13:03 Optimize several functions for the Program perf test. This gives the same or slightly better performance in the ProgramDraw perf test. Also only set the Program object as dirty when there are dirty bits set in the Program itself. Bug: angleproject:2877 Change-Id: I07b428b40d3e3c24e0a42c970524756b6dc3a30e Reviewed-on: https://chromium-review.googlesource.com/c/1271475 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6f755b21 2018-10-09T12:48:54 Use angle::Result in front-end. (Part 1) This covers most of the hot paths used in draw calls. Gives in the order of a 5% reduction in draw call overhead. Bug: angleproject:2491 Change-Id: I2d53afb1163eaceed61fb9cd9ce6c1267c85c0fa Reviewed-on: https://chromium-review.googlesource.com/c/1258149 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
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>
Jamie Madill 44a6fbfd 2018-10-02T13:38:56 Optimize resolveLink. This changes the program query to resolve the link if required. If the validation layer is skipped the link is resolved in the gl::Context. Resolving the link on program query allows us to avoid resolving the link on most of the gl::Program query APIs. This improves inlining and particularly affects uniform update. It fixes a performance regression introduced by the parallel shader linking extension. Gives a 17% increased score on a uniform benchmark. Also fixes two missing cases of checking for the extension in our validation code. Note that some bugs might still exist when the validation layer is disabled. Bug: angleproject:2851 Change-Id: I5d725eede3fa147cedf2ce0129791b3412a97a61 Reviewed-on: https://chromium-review.googlesource.com/1255509 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@google.com>
Jamie Madill d1249de0 2018-08-28T16:58:53 Vulkan: Optimize ContextVk::setupDraw. This improves performance significantly in the Vulkan CPU overhead test. Bug: angleproject:2786 Change-Id: I911bc66a6b2d11dd3848ffa90927b314aeadfc24 Reviewed-on: https://chromium-review.googlesource.com/1194301 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Qin Jiajia 47f6dd0d 2018-08-10T13:36:32 Implement robust initialization for image texture This change fixes a bug that the image texture initialization time is not correct. It happens when we use compute shader to write data to an uninitialized texture, then use readPixels to read the result which results that texture initialization falls behind image store and covers the real result. Bug: angleproject:2766 Change-Id: I4e986972096857afc975c40dfa4d559a2f31194c Reviewed-on: https://chromium-review.googlesource.com/1170569 Commit-Queue: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
jchen10 87498164 2018-08-21T21:57:22 Make some Program methods inlined These methods are very hot in the DrawCall/gl_null bechmark. With this CL applied, the score can improve about 10% on Linux. This also removes a few unnecessary resolveLink calls. Bug: chromium:873724 Change-Id: I6034f29eeeebe8341dae3988c38196123687a44f Reviewed-on: https://chromium-review.googlesource.com/1183522 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 70aeda49 2018-08-20T12:17:40 Add gl::Program::syncState and dirty bits. Currently this handles uniform block bindings. Cleans up some logic in D3D. Bug: angleproject:2747 Change-Id: I8c2989738d50a77d6f6d90a9ff11dceab6d3129c Reviewed-on: https://chromium-review.googlesource.com/1172085 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
jchen10 5055fba5 2018-08-17T09:57:07 Optimize Program::resolveLink The method has to be extremely fast as it's very frequently called. It contributes about 2% cpu time in the DrawCall/gl_null benchmark. With this optimization it can be decreased to less than 1%. Bug: chromium:873724 Change-Id: I7fb376db73452dbdf6cb44c92815848e860867c9 Reviewed-on: https://chromium-review.googlesource.com/1179369 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
jchen10 3fd614d0 2018-08-13T12:21:58 Refactor Context dependency for resolveCompile The context parameter of Shader::resolveCompile method causes a bad impact that many methods in Shader, Program etc. have to have a same context parameter. By removing it, these methods can be decoupled from Context. BUG=chromium:849576 Change-Id: Ia5545ee9dce45794550f6086bc0e6c4707e1276e Reviewed-on: https://chromium-review.googlesource.com/1172202 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
jchen10 7ae70d8f 2018-07-06T13:47:01 ParallelCompile: Parallelize D3D linking This adds a new linking state to Program. If a Program is in linking state, on the one hand the foreground thread may continue issuing more GL calls, and on the other hand the background linking threads may be accessing Program internally too. Without a proper constraint there must be conflicts between them. For this purpose, we block any further GL calls to Program until it's actually linked. In addition, we prohibit parallel linking an active program, so that ProgramD3D does not have to worry about such similar conflicts. Also changes the WorkerThread to support limiting the number of concurrently running worker threads. BUG=chromium:849576 Change-Id: I52618647539323f8bf27201320bdf7301c4982e6 Reviewed-on: https://chromium-review.googlesource.com/1127495 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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 cc73f241 2018-08-01T11:34:48 Micro-optimize some validation checks. Prepares for caching hasMappedBuffer. Also inclines several checks for faster speed. Bug: angleproject:2746 Change-Id: I74f9408d7b41e245c3f58d367dd2cc8fbace4a7a Reviewed-on: https://chromium-review.googlesource.com/1150762 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 3bb2bbea 2018-06-15T09:47:03 Program: Sampler uniform query in front-end. We have this information stored in the front-end sampler bindings. This solves sampler uniform query across the various back-ends. Turns on a bunch of uniform_api dEQP tests. Bug: angleproject:2612 Change-Id: If8752a26438595ad103598369df360e2f5e12d53 Reviewed-on: https://chromium-review.googlesource.com/1101572 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Luc Ferron e17b5ba5 2018-06-04T14:28:58 Vulkan: Keep unused uniforms list to fix glslang issues We we're unable to cleanup the unused uniforms if we did not keep a list of them while parsing them in ProgramLinkResource. Now that we keep a history of them, we're able to clean them up and fix a few dEQP tests. Bug: angleproject:2582 Bug: angleproject:2585 Bug: angleproject:2587 Bug: angleproject:2589 Bug: angleproject:2590 Bug: angleproject:2593 Change-Id: Ic1f9151e356a3d05e83f1031cc7b187b370284e5 Reviewed-on: https://chromium-review.googlesource.com/1085644 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@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>
Jamie Madill 2fc0806f 2018-05-10T15:10:55 Micro-optimize uniform updates. This CL is adapted from work by matavenrath@nvidia.com. It does the following small optimizations: * inlines a bunch of accessors. * reorders checks to hit the cache more often Also some small style updates. Bug: angleproject:1671 Change-Id: I8f21318e6644dcfe1f99c98f7f377742fcad78d3 Reviewed-on: https://chromium-review.googlesource.com/1054367 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiawei Shao 7a8fe156 2018-04-28T12:59:58 ES31: Add link validation on MAX_COMBINED_SHADER_OUTPUT_RESOURCES This patch adds the link validation on the maximum combined shader output resources required in OpenGL ES 3.1 SPEC. OpenGL ES 3.1 SPEC has restrictions on the sum of the number of all active images, shader storage blocks and fragment shader outputs. A link error will be generated if this sum exceeds the implementation- dependent value of MAX_COMBINED_SHADER_OUTPUT_RESOURCES. In order not to affect the existing image tests, this patch also sets a temporary value for maxCombinedShaderOutputResources on D3D11 back-ends. We will set more accurate values for all the UAV related resource limits in the next patch. BUG=angleproject:2345 TEST=dEQP-GLES31.functional.state_query.integer.max_combined_shader_output_resources_* Change-Id: Ib83a19ef0ae0b9af3422b5c970c7c07d96b2359d Reviewed-on: https://chromium-review.googlesource.com/1039155 Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiawei Shao 467c15f9 2018-04-24T15:04:26 Use ShaderMap in ProgramD3D - Part II This patch refactors ProgramD3D by storing all shader information into ShaderMap to simplify the code structure. This patch also fixes a bug on getting the number of maximum uniform blocks. BUG=angleproject:2169 Change-Id: I5b9fbfd70a18f8731ce19efed0df88037d495389 Reviewed-on: https://chromium-review.googlesource.com/1024749 Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiawei Shao 016105bb 2018-04-12T16:38:31 Store shader information in ShaderMap in class Program and Compiler This patch is the first one in the series of using ShaderMap as the container of the resources for each type of shader everywhere in ANGLE. This patch defines the new data structure ShaderMap and use it in class Program and Compiler in ANGLE front-end. The following work includes: 1. Use ShaderMap in D3D back-ends. 2. Use ShaderMap in Vulkan back-ends. BUG=angleproject:2169 Change-Id: I1c284d95f5a071c45bb468901eabc15694fffe38 Reviewed-on: https://chromium-review.googlesource.com/1011722 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@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>
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>
Jiawei Shao 1c08cbb3 2018-03-15T15:11:56 Clean up link validations on interface blocks This patch intends to clean up the link validations on interface blocks for better implementing program linking with geoemtry shader. 1. Move three interface block validation functions to the anonymous namespace of Program.cpp instead of the member function of class Program. 2. Use IsActiveInterfaceBlock everywhere we need to know if an interface block is active or not. BUG=angleproject:1941 Change-Id: Ic868d015e45f04d57ba382a2b447be00952fa4fc Reviewed-on: https://chromium-review.googlesource.com/965395 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiawei Shao 447bfac1 2018-03-14T14:23:40 ES31: Support program parameter queries on geometry shader This patch implements all the program queries on the geometry shader stage of a program by glGetProgramiv(), including the queries on geometry shader input/output primitives, invocations and maximum output vertices BUG=angleproject:1941 TEST=dEQP-GLES31.functional.geometry_shading.query.geometry_linked_* dEQP-GLES31.functional.geometry_shading.query.geometry_shader_invocations dEQP-GLES31.functional.state_query.program.geometry_shader_state_get_programiv Change-Id: Ibfa630c64dba5baf52ff84ce7e0bf4c567eef8c4 Reviewed-on: https://chromium-review.googlesource.com/961397 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiawei Shao fccebffe 2018-03-08T13:51:02 ES31: Support adjacency draw modes for geometry shader This patch implements adjacency primitive types as new draw modes on OpenGL back-ends. This patch also implements validations on the compatibilities among draw modes and geometry shader input primitive types. BUG=angleproject:1941 TEST=dEQP-GLES31.functional.geometry_shading.input.* dEQP-GLES31.functional.geometry_shading.negative.* Change-Id: I373ebfe88d7f50da3cc81adaf2d1b7f586b0932a Reviewed-on: https://chromium-review.googlesource.com/954715 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
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 d063affa 2018-02-22T10:19:09 ES31: Add link validation on geometry shader varyings This patch adds the link validation on geometry shader varyings. According to SPEC, geometry shader inputs should not be treated as arrays for the purpose of interface matching. This patch also moves the checks on fragment input bindings into a single function. BUG=angleproject:1941 TEST=angle_end2end_tests dEQP-GLES31.functional.shaders.linkage.es31.geometry.varying.* Change-Id: Ib3ca64e28683e9688edc9432d43ff5a70c86117e Reviewed-on: https://chromium-review.googlesource.com/929866 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@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>
Jiajia Qin 8efd1268 2017-12-19T09:32:55 ES31: Add max combined interface blocks validation BUG=angleproject:1951 Change-Id: I9223964fa84cee3888fb7f5949c3e098fe2aa2b0 Reviewed-on: https://chromium-review.googlesource.com/890818 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Qin Jiajia 9bf55527 2018-01-29T13:56:23 Fix the incorrect calculation for MAX_NAME_LENGTH The old implementation forgot to consider the instance array situation. This change will use unified method to calculate the interface block's MAX_NAME_LENGTH. It also removes some cases which have already passed from expectation files. BUG=angleproject:1920 TEST=angle_end2end_tests *program_interface_query.uniform_block.resource_list.block_array* *program_interface_query.shader_storage_block.resource_list.block_array* Change-Id: I6ef53951487e6366d69ecaa43e4df6824baad042 Reviewed-on: https://chromium-review.googlesource.com/890386 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiawei Shao 881b7bfa 2017-12-25T11:18:37 ES31: Refactor link mismatch error log This patch intends to refactor the structure of logging link mismatch errors to meet the new GLES 3.1 program link requirements and support linking program with geometry shader. This patch is mainly focusing on the following 4 issues: 1. There are totally 14 places that log the link mismatch errors in almost same format. 2. A temporary string is created (STRUCT_NAME.FIELD_NAME) before checking a field of a block, which is of no use if link succeeds. 3. LinkValidateVariablesBase needs to know "shaderTypes" if we support geometry shader based on current structure. Since uniforms are checked in the range of the whole program, it is unnecessary to know in which shader a uniform is defined if link succeeds. 4. GLES 3.1 regards varyings with same location but different names as matched, so it isn't enough to log errors only by one name. This patch can solve all these issues by the following 3 changes: 1. Replace "infoLog" and "variableNames" by "mismatchedFieldName" (the complete field name if the mismatch occurs on a field of a struct or block). 2. Use enum LinkMismatchError as the return value of all linkValidate* functions to reflect the detail of the link mismatch error. 3. Log all the link mismatch errors by InfoLog::logLinkMismatch where we can get shader types instead of passing them into linkValidate* functions. BUG=angleproject:1941, angleproject:2144 TEST=angle_end2end_tests Change-Id: I3ed876d61f812cc7a45a6a3c5fec0b4a88b9cc2c Reviewed-on: https://chromium-review.googlesource.com/844215 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@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>
Jiawei Shao 02f15239 2017-12-27T10:10:28 Clear error logs when starting a new link process This patch intends to fix a bug in logging link errors. OpenGL ES requires glGetProgramInfoLog return a string that contains information about last link or validation attempt on a program object (GLES 2.0 Chapter 6.1.8, GLES 3.0 Chapter 6.1.12). So all the link error logs should be cleared when a new link process is begun. This patch also removes several redundant allocations of mLazyStream in ProgramD3D::compileProgramExecutables. Calling "<<" on InfoLog objects will initialize its member mLazyStream from heap, so we will skip using "<<" if there is actually nothing to output. BUG=angleproject:2295 TEST=angle_end2end_tests Change-Id: Ib81fffd3d05919a8ebccd9145ff780548ca86a70 Reviewed-on: https://chromium-review.googlesource.com/848324 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
jchen10 910a3daf 2017-11-15T09:40:11 ES31 program query: support TRANSFORM_FEEDBACK_VARYING TRANSFORM_FEEDBACK_VARYING corresponds to the set of output variables in the last non-fragment stage of program that would be captured when transform feedback is active. The resources enumerated by this query are listed as specified by the most recent call to TransformFeedbackVaryings before the last call to LinkProgram. This mainly collects these resources for query. BUG=angleproject:1920 TEST=angle_end2end_tests:ProgramInterfaceTest* dEQP-GLES31.functional.program_interface_query.transform_feedback_varying.* Change-Id: I0655b12c6d82cef1b44d4ca57ea55bb60d1f78fb Reviewed-on: https://chromium-review.googlesource.com/770450 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jiawei Shao 73618601 2017-12-20T15:47:15 ES31: Clean up Program::link This patch intends to solve some structure and coding style issues in Program::link to make it easier to support linking program with geometry shader. 1. Move all the shader specific validations to linkValidateShaders. Geometry shader related link validations can also be added here. 2. Rename functions with "VertexAndFragment" to "Graphics" because these functions will also be responsible for the validations on geometry shader. 3. Refer uniforms by pointer when validating uniforms. 4. Re-declare functions to 'static' if we can and capitialize the first letter of all static functions in Program.h. BUG=angleproject:1941 Change-Id: I46608e86bddc12d95cbbbf9a85803d07ccf843d8 Reviewed-on: https://chromium-review.googlesource.com/836149 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
jchen10 8225e73b 2017-11-14T16:29:03 Support struct varying for transform feedback Capturing struct members is vague In ES 3.00. But the ES 3.10 explicitly says that base-level members of struct are feasible for transform feedback capture. This implementation fills the gap. TEST=angle_end2end_tests:TrasnformFeedbackTest* BUG=angleproject:2241 Change-Id: Ibdf3ae6c2b8b28952e2f7fef1363545cbccad389 Reviewed-on: https://chromium-review.googlesource.com/768613 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Jiajia Qin 94f1e89f 2017-11-20T12:14:32 ES31: Add atomic counter buffer data size BUG=angleproject:1729 TEST=dEQP-GLES31.functional.ssbo.layout.* dEQP-GLES31.functional.compute.basic.atomic_counter* Change-Id: Ic78c0f089fd539c0b1064e8405d63505456dbc01 Reviewed-on: https://chromium-review.googlesource.com/777958 Commit-Queue: Geoff Lang <geofflang@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>
Jiawei Shao 89be29a5 2017-11-06T14:36:45 ES31: Implement creation and attaching geometry shader on OpenGL This patch intends to implement the creation of a geometry shader and attaching a geometry shader to a program on OpenGL back-ends. This patch also adds all geometry shader related dEQP-GLES31 test failures to deqp_gles31_test_expectations.txt. BUG=angleproject:1941 TEST=angle_end2end_tests Change-Id: Ib0b497030255b15dacd967e48bc59eef0009af46 Reviewed-on: https://chromium-review.googlesource.com/757979 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
jchen10 85c93c41 2017-11-12T15:36:47 Refactor VaryingPacking Move all packing related logic from Program to VaryingPacking. Do linkValidateTransformFeedback check first to simplify packing. Make getPackedVaryings collect all required VaryingPackings in one run pass, so that packUserVaryings can focus on packing merely. BUG=angleproject:2241 Change-Id: I5e84e6e4688c80ba7a77a265b8ffaf79f4ddbb87 Reviewed-on: https://chromium-review.googlesource.com/764821 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@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>
Jamie Madill 6db1c2e8 2017-11-08T09:17:40 Link interface blocks in ProgramImpl::link. This allows the back-end to have access to the interface block info in the link operation, and also allows the interface block info to have direct access to the post-link Impl information. BUG=angleproject:2208 Change-Id: Ib2bfb3c9155eee715bd3d29de1c3fdd67b16eed4 Reviewed-on: https://chromium-review.googlesource.com/753521 Reviewed-by: 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>
Jamie Madill 977abce7 2017-11-07T08:03:19 Refactor interface block linking. This moves the logic for interface block linking. The new design is intended to be flexible enough to be passed into a back-end call to ProgramImpl::link. Then, the Impl object can be responsible for both filtering out unreferenced interface blocks as well as having access to the linked interface block information. A future change will pass the InterfaceBlockLinker objects (or objects when dealing with ES 3.1 and Shader Storage Blocks) to the Impl. This will help fix a D3D11 back-end bug where we would need acess to the Shader objects to finish a deferred uniform block link. This should also potentially make it easier for the back-ends to determine Shader Storage Block size and properties without defining new Impl methods. BUG=angleproject:2208 Change-Id: Ic5244a808dba44ba1a8c08d9ee701952034d2b18 Reviewed-on: https://chromium-review.googlesource.com/746203 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@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>
jchen10 58f67be0 2017-10-27T08:59:27 ES31 program query: support AtomicCounterBuffer and UniformBlock Calculates atomic counter buffer's shader reference according to its child counters. Merges GL_UNIFORM_BLOCK_* queries to GL_*. Refreshes deqp_gles31_test_expectations. BUG=angleproject:1920 TEST=angle_end2end_tests:ProgramInterfaceTest* dEQP-GLES31.functional.state_query.program.active_atomic_counter_buffers_get_programiv dEQP-GLES31.functional.layout_binding.ubo.* Change-Id: Ia23ddfef5f5dd7e15628f4c259273e1c01c14d80 Reviewed-on: https://chromium-review.googlesource.com/715436 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Xinghua Cao 971f8508 2017-10-17T13:01:24 Implement get compute work group size for glGetProgramiv BUG=angleproject:2187 TEST=dEQP-GLES31.functional.state_query.program.compute_work_group_size_get_programiv Change-Id: Ic09153ffccfb207e37ad70cf7e14714be987e7e1 Reviewed-on: https://chromium-review.googlesource.com/722178 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill bd159f06 2017-10-09T19:39:06 Vulkan: Use minimal dirty bits in VertexArrayVk. This should slightly reduce draw call overhead. BUG=angleproject:1898 Change-Id: I0e515bf2868f237f1d6948c12942f8cb6637c0c0 Reviewed-on: https://chromium-review.googlesource.com/707690 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
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>
jchen10 baf5d945 2017-08-28T20:45:48 ES31: Add UNIFORM support for ProgramInterface Add program resource properties for uniform. BUG=angleproject:1920 TEST=angle_end2end_tests:ProgramInterfaceTest* Change-Id: Ia5cf6219db43b8b1f73efbb3565d21c86e9d3ec0 Reviewed-on: https://chromium-review.googlesource.com/638050 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
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 81c2e253 2017-09-09T23:32:46 Add top-level dirty bits for texture and samplers. These will have to be fleshed out in the back-ends. Also currently uses a single bit for all the bindings, and we can extend this to more fine-grained updates in the future. This patch implements top-level updates for texture completeness. Sampler completeness caches are removed from the Texture class, and replaced by a cache in the gl::State class. The State class also keeps a channel binding to the bound textures so it can be notified when textures might change from complete <-> incomplete. In future CLs we skip updating back-ends if texture state doesn't change. BUG=angleproject:1387 Change-Id: If580b4851303c86f3240e62891f5f6047eefb6a2 Reviewed-on: https://chromium-review.googlesource.com/648053 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill fe8b5989 2017-09-07T17:00:18 Program: Fixed unreferenced Samplers. The calculation for unreferenced was incorrect - it checked the 'used' flag of the uniform location, but if samplers started at index zero, all the unused uniforms were to be considered valid samplers. Instead, initialize the uniform index to INVALID_INDEX. This bug was uncovered after doing work on the Texture dirty bits. BUG=angleproject:1387 Change-Id: I5e404e367caed38368bcc0e581699ae2c911bcc9 Reviewed-on: https://chromium-review.googlesource.com/655930 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill be5e2ec3 2017-08-31T13:28:28 Remove uniform memory copy from GL front-end. This moves the uniform query to the back-end. In D3D, this requires a bit more redesign, especially for matrix uniforms. Gives about a 10% speed improvement in the GL/NULL uniforms stress test on Windows (UniformsBenchmark.Run/gl_null_400_vec4). BUG=angleproject:1390 Change-Id: Idac22a77118e9e94d2f28c585e31ff0bc785ba94 Reviewed-on: https://chromium-review.googlesource.com/623929 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@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>
Martin Radev 4e619f58 2017-08-09T11:50:06 Add branch for viewport or layer selection in VS The patch extends the behavior of SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER so that either the viewport or layer is selected based on the value of the internal uniform variable MultiviewRenderPath. BUG=angleproject:2062 TEST=angle_end2end_tests TEST=angle_unittests Change-Id: Ia311b12b1fed642dac78eba8732e2535242f34fd Reviewed-on: https://chromium-review.googlesource.com/615260 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
jchen10 880683b1 2017-04-12T16:21:55 ES31: Add glGetProgramResourceiv API Add API entry and validation checks(GLES 3.1 section 7.3). Add the first 2 interfaces(PROGRAM_INPUT and PROGRAM_OUTPUT) implementation. BUG=angleproject:1920 TEST=angle_end2end_tests:ProgramInterfaceTestES31.* Change-Id: I50057f7b99f4dc7c23ca87fa9b797ca424f66e3d Reviewed-on: https://chromium-review.googlesource.com/475075 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Martin Radev 8f276e25 2017-05-30T12:05:52 Handle multiview Draw* calls Because the ANGLE_multiview extension uses instancing to multiply geometry for each view, Draw* calls with an active multiview program have to be handled in the follwing way: 1) Convert non-instanced Draw calls to their instanced versions. 2) Multiply the number of instances in an instanced Draw call by the number of views. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: I19119e8178f70336e5dbb1e5eed0658b5b9f43d7 Reviewed-on: https://chromium-review.googlesource.com/593657 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Martin Radev <mradev@nvidia.com>
Jamie Madill 23176cea 2017-07-31T14:14:33 Fix performance regression in stream init. Regressed: https://chromium-review.googlesource.com/531798 This was because the std::stringstream constructor was being called every draw call, for the InfoLog of the dynamically recompiled shaders in the D3D back-ends. The constructor was allocating memory and freeing it on destruction. Instead use a lazy init for the std::stringstream in InfoLog like we do for Error. BUG=chromium:750685 Change-Id: I9cd429ae4e1439ae504943a9cad31cbbed17ef32 Reviewed-on: https://chromium-review.googlesource.com/594629 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>
Yuly Novikov caa5cda0 2017-06-15T21:14:03 Validate uniforms and attributes name conflicts when linking Uniforms and attribute names have global scope, according to: GLSL 1.017 sections 4.2.6, 4.3.3 and 4.3.4. Thus, they can't have same names. BUG=angleproject:2014 Change-Id: Ibeb064aca877e404a67b9e3e9b57a0cc42e86f9f
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 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>
Corentin Wallez db9e5d31 2017-06-12T12:05:45 D3D11: Only apply attachments that are written by the program This works around a bug in the AMD driver that writes 0's to the first attachment if it isn't written by the pixel shader. BUG=angleproject:2048 Change-Id: I384fd60c0e0a37fbc0fd7b69fe1ec74fe4ffac8f Reviewed-on: https://chromium-review.googlesource.com/531630 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 4928b7ca 2017-06-20T12:57:39 Proliferate gl::Context everywhere. This gives the D3D back-end access to the GL state almost anywhere. This uses the onDestroy hook for Textures to push errors up from destructors, although they still don't quite make it to the Context. There are places, such as in EGL object (Context/Surface) destruction, where we end up calling through to GL implementation internals without having access to a gl::Context. We handle this via a proxy Context to a Display, basically a null context, that has access to impl-side state like the Renderer pointer if necessary. It does not have access to the normal GL state. Also Pass gl::Context to RefCountObject::release(). Since we're using destroy() methods now, we should not ever call the destructor directly. BUG=angleproject:1156 Change-Id: Ie4c32ad6bf6caaff0289901f30b5c6bafa2ce259 Reviewed-on: https://chromium-review.googlesource.com/529707 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 34ca4f5b 2017-06-13T11:49:39 Remove Shader::getSemanticIndex. This method doesn't really belong to GL, and was only used by the D3D back-end to compute some attribute indexes. Simplify the code by moving it into ProgramD3D. Also add the ability for the ShaderImpl to assert that any pending compiles have resolved. BUG=angleproject:1156 Change-Id: I0af3d3082ff8c908e6a87b9734989efbefd28808 Reviewed-on: https://chromium-review.googlesource.com/526336 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 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>
Jamie Madill bd044ed8 2017-06-05T12:59:21 Defer shader compiles when possible. When using the program binary memory cache inside ANGLE, this will give a potential fast path. If the user doesn't query the shader compile status or info log before calling LinkProgram, then we can check the program cache before translating the program, and if it finds a hit, we don't even need to call the translator. To preserve the shader settings at compile time, a reference to the current shader translator is kept in a binding pointer on the call to compile. This mirrors a similar implementation in Chromium's command buffer. Also the compile options and source are cached at compile to preserve the correct shader state. BUG=angleproject:1897 Change-Id: I3c046d7ac8c3b5c8cc169c4802ffe47f95537212 Reviewed-on: https://chromium-review.googlesource.com/517379 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Frank Henigman fccbac2c 2017-05-28T17:29:26 Validate precision in uniform blocks for WebGL. In WebGL mode turn on checking that precision qualifiers match in corresponding vertex/fragment uniform blocks. Add test for this behavior. BUG=angleproject:2015 Change-Id: Ie035138e8c46e430bdcf8fb5bbc3e0a3ab7d6391 Reviewed-on: https://chromium-review.googlesource.com/517724 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez e7557744 2017-06-01T13:09:57 WebGL compatibility: remove UB for draw buffers in the GL backend. WebGL adds two rules: - Fragment outputs declared but not written to should default to black. - FBO attachments for outputs not declared in the shader should not be written to (it is UB in OpenGL ES). Fix the first one by using the SH_INIT_OUTPUT_VARIABLES compiler options, and the second one by messing with glDrawBuffers so that the enabled draw buffers are always a subset of the ones declared by the shader. BUG=angleproject:2048 Change-Id: I1d851c190959c1acfc3e41d837e6990aec1d4086 Reviewed-on: https://chromium-review.googlesource.com/521682 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang e0cff190 2017-05-30T13:04:56 Validate that fragment shader output matches the draw buffer type. TEST=conformance2/rendering/fs-color-type-mismatch-color-buffer-type BUG=angleproject:1688 Change-Id: I17848baf40b6d32b5adc1458fe2369b850164da3 Reviewed-on: https://chromium-review.googlesource.com/518246 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 6de51858 2017-04-12T09:53:01 Optimize angle::BitSetIterator. Adds a new custom bitset template to handle packing as many bits as possible into a single variable. Intelligently select the right class depending on platform features and bit sizes. For now, always use a packed 64-bit set on 64-bit, instead of using a 32-bit set for smaller bitsets. BUG=angleproject:1814 Change-Id: I3ffef815c15515555833f6fc9302d8a4eee5423b Reviewed-on: https://chromium-review.googlesource.com/471827 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill c1d770e8 2017-04-13T17:31:24 Refactor remaining GLES 2.0 entry points. This will pave the way for several features, like auto-generation. BUG=angleproject:747 Change-Id: Ic390ac412f4e6b61346629093f185a4c07ea0284 Reviewed-on: https://chromium-review.googlesource.com/474118 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
jchen10 a9042d3c 2017-03-17T08:50:45 ES31: Add array element transformfeedback This enhances the PackedVarying to be either one element of array, or whole array. Correspondingly the VaryingPacking is expanded to pack it properly. BUG=angleproject:1950 Change-Id: I0529d7ac4367d42b2b433410fbf08351412aada8 Reviewed-on: https://chromium-review.googlesource.com/459115 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
jchen10 eb8abb0a 2017-04-11T08:30:38 Remove unused declaration isValidResourceIndex in Program.h is unused. BUG=angleproject:1920 Change-Id: Ide097348fac7ed97a0e07f3d97d7944ac997f71d Reviewed-on: https://chromium-review.googlesource.com/474229 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
jchen10 fd7c3b52 2017-03-21T15:36:03 ES31: Add glGetProgramResourceName API Add API entry and validation checks(GLES 3.1 section 7.3). Add the first 2 interfaces(PROGRAM_INPUT and PROGRAM_OUTPUT) implementation. BUG=angleproject:1920 Change-Id: Ide7d5ad40a611a091c3dffab47fd31da57b69f1d Reviewed-on: https://chromium-review.googlesource.com/457523 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Yunchao He 61afff14 2017-03-14T15:34:03 ES31: Add PROGRAM_SEPARABLE to ProgramParameter and GetProgram BUG=angleproject:1939 TEST=angle_end2end_tests Change-Id: I97ad11360f7c015947a2c0cc7d4a47f994726834 Reviewed-on: https://chromium-review.googlesource.com/454264 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 48fed633 2017-03-16T12:05:30 Set sampler uniform values from binding qualifiers The usual set uniform call is used to set initial sampler uniform values based on binding layout qualifiers. This is the simplest way to ensure that the uniform values are set correctly in both internal data structures of the Program class and on the different backends. This is done as one of the last steps of program linking. TEST=dEQP-GLES31.functional.uniform_binding.sampler* BUG=angleproject:1442 Change-Id: I2f58c98e175f6a10a90042050f4fcbea77ad97ac Reviewed-on: https://chromium-review.googlesource.com/456597 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>