Commit Graph
298 Commits
Author SHA1 Message Date
Xinyi He 4c7db77e01 Vulkan: Set limitation on maxComputeWorkGroupCount
According to Table 20.45 and Chapter 17 in the ES 3.1 spec, MAX_COMPUTE_WORK_GROUP_COUNT
is get as a GLint by using GetIntegeri_v. However, it is an unsigned integer
in the Vulkan. It needs to set limitation on maxComputeWorkGroupCount[] during
translating.

1. Change the data type to GLint stored in Caps.
2. Ensure that the limitation is set during initialization.
3. Add workaround for angleproject:4120

Bug: angleproject:4066
Change-Id: I1659ba1d560e30b9599cace0feeab8a18890c3ff
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1890586
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Ian Elliott <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2019-11-22 18:11:04 +00:00
Tim Van Patten c5c096aab4 Enable Compute Shader Program Input Queries
Compute shader inputs were not being tracked in the Shader or Program
states, causing program interface queries to fail. This change treats
compute shader inputs (all built-ins) as Attributes and pipes them
through from the Compiler to the Program to enable input queries. While
compute shader inputs are not technically attributes (or varyings),
the ANGLE code understands and handles attributes and a program
can never have both a vertex and compute shader, so there can't be any
conflicts.

The naming of these variable lists should probabaly be revisited at some
point to better handle these different use-cases.

Bug: angleproject:3596
Test: dEQP-GLES31.functional.program_interface_query.program_input.resource_list.compute.empty
Change-Id: Ie52cd59041868cfdb5d3d759bb4ec53c8d5b38d5
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1919557
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Cody Northrop <[email protected]>
Commit-Queue: Tim Van Patten <[email protected]>
2019-11-21 22:40:02 +00:00
Tim Van Patten 616a4dc0f2 Vulkan: Full support for program interface queries
Program interface queries are a generic way to query attributes of
the program like uniforms, samplers, attributes, etc. This change
supports those queries for program outputs.

Bug: angleproject:3596
Test: dEQP-GLES31.functional.program_interface_query.*
Test: ProgramInterfaceTest.cpp
Change-Id: I0f13692949073b45988b6f930eee9eaa6411bbe2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1801998
Commit-Queue: Tim Van Patten <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2019-10-01 20:47:19 +00:00
Jaedon Lee a0159c0348 Vulkan: Implement basic geometry shader feature
Enable the default behavior of the geometry shader

Bug: angleproject:3571
Test: dEQP-GLES31.functional.geometry_shading.input.basic_primitive.points
      dEQP-GLES31.functional.geometry_shading.input.basic_primitive.lines
      dEQP-GLES31.functional.geometry_shading.input.basic_primitive.line_loop
      dEQP-GLES31.functional.geometry_shading.input.basic_primitive.line_strip
      dEQP-GLES31.functional.geometry_shading.input.basic_primitive.triangles
      dEQP-GLES31.functional.geometry_shading.input.basic_primitive.triangle_strip
      dEQP-GLES31.functional.geometry_shading.input.basic_primitive.triangle_fan
Change-Id: I65708d19bbfe6a0ad8ca392a1d6b3609b1410ef4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1793753
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2019-09-27 12:25:46 +00:00
Tim Van Patten 790abf03b6 Vulkan: Support program interface queries for inputs
Program interface queries are a generic way to query attributes of
the program like uniforms, samplers, attributes, etc. This change
supports those queries for program inputs.

Bug: angleproject:3596
Test: dEQP-GLES31.functional.program_interface_query.*
Test: ProgramInterfaceTest.cpp
Change-Id: Ie904274f4efd87357256f559b69e148e8eda6119
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1775458
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Tim Van Patten <[email protected]>
2019-09-11 21:26:40 +00:00
Tim Van Patten 90a58622fd Refactor ShaderVariable to Remove Specializations
The following structs are being refactored and moved into the parent
struct ShaderVariable:

VariableWithLocation
Uniform
Attribute
OutputVariable
InterfaceBlockField
Varying

Bug: angleproject:3899
Test: CQ
Change-Id: I389eb3ab4ed44a360e09fca75ecc78d64a277f83
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1785877
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Courtney Goeltzenleuchter <[email protected]>
Commit-Queue: Tim Van Patten <[email protected]>
2019-09-06 14:51:31 +00:00
Shahbaz Youssefi 912e52d81e Vulkan: Storage image support
Image bindings are placed after atomic counters in the "resources"
descriptor set.

