Commit 2a12b3d5 by Qin Jiajia Committed by Commit Bot

ES31: Add struct uniform block support in compute shader for D3D

BUG=angleproject:2577 TEST=angle_end2end_tests Change-Id: I4d84a10508458444d559013e658ae88cd2923f91 Reviewed-on: https://chromium-review.googlesource.com/1069989 Commit-Queue: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent b001528f
...@@ -626,14 +626,6 @@ void OutputHLSL::header(TInfoSinkBase &out, ...@@ -626,14 +626,6 @@ void OutputHLSL::header(TInfoSinkBase &out,
"\n"; "\n";
} }
if (!mappedStructs.empty())
{
out << "// Structures from std140 blocks with padding removed\n";
out << "\n";
out << mappedStructs;
out << "\n";
}
if (usingMRTExtension && mNumRenderTargets > 1) if (usingMRTExtension && mNumRenderTargets > 1)
{ {
out << "#define GL_USES_MRT\n"; out << "#define GL_USES_MRT\n";
...@@ -738,14 +730,6 @@ void OutputHLSL::header(TInfoSinkBase &out, ...@@ -738,14 +730,6 @@ void OutputHLSL::header(TInfoSinkBase &out,
"dx_DepthRange.y, dx_DepthRange.z};\n" "dx_DepthRange.y, dx_DepthRange.z};\n"
"\n"; "\n";
} }
if (!mappedStructs.empty())
{
out << "// Structures from std140 blocks with padding removed\n";
out << "\n";
out << mappedStructs;
out << "\n";
}
} }
else // Compute shader else // Compute shader
{ {
...@@ -785,6 +769,14 @@ void OutputHLSL::header(TInfoSinkBase &out, ...@@ -785,6 +769,14 @@ void OutputHLSL::header(TInfoSinkBase &out,
} }
} }
if (!mappedStructs.empty())
{
out << "// Structures from std140 blocks with padding removed\n";
out << "\n";
out << mappedStructs;
out << "\n";
}
bool getDimensionsIgnoresBaseLevel = bool getDimensionsIgnoresBaseLevel =
(mCompileOptions & SH_HLSL_GET_DIMENSIONS_IGNORES_BASE_LEVEL) != 0; (mCompileOptions & SH_HLSL_GET_DIMENSIONS_IGNORES_BASE_LEVEL) != 0;
mTextureFunctionHLSL->textureFunctionHeader(out, mOutputType, getDimensionsIgnoresBaseLevel); mTextureFunctionHLSL->textureFunctionHeader(out, mOutputType, getDimensionsIgnoresBaseLevel);
......
...@@ -1278,6 +1278,33 @@ TEST_P(ComputeShaderTest, ExceedCombinedShaderOutputResourcesInCS) ...@@ -1278,6 +1278,33 @@ TEST_P(ComputeShaderTest, ExceedCombinedShaderOutputResourcesInCS)
EXPECT_EQ(0u, computeProgram); EXPECT_EQ(0u, computeProgram);
} }
// Test that uniform block with struct member in compute shader is supported.
TEST_P(ComputeShaderTest, UniformBlockWithStructMember)
{
const std::string csSource =
R"(#version 310 es
layout(local_size_x=8) in;
layout(rgba8) uniform highp readonly image2D mImage2DInput;
layout(rgba8) uniform highp writeonly image2D mImage2DOutput;
struct S {
ivec3 a;
ivec2 b;
};
layout(std140, binding=0) uniform blockName {
S bd;
} instanceName;
void main()
{
ivec2 t1 = instanceName.bd.b;
vec4 result2d = imageLoad(mImage2DInput, t1);
imageStore(mImage2DOutput, ivec2(gl_LocalInvocationID.xy), result2d);
})";
ANGLE_GL_COMPUTE_PROGRAM(program, csSource);
EXPECT_GL_NO_ERROR();
}
// Check that it is not possible to create a compute shader when the context does not support ES // Check that it is not possible to create a compute shader when the context does not support ES
// 3.10 // 3.10
TEST_P(ComputeShaderTestES3, NotSupported) TEST_P(ComputeShaderTestES3, NotSupported)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment