Use the transform manager instead of invoking the transform directly
This will allow us on the Tint side to refactor the transform code to correctly run the type determiner at the end of transforms, instead of hacking it into the transform itself. Bug: tint:308 Change-Id: I4fd5693ec700b2165ce8c08028b09df6cd8591e7 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33123 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dan sinclair <dsinclair@chromium.org> Auto-Submit: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
parent
2ba8f3cec4
commit
ce207be41f
|
@ -258,32 +258,37 @@ namespace dawn_native {
|
|||
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
|
||||
}
|
||||
|
||||
tint::transform::VertexPullingTransform transform(&context, &module);
|
||||
auto state = std::make_unique<tint::transform::VertexStateDescriptor>();
|
||||
for (uint32_t i = 0; i < vertexState.vertexBufferCount; ++i) {
|
||||
auto& vertexBuffer = vertexState.vertexBuffers[i];
|
||||
tint::transform::VertexBufferLayoutDescriptor layout;
|
||||
layout.array_stride = vertexBuffer.arrayStride;
|
||||
layout.step_mode = ToTintInputStepMode(vertexBuffer.stepMode);
|
||||
tint::transform::Manager transformManager(&context, &module);
|
||||
{
|
||||
auto transform =
|
||||
std::make_unique<tint::transform::VertexPullingTransform>(&context, &module);
|
||||
auto state = std::make_unique<tint::transform::VertexStateDescriptor>();
|
||||
for (uint32_t i = 0; i < vertexState.vertexBufferCount; ++i) {
|
||||
auto& vertexBuffer = vertexState.vertexBuffers[i];
|
||||
tint::transform::VertexBufferLayoutDescriptor layout;
|
||||
layout.array_stride = vertexBuffer.arrayStride;
|
||||
layout.step_mode = ToTintInputStepMode(vertexBuffer.stepMode);
|
||||
|
||||
for (uint32_t j = 0; j < vertexBuffer.attributeCount; ++j) {
|
||||
auto& attribute = vertexBuffer.attributes[j];
|
||||
tint::transform::VertexAttributeDescriptor attr;
|
||||
attr.format = ToTintVertexFormat(attribute.format);
|
||||
attr.offset = attribute.offset;
|
||||
attr.shader_location = attribute.shaderLocation;
|
||||
for (uint32_t j = 0; j < vertexBuffer.attributeCount; ++j) {
|
||||
auto& attribute = vertexBuffer.attributes[j];
|
||||
tint::transform::VertexAttributeDescriptor attr;
|
||||
attr.format = ToTintVertexFormat(attribute.format);
|
||||
attr.offset = attribute.offset;
|
||||
attr.shader_location = attribute.shaderLocation;
|
||||
|
||||
layout.attributes.push_back(std::move(attr));
|
||||
layout.attributes.push_back(std::move(attr));
|
||||
}
|
||||
|
||||
state->vertex_buffers.push_back(std::move(layout));
|
||||
}
|
||||
|
||||
state->vertex_buffers.push_back(std::move(layout));
|
||||
transform->SetVertexState(std::move(state));
|
||||
transform->SetEntryPoint(entryPoint);
|
||||
transform->SetPullingBufferBindingSet(pullingBufferBindingSet);
|
||||
transformManager.append(std::move(transform));
|
||||
}
|
||||
transform.SetVertexState(std::move(state));
|
||||
transform.SetEntryPoint(entryPoint);
|
||||
transform.SetPullingBufferBindingSet(pullingBufferBindingSet);
|
||||
|
||||
if (!transform.Run()) {
|
||||
errorStream << "Vertex pulling transform: " << transform.error();
|
||||
if (!transformManager.Run()) {
|
||||
errorStream << "Vertex pulling transform: " << transformManager.error();
|
||||
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -218,9 +218,11 @@ namespace dawn_native { namespace d3d12 {
|
|||
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
|
||||
}
|
||||
|
||||
tint::transform::BoundArrayAccessorsTransform boundArrayTransformer(&context, &module);
|
||||
if (!boundArrayTransformer.Run()) {
|
||||
errorStream << "Bound Array Accessors Transform: " << boundArrayTransformer.error()
|
||||
tint::transform::Manager transformManager(&context, &module);
|
||||
transformManager.append(
|
||||
std::make_unique<tint::transform::BoundArrayAccessorsTransform>(&context, &module));
|
||||
if (!transformManager.Run()) {
|
||||
errorStream << "Bound Array Accessors Transform: " << transformManager.error()
|
||||
<< std::endl;
|
||||
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue