Commit Graph
356 Commits
Author SHA1 Message Date
Jiawei Shao 4ed05da293 ES31: Add link validation on geometry shader itself
This patch intends to support program link validation on geometry
shader itself. A link error should occur when linking a program with
a geometry shader that lacks input primitive or output primitive or
the declaration of 'max_vertices'.

This patch also adds the support of linking a program with geometry
shader in angle_end2end_tests.

BUG=angleproject:1941
TEST=angle_end2end_tests
     dEQP-GLES31.functional.shaders.linkage.es31.geometry.varying.rules.unspecified_*

Change-Id: I25fb08514753102f5dd3ab86211c05d2ca4fd185
Reviewed-on: https://chromium-review.googlesource.com/898842
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2018-02-12 16:43:40 +00:00
Olli Etuaho e13f7ebea8 Make NVIDIA constant register zero skip specific to VS
It was found that the driver issue only affects vertex
shaders, so the workaround can be simplified to affect only
vertex shaders.

BUG=angleproject:2294
TEST=WebGL conformance tests on passthrough command buffer,
     angle_end2end_tests

Change-Id: Ie7fb4e75a3999e1de3d5c20d3de21e7ebb08f148
Reviewed-on: https://chromium-review.googlesource.com/889099
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2018-01-31 15:19:53 +00:00
Geoff Lang 2aaa7b4e10 Add GLES1 targets and stub entry points.
* Create a new libGLESv1_CM target.
 * Merge all autogenerated extension entry points into one file.
 * Allow creation of ES1 contexts.

BUG=angleproject:2306

Change-Id: I446258363a96a3c37d657089dd7c1cff0fa3cf78
Reviewed-on: https://chromium-review.googlesource.com/865718
Commit-Queue: Geoff Lang <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2018-01-16 19:01:00 +00:00
Olli Etuaho 0690e1aa31 Add a workaround to clamp gl_FragDepth
NVIDIA OpenGL drivers at least up to version 388.59 don't clamp
gl_FragDepth when it is written to a floating point depth buffer.
This bug is now worked around by clamping gl_FragDepth in the shader
if it is statically used.

BUG=angleproject:2299
TEST=angle_end2end_tests on NVIDIA

Change-Id: I61589b2b0dd2813c4901a157c8d37e470063773c
Reviewed-on: https://chromium-review.googlesource.com/840842
Commit-Queue: Olli Etuaho <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
2018-01-09 10:48:45 +00:00
Jamie Madill f3e2329595 EGL: Expose NULL driver device selection.
This makes the device type selection part of the ANGLE platform
extension. We currently support NULL driver selection on all
available back-ends (although on the NULL back-end, it already
has no device type). Optionally we could expose certain features
of this as separate extensions.

This currently also supports the old hidden enum, until we can
update Chrome and consolidate to the new exposed official enum.

Bug: angleproject:2159

Change-Id: I85d0811098e644e8192c207673af9e18ed7c1da2
Reviewed-on: https://chromium-review.googlesource.com/846021
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2018-01-05 00:08:29 +00:00
Jamie Madill 36937a64f4 Revert "Enable depth buffer to workaround driver bug on Intel windows"
This reverts commit 63ba357c09.

Reason for revert: May be causing Windows GPU.FYI bot failures.

https://ci.chromium.org/buildbot/chromium.gpu.fyi/Win10%20Release%20%28Intel%20HD%20630%29/1443

maps_pixel_test on Intel GPU:
Unexpected Failures:
* gpu_tests.maps_integration_test.MapsIntegrationTest.Maps_maps

webgl2_conformance_tests on Intel GPU:
Unexpected Failures:
* gpu_tests.webgl_conformance_integration_test.WebGLConformanceIntegrationTest.WebglConformance_deqp_functional_gles3_fboinvalidate_default
* gpu_tests.webgl_conformance_integration_test.WebGLConformanceIntegrationTest.WebglConformance_deqp_functional_gles3_fboinvalidate_sub

Bug: chromium:798757

