src/compiler/translator/UtilsHLSL.cpp


Log

Author Commit Date CI Message
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>
Natasha Lee 75d577fb 2019-02-04T16:28:28 Fixed Bug where array initialized with same name of previously declared variable fails on DirectX. Combined user defined variables with their unique ids to avoid overwriting same name variables of different scope. Bug: angleproject:2126 Change-Id: If9ad9e48f629d83b105d43ee28a50b8176d0e0a1 Reviewed-on: https://chromium-review.googlesource.com/c/1456484 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Xinghua Cao f3179a6a 2018-07-12T16:22:06 ES31: Implement bindImageTexture binds a single layer on D3D backend Dynamically generate image2D variables' declaration and function definition in libANGLE. Bug: angleproject:1987 TEST=angle_end2end_tests.ComputeShaderTest.* Change-Id: Idacc756f7bd15f22eccb1d689e18e997f3e74159 Reviewed-on: https://chromium-review.googlesource.com/c/1142885 Commit-Queue: Xinghua Cao <xinghua.cao@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Brandon Jones 4a22f4b0 2018-10-23T14:36:47 ES31: Add atomic_uint support to HLSL translator This is the first commit in a series to enable atomic counter buffers. Adds support for atomic counters to the GLSL->HLSL translator using RWByteAddressBuffer. Bug: angleproject:1729 Test: angle_end2end_tests Change-Id: I3b7e08f9256dc9bdbcc02ad8910040f2bc14aeac Reviewed-on: https://chromium-review.googlesource.com/c/1291329 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 2da04538 2018-08-24T13:59:44 Add sampler2DMSArray support to HLSL output This is done with small adjustments to TextureFunctionHLSL. Most of the functionality was already in place before. This changes the categorization of sampler types in BasicTypes.h helper functions: 2D array samplers are no longer treated as 2D samplers, but the two categories are now entirely disjoint. This makes TextureFunctionHLSL a little bit simpler. BUG=angleproject:2775 TEST=angle_unittests, angle_end2end_tests Change-Id: I84d9b56c37b1aaa01ee5921b6f17f8a78698fce2 Reviewed-on: https://chromium-review.googlesource.com/1188562 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 40b1c770 2018-03-19T10:29:37 Fix asserts related to writing nameless parameters in HLSL We rely on TSymbol::name() to generate names also for nameless parameters. Fix asserts to reflect this. BUG=chromium:823041 TEST=angle_unittests Change-Id: Ie9b8253a150e79965bf85d8a7f36643ada6c54cc Reviewed-on: https://chromium-review.googlesource.com/968242 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho d4bd963f 2018-03-08T16:32:44 Don't use TIntermSymbol nodes for function parameters Parameter nodes are not needed - it's simpler to just create a TVariable object for each parameter when the TFunction is initialized. With this change we also store only one object per each parameter type used in built-in functions, instead of one array of TConstParameter entries for each unique parameter sequence. This simplifies code and reduces binary size and compiler memory use. Compiler perf does not seem to be significantly affected. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I2b82400dd594731074309f92a705e75135a4c82c Reviewed-on: https://chromium-review.googlesource.com/955589 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 2f7c04a3 2018-01-25T14:50:37 Clean up unnecessary use of TString TString was being used in some places where it was not really needed. Clean these up. BUG=angleproject:2267 TEST=angle_unittests Change-Id: Ib7fd26f9c6b6b885433c840a9520393908f1f902 Reviewed-on: https://chromium-review.googlesource.com/887068 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Nico Weber b5db2b49 2018-02-12T15:31:56 Enable -Wimplicit-fallthrough for ANGLE. Also teach MSVC that ANGLE_CRASH() can't return. Also fix instances of the warning in build configurations where UNREACHABLE() can return (e.g. release without dcheck_always_on or debug). If the UNREACHABLE()s are truly unreachable, this change has no behavior change. Bug: chromium:810767 Change-Id: I68f3587cf3e268c3ef634dce7ae3d70399859d0f Reviewed-on: https://chromium-review.googlesource.com/914842 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Commit-Queue: Nico Weber <thakis@chromium.org>
Olli Etuaho fbb1c792 2018-01-19T16:26:59 Store symbol names as a ImmutableString This will enable compile-time initialization of built-in symbols as well as reducing copying strings. Most of the code that deals with names is changed to use ImmutableString where it makes sense to avoid conversions. The lexer/parser now allocate const char pointers into pool memory instead of allocating TStrings. These are then converted to ImmutableString upon entering TParseContext. BUG=angleproject:2267 TEST=angle_unittests, angle_end2end_tests Change-Id: I244d6271ea1ecf7150d4f89dfa388a7745a1150c Reviewed-on: https://chromium-review.googlesource.com/881561 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 12c03761 2018-01-25T12:22:33 Resubmit: Use ImmutableString for HLSL texture references This fixes an issue in the original revision of this patch by adding a operator<< to TInfoSinkBase that takes ImmutableString as a parameter. This also adds ImmutableStringBuilder class, which can be used to build ImmutableStrings in place without extra allocations if the maximum length is known in advance. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I52e984657a3aba3e6fe67a82b401c6b8de557d18 Reviewed-on: https://chromium-review.googlesource.com/890522 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill d1434c04 2018-01-29T02:29:53 Revert "Use ImmutableString for HLSL texture references" This reverts commit c13bda8678e86ff75a4acfc94f7a45e58224926d. Reason for revert: May have broken LibFuzzer and AFL builds: https://ci.chromium.org/buildbot/chromium.fyi/Afl%20Upload%20Linux%20ASan/7718 https://build.chromium.org/deprecated/chromium.fyi/builders/Libfuzzer%20Upload%20Linux%20ASan/builds/8691 In file included from ../../third_party/angle/src/compiler/translator/TextureFunctionHLSL.cpp:12: In file included from ../../third_party/angle/src/compiler/translator/TextureFunctionHLSL.h:19: ../../third_party/angle/src/compiler/translator/InfoSink.h:40:16: error: call to function 'operator<<' that is neither visible in the template definition nor found by argument-dependent lookup stream << t; ^ ../../third_party/angle/src/compiler/translator/TextureFunctionHLSL.cpp:111:9: note: in instantiation of function template specialization 'sh::TInfoSinkBase::operator<<<sh::ImmutableString>' requested here out << textureReference; ^ ../../third_party/angle/src/compiler/translator/ImmutableString.h:76:15: note: 'operator<<' should be declared prior to the call site or in namespace 'sh' std::ostream &operator<<(std::ostream &os, const sh::ImmutableString &str); ^ 1 error generated. Bug: chromium:806619 Original change's description: > Use ImmutableString for HLSL texture references > > This also adds ImmutableStringBuilder class, which can be used to > build ImmutableStrings in place without extra allocations if the > maximum length is known in advance. > > BUG=angleproject:2267 > TEST=angle_unittests > > Change-Id: I4dfb78adeb0cffcfad0d25753fb8063466012c92 > Reviewed-on: https://chromium-review.googlesource.com/886362 > Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=jmadill@chromium.org,cwallez@chromium.org,oetuaho@nvidia.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: angleproject:2267 Change-Id: I445f5a786f8b16c3f40f28df09d45fcb215a9c88 Reviewed-on: https://chromium-review.googlesource.com/890542 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho c13bda86 2018-01-25T12:22:33 Use ImmutableString for HLSL texture references This also adds ImmutableStringBuilder class, which can be used to build ImmutableStrings in place without extra allocations if the maximum length is known in advance. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I4dfb78adeb0cffcfad0d25753fb8063466012c92 Reviewed-on: https://chromium-review.googlesource.com/886362 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 8b5e8fdb 2017-12-15T14:59:15 Replace remaining usage of TName with TSymbol TName used to contain just a subset of the information stored in TSymbol. It makes more sense to use TSymbol directly instead of converting it to TName. This also improves type safety a bit by making some functions only take in TVariable or TFunction instead of the more generic TName. BUG=angleproject:2267 TEST=angle_unittests Change-Id: Icb46923c25d33ebbbbc06ddc487da25957dda771 Reviewed-on: https://chromium-review.googlesource.com/829143 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho bed35d76 2017-12-20T16:36:26 Don't query names of empty symbols This makes it possible to return a reference from TSymbol::name() instead of a pointer. This is safer since it completely avoids the possibility of a nullptr dereference. An assert is making sure that the function is not being called for empty symbols. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I44279f65989dbb828322843fc0216ba84d91dedf Reviewed-on: https://chromium-review.googlesource.com/836894 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho beb6dc74 2017-12-14T16:03:03 Always use TFunction instead of TFunctionSymbolInfo This reduces unnecessary memory allocations and conversions between different objects containing the same data. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I87316509ab1cd6d36756ff6af7fa2b5c5a76a8ea Reviewed-on: https://chromium-review.googlesource.com/827134 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho ae4dbf32 2017-12-08T20:49:00 Don't allocate name strings for empty symbols This removes unnecessary memory allocations. BUG=angleproject:2267 TEST=angle_unittests Change-Id: Ide575ea19ab2f8e9fc93092490f1352efa6024a3 Reviewed-on: https://chromium-review.googlesource.com/817415 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 9d4d7f06 2017-12-07T17:11:41 Classify TSymbols using an enum Symbols can be either built-ins, user-defined, nameless, or for ANGLE's internal use. In addition we currently use TFunction symbols that are not yet resolved - they might later resolve to either a built-in or a user-defined function. Record this information in each TSymbol so that TSymbol contains sufficient information for deciding how to format symbol names in output. The goal is to eventually replace current uses of TName with pointers to different TSymbol objects. So far only built-ins and user-defined symbols have associated TSymbol objects, but that will be expanded to cover ANGLE's internal symbols as well. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I927ce023fe257cc236da82c127700f3bd72bfe96 Reviewed-on: https://chromium-review.googlesource.com/816952 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 97fa8557 2017-11-28T16:28:42 Refactor TStructure Move methods and member variables that generalize to different types of field lists into TFieldListCollection and put implementations of methods in cpp files. This prepares for making TStructure inherit from TSymbol. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I63095242dd17aac2d2efd616b49be1143cfc1f92 Reviewed-on: https://chromium-review.googlesource.com/793813 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Xinghua Cao 711b7a12 2017-10-09T13:38:12 ES31: Support images in the compiler on D3D backend. BUG=angleproject:1987 TEST=angle_end2end_tests Change-Id: I83f5f9ffda7e676a8f98b963d1f1c50e9463faf4 Reviewed-on: https://chromium-review.googlesource.com/706247 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 088031e6 2017-07-03T15:59:33 HLSL: Disambiguate between struct function parameters Structs with different names but identical members are treated as ambiguous by the native HLSL compiler when looking up user-defined functions. Add the struct name to the function name to work around this limitation. BUG=chromium:731324 TEST=angle_end2end_tests Change-Id: Ie80ac0f1374bc5ac05dfebef3f94e2da7cdfc581 Reviewed-on: https://chromium-review.googlesource.com/558929 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho ff526f14 2017-06-30T12:26:54 Fix variable vs. function name conflict in HLSL output GLSL ES spec accepts the case where an initializer of a variable calls a function with the same name as the variable. The HLSL compiler doesn't accept that. Work around this limitation in the HLSL compiler by disambiguating user-defined functions from variables with a different prefix. BUG=angleproject:2095 TEST=angle_end2end_test, angle_unittests Change-Id: I41b32a3fcc6fd4c548e8dc3aa680d1b07fcf8719 Reviewed-on: https://chromium-review.googlesource.com/557872 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
jchen10 4cdac9eb 2017-05-08T11:01:20 ES31: Add atomic counter for GLSL parsing This makes shader compiler support the new basic type 'atomic_uint' and validate its layout qualifiers properly. BUG=angleproject:1729 TEST=angle_unittests:AtomicCounterTest angle_deqp_gles31_tests:dEQP-GLES31.functional.atomic_counter.layout.invalid* angle_deqp_gles31_tests:dEQP-GLES31.functional.debug.negative_coverage.*.atomic* Change-Id: Ia237eadf6ea72314f436a0abbb93a05598e71eba Reviewed-on: https://chromium-review.googlesource.com/500088 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho ec9232bd 2017-03-27T17:01:37 Store unmangled function names in the AST This makes the code simpler across the board. There are a few cases where mangled names still need to be generated in AST traversers, but they are outweighed by much leaner output code for all function nodes. BUG=angleproject:1490 TEST=angle_unittests, angle_end2end_tests Change-Id: Id3638e0fca6019bbbe6fc5e1b7763870591da2d8 Reviewed-on: https://chromium-review.googlesource.com/461077 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 92db39e8 2017-02-15T12:11:04 Fix multisample texture operations crashing HLSL generation This includes a partial implementation of multisample texture operations on the HLSL backend. It can't be fully tested yet, since the API side isn't implemented. BUG=angleproject:1442 TEST=dEQP-GLES31.functional.shaders.builtin_functions.texture_size.* (successfully compiles instead of crashing) Change-Id: Ief782db28388a3f8fd8113cc86ce3c4f500f322a Reviewed-on: https://chromium-review.googlesource.com/443264 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill d7b1ab58 2016-12-12T14:42:19 Fix up translator style. Using git cl format. BUG=angleproject:650 Change-Id: I7d3f98d2b0dcfb0a8de6c35327db74e55c28d761 Reviewed-on: https://chromium-review.googlesource.com/419059 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang 28a97ee1 2016-09-22T13:01:26 Generate unique HLSL texture function names for external textures. Because 2D and external textures have the same HLSL texture type, they were generating texture functions with the same name. This causes conflicts when both 2D and external textures are used in the same shader. BUG=angleproject:1534 BUG=645532 Change-Id: I4b324014b7d9b4851d358730cf4e31fc8461584c Reviewed-on: https://chromium-review.googlesource.com/388551 Reviewed-by: Corentin Wallez <cwallez@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>
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>
Olli Etuaho 5858f7e3 2016-04-08T13:08:46 Re-land "Refactor texture function handling in OutputHLSL" This change is pure refactoring, it does not introduce any functional changes. Separate texture function output into a helper class and further into different helper functions to make the code more maintainable. Some of the logic is simplified slightly by eliminating duplicate cases and limiting the scope of variables where possible, but care has been taken to preserve the exact same functionality as before. Re-land with a fix to typo in include guard. BUG=angleproject:1349 TEST=dEQP-GLES3.functional.shaders.texture_functions.* (no regression) dEQP-GLES3.texture.* (no regression) Change-Id: I57c1ec1950fa05bd16275ca578eb5ee99b34a5ae Reviewed-on: https://chromium-review.googlesource.com/339180 Reviewed-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez c2ed9380 2016-04-15T13:29:25 Revert "Refactor texture function handling in OutputHLSL" It triggered an include guard warning on Windows Clang This reverts commit 6f6c5580553d1f3c584df692823c2f5640e23d88. Change-Id: Ibd4f2851f311a494f16376d8eed38f3119594761 Reviewed-on: https://chromium-review.googlesource.com/338933 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 6f6c5580 2016-04-08T13:08:46 Refactor texture function handling in OutputHLSL This change is pure refactoring, it does not introduce any functional changes. Separate texture function output into a helper class and further into different helper functions to make the code more maintainable. Some of the logic is simplified slightly by eliminating duplicate cases and limiting the scope of variables where possible, but care has been taken to preserve the exact same functionality as before. BUG=angleproject:1349 TEST=dEQP-GLES3.functional.shaders.texture_functions.* (no regression) dEQP-GLES3.texture.* (no regression) Change-Id: I5d81b842d693c0055890d5724eae6c105e454cd8 Reviewed-on: https://chromium-review.googlesource.com/337931 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 9696316d 2016-03-21T11:54:33 Support ESSL structs containing samplers on D3D Since HLSL can't natively handle samplers in structs, samplers need to be extracted out of structs into separate variables in the translated shader code. In HLSL 4.1, samplers that were in structs go into the normal sampler arrays and are identified by index constants. In other HLSL versions, samplers that were in structs are translated as uniform variables. These transformations are done inside the HLSL output classes, not as tree transformations. This helps to keep the uniform API provided by the shader translator intact. Wherever a struct containing samplers is passed into a user-defined function, the translated HLSL code passes the separate sampler variables alongside a struct where the samplers have been removed. The D3D backend in libANGLE queries the uniform registers of any samplers that were in uniform structs, and adds them to the register maps, so that correct sampler state gets assigned to them. The extracted sampler variables are prefixed with "angle_" instead of the usual "_" to prevent any name conflicts between them and regular variables. BUG=angleproject:504 TEST=angle_end2end_tests, dEQP-GLES*.functional.shaders.struct.uniform.* (all pass), dEQP-GLES*.functional.uniform_api.* (most now pass) Change-Id: Ib79cba2fa0ff8257a973d70dfd917a64f0ca1efb Reviewed-on: https://chromium-review.googlesource.com/333743 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho be59c2fb 2016-03-07T11:32:34 Fix ambiguous function call issues in HLSL output D3D compiler can't resolve between these overloaded functions: float4 vec4(float2x2 x0); float4 vec4(float4 x0); Include the parameter types in the function name to disambiguate between overloaded user-defined functions and constructors, like this: float4 vec4_float2x2(float2x2 x0); float4 vec4_float4(float4 x0); This is only done for float2x2 and float4 parameters, other parameter types like float2x3 vs. float3x2 don't need this. BUG=angleproject:1099 BUG=angleproject:1030 TEST=angle_end2end_tests, dEQP-GLES3.functional.attribute_location.* (10 more tests pass), dEQP-GLES2.functional.attribute_location.* Change-Id: Ief047d41b0adbc238393c3c13cb29771cbb83d58 Reviewed-on: https://chromium-review.googlesource.com/329882 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 9b4e8626 2015-12-22T15:53:22 Redesign samplers in shaders on D3D11 Translation of samplers to HLSL on D3D11 is changed as follows: Instead of passing around HLSL sampler and HLSL texture references in shaders, all references to ESSL samplers are converted to constant indices within the shader body. Each ESSL sampler is identified by an unique index. In the code generated to implement ESSL texture functions, these indices are used to index arrays of HLSL samplers and HLSL textures to get the sampler and texture to use. HLSL textures and samplers are grouped into arrays by their types. Each unique combination of a HLSL texture type + HLSL sampler type gets its own array. To convert a unique sampler index to an index to one of these arrays, a constant offset is applied. In the most common case of a 2D texture and a regular (non-comparison) sampler, the index offset is always zero and is omitted. The end goal of this refactoring is to make adding extra metadata for samplers easier. The unique sampler index can be used in follow-up changes to index an array of metadata passed in uniforms, which can contain such things as the base level of the texture. This does not solve the issues with samplers in structs. The interface from the point of view of libANGLE is still exactly the same, the only thing that changes is how samplers are handled inside the shader. On feature level 9_3, the D3D compiler has a bug where it can report that the maximum sampler index is exceeded when in fact it is not. This can happen when an array of samplers is declared in the shader. Because of this the new approach can't be used on D3D11 feature level 9_3, but it will continue using the old approach instead. BUG=angleproject:1261 TEST=angle_end2end_tests, dEQP-GLES3.functional.shaders.texture_functions.* (no regressions) dEQP-GLES3.functional.texture.units.* (no regressions) Change-Id: I5fbb0c4280000202dc2795a628b56bd8194ef96f Reviewed-on: https://chromium-review.googlesource.com/320571 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 59f9a641 2015-08-06T20:38:26 Remove EOpInternalFunctionCall It's cleaner to mark internal functions by using the TName class, similarly to TIntermSymbol. TEST=angle_unittests BUG=angleproject:1116 Change-Id: I12a03a3dea42b3fc571fa25a1b11d0161f24de72 Reviewed-on: https://chromium-review.googlesource.com/291621 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho f5cfc8df 2015-08-06T16:36:39 Track whether a name is internal to ANGLE in a separate class The AST contains identifiers in a few different places: besides symbols, there are also function names, which show up in function signatures and function calls. Any of these can be coming either from the original shader or from inside ANGLE. A class that encapsulates a string and its internalness will be useful for implementing a unified way of handling all names in shader translation. Start implementing this by splitting the functionality out of TSymbol. TEST=angle_unittests BUG=angleproject:1116 Change-Id: I0a1b5936dcccd0d5fc1c0c13c712102fbfff2a79 Reviewed-on: https://chromium-review.googlesource.com/291280 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 214c2d8e 2015-04-27T14:49:13 Separate invariance from qualifiers ESSL3 makes it possible to combine invariant with several more different qualifiers. To avoid combinatorial explosion of the qualifier enum, track invariance with a separate boolean. TEST=WebGL conformance tests, angle_unittests BUG=angleproject:987 Change-Id: I0c6629e5ca2ded06db9ac9e5bab2fb6480299a5a Reviewed-on: https://chromium-review.googlesource.com/267662 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 9b82084f 2015-02-12T10:40:10 Fix HLSL varying struct linking. We would always expand a struct name to always include its symbol ID. This fixes the workaround to only affect scoped structs. We can leave global structs, which are by definition uniquely named, without decorating them with a symbol ID. This fixes several tests in dEQP's shader.linkage.varying.struct. Re-land with GLSL translator bug fixed. BUG=angle:910 Change-Id: I23a932bd1dadea5e9aafabde697e6a2af9a43f2b Reviewed-on: https://chromium-review.googlesource.com/249134 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill b960cc4a 2015-02-12T15:33:20 Revert "Allow varying structs to match between stages." This patch has a bug which breaks the GLSL to GLSL translator. See broken GPU FYI bot builds on the Chromium waterfall: http://build.chromium.org/p/chromium.gpu.fyi/builders/Win7%20Release%20%28NVIDIA%29/builds/13074 This reverts commit 489ffc4d69656c2dbfdbe07e3fa6e38baeb3e072. Change-Id: I8241c6d658f4f31af91b89af1141d3d778ff7c70 Reviewed-on: https://chromium-review.googlesource.com/249131 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 489ffc4d 2015-02-11T16:33:07 Allow varying structs to match between stages. We would always expand a struct name to always include its symbol ID. This workaround fixed scoped structs with the same name. It would also block any possiblity of linking the structs successfully. Instead we can use the workaround only on inner-scoped structs, and leave global structs, which are by definition uniquely named, as they are. This fixes several tests in dEQP's shader.linkage.varying.struct. BUG=angle:910 Change-Id: I81b8dadc7ea493152aff0c44d607114eaaabb142 Reviewed-on: https://chromium-review.googlesource.com/247242 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill d5512cd4 2014-07-10T17:50:08 Collect shader outputs and interface block information. This paves the way for returning ES3-specific info from the shader translator with the new query methods. BUG=angle:466 Change-Id: Ib13cdb604854cdf11e9dc00dd94f18eadc946561 Reviewed-on: https://chromium-review.googlesource.com/206770 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill 8daaba15 2014-06-13T10:04:33 Split OutputHLSL structure code into new module. Refactoring patch only. BUG=angle:466 Change-Id: I2c57096e1e24574e7de3d35d608645fde3b0c681 Reviewed-on: https://chromium-review.googlesource.com/203730 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Nicolas Capens <nicolascapens@chromium.org>
Jamie Madill 033dae67 2014-06-18T12:56:28 Move OutputHLSL utility methods to other files. OutputHLSL was become a large, unweildy file. Some were also useful to other classes, even on the GL back-end, but were inacessible. Refactoring patch only. BUG=angle:466 Change-Id: Id216147122ca105c6ccdf0ba0c5f6c5038726965 Reviewed-on: https://chromium-review.googlesource.com/203459 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Nicolas Capens <nicolascapens@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>