Commit Graph
202 Commits
Author SHA1 Message Date
Brandon Jones 76746f9bc2 Optimize Fragment Shader Type Match Validation
Improves ValidateFragmentShaderColorBufferTypeMatch by storing input and
output types into a bitmask for quick comparison when validation is
needed. This shows a 2% improvement to glDrawElements for the aquarium
workload.

BUG=angleproject:2203
Change-Id: Iade2ecf28383164e370b48442f01fba6c0962fba
Reviewed-on: https://chromium-review.googlesource.com/775019
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-12-01 21:08:45 +00:00
Jiajia Qin 94f1e89fc8 ES31: Add atomic counter buffer data size
BUG=angleproject:1729
TEST=dEQP-GLES31.functional.ssbo.layout.*
     dEQP-GLES31.functional.compute.basic.atomic_counter*

Change-Id: Ic78c0f089fd539c0b1064e8405d63505456dbc01
Reviewed-on: https://chromium-review.googlesource.com/777958
Commit-Queue: Geoff Lang <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-12-01 15:17:48 +00:00
Jamie Madill 3c1da04e0b Isolate GlslangWrapper header from most of ANGLE.
Since we might want to use the ANGLE PoolAlloc in the Vulkan back-end,
we want to make completely sure that it doesn't show up in any header
that might be included with the Glslang headers, since this could
cause a conflict.

This change moves as much as possible to forward-declaring instead of
including headers directly in ProgramLinkedResources.h. This means
making several internal Program helper classes external. I.E. instead
of Program::Bindings, we have ProgramBindings.

It also redeclares a "using" in two places, since it isn't possible to
forward declare these, and it seemed overdesigned to put the using in
a separate header.

Bug: angleproject:2264
Change-Id: Idd08706580c927327dddf46e86acbcd2c4e3286f
Reviewed-on: https://chromium-review.googlesource.com/792270
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-11-29 19:35:40 +00:00
Yunchao He 85072e8f4a ES31: Fix detaching/deleting compute shader after LinkProgram.
This change also moves the ShaderType enum from D3D renderer to angletype.h.
And it uses a bit mask to track the linked shader stages.

BUG=angleproject:2247

Change-Id: I5c7ee1445d353a02e24549ffcf6b0ac694dd1069
Reviewed-on: https://chromium-review.googlesource.com/768629
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-11-23 15:03:28 +00:00
Olli Etuaho 465835d61f Support arrays of arrays in the API
The ShaderVariable class that is used as an interface between the
compiler and the rest of the code gets arrays of arrays support.

Array of array variables are passed from the compiler just like any
other variables. However, when stored in Program state each innermost
array constitutes a separate variable. This is done to make the
implementation match the GLES specification for program interface
query APIs.

This will be tested more fully once support for parsing arrays of
arrays lands in the compiler.

TEST=angle_end2end_tests, angle_unittests
BUG=angleproject:2125

Change-Id: I0f7159000f039be92a87a52b3b68cd9a215a21cb
Reviewed-on: https://chromium-review.googlesource.com/684742
Commit-Queue: Olli Etuaho <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-11-22 12:38:32 +00:00
Jamie Madill acf2f3adba 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 <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-11-22 06:34:40 +00:00
Jiawei Shao 89be29a5cd ES31: Implement creation and attaching geometry shader on OpenGL
This patch intends to implement the creation of a geometry shader
and attaching a geometry shader to a program on OpenGL back-ends.

This patch also adds all geometry shader related dEQP-GLES31 test
failures to deqp_gles31_test_expectations.txt.

BUG=angleproject:1941
TEST=angle_end2end_tests

Change-Id: Ib0b497030255b15dacd967e48bc59eef0009af46
Reviewed-on: https://chromium-review.googlesource.com/757979
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-11-22 05:14:29 +00:00
jchen10 85c93c41e9 Refactor VaryingPacking
Move all packing related logic from Program to VaryingPacking.
Do linkValidateTransformFeedback check first to simplify packing.
Make getPackedVaryings collect all required VaryingPackings in one
run pass, so that packUserVaryings can focus on packing merely.

BUG=angleproject:2241
Change-Id: I5e84e6e4688c80ba7a77a265b8ffaf79f4ddbb87
Reviewed-on: https://chromium-review.googlesource.com/764821
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Geoff Lang <[email protected]>
2017-11-20 23:29:28 +00:00
Geoff Lang 92019431df Make conversion from GL types to native bools consistant.
Some places would compare with "== GL_TRUE" and others with "!= GL_FALSE".
This behaviour is not in the OpenGL spec but "!= GL_FALSE" is the most
standard and follows the same rules as C and C++.

Remove un-necessary validation that params are either GL_TRUE or
GL_FALSE.

Update some internal storage from GLboolean to bool.

BUG=angleproject:2258

Change-Id: I12adbe2d24318a206521ca6ad1099ee7e2bf677e
Reviewed-on: https://chromium-review.googlesource.com/779799
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Geoff Lang <[email protected]>
2017-11-20 20:56:37 +00:00
Jiajia Qin 3a9090fa0b ES31: Add BUFFER_VARIABLE and SHADER_STORAGE_BLOCK program interfaces
This patch collects the shader storage block members information.
It implements getShaderStorageBlockMemberInfo and getShaderStorageBlockSize
for OpenGL backend. Meanwhile, it implements BUFFER_VARIABLE and SHADER_STORAGE_BLOCK
interfaces for program query.

BUG=angleproject:1920
TEST=angle_end2end_tests:ProgramInterfaceTest*
     dEQP-GLES31.functional.layout_binding.ssbo*
     dEQP-GLES31.functional.compute.basic.empty
     dEQP-GLES31.functional.compute.basic.ssbo_rw*
     dEQP-GLES31.functional.compute.basic.ssbo_local_barrier*
     dEQP-GLES31.functional.compute.basic.copy_image_to_ssbo_small
     dEQP-GLES31.functional.compute.basic.copy_ssbo_multiple_groups
     dEQP-GLES31.functional.compute.basic.copy_ssbo_multiple_invocations
     dEQP-GLES31.functional.compute.basic.copy_ssbo_single_invocation
     dEQP-GLES31.functional.compute.basic.copy_ssbo_to_image_small
     dEQP-GLES31.functional.compute.basic.shared_var*
     dEQP-GLES31.functional.compute.basic.ubo_to_ssbo*
     dEQP-GLES31.functional.compute.basic.write_multiple_arr*
     dEQP-GLES31.functional.compute.shared_var.basic_type.*
     dEQP-GLES31.functional.compute.shared_var.work_group_size.*
     dEQP-GLES31.functional.atomic_counter.*

Change-Id: Ie8b81fde5a2e919aab77adb3d137c9ff2f193409
Reviewed-on: https://chromium-review.googlesource.com/712235
Reviewed-by: Olli Etuaho <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-11-10 20:05:22 +00:00
Jamie Madill 6db1c2e88a Link interface blocks in ProgramImpl::link.
This allows the back-end to have access to the interface block info
in the link operation, and also allows the interface block info to
have direct access to the post-link Impl information.

BUG=angleproject:2208

Change-Id: Ib2bfb3c9155eee715bd3d29de1c3fdd67b16eed4
Reviewed-on: https://chromium-review.googlesource.com/753521
Reviewed-by: Jamie Madill <[email protected]>
2017-11-08 16:53:10 +00:00
Jamie Madill 7af0de52d1 Rename UniformLinker.cpp/h to ProgramLinkedResources.
A more general name for a file that will house a collection of pogram
variable related linking code.

BUG=angleproject:2208

Change-Id: I82710f6abadd2df58fb58a3c4179989fe956e7e4
Reviewed-on: https://chromium-review.googlesource.com/755858
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-11-07 20:00:46 +00:00
Olli Etuaho 1734e17110 Only store innermost array offset in VariableLocation
Separate entries will be generated for each innermost array of arrays
of arrays in the variable tables. Because of this VariableLocation
actually only needs to store the innermost array index.

BUG=angleproject:2125
TEST=angle_end2end_tests

