src/libANGLE/Compiler.cpp


Log

Author Commit Date CI Message
Lingfeng Yang e05ffdd1 2018-02-19T13:24:17 GLES1: caps: Use GLES3 spec shader compiler If we attempt to compile the GLES1 emulation shader when the client version is 1, we use the webgl 1 / GLES2 spec, not the GLES3 spec that we use for GLES1 emulation. This CL adds a case in Compiler.cpp for ES 1 contexts to use the higher spec shader compiler. BUG=angleproject:2306 Change-Id: I86fe534dd405279155bd81680fed77b8f9a09042 Reviewed-on: https://chromium-review.googlesource.com/925548 Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Lingfeng Yang <lfy@google.com>
Jiawei Shao bd924af1 2017-11-16T15:28:04 ES31: Remove support of GL_OES_geometry_shader in compiler This patch intends to remove the support of GL_OES_geometry_shader in ANGLE compiler. To make the implementation simpler, currently we decide to only support "GL_EXT_geometry_shader" as the extension string of geometry shader in ANGLE. This patch also updates all the related shaders in angle_unittests into R"()" format. BUG=angleproject:1941 TEST=angle_unittests Change-Id: Ife9858abeedfb46b02c5c2fb1cda16fa27198511 Reviewed-on: https://chromium-review.googlesource.com/773451 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiawei Shao 361df070 2017-11-22T09:33:59 ES31: Implement Geometry Shader resource queries on OpenGL This patch intends to implement all geometry shader related resource queries on OpenGL back-ends. This patch also fixes a memory leak by releasing the geometry shader compiler handle in the destructor of the Compiler. BUG=angleproject:1941, angleproject:2261 TEST=angle_end2end_tests Change-Id: Ieb69c162d2fc6c6550e145d1ec7948c3d36d4d15 Reviewed-on: https://chromium-review.googlesource.com/784552 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@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>
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>
Martin Radev 84aa2dcf 2017-09-11T15:51:02 Add textureGather and textureGatherOffset The patch adds new built-ins and extends the semantic parser to add support for textureGather and textureGatherOffset. BUG=angleproject:1442 TEST=angle_unittests TEST=angle_deqp_gles31_tests.exe --deqp-case=dEQP-GLES31.functional.texture.gather* --deqp-egl-display-type=angle-gl Change-Id: Iaf98c3420fbd61193072fdec8f5a61ac4c574101 Reviewed-on: https://chromium-review.googlesource.com/660124 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 71c88b31 2017-09-14T22:20:29 Enable [[nodiscard]] for gl::Error. This forces all return values to be checked for gl::Error. Requires quite a bit of minor refactoring. I also added a macro to swallow an error without returning from a function. We could look at storing the errors in the Context at some point, since almost always when we're generating errors that we need to discard we have access to the Context as a parameter. BUG=angleproject:2150 Change-Id: I457e48a30c002eda0993acbcd3180ba87bf169fb Reviewed-on: https://chromium-review.googlesource.com/665173 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Corentin Wallez 13c0dd46 2017-07-04T18:27:01 Add texture rectangle extension. This is needed to support binding IOSurfaces to textures on OSX. This commit adds support in the API and tests, but didn't need to implement compiler changes as it already supported ARB_texture_rectangle. Implementation of CHROMIUM_opy_texture for rectangle texture and the spec are left for follow-up commits. Change-Id: I45c66be763a9d3f6f619640f9f95f39b05c70867 Reviewed-on: https://chromium-review.googlesource.com/559106 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho ab918821 2017-07-14T17:03:42 Clamp point size to maximum point size from the API on NVIDIA NVIDIA OpenGL drivers have a bug where the point size range is being reported incorrectly - it appears the core GL driver incorrectly gives the range for smooth points, when it should be giving the range for aliased points. Clamp the actual point size to the maximum point size reported from the API so that the GLES spec is followed. The same workaround seems to be necessary also on Android. The issue was revealed by the trybots, and has not been fully diagnosed though. The newly added test fails on AMD OpenGL. As a part of this change, the existing tests in PointSpritesTest are refactored to use gl_raii. BUG=chromium:740560 TEST=angle_end2end_tests Change-Id: Ic4a66c9ea16f5ae76beb3bb6577716d10c3b226e Reviewed-on: https://chromium-review.googlesource.com/574598 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Martin Radev 318f9aa5 2017-05-17T17:47:28 Initialize ANGLE_multiview caps and workaround state The patch checks whether ANGLE_multiview can be supported in the OpenGL renderer, updates the caps and adds a workaround field to enable multiview support through the NV_viewport_array2 extension. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: I99dae10564db7bcca41d7624f8de272c1d996e09 Reviewed-on: https://chromium-review.googlesource.com/567934 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
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 2f348d2a 2017-06-05T10:50:59 Make gl::Compiler reference-counted. This is helpful for implementing program binary caching in ANGLE. in order to maintain the current behaviour in Chrome, we will need to defer shader compilation until link time. Since WebGL allows the app layer to enable and disable extensions explicitly, the app can enable or disable an extension between the calls to glCompileShader and glLinkProgram. Then, if we're deferring shader compilation, we will have to preserve the extension settings at the time of the call to compile, not the current settings at the time of link. Making the compiler reference-counted gives us a pretty simple and robust solution. This also changes the Context class to lazily init the shader compiler. Lazy init prevents any unexpected nulls, and also ensures the releaseShaderCompiler does exactly that: just releases the shader compiler, and does not immediately re-initialize it. BUG=angleproject:2044 Change-Id: I0f0eeb4eb94dc4eee238f92482804a0921c77df0 Reviewed-on: https://chromium-review.googlesource.com/522868 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
jchen10 af713a24 2017-04-19T09:10:56 ES31: Implement binding layout for uniform blocks The binding point of uniform blocks can be specified in shaders with this CL. See spec ESSL 3.10, section 4.4.4, page 58 for more info. dEQP-GLES31.functional.ubo.* still can't completely pass as the missing of arrays-of-arrays feature. Neither can dEQP-GLES31.functional.layout_binding.ubo.* due to the incomplete implementation of program interface APIs. TEST=angle_end2end_tests:UniformBufferTest BUG=angleproject:1442 Change-Id: If95d468fc109834a132b9b817730d3fdc3a615da Reviewed-on: https://chromium-review.googlesource.com/483848 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 6ca2b65c 2017-02-19T18:05:10 Implement location layout qualifier for uniforms This is a complete implementation of the uniform location layout qualifier. Uniform location set in the shader is plumbed to shader linking, which does several link-time checks for conflicts and recursively applies the location to struct members. Validate that location is consistent as specified in the table in section 9.2.1 of the ESSL 3.10.4 spec. The location set in the shader overrides the one set via the CHROMIUM_bind_uniform_location API. Location conflicts must be checked even if the uniforms are not statically used. Because of this unused uniforms are now recorded during uniform linking. After linking checks are done, unused uniforms are pruned from the program state. Location is validated against the maximum number of uniform locations at compile time as specified in section 4.4.3 of the ESSL 3.10.4 spec. All dEQP uniform location tests don't yet pass due to unrelated bugs. BUG=angleproject:1442 TEST=angle_end2end_tests, dEQP-GLES31.functional.uniform_location.* Change-Id: I1f968e971f521fbc804b01e1a7c2b4d14f24d20f Reviewed-on: https://chromium-review.googlesource.com/447942 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Bryan Bernhart 58806567 2017-01-05T13:09:31 Apply max draw buffer limit for WebGL shaders. For WebGL, using native caps incorrectly sets gl_MaxDrawBuffers. This change always applys the limit for compatible shaders. BUG=angleproject:1523 Change-Id: Ie956f4b9fdd10bdf9276ae08eaeb49e65690185b Reviewed-on: https://chromium-review.googlesource.com/425477 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill e794cd86 2017-01-13T17:29:51 Vulkan: Implement new GLSL translator back-end. The Vulkan GLSL translator back-end will handle validating and translating our WebGL/ESSL shaders into Vulkan-specific GLSL. glslang (the Vulkan one) accepts both GLSL and GLSL ES shaders as inputs, and both the desktop and ESSL back-ends give incompleteness warnings when used. For now, use the desktop GL 450 as a target for Vulkan GLSL. The Vulkan-specific changes are currently only to add locations to every vertex input and fragment output. BUG=angleproject:1575 Change-Id: I7c3f32f522e9d18e5f8618eb7927336bf4fbdcf2 Reviewed-on: https://chromium-review.googlesource.com/412266 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
He Yunchao acd1898e 2017-01-04T10:46:42 Replace Error(GL_NO_ERROR) with NoError(). In order to make the errors be consistent throughout ANGLE. BUG=angleproject:1686 Change-Id: I0a2d86091d640aedeac94beae345c1fb6971b00d Reviewed-on: https://chromium-review.googlesource.com/424835 Commit-Queue: Yunchao He <yunchao.he@intel.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill acb4b81a 2016-11-07T13:50:29 translator: Put ShaderLang APIs in "sh" namespace. Working with glslang in Vulkan means we are static linking libANGLE with functions that have the same name as our translator APIs. We can fix this by scoping our APIs. We don't need to scope the types of the file, since they don't conflict. This will require a follow-up patch to remove the unscoped APIs once we switch over Chromium. We also scope TCompiler and some related classes to avoid multiply defined link errors with glslang. BUG=angleproject:1576 Change-Id: I729b19467d2ff7d374a82044b16dbebdf2dc8f16 Reviewed-on: https://chromium-review.googlesource.com/408337 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Bryan Bernhart 87c182e1 2016-11-02T11:23:22 Enable shader validation with WebGL compatibility extension. The change configures shaders to be of a compatible spec upon creation. BUG=angleproject:1523 Change-Id: Id345d0b8f0abad8ed3c4fb3117d0fdfeab9fea53 Reviewed-on: https://chromium-review.googlesource.com/405778 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Martin Radev 4c4c8e72 2016-08-04T12:25:34 Add compute program compilation and linking support Compute shaders can be now compiled and linked to create programs. Some tests are added to verify successful and unsuccessful compute shader linking. The patch also replaces std::array<int, 3> with a custom struct WorkGroupSize. BUG=angleproject:1442 TEST=angle_end2end_tests TEST=angle_unittests Change-Id: I4ab0ac05755d0167a6d2a798f8d7f1516cf54d84 Reviewed-on: https://chromium-review.googlesource.com/366740 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Martin Radev e93d24ef 2016-07-28T12:06:05 Add es3.1 shader constants The patch adds all shader built-in constants. BUG=angleproject:1442 TEST=angle_unittests TEST=angle_end2end_tests Change-Id: I81cae479d6506a8faa2dce023d5fcc2c1291d521 Reviewed-on: https://chromium-review.googlesource.com/364460 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Martin Radev 1be913cf 2016-07-11T17:59:16 Add support for ES31 context creation The dEQP test for context creation passes. SH_WEBGL3_SPEC has been added, but it should be considered whether we should keep it, remove it or rename it. It was added so that there is a webgl mapping to es 310 shaders. Check Compiler.cpp. The bison file has been modified so that some tokens from es3 can be also used in es31 as well. A separate macro ES3_1_ONLY is added so that some tokens are limited only for es 310 shaders. BUG=angleproject:1442 TEST=angle_unittests Change-Id: I2e5ca227c96046c30dc796ab934f3fda9c533eba Reviewed-on: https://chromium-review.googlesource.com/360300 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 29f908bf 2016-07-19T23:21:01 Revert "Support EXT_blend_func_extended in the GLES2 context" Test failures on Intel Release: https://build.chromium.org/p/chromium.gpu.fyi/builders/Win7%20Release%20%28New%20Intel%29/builds/1163 Also Intel Debug: https://build.chromium.org/p/chromium.gpu.fyi/builders/Win7%20Debug%20%28New%20Intel%29/builds/820 Also NVIDIA with a different config: https://build.chromium.org/p/chromium.gpu.fyi/builders/Win7%20Release%20%28NVIDIA%20GeForce%20730%29/builds/1564 BUG=angleproject:1379 This reverts commit 7f539ea52e6bc493d8e025ed2c43e10f606f088b. Change-Id: I2634ad2b3fcc31e1e5ffb3674b94cb0aed9fd773 Reviewed-on: https://chromium-review.googlesource.com/361840 Reviewed-by: Jamie Madill <jmadill@chromium.org>
Sami Väisänen 7f539ea5 2016-05-20T13:29:08 Support EXT_blend_func_extended in the GLES2 context BUG=angleproject:1379 Change-Id: Ibda6e84c0a7f86e838247cd5c538ef956dd786fe Reviewed-on: https://chromium-review.googlesource.com/346410 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Sami Väisänen <svaisanen@nvidia.com>
Jamie Madill dfde6abf 2016-06-09T07:07:18 Context: Remove mutable gl::State getter. This will preserve layering - the API layer doesn't mutate the state directly, it passes the API call through to the Context. Is also removes the possiblity of any shenanigans of the Validation layer changing the GL state. Also, this CL refactors a few validation entry points to take ValidationContext instead of Context. ValidationContext will be the correct way to interact with the gl::Context in the Validation code. Finally, additional refactorings make ContextState a proper class with private data. This allows the ContextState itself to keep a mutable pointer to the gl::State, so ValidationContext can modify it if necessary (and it will be necessary for Framebuffer completeness caching). BUG=angleproject:1388 Change-Id: I86ab3561573caa9535c8d1b8aad4ab3d0e7cd470 Reviewed-on: https://chromium-review.googlesource.com/348954 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang b66a9097 2016-05-16T15:59:14 Add support for OES_EGL_image_external and OES_EGL_image_external_essl3. BUG=angleproject:1372 Change-Id: I8489e7fd0ab409b0775041ad5e9fbf0aab53886d Reviewed-on: https://chromium-review.googlesource.com/344734 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jamie Madill 7aea7e05 2016-05-10T10:39:45 Add EGLImplFactory. Also rename ImplFactory to GLImplFactory. This will allow us to use the same factory design pattern for EGL objects, and to use State helper classes to share data with Impls. BUG=angleproject:1363 BUG=angleproject:1369 Change-Id: I07a8fe40838d5d4ca32b04910c306edeab4d25a7 Reviewed-on: https://chromium-review.googlesource.com/342051 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Ian Ewell bda75597 2016-04-18T17:25:54 Finish NV12 support via streams. The main functionality for NV12 texture support through EGL streams has been added. Updates to the compiler, texture code, and stream code were added to support binding to external D3D11 NV12 textures. An end2end test was also added to test sampling of YUV textures and converting to RGB. There is also a new script to convert BMP files to an NV12 texture ready to load into D3D11 for testing purposes. BUG=angleproject:1332 Change-Id: I39b6ec393ea338e2c843fb911acc1b36cd1158a0 Reviewed-on: https://chromium-review.googlesource.com/339454 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Ian Ewell <ewell@google.com> Reviewed-on: https://chromium-review.googlesource.com/341254 Reviewed-by: Ian Ewell <ewell@google.com>
Corentin Wallez 9670b03e 2016-04-29T09:47:47 Revert "Finish NV12 support via streams." Broke Windows Clang compilation, see https://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Win%20Clang%20Builder%20%28dbg%29/builds/3583/steps/compile/logs/stdio and search for TextureStorage11.h This reverts commit 9b8b359fa3615be7c7492239a48f61103b2e4fcc. Change-Id: I6e54305eba02b40927a35577594df39e951adb32 Reviewed-on: https://chromium-review.googlesource.com/341430 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 9082b982 2016-04-27T15:21:51 Rename gl::Data to gl::ContextState. Part of the new world order of renaming the Obj::Data classes to ObjState. BUG=angleproject:1363 Change-Id: I15cf002b8b093d687f540b9e86f045874af24a7e Reviewed-on: https://chromium-review.googlesource.com/340740 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Ian Ewell 9b8b359f 2016-04-18T17:25:54 Finish NV12 support via streams. The main functionality for NV12 texture support through EGL streams has been added. Updates to the compiler, texture code, and stream code were added to support binding to external D3D11 NV12 textures. An end2end test was also added to test sampling of YUV textures and converting to RGB. There is also a new script to convert BMP files to an NV12 texture ready to load into D3D11 for testing purposes. BUG=angleproject:1332 Change-Id: I098940e6f25e113dcc4fc8d22ffed4b5a16fd860 Reviewed-on: https://chromium-review.googlesource.com/339454 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Ian Ewell <ewell@google.com>
Jamie Madill 83f349ea 2015-09-23T09:50:36 Remove CompilerImpl and merge code to gl::Compiler. This class uses no Impl-specific code. We can also do a similar code relocation for the gl::Shader class, but in several steps because it is a bit more complex. BUG=angleproject:1159 Change-Id: I4d3ce3253df0a2bdee1d98e46cfd4b999d86be6e Reviewed-on: https://chromium-review.googlesource.com/299874 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 492a7e43 2014-11-05T13:27:06 Encapulate the ESSL compiler into a GL object that is per-context. * Allows for multiple contexts have to have different client versions, caps and extensions without causing shader compilation failures. BUG=angle:823 Change-Id: I523679e90be031b0b7fa385d46d6839b1cf3029f Reviewed-on: https://chromium-review.googlesource.com/227710 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>