ES31: Use indices to access image variables in built-in image functions
In order to implement glBindImageTexture to bind a layer of 3D/2DArray/Cube
texture, use indices to access image variables when translating built-in
image functions.
There is a conflict when transferring image2D/iimage2D/uimage2D variables to
an user defined function. For example,
layout(r32ui, binding = 0) readonly uniform highp uimage2D uImage_1;
layout(r32ui, binding = 1) readonly uniform highp uimage2D uImage_2;
uvec4 lod_fun(uimage2D img, ivec2 p)
{
return imageLoad(img, p);
}
void main()
{
uvec4 value_1 = lod_fun(uImage_1, ivec2(gl_LocalInvocationID.xy));
uvec4 value_2 = lod_fun(uImage_2, ivec2(gl_LocalInvocationID.xy));
}
If uImage_1 binds to a 2D texture, and uImage_2 binds to a layer of 3D texture,
uImage_1 will be translated to Texture2D type, and uImage_2 will be translated to
Texture3D type, "img" type of lod_fun will be translated Texture2D, so uImage_2
cannot be transferred to lod_fun as a parameter.
Indices without Texture/RWTexture information could handle this situation easily.
BUG=angleproject:1987
TEST=angle_end2end_tests.ComputeShaderTest.*
Change-Id: I7647395f0042f613c5d6e9eeb49392ab6252e21e
Reviewed-on: https://chromium-review.googlesource.com/1065797
Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 1f2b066..1c7e090 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -202,8 +202,7 @@
unsigned int firstUniformRegister =
((compileOptions & SH_SKIP_D3D_CONSTANT_REGISTER_ZERO) != 0) ? 1u : 0u;
- mUniformHLSL =
- new UniformHLSL(shaderType, mStructureHLSL, outputType, uniforms, firstUniformRegister);
+ mUniformHLSL = new UniformHLSL(mStructureHLSL, outputType, uniforms, firstUniformRegister);
if (mOutputType == SH_HLSL_3_0_OUTPUT)
{