Change-Id: Id1ee35b3cecfc011d96b58e43cf0b1cccbfed408
Reviewed-on: https://chromium-review.googlesource.com/741742
Commit-Queue: Olli Etuaho <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-11-07 19:36:45 +00:00
Jamie Madill c9727f31b5 Pass InterfaceBlockLinker to ProgramImpl::link.
This change is in preparation for moving the linking logic to the
Implementation.

Introduces a ProgramLinkedResources class that is passed into the Impl
and holds linking-related info such as the UBOs, Varyings, etc.

BUG=angleproject:2208

Change-Id: I2ef0824b54bfb462c79d003bffe34e9cfad60d8a
Reviewed-on: https://chromium-review.googlesource.com/746204
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-11-07 18:38:45 +00:00
Jamie Madill 977abce7a2 Refactor interface block linking.
This moves the logic for interface block linking. The new design is
intended to be flexible enough to be passed into a back-end call to
ProgramImpl::link. Then, the Impl object can be responsible for both
filtering out unreferenced interface blocks as well as having access
to the linked interface block information.

A future change will pass the InterfaceBlockLinker objects (or objects
when dealing with ES 3.1 and Shader Storage Blocks) to the Impl. This
will help fix a D3D11 back-end bug where we would need acess to the
Shader objects to finish a deferred uniform block link.

This should also potentially make it easier for the back-ends to
determine Shader Storage Block size and properties without defining
new Impl methods.

BUG=angleproject:2208

Change-Id: Ic5244a808dba44ba1a8c08d9ee701952034d2b18
Reviewed-on: https://chromium-review.googlesource.com/746203
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Yuly Novikov <[email protected]>
2017-11-07 16:56:24 +00:00
Olli Etuaho d255123c63 Store shader interface variables as per query spec
GLES 3.1 section 7.3.1.1 specifies how active variable entries should
be generated and how active variables are named. The specs for program
interface variable queries are built on top of this section.

ANGLE has already followed this spec for the most part for generating
variable lists in ProgramState, but now we also follow the naming spec
for arrays and include [0] at the end of the stored name.

This will make implementing arrays of arrays more straightforward.
Most logic for variable queries will just keep working as is when
arrays of arrays are added instead of needing more complex logic for
handling array indexing.

BUG=angleproject:2125
TEST=angle_end2end_tests

Change-Id: I3acd14253153e10bc312114b0303065da2efb506
Reviewed-on: https://chromium-review.googlesource.com/739826
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2017-11-03 15:52:26 +00:00
jchen10 58f67be0cf ES31 program query: support AtomicCounterBuffer and UniformBlock
Calculates atomic counter buffer's shader reference according to its
child counters.
Merges GL_UNIFORM_BLOCK_* queries to GL_*.
Refreshes deqp_gles31_test_expectations.

BUG=angleproject:1920
TEST=angle_end2end_tests:ProgramInterfaceTest*
     dEQP-GLES31.functional.state_query.program.active_atomic_counter_buffers_get_programiv
     dEQP-GLES31.functional.layout_binding.ubo.*
Change-Id: Ia23ddfef5f5dd7e15628f4c259273e1c01c14d80
Reviewed-on: https://chromium-review.googlesource.com/715436
Commit-Queue: Corentin Wallez <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
2017-11-02 15:24:46 +00:00
jchen10 4ef250333c Refactor StaticallyUsed
Gather vertexStaticUse, fragmentStaticUse, and computeStaticUse
into a new mixin class StaticallyUsed, from which various
program resources can inherit to track their shader references.

BUG=angleproject:1920
Change-Id: Ibb3c0fe035bb8789aad65dbdfefaf7cb17b64c4e
Reviewed-on: https://chromium-review.googlesource.com/748317
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
2017-11-02 03:20:31 +00:00
Jiawei Shao 3d40488b6a Split varyings into input and output varyings in renderer
This patch intends to split all vector<Varying> into two vectors
to store input and output varyings separately in the renderer.

This patch is a base of supporting program linking with geometry
shader. Unlike the vertex shaders (their outputs are varyings)
and fragment shaders (their inputs are varyings), the inputs and
outputs of geometry shaders are all varyings, so we need two
vector<Varying> to store them correctly.

BUG=angleproject:1941
TEST=angle_end2end_tests

