ShaderModule: Fix transform error message

It was being taken from the pre-transformed program, not the post-transformed program.
If we did get a transform error, the string would be empty.

Also change the signature of RunTransforms() to take a Transform* instead of a Manager*. There's nothing special about Manager anymore - it is just a transform that acts as a group of other transforms.

Change-Id: I4ea6cb022b5967b3c6b8c628517727dc3da3be8e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42640
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2021-02-25 13:56:31 +00:00 committed by Commit Bot service account
parent c093db250e
commit 3b201d122f
2 changed files with 11 additions and 13 deletions

View File

@ -867,13 +867,11 @@ namespace dawn_native {
DAWN_TRY(ValidateModule(&program));
}
} else {
{
tint::transform::Manager transformManager;
transformManager.append(
std::make_unique<tint::transform::EmitVertexPointSize>());
transformManager.append(std::make_unique<tint::transform::Spirv>());
DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, &program));
}
tint::transform::Manager transformManager;
transformManager.append(
std::make_unique<tint::transform::EmitVertexPointSize>());
transformManager.append(std::make_unique<tint::transform::Spirv>());
DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, &program));
if (device->IsValidationEnabled()) {
DAWN_TRY(ValidateModule(&program));
@ -911,9 +909,9 @@ namespace dawn_native {
}
#ifdef DAWN_ENABLE_WGSL
ResultOrError<tint::Program> RunTransforms(tint::transform::Manager* manager,
ResultOrError<tint::Program> RunTransforms(tint::transform::Transform* transform,
tint::Program* program) {
tint::transform::Transform::Output output = manager->Run(program);
tint::transform::Transform::Output output = transform->Run(program);
if (output.diagnostics.contains_errors()) {
// TODO(bclayton): Remove Transform::Output::diagnostics - just put diagnostics into
// output.program.
@ -923,8 +921,8 @@ namespace dawn_native {
}
if (!output.program.IsValid()) {
std::string err =
"Tint program failure: " + tint::diag::Formatter{}.format(program->Diagnostics());
std::string err = "Tint program failure: " +
tint::diag::Formatter{}.format(output.program.Diagnostics());
return DAWN_VALIDATION_ERROR(err.c_str());
}
return std::move(output.program);

View File

@ -36,7 +36,7 @@ namespace tint {
class Program;
namespace transform {
class Manager;
class Transform;
class VertexPulling;
} // namespace transform
@ -76,7 +76,7 @@ namespace dawn_native {
RequiredBufferSizes ComputeRequiredBufferSizesForLayout(const EntryPointMetadata& entryPoint,
const PipelineLayoutBase* layout);
#ifdef DAWN_ENABLE_WGSL
ResultOrError<tint::Program> RunTransforms(tint::transform::Manager* manager,
ResultOrError<tint::Program> RunTransforms(tint::transform::Transform* transform,
tint::Program* program);
std::unique_ptr<tint::transform::VertexPulling> MakeVertexPullingTransform(