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

View File

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