Add reflection for used vertex attributes using Tint
BUG=dawn:701 Change-Id: I36e5492cc87afc597d52e5cab9424922fd99dcdc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44200 Auto-Submit: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
6d4617a2d2
commit
54c9b8244d
|
@ -756,6 +756,31 @@ namespace dawn_native {
|
||||||
metadata->localWorkgroupSize.z = entryPoint.workgroup_size_z;
|
metadata->localWorkgroupSize.z = entryPoint.workgroup_size_z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (metadata->stage == SingleShaderStage::Vertex) {
|
||||||
|
for (const auto& input_var : entryPoint.input_variables) {
|
||||||
|
uint32_t location = 0;
|
||||||
|
if (input_var.has_location_decoration) {
|
||||||
|
location = input_var.location_decoration;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DAWN_UNLIKELY(location >= kMaxVertexAttributes)) {
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Attribute location (" << location << ") over limits";
|
||||||
|
return DAWN_VALIDATION_ERROR(ss.str());
|
||||||
|
}
|
||||||
|
metadata->usedVertexAttributes.set(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& output_var : entryPoint.output_variables) {
|
||||||
|
if (DAWN_UNLIKELY(!output_var.has_location_decoration)) {
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Missing location qualifier on vertex output, "
|
||||||
|
<< output_var.name;
|
||||||
|
return DAWN_VALIDATION_ERROR(ss.str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
result[entryPoint.name] = std::move(metadata);
|
result[entryPoint.name] = std::move(metadata);
|
||||||
}
|
}
|
||||||
return std::move(result);
|
return std::move(result);
|
||||||
|
@ -833,6 +858,14 @@ namespace dawn_native {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tintEntry->stage == SingleShaderStage::Vertex) {
|
||||||
|
if (tintEntry->usedVertexAttributes != crossEntry->usedVertexAttributes) {
|
||||||
|
return DAWN_VALIDATION_ERROR(
|
||||||
|
"Tint and SPIRV-Cross returned different values for used vertex "
|
||||||
|
"attributes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(rharrison): Use the Inspector to get this data.
|
// TODO(rharrison): Use the Inspector to get this data.
|
||||||
tintEntry->bindings = crossEntry->bindings;
|
tintEntry->bindings = crossEntry->bindings;
|
||||||
tintEntry->fragmentOutputFormatBaseTypes =
|
tintEntry->fragmentOutputFormatBaseTypes =
|
||||||
|
|
Loading…
Reference in New Issue