src/libANGLE/renderer/d3d/ProgramD3D.cpp


Log

Author Commit Date CI Message
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>
Xinghua Cao 26143fdd 2017-11-01T18:19:05 ES31: Support bindImageTexture on Texture2D for compute shaders on D3D BUG=angleproject:1987 TEST=angle_end2end_tests Change-Id: I3b0afb441a41dbd7f204b1d1bba7884c8d203ce1 Reviewed-on: https://chromium-review.googlesource.com/749004 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill f414121d 2017-12-12T15:08:07 D3D11: Fix program uniform buffer dity bits. There were actually three missing state synchronization points: 1. When re-binding a uniform buffer, we had no dirty bits. 2. When modifying the Program bindings, we also had no update. 3. When triggering a dependent state update via BufferData. This fixes all the missing syncs and adds tests for the cases. Bug: angleproject:1390 Change-Id: I2f05766545784248bcca8308ae34ac5720237ab1 Reviewed-on: https://chromium-review.googlesource.com/823150 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Kai Ninomiya <kainino@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>
Olli Etuaho 3de2703d 2017-11-30T12:16:47 Fix handling matrix qualifiers on block members Individual block member row_major/column_major layout qualifiers may override the qualifiers set on the block. During parsing, this was already being handled correctly, so that the qualifier is resolved for each block member and recorded for each TField / InterfaceBlockField. Now we always write the qualifiers on a per-member granularity to the output GLSL shaders, so that the native driver gets the correct per-member qualifiers. This replaces earlier behavior where the matrix qualifiers were only written per-block. Also only use qualifiers from individual members in block layout. Since the block-level qualifier information is no longer used after parsing, it is no longer kept in the AST. A dummy value is still set to the InterfaceBlock structs exposed through the ShaderVars interface, since that has existing usage in Chromium that needs to be removed before the field can be removed. Some AMD OpenGL drivers don't seem to handle matrix layout qualifiers correctly, so most of the added tests need to be skipped for AMD GL. On NVIDIA and Intel the tests pass. BUG=angleproject:2271 TEST=angle_unittests, angle_end2end_tests, dEQP-GLES31.functional.program_interface_query.uniform.matrix* Change-Id: I1baa7a633bc2da548743c2190cb72db491b5227a Reviewed-on: https://chromium-review.googlesource.com/800174 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Xinghua Cao 37584b36 2017-12-01T11:04:03 Refactor: replace SamplerType with ShaderType BUG=angleproject:1987 Change-Id: I189e1606bd966eb369e8192a6866c8e90810e937 Reviewed-on: https://chromium-review.googlesource.com/802956 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yunchao He <yunchao.he@intel.com> Reviewed-by: 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>
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>
Jamie Madill 7af0de52 2017-11-06T17:09:33 Rename UniformLinker.cpp/h to ProgramLinkedResources. A more general name for a file that will house a collection of pogram variable related linking code. BUG=angleproject:2208 Change-Id: I82710f6abadd2df58fb58a3c4179989fe956e7e4 Reviewed-on: https://chromium-review.googlesource.com/755858 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 1734e171 2017-10-27T15:30:27 Only store innermost array offset in VariableLocation Separate entries will be generated for each innermost array of arrays of arrays in the variable tables. Because of this VariableLocation actually only needs to store the innermost array index. BUG=angleproject:2125 TEST=angle_end2end_tests Change-Id: Id1ee35b3cecfc011d96b58e43cf0b1cccbfed408 Reviewed-on: https://chromium-review.googlesource.com/741742 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill c9727f31 2017-11-07T12:37:07 Pass InterfaceBlockLinker to ProgramImpl::link. This change is in preparation for moving the linking logic to the Implementation. Introduces a ProgramLinkedResources class that is passed into the Impl and holds linking-related info such as the UBOs, Varyings, etc. BUG=angleproject:2208 Change-Id: I2ef0824b54bfb462c79d003bffe34e9cfad60d8a Reviewed-on: https://chromium-review.googlesource.com/746204 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho d255123c 2017-10-26T20:03:33 Store shader interface variables as per query spec GLES 3.1 section 7.3.1.1 specifies how active variable entries should be generated and how active variables are named. The specs for program interface variable queries are built on top of this section. ANGLE has already followed this spec for the most part for generating variable lists in ProgramState, but now we also follow the naming spec for arrays and include [0] at the end of the stored name. This will make implementing arrays of arrays more straightforward. Most logic for variable queries will just keep working as is when arrays of arrays are added instead of needing more complex logic for handling array indexing. BUG=angleproject:2125 TEST=angle_end2end_tests Change-Id: I3acd14253153e10bc312114b0303065da2efb506 Reviewed-on: https://chromium-review.googlesource.com/739826 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Qin Jiajia ca68d988 2017-09-18T16:41:56 ES31: Add std430 support for OpenGL backend BUG=angleproject:1920 TEST=angle_unittests Change-Id: Ie8e171abec053c2c5dca93d6e79db534f74520e7 Reviewed-on: https://chromium-review.googlesource.com/737532 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jiawei Shao 3d40488b 2017-10-16T13:30:48 Split varyings into input and output varyings in renderer This patch intends to split all vector<Varying> into two vectors to store input and output varyings separately in the renderer. This patch is a base of supporting program linking with geometry shader. Unlike the vertex shaders (their outputs are varyings) and fragment shaders (their inputs are varyings), the inputs and outputs of geometry shaders are all varyings, so we need two vector<Varying> to store them correctly. BUG=angleproject:1941 TEST=angle_end2end_tests Change-Id: Ic4b8343f2fc3df87b764c45f2ea7810e565f7bee Reviewed-on: https://chromium-review.googlesource.com/720617 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 1bfa6b71 2017-10-13T14:07:45 Generalize GetUniformBlockInfo. This method is useful for the Vulkan back-end as well as D3D11. It can produce a uniform block layout for the default uniform blocks as well as for interface blocks. Put it in blocklayout.h in the translator. BUG=angleproject:2167 Change-Id: I13160906921da439746c1811a623006250aaeefd Reviewed-on: https://chromium-review.googlesource.com/713941 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Geoff Lang <geofflang@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>
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 80823cc8 2017-09-14T15:46:21 D3D: Add memcmp filtering for matrix uniforms. This was already implemented, it simply hooks it up to the rest of the code. Could improve performance on some badly behaved benchmarks. BUG=angleproject:1390 Change-Id: I539df611d51ca085712fa8022bf8a7c1990afc65 Reviewed-on: https://chromium-review.googlesource.com/663896 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 4148fd74 2017-09-14T15:46:20 Add separate dirty bits for Pixel and Fragment uniforms. Also use a single UpdateSubresource call to update the buffer. Should improve performance on some benchmarks. BUG=angleproject:1390 Change-Id: I70d54d86d3d3beb0e2caee86338ee03081070ac8 Reviewed-on: https://chromium-review.googlesource.com/663895 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill c9fed8dd 2017-09-12T15:23:00 D3D11: Move TF state management to StateManager11. This also changes the dirty TF object to use a Serial, which is more secure for very edge-care reallocation issues. It also moves the StateManager11::updateState call to be the very first thing that happens in a draw call. This prepares the back-end for making the state sync actually happen in Context11::syncState, instead of inside the draw call. Also moves a bit more TF management code out of RendererD3D and Renderer9. BUG=angleproject:2052 Change-Id: I93d033a07be2049023111975a31637c53893e8c8 Reviewed-on: https://chromium-review.googlesource.com/659229 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d63961d0 2017-09-12T15:22:57 D3D11: Move Constant Buffer state to StateManager11. Also moves the logic of the constant buffer sync to StateManager11. Removes a few of the remaining virtual methods in RendererD3D. BUG=angleproject:1390 BUG=angleproject:2052 Change-Id: Ia6c1c3949fff84323331510d80bbfb6e1665d294 Reviewed-on: https://chromium-review.googlesource.com/659226 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 9d815378 2017-09-09T23:32:54 D3D: Refactor driver uniform application. This is a preparation for more dirty bits. It moves the driver constant buffer application into the state manager, redesigns how the dirtiness is tracked (no more memcmp) and also removes a couple of virtual calls. BUG=angleproject:1390 BUG=angleproject:2052 Change-Id: I41a75c280600ad8ba1f23c721d436214a116422a Reviewed-on: https://chromium-review.googlesource.com/659223 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 33bb7c42 2017-09-09T23:32:51 ProgramD3D: Use more UniformTypeInfo. Instead of storing a type GLenum, store a pointer into the type info table. This makes looking up some values a bit easier. Also includes some micro-optimizations. Improves the score of the uniforms micro-benchmark by about 12.4% on a local Windows 10 machine. BUG=angleproject:1390 Change-Id: I35f7f1c7bb3cf2c62d737b494dc56ff61ea2d1fb Reviewed-on: https://chromium-review.googlesource.com/659221 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 0e7f1736 2017-09-09T23:32:50 D3D: Only scan cached shader executable lists once. Any time we would query ProgramD3D for a particular vertex or pixel shader, we would iterate over all the cached shaders of the program looking for the matching input or output layout signature. This change makes it so we only compute the index of the matching shader once, and subsequent calls will re-use the shader index. This should speed up the draw call benchmarks. Also include a fix to the Serial class that initializes a Serial value to an invalid sentinel value. This ensures that comparing any other Serial (including another invalid serial) to the invalid serial will return not-equals. BUG=angleproject:1155 Change-Id: I7d913bf08d0bedf6155eae0661b2a5fa94565cc9 Reviewed-on: https://chromium-review.googlesource.com/648730 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill af4ffe0a 2017-09-09T23:32:48 D3D11: Implement dirty bits for texture updates. BUG=angleproject:1387 Change-Id: I5f759c3dc60b53a5d4f8a1dd1f4a1d3d5330bfda Reviewed-on: https://chromium-review.googlesource.com/648487 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Martin Radev c1d4e550 2017-08-21T12:01:10 D3D11: Select view in vertex shader View selection can happen in the vertex shader through the optional feature VPAndRTArrayIndexFromAnyShaderFeedingRasterizer. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: Iaf65685e04f828b0936295fea867f6f6cbe69bee Reviewed-on: https://chromium-review.googlesource.com/628419 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 134f93d1 2017-08-31T17:11:00 D3D: Small optimizations to uniform updates. Uses more of the type info table for updates. Also special-case clamping when uniform count == 1. Improves the speed of the d3d11 uniform stress test by ~20%. BUG=angleproject:1390 Change-Id: I6707c67db84c94a28b1519b0bbee5d28fe38b189 Reviewed-on: https://chromium-review.googlesource.com/646828 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 561ed3ae 2017-08-31T16:48:09 D3D: Keep a single dirty bit for uniforms. This simplifies uniform management in D3D11. It will also facilitate further optimizations. Improves performance in a uniforms stress test by ~13% on a test machine. (UniformsBenchmark.Run/d3d11_null_400_vec4) BUG=angleproject:1390 Change-Id: Iba2c15d420396aa8fb4e8c451cba2b4dde7b4b77 Reviewed-on: https://chromium-review.googlesource.com/623930 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 41ac68e7 2017-06-06T12:16:58 Select viewport index in GS for multi-view instanced rendering The patch extends the OutputHLSL and DynamicHLSL translators to select the viewport index in the geometry shader and propagate the ViewID variable to the fragment shader. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: I9e344a7521e2e1137e6eb38d0bfecea8bece778f Reviewed-on: https://chromium-review.googlesource.com/608967 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jiajia Qin 9b11ea4f 2017-07-11T16:50:08 Gather UniformBlock and ShaderStorageBlock separately Refactor InterfaceBlocks since it only stands for UniformBlock before ES31. But for ES31, uniform block and shader storage block both belong to interface block. This CL will add GetUniformBlocks and GetShaderStorageBlocks in ShaderLang.h. Meanwhile, keep GetInterfaceBlocks which can return all the interface blocks together. BUG=angleproject:1951 Change-Id: I3036e201aadfbd490575ed03538c81bcc3793ff3 Reviewed-on: https://chromium-review.googlesource.com/582546 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 4c19a8a8 2017-07-24T11:46:06 D3D11: Update cached dynamically recompiled programs. This change makes it so that when we need to recompile a program on a draw call, we also update the cache. It also streamlines the internal queries of the dynamic vertex and fragment shaders such that we only update the input and output signatures a single time per draw. This should also facilitate dirty bit implementations for the D3D11 back- end. BUG=angleproject:2116 Change-Id: Iccb0501b700bc894f40a8c68d7f297ff0c8f46bd Reviewed-on: https://chromium-review.googlesource.com/531798 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill a779b610 2017-07-24T11:46:05 Smart caching of VAO input layout. Don't recompute the cached attribute layout for a program if the vertex array info hasn't changed. We can use the Serial class to know when a vertex array has identical state. BUG=angleproject:1156 Change-Id: Ia11f6ac268f63c3299f6d6d80c2866009cb8429c Reviewed-on: https://chromium-review.googlesource.com/529768 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 27a60631 2017-06-30T15:12:01 Re-apply UBO binding workaround on program save. The workaround which was previously defined to only apply on load also seems to affect save on some AMD drivers. BUG=angleproject:1637 BUG=angleproject:1897 Change-Id: Ia01a1420a484f3c2682ce97eaab18baccfb66a50 Reviewed-on: https://chromium-review.googlesource.com/558008 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
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 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 9cf9e871 2017-06-05T12:59:25 Move LinkResult to the gl:: namespace. This is a derived type from gl::Error so makes sense to be there. Also makes it more accessible than in ProgramImpl.h BUG=angleproject:1897 Change-Id: Id41b13e5a072745d8c361057f5bef8f152e0452b Reviewed-on: https://chromium-review.googlesource.com/522872 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 83418fb1 2017-06-05T12:59:24 Don't allow for error in ProgramImpl::save. Refactoring cleanup patch only. BUG=angleproject:1897 Change-Id: I6d12de5dab16ead9684886a1cf15b570e3c98156 Reviewed-on: https://chromium-review.googlesource.com/522871 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Corentin Wallez c084de14 2017-06-05T14:28:52 ProgramD3D: only broadcast when the GL_EXT_draw_buffers is enabled The behavior is undefined in GL ES when multiple attachments are used with gl_FragColor but WebGL clarifies that: - If the extension is enabled, broadcast happens - If the extension isn't enabled, only the first attachment is written BUG=angleproject:2048 Change-Id: I6d85ba91df77d42fb8863a03f1faa006cd7817bf Reviewed-on: https://chromium-review.googlesource.com/523809 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Yuly Novikov c4d18aac 2017-03-09T18:45:02 Use ErrorStream everywhere Eliminates one more usage of FormatString and its static initializer. Add more ErrorStream types and replace gl::Error and egl::Error with them. BUG=angleproject:1644 Change-Id: Ib498d0ae4b81a332ec71aed7cf709993b154e6bb Reviewed-on: https://chromium-review.googlesource.com/505429 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Jamie Madill c564c070 2017-06-01T12:45:42 Pass gl::Context to impl methods instead of ContextImpl. In some cases we might have to call back into the GL layer, passing the Context, and if we just have a ContextImpl pointer this isn't possible. It also removes the need for SafeGetImpl. BUG=angleproject:2044 Change-Id: I6363e84b25648c992c25779d4c43f795aa2866d6 Reviewed-on: https://chromium-review.googlesource.com/516835 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Xinghua Cao 73badc07 2017-03-29T19:14:53 ES31: Implement glDispatchCompute for D3D backend BUG=angleproject:1955 TESTCASE=angle_end2end_tests Change-Id: I69b4df83d67017d39df67753d6d17fc15ececebf Reviewed-on: https://chromium-review.googlesource.com/462067 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Yunchao He 4f285443 2017-04-21T12:15:49 Refactoring: replace NULL by nullptr for pointers (2nd CL). This CL mainly handles the pointer comparisons (== or !=). BUG=angleproject:2001 Change-Id: I25ac3b61032e7ad91459a1c6541cadc87cf9b160 Reviewed-on: https://chromium-review.googlesource.com/483935 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Yunchao He d7297bfb 2017-04-19T15:27:10 Code refactoring: replace NULL by nullptr for pointers. This is the frist change to replace NULL by nullptr. It handles the initialization and assignment for pointers. BUG=angleproject:2001 Change-Id: I6d4bb198a72e38b867cd2f65a6e6f2f61339a0b5 Reviewed-on: https://chromium-review.googlesource.com/481600 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@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>
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>
Jamie Madill 20e005b2 2017-04-07T14:19:22 Rename BitSetIterator.h to bitset_utils.h BUG=angleproject:1814 Change-Id: I152ae13b6b7cf0ba72259967f0f124e199b20e07 Reviewed-on: https://chromium-review.googlesource.com/471826 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@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>
Jamie Madill cc2ed612 2017-03-14T15:59:00 Fix non-square matrix uniform packing. This was broken in two places: the register count was using the non- transposed matrix row count. The block layout encoder was also not set to transpose matrices, which was causing incorrect packing info to be calculated in link. BUG=angleproject:1923 Change-Id: I89094aa116fad4bda15f018498f8637520f12bd4 Reviewed-on: https://chromium-review.googlesource.com/454876 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 8ecf7f9b 2017-01-13T17:29:52 Vulkan: Implement shader compilation. This hooks up the Vulkan GLSL, decorated with locations, to glslang, and then pipes the SPIRV back to the Program implementation for later use when making pipelines to run draw calls. The program compilation tests work now, but don't really test anything other than not generating Vulkan validation layer errors during compilation and shader object generation. BUG=angleproject:1576 Change-Id: I625e42219f4b4d1433dd3109b94e1a2f666ba4bd Reviewed-on: https://chromium-review.googlesource.com/408519 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Yuly Novikov d73f852f 2017-01-13T17:48:57 Reland "Replace gl::trace logging with Chromium style logging" Removing one usage of FormatString() and its static buffer. And preparation for Platform logging. Fix incorrect enabling of ERR() calls in UNIMPLEMENTED() and UNREACHABLE(), resulting in increased code size and <iostream> adding 5 static initializers to chrome because of cerr referenced in statically linked translator. BUG=angleproject:1660 Change-Id: I7caa18036118d532e0544f75278602559172ae04 Reviewed-on: https://chromium-review.googlesource.com/431457 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Xinghua Cao b123938d 2016-12-13T15:07:05 D3D11: Add support to compile and link compute shaders This is a reland of 2cd9d7e032fb412b539a907c58342060340387a1. BUG=angleproject:1442 TEST=angle_end2end_tests Change-Id: I5be0032b97617c31cdd4c66a823e8eb3b518867a Reviewed-on: https://chromium-review.googlesource.com/430199 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6a6b09c9 2017-01-12T21:52:29 Revert "Replace gl::trace logging with Chromium style logging" Failing Chromium static initializers check: FAILED linux-release-64/sizes/chrome-si/initializers: actual 8, expected 7, better lower Possibly due to the static initializer for std::array for the log severity types. We should change it to POD. BUG=angleproject:1660 This reverts commit afcc41cee4ff63e7f6c9e60e55fc061adbba7dd4. Change-Id: Ifb362a4af78542608397c7a0b19e6afe076f2cf3 Reviewed-on: https://chromium-review.googlesource.com/427235 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 417df92f 2017-01-12T09:23:07 Revert "D3D11: Add support to compile and link compute shaders." Fails https://build.chromium.org/p/chromium.gpu.fyi/builders/Linux%20Debug%20%28New%20Intel%29/builds/5769 BUG=angleproject:1442 This reverts commit 2cd9d7e032fb412b539a907c58342060340387a1. Change-Id: Ic1610d20ba0449b423528fa9840aa951c012cf84 Reviewed-on: https://chromium-review.googlesource.com/427229 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Yuly Novikov afcc41ce 2016-12-13T12:59:39 Replace gl::trace logging with Chromium style logging Removing one usage of FormatString() and its static buffer. And preparation for Platform logging. BUG=angleproject:1660 Change-Id: I58192988ad16196706fe48d0c0ab0fd1a10c0210 Reviewed-on: https://chromium-review.googlesource.com/424173 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Xinghua Cao 2cd9d7e0 2016-12-13T15:07:05 D3D11: Add support to compile and link compute shaders. BUG=angleproject:1442 Change-Id: I13240e931e6f121d175d2cd6b41324d38bb39a5c Reviewed-on: https://chromium-review.googlesource.com/405831 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 192745a7 2016-12-22T15:58:21 Add varying packing validation for WebGL. This CL moves the varying packing from the D3D layer up to Program. This is necessary for WebGL validation, and gives us consistency for the various back-ends. There may be some additional cleanup work on the VaryingPacking class, because it does some work that is D3D- specific. WebGL requires strict varying packing. Instead of allowing success unconditionally, it's an explicit error to succeed to pack a set of varyings that the sample algorithm would fail to pack. Introduce a new packing mode option to the varying packing class to handle this different packing style, while keeping our old more relaxed packing method for ES code. BUG=angleproject:1675 Change-Id: I674ae685ba573cc2ad7d9dfb7441efa8cb2d55fc Reviewed-on: https://chromium-review.googlesource.com/423254 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 51f522f1 2016-12-21T15:10:55 D3D11: Fix program binary crash with UBO bindings. This crash could occur when saving and loading a program with UBO bindings that was never used in a draw operation. The fix is to ensure the D3DLinkedUniforms are properly initialized before we save the program binary. BUG=angleproject:1637 Change-Id: I9691e375d19dc628f34f351ae94b68bd0f2f76b8 Reviewed-on: https://chromium-review.googlesource.com/422665 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez b58e9bac 2016-12-15T14:07:56 ProgramD3D: optimize Transpose/ExpandMatrix BUG=angleproject:1390 Change-Id: I7e8eb1f7924014bbde38269ef0fd0f7d65639083 Reviewed-on: https://chromium-review.googlesource.com/420518 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 408293f8 2016-12-20T10:11:45 D3D11: Fix stale SRVs with tiny depth textures. When the tiny depth texture would get re-created on change, it was not freeing any cached SRVs which were pointing to the old tex. Fix this by erasing the cache entry if the texure is recreated. Also include a test which hooks into the workarounds to force testing on every platform. Also narrow the workaround to only apply to depth/stencil textures which use these mips in GL, rather than D3D, where we always create a full mip chain. BUG=angleproject:1664 Change-Id: If0ac396b8847e1bf9b50165e5332da573e9bb3e4 Reviewed-on: https://chromium-review.googlesource.com/421567 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill a7d12dc7 2016-12-13T15:08:19 Store uniform block bindings in program binaries. This affects all back-ends - we weren't saving this. Note that bindings can only be set after program linking. The spec is fairly clear in that any programs saved must be loadable and runnable under the same set of state, which would include block bindings. Also add validation for zero binary formats in GetProgramBinary. Also add a workaround for AMD where the block bindings were not applied properly after link, similarly to our original bug. This CL also includes a few fixups for GLProgram (raii). BUG=angleproject:1637 Change-Id: Iae068eb4e1e4c763aa9f9332c033e38708026c8f Reviewed-on: https://chromium-review.googlesource.com/418393 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2ad1c490 2016-12-07T14:46:18 D3D: Fix overflow in varying packing. Also add a more robust set of unit tests for this internal class. Because the GL spec allows for succeess when packing any set of varyings, it's impossible to write negative end to end tests. This CL also rewrites our disabled varying packing GLSL tests as unit tests. BUG=angleproject:1296 BUG=angleproject:1638 Change-Id: I78153742517d5c72ddb13ff59dc44ddc4af42fc2 Reviewed-on: https://chromium-review.googlesource.com/415555 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 120040e2 2016-12-07T14:46:16 D3D: Move some HLSL-specific code to a new folder. This code doesn't actually call any D3D runtime methods, so it can be included in our cross platform unit tests. Just include the varying packing code for now. BUG=angleproject:1296 BUG=angleproject:1638 Change-Id: I5c0ccccb00e1c13ca98448256be048f7cd0968ce Reviewed-on: https://chromium-review.googlesource.com/417116 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 01074255 2016-11-28T15:55:51 D3D: Implement multi-thread shader compilation. Choose to use std::async for now to implement multi-threaded compiles. This should work across platforms and also be usable for other threading tasks. Note that std::async does not have a good way to wait for multiple std::futures. Also the Linux compile of std::async is broken due to a bug in an old STL version, so disable it on this platform. The implementation uses a static polymorphism approach, which should have very good performance (no virtual calls). This design leaves the door open for other future implementations, such as a Win32 thread pool, or one based on angle::Platform. BUG=angleproject:422 Change-Id: Ia2f13c3af0339efaca1d19b40b3e08ecca61b8e8 Reviewed-on: https://chromium-review.googlesource.com/413712 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b0a838bf 2016-11-13T20:02:12 Program: Make LinkResult use gl::ErrorOrResult. This simplifies the error handling code, and allows the use of the ANGLE_TRY macro (and friends). BUG=angleproject:1576 Change-Id: I3142388b10d0dd67a7f49a5c8c3d11102996be93 Reviewed-on: https://chromium-review.googlesource.com/411201 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 65d17e56 2016-09-08T09:52:58 Generate OUT_OF_MEMORY when compiler initialization fails. INVALID_OPERATION implies that the error is recoverable. Change-Id: Iaa13293168f66f46864e5e4c0ab7d7c53c97e8fd Reviewed-on: https://chromium-review.googlesource.com/383131 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jamie Madill c9bde926 2016-07-24T17:58:50 D3D11: Allow gl_PointCoord when not rendering points. ANGLE D3D11 uses a geometry shader to expand points into quads. This led to an edge case with gl_PointCoord. When the user references gl_PointCoord in the fragment shader but renders with GL_TRIANGLES or other non-point primitives, gl_PointCoord is undefined, but ANGLE would produce a link error. This would break some very odd edge-case shaders (e.g. a shader that is used with both points and triangles). We can fix this by simply adding a dummy PointCoord value to our vertex shader is all cases. If the user renders points, we ignore the PointCoord value passed to the geometry shader. If they render tris or lines and use PointCoord, the shader signatures will match, and PointCoord will even have a sane value of (0.5, 0.5). BUG=angleproject:1380 Change-Id: I322155cd3801d0241cabc9bb639a5aaa502831b3 Reviewed-on: https://chromium-review.googlesource.com/362779 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org>
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>
Sami Väisänen 46eaa946 2016-06-29T10:26:37 Support CHROMIUM_path_rendering fragment operations This brings two new APIs, BindFragmentInputLocation and ProgramPathFragmentInputGen that together dictate how the fragment shader varyings are used. BUG=angleproject:1382 Change-Id: I4b52fd8a3555235a73aecd4f3dba2d500789cbb0 Reviewed-on: https://chromium-review.googlesource.com/357071 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Sami Väisänen <svaisanen@nvidia.com> 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>
Jamie Madill e2e406c3 2016-06-02T13:04:10 Add base::numerics for safe math and conversions. This replaces are "IsUnsignedXXXSafe" family of methods. Also add overflow checks to unpack block sizes. BUG=angleproject:1397 Change-Id: Ib47be149b0486c70f795b0d0f8899441faac9340 Reviewed-on: https://chromium-review.googlesource.com/348062 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 53ea9cc6 2016-05-17T10:12:52 Replace rx::Renderer with rx::ContextImpl. Previously Context had no Impl class, but had a special relationship with the instanced Renderer class. Having a ContextImpl backing every Context will allow new designs to enable things like multithreading (where each ContextImpl stores a Context-specific device) or non- virtual Contexts on Android or other platforms where it is more efficient. A large refactoring patch that touches every back-end. BUG=angleproject:1363 Change-Id: Icb73a7d37447f08a664eeb499a310ba05d71a57e Reviewed-on: https://chromium-review.googlesource.com/342052 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 48ef11b2 2016-04-27T15:21:52 Rename gl::Framebuffer::Data to gl::FramebufferState. Moving this out of the Framebuffer class allows us to forward- declare it. BUG=angleproject:1363 Change-Id: I91971c37a92151df508cdf7f0eb8c3e93506d112 Reviewed-on: https://chromium-review.googlesource.com/340741 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@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>
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>
Jamie Madill 8047c0d2 2016-03-07T13:02:12 D3D11: Clean up InputLayoutCache. This change does a couple things. First, it uses the 'active attribs' mask in the gl::Program to sort the translated attributes, instead of checking the translated attribute themselves. This means we don't have to consult the 'active' field of the translated attributes, which in turns means we don't have to update the active field in the attributes, which breaks the dependency of the attributes on the gl::Program. Second, use a dynamically sized array for storing the cached vertex attributes in the InputLayoutCache. This is nice because it means we don't have to store the size of the array separately. Also some other refactoring cleanups. Refactoring change only. BUG=angleproject:1327 Change-Id: Iab22de92840b30674b92eca72e450673ed9f6d6d Reviewed-on: https://chromium-review.googlesource.com/330172 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill bdec2f4e 2016-03-02T16:35:32 D3D11: Fix overlapping vertex shader signatures. For the case of drawing with un-normalized integer vertex attributes, we need to do some dynamic conversion in the VS. However, each attribute can either be signed or unsigned, and our shader signature code would treat both as a match, giving rise to a warning in the D3D11 Debug runtime. It's unclear if this would give incorrect results, but it certainly should not produce a warning. BUG=angleproject:1329 Change-Id: I302d11b44e8a0ef981e89c181aefac5451a899b7 Reviewed-on: https://chromium-review.googlesource.com/329998 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Olli Etuaho 618bebcd 2016-01-15T16:40:00 Pass texture base level to shaders on D3D11 The base level is passed to shaders in an array included in the driver uniform block. This is done on feature levels above 9_3, which treat samplers as indices to sampler arrays in shaders. A separate uniform block couldn't be used for the sampler metadata, since that would bring the number of available uniform blocks down to below minimum level defined by GLES 3.0. BUG=angleproject:596 TEST=angle_end2end_tests Change-Id: Ie040521402f9996d51a978aeeba9222e9dd761ce Reviewed-on: https://chromium-review.googlesource.com/326290 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 39046169 2016-02-08T15:05:17 CollectVariables: Don't include block name in field name. The spec mandates that the instance name of a block determines how the active uniform name for this field is reported. However, our handling of this was a bit bugged. We would include the proper prefix on the compiler-side, but this mangled the hashing, and was also not strictly needed. We now also expose the instance name, so we can determine the proper prefix for variable linking on the GL-side of things. This also is consistent with how we handle other spec issues, where the GL-side handles the GL-API specific functionality. This also allows us to fix name hashing of instanced uniform blocks, which was previously broken because we would hash the full name of the active uniform, instead of just the field. BUG=angleproject:1306 Change-Id: I06ace6dbc3f75fdd8129677360dcc142aa89136e Reviewed-on: https://chromium-review.googlesource.com/326681 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Austin Kinross 2a63b3f8 2016-02-08T12:29:08 Re-land "Implement EGL_experimental_present_path_angle" - Re-land with clang fix. This allows ANGLE to render directly onto a D3D swapchain in the correct orientation when using the D3D11 renderer. The trick is to add an extra uniform to each shader which takes either the value +1.0 or -1.0. When rendering to a texture, ANGLE sets this value to -1.0. When rendering to the default framebuffer, ANGLE sets this value to +1.0. ANGLE multiplies vertex positions by this value in the VS to invert rendering when appropriate. It also corrects other state (e.g. viewport/scissor rect) and shader built-in values (e.g. gl_FragCoord). This saves a substantial amount of GPU time and lowers power consumption. For example, the old method (where ANGLE renders all content onto an offscreen texture, and then copies/inverts this onto the swapchain at eglSwapBuffers() time) uses about 20% of the GPU each frame on a Lumia 630. Verification: + dEQP GL ES2 tests pass when "present path fast" is enabled + all ANGLE_end2end_tests pass when "present path fast" is enabled BUG=angleproject:1219 Change-Id: I56b339897828753a616d7bae837a2f354dba9c63 Reviewed-on: https://chromium-review.googlesource.com/326730 Tryjob-Request: Austin Kinross <aukinros@microsoft.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill d1c46228 2016-02-08T14:51:18 Revert "Implement EGL_experimental_present_path_angle" Compile failure on Clang/Win: The reason for reverting is: FAILED: ninja -t msvc -e environment.x86 -- "..\..\third_party/llvm-build/Release+Asserts/bin/clang-cl" -m32 /nologo /showIncludes /FC @obj\third_party\angle\src\tests\egl_tests\angle_end2end_tests.EGLPresentPathD3D11Test.obj.rsp /c ..\..\third_party\angle\src\tests\egl_tests\EGLPresentPathD3D11Test.cpp /Foobj\third_party\angle\src\tests\egl_tests\angle_end2end_tests.EGLPresentPathD3D11Test.obj /Fdobj\gpu\angle_end2end_tests.cc.pdb In file included from ..\..\third_party\angle\src\tests\egl_tests\EGLPresentPathD3D11Test.cpp:7: In file included from ..\..\third_party\angle\src\tests\test_utils/ANGLETest.h:13: ..\..\testing\gtest\include\gtest/gtest.h(1392,16) : error: comparison of integers of different signs: 'const int' and 'const unsigned int' [-Werror,-Wsign-compare] if (expected == actual) { ~~~~~~~~ ^ ~~~~~~ ..\..\testing\gtest\include\gtest/gtest.h(1422,12) : note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<int, unsigned int>' requested here return CmpHelperEQ(expected_expression, actual_expression, expected, ^ ..\..\third_party\angle\src\tests\egl_tests\EGLPresentPathD3D11Test.cpp(281,9) : note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<int, unsigned int>' requested here ASSERT_EQ(mWindowWidth * 4, mappedSubresource.RowPitch); ^ ..\..\testing\gtest\include\gtest/gtest.h(1960,32) : note: expanded from macro 'ASSERT_EQ' # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2) ^ ..\..\testing\gtest\include\gtest/gtest.h(1943,67) : note: expanded from macro 'GTEST_ASSERT_EQ' EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \ ^ BUG=angleproject:1219 This reverts commit 6b3c1db5170450bbc4946d8f18ba0d8619da43a0. Change-Id: Ia67ab82dd13295dc03235d57fa417c73f20a49e6 Reviewed-on: https://chromium-review.googlesource.com/326680 Reviewed-by: Jamie Madill <jmadill@chromium.org>
Austin Kinross 6b3c1db5 2015-12-18T14:01:46 Implement EGL_experimental_present_path_angle This allows ANGLE to render directly onto a D3D swapchain in the correct orientation when using the D3D11 renderer. The trick is to add an extra uniform to each shader which takes either the value +1.0 or -1.0. When rendering to a texture, ANGLE sets this value to -1.0. When rendering to the default framebuffer, ANGLE sets this value to +1.0. ANGLE multiplies vertex positions by this value in the VS to invert rendering when appropriate. It also corrects other state (e.g. viewport/scissor rect) and shader built-in values (e.g. gl_FragCoord). This saves a substantial amount of GPU time and lowers power consumption. For example, the old method (where ANGLE renders all content onto an offscreen texture, and then copies/inverts this onto the swapchain at eglSwapBuffers() time) uses about 20% of the GPU each frame on a Lumia 630. Verification: + dEQP GL ES2 tests pass when "present path fast" is enabled + all ANGLE_end2end_tests pass when "present path fast" is enabled BUG=angleproject:1219 Change-Id: Ib6eeea46bafa6ebce4adada0ae9db3a433b8fc4c Reviewed-on: https://chromium-review.googlesource.com/321360 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tryjob-Request: Austin Kinross <aukinros@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang 00140f4a 2016-02-03T18:47:33 Revert "Pass texture base level to shaders on D3D11" This reverts commit 3026829e155bd89b5ca5b7b7c5267699b9192557. Change-Id: I0b4c3f5b1453b993b149423bb1ce407f4918cf54 Reviewed-on: https://chromium-review.googlesource.com/325435 Reviewed-by: Geoff Lang <geofflang@chromium.org>
Olli Etuaho 3026829e 2016-01-15T16:40:00 Pass texture base level to shaders on D3D11 The base level is passed to shaders in a uniform block created specifically for passing sampler metadata. This is done on feature levels above 9_3, which treat samplers as indices to sampler arrays in shaders. BUG=angleproject:596 TEST=angle_end2end_tests Change-Id: I846f2fc195ab1fd884052824ffd3c1d65083c0fb Reviewed-on: https://chromium-review.googlesource.com/322122 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 60ec6ea7 2016-01-22T15:27:19 Implement dirty bits for Framebuffer. The dirty bits set the stage for performance improvements in D3D, but don't actually reduce any of the redundant work just yet. BUG=angleproject:1260 Change-Id: Ib84e6a9b7aa40c37c41790f492361b22faaf4742 Reviewed-on: https://chromium-review.googlesource.com/318730 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Austin Kinross 88829e84 2016-01-12T13:04:41 Don't compile D3D geometry shader when using instanced point emulation If ANGLE is using instanced point sprites (e.g. on Feature Level 9_3) then it still tries to compile the point sprite geometry shader. It shouldn't do this. Change-Id: I6e7753dd337c385893fc4bea6c8438aeaf5e8427 Reviewed-on: https://chromium-review.googlesource.com/321397 Tryjob-Request: Austin Kinross <aukinros@microsoft.com> Tested-by: Austin Kinross <aukinros@microsoft.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho e5df3066 2015-11-18T13:45:19 D3D: Run applyTextures before applyShaders applyShaders will update uniform data by uploading the constant buffer. In the future uniform data will contain the base level of textures so that shaders can use it to adjust results of texture functions. The most natural place to set the base level in uniform data is applyTextures, so it needs to be run before applyShaders. updateSamplerMapping needs to be called before applyTextures, but genericDraw* functions already do that. Remove redundant updateSamplerMapping call from ProgramD3D::applyUniforms. BUG=angleproject:596 BUG=angleproject:1092 BUG=angleproject:1261 TEST=angle_end2end_tests Change-Id: I1828f7bdc75999872a26941a02cb4b6c6a66094d Reviewed-on: https://chromium-review.googlesource.com/322121 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang c5629759 2015-12-07T16:29:04 Implement full program binary support for ES3. Refactor validation to be used in both the OES and ES3 entry points. BUG=angleproject:600 BUG=angleproject:1101 Change-Id: I2008c4ea04ce07910f03ae0b997f8a77b66203d8 Reviewed-on: https://chromium-review.googlesource.com/316620 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jacek Caban 2302e69a 2015-12-01T12:44:43 Fixed compilation with mingw. Change-Id: I8102ce4dd934ac247a29e31140d3a1eca691802f Reviewed-on: https://chromium-review.googlesource.com/315060 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 6328667d 2015-11-24T13:00:08 Add gl_FragDepth support for D3D11/ES3. An incorrect check was blocking existing support we added for the extension. BUG=angleproject:1226 Change-Id: I335053b1bebb37fd9296b36702031bd34c1bb59e Reviewed-on: https://chromium-review.googlesource.com/313992 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 847638a6 2015-11-20T13:01:41 Re-land "D3D: Generate more shader debug info by default." Re-land with fix for shader size query. The debug info can be very useful to WebGL developers. Instead of hiding the feature behind an unsupported and broken flag, always enable it so that WebGL devs can access the useful translated info. Change the debug info policy to build the full info (including generated assembly) in Debug, and all info excepth the assembly in Release. BUG=angleproject:1179 Change-Id: I812b2c9ba98cb8c9d5ec95721441c70e8990b626 Reviewed-on: https://chromium-review.googlesource.com/313600 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 57d116a4 2015-11-20T17:59:18 Revert "D3D: Generate more shader debug info by default." Has a bug where we would return the wrong size for the query. BUG=angleproject:1179 This reverts commit 6de4d49477986339a92b542a18df22c49d10cf14. Change-Id: Ib58aaf0b58d8f20765f7267b29acd8c62d287525 Reviewed-on: https://chromium-review.googlesource.com/313552 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6de4d494 2015-11-19T14:08:34 D3D: Generate more shader debug info by default. The debug info can be very useful to WebGL developers. Instead of hiding the feature behind an unsupported and broken flag, always enable it so that WebGL devs can access the useful translated info. Change the debug info policy to build the full info (including generated assembly) in Debug, and all info excepth the assembly in Release. BUG=angleproject:1179 Change-Id: I25656b76b8437cb2edc9d88cd33f2c4d19b6a3f0 Reviewed-on: https://chromium-review.googlesource.com/313160 Tryjob-Request: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 55c25d0c 2015-11-18T13:08:08 D3D11: Fix varying packing with structs. Previously we would try to pass an entire struct through HLSL's shader interface. Instead, split this off as if each field was its own variable, which seems to be spec compliant (see ESSL 3.10). In the future we may want to fix register packing to use specific components of float4/int4/uint4 HLSL registers. This could also fix the remaining bugs in the SM3 packing. TEST=dEQP-GLES3.functional.shaders.linkage.varying.* BUG=angleproject:910 BUG=angleproject:1202 Change-Id: I1fd8b4505abc39bd2385ed5c088c316d55d0bc2c Reviewed-on: https://chromium-review.googlesource.com/311242 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 9fc3682c 2015-11-18T13:08:07 D3D: Rework varying packing code. In D3D we pack varyings by making a register map, and using the recommended GLSL ES algorithm to reserve register space. We use this map to assign row and column slots to each varying and then produce a semantic index value. The existing scheme had a number of bugs, and was failing several angle_end2end_tests. The new design cleans up the code somewhat and uses a different counting scheme for the semantic indexes: just sort the varyings in packing order and use a simple incrementing semantic index per varying. In SM4+, the HLSL compiler sorts and packs the varyings correctly itself, and in SM3, handle the cases we don't support by returning an error instead of a D3D compiler link error. Also refactor how we store varying information for TF Feedback/ StreamOut. Only store the necessary D3D information, instead of extra information like the name and type. This fixes several tests in GLSLTest/*. This also will allow us to fix interpolation qualifier packing and the structure packing in HLSL, which seems to work differently than the rest of the varying types. BUG=angleproject:1202 TEST=bots,dEQP-GLES3.functional.transform_feedback.* Change-Id: Ie5bfbb4f71d8bf97f39115fc46d2e61b131df639 Reviewed-on: https://chromium-review.googlesource.com/311241 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>