Change-Id: Ic4b8343f2fc3df87b764c45f2ea7810e565f7bee
Reviewed-on: https://chromium-review.googlesource.com/720617
Commit-Queue: Corentin Wallez <[email protected]>
Reviewed-by: Olli Etuaho <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
2017-10-25 14:44:01 +00:00
Jamie Madill bd159f0671 Vulkan: Use minimal dirty bits in VertexArrayVk.
This should slightly reduce draw call overhead.

BUG=angleproject:1898

Change-Id: I0e515bf2868f237f1d6948c12942f8cb6637c0c0
Reviewed-on: https://chromium-review.googlesource.com/707690
Reviewed-by: Frank Henigman <[email protected]>
Reviewed-by: Yuly Novikov <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-10-10 19:58:59 +00:00
Olli Etuaho c853804c5a Add support for arrays of arrays to VariableLocation
Array indices are sorted so that the outermost index is in the back.
This is because we want to be consistent with future arrays of arrays
parsing code. In parsing we'll have a utility function to make a
TType object into an array, and there it's most natural to push the
new outermost sizes to the back of the vector.

Further patches will still be needed to parse arrays of arrays and
add support to arrays of arrays into the API.

BUG=angleproject:2125
TEST=angle_unittests, angle_end2end_tests

Change-Id: I6c88edabf68ae9dbd803ec6d20543016c408b702
Reviewed-on: https://chromium-review.googlesource.com/686414
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2017-10-10 15:31:24 +00:00
jchen10 baf5d9458e ES31: Add UNIFORM support for ProgramInterface
Add program resource properties for uniform.

BUG=angleproject:1920
TEST=angle_end2end_tests:ProgramInterfaceTest*

Change-Id: Ia5cf6219db43b8b1f73efbb3565d21c86e9d3ec0
Reviewed-on: https://chromium-review.googlesource.com/638050
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-10-04 15:50:32 +00:00
Jamie Madill fb997ec1d1 Removed "name" and "used" from variable location.
The used flag was redundant with the index (which used MAXUINT). The
name was redundant with the stored uniform. Removing these gives a
very minor performance speed up when iterating and retrieving
uniform locations.

BUG=angleproject:1390

Change-Id: Ieeccdff7c131e1359e754e246d3648b73aad5baf
Reviewed-on: https://chromium-review.googlesource.com/659224
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-09-20 20:43:35 +00:00
Jiajia Qin 729b2c6e09 ES31: Enable shader storage buffer support for OpenGL backend
BUG=angleproject:1951
TEST=angle_end2end_tests:ShaderStorageBuffer

Change-Id: I1afc3cd005ad2e595c6ce937fc53e17423f8ec8b
Reviewed-on: https://chromium-review.googlesource.com/618132
Commit-Queue: Geoff Lang <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-09-20 15:40:37 +00:00
Jamie Madill d68248be4a Update Texture dirty bits documentation.
BUG=angleproject:1387

Change-Id: Ie2277874acb9e7a3eed4bce327f2c08750213967
Reviewed-on: https://chromium-review.googlesource.com/660419
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-09-12 17:57:38 +00:00
Jamie Madill 81c2e253b9 Add top-level dirty bits for texture and samplers.
These will have to be fleshed out in the back-ends.
Also currently uses a single bit for all the bindings, and we can
extend this to more fine-grained updates in the future.

This patch implements top-level updates for texture completeness.
Sampler completeness caches are removed from the Texture class, and
replaced by a cache in the gl::State class. The State class also
keeps a channel binding to the bound textures so it can be notified
when textures might change from complete <-> incomplete.

In future CLs we skip updating back-ends if texture state doesn't
change.

BUG=angleproject:1387

Change-Id: If580b4851303c86f3240e62891f5f6047eefb6a2
Reviewed-on: https://chromium-review.googlesource.com/648053
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-09-11 17:26:26 +00:00
Jamie Madill fe8b5989d0 Program: Fixed unreferenced Samplers.
The calculation for unreferenced was incorrect - it checked the 'used'
flag of the uniform location, but if samplers started at index zero,
all the unused uniforms were to be considered valid samplers. Instead,
initialize the uniform index to INVALID_INDEX.

