|
856c497e
|
2016-08-08T11:38:39
|
|
Clarify error checking function names in the GLSL parser
Most error checking functions in ParseContext used to follow a format
like <property>ErrorCheck. Sometimes this function would check that
the node/value would have <property>, sometimes it would check that
the node/value would not have it, which was confusing. Change most of
these functions to use a lot more descriptive names, which clearly
communicate what they are checking for.
Also includes a bit of refactoring in constructorErrorCheck(), so that
the function only checks for errors rather than also setting the type
of the constructor node.
Also make TType::arraySize unsigned, and return a sanitized size from
checkIsValidArraySize() instead of using an output parameter.
BUG=angleproject:911
TEST=angle_unittests
Change-Id: Id9767b8c79594ad3f782f801ea68eb96df721a31
Reviewed-on: https://chromium-review.googlesource.com/367070
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
b079c7af
|
2016-04-01T12:32:52
|
|
Wrap integer textures with correct wrap mode in HLSL
The wrap mode information for all three dimensions is packed to a
single integer in order to conserve sampler metadata space. Only one
int4 vector is used for the metadata for a single sampler.
The sampler metadata is now packed into a struct instead of an array
of integers in order to make the code more readable and maintainable.
The internalFormatBits field is not removed in this patch. It's better
to remove it in a separate patch, so restoring it is easier in case it
will be used for optimizing some of the texture sampling functions.
The wrap mode passed in sampler metadata is used to wrap the texture
coordinates in the code generated to implement ESSL 3.00 integer
texture sampling built-ins.
Those dEQP-GLES3.functional.texture.units.* tests that sample from
integer cube maps still fail on Intel D3D after this change,
presumably due to driver issues.
BUG=angleproject:1244
BUG=angleproject:1095
BUG=angleproject:1092
TEST=dEQP-GLES3.functional.texture.units.* (all pass on NVIDIA),
dEQP-GLES3.functional.shaders.texture_functions.* (no regressions)
Change-Id: I4e31e5796086f9cc290c6f1f8c4380a768758d71
Reviewed-on: https://chromium-review.googlesource.com/336638
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
9696316d
|
2016-03-21T11:54:33
|
|
Support ESSL structs containing samplers on D3D
Since HLSL can't natively handle samplers in structs, samplers need to
be extracted out of structs into separate variables in the translated
shader code. In HLSL 4.1, samplers that were in structs go into the
normal sampler arrays and are identified by index constants. In other
HLSL versions, samplers that were in structs are translated as uniform
variables.
These transformations are done inside the HLSL output classes, not as
tree transformations. This helps to keep the uniform API provided by
the shader translator intact.
Wherever a struct containing samplers is passed into a user-defined
function, the translated HLSL code passes the separate sampler
variables alongside a struct where the samplers have been removed.
The D3D backend in libANGLE queries the uniform registers of any
samplers that were in uniform structs, and adds them to the register
maps, so that correct sampler state gets assigned to them.
The extracted sampler variables are prefixed with "angle_" instead of
the usual "_" to prevent any name conflicts between them and regular
variables.
BUG=angleproject:504
TEST=angle_end2end_tests,
dEQP-GLES*.functional.shaders.struct.uniform.* (all pass),
dEQP-GLES*.functional.uniform_api.* (most now pass)
Change-Id: Ib79cba2fa0ff8257a973d70dfd917a64f0ca1efb
Reviewed-on: https://chromium-review.googlesource.com/333743
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
f8bf583b
|
2016-02-11T16:21:49
|
|
Pass integer texture format bit count to shaders on D3D11
This will be needed in the future when integer texture wrap mode support
will be added by sampling integer textures through FLOAT/UNORM/SNORM
SRVs.
The bit count needs to be passed for 8-, 10- and 16-bit textures. 32-bit
integer textures are the ones left over. Only passing the bit counts for
the absolute minimum number of formats avoids unnecessary driver constant
buffer updates.
BUG=angleproject:1244
BUG=angleproject:1095
TEST=angle_end2end_tests
Change-Id: I28a84588842b2eb9a1661454437d21c22ce794b7
Reviewed-on: https://chromium-review.googlesource.com/326944
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
618bebcd
|
2016-01-15T16:40:00
|
|
Pass texture base level to shaders on D3D11
The base level is passed to shaders in an array included in the driver
uniform block. This is done on feature levels above 9_3, which treat
samplers as indices to sampler arrays in shaders.
A separate uniform block couldn't be used for the sampler metadata,
since that would bring the number of available uniform blocks down to
below minimum level defined by GLES 3.0.
BUG=angleproject:596
TEST=angle_end2end_tests
Change-Id: Ie040521402f9996d51a978aeeba9222e9dd761ce
Reviewed-on: https://chromium-review.googlesource.com/326290
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
00140f4a
|
2016-02-03T18:47:33
|
|
Revert "Pass texture base level to shaders on D3D11"
This reverts commit 3026829e155bd89b5ca5b7b7c5267699b9192557.
Change-Id: I0b4c3f5b1453b993b149423bb1ce407f4918cf54
Reviewed-on: https://chromium-review.googlesource.com/325435
Reviewed-by: Geoff Lang <geofflang@chromium.org>
|
|
3026829e
|
2016-01-15T16:40:00
|
|
Pass texture base level to shaders on D3D11
The base level is passed to shaders in a uniform block created
specifically for passing sampler metadata. This is done on feature levels
above 9_3, which treat samplers as indices to sampler arrays in shaders.
BUG=angleproject:596
TEST=angle_end2end_tests
Change-Id: I846f2fc195ab1fd884052824ffd3c1d65083c0fb
Reviewed-on: https://chromium-review.googlesource.com/322122
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
|
|
9b4e8626
|
2015-12-22T15:53:22
|
|
Redesign samplers in shaders on D3D11
Translation of samplers to HLSL on D3D11 is changed as follows:
Instead of passing around HLSL sampler and HLSL texture references in
shaders, all references to ESSL samplers are converted to constant
indices within the shader body. Each ESSL sampler is identified by an
unique index. In the code generated to implement ESSL texture functions,
these indices are used to index arrays of HLSL samplers and HLSL
textures to get the sampler and texture to use.
HLSL textures and samplers are grouped into arrays by their types. Each
unique combination of a HLSL texture type + HLSL sampler type gets its
own array. To convert a unique sampler index to an index to one of these
arrays, a constant offset is applied. In the most common case of a 2D
texture and a regular (non-comparison) sampler, the index offset is
always zero and is omitted.
The end goal of this refactoring is to make adding extra metadata for
samplers easier. The unique sampler index can be used in follow-up
changes to index an array of metadata passed in uniforms, which can
contain such things as the base level of the texture.
This does not solve the issues with samplers in structs.
The interface from the point of view of libANGLE is still exactly the
same, the only thing that changes is how samplers are handled inside the
shader.
On feature level 9_3, the D3D compiler has a bug where it can report that
the maximum sampler index is exceeded when in fact it is not. This can
happen when an array of samplers is declared in the shader. Because of
this the new approach can't be used on D3D11 feature level 9_3, but it
will continue using the old approach instead.
BUG=angleproject:1261
TEST=angle_end2end_tests,
dEQP-GLES3.functional.shaders.texture_functions.* (no regressions)
dEQP-GLES3.functional.texture.units.* (no regressions)
Change-Id: I5fbb0c4280000202dc2795a628b56bd8194ef96f
Reviewed-on: https://chromium-review.googlesource.com/320571
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com>
|
|
73941deb
|
2015-02-25T14:34:49
|
|
Disable the HLSL code in Angle if it is not being used.
We're only using the HLSL code in Windows so
it's not necessary to compile and distribute it on other platforms.
This adds a defined ANGLE_ENABLE_HLSL that can be checked in files that
are used by non-HLSL code as well. Mostly the HLSL code is just not
include by the build system.
Details of the space savings (heavily truncated)
Total change: -165717 bytes
===========================
-606 - Source: angle/src/common/utilities.cpp
-627 - Source: angle/src/compiler/translator/FlagStd140Structs.cpp
-695 - Source: /usr/include/c++/4.8/bits/stl_algo.h
-710 - Source: angle/src/compiler/translator/TranslatorHLSL.cpp
-713 - Source: angle/src/compiler/translator/IntermNode.h
-863 - Source: /usr/include/c++/4.8/bits/stl_map.h
-935 - Source: angle/src/compiler/translator/blocklayout.cpp
-1515 - Source: angle/src/compiler/translator/BuiltInFunctionEmulator.cpp
-1655 - Source: angle/src/compiler/translator/UnfoldShortCircuit.cpp
-2375 - Source: /usr/include/c++/4.8/bits/vector.tcc
-3135 - Source: angle/src/compiler/translator/RewriteElseBlocks.cpp
-4656 - Source: angle/src/compiler/translator/UtilsHLSL.cpp
-5265 - Source: angle/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp
-6505 - Source: /usr/include/c++/4.8/bits/stl_tree.h
-11480 - Source: angle/src/compiler/translator/UniformHLSL.cpp
-13580 - Source: angle/src/compiler/translator/StructureHLSL.cpp
-18964 - Source: ??
(constant strings and a few vtbls)
-89332 - Source: angle/src/compiler/translator/OutputHLSL.cpp
Change-Id: I23ccc98abd0a21f847dd34f9482800b3ba679d56
Reviewed-on: https://chromium-review.googlesource.com/251528
Tested-by: bratell at Opera <bratell@opera.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
|
|
a3a5cc6a
|
2015-02-13T13:12:22
|
|
Expose the IntermNode tree generated in the compiler for testing
This refactoring makes it possible for tests to access the IntermNode
tree produced by compilation by calling compileTree(). Removing
ParseContext usage from OutputHLSL has the additional benefit of better
separation between parsing and output.
BUG=angle:916
Change-Id: Ib40954832316328772a5c1dcbbe6b46b238e4e65
Reviewed-on: https://chromium-review.googlesource.com/249723
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
|
|
9e0478f6
|
2015-01-13T11:13:54
|
|
Move the block layout code to translator.
This code is easily accessible from the translator, with the proper
export calls. This facilitates adding a common static library, since
this code calls some methods in translator.
BUG=angle:773
Change-Id: I0c50098ec3f67c2df7749b3c2518be0a9fd939e2
Reviewed-on: https://chromium-review.googlesource.com/240093
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
|
|
2ec386bb
|
2014-12-03T14:44:38
|
|
Rename IsSampler to IsSamplerType.
BUG=angle:733
Change-Id: I62aece16c11aefdbf13c0b5faf83040fdb8555e6
Reviewed-on: https://chromium-review.googlesource.com/232960
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
|
|
54ad4f81
|
2014-09-03T09:40:46
|
|
Use the CollectVariables path on the HLSL translator.
This approach consolidates our two methods, and lets us reuse the
same code for both methods of variable collection.
BUG=angle:466
Change-Id: Ie92f76ff0b6d0d0dbfd211a234d0ab86290fa798
Reviewed-on: https://chromium-review.googlesource.com/213504
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
|
|
42bcf32e
|
2014-08-25T16:20:46
|
|
Refactor ShaderVariables to store fields in the base.
Instead of only storing structure information in Varyings, Uniforms
and Interface Block Fields, store it in the base class. Also only
store base variable information for struct fields, instead of fully
typed information. This works because stuff like interpolation type,
invariance, and other properties are for the entire variable, not
individual fields.
Also add new fields for interface block instance name, varying
invariance and structure name for all struct types.
BUG=angle:466
Change-Id: If03fc071e6becb7aad6dea5093989bba7daee69e
Reviewed-on: https://chromium-review.googlesource.com/213501
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
|
|
33a74bde
|
2014-08-18T15:47:59
|
|
Fix std140 UBO layouts.
A call to "prePadding" instaed of "prePaddingString" was confusing
the HLSL output engine.
A separate bug was causing HLSL errors because HLSL puts all cbuffer
members in a flattened namespace, which caused our internal padding
variables to overlap.
BUG=angle:725
Change-Id: I69a01fefa430a83e433385c64a532a69e6851ae8
Reviewed-on: https://chromium-review.googlesource.com/212930
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
|
|
b8c0a832
|
2014-08-15T16:41:12
|
|
Amend comment about nameless structs & layout qualifiers
Change-Id: I1177c808bffd2beba7d52bd8f8869125a1624698
Reviewed-on: https://chromium-review.googlesource.com/212700
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
Tested-by: Shannon Woods <shannonwoods@chromium.org>
|
|
bc75f36b
|
2014-08-11T14:08:19
|
|
Fix nameless struct handling.
BUG=401296
The addition of layout qualifier handling in es3 development inadvertently
broke handling of nameless structs.
Change-Id: I805bab7a981d1f7f6227ae043720296fc3454662
Reviewed-on: https://chromium-review.googlesource.com/211860
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Shannon Woods <shannonwoods@chromium.org>
|
|
a3fe2b4e
|
2014-07-18T10:33:13
|
|
Update non-default constructors in shadervars.h.
Most of these constructors are unused. Remove the unused ones,
and change the usage of existing constructors to be consistent.
BUG=angle:466,697
Change-Id: I455dd314036e1dfcb8c4690bab577b81dd0e060c
Reviewed-on: https://chromium-review.googlesource.com/208355
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
|
|
e04a5b7b
|
2014-07-18T10:33:12
|
|
Remove sh::InterfaceBlock member info.
We can compute the interface block member info entirely on the
API side. This will allow us to get rid of some un-necessary
code in the compiler.
BUG=angle:466
Change-Id: I664ffc82de5f2723156e51f4e9ffc07e4de162aa
Reviewed-on: https://chromium-review.googlesource.com/207781
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
|
|
28f70c3a
|
2014-07-18T10:33:10
|
|
Remove sh::Uniform::registerIndex and elementIndex.
With the previous cleanups, these fields aren't needed any longer.
We can also clean up some unused methods and simplify existing code.
BUG=angle:466
Change-Id: I96df8d152324bda5e6868b5eccdf52bdc09155e9
Reviewed-on: https://chromium-review.googlesource.com/207256
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
|
|
9fe25e9e
|
2014-07-18T10:33:08
|
|
Add a uniform register query to the translator.
This returns the uniform index that we assigned for default uniforms.
All the dependent structure offsets can be determined from the base
register, so we won't have to store uniform information in the shader
variable.
BUG=angle:466
Change-Id: I0dd05251e8dba00c20d09fd865dfb150de56738e
Reviewed-on: https://chromium-review.googlesource.com/207254
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
|
|
fc43d273
|
2014-07-11T17:02:02
|
|
Remove the sh::InterfaceBlock::dataSize member.
We can replace this by doing the same calculation in the HLSL-side
code.
BUG=angle:466
Change-Id: Iecae4a92e9037e851419ce73e6267094ee8071a2
Reviewed-on: https://chromium-review.googlesource.com/207251
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
|
|
d4116ff3
|
2014-07-11T17:02:01
|
|
Remove sh::InterfaceBlock::registerIndex.
This value is HLSL-only and we can use the new query API to hide it
from GLSL programs.
BUG=angle:466
Change-Id: I75dc2fbbf1b29b1f6d561568174a15dea1f5b130
Reviewed-on: https://chromium-review.googlesource.com/207250
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
|
|
4e1fd412
|
2014-07-10T17:50:10
|
|
Store a map of interface block registers.
The shader translator can return the assigned register for a
block via a new API. This will let us delete the member variable
in interface blocks for the register -- a nice thing for GLSL.
BUG=angle:466
Change-Id: I9bc38e0cd031e32f90787be42c2324fc7c79dbf9
Reviewed-on: https://chromium-review.googlesource.com/206828
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
|
|
d5512cd4
|
2014-07-10T17:50:08
|
|
Collect shader outputs and interface block information.
This paves the way for returning ES3-specific info from the shader
translator with the new query methods.
BUG=angle:466
Change-Id: Ib13cdb604854cdf11e9dc00dd94f18eadc946561
Reviewed-on: https://chromium-review.googlesource.com/206770
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
|
|
77f74853
|
2014-07-08T15:02:34
|
|
Add a GetVariableInfo helper method.
This method replaces the similar logic in storing uniforms,
varyings, and interface blocks when collecting variable info.
We can also re-use this method for both GLSL and HLSL programs.
BUG=angle:466
Change-Id: Ie6c13abe0f09f38b2f9b36e117caae4833eaccbf
Reviewed-on: https://chromium-review.googlesource.com/206566
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
|
|
f2575989
|
2014-06-25T16:04:54
|
|
Use the sh namespace for shader variables.
Since these types originate from the translator, use an appropriate
namespace. Also rename some of the gl helper functions to be more
specific to their functionality.
BUG=angle:466
Change-Id: Idc29987b2053b3c40748dd46b581f3dbd8a6fd61
Reviewed-on: https://chromium-review.googlesource.com/204680
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
|
|
f91ce811
|
2014-06-13T10:04:34
|
|
Split OutputHLSL uniform code into new module.
Refactoring patch only, should have no externally visible changes.
BUG=angle:466
Change-Id: I01088a3b2979b96702d0a3c424d26928eb72b5b2
Reviewed-on: https://chromium-review.googlesource.com/203731
Reviewed-by: Nicolas Capens <nicolascapens@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
|