Commit 282fb409 by Shahbaz Youssefi Committed by Commit Bot

Fix link validation of I/O block members

Location and struct name matching for fields was missing as they only apply to I/O blocks and not varyings of struct type. Bug: angleproject:3580 Change-Id: I69083f39088458da72828b418be3068187a30fcc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2587456Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent da8c2261
......@@ -486,6 +486,11 @@ const char *GetLinkMismatchErrorString(LinkMismatchError linkError)
return "Layout qualifier";
case LinkMismatchError::MATRIX_PACKING_MISMATCH:
return "Matrix Packing";
case LinkMismatchError::FIELD_LOCATION_MISMATCH:
return "Field location";
case LinkMismatchError::FIELD_STRUCT_NAME_MISMATCH:
return "Field structure name";
default:
UNREACHABLE();
return "";
......@@ -3656,8 +3661,21 @@ bool Program::doShaderVariablesMatch(int outputShaderVersion,
bool namesMatch = input.isSameNameAtLinkTime(output);
bool locationsMatch = input.location != -1 && input.location == output.location;
// An output block is considered to match an input block in the subsequent
// shader if the two blocks have the same block name, and the members of the
// block match exactly in name, type, qualification, and declaration order.
//
// - For the purposes of shader interface matching, the gl_PointSize
// member of the intrinsically declared gl_PerVertex shader interface
// block is ignored.
// - Output blocks that do not match in name, but have a location and match
// in every other way listed above may be considered to match by some
// implementations, but not all - so this behaviour should not be relied
// upon.
// An output variable is considered to match an input variable in the subsequent
// shader if:
//
// - the two variables match in name, type, and qualification; or
// - the two variables are declared with the same location qualifier and
// match in type and qualification.
......@@ -3681,8 +3699,7 @@ bool Program::doShaderVariablesMatch(int outputShaderVersion,
return false;
}
// [OpenGL ES 3.1] Chapter 7.4.1 "Shader Interface Matching" Page 91
// TODO(jiawei.shao@intel.com): add validation on input/output blocks matching
// [OpenGL ES 3.2] Chapter 7.4.1 "Shader Interface Matching"
bool Program::linkValidateShaderInterfaceMatching(
const std::vector<sh::ShaderVariable> &outputVaryings,
const std::vector<sh::ShaderVariable> &inputVaryings,
......@@ -4235,6 +4252,19 @@ LinkMismatchError Program::LinkValidateVariablesBase(const sh::ShaderVariable &v
return LinkMismatchError::INTERPOLATION_TYPE_MISMATCH;
}
if (variable1.isShaderIOBlock && variable2.isShaderIOBlock)
{
if (member1.location != member2.location)
{
return LinkMismatchError::FIELD_LOCATION_MISMATCH;
}
if (member1.structName != member2.structName)
{
return LinkMismatchError::FIELD_STRUCT_NAME_MISMATCH;
}
}
LinkMismatchError linkErrorOnField = LinkValidateVariablesBase(
member1, member2, validatePrecision, true, mismatchedStructOrBlockMemberName);
if (linkErrorOnField != LinkMismatchError::NO_MISMATCH)
......
......@@ -85,6 +85,10 @@ enum class LinkMismatchError
// Interface block specific
LAYOUT_QUALIFIER_MISMATCH,
MATRIX_PACKING_MISMATCH,
// I/O block specific
FIELD_LOCATION_MISMATCH,
FIELD_STRUCT_NAME_MISMATCH,
};
void LogLinkMismatch(InfoLog &infoLog,
......
......@@ -189,10 +189,6 @@
3571 VULKAN : dEQP-GLES31.functional.geometry_shading.*transform_feedback* = SKIP
3571 VULKAN : dEQP-GLES31.functional.program_interface_query.transform_feedback_varying.*geo* = SKIP
// Shader I/O blocks:
// Missing matching of struct name in member fields of matching nameless I/O blocks
3580 VULKAN : dEQP-GLES31.functional.separate_shader.validation.es31.io_blocks.mismatch_different_member_struct_names = FAIL
////
//// AMD Vulkan expectations
////
......
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