This bug was uncovered after doing work on the Texture dirty bits.

BUG=angleproject:1387

Change-Id: I5e404e367caed38368bcc0e581699ae2c911bcc9
Reviewed-on: https://chromium-review.googlesource.com/655930
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-09-07 22:03:53 +00:00
Jamie Madill 134f93d1a8 D3D: Small optimizations to uniform updates.
Uses more of the type info table for updates.
Also special-case clamping when uniform count == 1.

Improves the speed of the d3d11 uniform stress test by ~20%.

BUG=angleproject:1390

Change-Id: I6707c67db84c94a28b1519b0bbee5d28fe38b189
Reviewed-on: https://chromium-review.googlesource.com/646828
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-09-01 20:35:54 +00:00
Jamie Madill be5e2ec349 Remove uniform memory copy from GL front-end.
This moves the uniform query to the back-end. In D3D, this requires
a bit more redesign, especially for matrix uniforms.

Gives about a 10% speed improvement in the GL/NULL uniforms stress
test on Windows (UniformsBenchmark.Run/gl_null_400_vec4).

BUG=angleproject:1390

Change-Id: Idac22a77118e9e94d2f28c585e31ff0bc785ba94
Reviewed-on: https://chromium-review.googlesource.com/623929
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
2017-08-31 18:36:40 +00:00
Olli Etuaho 855d964bd0 Prefix user-defined names in GLSL output
Now user-defined names are prefixed by _u in GLSL output in case name
hashing is not on. Internal names such as names of temporary variables
created in AST transformations are written out as such.

This makes handling of internal function names and internal variable
names consistent. It also removes the possibility of name conflicts
between user-defined names and internal names in case name hashing is
not on. In the same vein, it makes it safe to use GLSL reserved words
that are not reserved in ESSL as variable names in case name hashing
is not on.

This also makes the GLSL output more consistent with how names are
handled in HLSL output. Name hashing code is shared between
VariableInfo and OutputGLSLBase to ensure names are handled
consistently in both. The name that's used in the shader source for a
given interface variable is written out to ShaderVariable::mappedName.

An exception needs to be made for identifiers close to the length
limit, since adding any prefix would take them over the limit. But
they can be just written out as such, since we don't have any builtins
or ANGLE internal variables that have as long names and could create a
conflict.

BUG=angleproject:2139
BUG=angleproject:2038
TEST=angle_unittests, angle_end2end_tests, WebGL conformance tests

Change-Id: Id6ed052c4fab2d091227dc9a3668083053b67a38
Reviewed-on: https://chromium-review.googlesource.com/507647
Commit-Queue: Olli Etuaho <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-08-31 09:17:59 +00:00
Olli Etuaho 39e781220c Fix assert when linking nonexistent transform feedback varying
linkValidateTransformFeedback needs to be run after packing varyings,
since it relies on nonexistent varyings being already handled.

BUG=angleproject:2141
TEST=angle_end2end_tests on debug

Change-Id: I6178348f05a19070a2d17caf90f732df9eb06b9d
Reviewed-on: https://chromium-review.googlesource.com/641152
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2017-08-29 13:15:43 +00:00
Jamie Madill 54164b0cae Add getUniform impl methods.
This will let us remove some of the uniform data management code in
the GL front-end, and simplify the GL back-end. It will also enable
us to implement uniform data more efficiently in the D3D11 back-end,
and probably Vulkan back-end later.

This also implements a new impl method for the ProgramGL class to
flag optimized-out uniforms as no longer used, post-link. This is
important because otherwise the optimized uniforms get assigned
valid locations, and then the getUniform calls are expected to
succeed.

We also use a workaround for uniform value queries for the GL
back-end. It seems as though some drivers (seen on NVIDIA and AMD)
may not properly clamp to the maximum representable integer value
when querying out-of-range floating point values. Work around this by
always calling the driver with the proper type and then casting the
value in ANGLE.

BUG=angleproject:1390

Change-Id: I03dc2382e7af52455c356a2bf3971a4d1bd46ec6
Reviewed-on: https://chromium-review.googlesource.com/616785
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-08-28 22:11:29 +00:00
Jiajia Qin 9b11ea4f2d Gather UniformBlock and ShaderStorageBlock separately
Refactor InterfaceBlocks since it only stands for UniformBlock before
ES31. But for ES31, uniform block and shader storage block both belong
to interface block.