There are two issues yet to be addressed:

- GL can create a 2D (array) view of a 3D image, but this is not allowed
  in Vulkan.  If this cannot be made possible, emulation needs to be
  done.

  https://github.com/KhronosGroup/Vulkan-Docs/issues/1033

- GL can create an image view of a texture with a different format and
  have the data reinterpreted.  This is not currently done.

Bug: angleproject:3563
Change-Id: I95c4d92c50bb033212a9a67f3f2d6f97c074c7bf
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1767366
Commit-Queue: Shahbaz Youssefi <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2019-08-31 20:13:05 +00:00
Jiacheng Lu 120b61d34b Use ShaderProgramID in place of GLuint handles
Bug: angleproject:3804
Change-Id: I5dc640004c2cc054c53261e8e939b6a9f5fc23bb
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1762363
Commit-Queue: Jiacheng Lu <[email protected]>
Reviewed-by: Tobin Ehlis <[email protected]>
2019-08-29 23:21:23 +00:00
Tim Van Patten 5d27a69616 Support separable shader programs
The spec states:
  Shader stages including vertex shaders, fragment shaders, and compute
  shaders...A single program object can contain all of these shaders, or
  any subset thereof.

This change allows shader programs without a fragment shader. The
biggest driver of this change is dEQP since a large number of tests
create shader programs without a fragment shader.

Bug: angleproject:3803
Test: dEQP-GLES31.functional.program_interface_query
Change-Id: Id6cb098c62a1489a14b9ec1b31bd4cd59f655e49
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1752010
Commit-Queue: Tim Van Patten <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Cody Northrop <[email protected]>
Reviewed-by: Tim Van Patten <[email protected]>
2019-08-29 01:39:57 +00:00
shrekshao cd31f2860b 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 <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2019-08-26 21:33:24 +00:00
Jamie Madill 125154257b Remove context from linking state.
This Context could already be deleted from another thread. Better to
use save/load with the current thread.

Bug: angleproject:2464
Change-Id: Id7879a53bdfb7d1c86b09bb3e779a87afdefa873
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1756086
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Tobin Ehlis <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2019-08-16 14:02:38 +00:00
shrekshao cdecd97cee Add Draw base vertex and base instance function entrypoints
Split from https://chromium-review.googlesource.com/c/angle/angle/+/1705035/27

This patch adds entrypoints glDrawArraysInstancedBaseInstanceANGLE,
glDrawElementsInstancedBaseVertexBaseInstanceANGLE,
glMultiDrawArraysInstancedBaseInstanceANGLE,
and glMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE

Implementation will come in a later separate patch.

Bug: chromium:891861, angleproject:3402
Change-Id: I18e19b850cddd79be4798b9ae7efe0680a050c7f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1750125
Commit-Queue: Shrek Shao <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2019-08-16 00:27:22 +00:00
Stuart Morgan 9d737966ac 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 <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2019-08-14 23:05:33 +00:00
James Darpinian 7e48c9eb99 Add explicit integer casts
WebKit uses the -Wshorten-64-to-32 flag which warns on these cases.

Bug: 3439
Change-Id: I8c1de60da0f173ca2036e2120e79b857f5f2775f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1740866
Commit-Queue: James Darpinian <[email protected]>
Reviewed-by: Kenneth Russell <[email protected]>
2019-08-14 00:52:47 +00:00
James Darpinian efa898aca2 Enable some compiler warnings used by WebKit.
This will make it easier to roll ANGLE in WebKit.

Bug: angleproject:3439
Change-Id: Icd4a5a2d5dcabb6cf13d4b46a7547f49610fa4b3
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1743057
Commit-Queue: James Darpinian <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2019-08-09 17:05:01 +00:00
Mohan Maiya 9ec3f51d11 Reland "Vulkan: Implement OES_get_program_binary extension"
Reason for revert: default uniform initialization was incomplete

