src/tests/compiler_tests/GeometryShader_test.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi 6f80f0f0 2022-08-06T02:29:19 Translator: Clean up the compile flag passing interface Historically, compile flags were sent to the translator as a bitmask. Recently, we were getting close to running out of bits. Additionally, direct-to-metal work had started to introduce constants to be passed to the translator, which were misplaced in ShBuiltInResources and Caps. Recent work on Pixel Local Storage adds even more constants, aggravating the situation. In this change, the interface to passing compile flags is reworked. A struct is passed (instead of a bitmask) that has one bit for each flag. This can be indefinitely extended. Additionally, the constants needed by metal and PLS are also placed in this struct. In turn, the backends can set these options directly, and don't have to hack them into Caps to further get hacked into ShBuiltInResources. Bug: angleproject:7559 Change-Id: If93f1e1b8818ad3a0ac708ab04ab93b4b397d114 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3812562 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Cody Northrop e10803f7 2022-01-20T09:03:55 Compiler: Allow deferred array sizing in geometry shaders Based on work by Brandon Schade <b.schade@samsung.com>. When a shader sets an array input size in a GS after declaring input variables, compilation would fail. Example shader - in vec3 normal[]; in vec3 view_dir[]; in float patch_dist[]; in float e_patch_wire_scale[]; ... layout(triangles) in; layout(triangle_strip, max_vertices=3) out; void main() { ... Update translator to handle such cases. Also add a new check that there are no remaining unsized arrays when compilation has completed. Test: GeometryShaderTest.DeferredSetOfArrayInputSize Bug: angleproject:3571 Bug: angleproject:7125 Change-Id: I4853832c27f9551284bcca92b98cbf5f3a63aaf5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3564259 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi 157ddfdc 2021-01-06T23:20:36 Build compiler_tests only if GLSL or ESSL build is enabled Most of these tests use TranslatorGLSL or TranslatorESSL (often through ShaderCompileTreeTest). In specialized builds that disable GLSL and ESSL shader generation, disable these unit tests. Bug: chromium:1161513 Change-Id: Ib87e651706f141a41ffdaebfb0cbe5168582e341 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2613202 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 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>
Jiawei Shao e41df655 2018-02-09T14:31:39 ES31: Add shader version check for CS and GS This patch adds the missing check on the shader version for compute and geometry shaders, which can fix a bug that ANGLE GLSL compiler doesn't report a compile error when compiling an empty compute or geometry shader in version 100 or 300. This patch also updates the original compiler tests on the check of shader version. In these tests, the compile errors are all caused by illegal layouts instead of shader versions, which is against the purpose of the tests. This patch also fixes an incorrect case that used an empty compute shader in version 300. BUG=angleproject:1442, angleproject:1941 TEST=angle_unittests Change-Id: Ic26bb8eb312dbc0cec6a879997d0ae7a2e625a0f Reviewed-on: https://chromium-review.googlesource.com/910715 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jiawei Shao 492b5f51 2017-12-13T09:39:27 ES31: Support struct arrays as Geometry Shader inputs This patch adds the support of struct arrays as valid geometry shader user-defined inputs. Struct arrays are accepted as geometry shader inputs to match the vertex shader outputs that are also declared as structs. BUG=angleproject:1941 TEST=angle_unittests Change-Id: I0b5d545b10e9dda576a1c96d7c93ec2450611e9e Reviewed-on: https://chromium-review.googlesource.com/823622 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
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>
Olli Etuaho 7caa80e7 2017-11-14T15:03:14 Edit tests to reference temporary variables The shader translator is intended to prune unreferenced variables in the future. To maintain test coverage when this is done, most tests that used to have unreferenced GLSL locals and globals are edited to use built-ins or reference the necessary variables instead. BUG=angleproject:2166 TEST=angle_unittests, angle_end2end_tests Change-Id: I3964e7a80d52fc04a95f57e73da6095e433095e8 Reviewed-on: https://chromium-review.googlesource.com/768740 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jiawei Shao 0e883134 2017-10-26T09:53:50 ES31: Support EXT_geometry_shader in GLSL compiler This patch intends to support "EXT_geometry_shader" as a valid extension string in ANGLE GLSL compiler. We decide to support it because in dEQP-GLES31 all geometry shader related tests are using "EXT_geometry_shader" instead of "OES_geometry_shader". 1. Support new extension string "EXT_geometry_shader" 2. Enable geometry shader layout qualifiers with EXT_geometry_shader 3. Enable geometry shader builtins with EXT_geometry_shader BUG=angleproject:1941 TEST=angle_unittests Change-Id: Iaedd01a9100ccf56243c957db36ff0c983d17060 Reviewed-on: https://chromium-review.googlesource.com/737933 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 6bb4f501 2017-10-31T14:54:00 Fix MSVS 2015 compilation of tests "GLenum" needs to be prefixed to disambiguate between global GLenum and sh::GLenum. TEST=compile with MSVS 2015 Change-Id: I31a13c8d410bf32c4d5114c03f4b119aae256778 Reviewed-on: https://chromium-review.googlesource.com/746761 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jiawei Shao 65c56dd9 2017-10-13T16:18:57 Fix incorrect hashing on built-in interface block fields This patch intends to fix an error in translating built-in interface block fields. Any field of a built-in interface block should be kept and cannot be hashed. This patch can fix a bug in handling the interface block gl_in when we try to output the translated geometry shader string. BUG=angleproject:1941 TEST=angle_unittest Change-Id: Iebfba4b6a30c8942ed0f66131ad30d12ad96c62a Reviewed-on: https://chromium-review.googlesource.com/719454 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 454c34cb 2017-10-25T16:35:56 Accept valid geometry shader inputs regardless of syntax Before, only the following style of declarations were accepted: in float f[]; Now also these styles are accepted: in float[] f; in float f[], g[]; BUG=angleproject:2201 TEST=angle_unittests Change-Id: I0af7d355a5e06a67ceef2d6bd69af7e23c180a04 Reviewed-on: https://chromium-review.googlesource.com/738234 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jiawei Shao 8e4b355b 2017-08-30T14:20:58 ES31: Implement Geometry Shader inputs and outputs This patch intends to implement Geometry Shader inputs and outputs in ANGLE GLSL compiler. 1. Only accept arrays as the inputs of a Geometry Shader. 2. Allow unsized arrays as the inputs of a Geometry Shader after a valid input primitive declaration and assign size to them. 3. Implement Geometry Shader outputs. 4. Allow Geometry Shader inputs and outputs using interpolation qualifiers ('flat', 'smooth', 'centroid'). 5. Allow using 'location' layout qualifier on Geometry Shader inputs and outputs. BUG=angleproject:1941 TEST=angle_unittests Change-Id: Ia7e250277c61f45c8479437b567c2831ff26b433 Reviewed-on: https://chromium-review.googlesource.com/650211 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jiawei Shao d27f5c8d 2017-08-23T09:38:08 ES31: Implement GL_OES_geometry_shader built-ins in GLSL compiler This patch intends to implement all built-in constants, variables and functions defined in OpenGL ES 3.1 extension GL_OES_geometry_shader in ANGLE GLSL compiler. 1. Add all built-in constants defined in GL_OES_geometry_shader. 2. Add built-in functions EmitVertex() and EndPrimitive() required in Geometry Shader. 3. Add built-in variables gl_PrimitiveIDIn and gl_InvocationID to Geometry Shader. 4. Add built-in variables gl_PrimitiveID and gl_Layer to both Geometry Shader and Fragment Shader when GL_OES_geometry_shader is enabled. BUG=angleproject:1941 TEST=angle_unittests Change-Id: I92821553ed0efee2ccb77fead6e065e7799819d0 Reviewed-on: https://chromium-review.googlesource.com/627670 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jiawei Shao d8105a03 2017-08-08T09:54:36 ES31: Implement gl_in in Geometry Shader This patch intends to implement geometry shader built-in interface block instance gl_in defined in GL_OES_geometry_shader. 1. Add the definition of gl_in and its interface block gl_PerVertex into the symbol table. 2. Support gl_Position as a member of gl_in. 3. Set the array size of gl_in when a valid input primitive type is known. 4. Add check that it should be a compile error to index gl_in or call length() on gl_in without a valid input primitive declaration. This patch also adds unit tests to cover all these new features. BUG=angleproject:1941 TEST=angle_unittests Change-Id: I8da20c943b29c9ce904834625b396aab6302e1e1 Reviewed-on: https://chromium-review.googlesource.com/605059 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Shao b5cc1198 2017-07-06T10:47:20 ES31: Add Geometry Shader layout qualifiers in GLSL compiler This patch intends to implement Geometry Shader layout qualifiers required in OpenGL ES 3.1 extension GL_OES_geometry_shader in ANGLE GLSL compiler. 1. Add support to the shader type GL_GEOMETRY_SHADER_OES. 2. Implement Geometry Shader layout qualifiers in the GLSL compiler: (1) Add support to OpenGL ES 3.1 extension "GL_OES_geometry_shader". (2) Add validations of the input and output primitive declarations in the Geometry Shader layout declarations. (3) Add 'invocations' and 'max_vertices' support in the Geometry Shader layout declarations 3. Add unit tests to cover all the new features added in this patch. BUG=angleproject:1941 TEST=angle_unittests Change-Id: Ie693e11f8a00dab3552626ed63e9336c7fbd3cb8 Reviewed-on: https://chromium-review.googlesource.com/560647 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>