This CL will add GetUniformBlocks and GetShaderStorageBlocks in
ShaderLang.h. Meanwhile, keep GetInterfaceBlocks which can return all
the interface blocks together.

BUG=angleproject:1951

Change-Id: I3036e201aadfbd490575ed03538c81bcc3793ff3
Reviewed-on: https://chromium-review.googlesource.com/582546
Commit-Queue: Geoff Lang <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-08-14 14:07:10 +00:00
jchen10 880683b173 ES31: Add glGetProgramResourceiv API
Add API entry and validation checks(GLES 3.1 section 7.3).
Add the first 2 interfaces(PROGRAM_INPUT and PROGRAM_OUTPUT) implementation.

BUG=angleproject:1920
TEST=angle_end2end_tests:ProgramInterfaceTestES31.*

Change-Id: I50057f7b99f4dc7c23ca87fa9b797ca424f66e3d
Reviewed-on: https://chromium-review.googlesource.com/475075
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-08-09 14:51:12 +00:00
Jamie Madill 6c58b06200 Add histograms for the program cache.
Also includes some tracking of if a cache hit comes from a binary
inserted after a Link call, or sourced from the external disk cache.

Chromium-side CL: https://chromium-review.googlesource.com/c/592151/

BUG=angleproject:2118

Change-Id: I80eefd203d8ce31d1ac03dd1a36459d3581128f5
Reviewed-on: https://chromium-review.googlesource.com/590689
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-08-02 18:02:49 +00:00
Jamie Madill 44183ccead Micro-optimizations to draw call entry point.
Thanks to Markus from NVIDIA. This inlines some methods and optimizes
the check if a uniform is a bool type.

BUG=angleproject:2119

Change-Id: I6f2c2d22c577458b39de600d3c56ec8e1a456a7a
Reviewed-on: https://chromium-review.googlesource.com/591699
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Kenneth Russell <[email protected]>
2017-08-01 20:36:21 +00:00
Jamie Madill 23176cead0 Fix performance regression in stream init.
Regressed: https://chromium-review.googlesource.com/531798

This was because the std::stringstream constructor was being called
every draw call, for the InfoLog of the dynamically recompiled
shaders in the D3D back-ends. The constructor was allocating memory
and freeing it on destruction. Instead use a lazy init for the
std::stringstream in InfoLog like we do for Error.

BUG=chromium:750685

Change-Id: I9cd429ae4e1439ae504943a9cad31cbbed17ef32
Reviewed-on: https://chromium-review.googlesource.com/594629
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-08-01 00:43:57 +00:00
Martin Radev 7cf6166aa2 Generate error on program-framebuffer num views mismatch
According to the ANGLE_multiview spec Draw* commands should generate
an INVALID_OPERATION error if the program uses the multiview extension
and the number of views in the active draw framebuffer and active
program differs. The patch addresses this by extending the base draw
call validation.

BUG=angleproject:2062
TEST=angle_end2end_tests

Change-Id: I369070beb5ccb17211dbe61ebec40bfcbcf5bc4e
Reviewed-on: https://chromium-review.googlesource.com/586605
Commit-Queue: Martin Radev <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
2017-07-28 08:13:57 +00:00
Xinghua Cao 0328b57586 Bind all elements of unbound image arrays to unit zero
Spec GLSL ES 3.10, section 4.4.5, Any uniform sampler, image or atomic
counter variable declared without a binding qualifier is initially bound
to unit zero. If the binding qualifier is used with an array, the first
element of the array takes the specified unit and each subsequent element
takes the next consecutive unit.

BUG=angleproject:1987
TEST=angle_end2end_tests:ComputeShaderTest

Change-Id: I6a8188449a91bf3e8ded37e067205dcae4e47fa7
Reviewed-on: https://chromium-review.googlesource.com/547977
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-07-27 15:46:29 +00:00
Commit Bot 84db5733d8 Merge "Fix non statically used fragment input structs on HLSL" 2017-07-13 08:00:02 +00:00
Yuly Novikov caa5cda0dc Validate uniforms and attributes name conflicts when linking
Uniforms and attribute names have global scope, according to:
GLSL 1.017 sections 4.2.6, 4.3.3 and 4.3.4.
Thus, they can't have same names.