This change has the following fixes:
    1. Add missing default uniform initialization when loading
       program binaries.
    2. Re-enable OES Program Binary capabilities for Vulkan.
    3. Added two angle end2end test,
       - ProgramBinaryES3Test.BinaryWithLargeUniformCount
         uses several uniforms across the vertex and fragment
	 shaders.
       - ProgramBinaryES3Test.ActiveUniformShader tests
         the difference between uniform static and active use

Bug: angleproject:3216
Bug: angleproject:3217
Bug: angleproject:3665
Tests: dEQP-GLES3.functional.shader_api.program_binary*
       angle_end2end_tests --gtest_filter=ProgramBinary*
Change-Id: If6886f01241d65bb1e17a21cc3406533021072ee
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1699069
Commit-Queue: Mohan Maiya <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
2019-07-19 21:46:29 +00:00
Mohan Maiya 901dd5458e Rectify bug in initialization of offsets for uniform variables
Make sure to set a uniform's flattenedOffsetInParentArrays
value only if it has a valid parent array index.
Serialize/Deserialize flattenedOffsetInParentArrays value.

Bug: angleproject:3216
Bug: angleproject:3217
Bug: angleproject:3665
Change-Id: I6e4d003b1dd74b330bcf153f8d3df92414f198dd
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1704219
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2019-07-19 16:49:00 +00:00
Shahbaz Youssefi c44d2c7919 Fix glGetProgramResourceName filling output with 0
strncpy was used to copy resource names, which fills the unused parts of
the buffer with '\0'.  The spec doesn't forbid this, but dEQP fails on
this behavior, presumably to try and catch overflow bugs.

Bug: angleproject:3562
Change-Id: Ifce2d690221b2403848cb8913f4753ec60dfffab
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1698647
Commit-Queue: Shahbaz Youssefi <[email protected]>
Reviewed-by: Courtney Goeltzenleuchter <[email protected]>
Reviewed-by: Jonah Ryan-Davis <[email protected]>
2019-07-17 16:55:20 +00:00
Tim Van Patten f20605944e Update OpenGL ES 3.1 Shader Interface Matching
According to the OpenGL ES 3.1 spec Chapter 7.4.1 "Shader Interface
Matching" Page 91, an output variable is considered to match an
input variable in the subsequent shader if:

- the two variables match in name, type, and qualification; or
- the two variables are declared with the same location qualifier
  and match in type and qualification.

We currently only check the variable names, so this bug will add
checking the locations as well.

Bug: angleproject:3699
Test: dEQP, end2end
Change-Id: I45e91654450fd033299ff0a81bc26a23b3e25a04
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1700160
Reviewed-by: Shahbaz Youssefi <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Tim Van Patten <[email protected]>
2019-07-15 18:04:15 +00:00
Shahbaz Youssefi 29fba5e088 Vulkan: Prepare for variable-stage pipelines
Compute (single-stage pipeline) is upcoming, but this change prepares
GlslangWrapper to handle any number of stages (mostly).  Additionally,
this change binds each resource to each stage based on whether it's
active, so that we don't hit the per-stage limit of resources by binding
every resource to every stage.

Bug: angleproject:3633
Bug: angleproject:3562
Change-Id: Ifebf691482846e0371c6e314f514226a4cfee258
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1689330
Reviewed-by: Tim Van Patten <[email protected]>
Commit-Queue: Shahbaz Youssefi <[email protected]>
2019-07-11 15:49:00 +00:00
Tim Van Patten b91900a27b Vulkan: Fix khr-gles3.shaders.uniform_block.common.name_matching test failure
Fix various shader translator validation errors related to uniform
buffers and naming.

Bug: angleproject:3459
Test: angle_deqp_khr_gles3_tests
Change-Id: Iaa66b61e91c8f38ec7cccb43d71be9ba3cd83da3
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1684302
Commit-Queue: Tim Van Patten <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
2019-07-10 15:01:21 +00:00
Mohan Maiya e6741faab0 Add missing writes to Program::serialize
1. Write MaxActiveAttribLocation to the bitstream
2. Write Uniform Active shader info to the bitstream

Bug: angleproject:3216
Change-Id: I4f48f75de570b5fdce20e55caf62fa0d14d82646
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1682745
Commit-Queue: Tobin Ehlis <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2019-07-03 14:14:55 +00:00
Shahbaz Youssefi 0bfa55044f Vulkan: Emulate Transform Feedback with vertex shader output
In ES 3.0 and 3.1, only non-indexed GL_POINTS, GL_LINES and GL_TRIANGLES
is supported for transform feedback.  Without tessellation and geometry
shaders, we can calculate the exact location where each vertex transform
output should be written on the CPU, and have each vertex shader
invocation write its data separately to the appropriate location in the
buffer.