Original change's description:
> Enable depth buffer to workaround driver bug on Intel windows
>
> Rendering with depth buffer disabled and stencil buffer enabled
> leads to memory leak if we set viewport a large size on Intel
> windows platforms. So we enable depth buffer if stencil buffer
> is enabled to workaround this issue.
>
> TEST=gl_test.exe --gtest_filter=GLClearFramebufferTestWithParam/GLClearFramebufferTest.ClearDepthStencil/0
> TEST=conformance/rendering/rendering-stencil-large-viewport.html
> TEST=RenderStencilBufferTest.DrawWithLargeViewport/ES3_D3D11
>
> BUG=782317
>
> Change-Id: Idb185db296f13e3fa897534514e198651a56439f
> Reviewed-on: https://chromium-review.googlesource.com/809574
> Commit-Queue: Jamie Madill <[email protected]>
> Reviewed-by: Jamie Madill <[email protected]>

[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 782317
Change-Id: I7e29da683b22fd4640c230598c7b220cfae6a177
Reviewed-on: https://chromium-review.googlesource.com/848133
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2018-01-03 20:15:05 +00:00
Olli Etuaho d8724a947b Start D3D constant register allocations from 1 on NVIDIA
Recent NVIDIA drivers have a bug where a specific optimized path
inside the driver doesn't handle constant register 0 correctly. Work
around this by starting constant register allocations from 1. This
should make sure that the bug doesn't trigger if the ordering of
uniforms is changed on the D3D backend.

The repro case seems to require some specific driver state to be set
that's used inside Chromium. Because of this we have not been able to
develop a standalone test case so far.

The maximum number of available uniform slots is reduced accordingly.
This should not take them below required minimums in the spec.

BUG=angleproject:2294
TEST=WebGL tests on passthrough command buffer,
     angle_end2end_tests --gtest_filter=*GLSLTest*Uniform*

Change-Id: I92fff71efe5432ea7f15a7e90d497492514c65dc
Reviewed-on: https://chromium-review.googlesource.com/847481
Commit-Queue: Olli Etuaho <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2018-01-03 12:24:16 +00:00
JiangYizhou 63ba357c09 Enable depth buffer to workaround driver bug on Intel windows
Rendering with depth buffer disabled and stencil buffer enabled
leads to memory leak if we set viewport a large size on Intel
windows platforms. So we enable depth buffer if stencil buffer
is enabled to workaround this issue.

TEST=gl_test.exe --gtest_filter=GLClearFramebufferTestWithParam/GLClearFramebufferTest.ClearDepthStencil/0
TEST=conformance/rendering/rendering-stencil-large-viewport.html
TEST=RenderStencilBufferTest.DrawWithLargeViewport/ES3_D3D11

BUG=782317

Change-Id: Idb185db296f13e3fa897534514e198651a56439f
Reviewed-on: https://chromium-review.googlesource.com/809574
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2018-01-02 16:23:40 +00:00
Xinghua Cao 26143fdd0f 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 <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-12-20 17:16:46 +00:00
Jiawei Shao bd924af173 ES31: Remove support of GL_OES_geometry_shader in compiler
This patch intends to remove the support of GL_OES_geometry_shader
in ANGLE compiler.

To make the implementation simpler, currently we decide to only
support "GL_EXT_geometry_shader" as the extension string of geometry
shader in ANGLE.

This patch also updates all the related shaders in angle_unittests
into R"()" format.

BUG=angleproject:1941
TEST=angle_unittests

Change-Id: Ife9858abeedfb46b02c5c2fb1cda16fa27198511
Reviewed-on: https://chromium-review.googlesource.com/773451
Commit-Queue: Corentin Wallez <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
2017-12-14 18:32:04 +00:00
jchen10 8225e73bb3 Support struct varying for transform feedback
Capturing struct members is vague In ES 3.00. But the ES 3.10
explicitly says that base-level members of struct are feasible for
transform feedback capture. This implementation fills the gap.

TEST=angle_end2end_tests:TrasnformFeedbackTest*
BUG=angleproject:2241
Change-Id: Ibdf3ae6c2b8b28952e2f7fef1363545cbccad389
Reviewed-on: https://chromium-review.googlesource.com/768613
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-12-13 16:03:49 +00:00
Olli Etuaho ebe13bb1b9 Remove SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM
Instanced multiview is fully implemented and performs much better than
broadcasting draw calls on the CPU. There's no need to maintain
translating ViewID_OVR to a uniform.

BUG=angleproject:2267
TEST=angle_unittests

Change-Id: If3a8fa573f37b7926c052aecfcd4271f266751dc
Reviewed-on: https://chromium-review.googlesource.com/819417
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2017-12-13 15:55:49 +00:00
Corentin Wallez 9db70de8ec Reland: Implement EGL_ANGLE_iosurface_client_buffer
Includes a fix for creating pbuffers with <buftype> EGL_D3D_TEXTURE
with EGL_WIDTH and EGL_HEIGHT attributes.

BUG=angleproject:1649
[email protected]

Change-Id: Id2974b8fab02c3218febfac708b9b034e65cbc53
Reviewed-on: https://chromium-review.googlesource.com/823248
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Corentin Wallez <[email protected]>
2017-12-13 00:45:43 +00:00
Corentin Wallez 7f5c3eb768 Revert "Implement EGL_ANGLE_iosurface_client_buffer"
This reverts commit c7abc08034.

Reason for revert: Might have broken Chromium Win10 composition due to validation changes.

Original change's description:
> Implement EGL_ANGLE_iosurface_client_buffer
> 
> BUG=angleproject:1649
> 
> Change-Id: I1e72c31d7c9497ad14039a8d3fb97317ab193cb2
> Reviewed-on: https://chromium-review.googlesource.com/559107
> Reviewed-by: Corentin Wallez <[email protected]>
> Reviewed-by: Geoff Lang <[email protected]>
> Commit-Queue: Corentin Wallez <[email protected]>

[email protected],[email protected]

Change-Id: I605b710b6d76056d6276b09822cd6ddca277bfd0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: angleproject:1649
Reviewed-on: https://chromium-review.googlesource.com/822172
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Corentin Wallez <[email protected]>
2017-12-12 14:55:31 +00:00
Corentin Wallez c7abc08034 Implement EGL_ANGLE_iosurface_client_buffer
BUG=angleproject:1649

Change-Id: I1e72c31d7c9497ad14039a8d3fb97317ab193cb2
Reviewed-on: https://chromium-review.googlesource.com/559107
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Corentin Wallez <[email protected]>
2017-12-11 19:52:06 +00:00
Jeff Gilbert 3dddccff31 Support RGB gl-tex-external stream consumers for StreamProducerNV12.
This makes it relatively simple to sample from a D3D11Texture of
arbitrary format.

From: https://bugzilla.mozilla.org/show_bug.cgi?id=1322746

BUG=angleproject:2233
TEST=angle_end2end_tests

Change-Id: I10cd3043b5cb0c5d36dd613467ba6c0ceadf41af
Reviewed-on: https://chromium-review.googlesource.com/758042
Commit-Queue: Geoff Lang <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-12-05 15:24:25 +00:00
Olli Etuaho 3de2703d83 Fix handling matrix qualifiers on block members
Individual block member row_major/column_major layout qualifiers may
override the qualifiers set on the block. During parsing, this was
already being handled correctly, so that the qualifier is resolved for
each block member and recorded for each TField / InterfaceBlockField.

Now we always write the qualifiers on a per-member granularity to the
output GLSL shaders, so that the native driver gets the correct
per-member qualifiers. This replaces earlier behavior where the matrix
qualifiers were only written per-block.

Also only use qualifiers from individual members in block layout.

Since the block-level qualifier information is no longer used after
parsing, it is no longer kept in the AST. A dummy value is still set
to the InterfaceBlock structs exposed through the ShaderVars
interface, since that has existing usage in Chromium that needs to be
removed before the field can be removed.

Some AMD OpenGL drivers don't seem to handle matrix layout qualifiers
correctly, so most of the added tests need to be skipped for AMD GL.
On NVIDIA and Intel the tests pass.

BUG=angleproject:2271
TEST=angle_unittests, angle_end2end_tests,
     dEQP-GLES31.functional.program_interface_query.uniform.matrix*

Change-Id: I1baa7a633bc2da548743c2190cb72db491b5227a
Reviewed-on: https://chromium-review.googlesource.com/800174
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2017-12-04 20:31:47 +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
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
Jamie Madill 2f294c9abb Add constructors for TMemoryQualifier and TLayoutQualifier.
These replace the ::create methods, to facilitate constexpr versions.
Also adds a constructor of WorkGroupSize that can be made to be
constexpr.

Bug: angleproject:1432
Change-Id: I413d1a56102c94d6a383775110a2b850a7532ea0
Reviewed-on: https://chromium-review.googlesource.com/776279
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Kai Ninomiya <[email protected]>
2017-11-20 20:52:25 +00:00
Olli Etuaho b5601eb675 Only initialize globals if initialization flag is set
This avoids the possibility of initializing globals twice in Chromium.
Now we also never initialize variables redundantly in case we're
writing HLSL output. This was already the intent of the code before,
but a mistake had slipped in and the code didn't actually check the
output type properly.

This also simplifies DeferGlobalInitializers by running it after
SeparateDeclarations.

BUG=chromium:735497
TEST=WebGL conformance tests

Change-Id: I95036a24ac8cf18113755510376a2fca286b3ee6
Reviewed-on: https://chromium-review.googlesource.com/771555
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2017-11-16 20:14:54 +00:00
Jamie Madill 740aa41ddf Fix angle::Platform export definitions.
This was only showing up in the GYP build on Windows.

BUG=chromium:778918

Change-Id: Ib9db0c928474be887ec1f46d7e99c0a3dedfb9e0
Reviewed-on: https://chromium-review.googlesource.com/768947
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Olli Etuaho <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-11-14 16:52:19 +00:00
Jamie Madill ff7aac5e4f Re-land "Export angle::PlatformMethods."
This should fix undefined function call sanitizer warnings.

Re-land fixes the build and uses proper export annotation. Also fixes
the missing source includes in BUILD.gn for libANGLE so future
changes to Platform.h (and other includes) will get picked up by the
dependency analyzer step.

BUG=chromium:778918

Change-Id: I92cc8a43bbbdc70de50a67f73b223d8f903cd6cd
Reviewed-on: https://chromium-review.googlesource.com/767111
Commit-Queue: Jamie Madill <[email protected]>
Reviewed-by: Antoine Labour <[email protected]>
2017-11-14 04:34:52 +00:00
Jamie Madill c2eb32bad8 Revert "Export angle::PlatformMethods."
This reverts commit 8b920b211d.

Reason for revert: This had a syntax error and skipped the compile step, so went undetected.

BUG=chromium:778918

Original change's description:
> Export angle::PlatformMethods.
> 
> This should fix undefined function call sanitizer warnings.
> 
> BUG=chromium:778918
> 
> Change-Id: I718d58edd7b75a3fca1089edc4df7f3251d85153
> Reviewed-on: https://chromium-review.googlesource.com/767152
> Reviewed-by: Jamie Madill <[email protected]>
> Commit-Queue: Jamie Madill <[email protected]>

[email protected],[email protected]

Change-Id: I1825ce88bc82867a983bb08cd6732caff54f061c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:778918
Reviewed-on: https://chromium-review.googlesource.com/767128
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-11-13 21:53:14 +00:00
Jamie Madill 8b920b211d Export angle::PlatformMethods.
This should fix undefined function call sanitizer warnings.

BUG=chromium:778918

Change-Id: I718d58edd7b75a3fca1089edc4df7f3251d85153
Reviewed-on: https://chromium-review.googlesource.com/767152
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-11-13 21:19:01 +00:00
Olli Etuaho bb0775da28 Add flag for turning off initializing variables with loops
This flag is needed to toggle upcoming variable initialization mode
which uses for loops to optimize the compilation process. Initializing
variables using for loops will be turned on by default, but it needs
to be turned off in Chromium in certain cases. Chromium will use the
flag added in this patch and that code will need to go into Chromium
before finishing the implementation in ANGLE.

BUG=chromium:735497

Change-Id: I3a0e7b7c6cebe60afa72964fbd0caf3b1eafccbc
Reviewed-on: https://chromium-review.googlesource.com/763451
Commit-Queue: Olli Etuaho <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-11-12 09:08:00 +00:00
Jamie Madill cac94a9124 Optimize ShaderVariable::isBuiltIn.
This makes the check a bit faster, by inlining the prefix check.
Also some cleanups to ValidateVertexShaderAttributeTypeMatch.

BUG=angleproject:2202

Change-Id: Ifeab4cd85a91a1639a461f44776a68ac98c5bd79
Reviewed-on: https://chromium-review.googlesource.com/761240
Reviewed-by: Yuly Novikov <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-11-11 15:44:44 +00:00
JiangYizhou 38d92b59c4 Workaround Intel driver bug on D3D when renderering with no render target
When rendering with no render target on D3D, two bugs lead to
incorrect behavior on Intel drivers < 4815. The rendering samples
always pass neglecting discard statement in pixel shader.

Two bugs are listed bellow,
1. When a framebuffer has no attachments, the pixel shader will be
recompiled to drop 'SV_TARGET'. On Intel drivers, when using a pixel
shader with no 'SV_TARGET' in a draw, pixels are always generated even
if they should be discard by 'discard' statements.

2. When a framebuffer has no attachments, ID3D11BlendState.RenderTarget
[].RenderTargetWriteMask were set to 0 in angle. If RenderTargetWriteMask
is 0 and rendertarget is not set, then rendering samples also pass
neglecting discard statement in pixel shader on Intel.

So we add a dummy texture as render target to workaround this issue.

BUG=angleproject:2152

TEST=FramebufferTest_ES31.RenderingLimitToDefaultFBOSizeWithNoAttachments/ES3_1_D3D11
TEST=dEQP-GLES31.functional.fbo.no_attachments.*
TEST=dEQP-GLES31.functional.state_query.integer.max_framebuffer*
TEST=dEQP-GLES31.functional.state_query.integer.max_color_texture_samples_*
TEST=dEQP-GLES31.functional.state_query.integer.max_depth_texture_samples_*
TEST=dEQP-GLES31.functional.state_query.integer.max_integer_samples_*

Change-Id: I1cb974703b6c05c39b731d147f7c8c4fb7b5fe68
Reviewed-on: https://chromium-review.googlesource.com/741544
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-11-10 20:38:42 +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
Olli Etuaho 661fc487dd Work around NVIDIA GLSL vector-scalar op bug
This adds a new AST transform VectorizeVectorScalarArithmetic. The AST
transform works around incorrect handling of certain types of GLSL
arithmetic operations by NVIDIA's GL driver. It works around only the
most common cases where the bug reproduces, since detecting all the
cases would take more sophisticated analysis of the code than what
is currently easily implementable in ANGLE.

When a float add operator has both vector and scalar operands, the AST
transform turns the scalar operand into a vector operand. Example:

vec4 f;
f += 1.0;

gets turned into:

vec4 f;
f += vec4(1.0);

When a vector constructor contains a binary scalar float
multiplication or division operation as its only argument, the AST
transform turns both operands of the binary operation into vector
operands. Example:

float f, g;
vec4(f * g);

gets turned into:

float f, g;
vec4(vec4(f) * vec4(g));

Another example with compound assignment:

float f, g;
vec4(f *= g);

gets turned into:

float f, g;
vec4 s0 = vec4(f);
(s0 *= g, f = s0.x), s0;

This latter transformation only works in case the compound assignment
left hand expression doesn't have side effects.

BUG=chromium:772651
TEST=angle_end2end_tests

Change-Id: I84ec04287793c56a94845a725785439565debdaf
Reviewed-on: https://chromium-review.googlesource.com/721321
Commit-Queue: Olli Etuaho <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
2017-11-09 18:16:56 +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
Jeff Gilbert 20c285ecd7 callClearTwiceOnSmallTarget is needed for all sizes.
Gecko bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1325733

BUG=angleproject:2214

Change-Id: I6837a0fbf0bbbd0877f333f0625729445a5999aa
Reviewed-on: https://chromium-review.googlesource.com/748320
Reviewed-by: Geoff Lang <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Geoff Lang <[email protected]>
2017-11-06 16:57:51 +00:00
Qin Jiajia ca68d9886f ES31: Add std430 support for OpenGL backend
BUG=angleproject:1920
TEST=angle_unittests

Change-Id: Ie8e171abec053c2c5dca93d6e79db534f74520e7
Reviewed-on: https://chromium-review.googlesource.com/737532
Commit-Queue: Geoff Lang <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-10-27 14:42:04 +00:00
Olli Etuaho e7c2857dbe Clean up direct access of ShaderVariable::arraySize
This change is pure refactoring. It's intended to help with adding
support for arrays of arrays.

BUG=angleproject:2125
TEST=angle_unittests

Change-Id: I82881a98c3c476fd6666a551ce6be255ae0de4cf
Reviewed-on: https://chromium-review.googlesource.com/733127
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2017-10-24 06:50:10 +00:00
Olli Etuaho 15de9262ea Add array size functions to ShaderVars
These can be used instead of direct access of the arraySize field in
Chromium, so that arrays of arrays support can be implemented inside
ANGLE without breaking the Chromium build.

BUG=angleproject:2125
TEST=angle_unittests

Change-Id: I123c2a18549e8f6e40ade946870a5437faf2155e
Reviewed-on: https://chromium-review.googlesource.com/718201
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
Commit-Queue: Olli Etuaho <[email protected]>
2017-10-17 09:29:02 +00:00
Geoff Lang b433e872c8 Change robust resource init into a context creation attribute.
Enabled support on OpenGL even through the extension is not fully
implemented so that testing with Chromium/Passthrough commmand decoder
is still possible.

BUG=angleproject:1635

Change-Id: Ia417b1779aace1eae19514325701a79cd33f4ef3
Reviewed-on: https://chromium-review.googlesource.com/678479
Commit-Queue: Geoff Lang <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
2017-10-06 14:23:12 +00:00
Jiawei Shao 4cc89e2bfe ES31: Enable 'location' layout qualifier on shader interfaces in compiler
This patch enables 'location' layout qualifier for vertex outputs and
fragment shader inputs when the shader version is 3.1 in ANGLE GLSL
compiler and adds the check on location conflicts for these varyings.

According to GLSL ES 3.1 SPEC (Chapter 4.4.1 and Chapter 4.4.2),
'location' layout qualifier is allowed on both inputs and outputs of
vertex and fragment shaders.

'location' layout qualifier on shader interfaces is only valid on shaders
whose version is 3.1 and above. According to GLSL ES 3.0 SPEC, vertex shader
cannot have output layout qualifiers (Chapter 4.3.8.2) and fragment shader
cannot have input layout qualifiers (Chapter 4.3.8.1).

The 'location' qualifier on varyings is used in the shader interface
matching defined in OpenGL ES 3.1. (OpenGL ES 3.1 SPEC Chapter 7.4.1). This
new link rule will be added to Program.cpp in another patch.

For the OpenGL ES 3.1 extension GL_OES_geometry_shader, according to
GL_OES_shader_io_blocks SPEC (Chapter 4.4.1 and Chapter 4.4.2), 'location'
layout qualifier is both valid on geometry shader inputs and outputs. This
feature will be implemented together with other rules on geometry shader
inputs and outputs.

BUG=angleproject:2144
TEST=angle_unittests

Change-Id: I62d85f7144c177448321c2db36ed7aaeaa1fb205
Reviewed-on: https://chromium-review.googlesource.com/645366
Commit-Queue: Geoff Lang <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-09-20 16:06:02 +00:00
Martin Radev 84aa2dcf8a Add textureGather and textureGatherOffset
The patch adds new built-ins and extends the semantic parser to add
support for textureGather and textureGatherOffset.

BUG=angleproject:1442
TEST=angle_unittests
TEST=angle_deqp_gles31_tests.exe
     --deqp-case=dEQP-GLES31.functional.texture.gather*
     --deqp-egl-display-type=angle-gl

Change-Id: Iaf98c3420fbd61193072fdec8f5a61ac4c574101
Reviewed-on: https://chromium-review.googlesource.com/660124
Commit-Queue: Martin Radev <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-09-19 23:18:38 +00:00
Jamie Madill 9abe07c652 Move Platform Context pointer to start of struct.
This will ensure that new methods (placed at the end) don't collide
with the context pointer when using a mismatched platform.

BUG=angleproject:1892

Change-Id: Ice6a3ccaf3cc2a1e36a04bc217386cf096612176
Reviewed-on: https://chromium-review.googlesource.com/672147
Reviewed-by: Frank Henigman <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-09-19 20:51:10 +00:00
Jamie Madill 9dfa628dfc Add RequestExtension to static link.
This probably was left out accidentally. Also this fixes the return
type of the prototype in the extension header (should be void, not
boolean).

BUG=angleproject:1523

Change-Id: I7bf0b36b05a4cba4cb6fb2411fc53103dda54bfe
Reviewed-on: https://chromium-review.googlesource.com/657898
Reviewed-by: Jamie Madill <[email protected]>
Reviewed-by: Yuly Novikov <[email protected]>
Commit-Queue: Jamie Madill <[email protected]>
2017-09-14 15:22:55 +00:00
Martin Radev 7cadfcc70c Change ANGLE_multiview's enum values
The enums introduced by the ANGLE_multiview extension are changed
to use the values reserved specifically for ANGLE.

BUG=angleproject:2062
TEST=angle_end2end_tests

Change-Id: Ib668f2e0e9022442a432b1a04050aeb2ff82a3d1
Reviewed-on: https://chromium-review.googlesource.com/654864
Reviewed-by: Geoff Lang <[email protected]>
Commit-Queue: Martin Radev <[email protected]>
2017-09-07 14:25:36 +00:00
Martin Radev c1d4e55094 D3D11: Select view in vertex shader
View selection can happen in the vertex shader through the optional
feature VPAndRTArrayIndexFromAnyShaderFeedingRasterizer.

BUG=angleproject:2062
TEST=angle_end2end_tests

Change-Id: Iaf65685e04f828b0936295fea867f6f6cbe69bee
Reviewed-on: https://chromium-review.googlesource.com/628419
Commit-Queue: Martin Radev <[email protected]>
Reviewed-by: Jamie Madill <[email protected]>
2017-09-07 09:28:36 +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
Jiawei Shao d27f5c8d2b ES31: Implement GL_OES_geometry_shader built-ins in GLSL compiler
This patch intends to implement all built-in constants, variables and
functions defined in OpenGL ES 3.1 extension GL_OES_geometry_shader
in ANGLE GLSL compiler.

1. Add all built-in constants defined in GL_OES_geometry_shader.
2. Add built-in functions EmitVertex() and EndPrimitive() required
   in Geometry Shader.
3. Add built-in variables gl_PrimitiveIDIn and gl_InvocationID to
   Geometry Shader.
4. Add built-in variables gl_PrimitiveID and gl_Layer to both
   Geometry Shader and Fragment Shader when GL_OES_geometry_shader
   is enabled.

BUG=angleproject:1941
TEST=angle_unittests

Change-Id: I92821553ed0efee2ccb77fead6e065e7799819d0
Reviewed-on: https://chromium-review.googlesource.com/627670
Commit-Queue: Corentin Wallez <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-08-25 15:18:21 +00:00
Jiawei Shao d8105a03fa ES31: Implement gl_in in Geometry Shader
This patch intends to implement geometry shader built-in interface
block instance gl_in defined in GL_OES_geometry_shader.

1. Add the definition of gl_in and its interface block gl_PerVertex
   into the symbol table.
2. Support gl_Position as a member of gl_in.
3. Set the array size of gl_in when a valid input primitive type is
   known.
4. Add check that it should be a compile error to index gl_in or
   call length() on gl_in without a valid input primitive declaration.

This patch also adds unit tests to cover all these new features.

BUG=angleproject:1941
TEST=angle_unittests

Change-Id: I8da20c943b29c9ce904834625b396aab6302e1e1
Reviewed-on: https://chromium-review.googlesource.com/605059
Commit-Queue: Olli Etuaho <[email protected]>
Reviewed-by: Olli Etuaho <[email protected]>
2017-08-22 10:56:59 +00:00
Martin Radev 4e619f5877 Add branch for viewport or layer selection in VS
The patch extends the behavior of
SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER so that either the viewport
or layer is selected based on the value of the internal uniform variable
MultiviewRenderPath.

BUG=angleproject:2062
TEST=angle_end2end_tests
TEST=angle_unittests

Change-Id: Ia311b12b1fed642dac78eba8732e2535242f34fd
Reviewed-on: https://chromium-review.googlesource.com/615260
Commit-Queue: Martin Radev <[email protected]>
Reviewed-by: Olli Etuaho <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-08-21 08:00:04 +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
Corentin Wallez 13c0dd4631 Add texture rectangle extension.
This is needed to support binding IOSurfaces to textures on OSX. This
commit adds support in the API and tests, but didn't need to implement
compiler changes as it already supported ARB_texture_rectangle.

Implementation of CHROMIUM_opy_texture for rectangle texture and the
spec are left for follow-up commits.

Change-Id: I45c66be763a9d3f6f619640f9f95f39b05c70867
Reviewed-on: https://chromium-review.googlesource.com/559106
Commit-Queue: Corentin Wallez <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-08-03 19:32:46 +00:00
Jiawei-Shao df7d7c9ec7 Split varyings into input and output varyings in compiler
This patch intends to split all vector<Varying> into two vectors
to store input and output varyings separately in the compiler.

This patch is a base of implementing the built-ins, inputs and
outputs of a geometry shader to ANGLE GLSL compiler. 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

Change-Id: I9e8cc16045d5e29e9a80a09dc31b33a7ae39b345
Reviewed-on: https://chromium-review.googlesource.com/593347
Commit-Queue: Geoff Lang <[email protected]>
Reviewed-by: Geoff Lang <[email protected]>
2017-08-02 13:16:49 +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