BUG=angleproject:2014

Change-Id: Ibeb064aca877e404a67b9e3e9b57a0cc42e86f9f
2017-07-12 18:39:15 +00:00
Olli Etuaho 06a06f5ecc Fix non statically used fragment input structs on HLSL
Add static use information to struct fields that mirrors the static
use information on the struct itself. This way dynamically generated
HLSL doesn't need special handling for initializing fragment inputs
if they are structs.

This fixes a problem with the previous code where dynamically
generated HLSL ended up trying to initialize structs that are not
declared in the HLSL output because they were not being referenced.

BUG=angleproject:2104
TEST=angle_end2end_tests

Change-Id: I21283ce4fe26515d62d95e61f8155dc9a9b44cf1
2017-07-12 14:22:56 +03:00
jchen10 eaef1e5e23 Link atomic counters to buffers
Gather counters from each shader and group them according the
layout qualifier 'binding' into each buffer.

BUG=angleproject:1729
TEST=angle_end2end_tests:AtomicCounterBufferTest

Change-Id: I8d0cd0d2bf65be37c035b0e1540481c8bee0bae4
2017-07-12 08:39:03 +08:00
Jamie Madill 3244736a5d Use MemoryProgramCache.
Add the member functions for saving and loading from the binary cache,
and hook them into the Program class. Requires that the Renderer
supports the program binary extension.

BUG=angleproject:1897

Change-Id: I2dc8d21b02da705ded58c5cd1943562c9c97c49b
Reviewed-on: https://chromium-review.googlesource.com/522874
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-06-28 20:50:07 +00:00
Jamie Madill ffe00c0324 Add program cache transform feedback workaround.
On Qualcomm devices, they don't seem to correctly save transform
feedback info. Work around this by disabling caching on these devices.
This mirrors a Chromium workaround.

BUG=angleproject:2088

Change-Id: I6496d2fb6a03788379a6968bcd5eb3a9cb9d15d4
Reviewed-on: https://chromium-review.googlesource.com/549981
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
2017-06-27 21:57:56 +00:00
Xinghua Cao 65ec0b2ec4 ES31: Add support for bindImageTexture on GL backend
This patch refers to https://chromium-review.googlesource.com/c/380636/

BUG=angleproject:1987

Change-Id: If621eed6ecaa7298214843a2a133801ca1487b03
Reviewed-on: https://chromium-review.googlesource.com/462088
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-06-22 14:27:43 +00:00
jchen10 7a20b97396 Refactor uniform block binding
Remove mUniformBlockBindings and move its bindings to mUniformBlocks.

BUG=angleproject:1442

Change-Id: I62b4471990a44e626d2357c41cb914abc27cb18f
Reviewed-on: https://chromium-review.googlesource.com/532834
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-06-22 14:24:00 +00:00
Jamie Madill 4928b7caac 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 <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-06-20 21:41:46 +00:00
Jamie Madill 34ca4f5bd0 Remove Shader::getSemanticIndex.
This method doesn't really belong to GL, and was only used by the D3D
back-end to compute some attribute indexes. Simplify the code by
moving it into ProgramD3D. Also add the ability for the ShaderImpl to
assert that any pending compiles have resolved.

BUG=angleproject:1156

Change-Id: I0af3d3082ff8c908e6a87b9734989efbefd28808
Reviewed-on: https://chromium-review.googlesource.com/526336
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-06-13 18:44:30 +00:00
Jamie Madill 4f86d053b3 Introduce MemoryProgramCache.
This class will manage GPU binary programs in memory. It will be
owned by the Display, and shared between Contexts. Currently this
CL just refactors the Program binary saving and loading into static
members of this new class.

BUG=angleproject:1897

Change-Id: I34f5afb2c02416f6fd80dd65ba3827a8637ce190
Reviewed-on: https://chromium-review.googlesource.com/522873
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
2017-06-12 20:58:03 +00:00