This depends on the vertexPipelineStoresAndAtomics Vulkan feature.

Bug: angleproject:3205
Change-Id: I68ccbb80aece597cf20c557a0aee842360fea593
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1645678
Commit-Queue: Shahbaz Youssefi <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2019-06-27 20:36:53 +00:00
Jonah Ryan-Davis beb0eb2d8c Clean up workarounds/features to single location.
Rename all workarounds structs to features, and move the lists to a
shared location in include/platform (to help with documentation,
see:
https://cs.chromium.org/chromium/src/ui/gl/gl_switches.cc?sq=package:chromium&g=0&l=69)

Bug: angleproject:1621
Change-Id: I4069f08131db5e886047a007efb5d7764dfee5f2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1660952
Commit-Queue: Jonah Ryan-Davis <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2019-06-17 19:44:51 +00:00
Jonah Ryan-Davis 78a51911da Clean up and expose frontend features to egl.
gl::Workarounds was used to hold frontend features. Change ownership of
this struct from Context to Display, so it can be exposed to egl. Also
rename to features and clean up for consistency.

Bug: angleproject:1621
Change-Id: I82e98e53873abb7a402c93e60f8a662a7263e0d5
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1655772
Commit-Queue: Jonah Ryan-Davis <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2019-06-13 15:24:17 +00:00
Cody Northrop 70958d15db Let attribute aliasing logic detect overflow
Checking against the max attribute count is not needed
as aliasing is implemented correctly below.  If not enough
locations are available, linking will fail.

This works for backends that support aliasing (Vulkan, GLES),
but not for D3D11, which asserts.  To handle this, add a
limitation that informs the frontend of aliased attribute support.

Bug: angleproject:3252
Bug: chromium:964404
Change-Id: Ib9ae5d381bbb2e6bf496272fc3d9e88467c17290
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1572817
Commit-Queue: Cody Northrop <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2019-05-19 22:32:52 +00:00
Cody Northrop 09eabed99d Allow attribute linking for ES2
* Pipe webGL compatibility down to allow attribute aliasing.
* Reject aliasing if shader level is too high, or webGL is in use.

Bug: angleproject:3252
Change-Id: I3378fe707e3795a4b8a424989afccff42bc84344
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1556538
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Courtney Goeltzenleuchter <[email protected]>
Commit-Queue: Cody Northrop <[email protected]>
2019-05-17 14:45:36 +00:00
Jonah Ryan-Davis 776694cdad Change all ANGLE workarounds to use struct definition with info.
Change each workaround from a simple bool to a struct with info
including name, workaround set, description, and bug IDs. This will help
with future workaround integration with Chrome.

Bug: angleproject:1621
Change-Id: Ia27c180abaf845e280060c803e5994cc3152a057
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1593917
Commit-Queue: Jonah Ryan-Davis <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2019-05-09 21:05:59 +00:00
Lee Salzman 8ba78da0b3 add support for EXT_blend_func_extended to D3D11
Change-Id: Id66868851a490d0a68a7e76280720825c4844a45
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1591192
Commit-Queue: Geoff Lang <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
2019-05-06 16:41:20 +00:00
Shahbaz Youssefi 051b0896a7 Vulkan: Fix layout substitution for struct varyings
If the shader contains code such as the following:

    struct S {
        vec4 field;
    };
    out S varStruct;

The layout qualifier macro is defined as @@ LAYOUT-varStruct @@.
However, the Vulkan backend was replacing @@ LAYOUT-field @@.

Bug: angleproject:3220
Change-Id: Iae15003867e0bed2cc939159a6653429c7a431e0
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1571389
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Shahbaz Youssefi <[email protected]>
2019-05-03 17:26:31 +00:00
shrekshao 8413faba29 Fix formsRenderingFeedbackLoopWith check
To make it pass the following webgl conformance test
https://github.com/KhronosGroup/WebGL/blob/master/sdk/tests/conformance/rendering/rendering-sampling-feedback-loop.html

It used to fail due to
1. Didn't check if texture unit is sampler complete
2. Only checked active drawbuffers. But drawbuffer settings shouldn't be
taken into account when checking drawing feedback loop.

On top of applying these 2 functional fixes, I also tried to do some
optimization by unwrapping the nested for loop for program sampler
bindings and texture unit in `Program::samplesFromTexture` and putting
them outside of the draw buffer loop according to the old comment by
Antonie @piman.
https://codereview.chromium.org/2461973002/

> ... turning it around (for each texture check if it's
also an attachment, instead of for each attachment check if it's a bound
texture). In particular, we have an upper bound on the number of
attachments, so we can look them up outside the loop into a fixed size
buffer on the stack - and the very common case will be to only have 1 of
them making the inner loop cheap.

But this unwraps sort of breaks the code structure. An alternative way
would be passed in a framebuffer pointer into `Program::samplesFromTexture`
but that would ends up in tight class coupling. I am a bit unsure here.
Would like to hear if think this change is okay in terms of code style.

In addition to further speed up this check (as it runs for every draw
validation) I added a cache mLastColorAttachmentId indicating the last i
of GL_COLORATTACHMENTi that is not GL_NONE to shorten this inner loop.
In most scenario we won't have up to max number of color attachments.

A side note: this is still failing
https://github.com/KhronosGroup/WebGL/blob/master/sdk/tests/conformance2/rendering/depth-stencil-feedback-loop.html
But it's because the test case doesn't fit the spec at this moment.
I will update this test later.

Bug: chromium:660844
Change-Id: I6d718dada71a5d989caac04de03f2454f2377612
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1553963
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Shrek Shao <[email protected]>
2019-04-08 20:05:50 +00:00
Geoff Lang e332e621ea D3D: Asynchronously load program binaries.
Unpack as much of the binary steam as possible before passing the final loading
of the shader programs off to a worker thread.  Reporting as many possible link
errors before becoming asynchronous means that linking should only fail due to
unexpected system issues at that point.

This also allows other backends to asynchronously load program binaries.

BUG=angleproject:2857

Change-Id: I587917a3e54522114dabd41d1b14fc491c8fd18a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1473451
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
2019-03-04 19:41:32 +00:00
Jonah Ryan-Davis d4c09dd328 Fix unnecessary copy of for loop variables in ANGLE
Bug: angleproject:3075
Change-Id: I34dd5d4ecded6def5a2b46369277312af0de7c8c
Reviewed-on: https://chromium-review.googlesource.com/c/1443572
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Jonah Ryan-Davis <[email protected]>
2019-02-01 23:57:18 +00:00
Shahbaz Youssefi c3abb7f1a2 Fix MultiDraw shaders when loaded from cache
State updates that need to be done after linking vs. deserializing can
get out of sync, as was the case for mDrawIDLocation (introduced in
1bf18ce9e2).  This commit introduces a
common function that's called from both paths to hopefully avoid such
issues in the future.

The serialize/deserialize functions are moved from MemoryProgramCache
to the Program itself.

Bug: 890539,angleproject:2516
Change-Id: Idc5b87de53298aacbb1884e79e721b876281fb13
Reviewed-on: https://chromium-review.googlesource.com/c/1417970
Commit-Queue: Shahbaz Youssefi <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2019-01-18 22:15:12 +00:00
jchen10 a100d8f471 ParallelCompile: add GL backend support
For GL backend, at first each worker thread must have a naitve context
for its own to work in. These worker contexts have to be shared from
the main context, so that all shader and program objects are seen in
any context. This extends backend displays to create and destroy the
worker contexts. RendererGL manages and allocates them to the worker
threads. ShaderImpl has a new compile method added to do the actual
glCompile work in worker thread. The ProgramGL's link method is broken
down by introducing the LinkEventGL class.

Bug: chromium:849576

Change-Id: Idc2c51b4b6c978781ae77810e62c480acc67ebb5
Reviewed-on: https://chromium-review.googlesource.com/c/1373015
Commit-Queue: Jie A Chen <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2019-01-17 02:50:21 +00:00
Jamie Madill 6e18a23825 Optimize more front-end VertexArray binding.
Improves perf slightly (1-2%) in the Vulkan VBO state change test.

Bug: angleproject:3014
Change-Id: Ia8082b5b3f5e847a6b2775e896893fa8d38c1afd
Reviewed-on: https://chromium-review.googlesource.com/c/1393904
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
2019-01-16 20:01:14 +00:00
Jamie Madill ab2bfa814c Enable Chromium clang style plugin for libANGLE.
This fixes a few style warnings:

 * auto should not deduce to raw pointer type
 * inlined virtual methods are not allowed
 * non-trivial constructors and destructors should be explicit
 * inlined non-trivial constructors should not be in-class
 * missing override keywords

Bug: angleproject:3069
Change-Id: I3b3e55683691da3ebf6da06a5d3c729c71b6ee53
Reviewed-on: https://chromium-review.googlesource.com/c/1407640
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Yuly Novikov <[email protected]>
2019-01-16 01:44:15 +00:00
James Darpinian e4109f2713 WebGL: validate texture format matches sampler type
WebGL requires that drawing produces INVALID_OPERATION if a texture's
format doesn't match the sampler type it is bound to. This is a little
confusing because samplers have two attributes that could be called
"type": addressing mode (2D/3D/Cube), and component format
(float/signed/unsigned/shadow). ANGLE already handled checking the
addressing mode; this change adds checking for the component format.

Fixes WebGL conformance test
conformance2/uniforms/incompatible-texture-type-for-sampler.html

Bug: chromium:809237
Change-Id: I52ebfecd92625e3ee10274cb5f548d7e53de72dd
Reviewed-on: https://chromium-review.googlesource.com/c/1377611
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Yuly Novikov <[email protected]>
Commit-Queue: James Darpinian <[email protected]>
2019-01-04 02:03:28 +00:00
Jamie Madill c3dc5d4857 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 <[email protected]>
Reviewed-by: Markus Tavenrath <[email protected]>
2019-01-01 17:11:01 +00:00
Markus Tavenrath cb9609fe58 Optimize glDrawElements performance
A call to glDrawElements results in a calling depth of up to 4
* glDrawElements
* gl::Context::DrawElements
* rx::ContextGL::DrawElements
* VertexArrayGL::syncDrawState.

Each function call has to save/restore a lot of registers which
results in a stall in the prologue of rx::ContextGL::DrawElements
due to memory bandwidth limitations.

The main change is the function gl::Context::DrawElements being
inlined to reduce the calling depth by one. In addition the call
to ContextGL::syncDrawElementsState is now protected so that it
gets called only if it's required. Finally a few small getter
functions have been inlined where the calling code was bigger
than the actual function.

In total this change improves performance of the
DrawElementsPerfBenchmark.Run/gl benchmark by 16%.

Bug: angleproject:2966

Change-Id: I423d18452f2f5b520ab52850fda2054e1da86991
Reviewed-on: https://chromium-review.googlesource.com/c/1389988
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Markus Tavenrath <[email protected]>
2018-12-28 15:47:26 +00:00
Jamie Madill 7c985f5c4f Make angle::Result an enum.
This moves away from a class type to a value type. This should improve
performance when using angle::Result as a return value. Previously the
generated code would return a pointer instead of a value.

Improves performance in the most targeted microbenchmark by 10%. In
more realistic scanarios it will have a smaller improvement. Also
simplifies the class implementation and usage.

Includes some unrelated code generation changes.

Bug: angleproject:2491
Change-Id: Ifcf86870bf1c00a2f73c39ea6e4f05ca705050aa
Reviewed-on: https://chromium-review.googlesource.com/c/1356139
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2018-12-07 04:59:23 +00:00
Jamie Madill e3e680ca47 Remove State::syncProgramTextures.
Removes the concept of the program textures dirty object. Instead we
use a set of dirty bits to represent dirty texture samples. We mark
certain textures dirty and update state structures whenever there is
a new Texture/Program/Sampler bound, or when Texture/Program/Sampler
state changes.

This is in preparation for making clearing the uncleared active
textures into a dirty bit as well.

Also includes new dirty bit handling for texture image units. These are
a GLES 3.1 feature.

Bug: angleproject:2966
Change-Id: Ibb8619dd2669bb39fdbcd75e3685be9a8aeeee91
Reviewed-on: https://chromium-review.googlesource.com/c/1346649
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
2018-12-04 00:23:05 +00:00
Jamie Madill e90d4ee966 Pass Context to setLabel.
This is useful for triggering a dirty state notification for Textures.
It will lead to improvements for program and texture dirty bits.

Bug: angleproject:2966
Change-Id: Iaba625da8a970a558f7d158bfa2f09c964f6761a
Reviewed-on: https://chromium-review.googlesource.com/c/1347669
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Yuly Novikov <[email protected]>
2018-11-29 20:35:13 +00:00
Jamie Madill b980c5630e 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 <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
2018-11-27 18:27:13 +00:00
Austin Eng 1bf18ce9e2 Implement GL_ANGLE_multi_draw
This patch adds entrypoints glMultiDrawArraysANGLE,
glMultiDrawElementsANGLE, glMultiDrawArraysInstancedANGLE,
annd glMultiDrawElementsInstancedANGLE

Bug: chromium:890539

Change-Id: Ic9c374c53892460f44ca6e73a253b78473ac2dff
Reviewed-on: https://chromium-review.googlesource.com/c/1282268
Reviewed-by: Kai Ninomiya <[email protected]>
Commit-Queue: Austin Eng <[email protected]>
2018-11-06 18:04:07 +00:00
Jamie Madill f4a789f98d Use angle::Result in front-end (Part 6)
Refactors the gl::Program, gl::Compiler and gl::Query classes.

Bug: angleproject:2491
Change-Id: I96acecdc6af301a89201bd7f5222a180433e5eb2
Reviewed-on: https://chromium-review.googlesource.com/c/1289711
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-10-19 21:46:06 +00:00
Jamie Madill 78bcd2bec3 Vulkan: Fix deleting in-use descriptor sets.
Sequences of many frames with uniform updates could lead to a bug where
we attempt to delete descriptor sets that are still in use. To trigger
the bug we need to write enough uniform data to trigger a descriptor
set to be freed. This would correctly trigger refresh sets in the
Program. But if there was a second program idle in the background that
also allocated descriptors from the old pool, the bug would manifest.

Fix this by storing a shared handle to the descriptor pool in the
Program. The dynamic descriptor pool won't recycle descriptor pools
internally unless there are zero outstanding references to the pool.

We could also improve this in a resource sharing situation by keeping
a single shared dynamic descriptor pool per share group.

Includes a contribution from [email protected] that adds a test to
cover the bug.

Bug: angleproject:2863
Change-Id: Id585b85f33f8cfa3772ceff3af512d1e4fb0b75a
Reviewed-on: https://chromium-review.googlesource.com/c/1271919
Reviewed-by: Shahbaz Youssefi <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-10-17 14:01:49 +00:00
Jamie Madill 956ab4d9fa Optimize several functions for the Program perf test.
This gives the same or slightly better performance in the ProgramDraw
perf test. Also only set the Program object as dirty when there are
dirty bits set in the Program itself.

Bug: angleproject:2877
Change-Id: I07b428b40d3e3c24e0a42c970524756b6dc3a30e
Reviewed-on: https://chromium-review.googlesource.com/c/1271475
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-10-10 21:33:33 +00:00
Jamie Madill 6f755b210f Use angle::Result in front-end. (Part 1)
This covers most of the hot paths used in draw calls. Gives in the
order of a 5% reduction in draw call overhead.

Bug: angleproject:2491
Change-Id: I2d53afb1163eaceed61fb9cd9ce6c1267c85c0fa
Reviewed-on: https://chromium-review.googlesource.com/c/1258149
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2018-10-09 20:27:56 +00:00
Jamie Madill 785e8a0b7d Remove gl::LinkResult.
Instead of returning a small struct from LinkProgram calls we use
angle::Result. Linking can have 3 cases:

- the link was successful -> angle::Result::Continue
- the link failed -> angle::Result::Incomplete
- there was an internal error -> angle::Result::Stop

Note that any unexpected Incomplete is still an error. Each function
that accepts Incomplete must check explicitly.

This is the last user of ErrorOrResult.

Bug: angleproject:2491
Change-Id: Idba23be27efe4b561720a4bdd8fe486b40779497
Reviewed-on: https://chromium-review.googlesource.com/c/1255645
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Yuly Novikov <[email protected]>
2018-10-05 11:14:22 +00:00