src/compiler/translator/StructureHLSL.cpp


Log

Author Commit Date CI Message
Olli Etuaho 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>
Olli Etuaho be59c2fb 2016-03-07T11:32:34 Fix ambiguous function call issues in HLSL output D3D compiler can't resolve between these overloaded functions: float4 vec4(float2x2 x0); float4 vec4(float4 x0); Include the parameter types in the function name to disambiguate between overloaded user-defined functions and constructors, like this: float4 vec4_float2x2(float2x2 x0); float4 vec4_float4(float4 x0); This is only done for float2x2 and float4 parameters, other parameter types like float2x3 vs. float3x2 don't need this. BUG=angleproject:1099 BUG=angleproject:1030 TEST=angle_end2end_tests, dEQP-GLES3.functional.attribute_location.* (10 more tests pass), dEQP-GLES2.functional.attribute_location.* Change-Id: Ief047d41b0adbc238393c3c13cb29771cbb83d58 Reviewed-on: https://chromium-review.googlesource.com/329882 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 80d934bb 2015-02-19T10:16:12 Enable MSVS warning 4512. Fix up the missing DISALLOW_COPY_AND_ASSIGN macros and various small problems preventing us from turning on this warning. This should ensure we more often use the DISALLOW macro going forward. Change-Id: I2e1a9d23a31a51279a577fad8dffb8c1530e2ee8 Reviewed-on: https://chromium-review.googlesource.com/251100 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cooper Partin <coopp@microsoft.com> Tested-by: Cooper Partin <coopp@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Austin Kinross 3ae6465f 2015-01-26T15:51:39 Fix lots of variable shadowing in ANGLE BUG=angle:877 Change-Id: I3df0fffb19f5ecbe439fbc2a8d6d239a5dc6b638 Reviewed-on: https://chromium-review.googlesource.com/243334 Tested-by: Austin Kinross <aukinros@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 74cafab1 2015-01-23T23:17:32 Revert "Fix lots of variable shadowing in ANGLE" Caused WebGL CTS failures on the texture-npot test: https://www.khronos.org/registry/webgl/sdk/tests/conformance/textures/texture-npot.html This reverts commit c67e6e9fade44ef8938724e82db11db725e9c8e5. Change-Id: I089e99859231e0d657084ac3647257c650a9da92 Reviewed-on: https://chromium-review.googlesource.com/243041 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Austin Kinross c67e6e9f 2015-01-21T16:01:07 Fix lots of variable shadowing in ANGLE BUG=angle:877 Change-Id: I15168ae32605b26aee08274464ffe68adb5a7e87 Reviewed-on: https://chromium-review.googlesource.com/242351 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Austin Kinross <aukinros@microsoft.com>
Jamie Madill 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>
Jamie Madill f4e39bfd 2014-08-01T17:22:17 Fix non-square matrix-to-matrix constructors. This fixes some broken tests in dEQP: functional.shaders.conversions.matrix_to_matrix BUG=angle:712 Change-Id: I0538595f2913a2c1d4f0da901d65d608a6580d19 Reviewed-on: https://chromium-review.googlesource.com/210882 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Jamie Madill cf3af0bd 2014-08-01T17:22:16 Fix non-square scalar-to-matrix constructors. This fixes some broken tests in dEQP: functional.shaders.conversions.scalar_to_matrix BUG=angle:712 Change-Id: Ia01d720307ea6ca70da266b2085a878eaaab2412 Reviewed-on: https://chromium-review.googlesource.com/210881 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Jamie Madill 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>
Jamie Madill 961d5e98 2014-06-20T15:23:34 Use a const_iterator in structsHeader(). This was breaking the build for some compilers (GCC on android). Change-Id: Ibfe5603710961497b6c15aa2d9cb568096ca1dd4 Reviewed-on: https://chromium-review.googlesource.com/204897 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shannon Woods <shannonwoods@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 9e5317f4 2014-06-20T14:56:37 Add end-of-file newline to StructureHLSL.cpp. BUG=angle:680 Change-Id: I37aee0d136021a1ce1c3c398d680cdbc4820e6d0 Reviewed-on: https://chromium-review.googlesource.com/204905 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 8daaba15 2014-06-13T10:04:33 Split OutputHLSL structure code into new module. Refactoring patch only. BUG=angle:466 Change-Id: I2c57096e1e24574e7de3d35d608645fde3b0c681 Reviewed-on: https://chromium-review.googlesource.com/203730 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Nicolas Capens <nicolascapens@chromium.org>