src/libANGLE/renderer/d3d/d3d11/StateManager11.h


Log

Author Commit Date CI Message
Jamie Madill aac5d678 2021-10-20T11:48:57 Make "isCompute" private to ProgramExecutable. This eliminates uses of "isCompute" is the Vulkan back-end. Instead of checking the state flag, we can use the context of the current command to determine if we're running a compute or a graphics command. This will eventually lead to us being able to compile the program pipeline objects before we run a draw or dispatch command. Changes the driver uniforms descriptor desc to bind to both graphics and compute shader stages to simplify the code. This could have theoretical but low-risk performance implications. Bug: angleproject:6595 Change-Id: Ie30d419b6ece5b33f5066a034d3805fe96519b36 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3233903 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Steven Noonan 01341f94 2021-10-11T19:26:07 D3D11: implement EXT_clip_control This implements EXT_clip_control for the D3D11 renderer, so that I can use a reversed-Z depth buffer with ANGLE. Tested with angle_deqp_gles2_tests.exe --deqp-egl-display-type=angle-d3d11 --deqp-case=dEQP-GLES2.functional.clip_control.* and angle_end2end_tests.exe --gtest_filter=*D3D11* Bug: angleproject:6554 Change-Id: I1d11cd04a6654c28530b11104470f0cad0009abe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3218659 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
shrekshao 9349e262 2020-06-25T14:28:17 Fix multiDraw* with DYNAMIC_DRAW buffer usage Specialized Context11 impl to prevent promote Dynamic during MultiDraw. Add different buffer usage to MultiDraw and BaseVertexBaseInstance tests. Bug: angleproject:3402, angleproject:4754 Change-Id: I50e1a6fd6c8b6fd48f130c43545b895335d2e55b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2268581 Commit-Queue: Shrek Shao <shrekshao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
shrekshao e6124500 2020-06-02T12:02:55 Fix baseVertex and baseInstance with streaming attributes baseInstance: Fixed by adding the intial offset to each copy for streaming attributes baseVertex: make sure mShaderConstants.onFirstVertexChange takes in correct firstVertex value for dynamic attribs (where firstVertex passed to StateManager11::updateState already include baseVertex) Bug: chromium:1078330, angleproject:3402 Change-Id: I289c4e3733fdf6f78af8c3adee84112c05a5abce Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2227022 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shrek Shao <shrekshao@google.com>
Alexey Knyazev 779a25a8 2020-04-27T02:11:58 D3D11: Migrate to the new blend state tracking Migrate D3D ClearParameters struct to the new color mask storage Bug: angleproject:4394 Change-Id: Ibeb64e4bbb2758b9c8271fc3c59d2d675850b0a8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2165886 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Sunny Sachanandani 4b225c70 2020-05-06T15:38:12 Add texture offset attributess for D3D texture pbuffer surfaces Add EGL_TEXTURE_OFFSET_X_ANGLE and EGL_TEXTURE_OFFSET_Y_ANGLE attributes to EGL_ANGLE_d3d_texture_client_buffer which are used to specify offsets used for rendering into the pbuffer surface backed by a D3D11 texture. Rendering with the correct offset is needed when Chrome gets a texture and offset from an external source e.g. when calling BeginDraw() on IDCompositionSurface. Bug: angleproject:2997 Change-Id: I363f739f3f05c38720f385e34c91e98fc6a622a0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2186176 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Alexey Knyazev 605ab763 2020-02-24T19:43:32 D3D11: Implement OES_draw_buffers_indexed Existing CONSTANT_COLOR/CONSTANT_ALPHA limitation was generalized to independent blend states with draw call invalidation and a new end2end test. dEQP tests that are incompatible with this limitation result in INVALID_OPERATION and are marked as FAIL. D3D11 renderer always normalizes and deduplicates requested blend states based on their enabled features and bound framebuffer. Bug: angleproject:4394 Change-Id: I284796e18be71de1b5bfb087d36f6a45be4c3f70 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2070575 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev b8c6521a 2020-02-14T14:23:08 Reland "Move sampleAlphaToCoverage out of blendState" This is a reland of f6e73131c528b1317067624bc71c3ce41a48f9aa Aligned BlendStateKey fields Original change's description: > Move sampleAlphaToCoverage out of blendState > > This is the second step towards exposing OES_draw_buffers_indexed (that defines independent blend state for each draw buffer). This flag is global in all graphics APIs, however D3D11 technically puts it in the blend state. > > D3D11: BlendStateKey was extended to keep existing D3D11 state caching semantics. > > D3D9: a comment was added explaining why this feature was never implemented there. > > Bug: angleproject:4394 > Change-Id: Ie6a294eeb6fcf4c868a1f1001c4f7efd61692ccd > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057063 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Geoff Lang <geofflang@chromium.org> Bug: angleproject:4394 Change-Id: Ia7aed863f0f9f6066daf1b02ecade3256f494062 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2066698 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 38bb9fdf 2020-02-19T13:02:00 Revert "Move sampleAlphaToCoverage out of blendState" This reverts commit f6e73131c528b1317067624bc71c3ce41a48f9aa. Reason for revert: Crashes on Win10 FYI x64 Debug (NVIDIA) and Win7 FYI Debug (AMD) in the webgl CTS Original change's description: > Move sampleAlphaToCoverage out of blendState > > This is the second step towards exposing OES_draw_buffers_indexed (that defines independent blend state for each draw buffer). This flag is global in all graphics APIs, however D3D11 technically puts it in the blend state. > > D3D11: BlendStateKey was extended to keep existing D3D11 state caching semantics. > > D3D9: a comment was added explaining why this feature was never implemented there. > > Bug: angleproject:4394 > Change-Id: Ie6a294eeb6fcf4c868a1f1001c4f7efd61692ccd > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057063 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Geoff Lang <geofflang@chromium.org> TBR=geofflang@chromium.org,jmadill@chromium.org,lexa.knyazev@gmail.com Change-Id: I650624b5dfb7f2777c316906b9145a411243f42f No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:4394 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2062605 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Alexey Knyazev f6e73131 2020-02-14T14:23:08 Move sampleAlphaToCoverage out of blendState This is the second step towards exposing OES_draw_buffers_indexed (that defines independent blend state for each draw buffer). This flag is global in all graphics APIs, however D3D11 technically puts it in the blend state. D3D11: BlendStateKey was extended to keep existing D3D11 state caching semantics. D3D9: a comment was added explaining why this feature was never implemented there. Bug: angleproject:4394 Change-Id: Ie6a294eeb6fcf4c868a1f1001c4f7efd61692ccd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057063 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
shrekshao cd31f286 2019-06-25T14:22:41 Implement Draw base vertex and base instance functions This patch implements functionality of glDrawArraysInstancedBaseInstanceANGLE, glDrawElementsInstancedBaseVertexBaseInstanceANGLE, glMultiDrawArraysInstancedBaseInstanceANGLE, and glMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE Workaround for OpenGL driver on Mac: gl_VertexID on Mac with AMD GPU doesn't include baseVertex value. So replace gl_VertexID with (gl_VertexID + angle_BaseVertex) if any. Workaround for Vulkan GLSL: gl_InstanceIndex on Vulkan includes baseInstance. So replace gl_InstanceIndex with (gl_InstanceIndex - angle_BaseInstance) when angle_BaseInstance is declared. Bug: chromium:891861, angleproject:3402 Change-Id: Ia1d94b5d4d7da7e635468c05c962c4f7eb1b1919 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1750126 Commit-Queue: Shrek Shao <shrekshao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Qin Jiajia 96682377 2019-07-08T11:06:27 Fix the RTV and SRV conflict This change fixes below error: Message 0: ID3D11DeviceContext::CSSetShaderResources: Resource being set to CS shader resource slot 0 is still bound on output! Forcing to NULL. Bug: angleproject:3658 Change-Id: I72d656cf61ffb7c39660c019eab980c39eafb70f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1688307 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
Anders Leino 1245f078 2019-06-25T13:51:29 Use D3D11 GetDimensions driver workaround for dynamic images Some NVIDIA D3D11 drivers are buggy and interprets the level passed to GetDimensions as being relative to 0, rather than the SRV's MostDetailedMip. This affects the implementation of the imageSize function in the D3D11 backend. Bug: angleproject:3100 Change-Id: I1e48f5df5e40caf49a4d07662aec587e98cf8388 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1677206 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Qin Jiajia 3b225597 2019-06-17T14:18:06 Fix the DispatchCompute error The error happens when a RWTexture is used in shader. However, there is no resource binding to it. We should clear the corresponding UAV in case the previous view type is a bufer not a texture. Meanwhile, this patch removes clearSRVs/clearUAVs since we use unsetConflictingSRVs/unsetConflictingUAVs to do the similar thing. Bug: angleproject:3512, angleproject:3548 Change-Id: I01752bb9bc6aca5b767599639c4dc613b4e2e2d2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1662017 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
Stephen Martinis 88e03221 2019-05-31T12:06:28 Unset conflicting SRVs and UAVs D3D11 cannot allow the same (sub)-resource bound as both a SRV and an UAV at the same time. Unset conflicting SRVs and UVAs between render pipeline and compute pipeline. Bug: angleproject:3152 TEST=angle_end2end_tests.ComputeShaderTest.* Change-Id: I9cb8b902edbf987166a57af314af6b21a6874998 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1576504 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
Mingyu Hu 7d64c486 2019-03-12T14:27:40 GL_ANGLE_multiview has been renamed to GL_OVR_multiview2. changes include: 1) GL_OVR_multiview to GL_OVR_multiview2 extension directive change 2) Removal of all references to side by side. We no longer support multiple views in a single 2DTexture. Only 2DTextureArray's are supported 3) WebGL 2 (ES3) is required for multiview Bug: angleproject:3341 Change-Id: Ie0c1d21d7610f8feebdb2e4d01c6947f57e69328 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1552023 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Qin Jiajia e7da32f1 2018-12-27T15:31:47 Fix the failure in UpdateImageTextureInUse If we update the texture data between two dispatch calls, ReadPixels can't get right result after the second dispatch call. The failure reason is that after the first dispatch, ReadPixels will sync framebufer state which will update color render target. Finally, TextureD3D::ensureRenderTarget is reached. However, we are in compute pipeline. mTexStorage->isRenderTarget() will be false. That results the current texture will create a new render target storage. But the UAV is still bound with the previous texture storage. If there is no texture dirty bit between these two dispatch calls, applyTexturesForCompute won't be called. After the second dispatch, readPixels will read data from the new texture storage which is not updated. Bug: angleproject:3015 Change-Id: Ib2494ab8bf6e12faefc0a7370719d383526c36ba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1390710 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
Jonah Ryan-Davis eaf56133 2019-03-13T12:56:49 gl_VertexID is incorrect if offset argument to glDrawArrays is non-zero On D3D the vertex ID is always indexed from 0, unlike GL. The D3D backend had assumed the wrong behavior. This forwards the true offset to D3D by using the ConstantsBuffer. Bug: angleproject:3090 Change-Id: Ia19e3490503c97541af14979b75af0c94c67ab6b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1520988 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Enrico Galli c1c9fb1b 2018-10-18T11:41:50 ES31: Add atomic counter buffer support to D3D11 renderer Adds support for atomic counters to the D3D11 renderer using UAV. Bug: angleproject:1729 Test: angle_end2end_tests Change-Id: I2904ba62644685b7d91f7475bd80a81ae414993b Reviewed-on: https://chromium-review.googlesource.com/c/1451259 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
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>
Jamie Madill c3dc5d48 2018-12-30T12:12:04 Merge gl::Context and gl::ContextState. This reduces the number of indrections when accessing the Extensions or Caps structures. It will provide a small speed-up to some methods. It also cleans up the code. Bug: angleproject:2966 Change-Id: Idddac70758c42c1c2b75c885d0cacc8a5c458685 Reviewed-on: https://chromium-review.googlesource.com/c/1392391 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Markus Tavenrath <matavenrath@nvidia.com>
Jamie Madill 8dc27f99 2018-11-29T11:45:44 Use packed enum for DrawElementsType. The packing and unpacking take a few extra instructions. But it completely obviates the need for any switches in the validation code. Speed is slightly faster or the similar depending on the back-end. Also add gl_angle_ext.xml to GL entry point generator inputs. This was missing and would cause the code generation to miss certain changes. Bug: angleproject:2985 Change-Id: I1ea41a71db71135000166ead8305ec42d22ff7b3 Reviewed-on: https://chromium-review.googlesource.com/c/1351729 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill bfe31c42 2018-10-25T17:03:47 Remove uses of DrawCallParams. Packing and referencing this structure was causing unnecessary draw call overhead. This improves performance on all the back-ends. Impacts the GL back-end the most. In total this patch series reduces overhead by up to 5%. Bug: angleproject:2933 Change-Id: Ief416ab874e481baf960d02965978a311214a146 Reviewed-on: https://chromium-review.googlesource.com/c/1299477 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill c1fd7376 2018-10-26T22:48:39 Move index range calculations into VertexArray. This is in preparation for removing the entire DrawCallParams struct. This struct was big enough to cause a performance hit on draw call perf tests just by virtue of initializing the fields. Also dereferencing the struct members is slower than reading function parameters since it adds an indirection. Also includes some error refactoring to enable moving code to a shared location. In total this patch series reduces overhead by up to 5%. Bug: angleproject:2933 Change-Id: Ib663f2538c14ac30d4c31fd10d6350be469626e2 Reviewed-on: https://chromium-review.googlesource.com/c/1298380 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Till Rathmann b8543630 2018-10-02T19:46:14 Support GL_OES_texture_border_clamp Added support for GL_TEXTURE_BORDER_COLOR and GL_CLAMP_TO_BORDER in OpenGL/OpenGLES, Direct3D9 and Direct3D11 backends. For integer textures in OpenGLES3 contexts these additional entry points are available now: void glTexParameterIivOES(enum target, enum pname, const int *params); void glTexParameterIuivOES(enum target, enum pname, const uint *params); void glGetTexParameterIivOES(enum target, enum pname, int *params); void glGetTexParameterIuivOES(enum target, enum pname, uint *params); void glSamplerParameterIivOES(uint sampler, enum pname, const int *params); void glSamplerParameterIuivOES(uint sampler, enum pname, const uint *params); void glGetSamplerParameterIivOES(uint sampler, enum pname, int *params); void glGetSamplerParameterIuivOES(uint sampler, enum pname, uint *params); BUG=angleproject:2890 TEST=angle_end2end_tests.TextureBorderClamp* Change-Id: Iee3eeb399d8d7851b3b30694ad8f21a2111f5828 Reviewed-on: https://chromium-review.googlesource.com/c/1257824 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Qin Jiajia a602f906 2018-09-11T14:40:24 ES31: Support shader storage buffer in D3D-API side. Bug: angleproject:1951 Test: angle_end2end_tests Change-Id: I0d8a4f8cf00fc7fd2d85315138e2b7457fd0b90c Reviewed-on: https://chromium-review.googlesource.com/1242846 Commit-Queue: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
jchen10 99118c1c 2018-09-10T16:28:51 Improve dirtybits for compute For D3D11 backend, dirtybits are used to sync and update state for compute. For GL backend, mProgramUniformBuffersDirty, mProgramAtomicCounterBuffersDirty, mProgramImagesDirty are newly applied. Bug: angleproject:2814 Change-Id: Ia459ca26705b7c685179d64e0c934535bf16741f Reviewed-on: https://chromium-review.googlesource.com/1215245 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Qin Jiajia 155bfd11 2018-08-31T17:27:10 Fix that same resource is bound on SRV and UAV simultaneously This change makes sure that resource being set to UnorderedAccessView slot is not bound on ShaderResourceView and resource being set to shader resource slot is not bound on UnorderedAccessView. Bug: angleproject:2768 Change-Id: I52fc5bf5e76ccf8be61c59b2195459728f95e536 Reviewed-on: https://chromium-review.googlesource.com/1201324 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
Xinghua Cao 913ff54d 2018-08-07T15:14:05 ES31: support compute shader uniform buffer on D3D backend BUG=angleproject:2759 TEST=angle_end2end_tests.ComputeShaderTest.UniformBuffer/ES3_1_D3D11 Change-Id: I92326c3a84f13b364aed0daf567b68f8a411ed2b Reviewed-on: https://chromium-review.googlesource.com/1164843 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
Xinghua Cao 6dfdca83 2018-08-03T17:10:55 ES31: support compute shader sampling on D3D backend BUG=angleproject:2756 TEST=angle_end2end_tests.ComputeShaderTest.SamplingAndImageReadWrite/ES3_1_D3D11 Change-Id: I8f112227c5703fcaafffbd2262e6a039f869c483 Reviewed-on: https://chromium-review.googlesource.com/1161754 Commit-Queue: Xinghua Cao <xinghua.cao@intel.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 6d32cefd 2018-08-14T02:34:28 Use Observer pattern for Buffers in front-end. This will allow us to react to state change notifications for validation caching. It also cleans up some of the logic in the D3D11 State Manager. Bug: angleproject:2747 Change-Id: I85ed6404206c2b9bf504d552cf5751be56e62146 Reviewed-on: https://chromium-review.googlesource.com/1172086 Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Till Rathmann c1551dc2 2018-08-15T17:04:49 D3D11 fix: Mipmapping was used although disabled via Sampler When using a sampler the texture was created as if it has mipmaps, regardless what you specified in GL_TEXTURE_MIN_FILTER via glSamplerParameteri() -- mistakenly the default value GL_NEAREST_MIPMAP_LINEAR or the value set via glTexParameteri() was evaluated. If you didn't provide mipmaps and didn't let the driver generate them this led to not sampling your texture data when minification occurred. BUG=angleproject:2772 TEST=angle_end2end_tests.Texture2DTestES3.MinificationWithSamplerNoMipmapping Change-Id: I195147e208129c6fa8686bb0d9aea6931b2f20b1 Reviewed-on: https://chromium-review.googlesource.com/1175910 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 306b6c16 2018-07-27T08:12:49 D3D11: Use angle::Result error pattern. 1/3 This CL improves performance on the draw call microbenchmark by 10% when no-oping driver calls. Bug: angleproject:2738 Change-Id: I4f5c11db90d9056ce4557b2a4432bc55b42b5bba Reviewed-on: https://chromium-review.googlesource.com/1150093 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill b1565903 2018-07-27T08:12:48 D3D: Pass gl::Context to many more functions. This makes the Context more available for logging errors. Also includes more refactoring to VertexDataManager to ensure we can access the gl::Context. Bug: angleproject:2738 Change-Id: Iae3d22a1403078d236bfe63a3e2d203c13678dc4 Reviewed-on: https://chromium-review.googlesource.com/1151449 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis d7890bca 2018-06-29T11:57:22 Skip noop draws in the frontend If a draw does not have enough vertices for its primitive count to produce a primitive then skip it. If an instanced draw has 0 instances or not have enough vertices for its primitive count to produce a primitive then skip it. This means a Point with 0 vertices, a Line w/ 0-1 vertices, or a tri with 0-2 primitives. Updated some redundant code in the D3D11 backend. Draws below the minDrawCount will no longer be passed to the backend so updated the associated state in StateManager11 to only track the case where all primitives should be culled due to GL state settings. BUG=angleproject:2568 TEST=functional_transform_feedback_basic_types_interleaved_lines_lowp_int Change-Id: I9faa767c12004fcdec923ec70a8ee5615d789813 Reviewed-on: https://chromium-review.googlesource.com/1120849 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jiawei Shao a914f7ff 2018-06-08T10:07:41 Use ShaderMap in Statemanager11 - Part II This patch is the last patch of storing shader resources into ShaderMap in Statemanager11. This patch also splits several large functions into smaller one to make the code structure clearer. BUG=angleproject:2169 Change-Id: Id6d89976de0376b2479bd11d7551fc6f5b521c13 Reviewed-on: https://chromium-review.googlesource.com/1092511 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Jiawei Shao 81970bc3 2018-06-06T11:11:56 Use ShaderMap in DynamicHLSL and StateManager11 - Part I This patch is the first one of using ShaderMap in both DynamicHLSL and StateManager11 to make the code cleaner and more straightforward. BUG=angleproject:2169 Change-Id: I2b206d0250f5ced071cc1c3632367b16e5e02dfb Reviewed-on: https://chromium-review.googlesource.com/1089473 Reviewed-by: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Jamie Madill 4166f014 2018-05-31T14:53:30 D3D11: Optimize Renderer11::drawArrays. Uses inlining and more efficient computation re-use to streamline this function. Bug: angleproject:2575 Change-Id: Ib13e32811f56ec9a010ed66f298d4235e5c6807d Reviewed-on: https://chromium-review.googlesource.com/1067120 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2274b652 2018-05-31T10:56:08 StateManager11: Cache impl objects. Also requires putting the Framebuffer ID in the shared state object. Bug: angleproject:2575 Change-Id: I68e3af839a85798e01050560a67624a165d3ed2c Reviewed-on: https://chromium-review.googlesource.com/1067119 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 493f9571 2018-05-24T19:52:15 Add PrimitiveMode packed GLenum. Bug: angleproject:2574 Change-Id: I3d7bd7ca0d69a364a611dc04799ea34906fc4a6c Reviewed-on: https://chromium-review.googlesource.com/1067114 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jiawei Shao 3dd8d291 2018-03-30T09:39:09 Use ShaderBitSet for active use bits on uniforms BUG=angleproject:2169 Change-Id: I192c2e3c453540c8a6d7b0d066218ea3c9fbaab2 Reviewed-on: https://chromium-review.googlesource.com/989411 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 0946393d 2018-04-04T05:26:59 Move Buffer Subject/Observer to front end. This makes BufferImpl into an Observer Subject. It also refactors the Vertex Array updates for the D3D11 backend use more of a dirty bit coding style. This change makes it so Buffer contents changes trigger front-end dirty bits from the back-end, which may be undesirable. Bug: angleproject:2389 Change-Id: Iac8ce1171284a86851c18cd1373ddf24fcefe40b Reviewed-on: https://chromium-review.googlesource.com/979812 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill d7518622 2018-03-27T09:44:31 Buffer11: Refactor Subject/Observer pattern. Instead of having a direct/static observer distinction, add two messages for 'Contents Changed' and 'Storage Changed'. This makes Buffer11 itself the subject with two different message handling cases in the onSubjectStateChange methods. Bug: angleproject:2389 Change-Id: I645cd4b7cc7ce51cb7f48a01c7fc72939cbe89fe Reviewed-on: https://chromium-review.googlesource.com/957940 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill e403eef9 2018-03-27T09:50:00 D3D11: Add primitive type dirty bits. Bug: angleproject:1155 Bug: angleproject:2389 Change-Id: If410bc9e2ea97385def5d6a8a95d6bf6ea4c6a28 Reviewed-on: https://chromium-review.googlesource.com/948797 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill d779f6a9 2018-03-23T01:44:33 D3D11: Refactor draw call functions. This allow for better code reuse for the Indirect draw calls. It also cleans up the InputLayoutCache to be only responsible for caching input layouts, and moves the logic for maintaining state into StateManager11. Bug: angleproject:2389 Change-Id: I84aae164bf1b94a394743cf58650adfdcfc2c17a Reviewed-on: https://chromium-review.googlesource.com/948796 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill dfebe9b2 2018-03-14T10:08:12 D3D11: Add dirty bits for Transform Feedback. After testing, it seems practially impossible to trigger a dependent state change in a Buffer that would affect XFB. Any buffer change would have to happen between a pause or begin/end of XFB, which would trigger a state update. Bug: angleproject:1155 Bug: angleproject:2389 Change-Id: Ic3c1dc7cec661a826909bb5647ddabda1d6fb7fc Reviewed-on: https://chromium-review.googlesource.com/948795 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6f5444da 2018-03-14T10:08:11 Remove HasIndexRange. This is superseded by the DrawCallParams class. Instead of storing the context, we also return an error from the index range resolution. Bug: angleproject:2389 Change-Id: I9e7d58f006f51872eb3b52cbb9efbee16fff7ef6 Reviewed-on: https://chromium-review.googlesource.com/960570 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 97ab26fc 2018-03-14T10:08:10 Move DrawCallParams to the gl front-end. Previously called DrawCallVertexParams. This params helper will be passed into the VertexArray state sync method so we can handle vertex attribute updates directly in the VertexArray implementation instead of deferring the updates to the draw call, where the draw call implementation method would have access to the draw call params. Also includes the full range of draw parameters to DrawCallParams so we can use it in more places. Refactoring change only, subsequent work will contain more refactoring and lead to code cleanups and easier dependent state updates for the VertexArray implementation classes. Bug: angleproject:2389 Change-Id: Ia84f8af54ae51eca94d8fb6f5b8adc88b8d981a7 Reviewed-on: https://chromium-review.googlesource.com/948787 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 87db7c52 2018-03-14T10:08:10 D3D11: Minor cleanup to DrawCallVertexParams. The 'firstVertexDefinitelyZero' argument didn't actually have any behavioural change to the code, so remove it. Also add an explicit call to resolve the index range, instead of doing it implicitly when certain values were queried. Bug: angleproject:2389 Change-Id: I377c79006bfa541183fe94d0ed199fbaa1132afc Reviewed-on: https://chromium-review.googlesource.com/948786 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Dzmitry Malyshau b3b177d7 2018-03-09T16:37:22 Update driver constants on program change. Comes with a new SamplerMetadataUpdateOnSetProgram test. This is a fix for a graphics problem we've been seeing for a while with WebRender+Angle on Nvidia/Windows. The sampler metadata doesn't get updated properly for some of the draw calls, since it's not invalidated on program change (this is what the CL is fixing). Extra entries get filled with garbage data because the constant buffer is updated with `MAP_WRITE_DISCARD`, and only those samplers are updated that the current program has. This may generally occur undetected, if not for our `textureSize` calls that appear to go the NV-specific Angle workaround path that ignores our `baseLevel = 0` and instead picks the one from the driver constants (which contains garbage), leading to either zeroes returned or even crashing the driver sometimes... BUG=angleproject:2399 Change-Id: Ie2bef32184e2305c7255299933b899eb3fffb7ab Reviewed-on: https://chromium-review.googlesource.com/949412 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jamie Madill d444255a 2018-02-27T22:03:47 Refactor signal utils into Observer pattern. These types were over-generalized. All use cases featured arrays of resources attached to single parent resources. The channel ID is sufficient to identify the child resource in the parent, and having variadic template arguments wasn't necessary. Futhermore we can rename these types to use the common Observer pattern. This should make them more readable to new developers. Also update some classes to inherit from Subject instead of having a member Subject. This cleans up the code in a few places. This should lead to a simpler refactor to allow dependent dirty bits notifications in the Vulkan back-end. In the following patch the signal_utils files will be renamed. They are not renamed in this patch to ensure git history is preserved. Bug: angleproject:2372 Change-Id: I17a3f2c8d92afd4bb3cba2d378c3a2e8a6d7fb11 Reviewed-on: https://chromium-review.googlesource.com/936690 Reviewed-by: Luc Ferron <lucferron@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: 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>
Bryan Bernhart (Intel Americas Inc) ca71c75d 2017-12-15T13:39:57 Fix error handling of ID3D11DeviceContext::Map Refactors error handling should map() fail to avoid crashing during a device error event. BUG=angleproject:2284 Change-Id: Ib1eb676860fa5c3a81e523f49aab82b7e6700f73 Reviewed-on: https://chromium-review.googlesource.com/826485 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: 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>
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>
Jamie Madill d3e213bc 2017-11-27T18:33:41 Add a gl::AttribArray helper type. This is a generic std::array sized to gl::MAX_VERTEX_ATTRIBS. Bug: angleproject:2264 Change-Id: I788659ad25be5708dbab422ac4a16dff60abf154 Reviewed-on: https://chromium-review.googlesource.com/790750 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 8e4bb4b1 2017-11-22T18:59:51 D3D11: Cache element array buffer updates. This attempts to reduce the amount of redundant validation done between indexed draw calls. It keeps the cached info in the VertexArray11 class. It also includes a fix to a missing direct buffer invalidation in CopyBufferSubData which was turning up with the new caching. Reduces overhead in the D3D11 indexed rendering perf test such that it leads to an increased score of about 20%. BUG=angleproject:2229 Change-Id: I63121bea19a9c8198e1925ed6a1460838e8f8955 Reviewed-on: https://chromium-review.googlesource.com/765262 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill c7b0cf2a 2017-11-22T16:34:09 D3D11: Remove "fast path" check in DrawElements. This was a bit of an anti-pattern. Many draw calls were being handled in the "slow" path, so the repeated checks were slowing the draw calls down more than the fast path was speeding things up. The new code tries to do all the checking for index ranges and restart index once only, and lazily when possible. The 'start' vertex is a bit of a special case - we known when the primitive restart index is not enabled, this will be always the same as the 'base' vertex (zero if the base vertex is not enabled - only currently available through draw indirect commands). In future work we can look at implementing a lazy evaluation for draw indirect commands so we don't need to do a check there either. Reduces overhead in the D3D11 indexed rendering perf test such that it leads to an increased score of about 5%. BUG=angleproject:2229 Change-Id: I6330f30b66d1810624d03f4e7a012bf2391a3bf3 Reviewed-on: https://chromium-review.googlesource.com/764677 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@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 378734c5 2017-11-20T16:32:56 D3D11: Lazy evaluation for draw call vertex params. The vertex params are the 'start' vertex index and the number of vertices in the draw call. For indexed draws, they sometimes mean we need to compute the index range. In other cases, we don't. Defer computing the index range as long as possible so we don't end up computing the index range when we don't have to. BUG=angleproject:2229 Change-Id: I8e125416ef6767787a14509b322efa8dcd8e4a34 Reviewed-on: https://chromium-review.googlesource.com/764676 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill 03fd0356 2017-11-20T16:30:10 D3D11: Push index range computation deeper. If we can make the index range computation happen as late as possible, we won't have to check it during the fastest draw call paths. This change makes it easier to skip re-computing some index range checks by only checking it in one place in IndexDataManager, and by making it a lazy check; the check is never evaluated if the primitive restart workaround is not enabled. Future work can also push the index range computation for vertex info later, so we only evaluate it in the cases where we need it. BUG=angleproject:2229 Change-Id: Ic55fac9e23fd35a119ddff475355a43095d2e3e9 Reviewed-on: https://chromium-review.googlesource.com/764675 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 42975644 2017-10-12T12:31:51 Move incomplete texture logic to shared helper. The incomplete texture handling is similar between the D3D and Vulkan back-ends. We create 1x1 textures, initialize them to black, and bind them when we detect incomplete textures. We would also bind incomplete textures when we detect feedback loops. In the GL back-end, we wouldn't detect feedback loops, and would allow the driver to handle incompleteness. Instead implement this in a shared helper class, and do the feedback loop detection in the front-end for every back-end. This makes our behaviour more consistent between back-ends, and prevents undefined behaviour. Because initializing multisample textures is tricky (they can't be updated with TexImage calls) we do a bit of a workaround so the back-end can clear the incomplete multisample texture initially. This progresses the initial Vulkan textures implementation. BUG=angleproject:2167 Change-Id: I79ddcc0711fcc986f2578a52ac6f701231d241ac Reviewed-on: https://chromium-review.googlesource.com/700993 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Qin Jiajia e416e527 2017-10-10T11:01:20 Remove some unused codes This patch will remove unused functions syncVertexAttributes and hasDirtyOrDynamicAttrib, and private member mAppliedIBChanged. Meanwhile, it changes hasDynamicAttrib to hasActiveDynamicAttrib to avoid unnecessary update in some cases. BUG=angleproject:1155 Change-Id: I29a0aa7fbc13874b7b070cf1ac5ec4134728f519 Reviewed-on: https://chromium-review.googlesource.com/707014 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jamie Madill 1f9d6843 2017-09-21T11:01:44 StateManager11: Defer RenderTarget invalidation to draw. Although this adds a boolean check (and state flag maintenance) cost to each draw call, it makes ANGLE's internal life a lot simpler because it doesn't have to process a framebuffer change until the draw call. It turns out there are a few dependent checks of the Framebuffer that aren't always easy to do. In one test, Context destruction was triggering RenderTarget invalidation, after the Context had already freed the Framebuffer manager. This also fixes the problem in feature level 9_3 with framebuffer invalidation affecting the internal dirty bit set. (Note that it still dirties the Framebuffer for the next frame). BUG=chromium:767279 BUG=angleproject:2151 Change-Id: I74d61bddf9926004a04f712a9f9eb1205d5df0e1 Reviewed-on: https://chromium-review.googlesource.com/676657 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2bc94733 2017-09-20T21:57:29 D3D11: Minor optimizations to vertex attribute application. Introduce a dirty bit for current value attribs, and try to speed up the check for dirty vertex attribs. This series of small optimizations gives about a 15% improvement on the draw call benchmark for the D3D11 backend with the null driver. BUG=angleproject:1155 Change-Id: Idf560efa3af62776e8bdbdf693f8b06db8792c21 Reviewed-on: https://chromium-review.googlesource.com/666048 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill f1581583 2017-09-20T21:57:28 Minor cleanup to setIndexBuffer. This cleans up the point sprites dirtying logic into applyIndexBuffer. This series of small optimizations gives about a 15% improvement on the draw call benchmark for the D3D11 backend with the null driver. BUG=angleproject:1155 Change-Id: I210dd408d11ef5a0b58b0ad32d1255c787a55fba Reviewed-on: https://chromium-review.googlesource.com/666047 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill c8bee335 2017-09-20T15:42:09 D3D11: Implement a dirty bit for Shaders. This allows us to skip calling the dynamic shader generation and program shader application when there haven't been any state changes. It builds on the previous work that immediately update state caches in the VertexArray11 and Framebuffer11. It should improve performance in draw-call limited applications by a small margin. For reference, here are the conditions under which the shaders are refreshed: 1. Directly changing the program executable 2. The vertex attribute layout 3. The fragment shader's rendertargets 4. Enabling/disabling rasterizer discard 5. Enabling/disabling transform feedback 6. An internal shader was used 7. Drawing with/without point sprites Improves the score of the draw call stress test for the D3D11 back-end (with null driver) by about 40% on my test machine. The 9_3 back-end seems to have an issue where the getSRV call to a texture storage can change the "use level zero workaround" status of the storage, which in turn will invalidate the state. Since this is localized to 9_3 only, put in a hack to disable an assert check for now. BUG=angleproject:2151 Change-Id: Idbd0a31376691b33972e735d5833a9b02a8a4aa9 Reviewed-on: https://chromium-review.googlesource.com/666278 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill ace6822c 2017-09-12T21:56:20 Remove Renderer11::markAllStateDirty. Also remove StateManager11::invalidateEverything. With all state application consolidated in the StateManager, it should be aware of all state changes, and shouldn't need outside notifications. BUG=angleproject:2052 Change-Id: I6748b3944b25f958fa093052bcb7336e66255dd4 Reviewed-on: https://chromium-review.googlesource.com/659400 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 2cedb58c 2017-09-12T15:23:08 D3D11: Consolidate Scissor state application. BUG=angleproject:2052 Change-Id: Ib6f55be3d71d083a87e845447f174a55413c8a2f Reviewed-on: https://chromium-review.googlesource.com/659398 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill da7185fb 2017-09-12T15:23:07 D3D11: Consolidate SRV and Sampler application. This adds an internal and external version of the setShaderResource method. The external version sets the state as dirty. BUG=angleproject:2052 Change-Id: I6d2d47490c0af89ff5592d4e9c53eb69f8a3264d Reviewed-on: https://chromium-review.googlesource.com/659397 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7ef2ddab 2017-09-12T15:23:06 D3D11: Consolidate Viewport state application. BUG=angleproject:2052 Change-Id: I1cbf2adc09c82b9de68785265def9361eff418b3 Reviewed-on: https://chromium-review.googlesource.com/659236 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7f4fed80 2017-09-12T15:23:05 D3D11: Consolidate Rasterizer State application. BUG=angleproject:2052 Change-Id: I11094744bab4570712632a424f29dff8b19a8dea Reviewed-on: https://chromium-review.googlesource.com/659235 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill b05f3659 2017-09-12T15:23:05 D3D11: Consolidate Blend State application. This will make it easier to implement fast state switching on Context change. BUG=angleproject:2052 Change-Id: I045cc2164200a93215629a2746068e686d7c99ff Reviewed-on: https://chromium-review.googlesource.com/659234 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 518f5d55 2017-09-12T15:23:04 D3D11: Consolidate Depth Stencil State application. This will make it easier to do state update on context switch. BUG=angleproject:2052 Change-Id: Ia73cfd07ced40a9e22d6b34a5619250ede9e8844 Reviewed-on: https://chromium-review.googlesource.com/659233 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 85b63c8e 2017-09-12T15:23:03 D3D11: Consolidate OMSetRenderTargets calls. There were a few calls that were using the context directly. Consolidating them in the StateManager11 class should make efficient state update after a Context switch possible. Also remove the Context parameter from the setRenderTargets methods, since these are only used internally and should be dirtying other states themselves. BUG=angleproject:2052 Change-Id: I878c99fbde7a467f30cc89f2ee5aca476b8cf506 Reviewed-on: https://chromium-review.googlesource.com/659232 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 cd8e9729 2017-09-12T15:22:59 StateManager11: Add internal dirty bits for uniforms. This eliminates some of the redundant work we do in uniform state updates. Driver uniforms and constant buffers are no longer synched with every draw call, but only when the StateManager11 thinks they might be dirty. Should improve overall draw call throughput. BUG=angleproject:1155 BUG=angleproject:1390 Change-Id: I351c23fb18dcb3ef2f79e3b4f411e1e09c6300dc Reviewed-on: https://chromium-review.googlesource.com/659228 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 2dc027da 2017-09-12T15:22:58 D3D11: Consolidate constant buffer application. This will let the StateManager11 work more easily with dirty bits. BUG=angleproject:1390 BUG=angleproject:2052 Change-Id: I9738d02e69e2062feeba4237487ad8e9ae86e78b Reviewed-on: https://chromium-review.googlesource.com/659227 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@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 eb335950 2017-09-09T23:32:49 D3D11: Only update swizzles after a state change. Triggers the swizzle update whenever a new texture is bound, or when a subImage call triggers a swizzle cache update. BUG=angleproject:1387 Change-Id: Ia2a82126a621d8a643f715ea7e4a9c35b97e0a18 Reviewed-on: https://chromium-review.googlesource.com/648729 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>
Jamie Madill 92515f44 2017-09-09T23:32:48 Move swizzling and program update to StateManager11. This makes it in a centralized location where it can work with dirty bits. BUG=angleproject:1387 Change-Id: I3bfeb53c265d1679f6b8556941c1d9d77747aa24 Reviewed-on: https://chromium-review.googlesource.com/648486 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Martin Radev 72b4e1e5 2017-08-31T15:42:56 D3D11: Add support for multiview layered rendering A branch is added in the geometry shader to select either the viewport, or texture layer which is being rendered to based on the value of a uniform in the driver constant buffer. Using this approach there is no need for separate programs for side-by-side and layered rendering. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: I66701164ff02a851c13695d5409f8ad350534e69 Reviewed-on: https://chromium-review.googlesource.com/645547 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Martin Radev ced5c86c 2017-08-17T16:05:29 D3D11: Handle multi-view Draw* calls Because the ANGLE_multiview extension uses instancing to multiply geometry for each view, Draw* calls with an active multiview program have to be handled in the follwing way: 1) Convert non-instanced Draw calls to their instanced versions. 2) Multiply the number of instances in an instanced Draw call by the number of views. The patch also applies the viewport offsets to the viewport and scissor rectangle and propagates the computed viewports and scissors to the D3D11 runtime. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: I8b4295c95c2cc0c1046c67e1fb1a782a46703292 Reviewed-on: https://chromium-review.googlesource.com/618331 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
JiangYizhou 511937d9 2017-08-03T15:41:29 ES3.1: Implement framebuffer default parameters for d3d part. Set framebuffer default params with glFramebufferParameteri and glGetFramebufferParameteriv, keep framebuffer default parameters in cache for query. The es 3.1 spec section 9.2 states that, "If there are no attachments , rendering will be limited to a rectangle having a lower left of (0, 0) and an upper right of (width, height), where width and height are the framebuffer object's default width and height." If the Framebuffer has no color attachment and the default width or height is smaller than the current viewport, use the smaller of the two sizes. BUG=angleproject:1594 TEST=dEQP-GLES31.functional.state_query.framebuffer_default.framebuffer_default* TEST=dEQP-GLES31.functional.fbo.completeness.no_attachments TEST=dEQP-GLES31.functional.fbo.no_attachments.* TEST=angle_end2end_tests --gtest_filter=FramebufferTest_ES31.* Change-Id: I8041fd655161390acf115efa08ce0f04b10810a0 Reviewed-on: https://chromium-review.googlesource.com/609414 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill abf66fb3 2017-08-23T11:58:27 D3D11: Use dirty bits for applyVertexBuffers. If the vertex array has any dirty or dynamic attribs, we must do an update. Similarly, if a prior state change has left the vertex state invalidated, we do an update. For instance, a program change means we need a new input layout. If there was no such invalidation or dirtyness we can skip the call to InputLayoutCache. This improves the performance of the draw call benchmark (with no state changes) by about 50% on the D3D11 null driver. Increases the frames per second count of the aquarium demo with the passthrough command buffer by about 25% on a test machine. BUG=angleproject:1156 Change-Id: I8381999029f5b1912030a3342e96285a58f95e82 Reviewed-on: https://chromium-review.googlesource.com/616784 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill e3d8628d 2017-08-22T11:50:01 D3D11: Split input layout and VB application. This will enable future optimizations that only update either the applied vertex buffers or the input layout independenty. It also makes debugging a bit easier since we can force an update of the vertex buffer or input layout to diagnose potential state sync bugs. BUG=angleproject:1156 Change-Id: Ib375561528da539e136ff4fd02398b03c9caabb7 Reviewed-on: https://chromium-review.googlesource.com/627077 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 401345e4 2017-08-21T10:52:40 D3D11: Move more state into StateManager11. This moves the input layout cache and vertex and index data managers and related info into the state manager. This makes it easier to manage the state application with regards to dirty bits. Also updates the dirty current value handling in StateManager11. BUG=angleproject:1156 BUG=angleproject:2052 Change-Id: I8de968a1f8416363aa1c49d9e9da129942d21275 Reviewed-on: https://chromium-review.googlesource.com/616783 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 9603a956 2017-07-20T17:24:02 D3D11: Move applyShaders to StateManager11. This also moves the shader application to happen before any of the other state sync work. In order to do this, we must split off the uniform application to happen after the viewport sync, because the driver uniforms for the viewport size can change. This prepares the D3D11 back-end for updating the programs before a draw call, including refreshing binary cache entries. BUG=angleproject:1156 Change-Id: Ie491e8ddb69ff44ebe076c56ebd39c4b46a4d2b2 Reviewed-on: https://chromium-review.googlesource.com/531797 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 253daa56 2017-07-20T17:24:01 D3D: Split applyTextures into each back-end. This paves the way for a dirty bits implementation for Textures, and also will allow more precise ordering of the state update in D3D11. The latter becomes important when moving the shader application. Because the texture update can affect the built-in driver uniforms, we neeed to update textures before we update the uniforms. BUG=angleproject:1156 BUG=angleproject:1387 Change-Id: I995e095517c598d8672c6400d08a430da0e8339b Reviewed-on: https://chromium-review.googlesource.com/580361 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill a59a1c1e 2017-07-12T15:46:26 D3D11: Consolidate shader state application. This consolidates all the state changes for shaders into StateManager11. BUG=angleproject:2052 Change-Id: I64dc3af5b0f1459442369e09f93a9ca8ce3232b3 Reviewed-on: https://chromium-review.googlesource.com/531796 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 95107bc8 2017-07-12T15:46:25 D3D11: Consolidate primitive topology application. BUG=angleproject:2045 Change-Id: Ie1deac50a534ee748518d9ec5e6f749f3c78b53d Reviewed-on: https://chromium-review.googlesource.com/531795 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6dd06eac 2017-07-19T13:47:55 Give StateManager11 internal dirty bits. Intead of checking a series of bools and special variables, organize the state application into a switch with internal dirty bits. This should be faster for no-op, and makes it clear where we have to further optimize the state update to pre-compute certain values. BUG=angleproject:1156 Change-Id: I8eca8716340499085afa170ff45f7788e84fecab Reviewed-on: https://chromium-review.googlesource.com/531794 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 9c335865 2017-07-18T11:51:38 Refactor StateManager11 for dirty bits. This will make iterating over an internal set of dirty bits simpler. This also reorganizes the framebuffer invalidation logic a bit, including how the sample count is pulled from the Framebuffer. BUG=angleproject:1156 Change-Id: I79dbcd11704ab52568c587d836af9c1bff1d2d1f Reviewed-on: https://chromium-review.googlesource.com/529708 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez db9e5d31 2017-06-12T12:05:45 D3D11: Only apply attachments that are written by the program This works around a bug in the AMD driver that writes 0's to the first attachment if it isn't written by the pixel shader. BUG=angleproject:2048 Change-Id: I384fd60c0e0a37fbc0fd7b69fe1ec74fe4ffac8f Reviewed-on: https://chromium-review.googlesource.com/531630 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 4928b7ca 2017-06-20T12:57:39 Proliferate gl::Context everywhere. This gives the D3D back-end access to the GL state almost anywhere. This uses the onDestroy hook for Textures to push errors up from destructors, although they still don't quite make it to the Context. There are places, such as in EGL object (Context/Surface) destruction, where we end up calling through to GL implementation internals without having access to a gl::Context. We handle this via a proxy Context to a Display, basically a null context, that has access to impl-side state like the Renderer pointer if necessary. It does not have access to the normal GL state. Also Pass gl::Context to RefCountObject::release(). Since we're using destroy() methods now, we should not ever call the destructor directly. BUG=angleproject:1156 Change-Id: Ie4c32ad6bf6caaff0289901f30b5c6bafa2ce259 Reviewed-on: https://chromium-review.googlesource.com/529707 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>